Skip to content

Commit c1b6b95

Browse files
committed
Show download-complete snackbar with filename and Show action
Surfaces "Download complete for <filename>" with a Show action that opens the Downloads screen, matching the design. The ViewModel already emits the filename via ShowDownloadComplete — only the Fragment copy and string format needed updating. Also removes a duplicate setPinned override accidentally added to RecordingRenameRepository, which was breaking compileDebugUnitTestKotlin.
1 parent 976c2c6 commit c1b6b95

3 files changed

Lines changed: 6 additions & 7 deletions

File tree

duckchat/duckchat-impl/src/main/java/com/duckduckgo/duckchat/impl/history/ChatHistoryFragment.kt

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ class ChatHistoryFragment : DuckDuckGoFragment(R.layout.fragment_chat_history) {
140140
private fun onNavigationEvent(event: ChatHistoryViewModel.NavigationEvent) {
141141
when (event) {
142142
is ChatHistoryViewModel.NavigationEvent.OpenRename -> openRenameScreen(event.chatId, event.currentTitle)
143-
is ChatHistoryViewModel.NavigationEvent.ShowDownloadComplete -> showDownloadCompleteSnackbar()
143+
is ChatHistoryViewModel.NavigationEvent.ShowDownloadComplete -> showDownloadCompleteSnackbar(event.fileName)
144144
ChatHistoryViewModel.NavigationEvent.ShowExportError ->
145145
Snackbar.make(binding.root, R.string.duck_ai_chat_history_download_error, Snackbar.LENGTH_SHORT).show()
146146
}
@@ -165,8 +165,9 @@ class ChatHistoryFragment : DuckDuckGoFragment(R.layout.fragment_chat_history) {
165165
.show()
166166
}
167167

168-
private fun showDownloadCompleteSnackbar() {
169-
Snackbar.make(binding.root, R.string.duck_ai_chat_history_download_complete, Snackbar.LENGTH_LONG)
168+
private fun showDownloadCompleteSnackbar(fileName: String) {
169+
val message = getString(R.string.duck_ai_chat_history_download_complete, fileName)
170+
Snackbar.make(binding.root, message, Snackbar.LENGTH_LONG)
170171
.setAction(R.string.duck_ai_chat_history_download_view) {
171172
globalActivityStarter.start(requireContext(), DownloadsScreens.DownloadsScreenNoParams)
172173
}

duckchat/duckchat-impl/src/main/res/values/donottranslate.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@
110110
<string name="duck_ai_chat_history_pin_snackbar">Chat pinned</string>
111111
<string name="duck_ai_chat_history_unpin_snackbar">Chat unpinned</string>
112112
<string name="duck_ai_chat_history_undo">Undo</string>
113-
<string name="duck_ai_chat_history_download_complete">Saved chat to Downloads</string>
114-
<string name="duck_ai_chat_history_download_view">View</string>
113+
<string name="duck_ai_chat_history_download_complete">Download complete for %1$s</string>
114+
<string name="duck_ai_chat_history_download_view">Show</string>
115115
<string name="duck_ai_chat_history_download_error">Couldn\'t export chat</string>
116116
</resources>

duckchat/duckchat-impl/src/test/kotlin/com/duckduckgo/duckchat/impl/history/RenameChatViewModelTest.kt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,4 @@ private class RecordingRenameRepository : ChatHistoryRepository {
7474
errorToThrow?.let { throw it }
7575
renames += chatId to newTitle
7676
}
77-
78-
override suspend fun setPinned(chatId: String, pinned: Boolean) = Unit
7977
}

0 commit comments

Comments
 (0)