mirror of https://github.com/oxen-io/session-ios
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.
45 lines
1.1 KiB
Swift
45 lines
1.1 KiB
Swift
// Copyright © 2022 Rangeproof Pty Ltd. All rights reserved.
|
|
|
|
import Foundation
|
|
import SessionUtilitiesKit
|
|
import SignalUtilitiesKit
|
|
import SignalCoreKit
|
|
import SessionMessagingKit
|
|
|
|
public class AppEnvironment {
|
|
|
|
private static var _shared: AppEnvironment = AppEnvironment()
|
|
|
|
public class var shared: AppEnvironment {
|
|
get { return _shared }
|
|
set {
|
|
guard SNUtilitiesKit.isRunningTests else {
|
|
owsFailDebug("Can only switch environments in tests.")
|
|
return
|
|
}
|
|
|
|
_shared = newValue
|
|
}
|
|
}
|
|
|
|
public var pushRegistrationManager: PushRegistrationManager
|
|
public var fileLogger: DDFileLogger
|
|
|
|
private init() {
|
|
self.pushRegistrationManager = PushRegistrationManager()
|
|
self.fileLogger = DDFileLogger()
|
|
|
|
SwiftSingletons.register(self)
|
|
}
|
|
|
|
public func setup() {
|
|
setupLogFiles()
|
|
}
|
|
|
|
private func setupLogFiles() {
|
|
fileLogger.rollingFrequency = kDayInterval // Refresh everyday
|
|
fileLogger.logFileManager.maximumNumberOfLogFiles = 3 // Save 3 days' log files
|
|
DDLog.add(fileLogger)
|
|
}
|
|
}
|