Sfoglia il codice sorgente

Re-use local variable to avoid extra `FIRRemoteConfig` accesses in `RemoteConfigValueObservable` (#14756)

ivan moskalev 11 mesi fa
parent
commit
48af4cb559

+ 2 - 2
FirebaseRemoteConfig/Swift/PropertyWrapper/RemoteConfigValueObservable.swift

@@ -45,7 +45,7 @@ class RemoteConfigValueObservable<T: Decodable>: ObservableObject {
     do {
       let configValue: RemoteConfigValue = remoteConfig[key]
       if configValue.source == .remote || configValue.source == .default {
-        self.configValue = try remoteConfig[key].decoded()
+        self.configValue = try configValue.decoded()
       } else {
         self.configValue = fallbackValue
       }
@@ -66,7 +66,7 @@ class RemoteConfigValueObservable<T: Decodable>: ObservableObject {
     do {
       let configValue: RemoteConfigValue = remoteConfig[key]
       if configValue.source == .remote {
-        self.configValue = try remoteConfig[key].decoded()
+        self.configValue = try configValue.decoded()
       }
     } catch {
       // Suppresses a hard failure if decoding failed.