fix to open chat via bottom menu

Signed-off-by: Marcel Hibbe <dev@mhibbe.de>
This commit is contained in:
Marcel Hibbe 2023-04-03 14:17:56 +02:00
parent da9edbce97
commit 9e66c3192c
No known key found for this signature in database
GPG Key ID: C793F8B59F43CE7B

View File

@ -30,6 +30,7 @@ import com.afollestad.materialdialogs.MaterialDialog
import com.afollestad.materialdialogs.bottomsheets.BottomSheet
import com.nextcloud.talk.R
import com.nextcloud.talk.api.NcApi
import com.nextcloud.talk.chat.ChatActivity
import com.nextcloud.talk.controllers.bottomsheet.items.BasicListItemWithImage
import com.nextcloud.talk.controllers.bottomsheet.items.listItemsWithImage
import com.nextcloud.talk.data.user.model.User
@ -98,7 +99,7 @@ class ProfileBottomSheet(val ncApi: NcApi, val userModel: User) {
when (AllowedAppIds.createFor(action)) {
PROFILE -> openProfile(action.hyperlink!!, context)
EMAIL -> composeEmail(action.title!!, context)
SPREED -> talkTo(userId)
SPREED -> talkTo(userId, context)
}
}
}
@ -117,7 +118,7 @@ class ProfileBottomSheet(val ncApi: NcApi, val userModel: User) {
)
}
private fun talkTo(userId: String) {
private fun talkTo(userId: String, context: Context) {
val apiVersion =
ApiUtils.getConversationApiVersion(userModel, intArrayOf(ApiUtils.APIv4, 1))
val retrofitBucket = ApiUtils.getRetrofitBucketForCreateRoom(
@ -169,14 +170,10 @@ class ProfileBottomSheet(val ncApi: NcApi, val userModel: User) {
Parcels.wrap(roomOverall.ocs!!.data)
)
// TODO
// ConductorRemapping.remapChatController(
// router,
// userModel.id!!,
// roomOverall.ocs!!.data!!.token!!,
// bundle,
// true
// )
val chatIntent = Intent(context, ChatActivity::class.java)
chatIntent.putExtras(bundle)
chatIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP)
context.startActivity(chatIntent)
}
override fun onError(e: Throwable) {