forceRefreshRemoteConfig method

Future<void> forceRefreshRemoteConfig({
  1. required String apiKey,
  2. required String instanceURL,
  3. String? remoteConfigURL,
  4. String? appVersion,
  5. bool? proEnv,
})

Fuerza actualización de remote config

Implementation

Future<void> forceRefreshRemoteConfig({
  required String apiKey,
  required String instanceURL,
  String? remoteConfigURL,
  String? appVersion,
  bool? proEnv,
}) async {
  if (!_isInitialized) return;

  final remoteConfig = await _fetchRemoteConfig(
    apiKey: apiKey,
    instanceURL: instanceURL,
    remoteConfigURL: remoteConfigURL,
    appVersion: appVersion ?? 'unknown',
    proEnv: proEnv ?? false,
  );

  if (remoteConfig != null) {
    _currentConfig =
        _mergeWithDefaults(_currentConfig!, remoteConfig).validate();
    await _storeCurrentConfig();
    await _storeRemoteConfigWithTimestamp(remoteConfig);

    // Fetch obsly_tools en force refresh
    await _fetchObslyToolsIfAvailable(apiKey);

    ObslyLogger.debug('Remote config force refreshed');
  }
}