mirror of
https://github.com/wgtunnel/android.git
synced 2026-07-03 14:07:49 +02:00
fix: updater after abi split change
This commit is contained in:
@@ -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()
|
||||
|
||||
+25
-12
@@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -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),
|
||||
|
||||
Reference in New Issue
Block a user