mirror of
https://gitlab.linphone.org/BC/public/linphone-android.git
synced 2026-04-27 18:16:21 +00:00
Fixed clicking on chat message notification while being in conversations list stacked it twice
This commit is contained in:
parent
7c51cf7588
commit
2ad4e76bc3
3 changed files with 14 additions and 12 deletions
|
|
@ -30,7 +30,6 @@ import android.content.Intent
|
||||||
import android.content.pm.PackageManager
|
import android.content.pm.PackageManager
|
||||||
import android.graphics.Bitmap
|
import android.graphics.Bitmap
|
||||||
import android.net.Uri
|
import android.net.Uri
|
||||||
import android.os.Bundle
|
|
||||||
import android.webkit.MimeTypeMap
|
import android.webkit.MimeTypeMap
|
||||||
import androidx.annotation.AnyThread
|
import androidx.annotation.AnyThread
|
||||||
import androidx.annotation.MainThread
|
import androidx.annotation.MainThread
|
||||||
|
|
@ -1147,15 +1146,18 @@ class NotificationsManager @MainThread constructor(private val context: Context)
|
||||||
|
|
||||||
@WorkerThread
|
@WorkerThread
|
||||||
private fun getChatRoomPendingIntent(chatRoom: ChatRoom): PendingIntent {
|
private fun getChatRoomPendingIntent(chatRoom: ChatRoom): PendingIntent {
|
||||||
val args = Bundle()
|
val mainActivityIntent = Intent(context, MainActivity::class.java)
|
||||||
args.putString("RemoteSipUri", chatRoom.peerAddress.asStringUriOnly())
|
mainActivityIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP)
|
||||||
args.putString("LocalSipUri", chatRoom.localAddress.asStringUriOnly())
|
mainActivityIntent.setAction(Intent.ACTION_MAIN)
|
||||||
return NavDeepLinkBuilder(context)
|
mainActivityIntent.putExtra("Chat", true)
|
||||||
.setComponentName(MainActivity::class.java)
|
mainActivityIntent.putExtra("RemoteSipUri", chatRoom.peerAddress.asStringUriOnly())
|
||||||
.setGraph(R.navigation.main_nav_graph)
|
mainActivityIntent.putExtra("LocalSipUri", chatRoom.localAddress.asStringUriOnly())
|
||||||
.setDestination(R.id.conversationsListFragment)
|
return PendingIntent.getActivity(
|
||||||
.setArguments(args)
|
context,
|
||||||
.createPendingIntent()
|
0,
|
||||||
|
mainActivityIntent,
|
||||||
|
PendingIntent.FLAG_UPDATE_CURRENT or PendingIntent.FLAG_IMMUTABLE
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
class Notifiable(val notificationId: Int) {
|
class Notifiable(val notificationId: Int) {
|
||||||
|
|
|
||||||
|
|
@ -369,7 +369,6 @@ class MainActivity : GenericActivity() {
|
||||||
|
|
||||||
@MainThread
|
@MainThread
|
||||||
private fun handleMainIntent(intent: Intent, defaultDestination: Int, isNewIntent: Boolean) {
|
private fun handleMainIntent(intent: Intent, defaultDestination: Int, isNewIntent: Boolean) {
|
||||||
val navGraph = findNavController().navInflater.inflate(R.navigation.main_nav_graph)
|
|
||||||
if (intent.hasExtra("Chat")) {
|
if (intent.hasExtra("Chat")) {
|
||||||
Log.i("$TAG New intent with [Chat] extra")
|
Log.i("$TAG New intent with [Chat] extra")
|
||||||
if (isNewIntent) {
|
if (isNewIntent) {
|
||||||
|
|
@ -380,12 +379,14 @@ class MainActivity : GenericActivity() {
|
||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
Log.i("$TAG Going to Conversations fragment instead of default destination")
|
Log.i("$TAG Going to Conversations fragment instead of default destination")
|
||||||
|
val navGraph = findNavController().navInflater.inflate(R.navigation.main_nav_graph)
|
||||||
navGraph.setStartDestination(R.id.conversationsListFragment)
|
navGraph.setStartDestination(R.id.conversationsListFragment)
|
||||||
findNavController().setGraph(navGraph, intent.extras)
|
findNavController().setGraph(navGraph, intent.extras)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (!isNewIntent && defaultDestination > 0) {
|
if (!isNewIntent && defaultDestination > 0) {
|
||||||
Log.i("$TAG Setting nav graph with expected default destination")
|
Log.i("$TAG Setting nav graph with expected default destination")
|
||||||
|
val navGraph = findNavController().navInflater.inflate(R.navigation.main_nav_graph)
|
||||||
navGraph.setStartDestination(defaultDestination)
|
navGraph.setStartDestination(defaultDestination)
|
||||||
findNavController().setGraph(navGraph, null)
|
findNavController().setGraph(navGraph, null)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -205,7 +205,6 @@ class ConversationFragment : SlidingPaneChildFragment() {
|
||||||
|
|
||||||
override fun goBack(): Boolean {
|
override fun goBack(): Boolean {
|
||||||
sharedViewModel.closeSlidingPaneEvent.value = Event(true)
|
sharedViewModel.closeSlidingPaneEvent.value = Event(true)
|
||||||
coreContext.notificationsManager.resetCurrentlyDisplayedChatRoomId()
|
|
||||||
|
|
||||||
// If not done this fragment won't be paused, which will cause us issues
|
// If not done this fragment won't be paused, which will cause us issues
|
||||||
val action = ConversationFragmentDirections.actionConversationFragmentToEmptyFragment()
|
val action = ConversationFragmentDirections.actionConversationFragmentToEmptyFragment()
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue