getBackgroundSyncPreference static method

Future<bool> getBackgroundSyncPreference()

Recupera a preferência do usuário para background sync

Implementation

static Future<bool> getBackgroundSyncPreference() async {
  try {
    if (!_isInitialized) {
      throw Exception('SyncInitializer não foi inicializado');
    }

    IStorageProvider storageProvider = GetIt.instance.get<IStorageProvider>();

    final preference =
        await storageProvider.getBool('background_sync_enabled');
    return preference ?? false;
  } catch (e) {
    _defaultLogger.error(
      'Falha ao recuperar preferência de background sync',
      category: 'SyncInitializer',
      exception: e,
    );

    return false; // Default para false em caso de erro
  }
}