Remove broken android_package_installer

This commit is contained in:
franzap
2024-10-23 00:52:40 -03:00
parent 8b04173284
commit 9668171a3d
4 changed files with 19 additions and 24 deletions
+8 -13
View File
@@ -3,13 +3,13 @@ import 'dart:io';
import 'dart:isolate';
import 'dart:typed_data';
import 'package:android_package_installer/android_package_installer.dart';
import 'package:android_package_manager/android_package_manager.dart';
import 'package:async/async.dart';
import 'package:collection/collection.dart';
import 'package:convert/convert.dart';
import 'package:crypto/crypto.dart';
import 'package:flutter_data/flutter_data.dart';
import 'package:install_plugin/install_plugin.dart';
import 'package:path_provider/path_provider.dart';
import 'package:permission_handler/permission_handler.dart';
import 'package:purplebase/purplebase.dart';
@@ -101,25 +101,20 @@ class App extends BaseApp with DataModelMixin<App> {
notifier.state = ErrorInstallProgress(Exception(e));
return;
}
notifier.state = HashVerifiedInstallProgress();
notifier.state = RequestInstallProgress();
final result =
await AndroidPackageInstaller.installApk(apkFilePath: file.path);
final installationStatus =
result != null ? PackageInstallerStatus.byCode(result) : null;
if (installationStatus == PackageInstallerStatus.success) {
final result = await InstallPlugin.install(file.path);
if (result['isSuccess']) {
notifier.state = IdleInstallProgress();
await file.delete();
await adapter.ref.localApps.localAppAdapter
.refreshUpdateStatus(appId: identifier);
notifier.state = IdleInstallProgress();
} else if (installationStatus == PackageInstallerStatus.failureAborted) {
// do nothing
notifier.state = IdleInstallProgress();
} else {
const msg = 'Android installation failed';
notifier.state = ErrorInstallProgress(
Exception(msg),
info: installationStatus?.name ?? 'Unknown error',
info: result['errorMessage'],
);
}
}
@@ -423,7 +418,7 @@ class DownloadingInstallProgress extends AppInstallProgress {
class VerifyingHashProgress extends AppInstallProgress {}
class HashVerifiedInstallProgress extends AppInstallProgress {}
class RequestInstallProgress extends AppInstallProgress {}
class ErrorInstallProgress extends AppInstallProgress {
final Exception e;
+2 -2
View File
@@ -107,8 +107,8 @@ class InstallButton extends ConsumerWidget {
style: TextStyle(fontWeight: FontWeight.bold),
),
VerifyingHashProgress() => Text('Verifying file integrity'),
HashVerifiedInstallProgress() => Text(
'Hash verified, requesting ${app.canUpdate ? 'update' : 'installation'}'),
RequestInstallProgress() =>
Text('Requesting ${app.canUpdate ? 'update' : 'installation'}'),
ErrorInstallProgress() => Text('Error, tap to see message'),
}
},
+8 -8
View File
@@ -17,14 +17,6 @@ packages:
url: "https://pub.dev"
source: hosted
version: "6.4.1"
android_package_installer:
dependency: "direct main"
description:
name: android_package_installer
sha256: af2a0d2dfcfb2a82255c4fd37024304941359c2bed7e4813e053a662caaa2952
url: "https://pub.dev"
source: hosted
version: "0.0.2"
android_package_manager:
dependency: "direct main"
description:
@@ -601,6 +593,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "0.5.3+2"
install_plugin:
dependency: "direct main"
description:
name: install_plugin
sha256: "6fb67ba0781e75de4f2f2266ed25e835bfd277c5bfc2ed034af52774355857c6"
url: "https://pub.dev"
source: hosted
version: "2.1.0"
intl:
dependency: "direct main"
description:
+1 -1
View File
@@ -47,7 +47,7 @@ dependencies:
app_links: ^6.3.2
dart_emoji: ^0.2.0+2
remove_markdown: ^0.0.2
android_package_installer: ^0.0.2
install_plugin: ^2.1.0
dependency_overrides:
purplebase: