Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: showing Installed when it's actually not #1021

Merged
merged 1 commit into from
Jul 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 3 additions & 5 deletions lib/services/patcher_api.dart
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import 'dart:io';

import 'package:app_installer/app_installer.dart';
import 'package:collection/collection.dart';
import 'package:cr_file_saver/file_saver.dart';
import 'package:device_apps/device_apps.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/services.dart';
import 'package:injectable/injectable.dart';
import 'package:install_plugin/install_plugin.dart';
import 'package:path_provider/path_provider.dart';
import 'package:revanced_manager/app/app.locator.dart';
import 'package:revanced_manager/models/patch.dart';
Expand Down Expand Up @@ -232,10 +232,8 @@ class PatcherAPI {
);
}
} else {
await AppInstaller.installApk(_outFile!.path);
return await DeviceApps.isAppInstalled(
patchedApp.packageName,
);
final install = await InstallPlugin.installApk(_outFile!.path);
return install['isSuccess'];
}
} on Exception catch (e) {
if (kDebugMode) {
Expand Down
10 changes: 5 additions & 5 deletions lib/ui/views/home/home_viewmodel.dart
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
// ignore_for_file: use_build_context_synchronously
import 'dart:async';
import 'dart:io';
import 'package:app_installer/app_installer.dart';
import 'package:cross_connectivity/cross_connectivity.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter_i18n/flutter_i18n.dart';
import 'package:flutter_local_notifications/flutter_local_notifications.dart';
import 'package:injectable/injectable.dart';
import 'package:install_plugin/install_plugin.dart';
import 'package:path_provider/path_provider.dart';
import 'package:revanced_manager/app/app.locator.dart';
import 'package:revanced_manager/app/app.router.dart';
Expand Down Expand Up @@ -51,7 +51,7 @@ class HomeViewModel extends BaseViewModel {
_toast.showBottom('homeView.installingMessage');
final File? managerApk = await _managerAPI.downloadManager();
if (managerApk != null) {
await AppInstaller.installApk(managerApk.path);
await InstallPlugin.installApk(managerApk.path);
} else {
_toast.showBottom('homeView.errorDownloadMessage');
}
Expand All @@ -72,7 +72,7 @@ class HomeViewModel extends BaseViewModel {
_toast.showBottom('homeView.installingMessage');
final File? managerApk = await _managerAPI.downloadManager();
if (managerApk != null) {
await AppInstaller.installApk(managerApk.path);
await InstallPlugin.installApk(managerApk.path);
} else {
_toast.showBottom('homeView.errorDownloadMessage');
}
Expand Down Expand Up @@ -272,7 +272,7 @@ class HomeViewModel extends BaseViewModel {
child: CustomMaterialButton(
label: I18nText('updateButton'),
onPressed: () async {
await AppInstaller.installApk(
await InstallPlugin.installApk(
downloadedApk!.path,
);
},
Expand Down Expand Up @@ -318,7 +318,7 @@ class HomeViewModel extends BaseViewModel {
// UILocalNotificationDateInterpretation.absoluteTime,
// );
_toast.showBottom('homeView.installingMessage');
await AppInstaller.installApk(managerApk.path);
await InstallPlugin.installApk(managerApk.path);
} else {
_toast.showBottom('homeView.errorDownloadMessage');
}
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ environment:

dependencies:
animations: ^2.0.7
app_installer: ^1.1.0
collection: ^1.17.0
cross_connectivity: ^3.0.5
cr_file_saver:
Expand Down Expand Up @@ -75,6 +74,7 @@ dependencies:
flutter_dotenv: ^5.0.2
flutter_markdown: ^0.6.14
dio_cache_interceptor: ^3.4.0
install_plugin: ^2.1.0

dev_dependencies:
json_serializable: ^6.6.1
Expand Down