mirror of
https://github.com/streetwriters/notesnook.git
synced 2025-12-19 04:59:33 +01:00
mobile: cleanup console.log statements
This commit is contained in:
@@ -22,12 +22,12 @@ import { GestureHandlerRootView } from "react-native-gesture-handler";
|
|||||||
import { SafeAreaProvider } from "react-native-safe-area-context";
|
import { SafeAreaProvider } from "react-native-safe-area-context";
|
||||||
import { withErrorBoundry } from "./components/exception-handler";
|
import { withErrorBoundry } from "./components/exception-handler";
|
||||||
import Launcher from "./components/launcher";
|
import Launcher from "./components/launcher";
|
||||||
|
import { useAppEvents } from "./hooks/use-app-events";
|
||||||
import { ApplicationHolder } from "./navigation";
|
import { ApplicationHolder } from "./navigation";
|
||||||
import Notifications from "./services/notifications";
|
import Notifications from "./services/notifications";
|
||||||
import SettingsService from "./services/settings";
|
import SettingsService from "./services/settings";
|
||||||
import { TipManager } from "./services/tip-manager";
|
import { TipManager } from "./services/tip-manager";
|
||||||
import { useUserStore } from "./stores/use-user-store";
|
import { useUserStore } from "./stores/use-user-store";
|
||||||
import { useAppEvents } from "./hooks/use-app-events";
|
|
||||||
|
|
||||||
SettingsService.init();
|
SettingsService.init();
|
||||||
SettingsService.checkOrientation();
|
SettingsService.checkOrientation();
|
||||||
@@ -38,9 +38,12 @@ const App = () => {
|
|||||||
if (appLockMode && appLockMode !== "none") {
|
if (appLockMode && appLockMode !== "none") {
|
||||||
useUserStore.getState().setVerifyUser(true);
|
useUserStore.getState().setVerifyUser(true);
|
||||||
}
|
}
|
||||||
setTimeout(() => {
|
setTimeout(async () => {
|
||||||
SettingsService.onFirstLaunch();
|
SettingsService.onFirstLaunch();
|
||||||
Notifications.get();
|
await Notifications.get();
|
||||||
|
if (SettingsService.get().notifNotes) {
|
||||||
|
Notifications.pinQuickNote(true);
|
||||||
|
}
|
||||||
TipManager.init();
|
TipManager.init();
|
||||||
}, 100);
|
}, 100);
|
||||||
}, []);
|
}, []);
|
||||||
|
|||||||
@@ -35,12 +35,10 @@ export async function downloadFile(filename, data, cancelToken) {
|
|||||||
if (!data) return false;
|
if (!data) return false;
|
||||||
let { url, headers } = data;
|
let { url, headers } = data;
|
||||||
|
|
||||||
console.log("downloading file: ", filename, url);
|
|
||||||
let path = `${cacheDir}/${filename}`;
|
let path = `${cacheDir}/${filename}`;
|
||||||
try {
|
try {
|
||||||
let exists = await RNFetchBlob.fs.exists(path);
|
let exists = await RNFetchBlob.fs.exists(path);
|
||||||
if (exists) {
|
if (exists) {
|
||||||
console.log("file is downloaded");
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -120,7 +118,6 @@ export async function downloadAttachment(hash, global = true) {
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
let key = await db.attachments.decryptKey(attachment.key);
|
let key = await db.attachments.decryptKey(attachment.key);
|
||||||
console.log("attachment key", key);
|
|
||||||
let info = {
|
let info = {
|
||||||
iv: attachment.iv,
|
iv: attachment.iv,
|
||||||
salt: attachment.salt,
|
salt: attachment.salt,
|
||||||
@@ -142,10 +139,6 @@ export async function downloadAttachment(hash, global = true) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
if (attachment.dateUploaded) {
|
if (attachment.dateUploaded) {
|
||||||
console.log(
|
|
||||||
"Deleting attachment after download",
|
|
||||||
attachment.dateUploaded
|
|
||||||
);
|
|
||||||
RNFetchBlob.fs
|
RNFetchBlob.fs
|
||||||
.unlink(RNFetchBlob.fs.dirs.CacheDir + `/${attachment.metadata.hash}`)
|
.unlink(RNFetchBlob.fs.dirs.CacheDir + `/${attachment.metadata.hash}`)
|
||||||
.catch(console.log);
|
.catch(console.log);
|
||||||
@@ -177,7 +170,6 @@ export async function downloadAttachment(hash, global = true) {
|
|||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.log("download attachment error: ", e);
|
console.log("download attachment error: ", e);
|
||||||
if (attachment.dateUploaded) {
|
if (attachment.dateUploaded) {
|
||||||
console.log("Deleting attachment on error", attachment.dateUploaded);
|
|
||||||
RNFetchBlob.fs
|
RNFetchBlob.fs
|
||||||
.unlink(RNFetchBlob.fs.dirs.CacheDir + `/${attachment.metadata.hash}`)
|
.unlink(RNFetchBlob.fs.dirs.CacheDir + `/${attachment.metadata.hash}`)
|
||||||
.catch(console.log);
|
.catch(console.log);
|
||||||
@@ -196,8 +188,6 @@ export async function getUploadedFileSize(hash) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
const contentLength = parseInt(attachmentInfo.headers?.get("content-length"));
|
const contentLength = parseInt(attachmentInfo.headers?.get("content-length"));
|
||||||
console.log("contentLength:", contentLength, attachmentInfo.headers);
|
|
||||||
|
|
||||||
return isNaN(contentLength) ? 0 : contentLength;
|
return isNaN(contentLength) ? 0 : contentLength;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -38,7 +38,6 @@ export async function readEncrypted(filename, key, cipherData) {
|
|||||||
},
|
},
|
||||||
true
|
true
|
||||||
);
|
);
|
||||||
console.log("output length: ", output?.length);
|
|
||||||
return output;
|
return output;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
RNFetchBlob.fs.unlink(path).catch(console.log);
|
RNFetchBlob.fs.unlink(path).catch(console.log);
|
||||||
|
|||||||
@@ -56,11 +56,11 @@ export const AnnouncementDialog = () => {
|
|||||||
|
|
||||||
const close = useCallback(() => {
|
const close = useCallback(() => {
|
||||||
if (visible) {
|
if (visible) {
|
||||||
remove(info.id);
|
remove(info?.id);
|
||||||
setInfo(null);
|
setInfo(null);
|
||||||
setVisible(false);
|
setVisible(false);
|
||||||
}
|
}
|
||||||
}, [info.id, remove, visible]);
|
}, [info?.id, remove, visible]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<BaseDialog
|
<BaseDialog
|
||||||
|
|||||||
@@ -83,22 +83,18 @@ export const AttachmentDialog = () => {
|
|||||||
|
|
||||||
const onChangeText = (text) => {
|
const onChangeText = (text) => {
|
||||||
attachmentSearchValue.current = text;
|
attachmentSearchValue.current = text;
|
||||||
console.log(attachmentSearchValue.current?.length);
|
|
||||||
if (
|
if (
|
||||||
!attachmentSearchValue.current ||
|
!attachmentSearchValue.current ||
|
||||||
attachmentSearchValue.current === ""
|
attachmentSearchValue.current === ""
|
||||||
) {
|
) {
|
||||||
console.log("resetting all");
|
|
||||||
setAttachments([...db.attachments.all]);
|
setAttachments([...db.attachments.all]);
|
||||||
}
|
}
|
||||||
console.log(attachments.length);
|
|
||||||
clearTimeout(searchTimer.current);
|
clearTimeout(searchTimer.current);
|
||||||
searchTimer.current = setTimeout(() => {
|
searchTimer.current = setTimeout(() => {
|
||||||
let results = db.lookup.attachments(
|
let results = db.lookup.attachments(
|
||||||
db.attachments.all,
|
db.attachments.all,
|
||||||
attachmentSearchValue.current
|
attachmentSearchValue.current
|
||||||
);
|
);
|
||||||
console.log("results", results.length, attachments.length);
|
|
||||||
if (results.length === 0) return;
|
if (results.length === 0) return;
|
||||||
setAttachments(results);
|
setAttachments(results);
|
||||||
}, 300);
|
}, 300);
|
||||||
|
|||||||
@@ -120,7 +120,6 @@ export const Login = ({ changeMode }) => {
|
|||||||
await sleep(300);
|
await sleep(300);
|
||||||
TwoFactorVerification.present(async (mfa) => {
|
TwoFactorVerification.present(async (mfa) => {
|
||||||
if (mfa) {
|
if (mfa) {
|
||||||
console.log(mfa);
|
|
||||||
await login(mfa);
|
await login(mfa);
|
||||||
} else {
|
} else {
|
||||||
setLoading(false);
|
setLoading(false);
|
||||||
|
|||||||
@@ -96,7 +96,6 @@ export const SessionExpired = () => {
|
|||||||
|
|
||||||
const open = async () => {
|
const open = async () => {
|
||||||
try {
|
try {
|
||||||
console.log("REQUESTING NEW TOKEN");
|
|
||||||
let res = await db.user.tokenManager.getToken();
|
let res = await db.user.tokenManager.getToken();
|
||||||
if (!res) throw new Error("no token found");
|
if (!res) throw new Error("no token found");
|
||||||
if (db.user.tokenManager._isTokenExpired(res))
|
if (db.user.tokenManager._isTokenExpired(res))
|
||||||
@@ -162,7 +161,6 @@ export const SessionExpired = () => {
|
|||||||
if (e.message === "Multifactor authentication required.") {
|
if (e.message === "Multifactor authentication required.") {
|
||||||
TwoFactorVerification.present(async (mfa) => {
|
TwoFactorVerification.present(async (mfa) => {
|
||||||
if (mfa) {
|
if (mfa) {
|
||||||
console.log(mfa);
|
|
||||||
await login(mfa);
|
await login(mfa);
|
||||||
} else {
|
} else {
|
||||||
setLoading(false);
|
setLoading(false);
|
||||||
|
|||||||
@@ -68,7 +68,6 @@ const TwoFactorVerification = ({ onMfaLogin, mfaInfo }) => {
|
|||||||
const length = currentMethod.method === "recoveryCode" ? 8 : 6;
|
const length = currentMethod.method === "recoveryCode" ? 8 : 6;
|
||||||
|
|
||||||
if (!code.current || code.current.length !== length) return;
|
if (!code.current || code.current.length !== length) return;
|
||||||
console.log(currentMethod.method, code.current);
|
|
||||||
setLoading(true);
|
setLoading(true);
|
||||||
inputRef.current?.blur();
|
inputRef.current?.blur();
|
||||||
await onMfaLogin(
|
await onMfaLogin(
|
||||||
@@ -77,7 +76,6 @@ const TwoFactorVerification = ({ onMfaLogin, mfaInfo }) => {
|
|||||||
code: code.current
|
code: code.current
|
||||||
},
|
},
|
||||||
(result) => {
|
(result) => {
|
||||||
console.log("result recieved");
|
|
||||||
if (result) {
|
if (result) {
|
||||||
eSendEvent(eCloseProgressDialog, "two_factor_verify");
|
eSendEvent(eCloseProgressDialog, "two_factor_verify");
|
||||||
}
|
}
|
||||||
@@ -137,7 +135,6 @@ const TwoFactorVerification = ({ onMfaLogin, mfaInfo }) => {
|
|||||||
// TODO
|
// TODO
|
||||||
setSending(true);
|
setSending(true);
|
||||||
try {
|
try {
|
||||||
console.log("sending code", currentMethod.method, mfaInfo.token);
|
|
||||||
await db.mfa.sendCode(currentMethod.method, mfaInfo.token);
|
await db.mfa.sendCode(currentMethod.method, mfaInfo.token);
|
||||||
start(60);
|
start(60);
|
||||||
setSending(false);
|
setSending(false);
|
||||||
@@ -301,12 +298,10 @@ const TwoFactorVerification = ({ onMfaLogin, mfaInfo }) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
TwoFactorVerification.present = (onMfaLogin, data, context) => {
|
TwoFactorVerification.present = (onMfaLogin, data, context) => {
|
||||||
console.log("presenting sheet");
|
|
||||||
presentSheet({
|
presentSheet({
|
||||||
component: <TwoFactorVerification onMfaLogin={onMfaLogin} mfaInfo={data} />,
|
component: <TwoFactorVerification onMfaLogin={onMfaLogin} mfaInfo={data} />,
|
||||||
context: context || "two_factor_verify",
|
context: context || "two_factor_verify",
|
||||||
onClose: () => {
|
onClose: () => {
|
||||||
console.log("on close called");
|
|
||||||
onMfaLogin();
|
onMfaLogin();
|
||||||
},
|
},
|
||||||
disableClosing: true
|
disableClosing: true
|
||||||
|
|||||||
@@ -50,7 +50,6 @@ const JumpToSectionDialog = ({ scrollRef, data, type }) => {
|
|||||||
let ind = notes.findIndex(
|
let ind = notes.findIndex(
|
||||||
(i) => i.title === item.title && i.type === "header"
|
(i) => i.title === item.title && i.type === "header"
|
||||||
);
|
);
|
||||||
console.log(scrollRef.current);
|
|
||||||
scrollRef.current?.scrollToIndex({
|
scrollRef.current?.scrollToIndex({
|
||||||
index: ind,
|
index: ind,
|
||||||
animated: true
|
animated: true
|
||||||
|
|||||||
@@ -406,7 +406,6 @@ export class VaultDialog extends Component {
|
|||||||
type: "error",
|
type: "error",
|
||||||
context: "local"
|
context: "local"
|
||||||
});
|
});
|
||||||
console.log("returning from here");
|
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
await db.vault.add(this.state.note.id);
|
await db.vault.add(this.state.note.id);
|
||||||
@@ -863,7 +862,6 @@ export class VaultDialog extends Component {
|
|||||||
((!this.state.biometricUnlock && !changePassword) || !novault) ? (
|
((!this.state.biometricUnlock && !changePassword) || !novault) ? (
|
||||||
<Button
|
<Button
|
||||||
onPress={() => {
|
onPress={() => {
|
||||||
console.log(this.state.biometricUnlock);
|
|
||||||
this.setState({
|
this.setState({
|
||||||
biometricUnlock: !this.state.biometricUnlock
|
biometricUnlock: !this.state.biometricUnlock
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -19,7 +19,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||||||
|
|
||||||
import React from "react";
|
import React from "react";
|
||||||
import { NotebookItem } from ".";
|
import { NotebookItem } from ".";
|
||||||
import Notebook from "../../../screens/notebook";
|
|
||||||
import { TopicNotes } from "../../../screens/notes/topic-notes";
|
import { TopicNotes } from "../../../screens/notes/topic-notes";
|
||||||
import { ToastEvent } from "../../../services/event-manager";
|
import { ToastEvent } from "../../../services/event-manager";
|
||||||
import Navigation from "../../../services/navigation";
|
import Navigation from "../../../services/navigation";
|
||||||
@@ -30,6 +29,23 @@ import { db } from "../../../common/database";
|
|||||||
import { presentDialog } from "../../dialog/functions";
|
import { presentDialog } from "../../dialog/functions";
|
||||||
import SelectionWrapper from "../selection-wrapper";
|
import SelectionWrapper from "../selection-wrapper";
|
||||||
|
|
||||||
|
const navigateToNotebook = (item, canGoBack) => {
|
||||||
|
if (!item) return;
|
||||||
|
Navigation.navigate <
|
||||||
|
"Notebook" >
|
||||||
|
({
|
||||||
|
title: item.title,
|
||||||
|
name: "Notebook",
|
||||||
|
id: item.id,
|
||||||
|
type: "notebook"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: item.title,
|
||||||
|
item: item,
|
||||||
|
canGoBack
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
export const openNotebookTopic = (item) => {
|
export const openNotebookTopic = (item) => {
|
||||||
const isTrash = item.type === "trash";
|
const isTrash = item.type === "trash";
|
||||||
if (history.selectedItemsList.length > 0 && history.selectionMode) {
|
if (history.selectedItemsList.length > 0 && history.selectionMode) {
|
||||||
@@ -79,7 +95,7 @@ export const openNotebookTopic = (item) => {
|
|||||||
if (item.type === "topic") {
|
if (item.type === "topic") {
|
||||||
TopicNotes.navigate(item, true);
|
TopicNotes.navigate(item, true);
|
||||||
} else {
|
} else {
|
||||||
Notebook.navigate(item, true);
|
navigateToNotebook(item, true);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -52,7 +52,6 @@ export const Expiring = () => {
|
|||||||
extend: true
|
extend: true
|
||||||
});
|
});
|
||||||
const pricing = usePricing("yearly");
|
const pricing = usePricing("yearly");
|
||||||
console.log(pricing?.info?.discount);
|
|
||||||
|
|
||||||
const promo = status.offer
|
const promo = status.offer
|
||||||
? {
|
? {
|
||||||
|
|||||||
@@ -350,7 +350,6 @@ export const PricingPlans = ({
|
|||||||
positiveText: "Apply",
|
positiveText: "Apply",
|
||||||
positivePress: async (value) => {
|
positivePress: async (value) => {
|
||||||
if (!value) return;
|
if (!value) return;
|
||||||
console.log(value);
|
|
||||||
eSendEvent(eCloseSimpleDialog);
|
eSendEvent(eCloseSimpleDialog);
|
||||||
setBuying(true);
|
setBuying(true);
|
||||||
try {
|
try {
|
||||||
@@ -534,9 +533,7 @@ export const PricingPlans = ({
|
|||||||
onPress={() => {
|
onPress={() => {
|
||||||
openLinkInBrowser("https://notesnook.com/tos", colors)
|
openLinkInBrowser("https://notesnook.com/tos", colors)
|
||||||
.catch(() => {})
|
.catch(() => {})
|
||||||
.then(() => {
|
.then(() => {});
|
||||||
console.log("closed");
|
|
||||||
});
|
|
||||||
}}
|
}}
|
||||||
style={{
|
style={{
|
||||||
textDecorationLine: "underline"
|
textDecorationLine: "underline"
|
||||||
@@ -551,9 +548,7 @@ export const PricingPlans = ({
|
|||||||
onPress={() => {
|
onPress={() => {
|
||||||
openLinkInBrowser("https://notesnook.com/privacy", colors)
|
openLinkInBrowser("https://notesnook.com/privacy", colors)
|
||||||
.catch(() => {})
|
.catch(() => {})
|
||||||
.then(() => {
|
.then(() => {});
|
||||||
console.log("closed");
|
|
||||||
});
|
|
||||||
}}
|
}}
|
||||||
style={{
|
style={{
|
||||||
textDecorationLine: "underline"
|
textDecorationLine: "underline"
|
||||||
|
|||||||
@@ -36,7 +36,6 @@ export default function Notebooks({ note, close }) {
|
|||||||
let notebooks = [];
|
let notebooks = [];
|
||||||
for (let notebook of item.notebooks) {
|
for (let notebook of item.notebooks) {
|
||||||
let item_notebook = db.notebooks.notebook(notebook.id);
|
let item_notebook = db.notebooks.notebook(notebook.id);
|
||||||
console.log(notebook);
|
|
||||||
if (item_notebook) {
|
if (item_notebook) {
|
||||||
let data = {
|
let data = {
|
||||||
id: notebook.id,
|
id: notebook.id,
|
||||||
|
|||||||
@@ -119,7 +119,7 @@ const MoveNoteComponent = ({ note }) => {
|
|||||||
topics: [],
|
topics: [],
|
||||||
id: null
|
id: null
|
||||||
});
|
});
|
||||||
console.log("added notebook id", id);
|
|
||||||
setExpanded(id);
|
setExpanded(id);
|
||||||
openAddTopicDialog(db.notebooks.notebook(id).data);
|
openAddTopicDialog(db.notebooks.notebook(id).data);
|
||||||
notebookInput.current?.clear();
|
notebookInput.current?.clear();
|
||||||
@@ -137,7 +137,7 @@ const MoveNoteComponent = ({ note }) => {
|
|||||||
});
|
});
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
console.log(item.id);
|
|
||||||
await db.notebooks.notebook(item.id).topics.add(value);
|
await db.notebooks.notebook(item.id).topics.add(value);
|
||||||
setNotebooks();
|
setNotebooks();
|
||||||
updateNoteExists();
|
updateNoteExists();
|
||||||
@@ -198,7 +198,6 @@ const MoveNoteComponent = ({ note }) => {
|
|||||||
if (topic.type !== "topic") continue;
|
if (topic.type !== "topic") continue;
|
||||||
for (let id of notes) {
|
for (let id of notes) {
|
||||||
if (topic.notes.indexOf(id) > -1) {
|
if (topic.notes.indexOf(id) > -1) {
|
||||||
console.log("found", ids.indexOf(notebooks[i].id));
|
|
||||||
if (ids.indexOf(notebooks[i].id) === -1) {
|
if (ids.indexOf(notebooks[i].id) === -1) {
|
||||||
ids.push(notebooks[i].id);
|
ids.push(notebooks[i].id);
|
||||||
}
|
}
|
||||||
@@ -208,7 +207,7 @@ const MoveNoteComponent = ({ note }) => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
console.log("ids: ", ids);
|
|
||||||
setNoteExists(ids);
|
setNoteExists(ids);
|
||||||
}, [note?.id, selectedItemsList]);
|
}, [note?.id, selectedItemsList]);
|
||||||
|
|
||||||
|
|||||||
@@ -59,7 +59,6 @@ const ManageTagsSheet = () => {
|
|||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (visible) {
|
if (visible) {
|
||||||
console.log("sorting tags");
|
|
||||||
sortTags();
|
sortTags();
|
||||||
}
|
}
|
||||||
}, [allTags, note, query, sortTags, visible]);
|
}, [allTags, note, query, sortTags, visible]);
|
||||||
|
|||||||
@@ -126,25 +126,21 @@ const RestoreDataComponent = ({ close, setRestoring, restoring }) => {
|
|||||||
backup = await RNFetchBlob.fs.readFile(prefix + item.path, "utf8");
|
backup = await RNFetchBlob.fs.readFile(prefix + item.path, "utf8");
|
||||||
}
|
}
|
||||||
backup = JSON.parse(backup);
|
backup = JSON.parse(backup);
|
||||||
console.log("backup encrypted:", backup.data.iv && backup.data.salt);
|
|
||||||
|
|
||||||
if (backup.data.iv && backup.data.salt) {
|
if (backup.data.iv && backup.data.salt) {
|
||||||
withPassword(
|
withPassword(
|
||||||
async (value) => {
|
async (value) => {
|
||||||
try {
|
try {
|
||||||
console.log("password for backup:", value);
|
|
||||||
await restoreBackup(backup, value);
|
await restoreBackup(backup, value);
|
||||||
close();
|
close();
|
||||||
setRestoring(false);
|
setRestoring(false);
|
||||||
return true;
|
return true;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
backupError(e);
|
backupError(e);
|
||||||
console.log("return false");
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
() => {
|
() => {
|
||||||
console.log("closed");
|
|
||||||
setRestoring(false);
|
setRestoring(false);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
@@ -257,7 +253,6 @@ const RestoreDataComponent = ({ close, setRestoring, restoring }) => {
|
|||||||
);
|
);
|
||||||
|
|
||||||
const restoreBackup = async (backup, password) => {
|
const restoreBackup = async (backup, password) => {
|
||||||
console.log(password, "password");
|
|
||||||
await db.backup.import(backup, password);
|
await db.backup.import(backup, password);
|
||||||
setRestoring(false);
|
setRestoring(false);
|
||||||
initialize();
|
initialize();
|
||||||
@@ -289,15 +284,10 @@ const RestoreDataComponent = ({ close, setRestoring, restoring }) => {
|
|||||||
DocumentPicker.pickSingle()
|
DocumentPicker.pickSingle()
|
||||||
.then((r) => {
|
.then((r) => {
|
||||||
setRestoring(true);
|
setRestoring(true);
|
||||||
console.log(r.uri);
|
|
||||||
fetch(r.uri)
|
fetch(r.uri)
|
||||||
.then(async (r) => {
|
.then(async (r) => {
|
||||||
try {
|
try {
|
||||||
let backup = await r.json();
|
let backup = await r.json();
|
||||||
console.log(
|
|
||||||
"backup encrypted:",
|
|
||||||
backup.data.iv && backup.data.salt
|
|
||||||
);
|
|
||||||
if (backup.data.iv && backup.data.salt) {
|
if (backup.data.iv && backup.data.salt) {
|
||||||
withPassword(
|
withPassword(
|
||||||
async (value) => {
|
async (value) => {
|
||||||
@@ -313,7 +303,6 @@ const RestoreDataComponent = ({ close, setRestoring, restoring }) => {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
() => {
|
() => {
|
||||||
console.log("closed");
|
|
||||||
setRestoring(false);
|
setRestoring(false);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
@@ -400,7 +389,6 @@ const RestoreDataComponent = ({ close, setRestoring, restoring }) => {
|
|||||||
} else {
|
} else {
|
||||||
subfolder = folder;
|
subfolder = folder;
|
||||||
}
|
}
|
||||||
console.log(subfolder, folder);
|
|
||||||
SettingsService.set({
|
SettingsService.set({
|
||||||
backupDirectoryAndroid: subfolder
|
backupDirectoryAndroid: subfolder
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -67,7 +67,6 @@ export const Update = ({ version: appVersion, fwdRef }) => {
|
|||||||
if (!version) {
|
if (!version) {
|
||||||
(async () => {
|
(async () => {
|
||||||
try {
|
try {
|
||||||
console.log("checking for new version");
|
|
||||||
let v = await checkVersion();
|
let v = await checkVersion();
|
||||||
setVersion(v);
|
setVersion(v);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
|||||||
@@ -105,7 +105,6 @@ const ColorItem = React.memo(
|
|||||||
if (!value || value.trim().length === 0) return;
|
if (!value || value.trim().length === 0) return;
|
||||||
await db.colors.rename(item.id, value);
|
await db.colors.rename(item.id, value);
|
||||||
setColorNotes();
|
setColorNotes();
|
||||||
console.log("color updated");
|
|
||||||
},
|
},
|
||||||
positiveText: "Rename"
|
positiveText: "Rename"
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -40,7 +40,6 @@ export const UserStatus = () => {
|
|||||||
const lastSynced = useUserStore((state) => state.lastSynced);
|
const lastSynced = useUserStore((state) => state.lastSynced);
|
||||||
const insets = useSafeAreaInsets();
|
const insets = useSafeAreaInsets();
|
||||||
const { progress } = useSyncProgress();
|
const { progress } = useSyncProgress();
|
||||||
console.log("SYNC PROGRESS", progress);
|
|
||||||
return (
|
return (
|
||||||
<View
|
<View
|
||||||
style={{
|
style={{
|
||||||
|
|||||||
@@ -260,8 +260,6 @@ export const FluidTabs = forwardRef<TabsRef, TabProps>(function FluidTabs(
|
|||||||
};
|
};
|
||||||
})
|
})
|
||||||
.onStart((event) => {
|
.onStart((event) => {
|
||||||
console.log("gesture activated");
|
|
||||||
|
|
||||||
let vx = event.velocityX;
|
let vx = event.velocityX;
|
||||||
let vy = event.velocityY;
|
let vy = event.velocityY;
|
||||||
|
|
||||||
@@ -270,7 +268,6 @@ export const FluidTabs = forwardRef<TabsRef, TabProps>(function FluidTabs(
|
|||||||
// if vy is greater than vx, user is swiping vertically. lock swiping.
|
// if vy is greater than vx, user is swiping vertically. lock swiping.
|
||||||
if (vy > vx) locked.value = true;
|
if (vy > vx) locked.value = true;
|
||||||
// if dividend of vx/vy is less than 4, user is swiping diagonally. lock swiping
|
// if dividend of vx/vy is less than 4, user is swiping diagonally. lock swiping
|
||||||
console.log(vx / vy);
|
|
||||||
if (vx / vy < 1.5) locked.value = true;
|
if (vx / vy < 1.5) locked.value = true;
|
||||||
startX.value = translateX.value;
|
startX.value = translateX.value;
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -150,7 +150,6 @@ const Input = ({
|
|||||||
strictDetection: true,
|
strictDetection: true,
|
||||||
validateMobilePrefix: true
|
validateMobilePrefix: true
|
||||||
});
|
});
|
||||||
console.log(result);
|
|
||||||
isError = result.isValid;
|
isError = result.isValid;
|
||||||
if (result.isValid) {
|
if (result.isValid) {
|
||||||
onChangeText && onChangeText(result.phoneNumber);
|
onChangeText && onChangeText(result.phoneNumber);
|
||||||
|
|||||||
@@ -133,7 +133,6 @@ let walkthroughState: { [name: string]: boolean } = {};
|
|||||||
Walkthrough.update = async (
|
Walkthrough.update = async (
|
||||||
id: "notebooks" | "trialstarted" | "emailconfirmed" | "prouser"
|
id: "notebooks" | "trialstarted" | "emailconfirmed" | "prouser"
|
||||||
) => {
|
) => {
|
||||||
console.log("walkthrough state", walkthroughState);
|
|
||||||
if (walkthroughState[id]) return;
|
if (walkthroughState[id]) return;
|
||||||
walkthroughState[id] = true;
|
walkthroughState[id] = true;
|
||||||
MMKV.setItem("walkthroughState", JSON.stringify(walkthroughState));
|
MMKV.setItem("walkthroughState", JSON.stringify(walkthroughState));
|
||||||
@@ -143,7 +142,6 @@ Walkthrough.init = async () => {
|
|||||||
const json = MMKV.getString("walkthroughState");
|
const json = MMKV.getString("walkthroughState");
|
||||||
if (json) {
|
if (json) {
|
||||||
walkthroughState = JSON.parse(json);
|
walkthroughState = JSON.parse(json);
|
||||||
console.log(walkthroughState);
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -154,7 +152,6 @@ Walkthrough.present = async (
|
|||||||
) => {
|
) => {
|
||||||
if (!nopersist) {
|
if (!nopersist) {
|
||||||
if (!walkthroughState || Object.keys(walkthroughState).length === 0) {
|
if (!walkthroughState || Object.keys(walkthroughState).length === 0) {
|
||||||
console.log("late init of walkthrough state");
|
|
||||||
await Walkthrough.init();
|
await Walkthrough.init();
|
||||||
}
|
}
|
||||||
if (walkthroughState[id]) return;
|
if (walkthroughState[id]) return;
|
||||||
|
|||||||
@@ -66,7 +66,6 @@ export const useActions = ({ close = () => null, item }) => {
|
|||||||
const [isPinnedToMenu, setIsPinnedToMenu] = useState(
|
const [isPinnedToMenu, setIsPinnedToMenu] = useState(
|
||||||
db.settings.isPinned(item.id)
|
db.settings.isPinned(item.id)
|
||||||
);
|
);
|
||||||
console.log(item.readonly, "readonly");
|
|
||||||
const user = useUserStore((state) => state.user);
|
const user = useUserStore((state) => state.user);
|
||||||
const [notifPinned, setNotifPinned] = useState(null);
|
const [notifPinned, setNotifPinned] = useState(null);
|
||||||
const alias = item.alias || item.title;
|
const alias = item.alias || item.title;
|
||||||
@@ -175,7 +174,6 @@ export const useActions = ({ close = () => null, item }) => {
|
|||||||
|
|
||||||
async function pinToNotifications() {
|
async function pinToNotifications() {
|
||||||
if (!checkNoteSynced()) return;
|
if (!checkNoteSynced()) return;
|
||||||
console.log("pinToNotifications");
|
|
||||||
if (Platform.OS === "ios") return;
|
if (Platform.OS === "ios") return;
|
||||||
|
|
||||||
if (notifPinned !== null) {
|
if (notifPinned !== null) {
|
||||||
@@ -473,7 +471,6 @@ export const useActions = ({ close = () => null, item }) => {
|
|||||||
} else {
|
} else {
|
||||||
try {
|
try {
|
||||||
close();
|
close();
|
||||||
console.log("moving note to trash");
|
|
||||||
await deleteItems(item);
|
await deleteItems(item);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error(e);
|
console.error(e);
|
||||||
@@ -584,7 +581,6 @@ export const useActions = ({ close = () => null, item }) => {
|
|||||||
);
|
);
|
||||||
close();
|
close();
|
||||||
};
|
};
|
||||||
console.log("isNoteInTopic", isNoteInTopic());
|
|
||||||
const actions = [
|
const actions = [
|
||||||
{
|
{
|
||||||
name: "Add to notebook",
|
name: "Add to notebook",
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ import {
|
|||||||
import PremiumService from "../services/premium";
|
import PremiumService from "../services/premium";
|
||||||
import SettingsService from "../services/settings";
|
import SettingsService from "../services/settings";
|
||||||
import { updateStatusBarColor } from "../utils/color-scheme";
|
import { updateStatusBarColor } from "../utils/color-scheme";
|
||||||
import { db } from "../common/database";
|
import { DatabaseLogger, db } from "../common/database";
|
||||||
import { MMKV } from "../common/database/mmkv";
|
import { MMKV } from "../common/database/mmkv";
|
||||||
import {
|
import {
|
||||||
eClearEditor,
|
eClearEditor,
|
||||||
@@ -83,20 +83,17 @@ export const useAppEvents = () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
const onLoadingAttachmentProgress = (data) => {
|
const onLoadingAttachmentProgress = (data) => {
|
||||||
console.log("loading", data);
|
|
||||||
useAttachmentStore
|
useAttachmentStore
|
||||||
.getState()
|
.getState()
|
||||||
.setLoading(data.total === data.current ? null : data);
|
.setLoading(data.total === data.current ? null : data);
|
||||||
};
|
};
|
||||||
|
|
||||||
const onFileEncryptionProgress = ({ total, progress }) => {
|
const onFileEncryptionProgress = ({ total, progress }) => {
|
||||||
console.log("encryption progress: ", (progress / total).toFixed(2));
|
|
||||||
useAttachmentStore
|
useAttachmentStore
|
||||||
.getState()
|
.getState()
|
||||||
.setEncryptionProgress((progress / total).toFixed(2));
|
.setEncryptionProgress((progress / total).toFixed(2));
|
||||||
};
|
};
|
||||||
const onSyncProgress = ({ type, total, current }) => {
|
const onSyncProgress = ({ type, total, current }) => {
|
||||||
console.log(type, total, current);
|
|
||||||
if (type !== "download") return;
|
if (type !== "download") return;
|
||||||
if (total < 10 || current % 10 === 0) {
|
if (total < 10 || current % 10 === 0) {
|
||||||
initAfterSync();
|
initAfterSync();
|
||||||
@@ -210,7 +207,6 @@ export const useAppEvents = () => {
|
|||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
const onSyncComplete = useCallback(async () => {
|
const onSyncComplete = useCallback(async () => {
|
||||||
console.log("sync complete");
|
|
||||||
initAfterSync();
|
initAfterSync();
|
||||||
setLastSynced(await db.lastSynced());
|
setLastSynced(await db.lastSynced());
|
||||||
eSendEvent(eCloseProgressDialog, "sync_progress");
|
eSendEvent(eCloseProgressDialog, "sync_progress");
|
||||||
@@ -271,7 +267,7 @@ export const useAppEvents = () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const onRequestPartialSync = async (full, force) => {
|
const onRequestPartialSync = async (full, force) => {
|
||||||
console.log("auto sync request", full, force);
|
DatabaseLogger.info(`onRequestPartialSync full:${full}, force:${force}`);
|
||||||
if (full || force) {
|
if (full || force) {
|
||||||
await Sync.run("global", force, full);
|
await Sync.run("global", force, full);
|
||||||
} else {
|
} else {
|
||||||
@@ -280,7 +276,7 @@ export const useAppEvents = () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const onLogout = async (reason) => {
|
const onLogout = async (reason) => {
|
||||||
console.log("LOGOUT", reason);
|
console.log("Logged out", reason);
|
||||||
};
|
};
|
||||||
|
|
||||||
const unsubIAP = () => {
|
const unsubIAP = () => {
|
||||||
@@ -296,7 +292,6 @@ export const useAppEvents = () => {
|
|||||||
|
|
||||||
const onUserUpdated = useCallback(
|
const onUserUpdated = useCallback(
|
||||||
async (login) => {
|
async (login) => {
|
||||||
console.log(`onUserUpdated: ${login}`);
|
|
||||||
let user;
|
let user;
|
||||||
try {
|
try {
|
||||||
user = await db.user.getUser();
|
user = await db.user.getUser();
|
||||||
@@ -367,7 +362,6 @@ export const useAppEvents = () => {
|
|||||||
|
|
||||||
const onAppStateChanged = useCallback(
|
const onAppStateChanged = useCallback(
|
||||||
async (state) => {
|
async (state) => {
|
||||||
console.log("onAppStateChanged");
|
|
||||||
if (state === "active") {
|
if (state === "active") {
|
||||||
updateStatusBarColor();
|
updateStatusBarColor();
|
||||||
if (
|
if (
|
||||||
@@ -436,7 +430,6 @@ export const useAppEvents = () => {
|
|||||||
}
|
}
|
||||||
refValues.current.isReconnecting = true;
|
refValues.current.isReconnecting = true;
|
||||||
let state = connection;
|
let state = connection;
|
||||||
console.log("SSE:", "TRYING TO RECONNECT");
|
|
||||||
try {
|
try {
|
||||||
if (!state) {
|
if (!state) {
|
||||||
state = await NetInfo.fetch();
|
state = await NetInfo.fetch();
|
||||||
@@ -482,10 +475,7 @@ export const useAppEvents = () => {
|
|||||||
initAfterSync();
|
initAfterSync();
|
||||||
eSendEvent(refreshNotesPage);
|
eSendEvent(refreshNotesPage);
|
||||||
}
|
}
|
||||||
console.log(
|
|
||||||
"CHECK INTENT STATE",
|
|
||||||
notesAddedFromIntent || shareExtensionOpened
|
|
||||||
);
|
|
||||||
if (notesAddedFromIntent || shareExtensionOpened) {
|
if (notesAddedFromIntent || shareExtensionOpened) {
|
||||||
let id = useEditorStore.getState().currentEditingNote;
|
let id = useEditorStore.getState().currentEditingNote;
|
||||||
let note = id && db.notes.note(id).data;
|
let note = id && db.notes.note(id).data;
|
||||||
|
|||||||
@@ -37,8 +37,6 @@ export const useAttachmentProgress = (attachment, encryption) => {
|
|||||||
let loaded = prog.type === "download" ? prog.recieved : prog.sent;
|
let loaded = prog.type === "download" ? prog.recieved : prog.sent;
|
||||||
prog = loaded / prog.total;
|
prog = loaded / prog.total;
|
||||||
prog = (prog * 100).toFixed(0);
|
prog = (prog * 100).toFixed(0);
|
||||||
console.log("progress: ", prog);
|
|
||||||
console.log(prog);
|
|
||||||
setCurrentProgress({
|
setCurrentProgress({
|
||||||
value: prog,
|
value: prog,
|
||||||
percent: prog + "%",
|
percent: prog + "%",
|
||||||
|
|||||||
@@ -38,7 +38,6 @@ export const useNavigationFocus = (
|
|||||||
const _onFocus = useCallback(() => {
|
const _onFocus = useCallback(() => {
|
||||||
setTimeout(
|
setTimeout(
|
||||||
() => {
|
() => {
|
||||||
console.log("on focus", prev);
|
|
||||||
const shouldFocus = onFocus ? onFocus(prev) : true;
|
const shouldFocus = onFocus ? onFocus(prev) : true;
|
||||||
if (shouldFocus) {
|
if (shouldFocus) {
|
||||||
setFocused(true);
|
setFocused(true);
|
||||||
|
|||||||
@@ -58,13 +58,6 @@ export const usePricing = (period: "monthly" | "yearly") => {
|
|||||||
let product = products.find((p) => p.productId === skuInfo?.sku);
|
let product = products.find((p) => p.productId === skuInfo?.sku);
|
||||||
if (!product)
|
if (!product)
|
||||||
product = products.find((p) => p.productId === getDefaultSku(period));
|
product = products.find((p) => p.productId === getDefaultSku(period));
|
||||||
console.log(
|
|
||||||
"skuInfos: ",
|
|
||||||
skuInfos,
|
|
||||||
product?.productId,
|
|
||||||
product?.price,
|
|
||||||
products.length
|
|
||||||
);
|
|
||||||
setCurrent({
|
setCurrent({
|
||||||
info: skuInfo,
|
info: skuInfo,
|
||||||
period,
|
period,
|
||||||
|
|||||||
@@ -25,7 +25,6 @@ function getSecondsLeft(id?: string) {
|
|||||||
const endTime = timers[id || ""];
|
const endTime = timers[id || ""];
|
||||||
if (!endTime) return 0;
|
if (!endTime) return 0;
|
||||||
if (endTime < Date.now()) return 0;
|
if (endTime < Date.now()) return 0;
|
||||||
console.log((endTime - Date.now()) / 1000);
|
|
||||||
return ((endTime - Date.now()) / 1000).toFixed(0);
|
return ((endTime - Date.now()) / 1000).toFixed(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -35,15 +34,13 @@ const useTimer = (initialId?: string) => {
|
|||||||
const interval = useRef<NodeJS.Timer>();
|
const interval = useRef<NodeJS.Timer>();
|
||||||
|
|
||||||
const start = (sec: number, currentId = id) => {
|
const start = (sec: number, currentId = id) => {
|
||||||
console.log("started", sec, id);
|
|
||||||
if (!currentId) return;
|
if (!currentId) return;
|
||||||
timers[currentId] = Date.now() + sec * 1000;
|
timers[currentId] = Date.now() + sec * 1000;
|
||||||
console.log("timers:", timers[currentId]);
|
|
||||||
setSeconds(getSecondsLeft(id));
|
setSeconds(getSecondsLeft(id));
|
||||||
};
|
};
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
console.log(seconds);
|
|
||||||
interval.current = setInterval(() => {
|
interval.current = setInterval(() => {
|
||||||
const timeLeft = getSecondsLeft(id);
|
const timeLeft = getSecondsLeft(id);
|
||||||
setSeconds(timeLeft);
|
setSeconds(timeLeft);
|
||||||
|
|||||||
@@ -39,7 +39,6 @@ export const hideAllTooltips = async () => {
|
|||||||
timers.forEach((t) => t && clearTimeout(t));
|
timers.forEach((t) => t && clearTimeout(t));
|
||||||
for (let target of currentTargets) {
|
for (let target of currentTargets) {
|
||||||
if (target) {
|
if (target) {
|
||||||
console.log("dimissing targets", target);
|
|
||||||
RNTooltips.Dismiss(target);
|
RNTooltips.Dismiss(target);
|
||||||
target = -1;
|
target = -1;
|
||||||
}
|
}
|
||||||
@@ -78,7 +77,6 @@ const useTooltip = () => {
|
|||||||
currentTargets.push(target.current._nativeTag);
|
currentTargets.push(target.current._nativeTag);
|
||||||
timers[timers.length] = setTimeout(() => {
|
timers[timers.length] = setTimeout(() => {
|
||||||
//TipManager.markPopupUsed(popup.id);
|
//TipManager.markPopupUsed(popup.id);
|
||||||
console.log("tooltip showing", popup.text);
|
|
||||||
RNTooltips.Show(target.current, parent.current, {
|
RNTooltips.Show(target.current, parent.current, {
|
||||||
text: popup.text,
|
text: popup.text,
|
||||||
tintColor: colors.night ? colors.nav : "#404040",
|
tintColor: colors.night ? colors.nav : "#404040",
|
||||||
|
|||||||
@@ -157,7 +157,6 @@ const _TabsHolder = () => {
|
|||||||
]);
|
]);
|
||||||
|
|
||||||
const _onLayout = async (event) => {
|
const _onLayout = async (event) => {
|
||||||
console.log("layout called here");
|
|
||||||
if (layoutTimer) {
|
if (layoutTimer) {
|
||||||
clearTimeout(layoutTimer);
|
clearTimeout(layoutTimer);
|
||||||
layoutTimer = null;
|
layoutTimer = null;
|
||||||
@@ -180,7 +179,6 @@ const _TabsHolder = () => {
|
|||||||
width: size.width,
|
width: size.width,
|
||||||
height: size.height
|
height: size.height
|
||||||
});
|
});
|
||||||
console.log("height change", size.width, size.height);
|
|
||||||
setWidthHeight(size);
|
setWidthHeight(size);
|
||||||
DDS.setSize(size);
|
DDS.setSize(size);
|
||||||
|
|
||||||
@@ -243,7 +241,6 @@ const _TabsHolder = () => {
|
|||||||
if (!editorState().movedAway) {
|
if (!editorState().movedAway) {
|
||||||
tabBarRef.current?.goToIndex(2);
|
tabBarRef.current?.goToIndex(2);
|
||||||
} else {
|
} else {
|
||||||
console.log("index one", editorState().movedAway);
|
|
||||||
tabBarRef.current?.goToIndex(1);
|
tabBarRef.current?.goToIndex(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -103,8 +103,6 @@ const Editor = React.memo(
|
|||||||
groupId: string;
|
groupId: string;
|
||||||
src: string;
|
src: string;
|
||||||
}) => {
|
}) => {
|
||||||
console.log("onMediaDownoaded", groupId);
|
|
||||||
|
|
||||||
if (groupId !== editor.note.current?.id) return;
|
if (groupId !== editor.note.current?.id) return;
|
||||||
editor.commands.updateImage({
|
editor.commands.updateImage({
|
||||||
hash: hash,
|
hash: hash,
|
||||||
@@ -115,7 +113,6 @@ const Editor = React.memo(
|
|||||||
);
|
);
|
||||||
|
|
||||||
const onError = useCallback(() => {
|
const onError = useCallback(() => {
|
||||||
console.log("RENDER PROCESS GONE!!!");
|
|
||||||
editor.setLoading(true);
|
editor.setLoading(true);
|
||||||
setTimeout(() => editor.setLoading(false), 10);
|
setTimeout(() => editor.setLoading(false), 10);
|
||||||
}, [editor]);
|
}, [editor]);
|
||||||
@@ -134,7 +131,6 @@ const Editor = React.memo(
|
|||||||
editorController.current = editor;
|
editorController.current = editor;
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log(editor.loading, "loading editor");
|
|
||||||
return editor.loading ? null : (
|
return editor.loading ? null : (
|
||||||
<>
|
<>
|
||||||
<WebView
|
<WebView
|
||||||
@@ -170,7 +166,7 @@ const Editor = React.memo(
|
|||||||
allowUniversalAccessFromFileURLs={true}
|
allowUniversalAccessFromFileURLs={true}
|
||||||
originWhitelist={["*"]}
|
originWhitelist={["*"]}
|
||||||
source={{
|
source={{
|
||||||
uri: __DEV__ ? EDITOR_URI : EDITOR_URI
|
uri: EDITOR_URI
|
||||||
}}
|
}}
|
||||||
style={style}
|
style={style}
|
||||||
autoManageStatusBarEnabled={false}
|
autoManageStatusBarEnabled={false}
|
||||||
|
|||||||
@@ -35,7 +35,6 @@ export const ProgressBar = () => {
|
|||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (loading) {
|
if (loading) {
|
||||||
console.log(loading);
|
|
||||||
if (loading.current !== loading.total) {
|
if (loading.current !== loading.total) {
|
||||||
setVisible(true);
|
setVisible(true);
|
||||||
setProg(loading.current / loading.total);
|
setProg(loading.current / loading.total);
|
||||||
|
|||||||
@@ -19,7 +19,14 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||||||
|
|
||||||
import { Platform } from "react-native";
|
import { Platform } from "react-native";
|
||||||
|
|
||||||
export const EDITOR_URI =
|
const EditorMobileSourceUrl =
|
||||||
Platform.OS === "android"
|
Platform.OS === "android"
|
||||||
? "file:///android_asset/index.html"
|
? "file:///android_asset/index.html"
|
||||||
: "build.bundle/index.html";
|
: "build.bundle/index.html";
|
||||||
|
/**
|
||||||
|
* Replace this with dev url when debugging or working on the editor mobile repo.
|
||||||
|
* The url should be something like this: http://192.168.100.126:3000/index.html
|
||||||
|
*/
|
||||||
|
export const EDITOR_URI = __DEV__
|
||||||
|
? EditorMobileSourceUrl
|
||||||
|
: EditorMobileSourceUrl;
|
||||||
|
|||||||
@@ -38,10 +38,9 @@ async function call(webview: RefObject<WebView | undefined>, action?: Action) {
|
|||||||
if (!webview.current || !action) return;
|
if (!webview.current || !action) return;
|
||||||
setImmediate(() => webview.current?.injectJavaScript(action.job));
|
setImmediate(() => webview.current?.injectJavaScript(action.job));
|
||||||
const response = await getResponse(action.id);
|
const response = await getResponse(action.id);
|
||||||
console.log("webview job: ", action.id, response ? response.value : response);
|
// if (!response) {
|
||||||
if (!response) {
|
// console.warn("webview job failed", action.id);
|
||||||
console.warn("webview job failed", action.id);
|
// }
|
||||||
}
|
|
||||||
return response ? response.value : response;
|
return response ? response.value : response;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -162,7 +161,6 @@ typeof globalThis.statusBar !== "undefined" && statusBar.current.set({date:"",sa
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
console.log("setSettings", JSON.stringify(settings));
|
|
||||||
await this.doAsync(`
|
await this.doAsync(`
|
||||||
if (typeof globalThis.settingsController !== "undefined") {
|
if (typeof globalThis.settingsController !== "undefined") {
|
||||||
globalThis.settingsController.update(${JSON.stringify(settings)})
|
globalThis.settingsController.update(${JSON.stringify(settings)})
|
||||||
@@ -213,7 +211,6 @@ typeof globalThis.statusBar !== "undefined" && statusBar.current.set({date:"",sa
|
|||||||
};
|
};
|
||||||
|
|
||||||
insertImage = async (image: ImageAttributes) => {
|
insertImage = async (image: ImageAttributes) => {
|
||||||
console.log("image data", image);
|
|
||||||
await this.doAsync(
|
await this.doAsync(
|
||||||
`editor && editor.commands.insertImage(${JSON.stringify(image)})`
|
`editor && editor.commands.insertImage(${JSON.stringify(image)})`
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -77,9 +77,8 @@ const file = async (fileOptions) => {
|
|||||||
if (Platform.OS == "ios") {
|
if (Platform.OS == "ios") {
|
||||||
options.copyTo = "cachesDirectory";
|
options.copyTo = "cachesDirectory";
|
||||||
}
|
}
|
||||||
console.log("generate key for attachment");
|
await db.attachments.generateKey();
|
||||||
const key = await db.attachments.generateKey();
|
|
||||||
console.log("generated key for attachments: ", key);
|
|
||||||
let file;
|
let file;
|
||||||
try {
|
try {
|
||||||
file = await DocumentPicker.pick(options);
|
file = await DocumentPicker.pick(options);
|
||||||
@@ -205,7 +204,6 @@ const pick = async (options) => {
|
|||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
console.log("opening picker", options.type);
|
|
||||||
if (options?.type.startsWith("image") || options?.type === "camera") {
|
if (options?.type.startsWith("image") || options?.type === "camera") {
|
||||||
if (options.type === "image") {
|
if (options.type === "image") {
|
||||||
gallery(options);
|
gallery(options);
|
||||||
|
|||||||
@@ -286,20 +286,10 @@ export const useEditorEvents = (
|
|||||||
(event: WebViewMessageEvent) => {
|
(event: WebViewMessageEvent) => {
|
||||||
const data = event.nativeEvent.data;
|
const data = event.nativeEvent.data;
|
||||||
const editorMessage = JSON.parse(data) as EditorMessage;
|
const editorMessage = JSON.parse(data) as EditorMessage;
|
||||||
|
|
||||||
logger.info("editor", editorMessage.type);
|
|
||||||
if (
|
if (
|
||||||
editorMessage.sessionId !== editor.sessionId &&
|
editorMessage.sessionId !== editor.sessionId &&
|
||||||
editorMessage.type !== EditorEvents.status
|
editorMessage.type !== EditorEvents.status
|
||||||
) {
|
) {
|
||||||
logger.error(
|
|
||||||
"editor",
|
|
||||||
"invalid session",
|
|
||||||
editorMessage.type,
|
|
||||||
editor.sessionId,
|
|
||||||
editorMessage.sessionId
|
|
||||||
);
|
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
switch (editorMessage.type) {
|
switch (editorMessage.type) {
|
||||||
@@ -348,9 +338,10 @@ export const useEditorEvents = (
|
|||||||
pick({ type: editorMessage.value });
|
pick({ type: editorMessage.value });
|
||||||
break;
|
break;
|
||||||
case EventTypes.download:
|
case EventTypes.download:
|
||||||
console.log("download attachment request", editorMessage.value);
|
filesystem.downloadAttachment(
|
||||||
const attachmentInfo = editorMessage.value as Attachment;
|
(editorMessage.value as Attachment)?.hash,
|
||||||
filesystem.downloadAttachment(attachmentInfo?.hash, true);
|
true
|
||||||
|
);
|
||||||
break;
|
break;
|
||||||
case EventTypes.pro:
|
case EventTypes.pro:
|
||||||
if (editor.state.current?.isFocused) {
|
if (editor.state.current?.isFocused) {
|
||||||
@@ -373,11 +364,6 @@ export const useEditorEvents = (
|
|||||||
onBackPress();
|
onBackPress();
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
console.log(
|
|
||||||
"unhandled event recieved from editor: ",
|
|
||||||
editorMessage.type,
|
|
||||||
editorMessage.value
|
|
||||||
);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
eSendEvent(editorMessage.type, editorMessage);
|
eSendEvent(editorMessage.type, editorMessage);
|
||||||
|
|||||||
@@ -113,14 +113,12 @@ export const useEditor = (
|
|||||||
|
|
||||||
const onReady = useCallback(async () => {
|
const onReady = useCallback(async () => {
|
||||||
if (!(await isEditorLoaded(editorRef, sessionIdRef.current))) {
|
if (!(await isEditorLoaded(editorRef, sessionIdRef.current))) {
|
||||||
console.log("ON READY CALLED");
|
|
||||||
overlay(true);
|
overlay(true);
|
||||||
setLoading(true);
|
setLoading(true);
|
||||||
}
|
}
|
||||||
}, [overlay]);
|
}, [overlay]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
console.log("sessionId:", sessionId);
|
|
||||||
state.current.saveCount = 0;
|
state.current.saveCount = 0;
|
||||||
async () => {
|
async () => {
|
||||||
await commands.setSessionId(sessionIdRef.current);
|
await commands.setSessionId(sessionIdRef.current);
|
||||||
@@ -156,7 +154,6 @@ export const useEditor = (
|
|||||||
postMessage(EditorEvents.title, "");
|
postMessage(EditorEvents.title, "");
|
||||||
await commands.clearContent();
|
await commands.clearContent();
|
||||||
await commands.clearTags();
|
await commands.clearTags();
|
||||||
console.log("reset state: ", resetState);
|
|
||||||
if (resetState) {
|
if (resetState) {
|
||||||
isDefaultEditor &&
|
isDefaultEditor &&
|
||||||
useEditorStore.getState().setCurrentlyEditingNote(null);
|
useEditorStore.getState().setCurrentlyEditingNote(null);
|
||||||
@@ -182,8 +179,6 @@ export const useEditor = (
|
|||||||
currentNote.current?.readonly
|
currentNote.current?.readonly
|
||||||
)
|
)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
console.log("saving note", id);
|
|
||||||
try {
|
try {
|
||||||
if (id && !db.notes?.note(id)) {
|
if (id && !db.notes?.note(id)) {
|
||||||
isDefaultEditor &&
|
isDefaultEditor &&
|
||||||
@@ -244,9 +239,7 @@ export const useEditor = (
|
|||||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
await db.vault?.save(noteData as any);
|
await db.vault?.save(noteData as any);
|
||||||
}
|
}
|
||||||
console.log(id, sessionIdRef.current, currentSessionId);
|
|
||||||
if (id && sessionIdRef.current === currentSessionId) {
|
if (id && sessionIdRef.current === currentSessionId) {
|
||||||
console.log("updating state");
|
|
||||||
note = db.notes?.note(id)?.data as Note;
|
note = db.notes?.note(id)?.data as Note;
|
||||||
await commands.setStatus(timeConverter(note.dateEdited), "Saved");
|
await commands.setStatus(timeConverter(note.dateEdited), "Saved");
|
||||||
|
|
||||||
@@ -268,7 +261,7 @@ export const useEditor = (
|
|||||||
|
|
||||||
return id;
|
return id;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.log("error saving: ", e);
|
console.log("Error saving note: ", e);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
[commands, isDefaultEditor, postMessage, readonly, reset]
|
[commands, isDefaultEditor, postMessage, readonly, reset]
|
||||||
@@ -293,7 +286,6 @@ export const useEditor = (
|
|||||||
forced?: boolean;
|
forced?: boolean;
|
||||||
}
|
}
|
||||||
) => {
|
) => {
|
||||||
console.log("loading note", item.type, eOnLoadNote + editorId);
|
|
||||||
state.current.currentlyEditing = true;
|
state.current.currentlyEditing = true;
|
||||||
const editorState = useEditorStore.getState();
|
const editorState = useEditorStore.getState();
|
||||||
|
|
||||||
@@ -432,7 +424,6 @@ export const useEditor = (
|
|||||||
tabBarRef.current?.goToPage(1);
|
tabBarRef.current?.goToPage(1);
|
||||||
}
|
}
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
console.log("restoring app state here");
|
|
||||||
if (appState.note) {
|
if (appState.note) {
|
||||||
loadNote(appState.note);
|
loadNote(appState.note);
|
||||||
}
|
}
|
||||||
@@ -450,7 +441,6 @@ export const useEditor = (
|
|||||||
}, [loadNote, overlay]);
|
}, [loadNote, overlay]);
|
||||||
|
|
||||||
const onLoad = useCallback(async () => {
|
const onLoad = useCallback(async () => {
|
||||||
console.log("on editor load");
|
|
||||||
state.current.ready = true;
|
state.current.ready = true;
|
||||||
onReady();
|
onReady();
|
||||||
postMessage(EditorEvents.theme, theme || useThemeStore.getState().colors);
|
postMessage(EditorEvents.theme, theme || useThemeStore.getState().colors);
|
||||||
@@ -458,7 +448,6 @@ export const useEditor = (
|
|||||||
isDefaultEditor ? insets : { top: 0, left: 0, right: 0, bottom: 0 }
|
isDefaultEditor ? insets : { top: 0, left: 0, right: 0, bottom: 0 }
|
||||||
);
|
);
|
||||||
if (currentNote.current) {
|
if (currentNote.current) {
|
||||||
console.log("force reload note");
|
|
||||||
loadNote({ ...currentNote.current, forced: true });
|
loadNote({ ...currentNote.current, forced: true });
|
||||||
} else {
|
} else {
|
||||||
await commands.setPlaceholder(placeholderTip.current);
|
await commands.setPlaceholder(placeholderTip.current);
|
||||||
|
|||||||
@@ -84,7 +84,6 @@ export async function post<T>(
|
|||||||
};
|
};
|
||||||
setImmediate(() => ref.current?.postMessage(JSON.stringify(message)));
|
setImmediate(() => ref.current?.postMessage(JSON.stringify(message)));
|
||||||
const response = await getResponse(type);
|
const response = await getResponse(type);
|
||||||
console.log("post: ", type, sessionId, "result:", !!response);
|
|
||||||
return response;
|
return response;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -64,7 +64,6 @@ export const EditorWrapper = ({ width }) => {
|
|||||||
}, [loading]);
|
}, [loading]);
|
||||||
|
|
||||||
const getMarginBottom = () => {
|
const getMarginBottom = () => {
|
||||||
console.log(insets.top);
|
|
||||||
if (!keyboard.keyboardShown) return insets.bottom / 2;
|
if (!keyboard.keyboardShown) return insets.bottom / 2;
|
||||||
if (Platform.isPad && !floating) return 16;
|
if (Platform.isPad && !floating) return 16;
|
||||||
if (Platform.OS === "ios") return insets.bottom / 2;
|
if (Platform.OS === "ios") return insets.bottom / 2;
|
||||||
|
|||||||
@@ -51,7 +51,6 @@ export const Home = ({ navigation, route }: NavigationProps<"Notes">) => {
|
|||||||
const loading = useNoteStore((state) => state.loading);
|
const loading = useNoteStore((state) => state.loading);
|
||||||
const isFocused = useNavigationFocus(navigation, {
|
const isFocused = useNavigationFocus(navigation, {
|
||||||
onFocus: (prev) => {
|
onFocus: (prev) => {
|
||||||
console.log("updating", route.name, "on focus");
|
|
||||||
Navigation.routeNeedsUpdate(
|
Navigation.routeNeedsUpdate(
|
||||||
route.name,
|
route.name,
|
||||||
Navigation.routeUpdateFunctions[route.name]
|
Navigation.routeUpdateFunctions[route.name]
|
||||||
|
|||||||
@@ -85,11 +85,10 @@ export const setOnFirstSave = (
|
|||||||
|
|
||||||
export function isSynced(params: NotesScreenParams) {
|
export function isSynced(params: NotesScreenParams) {
|
||||||
if (params.item.type === "topic") {
|
if (params.item.type === "topic") {
|
||||||
console.log(params.item.type);
|
|
||||||
const topic = db.notebooks
|
const topic = db.notebooks
|
||||||
?.notebook(params.item.notebookId)
|
?.notebook(params.item.notebookId)
|
||||||
?.topics.topic(params.item.id);
|
?.topics.topic(params.item.id);
|
||||||
console.log(topic?.synced(), "sycned");
|
|
||||||
return !topic ? true : topic?.synced();
|
return !topic ? true : topic?.synced();
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -100,7 +100,6 @@ const NotesPage = ({
|
|||||||
const [loadingNotes, setLoadingNotes] = useState(false);
|
const [loadingNotes, setLoadingNotes] = useState(false);
|
||||||
const alias = getAlias(params.current);
|
const alias = getAlias(params.current);
|
||||||
const isMonograph = route.name === "Monographs";
|
const isMonograph = route.name === "Monographs";
|
||||||
console.log(warning, "isWarning", isSynced(route.params));
|
|
||||||
|
|
||||||
const isFocused = useNavigationFocus(navigation, {
|
const isFocused = useNavigationFocus(navigation, {
|
||||||
onFocus: (prev) => {
|
onFocus: (prev) => {
|
||||||
|
|||||||
@@ -55,9 +55,7 @@ export const SearchBar = () => {
|
|||||||
});
|
});
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
const onScroll = (event) => {
|
const onScroll = (event) => {};
|
||||||
console.log(event);
|
|
||||||
};
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
eSubscribeEvent(eScrollEvent, onScroll);
|
eSubscribeEvent(eScrollEvent, onScroll);
|
||||||
return () => {
|
return () => {
|
||||||
|
|||||||
@@ -196,10 +196,8 @@ export const MFASetup = ({
|
|||||||
if (!method) return;
|
if (!method) return;
|
||||||
setEnabling(true);
|
setEnabling(true);
|
||||||
if (recovery) {
|
if (recovery) {
|
||||||
console.log("enabling secondary method for 2FA");
|
|
||||||
await db.mfa?.enableFallback(method.id, code.current);
|
await db.mfa?.enableFallback(method.id, code.current);
|
||||||
} else {
|
} else {
|
||||||
console.log("enabling primary method for 2FA");
|
|
||||||
await db.mfa?.enable(method.id, code.current);
|
await db.mfa?.enable(method.id, code.current);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -209,14 +207,12 @@ export const MFASetup = ({
|
|||||||
setEnabling(false);
|
setEnabling(false);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
const error = e as Error;
|
const error = e as Error;
|
||||||
console.log("2fa submit code:", error.message);
|
|
||||||
ToastEvent.error(error, "Error submitting 2fa code");
|
ToastEvent.error(error, "Error submitting 2fa code");
|
||||||
setEnabling(false);
|
setEnabling(false);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const onSendCode = async () => {
|
const onSendCode = async () => {
|
||||||
console.log("send code");
|
|
||||||
if (error) return;
|
if (error) return;
|
||||||
if (!method || sending) return;
|
if (!method || sending) return;
|
||||||
if (method.id === "app" && authenticatorDetails.sharedKey) {
|
if (method.id === "app" && authenticatorDetails.sharedKey) {
|
||||||
@@ -236,7 +232,6 @@ export const MFASetup = ({
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
console.log("seconds", seconds);
|
|
||||||
if (seconds)
|
if (seconds)
|
||||||
throw new Error("Please wait a few seconds before resending code");
|
throw new Error("Please wait a few seconds before resending code");
|
||||||
if (method.id === "sms" && !phoneNumber.current)
|
if (method.id === "sms" && !phoneNumber.current)
|
||||||
@@ -245,7 +240,6 @@ export const MFASetup = ({
|
|||||||
await db.mfa?.setup(method?.id, phoneNumber.current);
|
await db.mfa?.setup(method?.id, phoneNumber.current);
|
||||||
|
|
||||||
if (method.id === "sms") {
|
if (method.id === "sms") {
|
||||||
console.log(phoneNumber.current);
|
|
||||||
setId(method.id + phoneNumber.current);
|
setId(method.id + phoneNumber.current);
|
||||||
}
|
}
|
||||||
await sleep(300);
|
await sleep(300);
|
||||||
@@ -262,7 +256,6 @@ export const MFASetup = ({
|
|||||||
} catch (e) {
|
} catch (e) {
|
||||||
setSending(false);
|
setSending(false);
|
||||||
const error = e as Error;
|
const error = e as Error;
|
||||||
console.log("Send code:", error.message);
|
|
||||||
ToastEvent.error(error, "Error sending 2FA code");
|
ToastEvent.error(error, "Error sending 2FA code");
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -73,7 +73,6 @@ export const AutomaticBackupsSelector = () => {
|
|||||||
if (Platform.OS === "android") {
|
if (Platform.OS === "android") {
|
||||||
let granted = await Backup.checkBackupDirExists();
|
let granted = await Backup.checkBackupDirExists();
|
||||||
if (!granted) {
|
if (!granted) {
|
||||||
console.log("returning");
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -58,10 +58,6 @@ export const Group = ({
|
|||||||
});
|
});
|
||||||
const colors = useThemeStore((state) => state.colors);
|
const colors = useThemeStore((state) => state.colors);
|
||||||
|
|
||||||
if (isDragged) {
|
|
||||||
console.log(dimensions.current.height, dimensions.current.width);
|
|
||||||
}
|
|
||||||
|
|
||||||
const onDrop = (data: DraxDragWithReceiverEventData) => {
|
const onDrop = (data: DraxDragWithReceiverEventData) => {
|
||||||
const isDroppedAbove = data.receiver.receiveOffsetRatio.y < 0.5;
|
const isDroppedAbove = data.receiver.receiveOffsetRatio.y < 0.5;
|
||||||
const dragged = data.dragged.payload;
|
const dragged = data.dragged.payload;
|
||||||
@@ -131,9 +127,9 @@ export const Group = ({
|
|||||||
positivePress: () => {
|
positivePress: () => {
|
||||||
if (groupIndex === undefined) return;
|
if (groupIndex === undefined) return;
|
||||||
const _data = useDragState.getState().data.slice();
|
const _data = useDragState.getState().data.slice();
|
||||||
console.log(groupIndex);
|
|
||||||
_data.splice(groupIndex, 1);
|
_data.splice(groupIndex, 1);
|
||||||
console.log(_data);
|
|
||||||
setData(_data);
|
setData(_data);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -116,7 +116,7 @@ export const Tool = ({
|
|||||||
).findIndex((tool: string) => tool === item);
|
).findIndex((tool: string) => tool === item);
|
||||||
(_data[parentIndex][groupIndex] as ToolId[]).splice(index, 1);
|
(_data[parentIndex][groupIndex] as ToolId[]).splice(index, 1);
|
||||||
}
|
}
|
||||||
console.log(_data[groupIndex]);
|
|
||||||
setData(_data);
|
setData(_data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -272,8 +272,6 @@ export const Tool = ({
|
|||||||
? Math.max(0, reciever.index)
|
? Math.max(0, reciever.index)
|
||||||
: reciever.index + 1;
|
: reciever.index + 1;
|
||||||
|
|
||||||
console.log("indexes", reciever.parentIndex, reciever.groupIndex);
|
|
||||||
|
|
||||||
const insertAt = isDroppedAtSubgroup
|
const insertAt = isDroppedAtSubgroup
|
||||||
? (_data[reciever.parentIndex][reciever.groupIndex] as string[])
|
? (_data[reciever.parentIndex][reciever.groupIndex] as string[])
|
||||||
: (_data[reciever.groupIndex] as string[]);
|
: (_data[reciever.groupIndex] as string[]);
|
||||||
|
|||||||
@@ -54,13 +54,13 @@ export function getUngroupedTools(
|
|||||||
toolDefinition: (string | string[])[][]
|
toolDefinition: (string | string[])[][]
|
||||||
): string[] {
|
): string[] {
|
||||||
const keys = Object.keys(tools);
|
const keys = Object.keys(tools);
|
||||||
console.log(keys);
|
|
||||||
const ungrouped = [];
|
const ungrouped = [];
|
||||||
const toolString = JSON.stringify(toolDefinition);
|
const toolString = JSON.stringify(toolDefinition);
|
||||||
for (const key of keys) {
|
for (const key of keys) {
|
||||||
if (tools[key as ToolId].conditional) continue;
|
if (tools[key as ToolId].conditional) continue;
|
||||||
if (!toolString.includes(key)) ungrouped.push(key);
|
if (!toolString.includes(key)) ungrouped.push(key);
|
||||||
}
|
}
|
||||||
console.log(ungrouped);
|
|
||||||
return ungrouped;
|
return ungrouped;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -37,7 +37,6 @@ const Group = ({
|
|||||||
useNavigationFocus(navigation, {
|
useNavigationFocus(navigation, {
|
||||||
onFocus: () => {
|
onFocus: () => {
|
||||||
tabBarRef.current?.lock();
|
tabBarRef.current?.lock();
|
||||||
console.log("called");
|
|
||||||
useNavigationStore.getState().update(
|
useNavigationStore.getState().update(
|
||||||
{
|
{
|
||||||
name: "SettingsGroup",
|
name: "SettingsGroup",
|
||||||
|
|||||||
@@ -772,7 +772,6 @@ export const settingsGroups: SettingSection[] = [
|
|||||||
icon: "form-textbox",
|
icon: "form-textbox",
|
||||||
modifer: () => {
|
modifer: () => {
|
||||||
const settings = SettingsService.get();
|
const settings = SettingsService.get();
|
||||||
console.log("called me now", settings.notifNotes);
|
|
||||||
if (settings.notifNotes) {
|
if (settings.notifNotes) {
|
||||||
Notifications.unpinQuickNote();
|
Notifications.unpinQuickNote();
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ import * as ScopedStorage from "react-native-scoped-storage";
|
|||||||
import Share from "react-native-share";
|
import Share from "react-native-share";
|
||||||
import RNFetchBlob from "rn-fetch-blob";
|
import RNFetchBlob from "rn-fetch-blob";
|
||||||
import { presentDialog } from "../components/dialog/functions";
|
import { presentDialog } from "../components/dialog/functions";
|
||||||
import { db } from "../common/database";
|
import { DatabaseLogger, db } from "../common/database";
|
||||||
import storage from "../common/database/storage";
|
import storage from "../common/database/storage";
|
||||||
import { eCloseProgressDialog } from "../utils/events";
|
import { eCloseProgressDialog } from "../utils/events";
|
||||||
import { sanitizeFilename } from "../utils/sanitizer";
|
import { sanitizeFilename } from "../utils/sanitizer";
|
||||||
@@ -43,7 +43,6 @@ async function getDirectoryAndroid() {
|
|||||||
let folderFiles = await ScopedStorage.listFiles(folder.uri);
|
let folderFiles = await ScopedStorage.listFiles(folder.uri);
|
||||||
for (let f of folderFiles) {
|
for (let f of folderFiles) {
|
||||||
if (f.type === "directory" && f.name === "Notesnook backups") {
|
if (f.type === "directory" && f.name === "Notesnook backups") {
|
||||||
console.log("folder already exists. reusing");
|
|
||||||
subfolder = f;
|
subfolder = f;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -114,7 +113,6 @@ async function presentBackupCompleteSheet(backupFilePath) {
|
|||||||
{
|
{
|
||||||
action: () => {
|
action: () => {
|
||||||
if (Platform.OS === "ios") {
|
if (Platform.OS === "ios") {
|
||||||
console.log(backupFilePath);
|
|
||||||
Share.open({
|
Share.open({
|
||||||
url: "file:/" + backupFilePath,
|
url: "file:/" + backupFilePath,
|
||||||
failOnCancel: false
|
failOnCancel: false
|
||||||
@@ -210,7 +208,7 @@ async function run(progress, context) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
let showBackupCompleteSheet = SettingsService.get().showBackupCompleteSheet;
|
let showBackupCompleteSheet = SettingsService.get().showBackupCompleteSheet;
|
||||||
console.log(backupFilePath);
|
|
||||||
if (context) return backupFilePath;
|
if (context) return backupFilePath;
|
||||||
await sleep(300);
|
await sleep(300);
|
||||||
if (showBackupCompleteSheet) {
|
if (showBackupCompleteSheet) {
|
||||||
@@ -239,16 +237,15 @@ async function checkBackupRequired(type) {
|
|||||||
}
|
}
|
||||||
lastBackupDate = parseInt(lastBackupDate);
|
lastBackupDate = parseInt(lastBackupDate);
|
||||||
if (type === "daily" && lastBackupDate + MS_DAY < now) {
|
if (type === "daily" && lastBackupDate + MS_DAY < now) {
|
||||||
console.log("daily backup started");
|
DatabaseLogger.info("Daily backup started");
|
||||||
return true;
|
return true;
|
||||||
} else if (type === "weekly" && lastBackupDate + MS_WEEK < now) {
|
} else if (type === "weekly" && lastBackupDate + MS_WEEK < now) {
|
||||||
console.log("weekly backup started");
|
DatabaseLogger.info("Weekly backup started");
|
||||||
return true;
|
return true;
|
||||||
} else if (type === "monthly" && lastBackupDate + MONTH < now) {
|
} else if (type === "monthly" && lastBackupDate + MONTH < now) {
|
||||||
console.log("monthly backup started");
|
DatabaseLogger.info("Monthly backup started");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
console.log("no need", lastBackupDate);
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -97,20 +97,13 @@ function clearRouteFromQueue(routeName: RouteName) {
|
|||||||
* Check if a route needs update
|
* Check if a route needs update
|
||||||
*/
|
*/
|
||||||
function routeNeedsUpdate(routeName: RouteName, callback: () => void) {
|
function routeNeedsUpdate(routeName: RouteName, callback: () => void) {
|
||||||
console.log(
|
|
||||||
"routeNeedsUpdate",
|
|
||||||
routesUpdateQueue,
|
|
||||||
routesUpdateQueue.indexOf(routeName)
|
|
||||||
);
|
|
||||||
if (routesUpdateQueue.indexOf(routeName) > -1) {
|
if (routesUpdateQueue.indexOf(routeName) > -1) {
|
||||||
clearRouteFromQueue(routeName);
|
clearRouteFromQueue(routeName);
|
||||||
console.log("CALL ROUTE UPDATE");
|
|
||||||
callback();
|
callback();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function queueRoutesForUpdate(...routes: RouteName[]) {
|
function queueRoutesForUpdate(...routes: RouteName[]) {
|
||||||
console.log("updating routes", routes);
|
|
||||||
const currentScreen = useNavigationStore.getState().currentScreen;
|
const currentScreen = useNavigationStore.getState().currentScreen;
|
||||||
// const routeHistory = rootNavigatorRef.current?.getRootState()?.routes || [
|
// const routeHistory = rootNavigatorRef.current?.getRootState()?.routes || [
|
||||||
// { key: currentScreen.name }
|
// { key: currentScreen.name }
|
||||||
@@ -122,7 +115,6 @@ function queueRoutesForUpdate(...routes: RouteName[]) {
|
|||||||
// );
|
// );
|
||||||
|
|
||||||
if (routes.indexOf(currentScreen.name) > -1) {
|
if (routes.indexOf(currentScreen.name) > -1) {
|
||||||
console.log("updating current route");
|
|
||||||
routeUpdateFunctions[currentScreen.name]();
|
routeUpdateFunctions[currentScreen.name]();
|
||||||
clearRouteFromQueue(currentScreen.name);
|
clearRouteFromQueue(currentScreen.name);
|
||||||
// Remove focused screen from queue
|
// Remove focused screen from queue
|
||||||
@@ -132,7 +124,6 @@ function queueRoutesForUpdate(...routes: RouteName[]) {
|
|||||||
|
|
||||||
routesUpdateQueue = routesUpdateQueue.concat(routes);
|
routesUpdateQueue = routesUpdateQueue.concat(routes);
|
||||||
routesUpdateQueue = [...new Set(routesUpdateQueue)];
|
routesUpdateQueue = [...new Set(routesUpdateQueue)];
|
||||||
//console.log(routesUpdateQueue);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function navigate<T extends RouteName>(
|
function navigate<T extends RouteName>(
|
||||||
|
|||||||
@@ -82,7 +82,6 @@ function init() {
|
|||||||
);
|
);
|
||||||
},
|
},
|
||||||
onAction: async function (notification) {
|
onAction: async function (notification) {
|
||||||
console.log("ACTION: ", notification.action);
|
|
||||||
switch (notification.action) {
|
switch (notification.action) {
|
||||||
case "UNPIN":
|
case "UNPIN":
|
||||||
remove(
|
remove(
|
||||||
@@ -94,7 +93,6 @@ function init() {
|
|||||||
unpinQuickNote();
|
unpinQuickNote();
|
||||||
break;
|
break;
|
||||||
case "ReplyInput":
|
case "ReplyInput":
|
||||||
console.log("texto", notification);
|
|
||||||
present({
|
present({
|
||||||
title: "Quick note",
|
title: "Quick note",
|
||||||
message: 'Tap on "Take note" to add a note.',
|
message: 'Tap on "Take note" to add a note.',
|
||||||
@@ -137,7 +135,7 @@ function init() {
|
|||||||
importance: Importance.HIGH,
|
importance: Importance.HIGH,
|
||||||
vibrate: true
|
vibrate: true
|
||||||
},
|
},
|
||||||
(created) => console.log(`createChannel returned '${created}'`)
|
(created) => console.log(`Android Notification Channel Status: ${created}`)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -157,7 +155,6 @@ function pinQuickNote(launch: boolean) {
|
|||||||
if (notif && launch) {
|
if (notif && launch) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
console.log("showing");
|
|
||||||
present({
|
present({
|
||||||
title: "Quick note",
|
title: "Quick note",
|
||||||
message: 'Tap on "Take note" to add a note.',
|
message: 'Tap on "Take note" to add a note.',
|
||||||
|
|||||||
@@ -80,7 +80,7 @@ function getMontlySub() {
|
|||||||
localizedPrice: "$4.49"
|
localizedPrice: "$4.49"
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
console.log(_product.localizedPrice);
|
|
||||||
return _product;
|
return _product;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -121,7 +121,6 @@ const onUserStatusCheck = async (type) => {
|
|||||||
if (userstore?.premium !== get()) {
|
if (userstore?.premium !== get()) {
|
||||||
userstore.setPremium(get());
|
userstore.setPremium(get());
|
||||||
}
|
}
|
||||||
console.log("status check: ", type, get());
|
|
||||||
|
|
||||||
let status = get();
|
let status = get();
|
||||||
let message = null;
|
let message = null;
|
||||||
@@ -189,7 +188,7 @@ const showVerifyEmailDialog = () => {
|
|||||||
type: "error",
|
type: "error",
|
||||||
context: "local"
|
context: "local"
|
||||||
});
|
});
|
||||||
console.log("error");
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
await db.user.sendVerificationEmail();
|
await db.user.sendVerificationEmail();
|
||||||
@@ -260,10 +259,6 @@ const subscriptions = {
|
|||||||
},
|
},
|
||||||
verify: async (subscription) => {
|
verify: async (subscription) => {
|
||||||
if (Platform.OS === "android") return;
|
if (Platform.OS === "android") return;
|
||||||
console.log(
|
|
||||||
"verifying: ",
|
|
||||||
new Date(subscription.transactionDate).toLocaleString()
|
|
||||||
);
|
|
||||||
|
|
||||||
if (subscription.transactionReceipt) {
|
if (subscription.transactionReceipt) {
|
||||||
if (Platform.OS === "ios") {
|
if (Platform.OS === "ios") {
|
||||||
@@ -286,11 +281,10 @@ const subscriptions = {
|
|||||||
);
|
);
|
||||||
|
|
||||||
let text = await result.text();
|
let text = await result.text();
|
||||||
console.log(text);
|
|
||||||
if (!result.ok) {
|
if (!result.ok) {
|
||||||
if (text === "Receipt already expired.") {
|
if (text === "Receipt already expired.") {
|
||||||
await subscriptions.clear(subscription);
|
await subscriptions.clear(subscription);
|
||||||
console.log("clearing because expired");
|
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -306,7 +300,6 @@ const subscriptions = {
|
|||||||
let subscription = null;
|
let subscription = null;
|
||||||
if (_subscription) {
|
if (_subscription) {
|
||||||
subscription = _subscription;
|
subscription = _subscription;
|
||||||
console.log("got id to clear");
|
|
||||||
} else {
|
} else {
|
||||||
subscription = _subscriptions.length > 0 ? _subscriptions[0] : null;
|
subscription = _subscriptions.length > 0 ? _subscriptions[0] : null;
|
||||||
}
|
}
|
||||||
@@ -314,7 +307,6 @@ const subscriptions = {
|
|||||||
await RNIap.finishTransactionIOS(subscription.transactionId);
|
await RNIap.finishTransactionIOS(subscription.transactionId);
|
||||||
await RNIap.clearTransactionIOS();
|
await RNIap.clearTransactionIOS();
|
||||||
await subscriptions.remove(subscription.transactionId);
|
await subscriptions.remove(subscription.transactionId);
|
||||||
console.log("clearing subscriptions");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -327,7 +319,7 @@ async function getRemainingTrialDaysStatus() {
|
|||||||
let total = user.subscription.expiry - user.subscription.start;
|
let total = user.subscription.expiry - user.subscription.start;
|
||||||
let current = Date.now() - user.subscription.start;
|
let current = Date.now() - user.subscription.start;
|
||||||
current = (current / total) * 100;
|
current = (current / total) * 100;
|
||||||
console.log(current);
|
|
||||||
let lastTrialDialogShownAt = MMKV.getString("lastTrialDialogShownAt");
|
let lastTrialDialogShownAt = MMKV.getString("lastTrialDialogShownAt");
|
||||||
|
|
||||||
if (current > 75 && isTrial && lastTrialDialogShownAt !== "ending") {
|
if (current > 75 && isTrial && lastTrialDialogShownAt !== "ending") {
|
||||||
|
|||||||
@@ -18,17 +18,15 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { Platform } from "react-native";
|
import { Platform } from "react-native";
|
||||||
|
import Orientation from "react-native-orientation";
|
||||||
import { enabled } from "react-native-privacy-snapshot";
|
import { enabled } from "react-native-privacy-snapshot";
|
||||||
import { SettingStore } from "../stores/use-setting-store";
|
import { MMKV } from "../common/database/mmkv";
|
||||||
import { useSettingStore } from "../stores/use-setting-store";
|
import { SettingStore, useSettingStore } from "../stores/use-setting-store";
|
||||||
|
import { ThemeStore } from "../stores/use-theme-store";
|
||||||
import { AndroidModule } from "../utils";
|
import { AndroidModule } from "../utils";
|
||||||
import { getColorScheme } from "../utils/color-scheme/utils";
|
import { getColorScheme } from "../utils/color-scheme/utils";
|
||||||
import { MMKV } from "../common/database/mmkv";
|
|
||||||
import { scale, updateSize } from "../utils/size";
|
import { scale, updateSize } from "../utils/size";
|
||||||
import Notifications from "./notifications";
|
|
||||||
import Orientation from "react-native-orientation";
|
|
||||||
import { DDS } from "./device-detection";
|
import { DDS } from "./device-detection";
|
||||||
import { ThemeStore } from "../stores/use-theme-store";
|
|
||||||
|
|
||||||
function migrate(settings: SettingStore["settings"]) {
|
function migrate(settings: SettingStore["settings"]) {
|
||||||
if (settings.migrated) return true;
|
if (settings.migrated) return true;
|
||||||
@@ -36,7 +34,6 @@ function migrate(settings: SettingStore["settings"]) {
|
|||||||
const introCompleted = MMKV.getString("introCompleted");
|
const introCompleted = MMKV.getString("introCompleted");
|
||||||
|
|
||||||
if (!introCompleted) {
|
if (!introCompleted) {
|
||||||
console.log("no need to migrate");
|
|
||||||
settings.migrated = true;
|
settings.migrated = true;
|
||||||
set(settings);
|
set(settings);
|
||||||
return;
|
return;
|
||||||
@@ -44,7 +41,6 @@ function migrate(settings: SettingStore["settings"]) {
|
|||||||
|
|
||||||
settings.introCompleted = true;
|
settings.introCompleted = true;
|
||||||
MMKV.removeItem("introCompleted");
|
MMKV.removeItem("introCompleted");
|
||||||
console.log("migrated introCompleted", introCompleted);
|
|
||||||
|
|
||||||
let askForRating = MMKV.getString("askForRating");
|
let askForRating = MMKV.getString("askForRating");
|
||||||
if (askForRating) {
|
if (askForRating) {
|
||||||
@@ -56,7 +52,7 @@ function migrate(settings: SettingStore["settings"]) {
|
|||||||
askForRating as unknown as { timestamp: number }
|
askForRating as unknown as { timestamp: number }
|
||||||
).timestamp;
|
).timestamp;
|
||||||
}
|
}
|
||||||
console.log("migrated askForRating", askForRating);
|
|
||||||
MMKV.removeItem("askForRating");
|
MMKV.removeItem("askForRating");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -67,30 +63,25 @@ function migrate(settings: SettingStore["settings"]) {
|
|||||||
askForBackup as unknown as { timestamp: number }
|
askForBackup as unknown as { timestamp: number }
|
||||||
).timestamp;
|
).timestamp;
|
||||||
MMKV.removeItem("askForBackup");
|
MMKV.removeItem("askForBackup");
|
||||||
console.log("migrated askForBackup", askForBackup);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const lastBackupDate = MMKV.getString("backupDate");
|
const lastBackupDate = MMKV.getString("backupDate");
|
||||||
if (lastBackupDate) settings.lastBackupDate = parseInt(lastBackupDate);
|
if (lastBackupDate) settings.lastBackupDate = parseInt(lastBackupDate);
|
||||||
MMKV.removeItem("backupDate");
|
MMKV.removeItem("backupDate");
|
||||||
console.log("migrated backupDate", lastBackupDate);
|
|
||||||
|
|
||||||
const isUserEmailConfirmed = MMKV.getString("isUserEmailConfirmed");
|
const isUserEmailConfirmed = MMKV.getString("isUserEmailConfirmed");
|
||||||
if (isUserEmailConfirmed === "yes") settings.userEmailConfirmed = true;
|
if (isUserEmailConfirmed === "yes") settings.userEmailConfirmed = true;
|
||||||
if (isUserEmailConfirmed === "no") settings.userEmailConfirmed = false;
|
if (isUserEmailConfirmed === "no") settings.userEmailConfirmed = false;
|
||||||
console.log("migrated useEmailConfirmed", isUserEmailConfirmed);
|
|
||||||
|
|
||||||
MMKV.removeItem("isUserEmailConfirmed");
|
MMKV.removeItem("isUserEmailConfirmed");
|
||||||
|
|
||||||
const userHasSavedRecoveryKey = MMKV.getString("userHasSavedRecoveryKey");
|
const userHasSavedRecoveryKey = MMKV.getString("userHasSavedRecoveryKey");
|
||||||
if (userHasSavedRecoveryKey) settings.recoveryKeySaved = true;
|
if (userHasSavedRecoveryKey) settings.recoveryKeySaved = true;
|
||||||
MMKV.removeItem("userHasSavedRecoveryKey");
|
MMKV.removeItem("userHasSavedRecoveryKey");
|
||||||
console.log("migrated userHasSavedRecoveryKey", userHasSavedRecoveryKey);
|
|
||||||
|
|
||||||
const accentColor = MMKV.getString("accentColor");
|
const accentColor = MMKV.getString("accentColor");
|
||||||
if (accentColor) settings.theme.accent = accentColor;
|
if (accentColor) settings.theme.accent = accentColor;
|
||||||
MMKV.removeItem("accentColor");
|
MMKV.removeItem("accentColor");
|
||||||
console.log("migrated accentColor", accentColor);
|
|
||||||
|
|
||||||
let theme = MMKV.getString("theme");
|
let theme = MMKV.getString("theme");
|
||||||
if (theme) {
|
if (theme) {
|
||||||
@@ -103,16 +94,13 @@ function migrate(settings: SettingStore["settings"]) {
|
|||||||
if (backupStorageDir)
|
if (backupStorageDir)
|
||||||
settings.backupDirectoryAndroid = JSON.parse(backupStorageDir);
|
settings.backupDirectoryAndroid = JSON.parse(backupStorageDir);
|
||||||
MMKV.removeItem("backupStorageDir");
|
MMKV.removeItem("backupStorageDir");
|
||||||
console.log("migrated backupStorageDir", backupStorageDir);
|
|
||||||
|
|
||||||
const dontShowCompleteSheet = MMKV.getString("dontShowCompleteSheet");
|
const dontShowCompleteSheet = MMKV.getString("dontShowCompleteSheet");
|
||||||
if (dontShowCompleteSheet) settings.showBackupCompleteSheet = false;
|
if (dontShowCompleteSheet) settings.showBackupCompleteSheet = false;
|
||||||
MMKV.removeItem("dontShowCompleteSheet");
|
MMKV.removeItem("dontShowCompleteSheet");
|
||||||
console.log("migrated dontShowCompleteSheet", dontShowCompleteSheet);
|
|
||||||
|
|
||||||
settings.migrated = true;
|
settings.migrated = true;
|
||||||
set(settings);
|
set(settings);
|
||||||
console.log("migrated completed");
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -129,9 +117,6 @@ function init() {
|
|||||||
...JSON.parse(settingsJson)
|
...JSON.parse(settingsJson)
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
if (settings.notifNotes) {
|
|
||||||
Notifications.pinQuickNote(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (settings.fontScale) {
|
if (settings.fontScale) {
|
||||||
scale.fontScale = settings.fontScale;
|
scale.fontScale = settings.fontScale;
|
||||||
|
|||||||
@@ -62,12 +62,10 @@ const run = async (
|
|||||||
}
|
}
|
||||||
userstore.setSyncing(true);
|
userstore.setSyncing(true);
|
||||||
let error = null;
|
let error = null;
|
||||||
console.log("Sync.run started");
|
|
||||||
try {
|
try {
|
||||||
console.log("DO IN BACKGROUND START");
|
|
||||||
let res = await doInBackground(async () => {
|
let res = await doInBackground(async () => {
|
||||||
try {
|
try {
|
||||||
console.log("DO IN BACKGROUND");
|
|
||||||
await db.sync(full, forced);
|
await db.sync(full, forced);
|
||||||
return true;
|
return true;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
@@ -89,7 +87,6 @@ const run = async (
|
|||||||
userstore.user
|
userstore.user
|
||||||
) {
|
) {
|
||||||
userstore.setSyncing(false);
|
userstore.setSyncing(false);
|
||||||
console.log(status.isConnected, status.isInternetReachable);
|
|
||||||
if (status.isConnected && status.isInternetReachable) {
|
if (status.isConnected && status.isInternetReachable) {
|
||||||
ToastEvent.error(e, "Sync failed", context);
|
ToastEvent.error(e, "Sync failed", context);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -138,7 +138,7 @@ export const useTip = (
|
|||||||
return () => {
|
return () => {
|
||||||
clearInterval(intervalRef.current);
|
clearInterval(intervalRef.current);
|
||||||
};
|
};
|
||||||
}, [context, fallback, options.delay, options?.rotate]);
|
}, [context, fallback, options?.delay, options?.rotate]);
|
||||||
|
|
||||||
return tip;
|
return tip;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -37,7 +37,6 @@ export const useEditorStore = create<EditorStore>((set, get) => ({
|
|||||||
setCurrentlyEditingNote: (note) => set({ currentEditingNote: note }),
|
setCurrentlyEditingNote: (note) => set({ currentEditingNote: note }),
|
||||||
sessionId: null,
|
sessionId: null,
|
||||||
setSessionId: (sessionId) => {
|
setSessionId: (sessionId) => {
|
||||||
console.log(sessionId, "session id");
|
|
||||||
// tiny.call(EditorWebView, `sessionId="${sessionId}";`);
|
// tiny.call(EditorWebView, `sessionId="${sessionId}";`);
|
||||||
set({ sessionId });
|
set({ sessionId });
|
||||||
},
|
},
|
||||||
@@ -54,7 +53,7 @@ export const useEditorStore = create<EditorStore>((set, get) => ({
|
|||||||
}
|
}
|
||||||
const func = (value: string) => {
|
const func = (value: string) => {
|
||||||
eUnSubscribeEvent("selectionvalue", func);
|
eUnSubscribeEvent("selectionvalue", func);
|
||||||
console.log("setSearchReplace:", value, value.length);
|
|
||||||
if (!value && get().searchReplace) {
|
if (!value && get().searchReplace) {
|
||||||
// endSearch();
|
// endSearch();
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -96,7 +96,6 @@ export const useMessageStore = create<MessageStore>((set, get) => ({
|
|||||||
icon: "account-outline"
|
icon: "account-outline"
|
||||||
},
|
},
|
||||||
setMessage: (message) => {
|
setMessage: (message) => {
|
||||||
console.log("setting message");
|
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
if (get().message.visible || message.visible) {
|
if (get().message.visible || message.visible) {
|
||||||
layoutmanager.withAnimation();
|
layoutmanager.withAnimation();
|
||||||
@@ -131,16 +130,12 @@ export const useMessageStore = create<MessageStore>((set, get) => ({
|
|||||||
announcements = [];
|
announcements = [];
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.log("ERROR", e);
|
console.log(e);
|
||||||
set({ announcements: [] });
|
set({ announcements: [] });
|
||||||
} finally {
|
} finally {
|
||||||
const all = await getFiltered(announcements);
|
const all = await getFiltered(announcements);
|
||||||
|
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
if (all.filter((a) => a.type === "inline").length !== 0) {
|
|
||||||
console.log("with setAnnouncement ");
|
|
||||||
layoutmanager.withAnimation();
|
|
||||||
}
|
|
||||||
set({
|
set({
|
||||||
announcements: all.filter((a) => a.type === "inline"),
|
announcements: all.filter((a) => a.type === "inline"),
|
||||||
dialogs: all.filter((a) => a.type === "dialog")
|
dialogs: all.filter((a) => a.type === "dialog")
|
||||||
|
|||||||
@@ -103,7 +103,7 @@ export function getColorScheme(overrideSystemTheme) {
|
|||||||
});
|
});
|
||||||
return COLOR_SCHEME;
|
return COLOR_SCHEME;
|
||||||
}
|
}
|
||||||
console.log("override system theme");
|
|
||||||
setAccentColor(theme.accent);
|
setAccentColor(theme.accent);
|
||||||
setColorScheme(theme.dark ? darkTheme : COLOR_SCHEME_LIGHT);
|
setColorScheme(theme.dark ? darkTheme : COLOR_SCHEME_LIGHT);
|
||||||
return COLOR_SCHEME;
|
return COLOR_SCHEME;
|
||||||
|
|||||||
@@ -149,7 +149,7 @@ export const deleteItems = async (item) => {
|
|||||||
useSelectionStore.getState().clearSelection(true);
|
useSelectionStore.getState().clearSelection(true);
|
||||||
useMenuStore.getState().setMenuPins();
|
useMenuStore.getState().setMenuPins();
|
||||||
useMenuStore.getState().setColorNotes();
|
useMenuStore.getState().setColorNotes();
|
||||||
console.log("running search again");
|
|
||||||
SearchService.updateAndSearch();
|
SearchService.updateAndSearch();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -113,7 +113,6 @@ export async function doInBackground(cb) {
|
|||||||
// eslint-disable-next-line no-async-promise-executor
|
// eslint-disable-next-line no-async-promise-executor
|
||||||
return new Promise(async (res) => {
|
return new Promise(async (res) => {
|
||||||
try {
|
try {
|
||||||
console.log("APP STATE AT SYNC: ", AppState.currentState);
|
|
||||||
let result = await cb();
|
let result = await cb();
|
||||||
res(result);
|
res(result);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
|||||||
@@ -27,7 +27,6 @@ jestExpect.extend({ toMatchImageSnapshot });
|
|||||||
const sleep = (duration) =>
|
const sleep = (duration) =>
|
||||||
new Promise((resolve) =>
|
new Promise((resolve) =>
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
console.log("Sleeping for " + duration / 1000 + " secs");
|
|
||||||
resolve();
|
resolve();
|
||||||
}, duration)
|
}, duration)
|
||||||
);
|
);
|
||||||
@@ -111,7 +110,6 @@ const testvars = {
|
|||||||
|
|
||||||
async function prepare() {
|
async function prepare() {
|
||||||
if (testvars.isFirstTest) {
|
if (testvars.isFirstTest) {
|
||||||
console.log("Launching App Directly without reset");
|
|
||||||
testvars.isFirstTest = false;
|
testvars.isFirstTest = false;
|
||||||
return await LaunchApp();
|
return await LaunchApp();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ UIManager.setLayoutAnimationEnabledExperimental &&
|
|||||||
UIManager.setLayoutAnimationEnabledExperimental(true);
|
UIManager.setLayoutAnimationEnabledExperimental(true);
|
||||||
|
|
||||||
if (__DEV__) {
|
if (__DEV__) {
|
||||||
|
console.warn = () => null;
|
||||||
LogBox.ignoreAllLogs();
|
LogBox.ignoreAllLogs();
|
||||||
}
|
}
|
||||||
let NotesnookShare;
|
let NotesnookShare;
|
||||||
|
|||||||
@@ -119,7 +119,7 @@ function removeInvalidElements(document) {
|
|||||||
|
|
||||||
function replaceSrcWithAbsoluteUrls(document, baseUrl) {
|
function replaceSrcWithAbsoluteUrls(document, baseUrl) {
|
||||||
let images = document.querySelectorAll("img");
|
let images = document.querySelectorAll("img");
|
||||||
console.log(images.length);
|
|
||||||
for (var i = 0; i < images.length; i++) {
|
for (var i = 0; i < images.length; i++) {
|
||||||
let img = images[i];
|
let img = images[i];
|
||||||
let url = getBaseUrl(baseUrl);
|
let url = getBaseUrl(baseUrl);
|
||||||
@@ -137,7 +137,7 @@ function replaceSrcWithAbsoluteUrls(document, baseUrl) {
|
|||||||
img.setAttribute("src", src);
|
img.setAttribute("src", src);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
console.log("end");
|
|
||||||
return document;
|
return document;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -216,13 +216,11 @@ const ShareView = ({ quicknote = false }) => {
|
|||||||
let kHeight = event.endCoordinates.height;
|
let kHeight = event.endCoordinates.height;
|
||||||
keyboardHeight.current = kHeight;
|
keyboardHeight.current = kHeight;
|
||||||
setKh(kHeight);
|
setKh(kHeight);
|
||||||
console.log("keyboard show/hide");
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const onKeyboardDidHide = () => {
|
const onKeyboardDidHide = () => {
|
||||||
keyboardHeight.current = 0;
|
keyboardHeight.current = 0;
|
||||||
setKh(0);
|
setKh(0);
|
||||||
console.log("keyboard hide");
|
|
||||||
};
|
};
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@@ -278,7 +276,7 @@ const ShareView = ({ quicknote = false }) => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
setNote({ ...note });
|
setNote({ ...note });
|
||||||
console.log(data, "share data");
|
|
||||||
onLoad();
|
onLoad();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error(e);
|
console.error(e);
|
||||||
@@ -418,7 +416,6 @@ const ShareView = ({ quicknote = false }) => {
|
|||||||
iconColor={colors.pri}
|
iconColor={colors.pri}
|
||||||
onPress={() => {
|
onPress={() => {
|
||||||
if (showSearch) {
|
if (showSearch) {
|
||||||
console.log("hide search");
|
|
||||||
setShowSearch(false);
|
setShowSearch(false);
|
||||||
} else {
|
} else {
|
||||||
close();
|
close();
|
||||||
@@ -460,7 +457,6 @@ const ShareView = ({ quicknote = false }) => {
|
|||||||
activeOpacity={1}
|
activeOpacity={1}
|
||||||
onPress={() => {
|
onPress={() => {
|
||||||
if (showSearch) {
|
if (showSearch) {
|
||||||
console.log("hide search");
|
|
||||||
setShowSearch(false);
|
setShowSearch(false);
|
||||||
} else {
|
} else {
|
||||||
close();
|
close();
|
||||||
|
|||||||
@@ -12,6 +12,7 @@
|
|||||||
"prepare:ios": "nx install-pods @notesnook/mobile",
|
"prepare:ios": "nx install-pods @notesnook/mobile",
|
||||||
"start:metro": "nx start @notesnook/mobile",
|
"start:metro": "nx start @notesnook/mobile",
|
||||||
"start:repack": "nx repack @notesnook/mobile",
|
"start:repack": "nx repack @notesnook/mobile",
|
||||||
|
"start:editor-mobile": "nx start @notesnook/editor-mobile",
|
||||||
"prettier": "npx prettier . --write",
|
"prettier": "npx prettier . --write",
|
||||||
"lint": "npx eslint ./apps/ ./packages/",
|
"lint": "npx eslint ./apps/ ./packages/",
|
||||||
"linc": "npx eslint ./apps/ ./packages/ --cache"
|
"linc": "npx eslint ./apps/ ./packages/ --cache"
|
||||||
|
|||||||
@@ -107,7 +107,6 @@ const Tiptap = ({
|
|||||||
useLayoutEffect(() => {
|
useLayoutEffect(() => {
|
||||||
setLayout(true);
|
setLayout(true);
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<div
|
<div
|
||||||
|
|||||||
@@ -104,7 +104,7 @@ declare global {
|
|||||||
>;
|
>;
|
||||||
}>;
|
}>;
|
||||||
|
|
||||||
function logger(type: "info" | "warn" | "error", ...logs: never[]): void;
|
function logger(type: "info" | "warn" | "error", ...logs: unknown[]): void;
|
||||||
/**
|
/**
|
||||||
* Function to post message to react native
|
* Function to post message to react native
|
||||||
* @param type
|
* @param type
|
||||||
@@ -148,7 +148,7 @@ export function isReactNative(): boolean {
|
|||||||
return !!window.ReactNativeWebView;
|
return !!window.ReactNativeWebView;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function logger(type: "info" | "warn" | "error", ...logs: never[]) {
|
export function logger(type: "info" | "warn" | "error", ...logs: unknown[]) {
|
||||||
const logString = logs
|
const logString = logs
|
||||||
.map((log) => {
|
.map((log) => {
|
||||||
return typeof log !== "string" ? JSON.stringify(log) : log;
|
return typeof log !== "string" ? JSON.stringify(log) : log;
|
||||||
|
|||||||
1890
packages/theme/package-lock.json
generated
1890
packages/theme/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user