Skip to content

Commit e66b838

Browse files
committed
Notification on main thread
1 parent e970ac3 commit e66b838

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

githubAppUpdate/src/main/java/info/hannes/github/AppUpdateHelper.kt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ object AppUpdateHelper {
8484
}
8585
}
8686

87-
internal fun checkForNewVersionSilent(
87+
internal suspend fun checkForNewVersionSilent(
8888
appContext: Context,
8989
currentVersionName: String,
9090
gitRepoUrl: String
@@ -100,7 +100,9 @@ object AppUpdateHelper {
100100
"and there is a new version ${release.tagName}\n"
101101
if (release.tagName > currentVersionName) {
102102
Timber.w(text)
103-
Notify.notification(appContext, text, "New version for '${getAppName(appContext)}'", assetApk, release)
103+
withContext(Dispatchers.Main) {
104+
Notify.notification(appContext, text, "New version for '${getAppName(appContext)}'", assetApk, release)
105+
}
104106
}
105107
}
106108
} catch (e: Exception) {

githubAppUpdate/src/main/java/info/hannes/github/DownloadWorker.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class DownloadWorker(private val appContext: Context, workerParams: WorkerParame
2525
Result.success(outputData)
2626
}
2727

28-
private fun check(currentVersion: String, repoUrl: String) {
28+
private suspend fun check(currentVersion: String, repoUrl: String) {
2929
AppUpdateHelper.checkForNewVersionSilent(appContext, currentVersion, repoUrl)
3030
}
3131

0 commit comments

Comments
 (0)