@@ -226,16 +226,26 @@ class UpdateActivity : FoxActivity() {
226226 // set progress bar to indeterminate
227227 progressIndicator.isIndeterminate = true
228228 }
229- // check for update
230- val shouldUpdate = AppUpdateManager .appUpdateManager.checkUpdate( true )
229+ val deviceId = AndroidacyRepoData .generateDeviceId()
230+ val clientId = BuildConfig . ANDROIDACY_CLIENT_ID
231231 var token = AndroidacyRepoData .token
232232 if (! AndroidacyRepoData .instance.isValidToken(token)) {
233233 Timber .w(" Invalid token, not checking for updates" )
234234 token = AndroidacyRepoData .instance.requestNewToken()
235235 }
236- val deviceId = AndroidacyRepoData .generateDeviceId()
237- val clientId = BuildConfig .ANDROIDACY_CLIENT_ID
238236 url = " https://production-api.androidacy.com/amm/updates/check?appVersionCode=${BuildConfig .VERSION_CODE } &token=$token &device_id=$deviceId &client_id=$clientId "
237+ runOnUiThread {
238+ // set status text to no update available
239+ statusTextView.setText(R .string.no_update_available)
240+ val changelogWebView = chgWv!!
241+ changelogWebView.loadUrl(url.replace(" updates/check" , " changelog" ))
242+ // execute javascript to make #rfrsh-btn just reload the page
243+ changelogWebView.evaluateJavascript(
244+ " (function() { document.getElementById('rfrsh-btn').onclick = function() { location.reload(); }; })();"
245+ ) { }
246+ }
247+ // check for update
248+ val shouldUpdate = AppUpdateManager .appUpdateManager.checkUpdate(true )
239249 // if shouldUpdate is true, then we have an update
240250 if (shouldUpdate) {
241251 runOnUiThread {
@@ -249,13 +259,6 @@ class UpdateActivity : FoxActivity() {
249259 button.isEnabled = true
250260 }
251261 // return
252- } else {
253- runOnUiThread {
254- // set status text to no update available
255- statusTextView.setText(R .string.no_update_available)
256- val changelogWebView = chgWv!!
257- changelogWebView.loadUrl(url.replace(" updates/check" , " changelog" ))
258- }
259262 }
260263 runOnUiThread {
261264 progressIndicator.isIndeterminate = false
@@ -409,4 +412,4 @@ class UpdateActivity : FoxActivity() {
409412 // action can be CHECK, DOWNLOAD, INSTALL
410413 CHECK , DOWNLOAD , INSTALL
411414 }
412- }
415+ }
0 commit comments