mirror of
https://github.com/ImranR98/Obtainium.git
synced 2025-07-14 21:56:44 +02:00
Compare commits
6 Commits
v0.6.2-bet
...
v0.6.4-bet
Author | SHA1 | Date | |
---|---|---|---|
e746ca890a | |||
9c00a7da14 | |||
4df0dd64ad | |||
7cf7ffe0de | |||
b1953435af | |||
fc7d7d11d6 |
@ -69,9 +69,10 @@ class GitHub implements AppSource {
|
|||||||
if (!includePrereleases && releases[i]['prerelease'] == true) {
|
if (!includePrereleases && releases[i]['prerelease'] == true) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (regexFilter != null &&
|
if (regexFilter != null &&
|
||||||
!RegExp(regexFilter)
|
!RegExp(regexFilter)
|
||||||
.hasMatch((releases[i]['name'] as String).trim())) {
|
.hasMatch((releases[i]['tag_name'] as String).trim())) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
var apkUrls = getReleaseAPKUrls(releases[i]);
|
var apkUrls = getReleaseAPKUrls(releases[i]);
|
||||||
|
@ -14,7 +14,7 @@ import 'package:workmanager/workmanager.dart';
|
|||||||
import 'package:dynamic_color/dynamic_color.dart';
|
import 'package:dynamic_color/dynamic_color.dart';
|
||||||
import 'package:device_info_plus/device_info_plus.dart';
|
import 'package:device_info_plus/device_info_plus.dart';
|
||||||
|
|
||||||
const String currentVersion = '0.6.2';
|
const String currentVersion = '0.6.4';
|
||||||
const String currentReleaseTag =
|
const String currentReleaseTag =
|
||||||
'v$currentVersion-beta'; // KEEP THIS IN SYNC WITH GITHUB RELEASES
|
'v$currentVersion-beta'; // KEEP THIS IN SYNC WITH GITHUB RELEASES
|
||||||
|
|
||||||
|
@ -121,8 +121,10 @@ class _AddAppPageState extends State<AddAppPage> {
|
|||||||
app.preferredApkIndex =
|
app.preferredApkIndex =
|
||||||
app.apkUrls.indexOf(apkUrl);
|
app.apkUrls.indexOf(apkUrl);
|
||||||
var downloadedApk =
|
var downloadedApk =
|
||||||
await appsProvider
|
await appsProvider.downloadApp(
|
||||||
.downloadApp(app);
|
app,
|
||||||
|
showOccasionalProgressToast:
|
||||||
|
true);
|
||||||
app.id = downloadedApk.appId;
|
app.id = downloadedApk.appId;
|
||||||
if (appsProvider.apps
|
if (appsProvider.apps
|
||||||
.containsKey(app.id)) {
|
.containsKey(app.id)) {
|
||||||
|
@ -62,10 +62,13 @@ class _AppPageState extends State<AppPage> {
|
|||||||
children: [
|
children: [
|
||||||
Image.memory(
|
Image.memory(
|
||||||
app!.installedInfo!.icon!,
|
app!.installedInfo!.icon!,
|
||||||
scale: 1.5,
|
height: 150,
|
||||||
)
|
)
|
||||||
])
|
])
|
||||||
: Container(),
|
: Container(),
|
||||||
|
const SizedBox(
|
||||||
|
height: 25,
|
||||||
|
),
|
||||||
Text(
|
Text(
|
||||||
app?.installedInfo?.name ?? app?.app.name ?? 'App',
|
app?.installedInfo?.name ?? app?.app.name ?? 'App',
|
||||||
textAlign: TextAlign.center,
|
textAlign: TextAlign.center,
|
||||||
|
@ -212,8 +212,15 @@ class AppsPageState extends State<AppsPage> {
|
|||||||
)),
|
)),
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
: Text(sortedApps[index].app.installedVersion ??
|
: SingleChildScrollView(
|
||||||
'Not Installed')),
|
child: SizedBox(
|
||||||
|
width: 80,
|
||||||
|
child: Text(
|
||||||
|
sortedApps[index].app.installedVersion ??
|
||||||
|
'Not Installed',
|
||||||
|
overflow: TextOverflow.fade,
|
||||||
|
textAlign: TextAlign.end,
|
||||||
|
)))),
|
||||||
onTap: () {
|
onTap: () {
|
||||||
if (selectedIds.isNotEmpty) {
|
if (selectedIds.isNotEmpty) {
|
||||||
toggleAppSelected(sortedApps[index].app.id);
|
toggleAppSelected(sortedApps[index].app.id);
|
||||||
|
@ -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:fluttertoast/fluttertoast.dart';
|
||||||
import 'package:install_plugin_v2/install_plugin_v2.dart';
|
import 'package:install_plugin_v2/install_plugin_v2.dart';
|
||||||
import 'package:installed_apps/app_info.dart';
|
import 'package:installed_apps/app_info.dart';
|
||||||
import 'package:installed_apps/installed_apps.dart';
|
import 'package:installed_apps/installed_apps.dart';
|
||||||
@ -115,7 +116,9 @@ class AppsProvider with ChangeNotifier {
|
|||||||
// Downloads the App (preferred URL) and returns an ApkFile object
|
// Downloads the App (preferred URL) and returns an ApkFile object
|
||||||
// If the app was already saved, updates it's download progress % in memory
|
// If the app was already saved, updates it's download progress % in memory
|
||||||
// But also works for Apps that are not saved
|
// But also works for Apps that are not saved
|
||||||
Future<DownloadedApp> downloadApp(App app) async {
|
Future<DownloadedApp> downloadApp(App app,
|
||||||
|
{bool showOccasionalProgressToast = false}) async {
|
||||||
|
int? prevProg;
|
||||||
var fileName = '${app.id}-${app.latestVersion}-${app.preferredApkIndex}';
|
var fileName = '${app.id}-${app.latestVersion}-${app.preferredApkIndex}';
|
||||||
File downloadFile = await downloadApk(app.apkUrls[app.preferredApkIndex],
|
File downloadFile = await downloadApk(app.apkUrls[app.preferredApkIndex],
|
||||||
'${app.id}-${app.latestVersion}-${app.preferredApkIndex}',
|
'${app.id}-${app.latestVersion}-${app.preferredApkIndex}',
|
||||||
@ -123,6 +126,14 @@ class AppsProvider with ChangeNotifier {
|
|||||||
if (apps[app.id] != null) {
|
if (apps[app.id] != null) {
|
||||||
apps[app.id]!.downloadProgress = progress;
|
apps[app.id]!.downloadProgress = progress;
|
||||||
}
|
}
|
||||||
|
int? prog = progress?.ceil();
|
||||||
|
if (showOccasionalProgressToast &&
|
||||||
|
(prog == 25 || prog == 50 || prog == 75) &&
|
||||||
|
prevProg != prog) {
|
||||||
|
Fluttertoast.showToast(
|
||||||
|
msg: 'Progress: $prog%', toastLength: Toast.LENGTH_SHORT);
|
||||||
|
}
|
||||||
|
prevProg = prog;
|
||||||
notifyListeners();
|
notifyListeners();
|
||||||
}, SourceProvider().getSource(app.url).apkUrlPrefetchModifier);
|
}, SourceProvider().getSource(app.url).apkUrlPrefetchModifier);
|
||||||
// Delete older versions of the APK if any
|
// Delete older versions of the APK if any
|
||||||
@ -291,7 +302,7 @@ class AppsProvider with ChangeNotifier {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// If Obtainium is being installed, it should be the last one
|
// If Obtainium is being installed, it should be the last one
|
||||||
List<DownloadedApp> moveObtainiumToEnd(List<DownloadedApp> items) {
|
List<DownloadedApp> moveObtainiumToStart(List<DownloadedApp> items) {
|
||||||
String obtainiumId = 'imranr98_obtainium_${GitHub().host}';
|
String obtainiumId = 'imranr98_obtainium_${GitHub().host}';
|
||||||
DownloadedApp? temp;
|
DownloadedApp? temp;
|
||||||
items.removeWhere((element) {
|
items.removeWhere((element) {
|
||||||
@ -302,7 +313,7 @@ class AppsProvider with ChangeNotifier {
|
|||||||
return res;
|
return res;
|
||||||
});
|
});
|
||||||
if (temp != null) {
|
if (temp != null) {
|
||||||
items.add(temp!);
|
items = [temp!, ...items];
|
||||||
}
|
}
|
||||||
return items;
|
return items;
|
||||||
}
|
}
|
||||||
@ -310,8 +321,8 @@ class AppsProvider with ChangeNotifier {
|
|||||||
// TODO: Remove below line if silentupdates are ever figured out
|
// TODO: Remove below line if silentupdates are ever figured out
|
||||||
regularInstalls.addAll(silentUpdates);
|
regularInstalls.addAll(silentUpdates);
|
||||||
|
|
||||||
silentUpdates = moveObtainiumToEnd(silentUpdates);
|
silentUpdates = moveObtainiumToStart(silentUpdates);
|
||||||
regularInstalls = moveObtainiumToEnd(regularInstalls);
|
regularInstalls = moveObtainiumToStart(regularInstalls);
|
||||||
|
|
||||||
// TODO: Uncomment below if silentupdates are ever figured out
|
// TODO: Uncomment below if silentupdates are ever figured out
|
||||||
// for (var u in silentUpdates) {
|
// for (var u in silentUpdates) {
|
||||||
|
@ -210,7 +210,7 @@ class SourceProvider {
|
|||||||
? name
|
? name
|
||||||
: names.name[0].toUpperCase() + names.name.substring(1),
|
: names.name[0].toUpperCase() + names.name.substring(1),
|
||||||
null,
|
null,
|
||||||
apk.version,
|
apk.version.replaceAll('/', '-'),
|
||||||
apk.apkUrls,
|
apk.apkUrls,
|
||||||
apk.apkUrls.length - 1,
|
apk.apkUrls.length - 1,
|
||||||
additionalData,
|
additionalData,
|
||||||
|
@ -17,7 +17,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
|
|||||||
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
|
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
|
||||||
# In Windows, build-name is used as the major, minor, and patch parts
|
# In Windows, build-name is used as the major, minor, and patch parts
|
||||||
# of the product and file versions while build-number is used as the build suffix.
|
# of the product and file versions while build-number is used as the build suffix.
|
||||||
version: 0.6.2+46 # When changing this, update the tag in main() accordingly
|
version: 0.6.4+48 # When changing this, update the tag in main() accordingly
|
||||||
|
|
||||||
environment:
|
environment:
|
||||||
sdk: '>=2.18.2 <3.0.0'
|
sdk: '>=2.18.2 <3.0.0'
|
||||||
|
Reference in New Issue
Block a user