diff --git a/assets/translations/en.json b/assets/translations/en.json index cb061cf..54a4a5e 100644 --- a/assets/translations/en.json +++ b/assets/translations/en.json @@ -278,6 +278,10 @@ "onlyCheckInstalledOrTrackOnlyApps": "Only check installed and Track-Only apps for updates", "supportFixedAPKURL": "Support fixed APK URLs", "selectX": "Select {}", + "installMethod": "Installation method", + "normal": "Normal", + "shizuku": "Shizuku", + "root": "Root", "removeAppQuestion": { "one": "Remove App?", "other": "Remove Apps?" diff --git a/assets/translations/ru.json b/assets/translations/ru.json index b0dfae8..a4eba6b 100644 --- a/assets/translations/ru.json +++ b/assets/translations/ru.json @@ -278,6 +278,10 @@ "onlyCheckInstalledOrTrackOnlyApps": "Only check installed and Track-Only apps for updates", "supportFixedAPKURL": "Support fixed APK URLs", "selectX": "Select {}", + "installMethod": "Метод установки", + "normal": "Нормальный", + "shizuku": "Shizuku", + "root": "Суперпользователь", "removeAppQuestion": { "one": "Удалить приложение?", "other": "Удалить приложения?" diff --git a/lib/pages/settings.dart b/lib/pages/settings.dart index c36c958..23f742b 100644 --- a/lib/pages/settings.dart +++ b/lib/pages/settings.dart @@ -30,6 +30,29 @@ class _SettingsPageState extends State { settingsProvider.initializeSettings(); } + var installMethodDropdown = DropdownButtonFormField( + decoration: InputDecoration(labelText: tr('installMethod')), + value: settingsProvider.installMethod, + items: [ + DropdownMenuItem( + value: InstallMethodSettings.normal, + child: Text(tr('normal')), + ), + DropdownMenuItem( + value: InstallMethodSettings.shizuku, + child: Text(tr('shizuku')), + ), + DropdownMenuItem( + value: InstallMethodSettings.root, + child: Text(tr('root')), + ) + ], + onChanged: (value) { + if (value != null) { + settingsProvider.installMethod = value; + } + }); + var themeDropdown = DropdownButtonFormField( decoration: InputDecoration(labelText: tr('theme')), value: settingsProvider.theme, @@ -327,6 +350,8 @@ class _SettingsPageState extends State { }) ], ), + height16, + installMethodDropdown, height32, Text( tr('sourceSpecific'), diff --git a/lib/providers/settings_provider.dart b/lib/providers/settings_provider.dart index 25e9a3b..cdc3b46 100644 --- a/lib/providers/settings_provider.dart +++ b/lib/providers/settings_provider.dart @@ -17,6 +17,8 @@ import 'package:shared_storage/shared_storage.dart' as saf; String obtainiumTempId = 'imranr98_obtainium_${GitHub().host}'; String obtainiumId = 'dev.imranr.obtainium'; +enum InstallMethodSettings { normal, shizuku, root } + enum ThemeSettings { system, light, dark } enum ColourSettings { basic, materialYou } @@ -49,6 +51,16 @@ class SettingsProvider with ChangeNotifier { notifyListeners(); } + InstallMethodSettings get installMethod { + return InstallMethodSettings + .values[prefs?.getInt('installMethod') ?? InstallMethodSettings.normal.index]; + } + + set installMethod(InstallMethodSettings t) { + prefs?.setInt('installMethod', t.index); + notifyListeners(); + } + ThemeSettings get theme { return ThemeSettings .values[prefs?.getInt('theme') ?? ThemeSettings.system.index];