mirror of
https://github.com/ImranR98/Obtainium.git
synced 2025-10-23 19:03:46 +02:00
Back to old install plugin (dealbreaker in new one)
This commit is contained in:
@@ -8,6 +8,7 @@ import 'dart:io';
|
|||||||
import 'package:device_info_plus/device_info_plus.dart';
|
import 'package:device_info_plus/device_info_plus.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter/services.dart';
|
import 'package:flutter/services.dart';
|
||||||
|
import 'package:install_plugin_v2/install_plugin_v2.dart';
|
||||||
import 'package:obtainium/app_sources/github.dart';
|
import 'package:obtainium/app_sources/github.dart';
|
||||||
import 'package:obtainium/providers/notifications_provider.dart';
|
import 'package:obtainium/providers/notifications_provider.dart';
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
@@ -15,7 +16,6 @@ import 'package:path_provider/path_provider.dart';
|
|||||||
import 'package:flutter_fgbg/flutter_fgbg.dart';
|
import 'package:flutter_fgbg/flutter_fgbg.dart';
|
||||||
import 'package:obtainium/providers/source_provider.dart';
|
import 'package:obtainium/providers/source_provider.dart';
|
||||||
import 'package:http/http.dart';
|
import 'package:http/http.dart';
|
||||||
import 'package:flutter_install_app/flutter_install_app.dart';
|
|
||||||
|
|
||||||
class AppInMemory {
|
class AppInMemory {
|
||||||
late App app;
|
late App app;
|
||||||
@@ -128,7 +128,7 @@ class AppsProvider with ChangeNotifier {
|
|||||||
// If appropriate criteria are met, the update (never a fresh install) happens silently in the background
|
// If appropriate criteria are met, the update (never a fresh install) happens silently in the background
|
||||||
// But even then, we don't know if it actually succeeded
|
// But even then, we don't know if it actually succeeded
|
||||||
Future<void> installApk(ApkFile file) async {
|
Future<void> installApk(ApkFile file) async {
|
||||||
await AppInstaller.installApk(file.file.path, actionRequired: false);
|
await InstallPlugin.installApk(file.file.path, 'dev.imranr.obtainium');
|
||||||
apps[file.appId]!.app.installedVersion =
|
apps[file.appId]!.app.installedVersion =
|
||||||
apps[file.appId]!.app.latestVersion;
|
apps[file.appId]!.app.latestVersion;
|
||||||
await saveApps([apps[file.appId]!.app]);
|
await saveApps([apps[file.appId]!.app]);
|
||||||
@@ -215,17 +215,21 @@ class AppsProvider with ChangeNotifier {
|
|||||||
return items;
|
return items;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO: Remove below line if silentupdates are ever figured out
|
||||||
|
regularInstalls.addAll(silentUpdates);
|
||||||
|
|
||||||
silentUpdates = moveObtainiumToEnd(silentUpdates);
|
silentUpdates = moveObtainiumToEnd(silentUpdates);
|
||||||
regularInstalls = moveObtainiumToEnd(regularInstalls);
|
regularInstalls = moveObtainiumToEnd(regularInstalls);
|
||||||
|
|
||||||
for (var u in silentUpdates) {
|
// TODO: Uncomment below if silentupdates are ever figured out
|
||||||
await installApk(u);
|
// for (var u in silentUpdates) {
|
||||||
}
|
// await installApk(u, silent: true); // Would need to add silent option
|
||||||
|
// }
|
||||||
|
|
||||||
if (context != null) {
|
if (context != null) {
|
||||||
if (regularInstalls.isNotEmpty) {
|
if (regularInstalls.isNotEmpty) {
|
||||||
// ignore: use_build_context_synchronously
|
// ignore: use_build_context_synchronously
|
||||||
await askUserToReturnToForeground(context);
|
await askUserToReturnToForeground(context, waitForFG: true);
|
||||||
}
|
}
|
||||||
for (var i in regularInstalls) {
|
for (var i in regularInstalls) {
|
||||||
await installApk(i);
|
await installApk(i);
|
||||||
|
@@ -282,6 +282,13 @@ packages:
|
|||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "3.2.0"
|
version: "3.2.0"
|
||||||
|
install_plugin_v2:
|
||||||
|
dependency: "direct main"
|
||||||
|
description:
|
||||||
|
name: install_plugin_v2
|
||||||
|
url: "https://pub.dartlang.org"
|
||||||
|
source: hosted
|
||||||
|
version: "1.0.0"
|
||||||
js:
|
js:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
@@ -52,6 +52,7 @@ dependencies:
|
|||||||
device_info_plus: ^4.1.2
|
device_info_plus: ^4.1.2
|
||||||
file_picker: ^5.1.0
|
file_picker: ^5.1.0
|
||||||
animations: ^2.0.4
|
animations: ^2.0.4
|
||||||
|
install_plugin_v2: ^1.0.0
|
||||||
flutter_install_app: ^1.3.0
|
flutter_install_app: ^1.3.0
|
||||||
share_plus: ^4.4.0
|
share_plus: ^4.4.0
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user