revanced-manager/lib/ui/views/settings/settings_viewmodel.dart

30 lines
868 B
Dart
Raw Normal View History

2022-08-12 23:37:16 +05:30
import 'package:revanced_manager/app/app.locator.dart';
import 'package:revanced_manager/app/app.router.dart';
2022-08-20 17:47:00 +05:30
import 'package:shared_preferences/shared_preferences.dart';
2022-08-10 18:00:28 +05:30
import 'package:stacked/stacked.dart';
2022-08-12 23:37:16 +05:30
import 'package:stacked_services/stacked_services.dart';
2022-08-10 18:00:28 +05:30
class SettingsViewModel extends BaseViewModel {
2022-08-20 17:47:00 +05:30
bool isRooted = false;
Future<void> initialize() async {
SharedPreferences prefs = await SharedPreferences.getInstance();
isRooted = prefs.getBool('isRooted') ?? false;
notifyListeners();
}
2022-08-18 15:33:33 +01:00
final NavigationService _navigationService = locator<NavigationService>();
2022-08-12 23:37:16 +05:30
2022-08-10 18:00:28 +05:30
void setLanguage(String language) {
notifyListeners();
}
2022-08-12 23:37:16 +05:30
void navigateToContributors() {
_navigationService.navigateTo(Routes.contributorsView);
}
2022-08-20 17:47:00 +05:30
void navigateToRootChecker() {
_navigationService.navigateTo(Routes.rootCheckerView);
}
2022-08-10 18:00:28 +05:30
}