diff --git a/app/src/main/java/com/fox2code/mmm/UpdateActivity.kt b/app/src/main/java/com/fox2code/mmm/UpdateActivity.kt index c9dd922..cc95927 100644 --- a/app/src/main/java/com/fox2code/mmm/UpdateActivity.kt +++ b/app/src/main/java/com/fox2code/mmm/UpdateActivity.kt @@ -226,16 +226,26 @@ class UpdateActivity : FoxActivity() { // set progress bar to indeterminate progressIndicator.isIndeterminate = true } - // check for update - val shouldUpdate = AppUpdateManager.appUpdateManager.checkUpdate(true) + val deviceId = AndroidacyRepoData.generateDeviceId() + val clientId = BuildConfig.ANDROIDACY_CLIENT_ID var token = AndroidacyRepoData.token if (!AndroidacyRepoData.instance.isValidToken(token)) { Timber.w("Invalid token, not checking for updates") token = AndroidacyRepoData.instance.requestNewToken() } - val deviceId = AndroidacyRepoData.generateDeviceId() - val clientId = BuildConfig.ANDROIDACY_CLIENT_ID url = "https://production-api.androidacy.com/amm/updates/check?appVersionCode=${BuildConfig.VERSION_CODE}&token=$token&device_id=$deviceId&client_id=$clientId" + runOnUiThread { + // set status text to no update available + statusTextView.setText(R.string.no_update_available) + val changelogWebView = chgWv!! + changelogWebView.loadUrl(url.replace("updates/check", "changelog")) + // execute javascript to make #rfrsh-btn just reload the page + changelogWebView.evaluateJavascript( + "(function() { document.getElementById('rfrsh-btn').onclick = function() { location.reload(); }; })();" + ) { } + } + // check for update + val shouldUpdate = AppUpdateManager.appUpdateManager.checkUpdate(true) // if shouldUpdate is true, then we have an update if (shouldUpdate) { runOnUiThread { @@ -249,13 +259,6 @@ class UpdateActivity : FoxActivity() { button.isEnabled = true } // return - } else { - runOnUiThread { - // set status text to no update available - statusTextView.setText(R.string.no_update_available) - val changelogWebView = chgWv!! - changelogWebView.loadUrl(url.replace("updates/check", "changelog")) - } } runOnUiThread { progressIndicator.isIndeterminate = false @@ -409,4 +412,4 @@ class UpdateActivity : FoxActivity() { // action can be CHECK, DOWNLOAD, INSTALL CHECK, DOWNLOAD, INSTALL } -} \ No newline at end of file +} diff --git a/app/src/main/java/com/fox2code/mmm/settings/SettingsActivity.java b/app/src/main/java/com/fox2code/mmm/settings/SettingsActivity.java index 0ec3ea8..74c6c07 100644 --- a/app/src/main/java/com/fox2code/mmm/settings/SettingsActivity.java +++ b/app/src/main/java/com/fox2code/mmm/settings/SettingsActivity.java @@ -811,6 +811,8 @@ public class SettingsActivity extends FoxActivity implements LanguageActivity { fileOutputStream.write(("Device: " + Build.MANUFACTURER + " " + Build.MODEL + " (" + Build.DEVICE + ")\n").getBytes()); fileOutputStream.write(("Magisk version: " + InstallerInitializer.peekMagiskVersion() + "\n").getBytes()); fileOutputStream.write(("Has internet: " + (RepoManager.getINSTANCE().hasConnectivity() ? "Yes" : "No") + "\n").getBytes()); + fileOutputStream.write(("Beginning of logs:\n").getBytes()); + // read our logcat but format the output to be more readable Process process = Runtime.getRuntime().exec("logcat -d -v tag"); BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(process.getInputStream()));