Skip to content

Commit b5a9803

Browse files
tweaks
Signed-off-by: androidacy-user <opensource@androidacy.com>
1 parent 7dc6263 commit b5a9803

2 files changed

Lines changed: 17 additions & 12 deletions

File tree

app/src/main/java/com/fox2code/mmm/UpdateActivity.kt

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -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+
}

app/src/main/java/com/fox2code/mmm/settings/SettingsActivity.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -811,6 +811,8 @@ public void onCreatePreferences(Bundle savedInstanceState, String rootKey) {
811811
fileOutputStream.write(("Device: " + Build.MANUFACTURER + " " + Build.MODEL + " (" + Build.DEVICE + ")\n").getBytes());
812812
fileOutputStream.write(("Magisk version: " + InstallerInitializer.peekMagiskVersion() + "\n").getBytes());
813813
fileOutputStream.write(("Has internet: " + (RepoManager.getINSTANCE().hasConnectivity() ? "Yes" : "No") + "\n").getBytes());
814+
fileOutputStream.write(("Beginning of logs:\n").getBytes());
815+
814816
// read our logcat but format the output to be more readable
815817
Process process = Runtime.getRuntime().exec("logcat -d -v tag");
816818
BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(process.getInputStream()));

0 commit comments

Comments
 (0)