Skip to content

Commit

Permalink
修复更新弹窗异常
Browse files Browse the repository at this point in the history
Signed-off-by: 子斗子 <[email protected]>
  • Loading branch information
ZIDOUZI committed Nov 24, 2023
1 parent b47a5be commit 246772f
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions app/src/main/java/zdz/imageURL/activity/main/MainViewModel.kt
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,9 @@ class MainViewModel @Inject constructor(

suspend fun checkUpdate() = try {
logger.measureTimeMillis("get remove info in %d millis time") {
getData().also { data = it }
getData()
}.run {
isOutOfData()
isOutOfData().also { if (it) data = this }
}
} catch (e: Throwable) {
logger.e(e)
Expand All @@ -103,7 +103,7 @@ class MainViewModel @Inject constructor(
suspend fun downloadUpdate(data: Data, ctx: Context) = downloader.download(
data.assets.first().browser_download_url.toString(),
subPath = "${appName}_release_${getData().tagName}.apk"
).let { downloader.openAfterFinished(ctx, it) }
).let { downloader.openAfterFinished(ctx, it, choose = pf.installerChooser.current()) }

private suspend fun parseTextInput(s: String): Pair<Type, String>? =
if (urlReg in s) s.parseUrlString() else // to make sure don't parse id if contains url.
Expand Down

0 comments on commit 246772f

Please sign in to comment.