mirror of
https://github.com/revanced/revanced-manager.git
synced 2025-04-30 05:54:26 +02:00
fix: Only show share and install options if patching was successful
This commit is contained in:
parent
a3c14e0a51
commit
3bb5e70d1c
@ -166,7 +166,7 @@ class HomeViewModel extends BaseViewModel {
|
|||||||
title: I18nText('homeView.updateDialogTitle'),
|
title: I18nText('homeView.updateDialogTitle'),
|
||||||
backgroundColor: Theme.of(context).colorScheme.secondaryContainer,
|
backgroundColor: Theme.of(context).colorScheme.secondaryContainer,
|
||||||
content: I18nText('homeView.updateDialogText'),
|
content: I18nText('homeView.updateDialogText'),
|
||||||
actions: [
|
actions: <Widget>[
|
||||||
CustomMaterialButton(
|
CustomMaterialButton(
|
||||||
isFilled: false,
|
isFilled: false,
|
||||||
label: I18nText('cancelButton'),
|
label: I18nText('cancelButton'),
|
||||||
|
@ -30,7 +30,7 @@ class InstallerView extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
actions: <Widget>[
|
actions: <Widget>[
|
||||||
Visibility(
|
Visibility(
|
||||||
visible: !model.isPatching,
|
visible: !model.isPatching && model.hasErrors,
|
||||||
child: CustomPopupMenu(
|
child: CustomPopupMenu(
|
||||||
onSelected: (value) => model.onMenuSelection(value),
|
onSelected: (value) => model.onMenuSelection(value),
|
||||||
children: {
|
children: {
|
||||||
@ -89,7 +89,7 @@ class InstallerView extends StatelessWidget {
|
|||||||
child: Align(
|
child: Align(
|
||||||
alignment: Alignment.bottomCenter,
|
alignment: Alignment.bottomCenter,
|
||||||
child: Visibility(
|
child: Visibility(
|
||||||
visible: !model.isPatching,
|
visible: !model.isPatching && !model.hasErrors,
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding: const EdgeInsets.all(20.0).copyWith(top: 0.0),
|
padding: const EdgeInsets.all(20.0).copyWith(top: 0.0),
|
||||||
child: Row(
|
child: Row(
|
||||||
|
@ -26,6 +26,7 @@ class InstallerViewModel extends BaseViewModel {
|
|||||||
String headerLogs = '';
|
String headerLogs = '';
|
||||||
bool isPatching = true;
|
bool isPatching = true;
|
||||||
bool isInstalled = false;
|
bool isInstalled = false;
|
||||||
|
bool hasErrors = false;
|
||||||
|
|
||||||
Future<void> initialize(BuildContext context) async {
|
Future<void> initialize(BuildContext context) async {
|
||||||
try {
|
try {
|
||||||
@ -79,6 +80,7 @@ class InstallerViewModel extends BaseViewModel {
|
|||||||
if (progress == 0.0) {
|
if (progress == 0.0) {
|
||||||
logs = '';
|
logs = '';
|
||||||
isInstalled = false;
|
isInstalled = false;
|
||||||
|
hasErrors = false;
|
||||||
}
|
}
|
||||||
if (header.isNotEmpty) {
|
if (header.isNotEmpty) {
|
||||||
headerLogs = header;
|
headerLogs = header;
|
||||||
@ -115,9 +117,11 @@ class InstallerViewModel extends BaseViewModel {
|
|||||||
update(0.0, '', 'Creating working directory');
|
update(0.0, '', 'Creating working directory');
|
||||||
await _patcherAPI.runPatcher(_app.packageName, apkFilePath, _patches);
|
await _patcherAPI.runPatcher(_app.packageName, apkFilePath, _patches);
|
||||||
} on Exception {
|
} on Exception {
|
||||||
|
hasErrors = true;
|
||||||
update(1.0, 'Aborting...', 'An error occurred! Aborting');
|
update(1.0, 'Aborting...', 'An error occurred! Aborting');
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
hasErrors = true;
|
||||||
update(1.0, 'Aborting...', 'No app or patches selected! Aborting');
|
update(1.0, 'Aborting...', 'No app or patches selected! Aborting');
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
@ -144,8 +148,6 @@ class InstallerViewModel extends BaseViewModel {
|
|||||||
_app.patchDate = DateTime.now();
|
_app.patchDate = DateTime.now();
|
||||||
_app.appliedPatches = _patches.map((p) => p.name).toList();
|
_app.appliedPatches = _patches.map((p) => p.name).toList();
|
||||||
await _managerAPI.savePatchedApp(_app);
|
await _managerAPI.savePatchedApp(_app);
|
||||||
} else {
|
|
||||||
update(1.0, 'Aborting...', 'An error occurred! Aborting');
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -88,7 +88,7 @@ class _PatchesSelectorViewState extends State<PatchesSelectorView> {
|
|||||||
tapHeaderToExpand: true,
|
tapHeaderToExpand: true,
|
||||||
),
|
),
|
||||||
header: Column(
|
header: Column(
|
||||||
children: [
|
children: <Widget>[
|
||||||
GestureDetector(
|
GestureDetector(
|
||||||
onLongPress: () =>
|
onLongPress: () =>
|
||||||
expController.toggle(),
|
expController.toggle(),
|
||||||
@ -138,7 +138,7 @@ class _PatchesSelectorViewState extends State<PatchesSelectorView> {
|
|||||||
BorderRadius.circular(12),
|
BorderRadius.circular(12),
|
||||||
),
|
),
|
||||||
child: Column(
|
child: Column(
|
||||||
children: [
|
children: <Widget>[
|
||||||
Text(
|
Text(
|
||||||
"Patch options",
|
"Patch options",
|
||||||
style: GoogleFonts.inter(
|
style: GoogleFonts.inter(
|
||||||
|
@ -100,7 +100,7 @@ class SettingsViewModel extends BaseViewModel {
|
|||||||
context: context,
|
context: context,
|
||||||
builder: (context) => AlertDialog(
|
builder: (context) => AlertDialog(
|
||||||
title: Row(
|
title: Row(
|
||||||
children: [
|
children: <Widget>[
|
||||||
I18nText('settingsView.sourcesLabel'),
|
I18nText('settingsView.sourcesLabel'),
|
||||||
const Spacer(),
|
const Spacer(),
|
||||||
IconButton(
|
IconButton(
|
||||||
@ -160,7 +160,7 @@ class SettingsViewModel extends BaseViewModel {
|
|||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
actions: [
|
actions: <Widget>[
|
||||||
CustomMaterialButton(
|
CustomMaterialButton(
|
||||||
isFilled: false,
|
isFilled: false,
|
||||||
label: I18nText('cancelButton'),
|
label: I18nText('cancelButton'),
|
||||||
@ -196,7 +196,7 @@ class SettingsViewModel extends BaseViewModel {
|
|||||||
title: I18nText('settingsView.sourcesResetDialogTitle'),
|
title: I18nText('settingsView.sourcesResetDialogTitle'),
|
||||||
backgroundColor: Theme.of(context).colorScheme.secondaryContainer,
|
backgroundColor: Theme.of(context).colorScheme.secondaryContainer,
|
||||||
content: I18nText('settingsView.sourcesResetDialogText'),
|
content: I18nText('settingsView.sourcesResetDialogText'),
|
||||||
actions: [
|
actions: <Widget>[
|
||||||
CustomMaterialButton(
|
CustomMaterialButton(
|
||||||
isFilled: false,
|
isFilled: false,
|
||||||
label: I18nText('cancelButton'),
|
label: I18nText('cancelButton'),
|
||||||
|
@ -64,12 +64,12 @@ class AppInfoView extends StatelessWidget {
|
|||||||
child: IntrinsicHeight(
|
child: IntrinsicHeight(
|
||||||
child: Row(
|
child: Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||||
children: [
|
children: <Widget>[
|
||||||
InkWell(
|
InkWell(
|
||||||
onTap: () => model.openApp(app),
|
onTap: () => model.openApp(app),
|
||||||
child: Column(
|
child: Column(
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
children: [
|
children: <Widget>[
|
||||||
Icon(
|
Icon(
|
||||||
Icons.open_in_new_outlined,
|
Icons.open_in_new_outlined,
|
||||||
color:
|
color:
|
||||||
@ -99,7 +99,7 @@ class AppInfoView extends StatelessWidget {
|
|||||||
model.showUninstallAlertDialog(context, app),
|
model.showUninstallAlertDialog(context, app),
|
||||||
child: Column(
|
child: Column(
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
children: [
|
children: <Widget>[
|
||||||
Icon(
|
Icon(
|
||||||
Icons.delete_outline,
|
Icons.delete_outline,
|
||||||
color:
|
color:
|
||||||
@ -131,7 +131,7 @@ class AppInfoView extends StatelessWidget {
|
|||||||
},
|
},
|
||||||
child: Column(
|
child: Column(
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
children: [
|
children: <Widget>[
|
||||||
Icon(
|
Icon(
|
||||||
Icons.build_outlined,
|
Icons.build_outlined,
|
||||||
color:
|
color:
|
||||||
|
@ -49,7 +49,7 @@ class AppInfoViewModel extends BaseViewModel {
|
|||||||
title: I18nText('appInfoView.rootDialogTitle'),
|
title: I18nText('appInfoView.rootDialogTitle'),
|
||||||
backgroundColor: Theme.of(context).colorScheme.secondaryContainer,
|
backgroundColor: Theme.of(context).colorScheme.secondaryContainer,
|
||||||
content: I18nText('appInfoView.rootDialogText'),
|
content: I18nText('appInfoView.rootDialogText'),
|
||||||
actions: [
|
actions: <Widget>[
|
||||||
CustomMaterialButton(
|
CustomMaterialButton(
|
||||||
label: I18nText('okButton'),
|
label: I18nText('okButton'),
|
||||||
onPressed: () => Navigator.of(context).pop(),
|
onPressed: () => Navigator.of(context).pop(),
|
||||||
@ -64,7 +64,7 @@ class AppInfoViewModel extends BaseViewModel {
|
|||||||
title: I18nText('appInfoView.uninstallDialogTitle'),
|
title: I18nText('appInfoView.uninstallDialogTitle'),
|
||||||
backgroundColor: Theme.of(context).colorScheme.secondaryContainer,
|
backgroundColor: Theme.of(context).colorScheme.secondaryContainer,
|
||||||
content: I18nText('appInfoView.uninstallDialogText'),
|
content: I18nText('appInfoView.uninstallDialogText'),
|
||||||
actions: [
|
actions: <Widget>[
|
||||||
CustomMaterialButton(
|
CustomMaterialButton(
|
||||||
isFilled: false,
|
isFilled: false,
|
||||||
label: I18nText('cancelButton'),
|
label: I18nText('cancelButton'),
|
||||||
@ -105,7 +105,7 @@ class AppInfoViewModel extends BaseViewModel {
|
|||||||
title: I18nText('appInfoView.appliedPatchesLabel'),
|
title: I18nText('appInfoView.appliedPatchesLabel'),
|
||||||
backgroundColor: Theme.of(context).colorScheme.secondaryContainer,
|
backgroundColor: Theme.of(context).colorScheme.secondaryContainer,
|
||||||
content: Text(getAppliedPatchesString(app.appliedPatches)),
|
content: Text(getAppliedPatchesString(app.appliedPatches)),
|
||||||
actions: [
|
actions: <Widget>[
|
||||||
CustomMaterialButton(
|
CustomMaterialButton(
|
||||||
label: I18nText('okButton'),
|
label: I18nText('okButton'),
|
||||||
onPressed: () => Navigator.of(context).pop(),
|
onPressed: () => Navigator.of(context).pop(),
|
||||||
|
@ -15,7 +15,7 @@ class AppSkeletonLoader extends StatelessWidget {
|
|||||||
padding: const EdgeInsets.symmetric(vertical: 16, horizontal: 8.0),
|
padding: const EdgeInsets.symmetric(vertical: 16, horizontal: 8.0),
|
||||||
child: SkeletonItem(
|
child: SkeletonItem(
|
||||||
child: Row(
|
child: Row(
|
||||||
children: [
|
children: <Widget>[
|
||||||
SkeletonAvatar(
|
SkeletonAvatar(
|
||||||
style: SkeletonAvatarStyle(
|
style: SkeletonAvatarStyle(
|
||||||
width: screenWidth * 0.15,
|
width: screenWidth * 0.15,
|
||||||
@ -27,7 +27,7 @@ class AppSkeletonLoader extends StatelessWidget {
|
|||||||
const SizedBox(width: 16),
|
const SizedBox(width: 16),
|
||||||
Column(
|
Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: <Widget>[
|
||||||
Container(
|
Container(
|
||||||
color: Colors.white,
|
color: Colors.white,
|
||||||
height: 34,
|
height: 34,
|
||||||
|
@ -154,7 +154,7 @@ class _PatchItemState extends State<PatchItem> {
|
|||||||
'\u2022 ${widget.supportedPackageVersions.join('\n\u2022 ')}',
|
'\u2022 ${widget.supportedPackageVersions.join('\n\u2022 ')}',
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
actions: [
|
actions: <Widget>[
|
||||||
CustomMaterialButton(
|
CustomMaterialButton(
|
||||||
label: I18nText('okButton'),
|
label: I18nText('okButton'),
|
||||||
onPressed: () => Navigator.of(context).pop(),
|
onPressed: () => Navigator.of(context).pop(),
|
||||||
|
@ -38,7 +38,7 @@ class OptionsFilePicker extends StatelessWidget {
|
|||||||
padding: const EdgeInsets.symmetric(horizontal: 4.0),
|
padding: const EdgeInsets.symmetric(horizontal: 4.0),
|
||||||
child: Row(
|
child: Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
children: [
|
children: <Widget>[
|
||||||
I18nText(
|
I18nText(
|
||||||
optionName,
|
optionName,
|
||||||
child: Text(
|
child: Text(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user