Adapted app updater

This commit is contained in:
Juan Gilsanz Polo 2023-05-01 19:00:06 +02:00
parent 578e606b83
commit 5660aefdc5
3 changed files with 39 additions and 11 deletions

View file

@ -55,15 +55,25 @@ class _BaseState extends State<Base> with WidgetsBindingObserver {
}
Future<GitHubRelease?> checkInstallationSource() async {
if (Platform.isAndroid) {
Source installationSource = await StoreChecker.getSource;
if (installationSource != Source.IS_INSTALLED_FROM_PLAY_STORE) {
final result = await checkAppUpdatesGitHub();
if (result['result'] == 'success') {
if (updateExists(widget.appConfigProvider.getAppInfo!.version, result['body'].tagName)) {
final result = await checkAppUpdatesGitHub();
if (result['result'] == 'success') {
final update = updateExists(widget.appConfigProvider.getAppInfo!.version, result['body'].tagName);
if (update == true) {
if (Platform.isAndroid) {
Source installationSource = await StoreChecker.getSource;
if (installationSource == Source.IS_INSTALLED_FROM_PLAY_STORE) {
return null;
}
else {
return result['body'];
}
}
else if (Platform.isIOS) {
return null;
}
else {
return result['body'];
}
}
}
return null;