mirror of
https://github.com/JGeek00/adguard-home-manager.git
synced 2025-06-07 07:07:46 +00:00
Improved updater
This commit is contained in:
parent
67b41b3382
commit
f63ac9eb66
3 changed files with 21 additions and 25 deletions
|
@ -13,9 +13,9 @@ class UpdateAvailable {
|
||||||
class UpdateAvailableData {
|
class UpdateAvailableData {
|
||||||
String currentVersion;
|
String currentVersion;
|
||||||
String? newVersion;
|
String? newVersion;
|
||||||
final String announcement;
|
final String? announcement;
|
||||||
final String announcementUrl;
|
final String? announcementUrl;
|
||||||
final bool canAutoupdate;
|
final bool? canAutoupdate;
|
||||||
final bool disabled;
|
final bool disabled;
|
||||||
String? changelog;
|
String? changelog;
|
||||||
bool? updateAvailable;
|
bool? updateAvailable;
|
||||||
|
|
|
@ -533,7 +533,6 @@ class ServersProvider with ChangeNotifier {
|
||||||
setUpdateAvailableLoadStatus(LoadStatus.loading, true);
|
setUpdateAvailableLoadStatus(LoadStatus.loading, true);
|
||||||
final result = await checkServerUpdates(server: server);
|
final result = await checkServerUpdates(server: server);
|
||||||
if (result['result'] == 'success') {
|
if (result['result'] == 'success') {
|
||||||
try {
|
|
||||||
UpdateAvailableData data = UpdateAvailableData.fromJson(result['data']);
|
UpdateAvailableData data = UpdateAvailableData.fromJson(result['data']);
|
||||||
final gitHubResult = await getUpdateChangelog(server: server, releaseTag: data.newVersion ?? data.currentVersion);
|
final gitHubResult = await getUpdateChangelog(server: server, releaseTag: data.newVersion ?? data.currentVersion);
|
||||||
if (gitHubResult['result'] == 'success') {
|
if (gitHubResult['result'] == 'success') {
|
||||||
|
@ -552,9 +551,6 @@ class ServersProvider with ChangeNotifier {
|
||||||
: false;
|
: false;
|
||||||
setUpdateAvailableData(data);
|
setUpdateAvailableData(data);
|
||||||
setUpdateAvailableLoadStatus(LoadStatus.loaded, true);
|
setUpdateAvailableLoadStatus(LoadStatus.loaded, true);
|
||||||
} catch (_) {
|
|
||||||
// AUTO UPDATE NOT AVAILABLE //
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
setUpdateAvailableLoadStatus(LoadStatus.error, true);
|
setUpdateAvailableLoadStatus(LoadStatus.error, true);
|
||||||
|
|
|
@ -127,7 +127,7 @@ class Settings extends StatelessWidget {
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
if (serversProvider.updateAvailable.data != null && serversProvider.updateAvailable.data!.canAutoupdate == true) CustomListTile(
|
if (serversProvider.updateAvailable.data != null) CustomListTile(
|
||||||
icon: Icons.system_update_rounded,
|
icon: Icons.system_update_rounded,
|
||||||
title: AppLocalizations.of(context)!.updates,
|
title: AppLocalizations.of(context)!.updates,
|
||||||
subtitle: AppLocalizations.of(context)!.updatesDescription,
|
subtitle: AppLocalizations.of(context)!.updatesDescription,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue