mirror of
https://github.com/vector-im/element-android.git
synced 2024-11-16 02:05:06 +08:00
Ensure that when user accept permission the native widget is well open
Before we were asking in loop until the sync comes back with the updated account data
This commit is contained in:
parent
4f8fd7b994
commit
85734e3581
@ -85,5 +85,6 @@ sealed class RoomDetailAction : VectorViewModelAction {
|
|||||||
data class AddJitsiWidget(val withVideo: Boolean): RoomDetailAction()
|
data class AddJitsiWidget(val withVideo: Boolean): RoomDetailAction()
|
||||||
data class RemoveWidget(val widgetId: String): RoomDetailAction()
|
data class RemoveWidget(val widgetId: String): RoomDetailAction()
|
||||||
data class EnsureNativeWidgetAllowed(val widget: Widget,
|
data class EnsureNativeWidgetAllowed(val widget: Widget,
|
||||||
|
val userJustAccepted: Boolean,
|
||||||
val grantedEvents: RoomDetailViewEvents) : RoomDetailAction()
|
val grantedEvents: RoomDetailViewEvents) : RoomDetailAction()
|
||||||
}
|
}
|
||||||
|
@ -384,7 +384,11 @@ class RoomDetailFragment @Inject constructor(
|
|||||||
).apply {
|
).apply {
|
||||||
directListener = { granted ->
|
directListener = { granted ->
|
||||||
if (granted) {
|
if (granted) {
|
||||||
roomDetailViewModel.handle(RoomDetailAction.EnsureNativeWidgetAllowed(it.widget, it.grantedEvents))
|
roomDetailViewModel.handle(RoomDetailAction.EnsureNativeWidgetAllowed(
|
||||||
|
widget = it.widget,
|
||||||
|
userJustAccepted = true,
|
||||||
|
grantedEvents = it.grantedEvents
|
||||||
|
))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -406,15 +410,17 @@ class RoomDetailFragment @Inject constructor(
|
|||||||
override fun onTapJoinAudio(jitsiWidget: Widget) {
|
override fun onTapJoinAudio(jitsiWidget: Widget) {
|
||||||
// need to check if allowed first
|
// need to check if allowed first
|
||||||
roomDetailViewModel.handle(RoomDetailAction.EnsureNativeWidgetAllowed(
|
roomDetailViewModel.handle(RoomDetailAction.EnsureNativeWidgetAllowed(
|
||||||
jitsiWidget,
|
widget = jitsiWidget,
|
||||||
RoomDetailViewEvents.JoinJitsiConference(jitsiWidget, false))
|
userJustAccepted = false,
|
||||||
|
grantedEvents = RoomDetailViewEvents.JoinJitsiConference(jitsiWidget, false))
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onTapJoinVideo(jitsiWidget: Widget) {
|
override fun onTapJoinVideo(jitsiWidget: Widget) {
|
||||||
roomDetailViewModel.handle(RoomDetailAction.EnsureNativeWidgetAllowed(
|
roomDetailViewModel.handle(RoomDetailAction.EnsureNativeWidgetAllowed(
|
||||||
jitsiWidget,
|
widget = jitsiWidget,
|
||||||
RoomDetailViewEvents.JoinJitsiConference(jitsiWidget, true))
|
userJustAccepted = false,
|
||||||
|
grantedEvents = RoomDetailViewEvents.JoinJitsiConference(jitsiWidget, true))
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -45,6 +45,15 @@ import im.vector.app.features.home.room.typing.TypingHelper
|
|||||||
import im.vector.app.features.powerlevel.PowerLevelsObservableFactory
|
import im.vector.app.features.powerlevel.PowerLevelsObservableFactory
|
||||||
import im.vector.app.features.settings.VectorLocale
|
import im.vector.app.features.settings.VectorLocale
|
||||||
import im.vector.app.features.settings.VectorPreferences
|
import im.vector.app.features.settings.VectorPreferences
|
||||||
|
import io.reactivex.Observable
|
||||||
|
import io.reactivex.functions.BiFunction
|
||||||
|
import io.reactivex.rxkotlin.subscribeBy
|
||||||
|
import io.reactivex.schedulers.Schedulers
|
||||||
|
import kotlinx.coroutines.Dispatchers
|
||||||
|
import kotlinx.coroutines.launch
|
||||||
|
import kotlinx.coroutines.withContext
|
||||||
|
import org.commonmark.parser.Parser
|
||||||
|
import org.commonmark.renderer.html.HtmlRenderer
|
||||||
import org.matrix.android.sdk.api.MatrixCallback
|
import org.matrix.android.sdk.api.MatrixCallback
|
||||||
import org.matrix.android.sdk.api.MatrixPatterns
|
import org.matrix.android.sdk.api.MatrixPatterns
|
||||||
import org.matrix.android.sdk.api.NoOpMatrixCallback
|
import org.matrix.android.sdk.api.NoOpMatrixCallback
|
||||||
@ -77,24 +86,15 @@ import org.matrix.android.sdk.api.session.room.timeline.Timeline
|
|||||||
import org.matrix.android.sdk.api.session.room.timeline.TimelineEvent
|
import org.matrix.android.sdk.api.session.room.timeline.TimelineEvent
|
||||||
import org.matrix.android.sdk.api.session.room.timeline.TimelineSettings
|
import org.matrix.android.sdk.api.session.room.timeline.TimelineSettings
|
||||||
import org.matrix.android.sdk.api.session.room.timeline.getTextEditableContent
|
import org.matrix.android.sdk.api.session.room.timeline.getTextEditableContent
|
||||||
|
import org.matrix.android.sdk.api.session.widgets.model.Widget
|
||||||
|
import org.matrix.android.sdk.api.session.widgets.model.WidgetType
|
||||||
import org.matrix.android.sdk.api.util.toOptional
|
import org.matrix.android.sdk.api.util.toOptional
|
||||||
import org.matrix.android.sdk.internal.crypto.attachments.toElementToDecrypt
|
import org.matrix.android.sdk.internal.crypto.attachments.toElementToDecrypt
|
||||||
import org.matrix.android.sdk.internal.crypto.model.event.EncryptedEventContent
|
import org.matrix.android.sdk.internal.crypto.model.event.EncryptedEventContent
|
||||||
import org.matrix.android.sdk.internal.crypto.model.event.WithHeldCode
|
import org.matrix.android.sdk.internal.crypto.model.event.WithHeldCode
|
||||||
|
import org.matrix.android.sdk.internal.util.awaitCallback
|
||||||
import org.matrix.android.sdk.rx.rx
|
import org.matrix.android.sdk.rx.rx
|
||||||
import org.matrix.android.sdk.rx.unwrap
|
import org.matrix.android.sdk.rx.unwrap
|
||||||
import io.reactivex.Observable
|
|
||||||
import io.reactivex.functions.BiFunction
|
|
||||||
import io.reactivex.rxkotlin.subscribeBy
|
|
||||||
import io.reactivex.schedulers.Schedulers
|
|
||||||
import kotlinx.coroutines.Dispatchers
|
|
||||||
import kotlinx.coroutines.launch
|
|
||||||
import kotlinx.coroutines.withContext
|
|
||||||
import org.commonmark.parser.Parser
|
|
||||||
import org.commonmark.renderer.html.HtmlRenderer
|
|
||||||
import org.matrix.android.sdk.api.session.widgets.model.Widget
|
|
||||||
import org.matrix.android.sdk.api.session.widgets.model.WidgetType
|
|
||||||
import org.matrix.android.sdk.internal.util.awaitCallback
|
|
||||||
import timber.log.Timber
|
import timber.log.Timber
|
||||||
import java.io.File
|
import java.io.File
|
||||||
import java.util.UUID
|
import java.util.UUID
|
||||||
@ -412,7 +412,7 @@ class RoomDetailViewModel @AssistedInject constructor(
|
|||||||
private fun handleCheckWidgetAllowed(action: RoomDetailAction.EnsureNativeWidgetAllowed) {
|
private fun handleCheckWidgetAllowed(action: RoomDetailAction.EnsureNativeWidgetAllowed) {
|
||||||
val widget = action.widget
|
val widget = action.widget
|
||||||
val domain = action.widget.widgetContent.data["domain"] as? String ?: ""
|
val domain = action.widget.widgetContent.data["domain"] as? String ?: ""
|
||||||
val isAllowed = if (widget.type == WidgetType.Jitsi) {
|
val isAllowed = action.userJustAccepted || if (widget.type == WidgetType.Jitsi) {
|
||||||
widget.senderInfo?.userId == session.myUserId
|
widget.senderInfo?.userId == session.myUserId
|
||||||
|| session.integrationManagerService().isNativeWidgetDomainAllowed(
|
|| session.integrationManagerService().isNativeWidgetDomainAllowed(
|
||||||
action.widget.type.preferred,
|
action.widget.type.preferred,
|
||||||
|
Loading…
Reference in New Issue
Block a user