Skip to content

Commit

Permalink
Notification on main thread
Browse files Browse the repository at this point in the history
  • Loading branch information
hannesa2 committed Dec 13, 2022
1 parent e970ac3 commit e66b838
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ object AppUpdateHelper {
}
}

internal fun checkForNewVersionSilent(
internal suspend fun checkForNewVersionSilent(
appContext: Context,
currentVersionName: String,
gitRepoUrl: String
Expand All @@ -100,7 +100,9 @@ object AppUpdateHelper {
"and there is a new version ${release.tagName}\n"
if (release.tagName > currentVersionName) {
Timber.w(text)
Notify.notification(appContext, text, "New version for '${getAppName(appContext)}'", assetApk, release)
withContext(Dispatchers.Main) {
Notify.notification(appContext, text, "New version for '${getAppName(appContext)}'", assetApk, release)
}
}
}
} catch (e: Exception) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class DownloadWorker(private val appContext: Context, workerParams: WorkerParame
Result.success(outputData)
}

private fun check(currentVersion: String, repoUrl: String) {
private suspend fun check(currentVersion: String, repoUrl: String) {
AppUpdateHelper.checkForNewVersionSilent(appContext, currentVersion, repoUrl)
}

Expand Down

0 comments on commit e66b838

Please sign in to comment.