diff --git a/CHANGELOG.md b/CHANGELOG.md index f914f33..1564436 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,9 @@ +# 0.1.1 + +## Fix + +- RemoteConfigRepository bug with setting the actual remote config + # 0.1.0 ## Feat diff --git a/lib/src/repo/remote_config/remote_config_repository.dart b/lib/src/repo/remote_config/remote_config_repository.dart index 2e6dc84..c71bc2e 100644 --- a/lib/src/repo/remote_config/remote_config_repository.dart +++ b/lib/src/repo/remote_config/remote_config_repository.dart @@ -30,19 +30,28 @@ abstract class RemoteConfigRepository { final json = jsonEncode(toJson(remoteConfigData)); ImpaktfullLogger.debug('REMOTE_CONFIG: Saving remote config data: $json'); await _sharedPrefsStore.saveString(key: storageKey, value: json); + ImpaktfullRemoteConfigData.configure(remoteConfigData); return remoteConfigData; } catch (e) { ImpaktfullLogger.debug( 'REMOTE_CONFIG: Failed to fetch data from remote config, try cache'); try { final json = await _sharedPrefsStore.getString(key: storageKey); - if (json == null) return getDefault(); + if (json == null) { + final remoteConfigData = await getDefault(); + ImpaktfullRemoteConfigData.configure(remoteConfigData); + return remoteConfigData; + } final jsonData = jsonDecode(json) as Map; - return fromJson(jsonData); + final remoteConfigData = fromJson(jsonData); + ImpaktfullRemoteConfigData.configure(remoteConfigData); + return remoteConfigData; } catch (e) { ImpaktfullLogger.debug( 'REMOTE_CONFIG: Failed to fetch data from cache, use default'); - return getDefault(); + final remoteConfigData = await getDefault(); + ImpaktfullRemoteConfigData.configure(remoteConfigData); + return remoteConfigData; } } }