fix: updater after abi split change

This commit is contained in:
Zane Schepke
2025-11-02 00:48:13 -04:00
parent 433d383b0b
commit 9991e06c44
3 changed files with 35 additions and 18 deletions
@@ -256,11 +256,15 @@ class MainActivity : AppCompatActivity() {
textDecoration = TextDecoration.Underline,
color = MaterialTheme.colorScheme.primary,
),
focusedStyle = SpanStyle(
textDecoration = TextDecoration.Underline,
color = MaterialTheme.colorScheme.primary,
background = MaterialTheme.colorScheme.primary.copy(alpha = 0.2f)
)
focusedStyle =
SpanStyle(
textDecoration = TextDecoration.Underline,
color = MaterialTheme.colorScheme.primary,
background =
MaterialTheme.colorScheme.primary.copy(
alpha = 0.2f
),
),
),
) {
snackbarState.dismissCurrent()
@@ -38,27 +38,40 @@ class GitHubUpdateRepository(
gitHubApi.getLatestRelease(githubOwner, githubRepo).onFailure(Timber::e)
}
release.map { release ->
val standaloneApkAsset =
val universalApkAsset =
release.assets.find { asset ->
asset.name.startsWith("wgtunnel-${Constants.STANDALONE_FLAVOR}-v") &&
asset.name.endsWith(".apk")
val prefix = "wgtunnel-${Constants.STANDALONE_FLAVOR}-v"
val apkSuffix = ".apk"
asset.name.startsWith(prefix) &&
asset.name.endsWith(apkSuffix) &&
!asset.name.endsWith("-arm64$apkSuffix") &&
!asset.name.endsWith("-armv7$apkSuffix")
}
val newVersion =
standaloneApkAsset
universalApkAsset
?.name
?.removePrefix("wgtunnel-${Constants.STANDALONE_FLAVOR}-v")
?.removeSuffix(".apk") ?: return@map null
Timber.i("Latest version: $newVersion, current version: $currentVersion")
if (isNightly && newVersion != currentVersion)
return@map GitHubReleaseMapper.toAppUpdate(release, newVersion)
if (NumberUtils.compareVersions(newVersion, currentVersion) > 0) {
GitHubReleaseMapper.toAppUpdate(
release.copy(assets = listOf(standaloneApkAsset)),
newVersion,
)
if (isNightly) {
if (newVersion != currentVersion) {
GitHubReleaseMapper.toAppUpdate(
release.copy(assets = listOf(universalApkAsset)),
newVersion,
)
} else {
null
}
} else {
null
if (NumberUtils.compareVersions(newVersion, currentVersion) > 0) {
GitHubReleaseMapper.toAppUpdate(
release.copy(assets = listOf(universalApkAsset)),
newVersion,
)
} else {
null
}
}
}
}
@@ -77,7 +77,7 @@ fun UpdateDialog(viewModel: SupportViewModel, context: Context, onPermissionNeed
Text(text = annotatedString)
if (supportState.isLoading) {
val stroke = Stroke(cap = StrokeCap.Round)
val stroke = Stroke(cap = StrokeCap.Round, width = 4.0f)
LinearWavyProgressIndicator(
progress = { supportState.downloadProgress },
modifier = Modifier.fillMaxWidth().padding(top = 16.dp),