Compare commits

...

7 Commits

Author SHA1 Message Date
bd5f21984e Shorter default interval (see #87) 2022-11-04 19:10:20 -04:00
5037d77b14 Increment version 2022-11-04 18:57:06 -04:00
c9711c7734 Addresses #76 and #93 2022-11-04 18:53:25 -04:00
76e98feeb7 Increment version 2022-11-02 20:24:12 -04:00
03da23f77a Addresses #90 2022-11-02 20:23:40 -04:00
9b99e2b302 Addresses #88, #89 2022-11-02 20:07:46 -04:00
e746ca890a Obtainium now installs last (#84) 2022-10-31 17:41:25 -04:00
8 changed files with 76 additions and 17 deletions

View File

@ -28,6 +28,7 @@ class _GeneratedFormModalState extends State<GeneratedFormModal> {
@override
void initState() {
super.initState();
values = widget.defaultValues;
valid = widget.initValid;
}

View File

@ -14,7 +14,7 @@ import 'package:workmanager/workmanager.dart';
import 'package:dynamic_color/dynamic_color.dart';
import 'package:device_info_plus/device_info_plus.dart';
const String currentVersion = '0.6.3';
const String currentVersion = '0.6.6';
const String currentReleaseTag =
'v$currentVersion-beta'; // KEEP THIS IN SYNC WITH GITHUB RELEASES

View File

@ -63,6 +63,7 @@ class _AppPageState extends State<AppPage> {
Image.memory(
app!.installedInfo!.icon!,
height: 150,
gaplessPlayback: true,
)
])
: Container(),

View File

@ -23,6 +23,7 @@ class AppsPageState extends State<AppsPage> {
var updatesOnlyFilter =
AppsFilter(includeUptodate: false, includeNonInstalled: false);
Set<String> selectedIds = {};
DateTime? refreshingSince;
clearSelected() {
if (selectedIds.isNotEmpty) {
@ -119,8 +120,9 @@ class AppsPageState extends State<AppsPage> {
sortedApps = sortedApps.reversed.toList();
}
var existingUpdateIdsAllOrSelected = appsProvider
.getExistingUpdates(installedOnly: true)
var existingUpdates = appsProvider.getExistingUpdates(installedOnly: true);
var existingUpdateIdsAllOrSelected = existingUpdates
.where((element) => selectedIds.isEmpty
? sortedApps.where((a) => a.app.id == element).isNotEmpty
: selectedIds.contains(element))
@ -132,15 +134,34 @@ class AppsPageState extends State<AppsPage> {
: selectedIds.contains(element))
.toList();
if (settingsProvider.pinUpdates) {
var temp = [];
sortedApps = sortedApps.where((sa) {
if (existingUpdates.contains(sa.app.id)) {
temp.add(sa);
return false;
}
return true;
}).toList();
sortedApps = [...temp, ...sortedApps];
}
return Scaffold(
backgroundColor: Theme.of(context).colorScheme.surface,
body: RefreshIndicator(
onRefresh: () {
HapticFeedback.lightImpact();
setState(() {
refreshingSince = DateTime.now();
});
return appsProvider.checkUpdates().catchError((e) {
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(content: Text(e.toString())),
);
}).whenComplete(() {
setState(() {
refreshingSince = null;
});
});
},
child: CustomScrollView(slivers: <Widget>[
@ -157,6 +178,17 @@ class AppsPageState extends State<AppsPage> {
style: Theme.of(context).textTheme.headlineMedium,
textAlign: TextAlign.center,
))),
if (refreshingSince != null)
SliverToBoxAdapter(
child: LinearProgressIndicator(
value: appsProvider.apps.values
.where((element) => !(element.app.lastUpdateCheck
?.isBefore(refreshingSince!) ??
true))
.length /
appsProvider.apps.length,
),
),
SliverList(
delegate: SliverChildBuilderDelegate(
(BuildContext context, int index) {
@ -168,7 +200,10 @@ class AppsPageState extends State<AppsPage> {
toggleAppSelected(sortedApps[index].app.id);
},
leading: sortedApps[index].installedInfo != null
? Image.memory(sortedApps[index].installedInfo!.icon!)
? Image.memory(
sortedApps[index].installedInfo!.icon!,
gaplessPlayback: true,
)
: null,
title: Text(sortedApps[index].installedInfo?.name ??
sortedApps[index].app.name),
@ -327,10 +362,8 @@ class AppsPageState extends State<AppsPage> {
);
}).then((values) {
if (values != null) {
bool shouldInstallUpdates =
values.isEmpty || values[0] == 'true';
bool shouldInstallNew = values.isEmpty ||
(values.length >= 2 && values[1] == 'true');
bool shouldInstallUpdates = values[0] == 'true';
bool shouldInstallNew = values[1] == 'true';
settingsProvider
.getInstallPermission()
.then((_) {

View File

@ -155,6 +155,20 @@ class _SettingsPageState extends State<SettingsPage> {
})
],
),
const SizedBox(
height: 16,
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
const Text('Pin Updates to Top of Apps View'),
Switch(
value: settingsProvider.pinUpdates,
onChanged: (value) {
settingsProvider.pinUpdates = value;
})
],
),
const Divider(
height: 16,
),
@ -199,7 +213,7 @@ class _SettingsPageState extends State<SettingsPage> {
height: 8,
),
Text(
'Longer intervals recommended for large App collections',
'Longer intervals may result in less reliable behaviour',
style: Theme.of(context)
.textTheme
.labelMedium!

View File

@ -70,8 +70,9 @@ class AppsProvider with ChangeNotifier {
}
downloadApk(String apkUrl, String fileName, Function? onProgress,
Function? urlModifier,
{bool useExistingIfExists = true}) async {
Function? urlModifier) async {
bool useExistingIfExists =
false; // This should be an function argument, but isn't because of the partially downloaded APK issue
var destDir = (await getExternalStorageDirectory())!.path;
if (urlModifier != null) {
apkUrl = await urlModifier(apkUrl);
@ -302,7 +303,7 @@ class AppsProvider with ChangeNotifier {
}
// 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}';
DownloadedApp? temp;
items.removeWhere((element) {
@ -313,7 +314,7 @@ class AppsProvider with ChangeNotifier {
return res;
});
if (temp != null) {
items.add(temp!);
items = [temp!, ...items];
}
return items;
}
@ -321,8 +322,8 @@ class AppsProvider with ChangeNotifier {
// TODO: Remove below line if silentupdates are ever figured out
regularInstalls.addAll(silentUpdates);
silentUpdates = moveObtainiumToEnd(silentUpdates);
regularInstalls = moveObtainiumToEnd(regularInstalls);
silentUpdates = moveObtainiumToStart(silentUpdates);
regularInstalls = moveObtainiumToStart(regularInstalls);
// TODO: Uncomment below if silentupdates are ever figured out
// for (var u in silentUpdates) {

View File

@ -55,7 +55,7 @@ class SettingsProvider with ChangeNotifier {
}
int get updateInterval {
var min = prefs?.getInt('updateInterval') ?? 180;
var min = prefs?.getInt('updateInterval') ?? 60;
if (!updateIntervals.contains(min)) {
var temp = updateIntervals[0];
for (var i in updateIntervals) {
@ -123,6 +123,15 @@ class SettingsProvider with ChangeNotifier {
notifyListeners();
}
bool get pinUpdates {
return prefs?.getBool('pinUpdates') ?? true;
}
set pinUpdates(bool show) {
prefs?.setBool('pinUpdates', show);
notifyListeners();
}
String? getSettingString(String settingId) {
return prefs?.getString(settingId);
}

View File

@ -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
# 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.
version: 0.6.3+47 # When changing this, update the tag in main() accordingly
version: 0.6.6+50 # When changing this, update the tag in main() accordingly
environment:
sdk: '>=2.18.2 <3.0.0'