forceVersionCheckWithFetch method

Future<void> forceVersionCheckWithFetch()

Force a version check with fresh Remote Config fetch (debug use only) This should only be used for debugging as it counts toward Firebase's 5 fetches/hour limit. Note: This is rarely needed now that onConfigUpdated works on all platforms including web.

Implementation

Future<void> forceVersionCheckWithFetch() async {
  logv('🔄 Force checking version update WITH Remote Config fetch (debug only)');

  // Try to fetch latest remote config if possible
  try {
    // Skip Firebase fetch if not initialized
    if (!AppConfigBase.isFirebaseInitialized) {
      logv('â„šī¸ Firebase not initialized - using cached/default values only');
    } else if (!AppConfigBase.doUseBackendEmulator ||
        AppConfigBase.doOverrideUseLiveRemoteConfig) {
      logv(
          'âš ī¸ Attempting to fetch latest Remote Config for force check (counts toward 5/hour limit)...');

      await FirebaseRemoteConfig.instance.fetchAndActivate();
      logv('✅ Remote Config refreshed for force check');
    } else if (AppConfigBase.doUseBackendEmulator &&
        !AppConfigBase.doOverrideUseLiveRemoteConfig) {
      logv('â„šī¸ Using mock Remote Config - no fetch needed');
    }
  } catch (e) {
    logv('âš ī¸ Could not fetch remote config during force check (using cached values): $e');
    // Continue with cached values - this is not a critical error
  }

  await checkVersionUpdate();
}