feat: update rules of analysis_options.yaml. and solved all problems (#665)

* update rules of analysis_options.yaml. and solved all problems

* refactor: fix remaining problems

---------

Co-authored-by: Ushie <ushiekane@gmail.com>
This commit is contained in:
Jay Gajjar
2023-01-30 18:05:06 +05:30
committed by GitHub
parent f5bc1a996f
commit a54ca799b9
62 changed files with 804 additions and 643 deletions

View File

@@ -8,7 +8,7 @@ class RootAPI {
Future<bool> isRooted() async {
try {
bool? isRooted = await Root.isRootAvailable();
final bool? isRooted = await Root.isRootAvailable();
return isRooted != null && isRooted;
} on Exception catch (e, s) {
await Sentry.captureException(e, stackTrace: s);
@@ -70,11 +70,11 @@ class RootAPI {
Future<List<String>> getInstalledApps() async {
try {
String? res = await Root.exec(
final String? res = await Root.exec(
cmd: 'ls "$_managerDirPath"',
);
if (res != null) {
List<String> apps = res.split('\n');
final List<String> apps = res.split('\n');
apps.removeWhere((pack) => pack.isEmpty);
return apps.map((pack) => pack.trim()).toList();
}
@@ -132,12 +132,12 @@ class RootAPI {
}
Future<void> installServiceDScript(String packageName) async {
String content = '#!/system/bin/sh\n'
final String content = '#!/system/bin/sh\n'
'while [ "\$(getprop sys.boot_completed | tr -d \'"\'"\'\\\\r\'"\'"\')" != "1" ]; do sleep 3; done\n'
'base_path=$_managerDirPath/$packageName/base.apk\n'
'stock_path=\$(pm path $packageName | grep base | sed \'"\'"\'s/package://g\'"\'"\')\n'
'[ ! -z \$stock_path ] && mount -o bind \$base_path \$stock_path';
String scriptFilePath = '$_serviceDDirPath/$packageName.sh';
r'[ ! -z $stock_path ] && mount -o bind $base_path $stock_path';
final String scriptFilePath = '$_serviceDDirPath/$packageName.sh';
await Root.exec(
cmd: 'echo \'$content\' > "$scriptFilePath"',
);
@@ -145,10 +145,10 @@ class RootAPI {
}
Future<void> installPostFsDataScript(String packageName) async {
String content = '#!/system/bin/sh\n'
final String content = '#!/system/bin/sh\n'
'stock_path=\$(pm path $packageName | grep base | sed \'"\'"\'s/package://g\'"\'"\')\n'
'[ ! -z \$stock_path ] && umount -l \$stock_path';
String scriptFilePath = '$_postFsDataDirPath/$packageName.sh';
r'[ ! -z $stock_path ] && umount -l $stock_path';
final String scriptFilePath = '$_postFsDataDirPath/$packageName.sh';
await Root.exec(
cmd: 'echo \'$content\' > "$scriptFilePath"',
);
@@ -156,7 +156,7 @@ class RootAPI {
}
Future<void> installApk(String packageName, String patchedFilePath) async {
String newPatchedFilePath = '$_managerDirPath/$packageName/base.apk';
final String newPatchedFilePath = '$_managerDirPath/$packageName/base.apk';
await Root.exec(
cmd: 'cp "$patchedFilePath" "$newPatchedFilePath"',
);
@@ -169,7 +169,7 @@ class RootAPI {
}
Future<void> mountApk(String packageName, String originalFilePath) async {
String newPatchedFilePath = '$_managerDirPath/$packageName/base.apk';
final String newPatchedFilePath = '$_managerDirPath/$packageName/base.apk';
await Root.exec(
cmd: 'am force-stop "$packageName"',
);
@@ -182,7 +182,7 @@ class RootAPI {
}
Future<bool> isMounted(String packageName) async {
String? res = await Root.exec(
final String? res = await Root.exec(
cmd: 'cat /proc/mounts | grep $packageName',
);
return res != null && res.isNotEmpty;
@@ -192,7 +192,7 @@ class RootAPI {
String packageName,
String originalFilePath,
) async {
bool isInstalled = await isAppInstalled(packageName);
final bool isInstalled = await isAppInstalled(packageName);
if (isInstalled && await isMounted(packageName)) {
originalFilePath = '$_managerDirPath/$packageName/original.apk';
await setPermissions(
@@ -209,7 +209,8 @@ class RootAPI {
String packageName,
String originalFilePath,
) async {
String originalRootPath = '$_managerDirPath/$packageName/original.apk';
final String originalRootPath =
'$_managerDirPath/$packageName/original.apk';
await Root.exec(
cmd: 'mkdir -p "$_managerDirPath/$packageName"',
);