2022-09-02 15:35:25 +02:00
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
import 'package:flutter_i18n/flutter_i18n.dart';
|
2022-08-12 20:07:16 +02:00
|
|
|
import 'package:revanced_manager/app/app.locator.dart';
|
|
|
|
import 'package:revanced_manager/app/app.router.dart';
|
2022-08-10 14:30:28 +02:00
|
|
|
import 'package:stacked/stacked.dart';
|
2022-08-12 20:07:16 +02:00
|
|
|
import 'package:stacked_services/stacked_services.dart';
|
2022-09-02 15:35:25 +02:00
|
|
|
import 'package:timeago/timeago.dart';
|
2022-08-10 14:30:28 +02:00
|
|
|
|
|
|
|
class SettingsViewModel extends BaseViewModel {
|
2022-08-18 16:33:33 +02:00
|
|
|
final NavigationService _navigationService = locator<NavigationService>();
|
2022-08-12 20:07:16 +02:00
|
|
|
|
2022-08-10 14:30:28 +02:00
|
|
|
void setLanguage(String language) {
|
|
|
|
notifyListeners();
|
|
|
|
}
|
2022-08-12 20:07:16 +02:00
|
|
|
|
2022-08-20 14:17:00 +02:00
|
|
|
void navigateToRootChecker() {
|
|
|
|
_navigationService.navigateTo(Routes.rootCheckerView);
|
|
|
|
}
|
2022-09-02 15:35:25 +02:00
|
|
|
|
|
|
|
Future<void> updateLanguage(BuildContext context, String? value) async {
|
|
|
|
if (value != null) {
|
|
|
|
await FlutterI18n.refresh(context, Locale(value));
|
|
|
|
setLocaleMessages(value, EnMessages());
|
|
|
|
}
|
|
|
|
}
|
2022-08-10 14:30:28 +02:00
|
|
|
}
|