Code review fix.

This commit is contained in:
Onuray Sahin 2022-07-22 14:48:58 +03:00
parent 23a25cf240
commit 792fca8400
2 changed files with 6 additions and 1 deletions

View file

@ -41,6 +41,7 @@ import im.vector.app.databinding.ActivityWidgetBinding
import im.vector.app.features.widgets.permissions.RoomWidgetPermissionBottomSheet
import im.vector.app.features.widgets.permissions.RoomWidgetPermissionViewEvents
import im.vector.app.features.widgets.permissions.RoomWidgetPermissionViewModel
import org.matrix.android.sdk.api.extensions.orFalse
import org.matrix.android.sdk.api.session.events.model.Content
import java.io.Serializable
@ -145,7 +146,7 @@ class WidgetActivity : VectorBaseActivity<ActivityWidgetBinding>() {
override fun onUserLeaveHint() {
super.onUserLeaveHint()
val widgetArgs: WidgetArgs? = intent?.extras?.getParcelable(Mavericks.KEY_ARG)
if (widgetArgs?.kind == WidgetKind.ELEMENT_CALL) {
if (widgetArgs?.kind?.supportsPictureInPictureMode().orFalse()) {
enterPictureInPicture()
}
}

View file

@ -39,6 +39,10 @@ enum class WidgetKind(@StringRes val nameRes: Int, val screenId: String?) {
fun isAdmin(): Boolean {
return this == STICKER_PICKER || this == INTEGRATION_MANAGER
}
fun supportsPictureInPictureMode(): Boolean {
return this == ELEMENT_CALL
}
}
data class WidgetViewState(