Merge pull request #6634 from vector-im/johannes/ec-permission-shortcuts
Put EC permission shortcuts behind labs flag (PSG-630)
This commit is contained in:
commit
e9bd271642
1
changelog.d/6634.bugfix
Normal file
1
changelog.d/6634.bugfix
Normal file
@ -0,0 +1 @@
|
|||||||
|
Put EC permission shortcuts behind labs flag (PSG-630)
|
@ -206,6 +206,8 @@ class VectorPreferences @Inject constructor(
|
|||||||
|
|
||||||
private const val SETTINGS_LABS_ENABLE_LIVE_LOCATION = "SETTINGS_LABS_ENABLE_LIVE_LOCATION"
|
private const val SETTINGS_LABS_ENABLE_LIVE_LOCATION = "SETTINGS_LABS_ENABLE_LIVE_LOCATION"
|
||||||
|
|
||||||
|
private const val SETTINGS_LABS_ENABLE_ELEMENT_CALL_PERMISSION_SHORTCUTS = "SETTINGS_LABS_ENABLE_ELEMENT_CALL_PERMISSION_SHORTCUTS"
|
||||||
|
|
||||||
// This key will be used to identify clients with the old thread support enabled io.element.thread
|
// This key will be used to identify clients with the old thread support enabled io.element.thread
|
||||||
const val SETTINGS_LABS_ENABLE_THREAD_MESSAGES_OLD_CLIENTS = "SETTINGS_LABS_ENABLE_THREAD_MESSAGES"
|
const val SETTINGS_LABS_ENABLE_THREAD_MESSAGES_OLD_CLIENTS = "SETTINGS_LABS_ENABLE_THREAD_MESSAGES"
|
||||||
|
|
||||||
@ -1050,6 +1052,10 @@ class VectorPreferences @Inject constructor(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun labsEnableElementCallPermissionShortcuts(): Boolean {
|
||||||
|
return defaultPrefs.getBoolean(SETTINGS_LABS_ENABLE_ELEMENT_CALL_PERMISSION_SHORTCUTS, false)
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Indicates whether or not thread messages are enabled.
|
* Indicates whether or not thread messages are enabled.
|
||||||
*/
|
*/
|
||||||
|
@ -18,6 +18,7 @@ package im.vector.app.features.widgets
|
|||||||
|
|
||||||
import android.app.Activity
|
import android.app.Activity
|
||||||
import android.app.PendingIntent
|
import android.app.PendingIntent
|
||||||
|
import android.app.PendingIntent.FLAG_IMMUTABLE
|
||||||
import android.app.PictureInPictureParams
|
import android.app.PictureInPictureParams
|
||||||
import android.app.RemoteAction
|
import android.app.RemoteAction
|
||||||
import android.content.BroadcastReceiver
|
import android.content.BroadcastReceiver
|
||||||
@ -38,12 +39,14 @@ import im.vector.app.R
|
|||||||
import im.vector.app.core.extensions.addFragment
|
import im.vector.app.core.extensions.addFragment
|
||||||
import im.vector.app.core.platform.VectorBaseActivity
|
import im.vector.app.core.platform.VectorBaseActivity
|
||||||
import im.vector.app.databinding.ActivityWidgetBinding
|
import im.vector.app.databinding.ActivityWidgetBinding
|
||||||
|
import im.vector.app.features.settings.VectorPreferences
|
||||||
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.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
|
||||||
|
import javax.inject.Inject
|
||||||
|
|
||||||
@AndroidEntryPoint
|
@AndroidEntryPoint
|
||||||
class WidgetActivity : VectorBaseActivity<ActivityWidgetBinding>() {
|
class WidgetActivity : VectorBaseActivity<ActivityWidgetBinding>() {
|
||||||
@ -78,6 +81,8 @@ class WidgetActivity : VectorBaseActivity<ActivityWidgetBinding>() {
|
|||||||
private val viewModel: WidgetViewModel by viewModel()
|
private val viewModel: WidgetViewModel by viewModel()
|
||||||
private val permissionViewModel: RoomWidgetPermissionViewModel by viewModel()
|
private val permissionViewModel: RoomWidgetPermissionViewModel by viewModel()
|
||||||
|
|
||||||
|
@Inject lateinit var vectorPreferences: VectorPreferences
|
||||||
|
|
||||||
override fun getBinding() = ActivityWidgetBinding.inflate(layoutInflater)
|
override fun getBinding() = ActivityWidgetBinding.inflate(layoutInflater)
|
||||||
|
|
||||||
override fun getTitleRes() = R.string.room_widget_activity_title
|
override fun getTitleRes() = R.string.room_widget_activity_title
|
||||||
@ -99,7 +104,7 @@ class WidgetActivity : VectorBaseActivity<ActivityWidgetBinding>() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Trust element call widget by default
|
// Trust element call widget by default
|
||||||
if (widgetArgs.kind == WidgetKind.ELEMENT_CALL) {
|
if (widgetArgs.kind == WidgetKind.ELEMENT_CALL && vectorPreferences.labsEnableElementCallPermissionShortcuts()) {
|
||||||
if (supportFragmentManager.findFragmentByTag(WIDGET_FRAGMENT_TAG) == null) {
|
if (supportFragmentManager.findFragmentByTag(WIDGET_FRAGMENT_TAG) == null) {
|
||||||
addOnPictureInPictureModeChangedListener(pictureInPictureModeChangedInfoConsumer)
|
addOnPictureInPictureModeChangedListener(pictureInPictureModeChangedInfoConsumer)
|
||||||
addFragment(views.fragmentContainer, WidgetFragment::class.java, widgetArgs, WIDGET_FRAGMENT_TAG)
|
addFragment(views.fragmentContainer, WidgetFragment::class.java, widgetArgs, WIDGET_FRAGMENT_TAG)
|
||||||
@ -168,7 +173,7 @@ class WidgetActivity : VectorBaseActivity<ActivityWidgetBinding>() {
|
|||||||
private fun createElementCallPipParams(): PictureInPictureParams? {
|
private fun createElementCallPipParams(): PictureInPictureParams? {
|
||||||
val actions = mutableListOf<RemoteAction>()
|
val actions = mutableListOf<RemoteAction>()
|
||||||
val intent = Intent(ACTION_MEDIA_CONTROL).putExtra(EXTRA_CONTROL_TYPE, CONTROL_TYPE_HANGUP)
|
val intent = Intent(ACTION_MEDIA_CONTROL).putExtra(EXTRA_CONTROL_TYPE, CONTROL_TYPE_HANGUP)
|
||||||
val pendingIntent = PendingIntent.getBroadcast(this, REQUEST_CODE_HANGUP, intent, 0)
|
val pendingIntent = PendingIntent.getBroadcast(this, REQUEST_CODE_HANGUP, intent, FLAG_IMMUTABLE)
|
||||||
val icon = Icon.createWithResource(this, R.drawable.ic_call_hangup)
|
val icon = Icon.createWithResource(this, R.drawable.ic_call_hangup)
|
||||||
actions.add(RemoteAction(icon, getString(R.string.call_notification_hangup), getString(R.string.call_notification_hangup), pendingIntent))
|
actions.add(RemoteAction(icon, getString(R.string.call_notification_hangup), getString(R.string.call_notification_hangup), pendingIntent))
|
||||||
|
|
||||||
|
@ -46,6 +46,7 @@ import im.vector.app.core.platform.VectorMenuProvider
|
|||||||
import im.vector.app.core.utils.CheckWebViewPermissionsUseCase
|
import im.vector.app.core.utils.CheckWebViewPermissionsUseCase
|
||||||
import im.vector.app.core.utils.openUrlInExternalBrowser
|
import im.vector.app.core.utils.openUrlInExternalBrowser
|
||||||
import im.vector.app.databinding.FragmentRoomWidgetBinding
|
import im.vector.app.databinding.FragmentRoomWidgetBinding
|
||||||
|
import im.vector.app.features.settings.VectorPreferences
|
||||||
import im.vector.app.features.webview.WebEventListener
|
import im.vector.app.features.webview.WebEventListener
|
||||||
import im.vector.app.features.widgets.webview.WebviewPermissionUtils
|
import im.vector.app.features.widgets.webview.WebviewPermissionUtils
|
||||||
import im.vector.app.features.widgets.webview.clearAfterWidget
|
import im.vector.app.features.widgets.webview.clearAfterWidget
|
||||||
@ -68,6 +69,7 @@ data class WidgetArgs(
|
|||||||
class WidgetFragment @Inject constructor(
|
class WidgetFragment @Inject constructor(
|
||||||
private val permissionUtils: WebviewPermissionUtils,
|
private val permissionUtils: WebviewPermissionUtils,
|
||||||
private val checkWebViewPermissionsUseCase: CheckWebViewPermissionsUseCase,
|
private val checkWebViewPermissionsUseCase: CheckWebViewPermissionsUseCase,
|
||||||
|
private val vectorPreferences: VectorPreferences,
|
||||||
) :
|
) :
|
||||||
VectorBaseFragment<FragmentRoomWidgetBinding>(),
|
VectorBaseFragment<FragmentRoomWidgetBinding>(),
|
||||||
WebEventListener,
|
WebEventListener,
|
||||||
@ -303,7 +305,7 @@ class WidgetFragment @Inject constructor(
|
|||||||
context = requireContext(),
|
context = requireContext(),
|
||||||
activity = requireActivity(),
|
activity = requireActivity(),
|
||||||
activityResultLauncher = permissionResultLauncher,
|
activityResultLauncher = permissionResultLauncher,
|
||||||
autoApprove = fragmentArgs.kind == WidgetKind.ELEMENT_CALL
|
autoApprove = fragmentArgs.kind == WidgetKind.ELEMENT_CALL && vectorPreferences.labsEnableElementCallPermissionShortcuts()
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3181,4 +3181,8 @@
|
|||||||
<item quantity="one">%d message removed</item>
|
<item quantity="one">%d message removed</item>
|
||||||
<item quantity="other">%d messages removed</item>
|
<item quantity="other">%d messages removed</item>
|
||||||
</plurals>
|
</plurals>
|
||||||
|
|
||||||
|
<!-- Element Call Widget -->
|
||||||
|
<string name="labs_enable_element_call_permission_shortcuts">Enable Element Call permission shortcuts</string>
|
||||||
|
<string name="labs_enable_element_call_permission_shortcuts_summary">Auto-approve Element Call widgets and grant camera / mic access</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
@ -77,4 +77,10 @@
|
|||||||
android:summary="@string/labs_enable_live_location_summary"
|
android:summary="@string/labs_enable_live_location_summary"
|
||||||
android:title="@string/labs_enable_live_location" />
|
android:title="@string/labs_enable_live_location" />
|
||||||
|
|
||||||
|
<im.vector.app.core.preference.VectorSwitchPreference
|
||||||
|
android:defaultValue="false"
|
||||||
|
android:key="SETTINGS_LABS_ENABLE_ELEMENT_CALL_PERMISSION_SHORTCUTS"
|
||||||
|
android:summary="@string/labs_enable_element_call_permission_shortcuts_summary"
|
||||||
|
android:title="@string/labs_enable_element_call_permission_shortcuts" />
|
||||||
|
|
||||||
</androidx.preference.PreferenceScreen>
|
</androidx.preference.PreferenceScreen>
|
||||||
|
Loading…
Reference in New Issue
Block a user