diff --git a/apps/mobile/.gitignore b/apps/mobile/.gitignore index d3b27e403..738a6ab8f 100644 --- a/apps/mobile/.gitignore +++ b/apps/mobile/.gitignore @@ -14,7 +14,9 @@ build_cache/ .yarnrc.yml .yarn *.log - +.cxx/ +*.keystore +!debug.keystore # Xcode # diff --git a/apps/mobile/__tests__/App-test.js b/apps/mobile/__tests__/App-test.js index 8defb77d8..1362d9405 100644 --- a/apps/mobile/__tests__/App-test.js +++ b/apps/mobile/__tests__/App-test.js @@ -3,6 +3,7 @@ */ import "react-native"; +import { it } from "@jest/globals"; // Note: test renderer must be required after react-native. import renderer from "react-test-renderer"; import Heading from "../app/components/ui/typography/heading"; diff --git a/apps/mobile/app/common/filesystem/download.js b/apps/mobile/app/common/filesystem/download.js index 0719e8878..9a3710592 100644 --- a/apps/mobile/app/common/filesystem/download.js +++ b/apps/mobile/app/common/filesystem/download.js @@ -46,6 +46,7 @@ export async function downloadFile(filename, data, cancelToken) { if (!downloadUrl) throw new Error("Unable to resolve download url"); let totalSize = 0; + console.log("Download starting"); let request = RNFetchBlob.config({ path: path, IOSBackgroundTask: true diff --git a/apps/mobile/app/common/filesystem/upload.js b/apps/mobile/app/common/filesystem/upload.js index fbc325342..19ec7446c 100644 --- a/apps/mobile/app/common/filesystem/upload.js +++ b/apps/mobile/app/common/filesystem/upload.js @@ -19,7 +19,7 @@ along with this program. If not, see . import RNFetchBlob from "react-native-blob-util"; import { useAttachmentStore } from "../../stores/use-attachment-store"; -import { db } from "../database"; +import { DatabaseLogger, db } from "../database"; import { cacheDir } from "./utils"; import { isImage, isDocument } from "@notesnook/core/utils/filename"; import { Platform } from "react-native"; @@ -29,7 +29,8 @@ export async function uploadFile(filename, data, cancelToken) { if (!data) return false; let { url, headers } = data; - console.log("uploading file: ", filename, headers); + DatabaseLogger.info(`Preparing to upload file: ${filename}`); + try { let res = await fetch(url, { method: "PUT", @@ -37,7 +38,7 @@ export async function uploadFile(filename, data, cancelToken) { }); if (!res.ok) throw new Error(`${res.status}: Unable to resolve upload url`); const uploadUrl = await res.text(); - if (!uploadUrl) throw new Error("Unable to resolve upload url"); + if (!uploadUrl) throw new Error("Unable to resolve attachment upload url"); let uploadFilePath = `${cacheDir}/${filename}`; const iosAppGroup = @@ -49,6 +50,7 @@ export async function uploadFile(filename, data, cancelToken) { if (!exists && Platform.OS === "ios") { uploadFilePath = appGroupPath; } + DatabaseLogger.info(`Starting upload: ${filename}`); let request = RNFetchBlob.config({ IOSBackgroundTask: !globalThis["IS_SHARE_EXTENSION"] }) @@ -64,7 +66,7 @@ export async function uploadFile(filename, data, cancelToken) { useAttachmentStore .getState() .setProgress(sent, total, filename, 0, "upload"); - console.log("uploading: ", sent, total); + DatabaseLogger.info(`uploading file: ${sent}/${total}`); }); cancelToken.cancel = request.cancel; let response = await request; @@ -83,11 +85,12 @@ export async function uploadFile(filename, data, cancelToken) { RNFetchBlob.fs.unlink(`${cacheDir}/${filename}`).catch(console.log); } } - + DatabaseLogger.info(`File uploaded: ${filename}`); return result; } catch (e) { useAttachmentStore.getState().remove(filename); - console.log("upload file: ", e, url, headers); + DatabaseLogger.info(`File upload error: ${filename}, ${e}`); + DatabaseLogger.error(e); return false; } } diff --git a/apps/mobile/app/components/app-lock-overlay/index.js b/apps/mobile/app/components/app-lock-overlay/index.js index ef6c3acde..cf60f4d5a 100644 --- a/apps/mobile/app/components/app-lock-overlay/index.js +++ b/apps/mobile/app/components/app-lock-overlay/index.js @@ -202,7 +202,7 @@ const AppLockedOverlay = () => { width={250} onPress={onUnlockAppRequested} icon={"fingerprint"} - type={user ? "grayAccent" : "accent"} + type="transparent" /> diff --git a/apps/mobile/app/components/attachments/index.js b/apps/mobile/app/components/attachments/index.js index b66185b46..ad780a2af 100644 --- a/apps/mobile/app/components/attachments/index.js +++ b/apps/mobile/app/components/attachments/index.js @@ -19,7 +19,7 @@ along with this program. If not, see . import React, { useRef, useState } from "react"; import { ActivityIndicator, ScrollView, View } from "react-native"; -import { FlatList } from "react-native-actions-sheet"; + import Icon from "react-native-vector-icons/MaterialCommunityIcons"; import { db } from "../../common/database"; import filesystem from "../../common/filesystem"; @@ -41,10 +41,12 @@ import { isImage, isVideo } from "@notesnook/core/utils/filename"; +import { useSettingStore } from "../../stores/use-setting-store"; +import { FlashList } from "react-native-actions-sheet/dist/src/views/FlashList"; export const AttachmentDialog = ({ note }) => { const colors = useThemeStore((state) => state.colors); - + const { height } = useSettingStore((state) => state.dimensions); const [attachments, setAttachments] = useState( note ? db.attachments.ofNote(note.id, "all") @@ -159,7 +161,8 @@ export const AttachmentDialog = ({ note }) => { style={{ width: "100%", alignSelf: "center", - paddingHorizontal: 12 + paddingHorizontal: 12, + height: height * 0.85 }} > @@ -228,51 +231,48 @@ export const AttachmentDialog = ({ note }) => { }} /> - + + {attachmentTypes.map((item) => ( +