mirror of
https://github.com/nextcloud/talk-android
synced 2025-07-15 08:45:04 +01:00
Fix to open chat from ContactsActivity.kt
(temporarily via MainActivity and ConductorRemapping until conductor is removed) Signed-off-by: Marcel Hibbe <dev@mhibbe.de>
This commit is contained in:
parent
5aac5637a7
commit
e740797b42
@ -93,6 +93,19 @@ class MainActivity : BaseActivity(), ActionBarProvider {
|
||||
|
||||
router = Conductor.attachRouter(this, binding.controllerContainer, savedInstanceState)
|
||||
|
||||
if (intent.getBooleanExtra(BundleKeys.KEY_OPEN_CHAT, false)) {
|
||||
logRouterBackStack(router!!)
|
||||
remapChatController(
|
||||
router!!,
|
||||
intent.getParcelableExtra<User>(KEY_USER_ENTITY)!!.id!!,
|
||||
intent.getStringExtra(KEY_ROOM_TOKEN)!!,
|
||||
intent.extras!!,
|
||||
true,
|
||||
true
|
||||
)
|
||||
logRouterBackStack(router!!)
|
||||
}
|
||||
|
||||
if (intent.hasExtra(BundleKeys.KEY_FROM_NOTIFICATION_START_CALL)) {
|
||||
onNewIntent(intent)
|
||||
} else if (!router!!.hasRootController()) {
|
||||
|
@ -25,6 +25,7 @@ package com.nextcloud.talk.contacts
|
||||
|
||||
import android.app.SearchManager
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.graphics.PorterDuff
|
||||
import android.graphics.drawable.ColorDrawable
|
||||
import android.os.Build
|
||||
@ -45,6 +46,7 @@ import autodagger.AutoInjector
|
||||
import com.bluelinelabs.logansquare.LoganSquare
|
||||
import com.nextcloud.talk.R
|
||||
import com.nextcloud.talk.activities.BaseActivity
|
||||
import com.nextcloud.talk.activities.MainActivity
|
||||
import com.nextcloud.talk.adapters.items.ContactItem
|
||||
import com.nextcloud.talk.adapters.items.GenericTextHeaderItem
|
||||
import com.nextcloud.talk.api.NcApi
|
||||
@ -66,6 +68,7 @@ import com.nextcloud.talk.users.UserManager
|
||||
import com.nextcloud.talk.utils.ApiUtils
|
||||
import com.nextcloud.talk.utils.DisplayUtils
|
||||
import com.nextcloud.talk.utils.bundle.BundleKeys
|
||||
import com.nextcloud.talk.utils.bundle.BundleKeys.KEY_OPEN_CHAT
|
||||
import com.nextcloud.talk.utils.database.user.CapabilitiesUtilNew
|
||||
import eu.davidea.flexibleadapter.FlexibleAdapter
|
||||
import eu.davidea.flexibleadapter.SelectableAdapter
|
||||
@ -373,15 +376,12 @@ class ContactsActivity :
|
||||
Parcels.wrap(roomOverall.ocs!!.data!!)
|
||||
)
|
||||
|
||||
// TODO: fix to open chat (go via MainActivity and open RemapChat... if conductor is still used)
|
||||
|
||||
// ConductorRemapping.remapChatController(
|
||||
// router,
|
||||
// currentUser!!.id!!,
|
||||
// roomOverall.ocs!!.data!!.token!!,
|
||||
// bundle,
|
||||
// true
|
||||
// )
|
||||
// TODO: go directly to ChatActivity when conductor is removed
|
||||
bundle.putBoolean(KEY_OPEN_CHAT, true)
|
||||
val intent = Intent(context, MainActivity::class.java)
|
||||
intent.putExtras(bundle)
|
||||
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP)
|
||||
startActivity(intent)
|
||||
}
|
||||
|
||||
override fun onError(e: Throwable) {
|
||||
@ -759,7 +759,6 @@ class ContactsActivity :
|
||||
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
fun onMessageEvent(openConversationEvent: OpenConversationEvent) {
|
||||
// TODO: fix to open chat
|
||||
// ConductorRemapping.remapChatController(
|
||||
// router,
|
||||
// currentUser!!.id!!,
|
||||
@ -767,6 +766,16 @@ class ContactsActivity :
|
||||
// openConversationEvent.bundle!!,
|
||||
// true
|
||||
// )
|
||||
|
||||
// TODO: go directly to ChatActivity when conductor is removed
|
||||
|
||||
var bundle = openConversationEvent.bundle!!
|
||||
|
||||
bundle.putBoolean(KEY_OPEN_CHAT, true)
|
||||
val intent = Intent(context, MainActivity::class.java)
|
||||
intent.putExtras(bundle)
|
||||
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP)
|
||||
startActivity(intent)
|
||||
contactsBottomDialog?.dismiss()
|
||||
}
|
||||
|
||||
@ -838,14 +847,12 @@ class ContactsActivity :
|
||||
Parcels.wrap(roomOverall.ocs!!.data!!)
|
||||
)
|
||||
|
||||
// TODO: fix to open chat
|
||||
// ConductorRemapping.remapChatController(
|
||||
// router,
|
||||
// currentUser!!.id!!,
|
||||
// roomOverall.ocs!!.data!!.token!!,
|
||||
// bundle,
|
||||
// true
|
||||
// )
|
||||
// TODO: go directly to ChatActivity when conductor is removed
|
||||
bundle.putBoolean(KEY_OPEN_CHAT, true)
|
||||
val intent = Intent(context, MainActivity::class.java)
|
||||
intent.putExtras(bundle)
|
||||
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP)
|
||||
startActivity(intent)
|
||||
}
|
||||
|
||||
override fun onError(e: Throwable) {
|
||||
|
@ -51,6 +51,7 @@ import com.afollestad.materialdialogs.datetime.dateTimePicker
|
||||
import com.google.android.material.dialog.MaterialAlertDialogBuilder
|
||||
import com.nextcloud.talk.R
|
||||
import com.nextcloud.talk.activities.BaseActivity
|
||||
import com.nextcloud.talk.activities.MainActivity
|
||||
import com.nextcloud.talk.adapters.items.ParticipantItem
|
||||
import com.nextcloud.talk.api.NcApi
|
||||
import com.nextcloud.talk.application.NextcloudTalkApplication
|
||||
@ -538,8 +539,9 @@ class ConversationInfoActivity :
|
||||
).setInputData(it).build()
|
||||
)
|
||||
|
||||
// TODO: fix to open ConversationList
|
||||
// router.popToRoot()
|
||||
val intent = Intent(context, MainActivity::class.java)
|
||||
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP)
|
||||
startActivity(intent)
|
||||
}
|
||||
}
|
||||
|
||||
@ -608,8 +610,9 @@ class ConversationInfoActivity :
|
||||
DeleteConversationWorker::class.java
|
||||
).setInputData(it).build()
|
||||
)
|
||||
// TODO: fix to open ConversationList
|
||||
// router.popToRoot()
|
||||
val intent = Intent(context, MainActivity::class.java)
|
||||
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP)
|
||||
startActivity(intent)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -86,4 +86,5 @@ object BundleKeys {
|
||||
const val KEY_DISMISS_RECORDING_URL = "KEY_DISMISS_RECORDING_URL"
|
||||
const val KEY_SHARE_RECORDING_TO_CHAT_URL = "KEY_SHARE_RECORDING_TO_CHAT_URL"
|
||||
const val KEY_GEOCODING_RESULT = "KEY_GEOCODING_RESULT"
|
||||
const val KEY_OPEN_CHAT = "KEY_OPEN_CHAT" // just temporarily used until conductor is deleted
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user