Compare commits

...

33 Commits

Author SHA1 Message Date
Benjamin f8f4ee754c
Merge 979cbfe94d into e5d83f424a 2024-04-22 17:23:48 +05:30
Benjamin Halko 979cbfe94d Added description 2024-03-05 08:45:45 -08:00
Benjamin Halko d83869da2c Merge branch 'dev' into feat/patch-history 2024-03-05 08:11:25 -08:00
Benjamin Halko a8bdafe952 Update installer_view.dart 2024-02-28 09:06:07 -08:00
Benjamin Halko cb686dabc7 Merge branch 'dev' into feat/patch-history 2024-02-28 08:48:22 -08:00
Benjamin aa7a8c422e Fixed merge conflicts 2024-02-17 15:02:14 -08:00
Benjamin 0cb84be764 Merge branch 'dev' into feat/patch-history 2024-02-17 13:50:05 -08:00
Benjamin ffa8847eb2
Update assets/i18n/en_US.json
Co-authored-by: oSumAtrIX <johan.melkonyan1@web.de>
2024-01-13 19:36:54 -08:00
Benjamin cb5641a50b
Update assets/i18n/en_US.json
Co-authored-by: oSumAtrIX <johan.melkonyan1@web.de>
2024-01-13 19:35:26 -08:00
Benjamin Halko a92b69b986
Update en_US.json 2023-12-26 10:43:48 -08:00
Benjamin Halko a3c4c8e706
Merge branch 'dev' into feat/patch-history 2023-12-26 10:37:33 -08:00
Benjamin Halko b4e21ae2ee
Merge branch 'dev' into feat/patch-history 2023-12-26 10:33:34 -08:00
Benjamin Halko 14dd4a0d1c
Merge branch 'dev' into feat/patch-history 2023-12-14 07:33:32 -08:00
festry0 1fee561345
fix: Grammar in readme mistake (#1569) 2023-12-14 14:54:14 +07:00
Benjamin 5f03a8b548
Update assets/i18n/en_US.json
Co-authored-by: oSumAtrIX <johan.melkonyan1@web.de>
2023-11-30 07:24:00 -08:00
Benjamin Halko d620272e9f
Merge branch 'dev' into feat/patch-history 2023-11-28 14:34:03 -08:00
Benjamin Halko 7e22fa25bb
Update en_US.json 2023-11-25 11:34:44 -08:00
Benjamin Halko cebf97464d
Added setting 2023-11-25 11:32:33 -08:00
Benjamin Halko 8ac25bfb40
Limit patch history to 1 app 2023-11-25 11:10:27 -08:00
Benjamin Halko f375fa9b35
Merge branch 'dev' into feat/patch-history 2023-11-25 09:38:06 -08:00
Benjamin Halko 443f59473a
switching to single app history 2023-11-25 09:37:21 -08:00
oSumAtrIX 36572abaea
Merge branch 'dev' into feat/patch-history
# Conflicts:
#	lib/models/patch.dart
#	lib/services/patcher_api.dart
#	pubspec.yaml
2023-11-05 21:55:17 +01:00
Benjamin Halko d0103a33d9
Merge branch 'dev' into feat/patch-history 2023-11-01 16:29:18 -07:00
Benjamin 52da64b229
chore: upgrade dependencies (#1404) 2023-10-31 14:41:53 +01:00
oSumAtrIX d63185be55
docs: Remove unneeded steps to build from source 2023-10-31 14:41:53 +01:00
Mr. X ee8c7f297d
docs: use correct directory path (#1440) 2023-10-31 14:41:52 +01:00
aAbed 163160c1ec
fix: Hide empty patches category labels (#1439) 2023-10-31 14:41:40 +01:00
aAbed 073acdaa72
build: Bump dependencies to support patch option values (#1431)
Co-authored-by: oSumAtrIX <johan.melkonyan1@web.de>
2023-10-31 14:41:40 +01:00
Ushie 7019d0cab5
build: bump version to v1.14.2 2023-10-31 14:41:39 +01:00
aAbed b53bc280b6
fix: unable to use custom API (#1435) 2023-10-31 14:41:39 +01:00
Benjamin Halko 18885a1433
Update home_view.dart 2023-10-21 13:12:35 -07:00
Benjamin Halko 527951397f
Update manager_api.dart 2023-10-21 13:00:06 -07:00
Benjamin Halko 72a99bc7fb
feat: patch history 2023-10-21 12:54:01 -07:00
15 changed files with 421 additions and 34 deletions

View File

@ -27,10 +27,12 @@
"refreshSuccess": "Refreshed successfully",
"widgetTitle": "Dashboard",
"updatesSubtitle": "Updates",
"patchedSubtitle": "Patched apps",
"patchHistorySubtitle": "Last patch",
"patchedSubtitle": "Installed apps",
"changeLaterSubtitle": "You can change this in the settings at a later time.",
"noUpdates": "No updates available",
"WIP": "Work in progress...",
"noHistory": "No app found",
"noInstallations": "No patched apps installed",
"installUpdate": "Continue to install the update?",
"updateSheetTitle": "Update ReVanced Manager",
@ -203,6 +205,8 @@
"showUpdateDialogHint": "Show a dialog when a new update is available",
"universalPatchesLabel": "Show universal patches",
"universalPatchesHint": "Display all apps and universal patches (may slow down the app list)",
"patchHistoryLabel": "Save patched app",
"patchHistoryHint": "Save the last patch to install or export later",
"versionCompatibilityCheckLabel": "Version compatibility check",
"versionCompatibilityCheckHint": "Prevent selecting patches that are not compatible with the selected app version",
"requireSuggestedAppVersionLabel": "Require suggested app version",
@ -254,18 +258,25 @@
"appInfoView": {
"widgetTitle": "App info",
"openButton": "Open",
"installButton": "Install",
"uninstallButton": "Uninstall",
"unmountButton": "Unmount",
"exportButton": "Export",
"deleteButton": "Delete",
"rootDialogTitle": "Error",
"patchHistoryDescription": "This is a backup of the last patched app. You can install or export it later.",
"unmountDialogText": "Are you sure you want to unmount this app?",
"uninstallDialogText": "Are you sure you want to uninstall this app?",
"rootDialogText": "App was installed with superuser permissions, but currently ReVanced Manager has no permissions.\nPlease grant superuser permissions first.",
"removeAppDialogTitle": "Delete app?",
"removeAppDialogText": "Are you sure you want to delete this app?",
"packageNameLabel": "Package name",
"installTypeLabel": "Installation type",
"mountTypeLabel": "Mount",
"regularTypeLabel": "Regular",
"patchedDateLabel": "Patched date",
"appliedPatchesLabel": "Applied patches",
"sizeLabel": "File size",
"patchedDateHint": "${date} at ${time}",
"appliedPatchesHint": "${quantity} applied patches",
"updateNotImplemented": "This feature has not been implemented yet"

View File

@ -16,6 +16,8 @@ class PatchedApplication {
this.isRooted = false,
this.isFromStorage = false,
this.appliedPatches = const [],
this.patchedFilePath = '',
this.fileSize = 0,
});
factory PatchedApplication.fromJson(Map<String, dynamic> json) =>
@ -33,6 +35,8 @@ class PatchedApplication {
bool isRooted;
bool isFromStorage;
List<String> appliedPatches;
String patchedFilePath;
int fileSize;
Map<String, dynamic> toJson() => _$PatchedApplicationToJson(this);

View File

@ -296,6 +296,14 @@ class ManagerAPI {
await _prefs.setBool('requireSuggestedAppVersionEnabled', value);
}
bool isPatchHistoryEnabled() {
return _prefs.getBool('patchHistoryEnabled') ?? true;
}
Future<void> enablePatchHistoryStatus(bool value) async {
await _prefs.setBool('patchHistoryEnabled', value);
}
Future<void> setKeystorePassword(String password) async {
await _prefs.setString('keystorePassword', password);
}
@ -328,6 +336,34 @@ class ManagerAPI {
}
}
PatchedApplication? getLastPatchedApp() {
final String? app = _prefs.getString('lastPatchedApp');
return app != null ? PatchedApplication.fromJson(jsonDecode(app)) : null;
}
Future<void> deleteLastPatchedApp() async {
final PatchedApplication? app = getLastPatchedApp();
if (app != null) {
final File file = File(app.patchedFilePath);
await file.delete();
await _prefs.remove('lastPatchedApp');
}
}
Future<void> setLastPatchedApp(
PatchedApplication app,
File outFile,
) async {
deleteLastPatchedApp();
final Directory appCache = await getApplicationSupportDirectory();
app.patchedFilePath = outFile.copySync('${appCache.path}/lastPatchedApp.apk').path;
app.fileSize = outFile.lengthSync();
await _prefs.setString(
'lastPatchedApp',
json.encode(app.toJson()),
);
}
List<PatchedApplication> getPatchedApps() {
final List<String> apps = _prefs.getStringList('patchedApps') ?? [];
return apps.map((a) => PatchedApplication.fromJson(jsonDecode(a))).toList();
@ -686,6 +722,16 @@ class ManagerAPI {
patchedApps.addAll(mountedApps);
await setPatchedApps(patchedApps);
// Removed saved app history if the file is not found.
final PatchedApplication? lastPatchedApp = getLastPatchedApp();
if (lastPatchedApp != null) {
final File file = File(lastPatchedApp.patchedFilePath);
if (!file.existsSync()) {
deleteLastPatchedApp();
_prefs.remove('lastPatchedApp');
}
}
}
Future<bool> isAppUninstalled(PatchedApplication app) async {
@ -780,4 +826,82 @@ class ManagerAPI {
selectedPatchesFile.deleteSync();
}
}
Future<bool> installTypeDialog(BuildContext context) async {
final ValueNotifier<int> installType = ValueNotifier(0);
if (isRooted) {
await showDialog(
context: context,
barrierDismissible: false,
builder: (context) => AlertDialog(
title: Text(t.installerView.installType),
backgroundColor: Theme.of(context).colorScheme.secondaryContainer,
icon: const Icon(Icons.file_download_outlined),
contentPadding: const EdgeInsets.symmetric(vertical: 16),
content: SingleChildScrollView(
child: ValueListenableBuilder(
valueListenable: installType,
builder: (context, value, child) {
return Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Padding(
padding: const EdgeInsets.symmetric(
horizontal: 20,
vertical: 10,
),
child: Text(
t.installerView.installTypeDescription,
style: TextStyle(
fontSize: 16,
fontWeight: FontWeight.w500,
color: Theme.of(context).colorScheme.secondary,
),
),
),
RadioListTile(
title: Text(t.installerView.installNonRootType),
contentPadding:
const EdgeInsets.symmetric(horizontal: 16),
value: 0,
groupValue: value,
onChanged: (selected) {
installType.value = selected!;
},
),
RadioListTile(
title: Text(t.installerView.installRootType),
contentPadding:
const EdgeInsets.symmetric(horizontal: 16),
value: 1,
groupValue: value,
onChanged: (selected) {
installType.value = selected!;
},
),
],
);
},
),
),
actions: [
OutlinedButton(
child: Text(t.cancelButton),
onPressed: () {
Navigator.of(context).pop();
},
),
FilledButton(
child: Text(t.installerView.installButton),
onPressed: () {
Navigator.of(context).pop();
},
),
],
),
);
}
return false;
}
}

View File

@ -217,7 +217,7 @@ class PatcherAPI {
BuildContext context,
PatchedApplication patchedApp,
) async {
if (outFile != null) {
if (patchedApp.patchedFilePath != '') {
_managerAPI.ctx = context;
try {
if (patchedApp.isRooted) {
@ -232,7 +232,7 @@ class PatcherAPI {
return await _rootAPI.install(
patchedApp.packageName,
patchedApp.apkFilePath,
outFile!.path,
patchedApp.patchedFilePath,
)
? 0
: 1;
@ -246,7 +246,7 @@ class PatcherAPI {
if (context.mounted) {
return await installApk(
context,
outFile!.path,
patchedApp.patchedFilePath,
);
}
}
@ -368,13 +368,13 @@ class PatcherAPI {
return cleanInstall ? 10 : 1;
}
void exportPatchedFile(String appName, String version) {
void exportPatchedFile(PatchedApplication app) {
try {
if (outFile != null) {
final String newName = _getFileName(appName, version);
final String newName = _getFileName(app.name, app.version);
FlutterFileDialog.saveFile(
params: SaveFileDialogParams(
sourceFilePath: outFile!.path,
sourceFilePath: app.patchedFilePath,
fileName: newName,
mimeTypesFilter: ['application/vnd.android.package-archive'],
),
@ -387,14 +387,14 @@ class PatcherAPI {
}
}
void sharePatchedFile(String appName, String version) {
void sharePatchedFile(PatchedApplication app) {
try {
if (outFile != null) {
final String newName = _getFileName(appName, version);
final int lastSeparator = outFile!.path.lastIndexOf('/');
final String newName = _getFileName(app.name, app.version);
final int lastSeparator = app.patchedFilePath.lastIndexOf('/');
final String newPath =
outFile!.path.substring(0, lastSeparator + 1) + newName;
final File shareFile = outFile!.copySync(newPath);
app.patchedFilePath.substring(0, lastSeparator + 1) + newName;
final File shareFile = File(app.patchedFilePath).copySync(newPath);
Share.shareXFiles([XFile(shareFile.path)]);
}
} on Exception catch (e) {

View File

@ -5,6 +5,7 @@ import 'package:revanced_manager/gen/strings.g.dart';
import 'package:revanced_manager/ui/views/home/home_viewmodel.dart';
import 'package:revanced_manager/ui/widgets/homeView/installed_apps_card.dart';
import 'package:revanced_manager/ui/widgets/homeView/latest_commit_card.dart';
import 'package:revanced_manager/ui/widgets/homeView/patch_history_card.dart';
import 'package:revanced_manager/ui/widgets/shared/custom_sliver_app_bar.dart';
import 'package:stacked/stacked.dart';
@ -44,6 +45,22 @@ class HomeView extends StatelessWidget {
const SizedBox(height: 10),
LatestCommitCard(model: model, parentContext: context),
const SizedBox(height: 23),
Visibility(
visible: model.isPatchHistoryEnabled(),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
t.homeView.patchHistorySubtitle,
style: Theme.of(context).textTheme.titleLarge,
),
const SizedBox(height: 10),
PatchHistoryCard(),
const SizedBox(height: 10),
],
),
),
Text(
t.homeView.patchedSubtitle,
style: Theme.of(context).textTheme.titleLarge,

View File

@ -35,6 +35,7 @@ class HomeViewModel extends BaseViewModel {
final Toast _toast = locator<Toast>();
final flutterLocalNotificationsPlugin = FlutterLocalNotificationsPlugin();
bool showUpdatableApps = false;
PatchedApplication? lastPatchedApp;
bool releaseBuild = false;
List<PatchedApplication> patchedInstalledApps = [];
String _currentManagerVersion = '';
@ -102,10 +103,10 @@ class HomeViewModel extends BaseViewModel {
}
}
void navigateToAppInfo(PatchedApplication app) {
void navigateToAppInfo(PatchedApplication app, bool isHistory) {
_navigationService.navigateTo(
Routes.appInfoView,
arguments: AppInfoViewArguments(app: app),
arguments: AppInfoViewArguments(app: app, isHistory: isHistory),
);
}
@ -123,10 +124,15 @@ class HomeViewModel extends BaseViewModel {
}
void getPatchedApps() {
lastPatchedApp = _managerAPI.getLastPatchedApp();
patchedInstalledApps = _managerAPI.getPatchedApps().toList();
notifyListeners();
}
bool isPatchHistoryEnabled() {
return _managerAPI.isPatchHistoryEnabled();
}
Future<bool> hasManagerUpdates() async {
if (!_managerAPI.releaseBuild) {
return false;

View File

@ -123,7 +123,7 @@ class InstallerViewModel extends BaseViewModel {
});
await WakelockPlus.enable();
await handlePlatformChannelMethods();
await runPatcher();
await runPatcher(context);
}
Future<dynamic> handlePlatformChannelMethods() async {
@ -182,13 +182,20 @@ class InstallerViewModel extends BaseViewModel {
notifyListeners();
}
Future<void> runPatcher() async {
Future<void> runPatcher(BuildContext context) async {
try {
await _patcherAPI.runPatcher(
_app.packageName,
_app.apkFilePath,
_patches,
);
_app.appliedPatches = _patches.map((p) => p.name).toList();
if (_managerAPI.isPatchHistoryEnabled()) {
await _managerAPI.setLastPatchedApp(_app, _patcherAPI.outFile!);
} else {
_app.patchedFilePath = _patcherAPI.outFile!.path;
}
locator<HomeViewModel>().initialize(context);
} on Exception catch (e) {
update(
-100.0,
@ -488,7 +495,7 @@ class InstallerViewModel extends BaseViewModel {
Future<void> installResult(BuildContext context, bool installAsRoot) async {
isInstalling = true;
try {
_app.isRooted = installAsRoot;
_app.isRooted = await _managerAPI.installTypeDialog(context);
if (headerLogs != 'Installing...') {
update(
.85,
@ -501,17 +508,15 @@ class InstallerViewModel extends BaseViewModel {
isInstalled = true;
_app.isFromStorage = false;
_app.patchDate = DateTime.now();
_app.appliedPatches = _patches.map((p) => p.name).toList();
// In case a patch changed the app name or package name,
// update the app info.
final app =
await DeviceApps.getAppFromStorage(_patcherAPI.outFile!.path);
await DeviceApps.getAppFromStorage(_patcherAPI.outFile!.path);
if (app != null) {
_app.name = app.appName;
_app.packageName = app.packageName;
}
await _managerAPI.savePatchedApp(_app);
_managerAPI
@ -544,7 +549,7 @@ class InstallerViewModel extends BaseViewModel {
void exportResult() {
try {
_patcherAPI.exportPatchedFile(_app.name, _app.version);
_patcherAPI.exportPatchedFile(_app);
} on Exception catch (e) {
if (kDebugMode) {
print(e);

View File

@ -141,6 +141,18 @@ class SettingsViewModel extends BaseViewModel {
notifyListeners();
}
bool isPatchHistoryEnabled() {
return _managerAPI.isPatchHistoryEnabled();
}
void usePatchHistory(bool value) {
_managerAPI.enablePatchHistoryStatus(value);
if (!value) {
_managerAPI.deleteLastPatchedApp();
}
notifyListeners();
}
bool isVersionCompatibilityCheckEnabled() {
return _managerAPI.isVersionCompatibilityCheckEnabled();
}

View File

@ -11,8 +11,10 @@ class AppInfoView extends StatelessWidget {
const AppInfoView({
super.key,
required this.app,
required this.isHistory,
});
final PatchedApplication app;
final bool isHistory;
@override
Widget build(BuildContext context) {
@ -57,6 +59,14 @@ class AppInfoView extends StatelessWidget {
style: Theme.of(context).textTheme.titleLarge,
),
const SizedBox(height: 20),
if (isHistory) ...[
ListTile(
contentPadding:
const EdgeInsets.symmetric(horizontal: 20.0),
subtitle: Text(t.appInfoView.patchHistoryDescription),
),
const SizedBox(height: 4),
],
Padding(
padding: const EdgeInsets.symmetric(horizontal: 20.0),
child: CustomCard(
@ -71,20 +81,26 @@ class AppInfoView extends StatelessWidget {
type: MaterialType.transparency,
child: InkWell(
borderRadius: BorderRadius.circular(16.0),
onTap: () => model.openApp(app),
onTap: () => isHistory
? model.installApp(context, app)
: model.openApp(app),
child: Column(
mainAxisAlignment:
MainAxisAlignment.center,
children: <Widget>[
Icon(
Icons.open_in_new_outlined,
isHistory
? Icons.download_outlined
: Icons.open_in_new_outlined,
color: Theme.of(context)
.colorScheme
.primary,
),
const SizedBox(height: 10),
Text(
t.appInfoView.openButton,
isHistory
? t.appInfoView.installButton
: t.appInfoView.openButton,
style: TextStyle(
color: Theme.of(context)
.colorScheme
@ -108,24 +124,30 @@ class AppInfoView extends StatelessWidget {
type: MaterialType.transparency,
child: InkWell(
borderRadius: BorderRadius.circular(16.0),
onTap: () => model.showUninstallDialog(
context,
app,
false,
),
onTap: () => isHistory
? model.exportApp(app)
: model.showUninstallDialog(
context,
app,
false,
),
child: Column(
mainAxisAlignment:
MainAxisAlignment.center,
children: <Widget>[
Icon(
Icons.delete_outline,
isHistory
? Icons.save
: Icons.delete_outline,
color: Theme.of(context)
.colorScheme
.primary,
),
const SizedBox(height: 10),
Text(
t.appInfoView.uninstallButton,
isHistory
? t.appInfoView.exportButton
: t.appInfoView.uninstallButton,
style: TextStyle(
color: Theme.of(context)
.colorScheme
@ -144,14 +166,57 @@ class AppInfoView extends StatelessWidget {
endIndent: 12.0,
width: 1.0,
),
if (app.isRooted)
if (isHistory)
VerticalDivider(
color: Theme.of(context).canvasColor,
indent: 12.0,
endIndent: 12.0,
width: 1.0,
),
if (app.isRooted)
if (isHistory)
Expanded(
child: Material(
type: MaterialType.transparency,
child: InkWell(
borderRadius: BorderRadius.circular(16.0),
onTap: () => model.showDeleteDialog(
context,
app,
),
child: Column(
mainAxisAlignment:
MainAxisAlignment.center,
children: <Widget>[
Icon(
Icons
.delete_forever_outlined,
color: Theme.of(context)
.colorScheme
.primary,
),
const SizedBox(height: 10),
Text(
t.appInfoView.deleteButton,
style: TextStyle(
color: Theme.of(context)
.colorScheme
.primary,
fontWeight: FontWeight.bold,
),
),
],
),
),
),
),
if (!isHistory && app.isRooted)
VerticalDivider(
color: Theme.of(context).canvasColor,
indent: 12.0,
endIndent: 12.0,
width: 1.0,
),
if (!isHistory && app.isRooted)
Expanded(
child: Material(
type: MaterialType.transparency,

View File

@ -1,4 +1,5 @@
// ignore_for_file: use_build_context_synchronously
import 'dart:math';
import 'package:device_apps/device_apps.dart';
import 'package:flutter/material.dart';
import 'package:intl/intl.dart';
@ -20,6 +21,23 @@ class AppInfoViewModel extends BaseViewModel {
final RootAPI _rootAPI = RootAPI();
final Toast _toast = locator<Toast>();
Future<void> installApp(
BuildContext context,
PatchedApplication app,
) async {
app.isRooted = await _managerAPI.installTypeDialog(context);
final int statusCode = await _patcherAPI.installPatchedFile(context, app);
if (statusCode == 0) {
locator<HomeViewModel>().initialize(context);
}
}
Future<void> exportApp(
PatchedApplication app,
) async {
_patcherAPI.exportPatchedFile(app);
}
Future<void> uninstallApp(
BuildContext context,
PatchedApplication app,
@ -123,6 +141,34 @@ class AppInfoViewModel extends BaseViewModel {
}
}
Future<void> showDeleteDialog(
BuildContext context,
PatchedApplication app,
) async {
return showDialog(
context: context,
builder: (context) => AlertDialog(
title: Text(t.appInfoView.removeAppDialogTitle),
backgroundColor: Theme.of(context).colorScheme.secondaryContainer,
content: Text(t.appInfoView.removeAppDialogText),
actions: <Widget>[
OutlinedButton(
child: Text(t.cancelButton),
onPressed: () => Navigator.of(context).pop(),
),
FilledButton(
child: Text(t.okButton),
onPressed: () => {
_managerAPI.deleteLastPatchedApp(),
Navigator.of(context)..pop()..pop(),
locator<HomeViewModel>().initialize(context),
},
),
],
),
);
}
String getPrettyDate(BuildContext context, DateTime dateTime) {
return DateFormat.yMMMMd(Localizations.localeOf(context).languageCode)
.format(dateTime);
@ -133,6 +179,12 @@ class AppInfoViewModel extends BaseViewModel {
.format(dateTime);
}
String getFileSizeString(int bytes) {
const suffixes = ['B', 'KB', 'MB', 'GB', 'TB'];
final i = (log(bytes) / log(1024)).floor();
return '${(bytes / pow(1024, i)).toStringAsFixed(2)} ${suffixes[i]}';
}
Future<void> showAppliedPatchesDialog(
BuildContext context,
PatchedApplication app,

View File

@ -76,7 +76,7 @@ class InstalledAppsCard extends StatelessWidget {
name: app.name,
patchDate: app.patchDate,
onPressed: () =>
locator<HomeViewModel>().navigateToAppInfo(app),
locator<HomeViewModel>().navigateToAppInfo(app, false),
),
)
.toList(),

View File

@ -0,0 +1,51 @@
import 'package:device_apps/device_apps.dart';
import 'package:flutter/material.dart';
import 'package:revanced_manager/app/app.locator.dart';
import 'package:revanced_manager/gen/strings.g.dart';
import 'package:revanced_manager/models/patched_application.dart';
import 'package:revanced_manager/services/manager_api.dart';
import 'package:revanced_manager/ui/views/home/home_viewmodel.dart';
import 'package:revanced_manager/ui/widgets/shared/application_item.dart';
import 'package:revanced_manager/ui/widgets/shared/custom_card.dart';
//ignore: must_be_immutable
class PatchHistoryCard extends StatelessWidget {
PatchHistoryCard({super.key});
PatchedApplication? app = locator<HomeViewModel>().lastPatchedApp;
@override
Widget build(BuildContext context) {
return app == null
? CustomCard(
child: Center(
child: Column(
children: <Widget>[
Icon(
size: 40,
Icons.update_disabled,
color: Theme.of(context).colorScheme.secondary,
),
const SizedBox(height: 16),
Text(
t.homeView.noHistory,
style: Theme.of(context)
.textTheme
.titleMedium!
.copyWith(
color:
Theme.of(context).colorScheme.secondary,
),
),
],
),
),
)
: ApplicationItem(
icon: app!.icon,
name: app!.name,
patchDate: app!.patchDate,
onPressed: () =>
locator<HomeViewModel>().navigateToAppInfo(app!, true),
);
}
}

View File

@ -4,6 +4,7 @@ import 'package:flutter/material.dart';
import 'package:revanced_manager/gen/strings.g.dart';
import 'package:revanced_manager/ui/widgets/settingsView/settings_auto_update_patches.dart';
import 'package:revanced_manager/ui/widgets/settingsView/settings_enable_patches_selection.dart';
import 'package:revanced_manager/ui/widgets/settingsView/settings_patch_history.dart';
import 'package:revanced_manager/ui/widgets/settingsView/settings_require_suggested_app_version.dart';
import 'package:revanced_manager/ui/widgets/settingsView/settings_section.dart';
import 'package:revanced_manager/ui/widgets/settingsView/settings_show_update_dialog.dart';
@ -24,6 +25,7 @@ class SAdvancedSection extends StatelessWidget {
SRequireSuggestedAppVersion(),
SVersionCompatibilityCheck(),
SUniversalPatches(),
SPatchHistory(),
],
);
}

View File

@ -0,0 +1,37 @@
import 'package:flutter/material.dart';
import 'package:revanced_manager/gen/strings.g.dart';
import 'package:revanced_manager/ui/views/settings/settings_viewmodel.dart';
class SPatchHistory extends StatefulWidget {
const SPatchHistory({super.key});
@override
State<SPatchHistory> createState() =>
_SPatchHistoryState();
}
final _settingsViewModel = SettingsViewModel();
class _SPatchHistoryState
extends State<SPatchHistory> {
@override
Widget build(BuildContext context) {
return SwitchListTile(
contentPadding: const EdgeInsets.symmetric(horizontal: 20.0),
title: Text(
t.settingsView.patchHistoryLabel,
style: const TextStyle(
fontSize: 20,
fontWeight: FontWeight.w500,
),
),
subtitle: Text(t.settingsView.patchHistoryHint),
value: _settingsViewModel.isPatchHistoryEnabled(),
onChanged: (value) {
setState(() {
_settingsViewModel.usePatchHistory(value);
});
},
);
}
}

View File

@ -33,6 +33,7 @@ class _ApplicationItemState extends State<ApplicationItem> {
return Container(
margin: const EdgeInsets.only(bottom: 16.0),
child: CustomCard(
onTap: widget.onPressed,
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [