session-ios/SessionMessagingKit/Configuration.swift
Morgan Pretty ed9f4ea6c6 Fixed a few closed group and job issues
Fixed a few job migration issues
Fixed an issue with the closed group key pair management (wasn't storing keys correctly)
Refactored the OWSSound (now Preferences.Sound)
Added the logic for the AttachmentDownloadJob and enabled jobs to be cascade deleted via interactions
Optimised the HomeViewModel database observation query (fetch specific columns so changes outside those don't trigger updates)
Updated to the latest GRDB (ran into a deadlock which should be fixed in a newer version)
2022-04-22 18:47:11 +10:00

44 lines
1.7 KiB
Swift

import Foundation
import SessionUtilitiesKit
@objc
public final class SNMessagingKitConfiguration : NSObject {
public let storage: SessionMessagingKitStorageProtocol
@objc public static var shared: SNMessagingKitConfiguration!
fileprivate init(storage: SessionMessagingKitStorageProtocol) {
self.storage = storage
}
}
public enum SNMessagingKit { // Just to make the external API nice
public static func migrations() -> TargetMigrations {
return TargetMigrations(
identifier: .messagingKit,
migrations: [
[
_001_InitialSetupMigration.self,
_002_SetupStandardJobs.self
],
[
_003_YDBToGRDBMigration.self
]
]
)
}
public static func configure(storage: SessionMessagingKitStorageProtocol) {
// Configure the job executors
JobRunner.add(executor: DisappearingMessagesJob.self, for: .disappearingMessages)
JobRunner.add(executor: FailedMessagesJob.self, for: .failedMessages)
JobRunner.add(executor: FailedAttachmentDownloadsJob.self, for: .failedAttachmentDownloads)
JobRunner.add(executor: MessageSendJob.self, for: .messageSend)
JobRunner.add(executor: MessageReceiveJob.self, for: .messageReceive)
JobRunner.add(executor: NotifyPushServerJob.self, for: .notifyPushServer)
JobRunner.add(executor: SendReadReceiptsJob.self, for: .sendReadReceipts)
JobRunner.add(executor: AttachmentDownloadJob.self, for: .attachmentDownload)
SNMessagingKitConfiguration.shared = SNMessagingKitConfiguration(storage: storage)
}
}