Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: add conversation to folder after its creation [WPB-15892] #3867

Merged
merged 2 commits into from
Feb 7, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,9 @@ data class ConversationFoldersNavArgs(

@Parcelize
data class ConversationFoldersNavBackArgs(val message: String) : Parcelable

@Parcelize
data class NewConversationFolderNavBackArgs(
val folderName: String,
val folderId: String
) : Parcelable
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ import com.wire.android.ui.common.topappbar.WireCenterAlignedTopAppBar
import com.wire.android.ui.common.typography
import com.wire.android.ui.destinations.NewConversationFolderScreenDestination
import com.wire.kalium.logic.data.conversation.ConversationFolder
import com.wire.kalium.logic.data.conversation.FolderType

@RootNavGraph
@WireDestination(
Expand All @@ -70,7 +71,7 @@ fun ConversationFoldersScreen(
args: ConversationFoldersNavArgs,
navigator: Navigator,
resultNavigator: ResultBackNavigator<ConversationFoldersNavBackArgs>,
resultRecipient: ResultRecipient<NewConversationFolderScreenDestination, String>,
resultRecipient: ResultRecipient<NewConversationFolderScreenDestination, NewConversationFolderNavBackArgs>,
foldersViewModel: ConversationFoldersVM =
hiltViewModel<ConversationFoldersVMImpl, ConversationFoldersVMImpl.Factory>(
creationCallback = { it.create(ConversationFoldersStateArgs(args.currentFolderId)) }
Expand Down Expand Up @@ -104,7 +105,13 @@ fun ConversationFoldersScreen(
when (it) {
NavResult.Canceled -> {}
is NavResult.Value -> {
foldersViewModel.onFolderSelected(it.value)
moveToFolderVM.moveConversationToFolder(
ConversationFolder(
it.value.folderId,
it.value.folderName,
FolderType.USER
)
)
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,13 +66,18 @@ import com.wire.android.util.ui.SnackBarMessageHandler
@Composable
fun NewConversationFolderScreen(
navigator: Navigator,
resultNavigator: ResultBackNavigator<String>,
resultNavigator: ResultBackNavigator<NewConversationFolderNavBackArgs>,
viewModel: NewFolderViewModel = hiltViewModel()
) {

LaunchedEffect(viewModel.folderNameState.folderId) {
if (viewModel.folderNameState.folderId != null) {
resultNavigator.navigateBack(viewModel.folderNameState.folderId!!)
resultNavigator.navigateBack(
NewConversationFolderNavBackArgs(
viewModel.textState.text.toString(),
viewModel.folderNameState.folderId!!
)
)
}
}

Expand Down
Loading