Skip to content

Commit ca09370

Browse files
committed
Drop swiftboost.
1 parent fbc3264 commit ca09370

File tree

2 files changed

+22
-16
lines changed

2 files changed

+22
-16
lines changed
Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
import Foundation
22
import FirebaseCore
3-
import SwiftBoost
3+
// import SwiftBoost
44

55
open class FirebaseWrapper {
66

77
public static func configure() {
8-
Logger.configure(levels: Logger.Level.allCases, fileNameMode: .show)
98
FirebaseApp.configure()
109
}
1110
}

Sources/FirebaseWrapperRemoteConfig/FirebaseWrapperRemoteConfig.swift

Lines changed: 21 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,49 +1,56 @@
11
import Foundation
22
import FirebaseWrapper
33
import FirebaseRemoteConfig
4-
import SwiftBoost
4+
// import SwiftBoost
55

66
extension FirebaseWrapper {
77

88
public class RemoteConfig {
99

10-
public static func configure(updatedHandler: (() -> Void)? = nil) {
11-
debug("FirebaseWrapper: RemoteConfig configure")
10+
public static func configure(
11+
defaults: [String : NSObject]? = nil,
12+
updatedHandler: (() -> Void)? = nil
13+
) {
14+
// debug("FirebaseWrapper: RemoteConfig configure")
1215
shared.updatedHandler = updatedHandler
1316

1417
let settings = RemoteConfigSettings()
1518
settings.minimumFetchInterval = 0
1619
shared.remoteConfig.configSettings = settings
20+
shared.remoteConfig.setDefaults(defaults ?? [:])
1721

18-
debug("FirebaseWrapper: RemoteConfig fetchAndActivate")
19-
shared.remoteConfig.fetchAndActivate()
20-
shared.remoteConfig.fetch { configUpdate, getError in
21-
guard getError == nil else {
22-
error("FirebaseWrapper: RemoteConfig initial get with error, " + (getError?.localizedDescription ?? .empty))
23-
return
22+
// debug("FirebaseWrapper: RemoteConfig fetchAndActivate")
23+
shared.remoteConfig.fetch { updateStatus, getError in
24+
switch updateStatus {
25+
case .success:
26+
activateNewConfig()
27+
case .failure, .noFetchYet, .throttled:
28+
//error("FirebaseWrapper: RemoteConfig initial get with error, " + (getError?.localizedDescription ?? .empty))
29+
break
30+
@unknown default:
31+
break
2432
}
25-
activateNewConfig()
2633
}
2734

2835
shared.remoteConfig.addOnConfigUpdateListener { configUpdate, listnerError in
2936
guard listnerError == nil else {
30-
error("FirebaseWrapper: RemoteConfig got update in listner with error, " + (listnerError?.localizedDescription ?? .empty))
37+
//error("FirebaseWrapper: RemoteConfig got update in listner with error, " + (listnerError?.localizedDescription ?? .empty))
3138
return
3239
}
33-
debug("FirebaseWrapper: RemoteConfig activate after got new in listner")
40+
// debug("FirebaseWrapper: RemoteConfig activate after got new in listner")
3441
activateNewConfig()
3542
}
3643
}
3744

3845
private static func activateNewConfig() {
3946
shared.remoteConfig.activate { changed, activateError in
4047
guard activateError == nil else {
41-
error("FirebaseWrapper: RemoteConfig can't activate after got new in listner, " + (activateError?.localizedDescription ?? .empty))
48+
// error("FirebaseWrapper: RemoteConfig can't activate after got new in listner, " + (activateError?.localizedDescription ?? .empty))
4249
return
4350
}
4451

4552
shared.updatedHandler?()
46-
NotificationCenter.default.post(name: .firebaseWrapperRemoteConfigUpdated)
53+
// NotificationCenter.default.post(name: .firebaseWrapperRemoteConfigUpdated)
4754
}
4855
}
4956

0 commit comments

Comments
 (0)