mirror of
https://github.com/JGeek00/adguard-home-manager.git
synced 2025-06-28 20:09:51 +00:00
Added screen to update server
This commit is contained in:
parent
4e65f80baf
commit
e02b598be9
13 changed files with 819 additions and 34 deletions
47
lib/functions/compare_versions.dart
Normal file
47
lib/functions/compare_versions.dart
Normal file
|
@ -0,0 +1,47 @@
|
|||
bool compareVersions({
|
||||
required String currentVersion,
|
||||
required String newVersion
|
||||
}) {
|
||||
final currentSplit = currentVersion.split('.').map((e) => int.parse(e)).toList();
|
||||
final newSplit = newVersion.split('.').map((e) => int.parse(e)).toList();
|
||||
|
||||
if (newSplit[0] > currentSplit[0]) {
|
||||
return true;
|
||||
}
|
||||
else if (newSplit[1] > currentSplit[1]) {
|
||||
return true;
|
||||
}
|
||||
else if (newSplit[2] > currentSplit[2]) {
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
bool compareBetaVersions({
|
||||
required String currentVersion,
|
||||
required String newVersion
|
||||
}) {
|
||||
final currentSplit = currentVersion.split('-')[0].split('.').map((e) => int.parse(e)).toList();
|
||||
final newSplit = newVersion.split('-')[0].split('.').map((e) => int.parse(e)).toList();
|
||||
|
||||
final currentBeta = int.parse(currentVersion.split('-')[1].replaceAll('b.', ''));
|
||||
final newBeta = int.parse(newVersion.split('-')[1].replaceAll('b.', ''));
|
||||
|
||||
if (newSplit[0] > currentSplit[0]) {
|
||||
return true;
|
||||
}
|
||||
else if (newSplit[1] > currentSplit[1]) {
|
||||
return true;
|
||||
}
|
||||
else if (newSplit[2] > currentSplit[2]) {
|
||||
return true;
|
||||
}
|
||||
else if (newBeta > currentBeta) {
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
}
|
17
lib/functions/open_url.dart
Normal file
17
lib/functions/open_url.dart
Normal file
|
@ -0,0 +1,17 @@
|
|||
import 'package:flutter_web_browser/flutter_web_browser.dart';
|
||||
|
||||
void openUrl(String url) {
|
||||
FlutterWebBrowser.openWebPage(
|
||||
url: url,
|
||||
customTabsOptions: const CustomTabsOptions(
|
||||
instantAppsEnabled: true,
|
||||
showTitle: true,
|
||||
urlBarHidingEnabled: false,
|
||||
),
|
||||
safariVCOptions: const SafariViewControllerOptions(
|
||||
barCollapsingEnabled: true,
|
||||
dismissButtonStyle: SafariViewControllerDismissButtonStyle.close,
|
||||
modalPresentationCapturesStatusBarAppearance: true,
|
||||
)
|
||||
);
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue