getInterBackupConfig function
Read backup interstitial config from remote preferences.
Implementation
InterBackupConfig getInterBackupConfig() {
const fallback = InterBackupConfig(rate: 0.0, ids: []);
if (!PreferencesManager.isInitialized()) {
Logger().e(
'RemoteConfigValue: PreferencesManager is not initialized. Returning fallback config.',
);
return fallback;
}
try {
final config = PreferencesManager.getJson(
interBackupConfigKey,
(json) => InterBackupConfig.fromJson(json),
);
if (config == null) {
Logger().w('RemoteConfigValue: No inter backup config found.');
return fallback;
}
final sanitized = config.sanitize();
if (!sanitized.hasValidIds) {
Logger().e(
'RemoteConfigValue: Inter backup config ids are empty. Returning fallback.',
);
return fallback;
}
return sanitized;
} catch (e, stackTrace) {
Logger().e(
'RemoteConfigValue: Failed to parse inter backup config.',
error: e,
stackTrace: stackTrace,
);
return fallback;
}
}