mirror of
https://github.com/ImranR98/Obtainium.git
synced 2025-08-10 17:10:15 +02:00
"Check updates on start" toggle
This commit is contained in:
@@ -121,7 +121,7 @@
|
|||||||
"followSystem": "System folgen",
|
"followSystem": "System folgen",
|
||||||
"obtainium": "Obtainium",
|
"obtainium": "Obtainium",
|
||||||
"materialYou": "Material You",
|
"materialYou": "Material You",
|
||||||
"useBlackTheme": "Use pure black dark theme",
|
"useBlackTheme": "Use Pure Black Dark Theme",
|
||||||
"appSortBy": "App sortieren nach",
|
"appSortBy": "App sortieren nach",
|
||||||
"authorName": "Autor/Name",
|
"authorName": "Autor/Name",
|
||||||
"nameAuthor": "Name/Autor",
|
"nameAuthor": "Name/Autor",
|
||||||
@@ -231,6 +231,7 @@
|
|||||||
"gitlabPATLabel": "GitLab Personal Access Token (Enables Search)",
|
"gitlabPATLabel": "GitLab Personal Access Token (Enables Search)",
|
||||||
"about": "About",
|
"about": "About",
|
||||||
"requiresCredentialsInSettings": "This needs additional credentials (in Settings)",
|
"requiresCredentialsInSettings": "This needs additional credentials (in Settings)",
|
||||||
|
"checkOnStart": "Check Once on Start",
|
||||||
"removeAppQuestion": {
|
"removeAppQuestion": {
|
||||||
"one": "App entfernen?",
|
"one": "App entfernen?",
|
||||||
"other": "Apps entfernen?"
|
"other": "Apps entfernen?"
|
||||||
|
@@ -121,7 +121,7 @@
|
|||||||
"followSystem": "Follow System",
|
"followSystem": "Follow System",
|
||||||
"obtainium": "Obtainium",
|
"obtainium": "Obtainium",
|
||||||
"materialYou": "Material You",
|
"materialYou": "Material You",
|
||||||
"useBlackTheme": "Use pure black dark theme",
|
"useBlackTheme": "Use Pure Black Dark Theme",
|
||||||
"appSortBy": "App Sort By",
|
"appSortBy": "App Sort By",
|
||||||
"authorName": "Author/Name",
|
"authorName": "Author/Name",
|
||||||
"nameAuthor": "Name/Author",
|
"nameAuthor": "Name/Author",
|
||||||
@@ -231,6 +231,7 @@
|
|||||||
"gitlabPATLabel": "GitLab Personal Access Token (Enables Search)",
|
"gitlabPATLabel": "GitLab Personal Access Token (Enables Search)",
|
||||||
"about": "About",
|
"about": "About",
|
||||||
"requiresCredentialsInSettings": "This needs additional credentials (in Settings)",
|
"requiresCredentialsInSettings": "This needs additional credentials (in Settings)",
|
||||||
|
"checkOnStart": "Check Once on Start",
|
||||||
"removeAppQuestion": {
|
"removeAppQuestion": {
|
||||||
"one": "Remove App?",
|
"one": "Remove App?",
|
||||||
"other": "Remove Apps?"
|
"other": "Remove Apps?"
|
||||||
|
@@ -231,6 +231,7 @@
|
|||||||
"gitlabPATLabel": "GitLab Personal Access Token (Enables Search)",
|
"gitlabPATLabel": "GitLab Personal Access Token (Enables Search)",
|
||||||
"about": "About",
|
"about": "About",
|
||||||
"requiresCredentialsInSettings": "This needs additional credentials (in Settings)",
|
"requiresCredentialsInSettings": "This needs additional credentials (in Settings)",
|
||||||
|
"checkOnStart": "Check Once on Start",
|
||||||
"removeAppQuestion": {
|
"removeAppQuestion": {
|
||||||
"one": "¿Eliminar Aplicación?",
|
"one": "¿Eliminar Aplicación?",
|
||||||
"other": "¿Eliminar Aplicaciones?"
|
"other": "¿Eliminar Aplicaciones?"
|
||||||
|
@@ -231,6 +231,7 @@
|
|||||||
"gitlabPATLabel": "GitLab Personal Access Token (Enables Search)",
|
"gitlabPATLabel": "GitLab Personal Access Token (Enables Search)",
|
||||||
"about": "About",
|
"about": "About",
|
||||||
"requiresCredentialsInSettings": "This needs additional credentials (in Settings)",
|
"requiresCredentialsInSettings": "This needs additional credentials (in Settings)",
|
||||||
|
"checkOnStart": "Check Once on Start",
|
||||||
"removeAppQuestion": {
|
"removeAppQuestion": {
|
||||||
"one": "برنامه حذف شود؟",
|
"one": "برنامه حذف شود؟",
|
||||||
"other": "برنامه ها حذف شوند؟"
|
"other": "برنامه ها حذف شوند؟"
|
||||||
|
@@ -121,7 +121,7 @@
|
|||||||
"followSystem": "Suivre le système",
|
"followSystem": "Suivre le système",
|
||||||
"obtainium": "Obtainium",
|
"obtainium": "Obtainium",
|
||||||
"materialYou": "Material You",
|
"materialYou": "Material You",
|
||||||
"useBlackTheme": "Use pure black dark theme",
|
"useBlackTheme": "Use Pure Black Dark Theme",
|
||||||
"appSortBy": "Applications triées par",
|
"appSortBy": "Applications triées par",
|
||||||
"authorName": "Auteur/Nom",
|
"authorName": "Auteur/Nom",
|
||||||
"nameAuthor": "Nom/Auteur",
|
"nameAuthor": "Nom/Auteur",
|
||||||
@@ -231,6 +231,7 @@
|
|||||||
"gitlabPATLabel": "GitLab Personal Access Token (Enables Search)",
|
"gitlabPATLabel": "GitLab Personal Access Token (Enables Search)",
|
||||||
"about": "About",
|
"about": "About",
|
||||||
"requiresCredentialsInSettings": "This needs additional credentials (in Settings)",
|
"requiresCredentialsInSettings": "This needs additional credentials (in Settings)",
|
||||||
|
"checkOnStart": "Check Once on Start",
|
||||||
"removeAppQuestion": {
|
"removeAppQuestion": {
|
||||||
"one": "Supprimer l'application ?",
|
"one": "Supprimer l'application ?",
|
||||||
"other": "Supprimer les applications ?"
|
"other": "Supprimer les applications ?"
|
||||||
|
@@ -230,6 +230,7 @@
|
|||||||
"gitlabPATLabel": "GitLab Personal Access Token (Enables Search)",
|
"gitlabPATLabel": "GitLab Personal Access Token (Enables Search)",
|
||||||
"about": "About",
|
"about": "About",
|
||||||
"requiresCredentialsInSettings": "This needs additional credentials (in Settings)",
|
"requiresCredentialsInSettings": "This needs additional credentials (in Settings)",
|
||||||
|
"checkOnStart": "Check Once on Start",
|
||||||
"removeAppQuestion": {
|
"removeAppQuestion": {
|
||||||
"one": "Eltávolítja az alkalmazást?",
|
"one": "Eltávolítja az alkalmazást?",
|
||||||
"other": "Eltávolítja az alkalmazást?"
|
"other": "Eltávolítja az alkalmazást?"
|
||||||
|
@@ -121,7 +121,7 @@
|
|||||||
"followSystem": "Segui sistema",
|
"followSystem": "Segui sistema",
|
||||||
"obtainium": "Obtainium",
|
"obtainium": "Obtainium",
|
||||||
"materialYou": "Material You",
|
"materialYou": "Material You",
|
||||||
"useBlackTheme": "Use pure black dark theme",
|
"useBlackTheme": "Use Pure Black Dark Theme",
|
||||||
"appSortBy": "App ordinate per",
|
"appSortBy": "App ordinate per",
|
||||||
"authorName": "Autore/Nome",
|
"authorName": "Autore/Nome",
|
||||||
"nameAuthor": "Nome/Autore",
|
"nameAuthor": "Nome/Autore",
|
||||||
@@ -231,6 +231,7 @@
|
|||||||
"gitlabPATLabel": "GitLab Personal Access Token (Enables Search)",
|
"gitlabPATLabel": "GitLab Personal Access Token (Enables Search)",
|
||||||
"about": "About",
|
"about": "About",
|
||||||
"requiresCredentialsInSettings": "This needs additional credentials (in Settings)",
|
"requiresCredentialsInSettings": "This needs additional credentials (in Settings)",
|
||||||
|
"checkOnStart": "Check Once on Start",
|
||||||
"removeAppQuestion": {
|
"removeAppQuestion": {
|
||||||
"one": "Rimuovere l'App?",
|
"one": "Rimuovere l'App?",
|
||||||
"other": "Rimuovere le App?"
|
"other": "Rimuovere le App?"
|
||||||
|
@@ -231,6 +231,7 @@
|
|||||||
"gitlabPATLabel": "GitLab Personal Access Token (Enables Search)",
|
"gitlabPATLabel": "GitLab Personal Access Token (Enables Search)",
|
||||||
"about": "About",
|
"about": "About",
|
||||||
"requiresCredentialsInSettings": "This needs additional credentials (in Settings)",
|
"requiresCredentialsInSettings": "This needs additional credentials (in Settings)",
|
||||||
|
"checkOnStart": "Check Once on Start",
|
||||||
"removeAppQuestion": {
|
"removeAppQuestion": {
|
||||||
"one": "アプリを削除しますか?",
|
"one": "アプリを削除しますか?",
|
||||||
"other": "アプリを削除しますか?"
|
"other": "アプリを削除しますか?"
|
||||||
|
@@ -231,6 +231,7 @@
|
|||||||
"gitlabPATLabel": "GitLab Personal Access Token (Enables Search)",
|
"gitlabPATLabel": "GitLab Personal Access Token (Enables Search)",
|
||||||
"about": "About",
|
"about": "About",
|
||||||
"requiresCredentialsInSettings": "This needs additional credentials (in Settings)",
|
"requiresCredentialsInSettings": "This needs additional credentials (in Settings)",
|
||||||
|
"checkOnStart": "Check Once on Start",
|
||||||
"removeAppQuestion": {
|
"removeAppQuestion": {
|
||||||
"one": "是否删除应用?",
|
"one": "是否删除应用?",
|
||||||
"other": "是否删除应用?"
|
"other": "是否删除应用?"
|
||||||
|
@@ -52,6 +52,9 @@ class AppsPageState extends State<AppsPage> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
final GlobalKey<RefreshIndicatorState> _refreshIndicatorKey =
|
||||||
|
GlobalKey<RefreshIndicatorState>();
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
var appsProvider = context.watch<AppsProvider>();
|
var appsProvider = context.watch<AppsProvider>();
|
||||||
@@ -61,6 +64,27 @@ class AppsPageState extends State<AppsPage> {
|
|||||||
var currentFilterIsUpdatesOnly =
|
var currentFilterIsUpdatesOnly =
|
||||||
filter.isIdenticalTo(updatesOnlyFilter, settingsProvider);
|
filter.isIdenticalTo(updatesOnlyFilter, settingsProvider);
|
||||||
|
|
||||||
|
refresh() {
|
||||||
|
HapticFeedback.lightImpact();
|
||||||
|
setState(() {
|
||||||
|
refreshingSince = DateTime.now();
|
||||||
|
});
|
||||||
|
return appsProvider.checkUpdates().catchError((e) {
|
||||||
|
showError(e, context);
|
||||||
|
}).whenComplete(() {
|
||||||
|
setState(() {
|
||||||
|
refreshingSince = null;
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!appsProvider.loadingApps &&
|
||||||
|
appsProvider.apps.isNotEmpty &&
|
||||||
|
settingsProvider.checkJustStarted() &&
|
||||||
|
settingsProvider.checkOnStart) {
|
||||||
|
_refreshIndicatorKey.currentState?.show();
|
||||||
|
}
|
||||||
|
|
||||||
selectedAppIds = selectedAppIds
|
selectedAppIds = selectedAppIds
|
||||||
.where((element) => listedApps.map((e) => e.app.id).contains(element))
|
.where((element) => listedApps.map((e) => e.app.id).contains(element))
|
||||||
.toSet();
|
.toSet();
|
||||||
@@ -315,7 +339,7 @@ class AppsPageState extends State<AppsPage> {
|
|||||||
?.isBefore(refreshingSince!) ??
|
?.isBefore(refreshingSince!) ??
|
||||||
true))
|
true))
|
||||||
.length /
|
.length /
|
||||||
appsProvider.apps.length,
|
(appsProvider.apps.isNotEmpty ? appsProvider.apps.length : 1),
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
];
|
];
|
||||||
@@ -1019,19 +1043,8 @@ class AppsPageState extends State<AppsPage> {
|
|||||||
return Scaffold(
|
return Scaffold(
|
||||||
backgroundColor: Theme.of(context).colorScheme.surface,
|
backgroundColor: Theme.of(context).colorScheme.surface,
|
||||||
body: RefreshIndicator(
|
body: RefreshIndicator(
|
||||||
onRefresh: () {
|
key: _refreshIndicatorKey,
|
||||||
HapticFeedback.lightImpact();
|
onRefresh: refresh,
|
||||||
setState(() {
|
|
||||||
refreshingSince = DateTime.now();
|
|
||||||
});
|
|
||||||
return appsProvider.checkUpdates().catchError((e) {
|
|
||||||
showError(e, context);
|
|
||||||
}).whenComplete(() {
|
|
||||||
setState(() {
|
|
||||||
refreshingSince = null;
|
|
||||||
});
|
|
||||||
});
|
|
||||||
},
|
|
||||||
child: CustomScrollView(slivers: <Widget>[
|
child: CustomScrollView(slivers: <Widget>[
|
||||||
CustomAppBar(title: tr('appsString')),
|
CustomAppBar(title: tr('appsString')),
|
||||||
...getLoadingWidgets(),
|
...getLoadingWidgets(),
|
||||||
|
@@ -228,6 +228,18 @@ class _SettingsPageState extends State<SettingsPage> {
|
|||||||
color: Theme.of(context).colorScheme.primary),
|
color: Theme.of(context).colorScheme.primary),
|
||||||
),
|
),
|
||||||
intervalDropdown,
|
intervalDropdown,
|
||||||
|
height16,
|
||||||
|
Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
|
children: [
|
||||||
|
Flexible(child: Text(tr('checkOnStart'))),
|
||||||
|
Switch(
|
||||||
|
value: settingsProvider.checkOnStart,
|
||||||
|
onChanged: (value) {
|
||||||
|
settingsProvider.checkOnStart = value;
|
||||||
|
})
|
||||||
|
],
|
||||||
|
),
|
||||||
height32,
|
height32,
|
||||||
Text(
|
Text(
|
||||||
tr('sourceSpecific'),
|
tr('sourceSpecific'),
|
||||||
|
@@ -35,6 +35,7 @@ List<int> updateIntervals = [15, 30, 60, 120, 180, 360, 720, 1440, 4320, 0]
|
|||||||
|
|
||||||
class SettingsProvider with ChangeNotifier {
|
class SettingsProvider with ChangeNotifier {
|
||||||
SharedPreferences? prefs;
|
SharedPreferences? prefs;
|
||||||
|
bool justStarted = true;
|
||||||
|
|
||||||
String sourceUrl = 'https://github.com/ImranR98/Obtainium';
|
String sourceUrl = 'https://github.com/ImranR98/Obtainium';
|
||||||
|
|
||||||
@@ -92,6 +93,15 @@ class SettingsProvider with ChangeNotifier {
|
|||||||
notifyListeners();
|
notifyListeners();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool get checkOnStart {
|
||||||
|
return prefs?.getBool('checkOnStart') ?? false;
|
||||||
|
}
|
||||||
|
|
||||||
|
set checkOnStart(bool checkOnStart) {
|
||||||
|
prefs?.setBool('checkOnStart', checkOnStart);
|
||||||
|
notifyListeners();
|
||||||
|
}
|
||||||
|
|
||||||
SortColumnSettings get sortColumn {
|
SortColumnSettings get sortColumn {
|
||||||
return SortColumnSettings.values[
|
return SortColumnSettings.values[
|
||||||
prefs?.getInt('sortColumn') ?? SortColumnSettings.nameAuthor.index];
|
prefs?.getInt('sortColumn') ?? SortColumnSettings.nameAuthor.index];
|
||||||
@@ -120,6 +130,14 @@ class SettingsProvider with ChangeNotifier {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool checkJustStarted() {
|
||||||
|
if (justStarted) {
|
||||||
|
justStarted = false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
Future<bool> getInstallPermission({bool enforce = false}) async {
|
Future<bool> getInstallPermission({bool enforce = false}) async {
|
||||||
while (!(await Permission.requestInstallPackages.isGranted)) {
|
while (!(await Permission.requestInstallPackages.isGranted)) {
|
||||||
// Explicit request as InstallPlugin request sometimes bugged
|
// Explicit request as InstallPlugin request sometimes bugged
|
||||||
|
Reference in New Issue
Block a user