From 8e54aa83c709e7cc04265acb2583c07ea0bbf37c Mon Sep 17 00:00:00 2001 From: Dwynr Date: Mon, 12 Jun 2023 16:18:13 +0200 Subject: [PATCH] bump version, misc --- .vscode/settings.json | 3 +- android/app/build.gradle | 4 +- ios/Filen.xcodeproj/project.pbxproj | 8 +-- .../xcshareddata/xcschemes/Filen.xcscheme | 2 +- package.json | 2 +- src/i18n/lang/zh/zh.ts | 2 +- src/lib/db/db.ts | 71 +++++-------------- src/lib/services/cameraUpload/cameraUpload.ts | 2 +- src/screens/SettingsScreen/SettingsScreen.tsx | 38 +++++----- 9 files changed, 50 insertions(+), 82 deletions(-) diff --git a/.vscode/settings.json b/.vscode/settings.json index b06c5d898..871afe7e5 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -8,5 +8,6 @@ "source.fixAll.eslint": false, "source.fixAll.format": false }, - "typescript.tsdk": "node_modules\\typescript\\lib" + "typescript.tsdk": "node_modules\\typescript\\lib", + "java.configuration.updateBuildConfiguration": "disabled" } diff --git a/android/app/build.gradle b/android/app/build.gradle index 6a61dd13c..ba1a06c5e 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -118,8 +118,8 @@ android { applicationId "io.filen.app" minSdkVersion rootProject.ext.minSdkVersion targetSdkVersion rootProject.ext.targetSdkVersion - versionCode 2059 - versionName "2.0.59" + versionCode 2060 + versionName "2.0.60" } splits { diff --git a/ios/Filen.xcodeproj/project.pbxproj b/ios/Filen.xcodeproj/project.pbxproj index bb1a160b7..0a1c68256 100644 --- a/ios/Filen.xcodeproj/project.pbxproj +++ b/ios/Filen.xcodeproj/project.pbxproj @@ -648,7 +648,7 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; CODE_SIGN_ENTITLEMENTS = Filen/Filen.entitlements; - CURRENT_PROJECT_VERSION = 2059; + CURRENT_PROJECT_VERSION = 2060; DEVELOPMENT_TEAM = 7YTW5D2K7P; ENABLE_BITCODE = NO; INFOPLIST_FILE = Filen/Info.plist; @@ -657,7 +657,7 @@ "$(inherited)", "@executable_path/Frameworks", ); - MARKETING_VERSION = 2.0.59; + MARKETING_VERSION = 2.0.60; OTHER_LDFLAGS = ( "$(inherited)", "-ObjC", @@ -685,7 +685,7 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; CODE_SIGN_ENTITLEMENTS = Filen/Filen.entitlements; - CURRENT_PROJECT_VERSION = 2059; + CURRENT_PROJECT_VERSION = 2060; DEVELOPMENT_TEAM = 7YTW5D2K7P; INFOPLIST_FILE = Filen/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 13.0; @@ -693,7 +693,7 @@ "$(inherited)", "@executable_path/Frameworks", ); - MARKETING_VERSION = 2.0.59; + MARKETING_VERSION = 2.0.60; OTHER_LDFLAGS = ( "$(inherited)", "-ObjC", diff --git a/ios/Filen.xcodeproj/xcshareddata/xcschemes/Filen.xcscheme b/ios/Filen.xcodeproj/xcshareddata/xcschemes/Filen.xcscheme index b4c796f5a..8ac4529eb 100644 --- a/ios/Filen.xcodeproj/xcshareddata/xcschemes/Filen.xcscheme +++ b/ios/Filen.xcodeproj/xcshareddata/xcschemes/Filen.xcscheme @@ -41,7 +41,7 @@ (key: string): Promise => { try { const value = storage.getString(PREFIX + key) - if (typeof value == "undefined") { + if (typeof value === "undefined") { return null } @@ -110,10 +109,6 @@ export const hashDbFsKey = memoize(async (key: string): Promise => { export const dbFs = { get: async (key: string) => { - if (memoryCache.has(PREFIX + key)) { - return memoryCache.get(PREFIX + key) as any as T - } - const keyHashed = await hashDbFsKey(key) const path = (await getDownloadPath({ type: "db" })) + keyHashed const stat = await fs.stat(path) @@ -148,14 +143,8 @@ export const dbFs = { encoding: "utf8" } ) - - memoryCache.set(PREFIX + key, value) }, has: async (key: string) => { - if (memoryCache.has(PREFIX + key)) { - return true - } - const keyHashed = await hashDbFsKey(key) const path = (await getDownloadPath({ type: "db" })) + keyHashed const stat = await fs.stat(path) @@ -176,8 +165,6 @@ export const dbFs = { } await fs.unlink(path) - - memoryCache.delete(PREFIX + key) }, warmUp: async () => { const path = await getDownloadPath({ type: "db" }) @@ -188,7 +175,7 @@ export const dbFs = { if (file.length === keyHashed.length) { const read = await fs.readAsString(path + file, "utf8") - if (read.slice(0, 64).indexOf("loadItems:") == -1) { + if (read.slice(0, 64).indexOf("loadItems:") === -1) { continue } @@ -202,11 +189,9 @@ export const dbFs = { continue } - if (value.key.indexOf("loadItems:") == -1) { + if (value.key.indexOf("loadItems:") === -1) { continue } - - memoryCache.set(PREFIX + value.key, value.value) } } } @@ -242,21 +227,14 @@ export const cameraUpload = { }, setLastModified: async (asset: Asset, lastModified: number): Promise => { const assetId = getAssetId(asset) - const [result] = await query( - "SELECT rowid FROM camera_upload_last_modified WHERE asset_id = ? ORDER BY rowid DESC LIMIT 1", - [assetId] - ) - const hasRow = result.rows.length == 1 + const [result] = await query("SELECT rowid FROM camera_upload_last_modified WHERE asset_id = ? ORDER BY rowid DESC LIMIT 1", [ + assetId + ]) + const hasRow = result.rows.length === 1 await (hasRow - ? query("UPDATE camera_upload_last_modified SET last_modified = ? WHERE asset_id = ?", [ - lastModified, - assetId - ]) - : query("INSERT INTO camera_upload_last_modified (asset_id, last_modified) VALUES (?, ?)", [ - assetId, - lastModified - ])) + ? query("UPDATE camera_upload_last_modified SET last_modified = ? WHERE asset_id = ?", [lastModified, assetId]) + : query("INSERT INTO camera_upload_last_modified (asset_id, last_modified) VALUES (?, ?)", [assetId, lastModified])) }, getLastModifiedStat: async (asset: Asset): Promise => { const assetId = getAssetId(asset) @@ -273,28 +251,18 @@ export const cameraUpload = { }, setLastModifiedStat: async (asset: Asset, lastModified: number): Promise => { const assetId = getAssetId(asset) - const [result] = await query( - "SELECT rowid FROM camera_upload_last_modified_stat WHERE asset_id = ? ORDER BY rowid DESC LIMIT 1", - [assetId] - ) - const hasRow = result.rows.length == 1 + const [result] = await query("SELECT rowid FROM camera_upload_last_modified_stat WHERE asset_id = ? ORDER BY rowid DESC LIMIT 1", [ + assetId + ]) + const hasRow = result.rows.length === 1 await (hasRow - ? query("UPDATE camera_upload_last_modified_stat SET last_modified = ? WHERE asset_id = ?", [ - lastModified, - assetId - ]) - : query("INSERT INTO camera_upload_last_modified_stat (asset_id, last_modified) VALUES (?, ?)", [ - assetId, - lastModified - ])) + ? query("UPDATE camera_upload_last_modified_stat SET last_modified = ? WHERE asset_id = ?", [lastModified, assetId]) + : query("INSERT INTO camera_upload_last_modified_stat (asset_id, last_modified) VALUES (?, ?)", [assetId, lastModified])) }, getLastSize: async (asset: Asset): Promise => { const assetId = getAssetId(asset) - const [result] = await query( - "SELECT size FROM camera_upload_last_size WHERE asset_id = ? ORDER BY rowid DESC LIMIT 1", - [assetId] - ) + const [result] = await query("SELECT size FROM camera_upload_last_size WHERE asset_id = ? ORDER BY rowid DESC LIMIT 1", [assetId]) if (result.rows.length !== 1) { return -1 @@ -304,11 +272,8 @@ export const cameraUpload = { }, setLastSize: async (asset: Asset, size: number): Promise => { const assetId = getAssetId(asset) - const [result] = await query( - "SELECT rowid FROM camera_upload_last_size WHERE asset_id = ? ORDER BY rowid DESC LIMIT 1", - [assetId] - ) - const hasRow = result.rows.length == 1 + const [result] = await query("SELECT rowid FROM camera_upload_last_size WHERE asset_id = ? ORDER BY rowid DESC LIMIT 1", [assetId]) + const hasRow = result.rows.length === 1 await (hasRow ? query("UPDATE camera_upload_last_size SET size = ? WHERE asset_id = ?", [size, assetId]) diff --git a/src/lib/services/cameraUpload/cameraUpload.ts b/src/lib/services/cameraUpload/cameraUpload.ts index 54ba53cc9..abaf53e37 100644 --- a/src/lib/services/cameraUpload/cameraUpload.ts +++ b/src/lib/services/cameraUpload/cameraUpload.ts @@ -544,7 +544,7 @@ export const getAssetURI = async (asset: MediaLibrary.Asset) => { } export const convertHeicToJPGIOS = async (inputPath: string) => { - if (!inputPath.toLowerCase().endsWith(".heic")) { + if (!inputPath.toLowerCase().endsWith(".heic") || Platform.OS !== "ios") { return inputPath } diff --git a/src/screens/SettingsScreen/SettingsScreen.tsx b/src/screens/SettingsScreen/SettingsScreen.tsx index 84cd239a2..4cbc4e2d8 100644 --- a/src/screens/SettingsScreen/SettingsScreen.tsx +++ b/src/screens/SettingsScreen/SettingsScreen.tsx @@ -857,24 +857,26 @@ export const SettingsScreen = memo(({ navigation, route }: SettingsScreenProps) /> } /> - setHideEditorLineNumbers(!hideEditorLineNumbers)} - value={hideEditorLineNumbers} - /> - } - /> + {Platform.OS === "ios" && ( + setHideEditorLineNumbers(!hideEditorLineNumbers)} + value={hideEditorLineNumbers} + /> + } + /> + )}