From 3653b04a811214f713cb349b3652dd8db84411ee Mon Sep 17 00:00:00 2001 From: Philipp Schmid <25935690+phil1995@users.noreply.github.com> Date: Tue, 19 Jul 2022 16:41:03 +0200 Subject: [PATCH 1/2] Revert "Optimize `cacheMetadata(itemMetadataList:)` by using UPSERT" This reverts commit 406887b470651f67102e9ac4b7c8538755a7ac83. --- .../DB/ItemMetadataDBManager.swift | 39 +++++-------------- 1 file changed, 10 insertions(+), 29 deletions(-) diff --git a/CryptomatorFileProvider/DB/ItemMetadataDBManager.swift b/CryptomatorFileProvider/DB/ItemMetadataDBManager.swift index bf089d7b6..93518a375 100644 --- a/CryptomatorFileProvider/DB/ItemMetadataDBManager.swift +++ b/CryptomatorFileProvider/DB/ItemMetadataDBManager.swift @@ -80,38 +80,19 @@ class ItemMetadataDBManager: ItemMetadataManager { } } + // TODO: Optimize Code and/or DB Scheme func cacheMetadata(_ itemMetadataList: [ItemMetadata]) throws { try database.write { db in for metadata in itemMetadataList { - try db.execute( - sql: """ - INSERT INTO \(ItemMetadata.databaseTableName) - (\(ItemMetadata.Columns.name), \(ItemMetadata.Columns.type), \(ItemMetadata.Columns.size), \(ItemMetadata.Columns.parentID), \(ItemMetadata.Columns.lastModifiedDate), \(ItemMetadata.Columns.statusCode), \(ItemMetadata.Columns.cloudPath), \(ItemMetadata.Columns.isPlaceholderItem), \(ItemMetadata.Columns.isMaybeOutdated), \(ItemMetadata.Columns.favoriteRank), \(ItemMetadata.Columns.tagData)) VALUES - (:name, :type, :size, :parentID, :lastModifiedDate, :statusCode, :cloudPath, :isPlaceholderItem, :isMaybeOutdated, :favoriteRank, :tagData) - ON CONFLICT (\(ItemMetadata.Columns.cloudPath)) - DO UPDATE SET \(ItemMetadata.Columns.name) = excluded.\(ItemMetadata.Columns.name), - \(ItemMetadata.Columns.type) = excluded.\(ItemMetadata.Columns.type), - \(ItemMetadata.Columns.size) = excluded.\(ItemMetadata.Columns.size), - \(ItemMetadata.Columns.parentID) = excluded.\(ItemMetadata.Columns.parentID), - \(ItemMetadata.Columns.lastModifiedDate) = excluded.\(ItemMetadata.Columns.lastModifiedDate), - \(ItemMetadata.Columns.cloudPath) = excluded.\(ItemMetadata.Columns.cloudPath), - \(ItemMetadata.Columns.isPlaceholderItem) = excluded.\(ItemMetadata.Columns.isPlaceholderItem), - \(ItemMetadata.Columns.isMaybeOutdated) = excluded.\(ItemMetadata.Columns.isMaybeOutdated) - """, - arguments: ["name": metadata.name, - "type": metadata.type, - "size": metadata.size, - "parentID": metadata.parentID, - "lastModifiedDate": metadata.lastModifiedDate, - "statusCode": metadata.statusCode, - "cloudPath": metadata.cloudPath, - "isPlaceholderItem": metadata.isPlaceholderItem, - "isMaybeOutdated": metadata.isMaybeOutdated, - "favoriteRank": metadata.favoriteRank, - "tagData": metadata.tagData] - ) - let metadataID = db.lastInsertedRowID - metadata.id = metadataID + if let cachedMetadata = try ItemMetadata.fetchOne(db, key: ["cloudPath": metadata.cloudPath]) { + metadata.id = cachedMetadata.id + metadata.statusCode = cachedMetadata.statusCode + metadata.tagData = cachedMetadata.tagData + metadata.favoriteRank = cachedMetadata.favoriteRank + try metadata.update(db) + } else { + try metadata.insert(db) + } } } } From 1dc7e13f30d83c5e1b351221f1e4c0d59024bdc2 Mon Sep 17 00:00:00 2001 From: Tobias Hagemann Date: Tue, 19 Jul 2022 16:43:08 +0200 Subject: [PATCH 2/2] Preparing 2.4.1 --- Cryptomator.xcodeproj/project.pbxproj | 4 ++-- fastlane/changelog.txt | 2 ++ fastlane/metadata/de-DE/release_notes.txt | 2 ++ fastlane/metadata/en-US/release_notes.txt | 2 ++ 4 files changed, 8 insertions(+), 2 deletions(-) diff --git a/Cryptomator.xcodeproj/project.pbxproj b/Cryptomator.xcodeproj/project.pbxproj index 179c34196..a0b012550 100644 --- a/Cryptomator.xcodeproj/project.pbxproj +++ b/Cryptomator.xcodeproj/project.pbxproj @@ -3243,7 +3243,7 @@ GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; IPHONEOS_DEPLOYMENT_TARGET = 13.0; - MARKETING_VERSION = 2.4.0; + MARKETING_VERSION = 2.4.1; MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; MTL_FAST_MATH = YES; ONLY_ACTIVE_ARCH = YES; @@ -3305,7 +3305,7 @@ GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; IPHONEOS_DEPLOYMENT_TARGET = 13.0; - MARKETING_VERSION = 2.4.0; + MARKETING_VERSION = 2.4.1; MTL_ENABLE_DEBUG_INFO = NO; MTL_FAST_MATH = YES; OTHER_SWIFT_FLAGS = "-Xfrontend -warn-long-expression-type-checking=200 -Xfrontend -warn-long-function-bodies=200"; diff --git a/fastlane/changelog.txt b/fastlane/changelog.txt index f4413c48e..d576777dc 100644 --- a/fastlane/changelog.txt +++ b/fastlane/changelog.txt @@ -1,3 +1,5 @@ +Hotfix for "empty vaults" bug. Here are the release notes of 2.4.0: + - Added support for S3 (#238) - Added additional Shortcut intents for "Get Lock Status", "Open Vault", and "Lock Vault" (#229, #233) - Added quicker unlock when Touch ID / Face ID is set up (#225) diff --git a/fastlane/metadata/de-DE/release_notes.txt b/fastlane/metadata/de-DE/release_notes.txt index 1420f8a3e..736e0b190 100644 --- a/fastlane/metadata/de-DE/release_notes.txt +++ b/fastlane/metadata/de-DE/release_notes.txt @@ -1,3 +1,5 @@ +Hotfix für „leere Tresore“ Fehler. Hier sind die Release Notes von 2.4.0: + - Unterstützung für S3 hinzugefügt (#238) - Zusätzliche Shortcut-Intents für „Sperrstatus abfragen“, „Tresor öffnen“ und „Tresor sperren“ hinzugefügt (#229, #233) - Schnelleres Entsperren hinzugefügt, wenn Touch ID / Face ID eingerichtet ist (#225) diff --git a/fastlane/metadata/en-US/release_notes.txt b/fastlane/metadata/en-US/release_notes.txt index f4413c48e..d576777dc 100644 --- a/fastlane/metadata/en-US/release_notes.txt +++ b/fastlane/metadata/en-US/release_notes.txt @@ -1,3 +1,5 @@ +Hotfix for "empty vaults" bug. Here are the release notes of 2.4.0: + - Added support for S3 (#238) - Added additional Shortcut intents for "Get Lock Status", "Open Vault", and "Lock Vault" (#229, #233) - Added quicker unlock when Touch ID / Face ID is set up (#225)