mirror of
https://github.com/revanced/revanced-manager.git
synced 2025-04-30 14:04:26 +02:00
feat: root and nonroot toggle.
This commit is contained in:
parent
2abe051483
commit
2f83ea290b
@ -69,7 +69,9 @@
|
|||||||
"lightThemeLabel": "Light",
|
"lightThemeLabel": "Light",
|
||||||
"versionLabel": "Version",
|
"versionLabel": "Version",
|
||||||
"aboutLabel": "About",
|
"aboutLabel": "About",
|
||||||
"contributorsLabel": "Contributors"
|
"contributorsLabel": "Contributors",
|
||||||
|
"rootModeLabel": "Root Mode",
|
||||||
|
"rootModeHint": "Enable this if you want to patch applications as rooted."
|
||||||
},
|
},
|
||||||
"rootCheckerView": {
|
"rootCheckerView": {
|
||||||
"widgetTitle": "Is your device rooted?",
|
"widgetTitle": "Is your device rooted?",
|
||||||
|
@ -14,7 +14,9 @@ class SettingsView extends StatelessWidget {
|
|||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return ViewModelBuilder<SettingsViewModel>.reactive(
|
return ViewModelBuilder<SettingsViewModel>.reactive(
|
||||||
|
disposeViewModel: false,
|
||||||
viewModelBuilder: () => SettingsViewModel(),
|
viewModelBuilder: () => SettingsViewModel(),
|
||||||
|
onModelReady: (model) => model.initialize(),
|
||||||
builder: (context, SettingsViewModel model, child) => Scaffold(
|
builder: (context, SettingsViewModel model, child) => Scaffold(
|
||||||
body: SafeArea(
|
body: SafeArea(
|
||||||
child: Padding(
|
child: Padding(
|
||||||
@ -51,6 +53,35 @@ class SettingsView extends StatelessWidget {
|
|||||||
},
|
},
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
ListTile(
|
||||||
|
title: I18nText(
|
||||||
|
'settingsView.rootModeLabel',
|
||||||
|
child: Text(
|
||||||
|
'',
|
||||||
|
style: kSettingItemTextStyle,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
subtitle: I18nText('settingsView.rootModeHint'),
|
||||||
|
trailing: GestureDetector(
|
||||||
|
onTap: () {
|
||||||
|
model.navigateToRootChecker();
|
||||||
|
},
|
||||||
|
child: Container(
|
||||||
|
padding: const EdgeInsets.symmetric(
|
||||||
|
horizontal: 16, vertical: 8),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
borderRadius: BorderRadius.circular(20),
|
||||||
|
border: Border.all(
|
||||||
|
width: 1,
|
||||||
|
color: Theme.of(context).colorScheme.secondary,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
child: Text(
|
||||||
|
model.isRooted ? 'Rooted' : 'Not rooted',
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
Container(
|
Container(
|
||||||
padding: const EdgeInsets.symmetric(
|
padding: const EdgeInsets.symmetric(
|
||||||
horizontal: 16.0,
|
horizontal: 16.0,
|
||||||
|
@ -1,9 +1,18 @@
|
|||||||
import 'package:revanced_manager/app/app.locator.dart';
|
import 'package:revanced_manager/app/app.locator.dart';
|
||||||
import 'package:revanced_manager/app/app.router.dart';
|
import 'package:revanced_manager/app/app.router.dart';
|
||||||
|
import 'package:shared_preferences/shared_preferences.dart';
|
||||||
import 'package:stacked/stacked.dart';
|
import 'package:stacked/stacked.dart';
|
||||||
import 'package:stacked_services/stacked_services.dart';
|
import 'package:stacked_services/stacked_services.dart';
|
||||||
|
|
||||||
class SettingsViewModel extends BaseViewModel {
|
class SettingsViewModel extends BaseViewModel {
|
||||||
|
bool isRooted = false;
|
||||||
|
|
||||||
|
Future<void> initialize() async {
|
||||||
|
SharedPreferences prefs = await SharedPreferences.getInstance();
|
||||||
|
isRooted = prefs.getBool('isRooted') ?? false;
|
||||||
|
notifyListeners();
|
||||||
|
}
|
||||||
|
|
||||||
final NavigationService _navigationService = locator<NavigationService>();
|
final NavigationService _navigationService = locator<NavigationService>();
|
||||||
|
|
||||||
void setLanguage(String language) {
|
void setLanguage(String language) {
|
||||||
@ -13,4 +22,8 @@ class SettingsViewModel extends BaseViewModel {
|
|||||||
void navigateToContributors() {
|
void navigateToContributors() {
|
||||||
_navigationService.navigateTo(Routes.contributorsView);
|
_navigationService.navigateTo(Routes.contributorsView);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void navigateToRootChecker() {
|
||||||
|
_navigationService.navigateTo(Routes.rootCheckerView);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user