@@ -168,6 +168,8 @@ - (instancetype)initWithAppName:(NSString *)appName
168
168
// / Serial queue for read and write lock.
169
169
_queue = [FIRRemoteConfig sharedRemoteConfigSerialQueue ];
170
170
171
+ // Initialize with default config settings.
172
+ [self setDefaultConfigSettings ];
171
173
_configFetch = [[RCNConfigFetch alloc ] initWithContent: _configContent
172
174
DBManager: _DBManager
173
175
settings: _settings
@@ -178,12 +180,17 @@ - (instancetype)initWithAppName:(NSString *)appName
178
180
options: options];
179
181
180
182
[_settings loadConfigFromMetadataTable ];
181
- self->_settings .fetchTimeout = RCNHTTPDefaultConnectionTimeout;
182
- self->_settings .minimumFetchInterval = RCNDefaultMinimumFetchInterval;
183
183
}
184
184
return self;
185
185
}
186
186
187
+ // Initialize with default config settings.
188
+ - (void )setDefaultConfigSettings {
189
+ // Set the default config settings.
190
+ self->_settings .fetchTimeout = RCNHTTPDefaultConnectionTimeout;
191
+ self->_settings .minimumFetchInterval = RCNDefaultMinimumFetchInterval;
192
+ }
193
+
187
194
- (void )ensureInitializedWithCompletionHandler :
188
195
(nonnull FIRRemoteConfigInitializationCompletion)completionHandler {
189
196
__weak FIRRemoteConfig *weakSelf = self;
@@ -592,6 +599,8 @@ - (FIRRemoteConfigSettings *)configSettings {
592
599
[[FIRRemoteConfigSettings alloc ] initWithDeveloperModeEnabled: developerModeEnabled];
593
600
settings.minimumFetchInterval = minimumFetchInterval;
594
601
settings.fetchTimeout = fetchTimeout;
602
+ // / The NSURLSession needs to be recreated whenever the fetch timeout may be updated.
603
+ [_configFetch recreateNetworkSession ];
595
604
return settings;
596
605
}
597
606
@@ -607,6 +616,8 @@ - (void)setConfigSettings:(FIRRemoteConfigSettings *)configSettings {
607
616
self->_settings .customVariables = settingsToSave;
608
617
self->_settings .minimumFetchInterval = configSettings.minimumFetchInterval ;
609
618
self->_settings .fetchTimeout = configSettings.fetchTimeout ;
619
+ // / The NSURLSession needs to be recreated whenever the fetch timeout may be updated.
620
+ [self ->_configFetch recreateNetworkSession ];
610
621
FIRLogDebug (kFIRLoggerRemoteConfig , @" I-RCN000067" ,
611
622
@" Successfully set configSettings. Developer Mode: %@ , Minimum Fetch Interval:%f , "
612
623
@" Fetch timeout:%f " ,
0 commit comments