diff --git a/vector/src/main/java/im/vector/app/features/widgets/WidgetActivity.kt b/vector/src/main/java/im/vector/app/features/widgets/WidgetActivity.kt index 92b070c8d0..0b78d8d2f1 100644 --- a/vector/src/main/java/im/vector/app/features/widgets/WidgetActivity.kt +++ b/vector/src/main/java/im/vector/app/features/widgets/WidgetActivity.kt @@ -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() { 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() } } diff --git a/vector/src/main/java/im/vector/app/features/widgets/WidgetViewState.kt b/vector/src/main/java/im/vector/app/features/widgets/WidgetViewState.kt index 7619fea766..cd2ed23980 100644 --- a/vector/src/main/java/im/vector/app/features/widgets/WidgetViewState.kt +++ b/vector/src/main/java/im/vector/app/features/widgets/WidgetViewState.kt @@ -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(