Added logs & fixed nav graph id

This commit is contained in:
Sylvain Berfini 2023-09-09 17:50:43 +02:00
parent 619ab8a6ed
commit 702504e1d5
5 changed files with 16 additions and 5 deletions

View file

@ -38,6 +38,10 @@ import org.linphone.utils.SlidingPaneBackPressedCallback
@UiThread @UiThread
class CallsFragment : GenericFragment() { class CallsFragment : GenericFragment() {
companion object {
private const val TAG = "[Calls Fragment]"
}
private lateinit var binding: CallsFragmentBinding private lateinit var binding: CallsFragmentBinding
override fun onCreateView( override fun onCreateView(
@ -65,6 +69,7 @@ class CallsFragment : GenericFragment() {
sharedViewModel.callsListReadyToBeDisplayedEvent.observe(viewLifecycleOwner) { sharedViewModel.callsListReadyToBeDisplayedEvent.observe(viewLifecycleOwner) {
it.consume { it.consume {
Log.i("$TAG Calls list is ready, starting postponed enter transition")
startPostponedEnterTransition() startPostponedEnterTransition()
} }
} }
@ -85,6 +90,7 @@ class CallsFragment : GenericFragment() {
viewLifecycleOwner viewLifecycleOwner
) { ) {
it.consume { it.consume {
Log.i("$TAG Closing sliding pane")
binding.slidingPaneLayout.closePane() binding.slidingPaneLayout.closePane()
} }
} }
@ -93,12 +99,14 @@ class CallsFragment : GenericFragment() {
viewLifecycleOwner viewLifecycleOwner
) { ) {
it.consume { it.consume {
Log.i("$TAG Opening sliding pane")
binding.slidingPaneLayout.openPane() binding.slidingPaneLayout.openPane()
} }
} }
sharedViewModel.showStartCallEvent.observe(viewLifecycleOwner) { sharedViewModel.showStartCallEvent.observe(viewLifecycleOwner) {
it.consume { it.consume {
Log.i("$TAG Navigating to start call fragment")
findNavController().navigate(R.id.action_global_startCallFragment) findNavController().navigate(R.id.action_global_startCallFragment)
} }
} }
@ -107,7 +115,7 @@ class CallsFragment : GenericFragment() {
viewLifecycleOwner viewLifecycleOwner
) { ) {
it.consume { callId -> it.consume { callId ->
Log.i("[Calls Fragment] Displaying call log with call ID [$callId]") Log.i("$TAG Displaying call log with call ID [$callId]")
val navController = binding.callsNavContainer.findNavController() val navController = binding.callsNavContainer.findNavController()
val action = CallFragmentDirections.actionGlobalCallFragment( val action = CallFragmentDirections.actionGlobalCallFragment(
callId callId

View file

@ -130,6 +130,7 @@ class CallsListFragment : GenericFragment() {
adapter.callLogClickedEvent.observe(viewLifecycleOwner) { adapter.callLogClickedEvent.observe(viewLifecycleOwner) {
it.consume { model -> it.consume { model ->
Log.i("$TAG Show details for call log with ID [${model.id}]")
sharedViewModel.showCallLogEvent.value = Event(model.id ?: "") sharedViewModel.showCallLogEvent.value = Event(model.id ?: "")
} }
} }
@ -147,6 +148,7 @@ class CallsListFragment : GenericFragment() {
binding.callsList.layoutManager = layoutManager binding.callsList.layoutManager = layoutManager
listViewModel.callLogs.observe(viewLifecycleOwner) { listViewModel.callLogs.observe(viewLifecycleOwner) {
Log.i("$TAG Call logs ready with [${it.size}] items")
adapter.submitList(it) adapter.submitList(it)
binding.callsList.scrollToPosition(0) binding.callsList.scrollToPosition(0)
@ -158,6 +160,7 @@ class CallsListFragment : GenericFragment() {
listViewModel.historyDeletedEvent.observe(viewLifecycleOwner) { listViewModel.historyDeletedEvent.observe(viewLifecycleOwner) {
it.consume { it.consume {
Log.w("$TAG Deleting all call history")
// TODO FIXME: show translated string // TODO FIXME: show translated string
(requireActivity() as MainActivity).showGreenToast( (requireActivity() as MainActivity).showGreenToast(
"Historique supprimé", "Historique supprimé",

View file

@ -58,11 +58,11 @@ class StartCallFragment : GenericFragment() {
private lateinit var binding: CallStartFragmentBinding private lateinit var binding: CallStartFragmentBinding
private val viewModel: StartCallViewModel by navGraphViewModels( private val viewModel: StartCallViewModel by navGraphViewModels(
R.id.voip_nav_graph R.id.main_nav_graph
) )
private val contactsListViewModel: ContactsListViewModel by navGraphViewModels( private val contactsListViewModel: ContactsListViewModel by navGraphViewModels(
R.id.voip_nav_graph R.id.main_nav_graph
) )
private lateinit var contactsAdapter: ContactsListAdapter private lateinit var contactsAdapter: ContactsListAdapter

View file

@ -2,7 +2,7 @@
<navigation xmlns:android="http://schemas.android.com/apk/res/android" <navigation xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/calls_right_nav_graph" android:id="@+id/calls_nav_graph"
app:startDestination="@id/emptyFragment"> app:startDestination="@id/emptyFragment">
<fragment <fragment

View file

@ -2,7 +2,7 @@
<navigation xmlns:android="http://schemas.android.com/apk/res/android" <navigation xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/contact_right_nav_graph" android:id="@+id/contact_nav_graph"
app:startDestination="@id/emptyFragment"> app:startDestination="@id/emptyFragment">
<fragment <fragment