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