mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-09-20 00:35:47 +01:00
Avoid erroneous chat folder education sheet.
This commit is contained in:
committed by
Cody Henthorne
parent
7b01d881ad
commit
296fdade07
+7
-9
@@ -74,6 +74,13 @@ class ChatFoldersFragment : ComposeFragment() {
|
||||
val navController: NavController by remember { mutableStateOf(findNavController()) }
|
||||
viewModel.loadCurrentFolders(requireContext())
|
||||
|
||||
LaunchedEffect(Unit) {
|
||||
if (viewModel.shouldShowEducationSheet()) {
|
||||
SignalStore.uiHints.hasSeenChatFoldersEducationSheet = true
|
||||
navController.safeNavigate(R.id.action_chatFoldersFragment_to_chatFoldersEducationSheet)
|
||||
}
|
||||
}
|
||||
|
||||
Scaffolds.Settings(
|
||||
title = stringResource(id = R.string.ChatsSettingsFragment__chat_folders),
|
||||
onNavigationClick = { requireActivity().onNavigateUp() },
|
||||
@@ -82,7 +89,6 @@ class ChatFoldersFragment : ComposeFragment() {
|
||||
) { contentPadding: PaddingValues ->
|
||||
FoldersScreen(
|
||||
state = state,
|
||||
navController = navController,
|
||||
modifier = Modifier.padding(contentPadding),
|
||||
onFolderClicked = {
|
||||
navController.safeNavigate(ChatFoldersFragmentDirections.actionChatFoldersFragmentToCreateFoldersFragment(it.id, null))
|
||||
@@ -116,7 +122,6 @@ class ChatFoldersFragment : ComposeFragment() {
|
||||
@Composable
|
||||
fun FoldersScreen(
|
||||
state: ChatFoldersSettingsState,
|
||||
navController: NavController? = null,
|
||||
modifier: Modifier = Modifier,
|
||||
onFolderClicked: (ChatFolderRecord) -> Unit = {},
|
||||
onAdd: (ChatFolderRecord) -> Unit = {},
|
||||
@@ -128,13 +133,6 @@ fun FoldersScreen(
|
||||
val listState = rememberLazyListState()
|
||||
val reorderableListState = rememberReorderableListState(listState, includeHeader = true, includeFooter = true, onEvent = onReorderListEvent)
|
||||
|
||||
LaunchedEffect(Unit) {
|
||||
if (!SignalStore.uiHints.hasSeenChatFoldersEducationSheet) {
|
||||
SignalStore.uiHints.hasSeenChatFoldersEducationSheet = true
|
||||
navController?.safeNavigate(R.id.action_chatFoldersFragment_to_chatFoldersEducationSheet)
|
||||
}
|
||||
}
|
||||
|
||||
if (state.showDeleteDialog) {
|
||||
Dialogs.SimpleAlertDialog(
|
||||
title = "",
|
||||
|
||||
+12
@@ -8,10 +8,12 @@ import kotlinx.coroutines.flow.MutableStateFlow
|
||||
import kotlinx.coroutines.flow.asStateFlow
|
||||
import kotlinx.coroutines.flow.update
|
||||
import kotlinx.coroutines.launch
|
||||
import kotlinx.coroutines.withContext
|
||||
import org.signal.core.util.swap
|
||||
import org.thoughtcrime.securesms.R
|
||||
import org.thoughtcrime.securesms.contacts.paged.ChatType
|
||||
import org.thoughtcrime.securesms.database.SignalDatabase
|
||||
import org.thoughtcrime.securesms.keyvalue.SignalStore
|
||||
import org.thoughtcrime.securesms.recipients.Recipient
|
||||
import org.thoughtcrime.securesms.recipients.RecipientId
|
||||
|
||||
@@ -39,6 +41,16 @@ class ChatFoldersViewModel : ViewModel() {
|
||||
}
|
||||
}
|
||||
|
||||
suspend fun shouldShowEducationSheet(): Boolean {
|
||||
if (SignalStore.uiHints.hasSeenChatFoldersEducationSheet) {
|
||||
return false
|
||||
}
|
||||
|
||||
return withContext(Dispatchers.Default) {
|
||||
ChatFoldersRepository.getFolderCount() == 1
|
||||
}
|
||||
}
|
||||
|
||||
private fun getSuggestedFolders(context: Context, currentFolders: List<ChatFolderRecord>): List<ChatFolderRecord> {
|
||||
var showIndividualSuggestion = true
|
||||
var showGroupSuggestion = true
|
||||
|
||||
+1
-1
@@ -106,7 +106,7 @@ class CreateFoldersFragment : ComposeFragment() {
|
||||
}
|
||||
|
||||
LaunchedEffect(Unit) {
|
||||
if (!SignalStore.uiHints.hasSeenChatFoldersEducationSheet) {
|
||||
if (viewModel.shouldShowEducationSheet()) {
|
||||
SignalStore.uiHints.hasSeenChatFoldersEducationSheet = true
|
||||
navController.safeNavigate(R.id.action_createFoldersFragment_to_chatFoldersEducationSheet)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user