@@ -22,7 +22,7 @@ class AppConfig: ObservableObject {
22
22
@Published var colorScheme : ColorScheme
23
23
24
24
init ( ) {
25
- let value = RemoteConfig . remoteConfig ( ) [ " color_scheme " ] . stringValue ?? " nil "
25
+ let value = RemoteConfig . remoteConfig ( ) [ " color_scheme " ] . stringValue
26
26
colorScheme = ColorScheme ( value)
27
27
#if !targetEnvironment(macCatalyst) && DEBUG
28
28
NotificationCenter . default. addObserver ( self ,
@@ -38,13 +38,13 @@ class AppConfig: ObservableObject {
38
38
39
39
func updateFromRemoteConfig( ) {
40
40
let remoteConfig = RemoteConfig . remoteConfig ( )
41
- let oldValue = remoteConfig [ " color_scheme " ] . stringValue ?? " nil "
41
+ let oldValue = remoteConfig [ " color_scheme " ] . stringValue
42
42
remoteConfig. fetchAndActivate { status, error in
43
43
print ( " Fetch-and-activate completed with status: \( status. debugDescription) " )
44
44
if let error = error {
45
45
print ( " Error fetching and activating config: \( error) " )
46
46
} else {
47
- let newValue = remoteConfig [ " color_scheme " ] . stringValue ?? " nil "
47
+ let newValue = remoteConfig [ " color_scheme " ] . stringValue
48
48
if newValue != oldValue {
49
49
print ( " Remote Config changed to: \( newValue) " )
50
50
DispatchQueue . main. async { self . colorScheme = ColorScheme ( newValue) }
@@ -59,11 +59,11 @@ class AppConfig: ObservableObject {
59
59
@available ( iOS 15 , tvOS 15 , macOS 12 , watchOS 8 , * )
60
60
func updateFromRemoteConfigAsync( ) async {
61
61
let remoteConfig = RemoteConfig . remoteConfig ( )
62
- let oldValue = remoteConfig [ " color_scheme " ] . stringValue ?? " nil "
62
+ let oldValue = remoteConfig [ " color_scheme " ] . stringValue
63
63
do {
64
64
let status = try await remoteConfig. fetchAndActivate ( )
65
65
print ( " Fetch-and-activate completed with status: \( status. debugDescription) " )
66
- let newValue = remoteConfig [ " color_scheme " ] . stringValue ?? " nil "
66
+ let newValue = remoteConfig [ " color_scheme " ] . stringValue
67
67
if newValue != oldValue {
68
68
print ( " Remote Config changed to: \( newValue) " )
69
69
Task . detached { @MainActor in self . colorScheme = ColorScheme ( newValue) }
0 commit comments