haptic feedback, listed sources

This commit is contained in:
Imran Remtulla
2022-08-27 16:25:45 -04:00
parent 6c076751ab
commit 5e785ae1d5
8 changed files with 136 additions and 76 deletions

View File

@@ -6,6 +6,7 @@ import 'dart:convert';
import 'dart:io';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:obtainium/providers/notifications_provider.dart';
import 'package:provider/provider.dart';
import 'package:path_provider/path_provider.dart';
@@ -191,7 +192,7 @@ class AppsProvider with ChangeNotifier {
Future<App?> getUpdate(String appId) async {
App? currentApp = apps[appId]!.app;
App newApp = await sourceProvider().getApp(currentApp.url);
App newApp = await SourceProvider().getApp(currentApp.url);
if (newApp.latestVersion != currentApp.latestVersion) {
newApp.installedVersion = currentApp.installedVersion;
await saveApp(newApp);
@@ -299,11 +300,13 @@ class _APKPickerState extends State<APKPicker> {
actions: [
TextButton(
onPressed: () {
HapticFeedback.lightImpact();
Navigator.of(context).pop(null);
},
child: const Text('Cancel')),
TextButton(
onPressed: () {
HapticFeedback.mediumImpact();
Navigator.of(context).pop(apkUrl);
},
child: const Text('Continue'))

View File

@@ -195,7 +195,7 @@ class GitLab implements AppSource {
}
}
class sourceProvider {
class SourceProvider {
// Add more source classes here so they are available via the service
AppSource getSource(String url) {
if (url.toLowerCase().contains('://github.com')) {
@@ -227,4 +227,6 @@ class sourceProvider {
apk.version,
apk.apkUrls);
}
List<String> getSourceHosts() => ['github.com', 'gitlab.com'];
}