mirror of
https://github.com/revanced/revanced-manager
synced 2024-05-14 13:56:57 +02:00
fix: update name, version and icon when saving on prefs
This commit is contained in:
parent
0ccf1fb3b8
commit
6487284dd2
@ -6,15 +6,15 @@ part 'patched_application.g.dart';
|
|||||||
|
|
||||||
@JsonSerializable()
|
@JsonSerializable()
|
||||||
class PatchedApplication {
|
class PatchedApplication {
|
||||||
final String name;
|
String name;
|
||||||
final String packageName;
|
final String packageName;
|
||||||
final String version;
|
String version;
|
||||||
final String apkFilePath;
|
final String apkFilePath;
|
||||||
@JsonKey(
|
@JsonKey(
|
||||||
fromJson: decodeBase64,
|
fromJson: decodeBase64,
|
||||||
toJson: encodeBase64,
|
toJson: encodeBase64,
|
||||||
)
|
)
|
||||||
final Uint8List icon;
|
Uint8List icon;
|
||||||
DateTime patchDate;
|
DateTime patchDate;
|
||||||
final bool isRooted;
|
final bool isRooted;
|
||||||
final bool isFromStorage;
|
final bool isFromStorage;
|
||||||
|
@ -68,6 +68,13 @@ class ManagerAPI {
|
|||||||
Future<void> savePatchedApp(PatchedApplication app) async {
|
Future<void> savePatchedApp(PatchedApplication app) async {
|
||||||
List<PatchedApplication> patchedApps = getPatchedApps();
|
List<PatchedApplication> patchedApps = getPatchedApps();
|
||||||
patchedApps.removeWhere((a) => a.packageName == app.packageName);
|
patchedApps.removeWhere((a) => a.packageName == app.packageName);
|
||||||
|
ApplicationWithIcon? installed =
|
||||||
|
await DeviceApps.getApp(app.packageName, true) as ApplicationWithIcon?;
|
||||||
|
if (installed != null) {
|
||||||
|
app.name = installed.appName;
|
||||||
|
app.version = installed.versionName!;
|
||||||
|
app.icon = installed.icon;
|
||||||
|
}
|
||||||
patchedApps.add(app);
|
patchedApps.add(app);
|
||||||
await setPatchedApps(patchedApps);
|
await setPatchedApps(patchedApps);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user