Allow entire app config to be shared as link (see https://github.com/ImranR98/apps.obtainium.imranr.dev/issues/5)

This commit is contained in:
Imran Remtulla
2024-01-12 23:46:50 -05:00
parent 102be5fa2e
commit 60869a0490
23 changed files with 94 additions and 29 deletions

View File

@@ -404,7 +404,7 @@ class AppsProvider with ChangeNotifier {
.isNotEmpty;
Future<bool> canInstallSilently(App app) async {
if (app.id == obtainiumId) {
if (app.id == obtainiumApp.id) {
return false;
}
if (!settingsProvider.enableBackgroundUpdates) {
@@ -428,7 +428,7 @@ class AppsProvider with ChangeNotifier {
} catch (e) {
// Probably not installed - ignore
}
if (installerPackageName != obtainiumId) {
if (installerPackageName != obtainiumApp.id) {
// If we did not install the app (or it isn't installed), silent install is not possible
return false;
}
@@ -673,7 +673,7 @@ class AppsProvider with ChangeNotifier {
// Move Obtainium to the end of the line (let all other apps update first)
appsToInstall =
moveStrToEnd(appsToInstall, obtainiumId, strB: obtainiumTempId);
moveStrToEnd(appsToInstall, obtainiumApp.id, strB: obtainiumTempId);
Future<void> updateFn(String id, {bool skipInstalls = false}) async {
try {
@@ -1676,7 +1676,8 @@ Future<void> bgUpdateCheck(String taskId, Map<String, dynamic>? params) async {
}
if (toInstall.isNotEmpty) {
logs.add('BG install task: Started (${toInstall.length}).');
var tempObtArr = toInstall.where((element) => element.key == obtainiumId);
var tempObtArr =
toInstall.where((element) => element.key == obtainiumApp.id);
if (tempObtArr.isNotEmpty) {
// Move obtainium to the end of the list as it must always install last
var obt = tempObtArr.first;

View File

@@ -15,7 +15,22 @@ import 'package:shared_preferences/shared_preferences.dart';
import 'package:shared_storage/shared_storage.dart' as saf;
String obtainiumTempId = 'imranr98_obtainium_${GitHub().hosts[0]}';
String obtainiumId = 'dev.imranr.obtainium';
App obtainiumApp = App(
'dev.imranr.obtainium',
'https://github.com/ImranR98/Obtainium',
'ImranR98',
'Obtainium',
currentReleaseTag,
currentReleaseTag,
[],
0,
{
'includePrereleases': true,
'versionDetection': 'standardVersionDetection'
},
null,
false);
enum InstallMethodSettings { normal, shizuku, root }

View File

@@ -276,9 +276,10 @@ class App {
json['installedVersion'] == null
? null
: json['installedVersion'] as String,
json['latestVersion'] as String,
assumed2DlistToStringMapList(jsonDecode(json['apkUrls'])),
json['preferredApkIndex'] as int,
(json['latestVersion'] ?? tr('unknown')) as String,
assumed2DlistToStringMapList(jsonDecode(
(json['apkUrls'] ?? '[["placeholder", "placeholder"]]'))),
(json['preferredApkIndex'] ?? -1) as int,
jsonDecode(json['additionalSettings']) as Map<String, dynamic>,
json['lastUpdateCheck'] == null
? null