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

View File

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