@@ -87,7 +87,7 @@ public class GRDBDatabaseStorageAdapter: NSObject {
8787 return primaryFolderName
8888 }
8989 if let primaryFolderName = CurrentAppContext ( ) . appUserDefaults ( ) . string ( forKey: DirectoryMode . primaryFolderNameKey) {
90- // Make sure its also written to the file.
90+ // Make sure it's also written to the file.
9191 OWSFileSystem . ensureDirectoryExists ( fileUrl. deletingLastPathComponent ( ) . path)
9292 try ? primaryFolderName. write ( toFile: fileUrl. pathExtension, atomically: true , encoding: . utf8)
9393 return primaryFolderName
@@ -97,7 +97,7 @@ public class GRDBDatabaseStorageAdapter: NSObject {
9797
9898 fileprivate static func writeStoredPrimaryFolderName( _ newPrimaryFolderName: String ) {
9999 CurrentAppContext ( ) . appUserDefaults ( ) . set ( newPrimaryFolderName, forKey: DirectoryMode . primaryFolderNameKey)
100- // Make sure its also written to the file.
100+ // Make sure it's also written to the file.
101101 let fileUrl = storedPrimaryFolderNameFileUrl ( )
102102 OWSFileSystem . ensureDirectoryExists ( fileUrl. deletingLastPathComponent ( ) . path)
103103 try ? newPrimaryFolderName. write ( toFile: fileUrl. pathExtension, atomically: true , encoding: . utf8)
@@ -139,9 +139,6 @@ public class GRDBDatabaseStorageAdapter: NSObject {
139139 } catch {
140140 throw error
141141 }
142-
143- super. init ( )
144- setUpDatabasePathKVO ( )
145142 }
146143
147144 deinit {
@@ -207,7 +204,7 @@ public class GRDBDatabaseStorageAdapter: NSObject {
207204
208205 private var darwinToken : Int32 ?
209206
210- func setUpDatabasePathKVO( ) {
207+ public func setUpDatabasePathKVO( ) {
211208 darwinToken = DarwinNotificationCenter . addObserver (
212209 for: . primaryDBFolderNameDidChange,
213210 queue: . main,
@@ -351,7 +348,7 @@ extension GRDBDatabaseStorageAdapter {
351348 }
352349
353350 public static func promoteTransferDirectoryToPrimary( ) {
354- owsAssert ( CurrentAppContext ( ) . isMainApp, " Only the main app can't swap databases " )
351+ owsAssert ( CurrentAppContext ( ) . isMainApp, " Only the main app can swap databases " )
355352
356353 // Ordering matters here. We should be able to crash and recover without issue
357354 // A prior run may have already performed the swap but crashed, so we should not expect a transfer folder
@@ -863,7 +860,11 @@ public struct GRDBKeyFetcher {
863860 public static let kSQLCipherKeySpecLength : Int32 = 48
864861 }
865862
866- let keychainStorage : any KeychainStorage
863+ private let keychainStorage : any KeychainStorage
864+
865+ public init ( keychainStorage: any KeychainStorage ) {
866+ self . keychainStorage = keychainStorage
867+ }
867868
868869 func fetchString( ) throws -> String {
869870 // Use a raw key spec, where the 96 hexadecimal digits are provided
0 commit comments