Show basic bottom sheet when pressing learn more link from other sessions section

This commit is contained in:
Maxime NATUREL 2022-09-12 15:54:15 +02:00
parent 1d11eae0cc
commit 648311e2b1
24 changed files with 222 additions and 25 deletions

View file

@ -2604,7 +2604,7 @@
<string name="explore_rooms">Explora sales</string>
<string name="device_manager_sessions_other_description">Per estar més segur, verifica les teves sessions i tanca qualsevol sessió que no reconeguis o ja no utilitzis.</string>
<string name="device_manager_sessions_other_title">Altres sessions</string>
<string name="settings_sessions_list">Sessions</string>
<string name="device_manager_sessions_list_title">Sessions</string>
<string name="a11y_open_spaces">Obre la llista d\'espais</string>
<string name="a11y_create_message">Crea un nou xat o sala</string>
<string name="room_list_filter_people">Gent</string>
@ -2674,4 +2674,4 @@
<string name="device_manager_verification_status_detail_other_session_verified">Aquesta sessió està llesta per a missatges segurs.</string>
<string name="device_manager_verification_status_detail_current_session_verified">La teva sessió actual està llesta per a missatges segurs.</string>
<string name="device_manager_verification_status_detail_current_session_unverified">Verifica la teva sessió actual obtenir missatges segurs millorats.</string>
</resources>
</resources>

View file

@ -2653,7 +2653,7 @@
<string name="device_manager_settings_active_sessions_show_all">Zobrazit všechny relace (V2, WIP)</string>
<string name="device_manager_sessions_other_description">V zájmu co nejlepšího zabezpečení ověřujte své relace a odhlašujte se ze všech relací, které již nepoznáváte nebo nepoužíváte.</string>
<string name="device_manager_sessions_other_title">Ostatní relace</string>
<string name="settings_sessions_list">Relace</string>
<string name="device_manager_sessions_list_title">Relace</string>
<string name="a11y_open_spaces">Seznam otevřených prostorů</string>
<string name="a11y_create_message">Vytvořit novou konverzaci nebo místnost</string>
<string name="room_list_filter_people">Lidé</string>

View file

@ -2589,7 +2589,7 @@
<string name="device_manager_settings_active_sessions_show_all">Alle Sitzungen anzeigen (V2, in Arbeit)</string>
<string name="device_manager_sessions_other_description">Für bestmögliche Sicherheit verifiziere deine Sitzungen und melde dich von allen ab, die du nicht erkennst oder nutzt.</string>
<string name="device_manager_sessions_other_title">Andere Sitzungen</string>
<string name="settings_sessions_list">Sitzungen</string>
<string name="device_manager_sessions_list_title">Sitzungen</string>
<string name="a11y_open_spaces">Space-Liste öffnen</string>
<string name="a11y_create_message">Beginne ein Gespräch oder erstelle einen Raum</string>
<string name="room_list_filter_favourites">Favoriten</string>

View file

@ -2594,7 +2594,7 @@
<string name="device_manager_settings_active_sessions_show_all">Näita kõiki sessioone (V2, WIP)</string>
<string name="device_manager_sessions_other_description">Parima turvalisuse nimel verifitseeri kõik oma sessioonid ning logi välja neist, mida sa enam ei kasuta.</string>
<string name="device_manager_sessions_other_title">Muud sessioonid</string>
<string name="settings_sessions_list">Sessionid</string>
<string name="device_manager_sessions_list_title">Sessionid</string>
<string name="a11y_open_spaces">Ava kogukondade loend</string>
<string name="a11y_create_message">Alusta uut vestlust või loo uus jututuba</string>
<string name="room_list_filter_people">Inimesed</string>

View file

@ -2603,7 +2603,7 @@
<string name="device_manager_settings_active_sessions_show_all">نمایش تمامی نشست‌ها (ن۲، دح‌ت)</string>
<string name="device_manager_sessions_other_description">برای امنیت بیش‌تر، نشست‌هایتان را تأیید و از هر نشستی که تشخیصش نمی‌دهید یا دیگر استفاده نمی‌کنید خارج شوید.</string>
<string name="device_manager_sessions_other_title">دیگر نشست‌ها</string>
<string name="settings_sessions_list">نشست‌ها</string>
<string name="device_manager_sessions_list_title">نشست‌ها</string>
<string name="a11y_open_spaces">گشودن سیاههٔ فضاها</string>
<string name="a11y_create_message">ایجاد اتاق یا گفت‌وگویی جدید</string>
<string name="room_list_filter_people">افراد</string>
@ -2700,4 +2700,4 @@
<string name="labs_enable_deferred_dm_summary">ایجاد پیام خصوصی فقط در نخستین پیام</string>
<string name="labs_enable_new_app_layout_summary">المنتی ساده شده با زبانه‌های انتخابی</string>
<string name="labs_enable_new_app_layout_title">به کار انداختن چینش جدید</string>
</resources>
</resources>

View file

@ -2603,7 +2603,7 @@
<string name="device_manager_settings_active_sessions_show_all">Afficher toutes les sessions (V2, en cours)</string>
<string name="device_manager_sessions_other_description">Pour une meilleure sécurité, vérifiez vos sessions et déconnectez toutes les sessions que vous ne connaissez pas ou que vous nutilisez plus.</string>
<string name="device_manager_sessions_other_title">Autres sessions</string>
<string name="settings_sessions_list">Sessions</string>
<string name="device_manager_sessions_list_title">Sessions</string>
<string name="a11y_open_spaces">Ouvrir la liste des espaces</string>
<string name="a11y_create_message">Créer une nouvelle conversation ou salon</string>
<string name="room_list_filter_people">Personnes</string>

View file

@ -2614,7 +2614,7 @@ A Visszaállítási Kulcsot tartsd biztonságos helyen, mint pl. egy jelszókeze
<string name="device_manager_settings_active_sessions_show_all">Minden munkamenet megjelenítése (V2, WIP)</string>
<string name="device_manager_sessions_other_description">A legjobb biztonság érdekében ellenőrizd a munkameneteket, és jelentkezz ki minden olyan munkamenetből, melyet már nem ismersz fel vagy nem használsz.</string>
<string name="device_manager_sessions_other_title">Más munkamenetek</string>
<string name="settings_sessions_list">Munkamenetek</string>
<string name="device_manager_sessions_list_title">Munkamenetek</string>
<string name="a11y_open_spaces">Nyitott területek listája</string>
<string name="a11y_create_message">Új beszélgetés vagy szoba létrehozása</string>
<string name="room_list_filter_people">Emberek</string>

View file

@ -2555,7 +2555,7 @@ Di masa mendatang proses verifikasi ini akan dimutakhirkan.</string>
<string name="device_manager_settings_active_sessions_show_all">Tampilkan Semua Sesi (V2, Dalam Pengembangan)</string>
<string name="device_manager_sessions_other_description">Untuk keamanan terbaik, verifikasi sesi Anda dan keluarkan sesi apa pun yang Anda tidak kenal atau Anda tidak gunakan lagi.</string>
<string name="device_manager_sessions_other_title">Sesi lainnya</string>
<string name="settings_sessions_list">Sesi</string>
<string name="device_manager_sessions_list_title">Sesi</string>
<string name="a11y_open_spaces">Buka daftar space</string>
<string name="a11y_create_message">Buat percakapan atau ruangan baru</string>
<string name="room_list_filter_people">Orang</string>

View file

@ -2594,7 +2594,7 @@
<string name="device_manager_settings_active_sessions_show_all">Mostra tutte le sessioni (V2, WIP)</string>
<string name="device_manager_sessions_other_description">Per una maggiore sicurezza, verifica le tue sessioni e disconnetti quelle che non riconosci o che non usi più.</string>
<string name="device_manager_sessions_other_title">Altre sessioni</string>
<string name="settings_sessions_list">Sessioni</string>
<string name="device_manager_sessions_list_title">Sessioni</string>
<string name="a11y_open_spaces">Apri elenco spazi</string>
<string name="a11y_create_message">Crea una nuova conversazione o stanza</string>
<string name="room_list_filter_people">Persone</string>

View file

@ -2602,7 +2602,7 @@
<string name="a11y_open_settings">Open instellingen</string>
<string name="device_manager_sessions_other_description">Voor de beste beveiliging verifieert u uw sessies en meldt u zich af bij elke sessie die u niet meer herkent of gebruikt.</string>
<string name="device_manager_sessions_other_title">Andere sessies</string>
<string name="settings_sessions_list">Sessies</string>
<string name="device_manager_sessions_list_title">Sessies</string>
<string name="a11y_open_spaces">Lijst met publieke spaces</string>
<string name="a11y_create_message">Nieuw gesprek of nieuwe kamer aanmaken</string>
<string name="room_list_filter_people">Personen</string>

View file

@ -2699,7 +2699,7 @@
<string name="a11y_open_settings">Otwórz ustawienia</string>
<string name="device_manager_sessions_other_description">Aby zapewnić najlepsze bezpieczeństwo, zweryfikuj swoje sesje i wyloguj się z każdej sesji, której już nie rozpoznajesz lub której już nie używasz.</string>
<string name="device_manager_sessions_other_title">Inne sesje</string>
<string name="settings_sessions_list">Sesje</string>
<string name="device_manager_sessions_list_title">Sesje</string>
<string name="a11y_open_spaces">Lista otwartych przestrzeni</string>
<string name="a11y_create_message">Utwórz nową rozmowę lub pokój</string>
<string name="room_list_filter_people">Ludzie</string>

View file

@ -2603,7 +2603,7 @@
<string name="device_manager_settings_active_sessions_show_all">Mostrar Todas Sessões (V2, WIP)</string>
<string name="device_manager_sessions_other_description">Para a melhor segurança, verifique suas sessões e faça signout de qualquer sessão que você não reconhece ou usa mais.</string>
<string name="device_manager_sessions_other_title">Outras sessões</string>
<string name="settings_sessions_list">Sessões</string>
<string name="device_manager_sessions_list_title">Sessões</string>
<string name="a11y_open_spaces">Abrir lista de espaços</string>
<string name="a11y_create_message">Criar uma nova conversa ou sala</string>
<string name="room_list_filter_all">Todas</string>

View file

@ -2662,7 +2662,7 @@
<string name="all_chats">Все беседы</string>
<string name="device_manager_sessions_other_description">Для лучшей безопасности заверьте свои сессии и выйдите из тех, которые более не признаёте или не используете.</string>
<string name="device_manager_sessions_other_title">Другие сессии</string>
<string name="settings_sessions_list">Сессии</string>
<string name="device_manager_sessions_list_title">Сессии</string>
<string name="a11y_create_message">Создать беседу или комнату</string>
<string name="device_manager_settings_active_sessions_show_all">Показать все сессии (V2, в разработке)</string>
<string name="room_list_filter_people">Люди</string>

View file

@ -2653,7 +2653,7 @@
<string name="device_manager_settings_active_sessions_show_all">Zobraziť všetky relácie (V2, WIP)</string>
<string name="device_manager_sessions_other_description">V záujme čo najlepšieho zabezpečenia overte svoje relácie a odhláste sa z každej relácie, ktorú už nepoznáte alebo nepoužívate.</string>
<string name="device_manager_sessions_other_title">Iné relácie</string>
<string name="settings_sessions_list">Relácie</string>
<string name="device_manager_sessions_list_title">Relácie</string>
<string name="a11y_open_spaces">Otvoriť zoznam priestorov</string>
<string name="a11y_create_message">Vytvoriť novú konverzáciu alebo miestnosť</string>
<string name="room_list_filter_people">Ľudia</string>

View file

@ -2703,7 +2703,7 @@
<string name="device_manager_settings_active_sessions_show_all">Показати всі сеанси (V2, WIP)</string>
<string name="device_manager_sessions_other_description">Для найкращої безпеки перевірте свої сеанси та вийдіть з усіх сеансів, які ви більше не розпізнаєте або не використовуєте.</string>
<string name="device_manager_sessions_other_title">Інші сеанси</string>
<string name="settings_sessions_list">Сеанси</string>
<string name="device_manager_sessions_list_title">Сеанси</string>
<string name="a11y_open_spaces">Відкрити список кімнат</string>
<string name="a11y_create_message">Створити нову розмову або кімнату</string>
<string name="room_list_filter_people">Люди</string>

View file

@ -2553,7 +2553,7 @@
<string name="device_manager_settings_active_sessions_show_all">显示全部会话V2, WIP</string>
<string name="device_manager_sessions_other_description">为获得最佳安全性,请验证你的会话,并从任何你不认识或不再使用的会话登出。</string>
<string name="device_manager_sessions_other_title">其他会话</string>
<string name="settings_sessions_list">会话</string>
<string name="device_manager_sessions_list_title">会话</string>
<string name="a11y_open_spaces">打开空间列表</string>
<string name="a11y_create_message">创建新对话或房间</string>
<string name="room_list_filter_people"></string>

View file

@ -2553,7 +2553,7 @@
<string name="device_manager_settings_active_sessions_show_all">顯示所有工作階段 (V2, WIP)</string>
<string name="device_manager_sessions_other_description">為了取得最佳安全性,請驗證您的工作階段並登出任何您無法識別或不再使用的工作階段。</string>
<string name="device_manager_sessions_other_title">其他工作階段</string>
<string name="settings_sessions_list">工作階段</string>
<string name="device_manager_sessions_list_title">工作階段</string>
<string name="a11y_open_spaces">開啟空間清單</string>
<string name="a11y_create_message">建立新的對話或聊天室</string>
<string name="room_list_filter_people">聯絡人</string>

View file

@ -2365,9 +2365,6 @@
<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_signout_device">Sign out of this session</string>
<string name="settings_sessions_list">Sessions</string>
<string name="device_manager_sessions_other_title">Other sessions</string>
<string name="device_manager_sessions_other_description">For best security, verify your sessions and sign out from any session that you dont recognize or use anymore.</string>
<string name="settings_server_name">Server name</string>
<string name="settings_server_version">Server version</string>
@ -3229,6 +3226,9 @@
<!-- Device Manager -->
<string name="device_manager_settings_active_sessions_show_all">Show All Sessions (V2, WIP)</string>
<string name="device_manager_sessions_list_title">Sessions</string>
<string name="device_manager_sessions_other_title">Other sessions</string>
<string name="device_manager_sessions_other_description">For best security, verify your sessions and sign out from any session that you dont recognize or use anymore.</string>
<string name="a11y_device_manager_device_type_mobile">Mobile</string>
<string name="a11y_device_manager_device_type_web">Web</string>
<string name="a11y_device_manager_device_type_desktop">Desktop</string>

View file

@ -90,6 +90,7 @@ import im.vector.app.features.settings.devices.DeviceVerificationInfoBottomSheet
import im.vector.app.features.settings.devices.DevicesViewModel
import im.vector.app.features.settings.devices.v2.details.SessionDetailsViewModel
import im.vector.app.features.settings.devices.v2.othersessions.OtherSessionsViewModel
import im.vector.app.features.settings.devices.v2.more.SessionLearnMoreViewModel
import im.vector.app.features.settings.devices.v2.overview.SessionOverviewViewModel
import im.vector.app.features.settings.devices.v2.rename.RenameSessionViewModel
import im.vector.app.features.settings.devtools.AccountDataViewModel
@ -659,4 +660,9 @@ interface MavericksViewModelModule {
@IntoMap
@MavericksViewModelKey(RenameSessionViewModel::class)
fun renameSessionViewModelFactory(factory: RenameSessionViewModel.Factory): MavericksAssistedViewModelFactory<*, *>
@Binds
@IntoMap
@MavericksViewModelKey(SessionLearnMoreViewModel::class)
fun sessionLearnMoreViewModelFactory(factory: SessionLearnMoreViewModel.Factory): MavericksAssistedViewModelFactory<*, *>
}

View file

@ -21,7 +21,6 @@ import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.Toast
import androidx.appcompat.app.AppCompatActivity
import androidx.core.view.isVisible
import com.airbnb.mvrx.Success
@ -44,6 +43,7 @@ import im.vector.app.features.settings.devices.v2.list.SESSION_IS_MARKED_AS_INAC
import im.vector.app.features.settings.devices.v2.list.SecurityRecommendationView
import im.vector.app.features.settings.devices.v2.list.SecurityRecommendationViewState
import im.vector.app.features.settings.devices.v2.list.SessionInfoViewState
import im.vector.app.features.settings.devices.v2.more.SessionLearnMoreBottomSheet
import javax.inject.Inject
/**
@ -76,7 +76,7 @@ class VectorSettingsDevicesFragment :
private fun initToolbar() {
(activity as? AppCompatActivity)
?.supportActionBar
?.setTitle(R.string.settings_sessions_list)
?.setTitle(R.string.device_manager_sessions_list_title)
}
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
@ -157,10 +157,22 @@ class VectorSettingsDevicesFragment :
private fun initLearnMoreButtons() {
views.deviceListHeaderOtherSessions.onLearnMoreClickListener = {
Toast.makeText(context, "Learn more other", Toast.LENGTH_LONG).show()
showLearnMoreInfoOtherSessions()
}
}
private fun showLearnMoreInfoOtherSessions() {
val args = SessionLearnMoreBottomSheet.Args(
title = getString(R.string.device_manager_sessions_other_title),
description = buildString {
append(getString(R.string.device_manager_learn_more_sessions_unverified))
append("\n\n")
append(getString(R.string.device_manager_learn_more_sessions_inactive))
}
)
SessionLearnMoreBottomSheet.show(childFragmentManager, args)
}
private fun cleanUpLearnMoreButtonsListeners() {
views.deviceListHeaderOtherSessions.onLearnMoreClickListener = null
}

View file

@ -0,0 +1,62 @@
/*
* Copyright (c) 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.more
import android.os.Parcelable
import android.view.LayoutInflater
import android.view.ViewGroup
import androidx.fragment.app.FragmentManager
import com.airbnb.mvrx.fragmentViewModel
import com.airbnb.mvrx.withState
import dagger.hilt.android.AndroidEntryPoint
import im.vector.app.core.platform.VectorBaseBottomSheetDialogFragment
import im.vector.app.databinding.BottomSheetSessionLearnMoreBinding
import kotlinx.parcelize.Parcelize
@AndroidEntryPoint
class SessionLearnMoreBottomSheet : VectorBaseBottomSheetDialogFragment<BottomSheetSessionLearnMoreBinding>() {
@Parcelize
data class Args(
val title: String,
val description: String,
) : Parcelable
private val viewModel: SessionLearnMoreViewModel by fragmentViewModel()
override val showExpanded = true
override fun getBinding(inflater: LayoutInflater, container: ViewGroup?): BottomSheetSessionLearnMoreBinding {
return BottomSheetSessionLearnMoreBinding.inflate(inflater, container, false)
}
override fun invalidate() = withState(viewModel) { viewState ->
super.invalidate()
views.bottomSheetSessionLearnMoreTitle.text = viewState.title
views.bottomSheetSessionLearnMoreDescription.text = viewState.description
}
companion object {
fun show(fragmentManager: FragmentManager, args: Args) {
val bottomSheet = SessionLearnMoreBottomSheet()
bottomSheet.isCancelable = true
bottomSheet.setArguments(args)
bottomSheet.show(fragmentManager, "SessionLearnMoreBottomSheet")
}
}
}

View file

@ -0,0 +1,43 @@
/*
* Copyright (c) 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.more
import com.airbnb.mvrx.MavericksViewModelFactory
import dagger.assisted.Assisted
import dagger.assisted.AssistedFactory
import dagger.assisted.AssistedInject
import im.vector.app.core.di.MavericksAssistedViewModelFactory
import im.vector.app.core.di.hiltMavericksViewModelFactory
import im.vector.app.core.platform.EmptyAction
import im.vector.app.core.platform.EmptyViewEvents
import im.vector.app.core.platform.VectorViewModel
class SessionLearnMoreViewModel @AssistedInject constructor(
@Assisted initialState: SessionLearnMoreViewState,
) : VectorViewModel<SessionLearnMoreViewState, EmptyAction, EmptyViewEvents>(initialState) {
@AssistedFactory
interface Factory : MavericksAssistedViewModelFactory<SessionLearnMoreViewModel, SessionLearnMoreViewState> {
override fun create(initialState: SessionLearnMoreViewState): SessionLearnMoreViewModel
}
companion object : MavericksViewModelFactory<SessionLearnMoreViewModel, SessionLearnMoreViewState> by hiltMavericksViewModelFactory()
override fun handle(action: EmptyAction) {
// do nothing
}
}

View file

@ -0,0 +1,29 @@
/*
* Copyright (c) 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.more
import com.airbnb.mvrx.MavericksState
data class SessionLearnMoreViewState(
val title: String,
val description: String,
) : MavericksState {
constructor(args: SessionLearnMoreBottomSheet.Args) : this(
title = args.title,
description = args.description,
)
}

View file

@ -0,0 +1,45 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.core.widget.NestedScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/bottomSheetScrollView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:animateLayoutChanges="true"
android:background="?colorSurface"
android:fadeScrollbars="false"
android:scrollbars="vertical">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingHorizontal="24dp"
android:paddingVertical="16dp">
<TextView
android:id="@+id/bottomSheetSessionLearnMoreTitle"
style="@style/TextAppearance.Vector.Subtitle.Medium.DevicesManagement"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintBottom_toTopOf="@id/bottomSheetSessionLearnMoreDescription"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:text="Verified sessions" />
<TextView
android:id="@+id/bottomSheetSessionLearnMoreDescription"
style="@style/TextAppearance.Vector.Body"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/bottomSheetSessionLearnMoreTitle"
tools:text="Further context on verified sessions. What do those mean, and how do they differ from unverified ones." />
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.core.widget.NestedScrollView>