Merge pull request #6800 from vector-im/feature/mna/new-device-management-screen
[Devices management] Add a feature flag and empty screen for future new layout (PSG-676)
This commit is contained in:
commit
0515303c8c
1
changelog.d/6798.wip
Normal file
1
changelog.d/6798.wip
Normal file
@ -0,0 +1 @@
|
|||||||
|
[Devices management] Add a feature flag and empty screen for future new layout
|
@ -90,6 +90,11 @@ class DebugFeaturesStateFactory @Inject constructor(
|
|||||||
key = DebugFeatureKeys.newAppLayoutEnabled,
|
key = DebugFeatureKeys.newAppLayoutEnabled,
|
||||||
factory = VectorFeatures::isNewAppLayoutEnabled
|
factory = VectorFeatures::isNewAppLayoutEnabled
|
||||||
),
|
),
|
||||||
|
createBooleanFeature(
|
||||||
|
label = "Enable New Device Management",
|
||||||
|
key = DebugFeatureKeys.newDeviceManagementEnabled,
|
||||||
|
factory = VectorFeatures::isNewDeviceManagementEnabled
|
||||||
|
),
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@ -79,6 +79,9 @@ class DebugVectorFeatures(
|
|||||||
override fun isNewAppLayoutEnabled(): Boolean = read(DebugFeatureKeys.newAppLayoutEnabled)
|
override fun isNewAppLayoutEnabled(): Boolean = read(DebugFeatureKeys.newAppLayoutEnabled)
|
||||||
?: vectorFeatures.isNewAppLayoutEnabled()
|
?: vectorFeatures.isNewAppLayoutEnabled()
|
||||||
|
|
||||||
|
override fun isNewDeviceManagementEnabled(): Boolean = read(DebugFeatureKeys.newDeviceManagementEnabled)
|
||||||
|
?: vectorFeatures.isNewDeviceManagementEnabled()
|
||||||
|
|
||||||
fun <T> override(value: T?, key: Preferences.Key<T>) = updatePreferences {
|
fun <T> override(value: T?, key: Preferences.Key<T>) = updatePreferences {
|
||||||
if (value == null) {
|
if (value == null) {
|
||||||
it.remove(key)
|
it.remove(key)
|
||||||
@ -139,4 +142,5 @@ object DebugFeatureKeys {
|
|||||||
val forceUsageOfOpusEncoder = booleanPreferencesKey("force-usage-of-opus-encoder")
|
val forceUsageOfOpusEncoder = booleanPreferencesKey("force-usage-of-opus-encoder")
|
||||||
val startDmOnFirstMsg = booleanPreferencesKey("start-dm-on-first-msg")
|
val startDmOnFirstMsg = booleanPreferencesKey("start-dm-on-first-msg")
|
||||||
val newAppLayoutEnabled = booleanPreferencesKey("new-app-layout-enabled")
|
val newAppLayoutEnabled = booleanPreferencesKey("new-app-layout-enabled")
|
||||||
|
val newDeviceManagementEnabled = booleanPreferencesKey("new-device-management-enabled")
|
||||||
}
|
}
|
||||||
|
@ -34,6 +34,7 @@ interface VectorFeatures {
|
|||||||
fun forceUsageOfOpusEncoder(): Boolean
|
fun forceUsageOfOpusEncoder(): Boolean
|
||||||
fun shouldStartDmOnFirstMessage(): Boolean
|
fun shouldStartDmOnFirstMessage(): Boolean
|
||||||
fun isNewAppLayoutEnabled(): Boolean
|
fun isNewAppLayoutEnabled(): Boolean
|
||||||
|
fun isNewDeviceManagementEnabled(): Boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
class DefaultVectorFeatures : VectorFeatures {
|
class DefaultVectorFeatures : VectorFeatures {
|
||||||
@ -50,4 +51,5 @@ class DefaultVectorFeatures : VectorFeatures {
|
|||||||
override fun forceUsageOfOpusEncoder(): Boolean = false
|
override fun forceUsageOfOpusEncoder(): Boolean = false
|
||||||
override fun shouldStartDmOnFirstMessage(): Boolean = false
|
override fun shouldStartDmOnFirstMessage(): Boolean = false
|
||||||
override fun isNewAppLayoutEnabled(): Boolean = false
|
override fun isNewAppLayoutEnabled(): Boolean = false
|
||||||
|
override fun isNewDeviceManagementEnabled(): Boolean = false
|
||||||
}
|
}
|
||||||
|
@ -74,6 +74,7 @@ class VectorPreferences @Inject constructor(
|
|||||||
const val SETTINGS_ENCRYPTION_IMPORT_E2E_ROOM_KEYS_PREFERENCE_KEY = "SETTINGS_ENCRYPTION_IMPORT_E2E_ROOM_KEYS_PREFERENCE_KEY"
|
const val SETTINGS_ENCRYPTION_IMPORT_E2E_ROOM_KEYS_PREFERENCE_KEY = "SETTINGS_ENCRYPTION_IMPORT_E2E_ROOM_KEYS_PREFERENCE_KEY"
|
||||||
const val SETTINGS_ENCRYPTION_NEVER_SENT_TO_PREFERENCE_KEY = "SETTINGS_ENCRYPTION_NEVER_SENT_TO_PREFERENCE_KEY"
|
const val SETTINGS_ENCRYPTION_NEVER_SENT_TO_PREFERENCE_KEY = "SETTINGS_ENCRYPTION_NEVER_SENT_TO_PREFERENCE_KEY"
|
||||||
const val SETTINGS_SHOW_DEVICES_LIST_PREFERENCE_KEY = "SETTINGS_SHOW_DEVICES_LIST_PREFERENCE_KEY"
|
const val SETTINGS_SHOW_DEVICES_LIST_PREFERENCE_KEY = "SETTINGS_SHOW_DEVICES_LIST_PREFERENCE_KEY"
|
||||||
|
const val SETTINGS_SHOW_DEVICES_LIST_V2_PREFERENCE_KEY = "SETTINGS_SHOW_DEVICES_LIST_V2_PREFERENCE_KEY"
|
||||||
const val SETTINGS_ALLOW_INTEGRATIONS_KEY = "SETTINGS_ALLOW_INTEGRATIONS_KEY"
|
const val SETTINGS_ALLOW_INTEGRATIONS_KEY = "SETTINGS_ALLOW_INTEGRATIONS_KEY"
|
||||||
const val SETTINGS_INTEGRATION_MANAGER_UI_URL_KEY = "SETTINGS_INTEGRATION_MANAGER_UI_URL_KEY"
|
const val SETTINGS_INTEGRATION_MANAGER_UI_URL_KEY = "SETTINGS_INTEGRATION_MANAGER_UI_URL_KEY"
|
||||||
const val SETTINGS_SECURE_MESSAGE_RECOVERY_PREFERENCE_KEY = "SETTINGS_SECURE_MESSAGE_RECOVERY_PREFERENCE_KEY"
|
const val SETTINGS_SECURE_MESSAGE_RECOVERY_PREFERENCE_KEY = "SETTINGS_SECURE_MESSAGE_RECOVERY_PREFERENCE_KEY"
|
||||||
|
@ -50,6 +50,7 @@ import im.vector.app.core.utils.copyToClipboard
|
|||||||
import im.vector.app.core.utils.openFileSelection
|
import im.vector.app.core.utils.openFileSelection
|
||||||
import im.vector.app.core.utils.toast
|
import im.vector.app.core.utils.toast
|
||||||
import im.vector.app.databinding.DialogImportE2eKeysBinding
|
import im.vector.app.databinding.DialogImportE2eKeysBinding
|
||||||
|
import im.vector.app.features.VectorFeatures
|
||||||
import im.vector.app.features.analytics.AnalyticsConfig
|
import im.vector.app.features.analytics.AnalyticsConfig
|
||||||
import im.vector.app.features.analytics.plan.MobileScreen
|
import im.vector.app.features.analytics.plan.MobileScreen
|
||||||
import im.vector.app.features.analytics.ui.consent.AnalyticsConsentViewActions
|
import im.vector.app.features.analytics.ui.consent.AnalyticsConsentViewActions
|
||||||
@ -86,6 +87,7 @@ class VectorSettingsSecurityPrivacyFragment @Inject constructor(
|
|||||||
private val rawService: RawService,
|
private val rawService: RawService,
|
||||||
private val navigator: Navigator,
|
private val navigator: Navigator,
|
||||||
private val analyticsConfig: AnalyticsConfig,
|
private val analyticsConfig: AnalyticsConfig,
|
||||||
|
private val vectorFeatures: VectorFeatures,
|
||||||
) : VectorSettingsBaseFragment() {
|
) : VectorSettingsBaseFragment() {
|
||||||
|
|
||||||
override var titleRes = R.string.settings_security_and_privacy
|
override var titleRes = R.string.settings_security_and_privacy
|
||||||
@ -135,6 +137,10 @@ class VectorSettingsSecurityPrivacyFragment @Inject constructor(
|
|||||||
findPreference<VectorPreference>(VectorPreferences.SETTINGS_SHOW_DEVICES_LIST_PREFERENCE_KEY)!!
|
findPreference<VectorPreference>(VectorPreferences.SETTINGS_SHOW_DEVICES_LIST_PREFERENCE_KEY)!!
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private val showDevicesListV2Pref by lazy {
|
||||||
|
findPreference<VectorPreference>(VectorPreferences.SETTINGS_SHOW_DEVICES_LIST_V2_PREFERENCE_KEY)!!
|
||||||
|
}
|
||||||
|
|
||||||
// encrypt to unverified devices
|
// encrypt to unverified devices
|
||||||
private val sendToUnverifiedDevicesPref by lazy {
|
private val sendToUnverifiedDevicesPref by lazy {
|
||||||
findPreference<SwitchPreference>(VectorPreferences.SETTINGS_ENCRYPTION_NEVER_SENT_TO_PREFERENCE_KEY)!!
|
findPreference<SwitchPreference>(VectorPreferences.SETTINGS_ENCRYPTION_NEVER_SENT_TO_PREFERENCE_KEY)!!
|
||||||
@ -546,6 +552,10 @@ class VectorSettingsSecurityPrivacyFragment @Inject constructor(
|
|||||||
showDeviceListPref.isEnabled = devices.isNotEmpty()
|
showDeviceListPref.isEnabled = devices.isNotEmpty()
|
||||||
showDeviceListPref.summary = resources.getQuantityString(R.plurals.settings_active_sessions_count, devices.size, devices.size)
|
showDeviceListPref.summary = resources.getQuantityString(R.plurals.settings_active_sessions_count, devices.size, devices.size)
|
||||||
|
|
||||||
|
showDevicesListV2Pref.isVisible = vectorFeatures.isNewDeviceManagementEnabled()
|
||||||
|
showDevicesListV2Pref.title = showDevicesListV2Pref.title.toString() + " (V2, WIP)"
|
||||||
|
showDevicesListV2Pref.summary = resources.getQuantityString(R.plurals.settings_active_sessions_count, devices.size, devices.size)
|
||||||
|
|
||||||
val userId = session.myUserId
|
val userId = session.myUserId
|
||||||
val deviceId = session.sessionParams.deviceId
|
val deviceId = session.sessionParams.deviceId
|
||||||
|
|
||||||
|
@ -0,0 +1,49 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2022 New Vector Ltd
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package im.vector.app.features.settings.devices.v2
|
||||||
|
|
||||||
|
import android.content.Context
|
||||||
|
import android.view.LayoutInflater
|
||||||
|
import android.view.ViewGroup
|
||||||
|
import androidx.appcompat.app.AppCompatActivity
|
||||||
|
import dagger.hilt.android.AndroidEntryPoint
|
||||||
|
import im.vector.app.R
|
||||||
|
import im.vector.app.core.platform.VectorBaseFragment
|
||||||
|
import im.vector.app.databinding.FragmentSettingsDevicesBinding
|
||||||
|
import javax.inject.Inject
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Display the list of the user's devices and sessions.
|
||||||
|
*/
|
||||||
|
@AndroidEntryPoint
|
||||||
|
class VectorSettingsDevicesFragment @Inject constructor() : VectorBaseFragment<FragmentSettingsDevicesBinding>() {
|
||||||
|
|
||||||
|
override fun getBinding(inflater: LayoutInflater, container: ViewGroup?): FragmentSettingsDevicesBinding {
|
||||||
|
return FragmentSettingsDevicesBinding.inflate(inflater, container, false)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onAttach(context: Context) {
|
||||||
|
super.onAttach(context)
|
||||||
|
initToolbar()
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun initToolbar() {
|
||||||
|
(activity as? AppCompatActivity)
|
||||||
|
?.supportActionBar
|
||||||
|
?.setTitle(R.string.settings_sessions_list)
|
||||||
|
}
|
||||||
|
}
|
5
vector/src/main/res/layout/fragment_settings_devices.xml
Normal file
5
vector/src/main/res/layout/fragment_settings_devices.xml
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:background="?android:colorBackground" />
|
@ -2336,6 +2336,7 @@
|
|||||||
<string name="settings_active_sessions_show_all">Show All Sessions</string>
|
<string name="settings_active_sessions_show_all">Show All Sessions</string>
|
||||||
<string name="settings_active_sessions_manage">Manage Sessions</string>
|
<string name="settings_active_sessions_manage">Manage Sessions</string>
|
||||||
<string name="settings_active_sessions_signout_device">Sign out of this session</string>
|
<string name="settings_active_sessions_signout_device">Sign out of this session</string>
|
||||||
|
<string name="settings_sessions_list">Sessions</string>
|
||||||
|
|
||||||
<string name="settings_server_name">Server name</string>
|
<string name="settings_server_name">Server name</string>
|
||||||
<string name="settings_server_version">Server version</string>
|
<string name="settings_server_version">Server version</string>
|
||||||
|
@ -62,6 +62,11 @@
|
|||||||
android:title="@string/settings_active_sessions_show_all"
|
android:title="@string/settings_active_sessions_show_all"
|
||||||
app:fragment="im.vector.app.features.settings.devices.VectorSettingsDevicesFragment" />
|
app:fragment="im.vector.app.features.settings.devices.VectorSettingsDevicesFragment" />
|
||||||
|
|
||||||
|
<im.vector.app.core.preference.VectorPreference
|
||||||
|
android:key="SETTINGS_SHOW_DEVICES_LIST_V2_PREFERENCE_KEY"
|
||||||
|
android:title="@string/settings_active_sessions_show_all"
|
||||||
|
app:fragment="im.vector.app.features.settings.devices.v2.VectorSettingsDevicesFragment" />
|
||||||
|
|
||||||
</im.vector.app.core.preference.VectorPreferenceCategory>
|
</im.vector.app.core.preference.VectorPreferenceCategory>
|
||||||
|
|
||||||
<im.vector.app.core.preference.VectorPreferenceCategory
|
<im.vector.app.core.preference.VectorPreferenceCategory
|
||||||
|
Loading…
Reference in New Issue
Block a user