diff --git a/lib/core/shared_preferences.dart b/lib/core/shared_preferences.dart index 2a4550b90..83ef9b46c 100644 --- a/lib/core/shared_preferences.dart +++ b/lib/core/shared_preferences.dart @@ -1,7 +1,6 @@ import 'dart:convert'; import 'package:shared_preferences/shared_preferences.dart'; -import 'package:shared_preferences/util/legacy_to_async_migration_util.dart'; import 'package:wger/core/search_options.dart'; import 'package:wger/features/exercises/models/exercise_filters.dart'; import 'package:wger/features/nutrition/models/ingredient.dart'; @@ -11,9 +10,7 @@ import 'package:wger/features/nutrition/models/ingredient_filters.dart'; /// leaves with the local data. const PREFS_WORKOUT_PROGRESS = 'workoutProgressPrefs'; -/// A helper class that manages preferences using SharedPreferencesAsync -/// and handles migration from the legacy SharedPreferences to -/// SharedPreferencesAsync. +/// A helper class that manages preferences using SharedPreferencesAsync. class PreferenceHelper { PreferenceHelper._instantiate(); @@ -25,22 +22,6 @@ class PreferenceHelper { static PreferenceHelper get instance => _instance; - /// Migration function that ensures any legacy data stored in - /// SharedPreferences is migrated to SharedPreferencesAsync. This migration - /// only happens once, as checked by the migrationCompletedKey. - /// - /// `migrationCompletedKey` is used to track if the migration has been - /// completed. - Future migrationSupportFunctionForSharedPreferences() async { - const SharedPreferencesOptions sharedPreferencesOptions = SharedPreferencesOptions(); - final SharedPreferences prefs = await SharedPreferences.getInstance(); - await migrateLegacySharedPreferencesToSharedPreferencesAsyncIfNecessary( - legacySharedPreferencesInstance: prefs, - sharedPreferencesAsyncOptions: sharedPreferencesOptions, - migrationCompletedKey: 'migrationCompleted', - ); - } - //ingredients filters //1.vegan Future saveIngredientVeganFilter(bool value) async { diff --git a/lib/main.dart b/lib/main.dart index 6110c7d11..bcd8f3921 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -123,9 +123,6 @@ void main() async { final logger = Logger('main'); - // SharedPreferences to SharedPreferencesAsync migration function - await PreferenceHelper.instance.migrationSupportFunctionForSharedPreferences(); - // Seed the log level from the prefs, the phase right after a cold start is // the interesting one; AppSettingsNotifier keeps it in sync from here on. applyVerboseLogging( diff --git a/test/features/nutrition/widgets/ingredient_typeahead_test.dart b/test/features/nutrition/widgets/ingredient_typeahead_test.dart index be9cdccf1..6fc9349a7 100644 --- a/test/features/nutrition/widgets/ingredient_typeahead_test.dart +++ b/test/features/nutrition/widgets/ingredient_typeahead_test.dart @@ -22,11 +22,9 @@ import 'package:flutter_typeahead/flutter_typeahead.dart'; import 'package:material_ui/material_ui.dart'; import 'package:mockito/annotations.dart'; import 'package:mockito/mockito.dart'; -import 'package:shared_preferences/shared_preferences.dart'; import 'package:shared_preferences_platform_interface/in_memory_shared_preferences_async.dart'; import 'package:shared_preferences_platform_interface/shared_preferences_async_platform_interface.dart'; import 'package:wger/core/search_options.dart'; -import 'package:wger/core/shared_preferences.dart'; import 'package:wger/features/nutrition/models/ingredient.dart'; import 'package:wger/features/nutrition/providers/ingredient_repository.dart'; import 'package:wger/features/nutrition/widgets/widgets.dart'; @@ -45,9 +43,7 @@ void main() { late MockIngredientRepository mockIngredientRepo; setUp(() async { - SharedPreferences.setMockInitialValues({}); SharedPreferencesAsyncPlatform.instance = InMemorySharedPreferencesAsync.empty(); - await PreferenceHelper.instance.migrationSupportFunctionForSharedPreferences(); mockIngredientRepo = MockIngredientRepository(); when(mockIngredientRepo.getById(any)).thenAnswer((_) async => null);