fix: Update package name if MicroG was applied

This commit is contained in:
Alberto Ponces 2022-09-14 23:40:08 +01:00
parent 9f3a30d9f2
commit cdb492910c
3 changed files with 8 additions and 3 deletions

View file

@ -7,7 +7,7 @@ part 'patched_application.g.dart';
@JsonSerializable() @JsonSerializable()
class PatchedApplication { class PatchedApplication {
String name; String name;
final String packageName; String packageName;
String version; String version;
final String apkFilePath; final String apkFilePath;
@JsonKey( @JsonKey(

View file

@ -142,6 +142,13 @@ class InstallerViewModel extends BaseViewModel {
update(1.0, 'Installed!', 'Installed!'); update(1.0, 'Installed!', 'Installed!');
_app.patchDate = DateTime.now(); _app.patchDate = DateTime.now();
_app.appliedPatches = _patches.map((p) => p.name).toList(); _app.appliedPatches = _patches.map((p) => p.name).toList();
bool hasMicroG = _patches.any((p) => p.name.endsWith('microg-support'));
if (hasMicroG) {
_app.packageName = _app.packageName.replaceFirst(
'com.google.',
'app.revanced.',
);
}
await _managerAPI.savePatchedApp(_app); await _managerAPI.savePatchedApp(_app);
} }
} }

View file

@ -1,6 +1,4 @@
// ignore_for_file: use_build_context_synchronously // ignore_for_file: use_build_context_synchronously
import 'package:app_installer/app_installer.dart';
import 'package:device_apps/device_apps.dart';
import 'package:dynamic_themes/dynamic_themes.dart'; import 'package:dynamic_themes/dynamic_themes.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:injectable/injectable.dart'; import 'package:injectable/injectable.dart';