mirror of
https://github.com/ReVanced/revanced-manager.git
synced 2024-11-12 18:04:28 +01:00
refactor: apply suggestions from analyser
Signed-off-by: validcube <pun.butrach@gmail.com>
This commit is contained in:
parent
c56c445fb7
commit
a0b673c138
18 changed files with 120 additions and 79 deletions
|
@ -75,9 +75,8 @@ class Option {
|
||||||
if (json['valueType'] == null) {
|
if (json['valueType'] == null) {
|
||||||
final type = json['optionClassType'];
|
final type = json['optionClassType'];
|
||||||
if (type is String) {
|
if (type is String) {
|
||||||
json['valueType'] = type
|
json['valueType'] =
|
||||||
.replaceAll('PatchOption', '')
|
type.replaceAll('PatchOption', '').replaceAll('List', 'Array');
|
||||||
.replaceAll('List', 'Array');
|
|
||||||
|
|
||||||
json['optionClassType'] = null;
|
json['optionClassType'] = null;
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,7 +19,8 @@ class DownloadManager {
|
||||||
);
|
);
|
||||||
|
|
||||||
Future<void> initialize() async {
|
Future<void> initialize() async {
|
||||||
_userAgent = 'ReVanced-Manager/${await _managerAPI.getCurrentManagerVersion()}';
|
_userAgent =
|
||||||
|
'ReVanced-Manager/${await _managerAPI.getCurrentManagerVersion()}';
|
||||||
}
|
}
|
||||||
|
|
||||||
Dio initDio(String url) {
|
Dio initDio(String url) {
|
||||||
|
|
|
@ -14,7 +14,6 @@ import 'package:revanced_manager/models/patch.dart';
|
||||||
import 'package:revanced_manager/models/patched_application.dart';
|
import 'package:revanced_manager/models/patched_application.dart';
|
||||||
import 'package:revanced_manager/services/manager_api.dart';
|
import 'package:revanced_manager/services/manager_api.dart';
|
||||||
import 'package:revanced_manager/services/root_api.dart';
|
import 'package:revanced_manager/services/root_api.dart';
|
||||||
import 'package:revanced_manager/ui/widgets/shared/custom_material_button.dart';
|
|
||||||
import 'package:share_plus/share_plus.dart';
|
import 'package:share_plus/share_plus.dart';
|
||||||
|
|
||||||
@lazySingleton
|
@lazySingleton
|
||||||
|
|
|
@ -93,7 +93,8 @@ class RootAPI {
|
||||||
|
|
||||||
Future<void> unmount(String packageName) async {
|
Future<void> unmount(String packageName) async {
|
||||||
await Root.exec(
|
await Root.exec(
|
||||||
cmd: 'grep $packageName /proc/mounts | while read -r line; do echo \$line | cut -d " " -f 2 | sed "s/apk.*/apk/" | xargs -r umount -l; done',
|
cmd:
|
||||||
|
'grep $packageName /proc/mounts | while read -r line; do echo \$line | cut -d " " -f 2 | sed "s/apk.*/apk/" | xargs -r umount -l; done',
|
||||||
);
|
);
|
||||||
await Root.exec(
|
await Root.exec(
|
||||||
cmd: 'rm -rf "$_revancedDirPath/$packageName"',
|
cmd: 'rm -rf "$_revancedDirPath/$packageName"',
|
||||||
|
@ -188,12 +189,15 @@ class RootAPI {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> mountApk(String packageName,) async {
|
Future<void> mountApk(
|
||||||
|
String packageName,
|
||||||
|
) async {
|
||||||
await Root.exec(
|
await Root.exec(
|
||||||
cmd: '''
|
cmd: '''
|
||||||
grep $packageName /proc/mounts | while read -r line; do echo \$line | cut -d " " -f 2 | sed "s/apk.*/apk/" | xargs -r umount -l; done
|
grep $packageName /proc/mounts | while read -r line; do echo \$line | cut -d " " -f 2 | sed "s/apk.*/apk/" | xargs -r umount -l; done
|
||||||
.$_serviceDDirPath/$packageName.sh
|
.$_serviceDDirPath/$packageName.sh
|
||||||
'''.trim(),
|
'''
|
||||||
|
.trim(),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -25,7 +25,8 @@ class DynamicThemeBuilder extends StatefulWidget {
|
||||||
State<DynamicThemeBuilder> createState() => _DynamicThemeBuilderState();
|
State<DynamicThemeBuilder> createState() => _DynamicThemeBuilderState();
|
||||||
}
|
}
|
||||||
|
|
||||||
class _DynamicThemeBuilderState extends State<DynamicThemeBuilder> with WidgetsBindingObserver {
|
class _DynamicThemeBuilderState extends State<DynamicThemeBuilder>
|
||||||
|
with WidgetsBindingObserver {
|
||||||
Brightness brightness = PlatformDispatcher.instance.platformBrightness;
|
Brightness brightness = PlatformDispatcher.instance.platformBrightness;
|
||||||
final ManagerAPI _managerAPI = locator<ManagerAPI>();
|
final ManagerAPI _managerAPI = locator<ManagerAPI>();
|
||||||
|
|
||||||
|
@ -43,8 +44,9 @@ class _DynamicThemeBuilderState extends State<DynamicThemeBuilder> with WidgetsB
|
||||||
if (_managerAPI.getThemeMode() < 2) {
|
if (_managerAPI.getThemeMode() < 2) {
|
||||||
SystemChrome.setSystemUIOverlayStyle(
|
SystemChrome.setSystemUIOverlayStyle(
|
||||||
SystemUiOverlayStyle(
|
SystemUiOverlayStyle(
|
||||||
systemNavigationBarIconBrightness:
|
systemNavigationBarIconBrightness: brightness == Brightness.light
|
||||||
brightness == Brightness.light ? Brightness.dark : Brightness.light,
|
? Brightness.dark
|
||||||
|
: Brightness.light,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -83,24 +85,31 @@ class _DynamicThemeBuilderState extends State<DynamicThemeBuilder> with WidgetsB
|
||||||
return DynamicTheme(
|
return DynamicTheme(
|
||||||
themeCollection: ThemeCollection(
|
themeCollection: ThemeCollection(
|
||||||
themes: {
|
themes: {
|
||||||
0: brightness == Brightness.light ? lightCustomTheme : darkCustomTheme,
|
0: brightness == Brightness.light
|
||||||
1: brightness == Brightness.light ? lightDynamicTheme : darkDynamicTheme,
|
? lightCustomTheme
|
||||||
|
: darkCustomTheme,
|
||||||
|
1: brightness == Brightness.light
|
||||||
|
? lightDynamicTheme
|
||||||
|
: darkDynamicTheme,
|
||||||
2: lightCustomTheme,
|
2: lightCustomTheme,
|
||||||
3: lightDynamicTheme,
|
3: lightDynamicTheme,
|
||||||
4: darkCustomTheme,
|
4: darkCustomTheme,
|
||||||
5: darkDynamicTheme,
|
5: darkDynamicTheme,
|
||||||
},
|
},
|
||||||
fallbackTheme: PlatformDispatcher.instance.platformBrightness == Brightness.light ? lightCustomTheme : darkCustomTheme,
|
fallbackTheme: PlatformDispatcher.instance.platformBrightness ==
|
||||||
|
Brightness.light
|
||||||
|
? lightCustomTheme
|
||||||
|
: darkCustomTheme,
|
||||||
),
|
),
|
||||||
builder: (context, theme) => MaterialApp(
|
builder: (context, theme) => MaterialApp(
|
||||||
debugShowCheckedModeBanner: false,
|
debugShowCheckedModeBanner: false,
|
||||||
title: widget.title,
|
title: widget.title,
|
||||||
navigatorKey: StackedService.navigatorKey,
|
navigatorKey: StackedService.navigatorKey,
|
||||||
onGenerateRoute: StackedRouter().onGenerateRoute,
|
onGenerateRoute: StackedRouter().onGenerateRoute,
|
||||||
theme: theme,
|
theme: theme,
|
||||||
home: widget.home,
|
home: widget.home,
|
||||||
localizationsDelegates: widget.localizationsDelegates,
|
localizationsDelegates: widget.localizationsDelegates,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
|
@ -40,8 +40,8 @@ class _AppSelectorViewState extends State<AppSelectorView> {
|
||||||
),
|
),
|
||||||
titleTextStyle: TextStyle(
|
titleTextStyle: TextStyle(
|
||||||
fontSize: 22.0,
|
fontSize: 22.0,
|
||||||
color: Theme.of(context).textTheme.titleLarge!.color,
|
color: Theme.of(context).textTheme.titleLarge!.color,
|
||||||
),
|
),
|
||||||
leading: IconButton(
|
leading: IconButton(
|
||||||
icon: Icon(
|
icon: Icon(
|
||||||
Icons.arrow_back,
|
Icons.arrow_back,
|
||||||
|
@ -94,9 +94,7 @@ class _AppSelectorViewState extends State<AppSelectorView> {
|
||||||
),
|
),
|
||||||
child: Column(
|
child: Column(
|
||||||
children: [
|
children: [
|
||||||
...model
|
...model.getFilteredApps(_query).map(
|
||||||
.getFilteredApps(_query)
|
|
||||||
.map(
|
|
||||||
(app) => InstalledAppItem(
|
(app) => InstalledAppItem(
|
||||||
name: app.appName,
|
name: app.appName,
|
||||||
pkgName: app.packageName,
|
pkgName: app.packageName,
|
||||||
|
@ -117,11 +115,8 @@ class _AppSelectorViewState extends State<AppSelectorView> {
|
||||||
packageName: app.packageName,
|
packageName: app.packageName,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
)
|
),
|
||||||
,
|
...model.getFilteredAppsNames(_query).map(
|
||||||
...model
|
|
||||||
.getFilteredAppsNames(_query)
|
|
||||||
.map(
|
|
||||||
(app) => NotInstalledAppItem(
|
(app) => NotInstalledAppItem(
|
||||||
name: app,
|
name: app,
|
||||||
patchesCount: model.patchesCount(app),
|
patchesCount: model.patchesCount(app),
|
||||||
|
@ -135,8 +130,7 @@ class _AppSelectorViewState extends State<AppSelectorView> {
|
||||||
packageName: app,
|
packageName: app,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
)
|
),
|
||||||
,
|
|
||||||
const SizedBox(height: 70.0),
|
const SizedBox(height: 70.0),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
|
|
@ -83,7 +83,6 @@ class HomeViewModel extends BaseViewModel {
|
||||||
_managerAPI.reAssessSavedApps().then((_) => _getPatchedApps());
|
_managerAPI.reAssessSavedApps().then((_) => _getPatchedApps());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void navigateToAppInfo(PatchedApplication app) {
|
void navigateToAppInfo(PatchedApplication app) {
|
||||||
_navigationService.navigateTo(
|
_navigationService.navigateTo(
|
||||||
Routes.appInfoView,
|
Routes.appInfoView,
|
||||||
|
@ -366,7 +365,10 @@ class HomeViewModel extends BaseViewModel {
|
||||||
alignment: Alignment.centerRight,
|
alignment: Alignment.centerRight,
|
||||||
child: FilledButton(
|
child: FilledButton(
|
||||||
onPressed: () async {
|
onPressed: () async {
|
||||||
await _patcherAPI.installApk(context, downloadedApk!.path);
|
await _patcherAPI.installApk(
|
||||||
|
context,
|
||||||
|
downloadedApk!.path,
|
||||||
|
);
|
||||||
},
|
},
|
||||||
child: I18nText('updateButton'),
|
child: I18nText('updateButton'),
|
||||||
),
|
),
|
||||||
|
|
|
@ -183,7 +183,9 @@ class InstallerViewModel extends BaseViewModel {
|
||||||
final index = logLines.indexWhere((line) => line.endsWith(keyword));
|
final index = logLines.indexWhere((line) => line.endsWith(keyword));
|
||||||
if (newString != null && lineCount > 0) {
|
if (newString != null && lineCount > 0) {
|
||||||
logLines.insert(
|
logLines.insert(
|
||||||
index, newString.replaceAll('{lineCount}', lineCount.toString()));
|
index,
|
||||||
|
newString.replaceAll('{lineCount}', lineCount.toString()),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
logLines.removeWhere((lines) => lines.endsWith(keyword));
|
logLines.removeWhere((lines) => lines.endsWith(keyword));
|
||||||
}
|
}
|
||||||
|
@ -203,11 +205,13 @@ class InstallerViewModel extends BaseViewModel {
|
||||||
return 'None';
|
return 'None';
|
||||||
}
|
}
|
||||||
return patches
|
return patches
|
||||||
.map((p) =>
|
.map(
|
||||||
p.name +
|
(p) =>
|
||||||
(p.options.isEmpty
|
p.name +
|
||||||
? ''
|
(p.options.isEmpty
|
||||||
: ' [${p.options.map((o) => '${o.title}: ${_getPatchOptionValue(p.name, o)}').join(", ")}]'))
|
? ''
|
||||||
|
: ' [${p.options.map((o) => '${o.title}: ${_getPatchOptionValue(p.name, o)}').join(", ")}]'),
|
||||||
|
)
|
||||||
.toList()
|
.toList()
|
||||||
.join(', ');
|
.join(', ');
|
||||||
}
|
}
|
||||||
|
@ -242,9 +246,11 @@ class InstallerViewModel extends BaseViewModel {
|
||||||
|
|
||||||
// Options changed
|
// Options changed
|
||||||
final patchesChanged = defaultPatches
|
final patchesChanged = defaultPatches
|
||||||
.where((p) =>
|
.where(
|
||||||
_patches.contains(p) &&
|
(p) =>
|
||||||
p.options.any((o) => _getPatchOptionValue(p.name, o) != o.value))
|
_patches.contains(p) &&
|
||||||
|
p.options.any((o) => _getPatchOptionValue(p.name, o) != o.value),
|
||||||
|
)
|
||||||
.toList();
|
.toList();
|
||||||
|
|
||||||
// Add Info
|
// Add Info
|
||||||
|
@ -453,9 +459,7 @@ class InstallerViewModel extends BaseViewModel {
|
||||||
update(
|
update(
|
||||||
1.0,
|
1.0,
|
||||||
'Installing...',
|
'Installing...',
|
||||||
_app.isRooted
|
_app.isRooted ? 'Mounting patched app' : 'Installing patched app',
|
||||||
? 'Mounting patched app'
|
|
||||||
: 'Installing patched app',
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
final int response = await _patcherAPI.installPatchedFile(context, _app);
|
final int response = await _patcherAPI.installPatchedFile(context, _app);
|
||||||
|
|
|
@ -22,7 +22,7 @@ class PatcherView extends StatelessWidget {
|
||||||
child: FloatingActionButton.extended(
|
child: FloatingActionButton.extended(
|
||||||
label: I18nText('patcherView.patchButton'),
|
label: I18nText('patcherView.patchButton'),
|
||||||
icon: const Icon(Icons.build),
|
icon: const Icon(Icons.build),
|
||||||
onPressed: () async{
|
onPressed: () async {
|
||||||
if (model.checkRequiredPatchOption(context)) {
|
if (model.checkRequiredPatchOption(context)) {
|
||||||
final bool proceed = model.showRemovedPatchesDialog(context);
|
final bool proceed = model.showRemovedPatchesDialog(context);
|
||||||
if (proceed && context.mounted) {
|
if (proceed && context.mounted) {
|
||||||
|
|
|
@ -180,11 +180,16 @@ class _PatchesSelectorViewState extends State<PatchesSelectorView> {
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
if (model.getQueriedPatches(_query).any((patch) => model.isPatchNew(patch)))
|
if (model
|
||||||
|
.getQueriedPatches(_query)
|
||||||
|
.any((patch) => model.isPatchNew(patch)))
|
||||||
Column(
|
Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
model.getPatchCategory(context, 'patchesSelectorView.newPatches'),
|
model.getPatchCategory(
|
||||||
|
context,
|
||||||
|
'patchesSelectorView.newPatches',
|
||||||
|
),
|
||||||
...model.getQueriedPatches(_query).map((patch) {
|
...model.getQueriedPatches(_query).map((patch) {
|
||||||
if (model.isPatchNew(patch)) {
|
if (model.isPatchNew(patch)) {
|
||||||
return model.getPatchItem(context, patch);
|
return model.getPatchItem(context, patch);
|
||||||
|
@ -192,26 +197,40 @@ class _PatchesSelectorViewState extends State<PatchesSelectorView> {
|
||||||
return Container();
|
return Container();
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
if (model.getQueriedPatches(_query).any((patch) => !model.isPatchNew(patch) && patch.compatiblePackages.isNotEmpty))
|
if (model.getQueriedPatches(_query).any(
|
||||||
model.getPatchCategory(context, 'patchesSelectorView.patches'),
|
(patch) =>
|
||||||
|
!model.isPatchNew(patch) &&
|
||||||
|
patch.compatiblePackages.isNotEmpty,
|
||||||
|
))
|
||||||
|
model.getPatchCategory(
|
||||||
|
context,
|
||||||
|
'patchesSelectorView.patches',
|
||||||
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
...model.getQueriedPatches(_query).map(
|
...model.getQueriedPatches(_query).map(
|
||||||
(patch) {
|
(patch) {
|
||||||
if (patch.compatiblePackages.isNotEmpty && !model.isPatchNew(patch)) {
|
if (patch.compatiblePackages.isNotEmpty &&
|
||||||
|
!model.isPatchNew(patch)) {
|
||||||
return model.getPatchItem(context, patch);
|
return model.getPatchItem(context, patch);
|
||||||
} else {
|
} else {
|
||||||
return Container();
|
return Container();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
if (model.getQueriedPatches(_query).any((patch) => patch.compatiblePackages.isEmpty))
|
if (model
|
||||||
|
.getQueriedPatches(_query)
|
||||||
|
.any((patch) => patch.compatiblePackages.isEmpty))
|
||||||
Column(
|
Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
model.getPatchCategory(context, 'patchesSelectorView.universalPatches'),
|
model.getPatchCategory(
|
||||||
|
context,
|
||||||
|
'patchesSelectorView.universalPatches',
|
||||||
|
),
|
||||||
...model.getQueriedPatches(_query).map((patch) {
|
...model.getQueriedPatches(_query).map((patch) {
|
||||||
if (patch.compatiblePackages.isEmpty && !model.isPatchNew(patch)) {
|
if (patch.compatiblePackages.isEmpty &&
|
||||||
|
!model.isPatchNew(patch)) {
|
||||||
return model.getPatchItem(context, patch);
|
return model.getPatchItem(context, patch);
|
||||||
} else {
|
} else {
|
||||||
return Container();
|
return Container();
|
||||||
|
|
|
@ -58,7 +58,8 @@ class PatchSelectorCard extends StatelessWidget {
|
||||||
|
|
||||||
String _getPatchesSelection() {
|
String _getPatchesSelection() {
|
||||||
String text = '';
|
String text = '';
|
||||||
final List<Patch> selectedPatches = locator<PatcherViewModel>().selectedPatches;
|
final List<Patch> selectedPatches =
|
||||||
|
locator<PatcherViewModel>().selectedPatches;
|
||||||
selectedPatches.sort((a, b) => a.name.compareTo(b.name));
|
selectedPatches.sort((a, b) => a.name.compareTo(b.name));
|
||||||
for (final Patch p in selectedPatches) {
|
for (final Patch p in selectedPatches) {
|
||||||
text += '• ${p.getSimpleName()}\n';
|
text += '• ${p.getSimpleName()}\n';
|
||||||
|
|
|
@ -400,7 +400,9 @@ class _TextFieldForPatchOptionState extends State<TextFieldForPatchOption> {
|
||||||
final bool isStringOption = widget.optionType.contains('String');
|
final bool isStringOption = widget.optionType.contains('String');
|
||||||
final bool isArrayOption = widget.optionType.contains('Array');
|
final bool isArrayOption = widget.optionType.contains('Array');
|
||||||
selectedKey ??= widget.selectedKey;
|
selectedKey ??= widget.selectedKey;
|
||||||
controller.text = !isStringOption && isArrayOption && selectedKey == '' &&
|
controller.text = !isStringOption &&
|
||||||
|
isArrayOption &&
|
||||||
|
selectedKey == '' &&
|
||||||
(widget.value != null && widget.value.toString().startsWith('['))
|
(widget.value != null && widget.value.toString().startsWith('['))
|
||||||
? ''
|
? ''
|
||||||
: widget.value ?? '';
|
: widget.value ?? '';
|
||||||
|
@ -519,7 +521,8 @@ class _TextFieldForPatchOptionState extends State<TextFieldForPatchOption> {
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'patchOptionsView.selectFolder':
|
case 'patchOptionsView.selectFolder':
|
||||||
final DirectoryLocation? result = await FlutterFileDialog.pickDirectory();
|
final DirectoryLocation? result =
|
||||||
|
await FlutterFileDialog.pickDirectory();
|
||||||
if (result != null) {
|
if (result != null) {
|
||||||
controller.text = result.toString();
|
controller.text = result.toString();
|
||||||
widget.onChanged(controller.text);
|
widget.onChanged(controller.text);
|
||||||
|
|
|
@ -10,7 +10,6 @@ import 'package:revanced_manager/ui/widgets/settingsView/settings_section.dart';
|
||||||
import 'package:revanced_manager/ui/widgets/settingsView/settings_universal_patches.dart';
|
import 'package:revanced_manager/ui/widgets/settingsView/settings_universal_patches.dart';
|
||||||
import 'package:revanced_manager/ui/widgets/settingsView/settings_version_compatibility_check.dart';
|
import 'package:revanced_manager/ui/widgets/settingsView/settings_version_compatibility_check.dart';
|
||||||
|
|
||||||
|
|
||||||
class SAdvancedSection extends StatelessWidget {
|
class SAdvancedSection extends StatelessWidget {
|
||||||
const SAdvancedSection({super.key});
|
const SAdvancedSection({super.key});
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,8 @@ class SEnablePatchesSelection extends StatefulWidget {
|
||||||
const SEnablePatchesSelection({super.key});
|
const SEnablePatchesSelection({super.key});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
State<SEnablePatchesSelection> createState() => _SEnablePatchesSelectionState();
|
State<SEnablePatchesSelection> createState() =>
|
||||||
|
_SEnablePatchesSelectionState();
|
||||||
}
|
}
|
||||||
|
|
||||||
final _settingsViewModel = SettingsViewModel();
|
final _settingsViewModel = SettingsViewModel();
|
||||||
|
|
|
@ -6,12 +6,14 @@ class SRequireSuggestedAppVersion extends StatefulWidget {
|
||||||
const SRequireSuggestedAppVersion({super.key});
|
const SRequireSuggestedAppVersion({super.key});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
State<SRequireSuggestedAppVersion> createState() => _SRequireSuggestedAppVersionState();
|
State<SRequireSuggestedAppVersion> createState() =>
|
||||||
|
_SRequireSuggestedAppVersionState();
|
||||||
}
|
}
|
||||||
|
|
||||||
final _settingsViewModel = SettingsViewModel();
|
final _settingsViewModel = SettingsViewModel();
|
||||||
|
|
||||||
class _SRequireSuggestedAppVersionState extends State<SRequireSuggestedAppVersion> {
|
class _SRequireSuggestedAppVersionState
|
||||||
|
extends State<SRequireSuggestedAppVersion> {
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return SwitchListTile(
|
return SwitchListTile(
|
||||||
|
@ -29,8 +31,11 @@ class _SRequireSuggestedAppVersionState extends State<SRequireSuggestedAppVersio
|
||||||
subtitle: I18nText('settingsView.requireSuggestedAppVersionHint'),
|
subtitle: I18nText('settingsView.requireSuggestedAppVersionHint'),
|
||||||
value: _settingsViewModel.isRequireSuggestedAppVersionEnabled(),
|
value: _settingsViewModel.isRequireSuggestedAppVersionEnabled(),
|
||||||
onChanged: (value) async {
|
onChanged: (value) async {
|
||||||
await _settingsViewModel.showRequireSuggestedAppVersionDialog(context, value,);
|
await _settingsViewModel.showRequireSuggestedAppVersionDialog(
|
||||||
setState(() {});
|
context,
|
||||||
|
value,
|
||||||
|
);
|
||||||
|
setState(() {});
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,16 +8,14 @@ class SUniversalPatches extends StatefulWidget {
|
||||||
const SUniversalPatches({super.key});
|
const SUniversalPatches({super.key});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
State<SUniversalPatches> createState() =>
|
State<SUniversalPatches> createState() => _SUniversalPatchesState();
|
||||||
_SUniversalPatchesState();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
final _settingsViewModel = SettingsViewModel();
|
final _settingsViewModel = SettingsViewModel();
|
||||||
final _patchesSelectorViewModel = PatchesSelectorViewModel();
|
final _patchesSelectorViewModel = PatchesSelectorViewModel();
|
||||||
final _patcherViewModel = PatcherViewModel();
|
final _patcherViewModel = PatcherViewModel();
|
||||||
|
|
||||||
class _SUniversalPatchesState
|
class _SUniversalPatchesState extends State<SUniversalPatches> {
|
||||||
extends State<SUniversalPatches> {
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return SwitchListTile(
|
return SwitchListTile(
|
||||||
|
|
|
@ -9,14 +9,16 @@ class SVersionCompatibilityCheck extends StatefulWidget {
|
||||||
const SVersionCompatibilityCheck({super.key});
|
const SVersionCompatibilityCheck({super.key});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
State<SVersionCompatibilityCheck> createState() => _SVersionCompatibilityCheckState();
|
State<SVersionCompatibilityCheck> createState() =>
|
||||||
|
_SVersionCompatibilityCheckState();
|
||||||
}
|
}
|
||||||
|
|
||||||
final _settingsViewModel = SettingsViewModel();
|
final _settingsViewModel = SettingsViewModel();
|
||||||
final _patchesSelectorViewModel = PatchesSelectorViewModel();
|
final _patchesSelectorViewModel = PatchesSelectorViewModel();
|
||||||
final _patcherViewModel = PatcherViewModel();
|
final _patcherViewModel = PatcherViewModel();
|
||||||
|
|
||||||
class _SVersionCompatibilityCheckState extends State<SVersionCompatibilityCheck> {
|
class _SVersionCompatibilityCheckState
|
||||||
|
extends State<SVersionCompatibilityCheck> {
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return SwitchListTile(
|
return SwitchListTile(
|
||||||
|
|
|
@ -27,12 +27,12 @@ bool hasUnsupportedRequiredOption(List<Option> options, Patch patch) {
|
||||||
for (final Option option in options) {
|
for (final Option option in options) {
|
||||||
if (option.required &&
|
if (option.required &&
|
||||||
option.value == null &&
|
option.value == null &&
|
||||||
locator<ManagerAPI>()
|
locator<ManagerAPI>().getPatchOption(
|
||||||
.getPatchOption(
|
locator<PatcherViewModel>().selectedApp!.packageName,
|
||||||
locator<PatcherViewModel>().selectedApp!.packageName,
|
patch.name,
|
||||||
patch.name,
|
option.key,
|
||||||
option.key,
|
) ==
|
||||||
) == null) {
|
null) {
|
||||||
requiredOptionsType.add(option.valueType);
|
requiredOptionsType.add(option.valueType);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -52,7 +52,8 @@ List<Option> getNullRequiredOptions(List<Patch> patches, String packageName) {
|
||||||
patchOption.required &&
|
patchOption.required &&
|
||||||
patchOption.value == null &&
|
patchOption.value == null &&
|
||||||
locator<ManagerAPI>()
|
locator<ManagerAPI>()
|
||||||
.getPatchOption(packageName, patch.name, patchOption.key) == null) {
|
.getPatchOption(packageName, patch.name, patchOption.key) ==
|
||||||
|
null) {
|
||||||
requiredNullOptions.add(patchOption);
|
requiredNullOptions.add(patchOption);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue