feat: Show a dialog when an update is available (#1654)

This commit is contained in:
aAbed 2024-01-25 23:05:34 +05:45 committed by aAbed
parent 7104d6d6dd
commit c7d975e612
No known key found for this signature in database
GPG key ID: F26611AB3F996827
10 changed files with 302 additions and 190 deletions

View file

@ -128,12 +128,12 @@ class ManagerAPI {
await _prefs.setString('patchesRepo', value);
}
bool getPatchesConsent() {
return _prefs.getBool('patchesConsent') ?? false;
bool getDownloadConsent() {
return _prefs.getBool('downloadConsent') ?? false;
}
Future<void> setPatchesConsent(bool consent) async {
await _prefs.setBool('patchesConsent', consent);
void setDownloadConsent(bool consent) {
_prefs.setBool('downloadConsent', consent);
}
bool isPatchesAutoUpdate() {
@ -156,6 +156,14 @@ class ManagerAPI {
_prefs.setBool('showPatchesChangeWarning', !value);
}
bool showUpdateDialog() {
return _prefs.getBool('showUpdateDialog') ?? true;
}
void setShowUpdateDialog(bool value) {
_prefs.setBool('showUpdateDialog', value);
}
bool isChangingToggleModified() {
return _prefs.getBool('isChangingToggleModified') ?? false;
}
@ -164,8 +172,8 @@ class ManagerAPI {
_prefs.setBool('isChangingToggleModified', value);
}
Future<void> setPatchesAutoUpdate(bool value) async {
await _prefs.setBool('patchesAutoUpdate', value);
void setPatchesAutoUpdate(bool value) {
_prefs.setBool('patchesAutoUpdate', value);
}
List<Patch> getSavedPatches(String packageName) {
@ -508,7 +516,11 @@ class ManagerAPI {
Future<String> getCurrentManagerVersion() async {
final PackageInfo packageInfo = await PackageInfo.fromPlatform();
return packageInfo.version;
String version = packageInfo.version;
if (!version.startsWith('v')) {
version = 'v$version';
}
return version;
}
Future<String> getCurrentPatchesVersion() async {