Skip to content

Commit

Permalink
fix: add conversation to folder after its creation [WPB-15892] (#3867)
Browse files Browse the repository at this point in the history
  • Loading branch information
Garzas authored Feb 7, 2025
1 parent 312f973 commit 94bd1dc
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 4 deletions.
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

0 comments on commit 94bd1dc

Please sign in to comment.