|
|
|
@ -6,49 +6,58 @@ import Foundation
|
|
|
|
|
import SignalServiceKit
|
|
|
|
|
import SignalMessaging
|
|
|
|
|
|
|
|
|
|
@objc public class AppEnvironment : NSObject {
|
|
|
|
|
@objc public class AppEnvironment: NSObject {
|
|
|
|
|
|
|
|
|
|
private static var _shared : AppEnvironment = AppEnvironment()
|
|
|
|
|
private static var _shared: AppEnvironment = AppEnvironment()
|
|
|
|
|
|
|
|
|
|
@objc
|
|
|
|
|
public class var shared : AppEnvironment {
|
|
|
|
|
public class var shared: AppEnvironment {
|
|
|
|
|
get {
|
|
|
|
|
return _shared
|
|
|
|
|
}
|
|
|
|
|
set {
|
|
|
|
|
guard CurrentAppContext().isRunningTests else {
|
|
|
|
|
owsFailDebug("Can only switch environments in tests.")
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
_shared = newValue
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@objc
|
|
|
|
|
public var callMessageHandler : WebRTCCallMessageHandler
|
|
|
|
|
public var callMessageHandler: WebRTCCallMessageHandler
|
|
|
|
|
|
|
|
|
|
@objc
|
|
|
|
|
public var callService: CallService
|
|
|
|
|
|
|
|
|
|
@objc
|
|
|
|
|
public var callService : CallService
|
|
|
|
|
public var outboundCallInitiator: OutboundCallInitiator
|
|
|
|
|
|
|
|
|
|
@objc
|
|
|
|
|
public var outboundCallInitiator : OutboundCallInitiator
|
|
|
|
|
public var messageFetcherJob: MessageFetcherJob
|
|
|
|
|
|
|
|
|
|
@objc
|
|
|
|
|
public var messageFetcherJob : MessageFetcherJob
|
|
|
|
|
public var notificationsManager: NotificationsManager
|
|
|
|
|
|
|
|
|
|
@objc
|
|
|
|
|
public var notificationsManager : NotificationsManager
|
|
|
|
|
public var accountManager: AccountManager
|
|
|
|
|
|
|
|
|
|
@objc
|
|
|
|
|
public var accountManager : AccountManager
|
|
|
|
|
public var callNotificationsAdapter: CallNotificationsAdapter
|
|
|
|
|
|
|
|
|
|
@objc
|
|
|
|
|
public var callNotificationsAdapter : CallNotificationsAdapter
|
|
|
|
|
public var pushRegistrationManager: PushRegistrationManager
|
|
|
|
|
|
|
|
|
|
@objc
|
|
|
|
|
public init(callMessageHandler : WebRTCCallMessageHandler,
|
|
|
|
|
callService : CallService,
|
|
|
|
|
outboundCallInitiator : OutboundCallInitiator,
|
|
|
|
|
messageFetcherJob : MessageFetcherJob,
|
|
|
|
|
notificationsManager : NotificationsManager,
|
|
|
|
|
accountManager : AccountManager,
|
|
|
|
|
callNotificationsAdapter : CallNotificationsAdapter) {
|
|
|
|
|
public init(callMessageHandler: WebRTCCallMessageHandler,
|
|
|
|
|
callService: CallService,
|
|
|
|
|
outboundCallInitiator: OutboundCallInitiator,
|
|
|
|
|
messageFetcherJob: MessageFetcherJob,
|
|
|
|
|
notificationsManager: NotificationsManager,
|
|
|
|
|
accountManager: AccountManager,
|
|
|
|
|
callNotificationsAdapter: CallNotificationsAdapter,
|
|
|
|
|
pushRegistrationManager: PushRegistrationManager) {
|
|
|
|
|
self.callMessageHandler = callMessageHandler
|
|
|
|
|
self.callService = callService
|
|
|
|
|
self.outboundCallInitiator = outboundCallInitiator
|
|
|
|
@ -56,13 +65,11 @@ import SignalMessaging
|
|
|
|
|
self.notificationsManager = notificationsManager
|
|
|
|
|
self.accountManager = accountManager
|
|
|
|
|
self.callNotificationsAdapter = callNotificationsAdapter
|
|
|
|
|
self.pushRegistrationManager = pushRegistrationManager
|
|
|
|
|
|
|
|
|
|
super
|
|
|
|
|
.init()
|
|
|
|
|
super.init()
|
|
|
|
|
|
|
|
|
|
SwiftSingletons.register(self)
|
|
|
|
|
|
|
|
|
|
setup()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private override init() {
|
|
|
|
@ -73,6 +80,7 @@ import SignalMessaging
|
|
|
|
|
let callMessageHandler = WebRTCCallMessageHandler()
|
|
|
|
|
let outboundCallInitiator = OutboundCallInitiator()
|
|
|
|
|
let messageFetcherJob = MessageFetcherJob()
|
|
|
|
|
let pushRegistrationManager = PushRegistrationManager()
|
|
|
|
|
|
|
|
|
|
self.callMessageHandler = callMessageHandler
|
|
|
|
|
self.callService = callService
|
|
|
|
@ -81,15 +89,15 @@ import SignalMessaging
|
|
|
|
|
self.notificationsManager = notificationsManager
|
|
|
|
|
self.accountManager = accountManager
|
|
|
|
|
self.callNotificationsAdapter = callNotificationsAdapter
|
|
|
|
|
self.pushRegistrationManager = pushRegistrationManager
|
|
|
|
|
|
|
|
|
|
super.init()
|
|
|
|
|
|
|
|
|
|
SwiftSingletons.register(self)
|
|
|
|
|
|
|
|
|
|
setup()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private func setup() {
|
|
|
|
|
@objc
|
|
|
|
|
public func setup() {
|
|
|
|
|
callService.createCallUIAdapter()
|
|
|
|
|
|
|
|
|
|
// Hang certain singletons on SSKEnvironment too.
|
|
|
|
|