Просмотр исходного кода

Fix to switch active user when opening talk from notification

When two or more users were setup, the active user was not updated when opening the app from notification. As a result, it was not possible to send files, mention people...

Signed-off-by: Marcel Hibbe <dev@mhibbe.de>
Marcel Hibbe 2 лет назад
Родитель
Сommit
fb7ea25b9d
1 измененных файлов с 8 добавлено и 0 удалено
  1. 8 0
      app/src/main/java/com/nextcloud/talk/activities/MainActivity.kt

+ 8 - 0
app/src/main/java/com/nextcloud/talk/activities/MainActivity.kt

@@ -338,6 +338,14 @@ class MainActivity : BaseActivity(), ActionBarProvider {
     override fun onNewIntent(intent: Intent) {
         super.onNewIntent(intent)
         Log.d(TAG, "onNewIntent Activity: " + System.identityHashCode(this).toString())
+
+        val user = intent.getParcelableExtra<User>(KEY_USER_ENTITY)
+        if (user != null && userManager.setUserAsActive(user).blockingGet()) {
+            handleIntent(intent)
+        }
+    }
+
+    private fun handleIntent(intent: Intent) {
         handleActionFromContact(intent)
         if (intent.hasExtra(BundleKeys.KEY_FROM_NOTIFICATION_START_CALL)) {
             if (intent.getBooleanExtra(BundleKeys.KEY_FROM_NOTIFICATION_START_CALL, false)) {