diff --git a/FlowCrypt/src/main/java/com/flowcrypt/email/database/dao/MessageDao.kt b/FlowCrypt/src/main/java/com/flowcrypt/email/database/dao/MessageDao.kt index 99badc86f..90cdee30f 100644 --- a/FlowCrypt/src/main/java/com/flowcrypt/email/database/dao/MessageDao.kt +++ b/FlowCrypt/src/main/java/com/flowcrypt/email/database/dao/MessageDao.kt @@ -424,7 +424,7 @@ abstract class MessageDao : BaseDao { abstract suspend fun getMessagesForGmailThread( account: String, folder: String, - threadId: String + threadId: Long ): List @Query("DELETE FROM messages WHERE account = :account AND folder = :folder AND thread_id = :threadId AND is_visible = 0") diff --git a/FlowCrypt/src/main/java/com/flowcrypt/email/jetpack/viewmodel/ThreadDetailsViewModel.kt b/FlowCrypt/src/main/java/com/flowcrypt/email/jetpack/viewmodel/ThreadDetailsViewModel.kt index 890a3e5a3..13ca801b4 100644 --- a/FlowCrypt/src/main/java/com/flowcrypt/email/jetpack/viewmodel/ThreadDetailsViewModel.kt +++ b/FlowCrypt/src/main/java/com/flowcrypt/email/jetpack/viewmodel/ThreadDetailsViewModel.kt @@ -99,7 +99,7 @@ class ThreadDetailsViewModel( val cachedEntities = roomDatabase.msgDao().getMessagesForGmailThread( activeAccount.email, GmailApiHelper.LABEL_INBOX,//fix me - threadMessageEntity.threadIdAsHEX, + threadMessageEntity.threadId ?: 0, ) val finalList = messageEntities.map { fromServerMessageEntity -> diff --git a/FlowCrypt/src/main/java/com/flowcrypt/email/ui/activity/fragment/ThreadDetailsFragment.kt b/FlowCrypt/src/main/java/com/flowcrypt/email/ui/activity/fragment/ThreadDetailsFragment.kt index 9067b86a2..b53172b35 100644 --- a/FlowCrypt/src/main/java/com/flowcrypt/email/ui/activity/fragment/ThreadDetailsFragment.kt +++ b/FlowCrypt/src/main/java/com/flowcrypt/email/ui/activity/fragment/ThreadDetailsFragment.kt @@ -12,6 +12,7 @@ import android.view.ViewGroup import androidx.fragment.app.viewModels import androidx.lifecycle.ViewModel import androidx.lifecycle.lifecycleScope +import androidx.navigation.NavDirections import androidx.navigation.fragment.navArgs import androidx.recyclerview.widget.LinearLayoutManager import com.flowcrypt.email.R @@ -24,7 +25,6 @@ import com.flowcrypt.email.extensions.androidx.fragment.app.launchAndRepeatWithV import com.flowcrypt.email.extensions.androidx.fragment.app.navController import com.flowcrypt.email.extensions.androidx.fragment.app.supportActionBar import com.flowcrypt.email.extensions.androidx.fragment.app.toast -import com.flowcrypt.email.extensions.androidx.navigation.navigateSafe import com.flowcrypt.email.jetpack.lifecycle.CustomAndroidViewModelFactory import com.flowcrypt.email.jetpack.viewmodel.ThreadDetailsViewModel import com.flowcrypt.email.ui.activity.fragment.base.BaseFragment @@ -82,16 +82,18 @@ class ThreadDetailsFragment : BaseFragment(), messageEntity.folder, messageEntity.uid )?.id?.let { - navController?.navigateSafe( - currentDestinationId = R.id.threadDetailsFragment, - directions = MessagesListFragmentDirections - .actionMessagesListFragmentToViewPagerThreadDetailsFragment( + navController?.navigate( + object : NavDirections { + override val actionId = R.id.viewPagerMessageDetailsFragment + override val arguments = ViewPagerMessageDetailsFragmentArgs( messageEntityId = it, localFolder = LocalFolder( messageEntity.account, GmailApiHelper.LABEL_INBOX - )//fix me - ) + ),//fix me, + sortedEntityIdListForThread = getSortedEntityIdListForThread() + ).toBundle() + } ) } } diff --git a/FlowCrypt/src/main/res/navigation/nav_graph.xml b/FlowCrypt/src/main/res/navigation/nav_graph.xml index 419512b3f..2ac015f71 100644 --- a/FlowCrypt/src/main/res/navigation/nav_graph.xml +++ b/FlowCrypt/src/main/res/navigation/nav_graph.xml @@ -354,6 +354,9 @@ +