You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
session-ios/SignalUtilitiesKit/Configuration.swift

40 lines
1.2 KiB
Swift

import SessionMessagingKit
import SessionSnodeKit
extension OWSPrimaryStorage : OWSPrimaryStorageProtocol { }
var isSetup: Bool = false // TODO: Remove this
@objc(SNConfiguration)
public final class Configuration : NSObject {
@objc public static func performMainSetup() {
// Need to do this first to ensure the legacy database exists
SNUtilitiesKit.configure(
owsPrimaryStorage: OWSPrimaryStorage.shared(),
maxFileSize: UInt(Double(FileServerAPIV2.maxFileSize) / FileServerAPIV2.fileSizeORMultiplier)
)
SNMessagingKit.configure(storage: Storage.shared)
SNSnodeKit.configure()
}
@objc public static func performDatabaseSetup() {
if !isSetup {
isSetup = true
// TODO: Need to store this result somewhere?
// TODO: This function seems to get called multiple times
//DispatchQueue.main.once
let storage: GRDBStorage? = try? GRDBStorage(
migrations: [
SNUtilitiesKit.migrations(),
SNSnodeKit.migrations(),
SNMessagingKit.migrations()
]
)
}
}
}