// private async void MigrateSchedulesAsync(Int64 currentVersion) // { // if (_application.Preferences.LastMigrationVersion == currentVersion) // { // return ; // } // // if (!await _application.Manager.MigrateSchedulesAsync()) // { // ShowSnackbar(Resource.String.schedulesMigrationErrorMessage); // _ = _application.SaveLogAsync(); // } // else // { // _application.Preferences.SetLastMigrationVersion(currentVersion); // } // } private async void CheckForCriticalUpdatesAsync(Int64 currentVersion) { if (IsPermissionDenied(Manifest.Permission.Internet)) { RequestPermissions(InternetPermissionRequestCode, Manifest.Permission.Internet); return; } ReleaseDescription latest = await ApplicationUtilities.GetLatestReleaseDescription(); if (latest == null) { return; } if (!latest.IsCriticalUpdate) // && !_application.Preferences.CheckUpdatesOnStart { return; } if (latest.VersionCode == _application.Preferences.LastSeenUpdateVersion || latest.VersionCode <= currentVersion) { return; } Java.Lang.ICharSequence dialogMessage = (latest.VersionNotes != null) ? latest.VersionNotes.FromHtml() : Resources.GetString(Resource.String.applicationUpdateAvailableMessage).FromMarkdown(); Int32 dialogTitleId = latest.IsCriticalUpdate ? Resource.String.applicationCriticalUpdateAvailableDialogTitle : Resource.String.applicationUpdateAvailableDialogTitle; String packageId = latest.GooglePlayStorePackageId; if (packageId == null) { new CustomAlertDialog(this) .SetTitle(dialogTitleId) .SetMessage(dialogMessage) .SetPositiveButton( Resource.String.openUpdateDownloadPageActionTitle, () => { String url = ApplicationUtilities.LatestReleaseDownloadPageUrl; StartActivity(IntentUtilities.CreateViewIntentFromUrl(url)); } ) .SetNegativeButton( Resource.String.gotItActionTitle, () => _application.Preferences.SetLastSeenUpdateVersion(latest.VersionCode) ) .Show(); return; } void OpenWithPlayStore() { try { Intent intent = IntentUtilities.CreateGooglePlayStoreViewIntent( this, packageId ); if (intent != null) { StartActivity(intent); } } catch (ActivityNotFoundException) { Intent intent = IntentUtilities.CreateGooglePlayStoreViewIntent( this, packageId, true ); if (intent != null) { StartActivity(intent); } } } if (packageId == PackageName) { new CustomAlertDialog(this) .SetTitle(dialogTitleId) .SetMessage(dialogMessage) .SetPositiveButton( Resource.String.openPlayMarketActionTitle, () => OpenWithPlayStore() ) .SetNegativeButton( Resource.String.gotItActionTitle, () => _application.Preferences.SetLastSeenUpdateVersion(latest.VersionCode) ) .Show(); return; } new CustomAlertDialog(this) .SetTitle(Resource.String.googlePlayStoreReleaseAvailableDialogTitle) .SetMessage(Resource.String.googlePlayStoreReleaseRelocatedMessage) .SetPositiveButton(Resource.String.openPlayMarketActionTitle, () => OpenWithPlayStore()) .Show(); }