You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
val deviceId =AndroidacyRepoData.generateDeviceId()
53
+
val clientId =BuildConfig.ANDROIDACY_CLIENT_ID
54
+
val url ="https://production-api.androidacy.com/ammm/updates/check?appVersionCode=${BuildConfig.VERSION_CODE}&token=$token&device_id=$deviceId&client_id=$clientId"
55
+
val response = doHttpGet(url, false)
56
+
// convert response to string
57
+
val responseString =String(response, Charsets.UTF_8)
58
+
Timber.d("Response: $responseString")
59
+
// json response has a boolean shouldUpdate and an int latestVersion
val deviceId =AndroidacyRepoData.generateDeviceId()
236
+
val clientId =BuildConfig.ANDROIDACY_CLIENT_ID
237
+
val url ="https://production-api.androidacy.com/ammm/updates/check?appVersionCode=${BuildConfig.VERSION_CODE}&token=$token&device_id=$deviceId&client_id=$clientId"
// we already know that there is an update, so we can get the latest version of our architecture. We're going to have to iterate through the assets to find the one we want
236
-
val assets = latestJSON.getJSONArray("assets")
237
-
// get the asset we want
238
-
var asset:JSONObject?=null
239
-
// iterate through assets until we find the one that contains Build.SUPPORTED_ABIS[0]
240
-
while (Objects.isNull(asset)) {
241
-
for (i in0 until assets.length()) {
242
-
val asset1 = assets.getJSONObject(i)
243
-
if (asset1.getString("name").contains(Build.SUPPORTED_ABIS[0])) {
244
-
asset = asset1
245
-
break
246
-
}
247
-
}
248
-
}
249
-
// if asset is null, then we are in a bad state
250
-
if (Objects.isNull(asset)) {
251
-
// set status text to error
252
-
runOnUiThread {
253
-
statusTextView.setText(R.string.error_no_asset)
254
-
// set progress bar to error
255
-
progressIndicator.isIndeterminate =false
256
-
progressIndicator.setProgressCompat(100, false)
257
-
}
258
-
// return
259
-
return
251
+
val latestJSON =JSONObject(String(lastestJSON))
252
+
val changelog = latestJSON.getString("changelog")
253
+
runOnUiThread {
254
+
// set changelog text. changelog could be markdown, so we need to convert it
255
+
val changelogTextView = findViewById<MaterialTextView>(R.id.update_changelog)
256
+
val markwon =Markwon.create(this@UpdateActivity)
257
+
markwon.setMarkdown(changelogTextView, changelog)
260
258
}
261
259
// get the download url
262
-
val downloadUrl = asset?.getString("browser_download_url")
263
-
// get the download size
264
-
val downloadSize = asset?.getLong("size")
260
+
var downloadUrl = url.replace("check", "download")
261
+
// append arch to download url. coerce anything like arm64-* or aarch64-* to arm64 and anything like arm-* or armeabi-* to arm
0 commit comments