diff options
| author | Janito Vaqueiro Ferreira Filho <janito@mullvad.net> | 2019-12-04 19:04:21 +0000 |
|---|---|---|
| committer | Janito Vaqueiro Ferreira Filho <janito@mullvad.net> | 2019-12-05 10:47:01 +0000 |
| commit | 38d89e49d8b4a83001f1a6487b4df3fe4151bb4d (patch) | |
| tree | 6d3230c7eb4e6590ae80bb5f82b78df2acc7e790 /android | |
| parent | 6b0edd2cd9e4f7b60c6f1d092d88ac5fb2dba2a1 (diff) | |
| download | mullvadvpn-38d89e49d8b4a83001f1a6487b4df3fe4151bb4d.tar.xz mullvadvpn-38d89e49d8b4a83001f1a6487b4df3fe4151bb4d.zip | |
Fix `NotificationBanner` update on wrong thread
Diffstat (limited to 'android')
| -rw-r--r-- | android/src/main/kotlin/net/mullvad/mullvadvpn/NotificationBanner.kt | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/android/src/main/kotlin/net/mullvad/mullvadvpn/NotificationBanner.kt b/android/src/main/kotlin/net/mullvad/mullvadvpn/NotificationBanner.kt index ff6330d975..c5cd816ce2 100644 --- a/android/src/main/kotlin/net/mullvad/mullvadvpn/NotificationBanner.kt +++ b/android/src/main/kotlin/net/mullvad/mullvadvpn/NotificationBanner.kt @@ -41,6 +41,8 @@ class NotificationBanner( private val message: TextView = parentView.findViewById(R.id.notification_message) private val icon: View = parentView.findViewById(R.id.notification_icon) + private var updateJob: Job? = null + private var externalLink: ExternalLink? = null private var visible = false @@ -83,11 +85,14 @@ class NotificationBanner( } fun onResume() { - versionInfoCache.onUpdate = { update() } + versionInfoCache.onUpdate = { + updateJob = GlobalScope.launch(Dispatchers.Main) { update() } + } } fun onPause() { versionInfoCache.onUpdate = null + updateJob?.cancel() keyManagementController.onPause() } |
