Added toast to let user know when files are waiting for a conversation to be opened to add files in it

This commit is contained in:
Sylvain Berfini 2023-12-13 13:13:51 +01:00
parent d5b0d82adc
commit 678949aff2
2 changed files with 18 additions and 0 deletions

View file

@ -46,6 +46,7 @@ import org.linphone.ui.main.chat.viewmodel.ConversationsListViewModel
import org.linphone.ui.main.fragment.AbstractTopBarFragment
import org.linphone.ui.main.history.fragment.HistoryMenuDialogFragment
import org.linphone.ui.main.viewer.fragment.FileViewerFragmentDirections
import org.linphone.utils.AppUtils
import org.linphone.utils.Event
import org.linphone.utils.FileUtils
@ -310,6 +311,19 @@ class ConversationsListFragment : AbstractTopBarFragment() {
Log.e("$TAG Failed to unregister data observer to adapter: $e")
}
val filesToShare = sharedViewModel.filesToShareFromIntent.value.orEmpty()
if (filesToShare.isNotEmpty()) {
val count = filesToShare.size
val message = AppUtils.getStringWithPlural(
R.plurals.toast_files_waiting_to_be_shared,
count,
filesToShare.size.toString()
)
val icon = R.drawable.file
(requireActivity() as MainActivity).showGreenToast(message, icon)
Log.i("$TAG Found [$count] files waiting to be shared")
}
// Scroll to top when fragment is resumed
binding.conversationsList.scrollToPosition(0)
}

View file

@ -156,6 +156,10 @@
<string name="toast_group_conversation_left">You have left the group</string>
<string name="toast_low_media_volume">Media volume is low, you may not hear anything!</string>
<string name="toast_no_app_registered_to_handle_content_type_error">No app found to open this kind of file</string>
<plurals name="toast_files_waiting_to_be_shared">
<item quantity="one">%s file waiting to be shared</item>
<item quantity="other">%s files waiting to be shared</item>
</plurals>
<string name="assistant_account_login">Login</string>
<string name="assistant_scan_qr_code">Scan QR code</string>