Fixed UI issues when sharing file(s) from third party using shortcut API
This commit is contained in:
parent
23211f49ea
commit
9874b04d9c
8 changed files with 17 additions and 17 deletions
|
@ -454,6 +454,7 @@ class MainActivity : GenericActivity(), SnackBarActivity, NavController.OnDestin
|
||||||
findNavController(R.id.nav_host_fragment).navigate(Uri.parse(deepLink))
|
findNavController(R.id.nav_host_fragment).navigate(Uri.parse(deepLink))
|
||||||
} else {
|
} else {
|
||||||
Log.e("[Main Activity] Failed to parse shortcut/locus id: $id")
|
Log.e("[Main Activity] Failed to parse shortcut/locus id: $id")
|
||||||
|
findNavController(R.id.nav_host_fragment).navigate(R.id.action_global_masterChatRoomsFragment)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -318,6 +318,8 @@ class DetailChatRoomFragment : MasterFragment<ChatRoomDetailFragmentBinding, Cha
|
||||||
if (sharedViewModel.isSlidingPaneSlideable.value == true) {
|
if (sharedViewModel.isSlidingPaneSlideable.value == true) {
|
||||||
Log.i("[Chat Room] Forwarding message, going to chat rooms list")
|
Log.i("[Chat Room] Forwarding message, going to chat rooms list")
|
||||||
sharedViewModel.closeSlidingPaneEvent.value = Event(true)
|
sharedViewModel.closeSlidingPaneEvent.value = Event(true)
|
||||||
|
} else {
|
||||||
|
navigateToEmptyChatRoom()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -148,11 +148,7 @@ class MasterChatRoomsFragment : MasterFragment<ChatRoomMasterFragmentBinding, Ch
|
||||||
binding.slidingPane.addPanelSlideListener(object : SlidingPaneLayout.PanelSlideListener {
|
binding.slidingPane.addPanelSlideListener(object : SlidingPaneLayout.PanelSlideListener {
|
||||||
override fun onPanelSlide(panel: View, slideOffset: Float) { }
|
override fun onPanelSlide(panel: View, slideOffset: Float) { }
|
||||||
|
|
||||||
override fun onPanelOpened(panel: View) {
|
override fun onPanelOpened(panel: View) { }
|
||||||
/* if (binding.slidingPane.isSlideable) {
|
|
||||||
(requireActivity() as MainActivity).hideTabsFragment()
|
|
||||||
} */
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onPanelClosed(panel: View) {
|
override fun onPanelClosed(panel: View) {
|
||||||
if (binding.slidingPane.isSlideable) {
|
if (binding.slidingPane.isSlideable) {
|
||||||
|
@ -326,6 +322,7 @@ class MasterChatRoomsFragment : MasterFragment<ChatRoomMasterFragmentBinding, Ch
|
||||||
// val activity = requireActivity() as MainActivity
|
// val activity = requireActivity() as MainActivity
|
||||||
// activity.showSnackBar(R.string.chat_room_toast_choose_for_sharing)
|
// activity.showSnackBar(R.string.chat_room_toast_choose_for_sharing)
|
||||||
listViewModel.textSharingPending.value = true
|
listViewModel.textSharingPending.value = true
|
||||||
|
clearDisplayedChatRoom()
|
||||||
} else {
|
} else {
|
||||||
if (sharedViewModel.filesToShare.value.isNullOrEmpty()) {
|
if (sharedViewModel.filesToShare.value.isNullOrEmpty()) {
|
||||||
listViewModel.textSharingPending.value = false
|
listViewModel.textSharingPending.value = false
|
||||||
|
@ -341,6 +338,7 @@ class MasterChatRoomsFragment : MasterFragment<ChatRoomMasterFragmentBinding, Ch
|
||||||
// val activity = requireActivity() as MainActivity
|
// val activity = requireActivity() as MainActivity
|
||||||
// activity.showSnackBar(R.string.chat_room_toast_choose_for_sharing)
|
// activity.showSnackBar(R.string.chat_room_toast_choose_for_sharing)
|
||||||
listViewModel.fileSharingPending.value = true
|
listViewModel.fileSharingPending.value = true
|
||||||
|
clearDisplayedChatRoom()
|
||||||
} else {
|
} else {
|
||||||
if (sharedViewModel.textToShare.value.isNullOrEmpty()) {
|
if (sharedViewModel.textToShare.value.isNullOrEmpty()) {
|
||||||
listViewModel.fileSharingPending.value = false
|
listViewModel.fileSharingPending.value = false
|
||||||
|
|
|
@ -86,9 +86,7 @@ class Api29Compatibility {
|
||||||
fun setLocusIdInContentCaptureSession(root: View, chatRoom: ChatRoom) {
|
fun setLocusIdInContentCaptureSession(root: View, chatRoom: ChatRoom) {
|
||||||
val session: ContentCaptureSession? = root.contentCaptureSession
|
val session: ContentCaptureSession? = root.contentCaptureSession
|
||||||
if (session != null) {
|
if (session != null) {
|
||||||
val localAddress = chatRoom.localAddress.asStringUriOnly()
|
val id = LinphoneUtils.getChatRoomId(chatRoom.localAddress, chatRoom.peerAddress)
|
||||||
val peerAddress = chatRoom.peerAddress.asStringUriOnly()
|
|
||||||
val id = LinphoneUtils.getChatRoomId(localAddress, peerAddress)
|
|
||||||
session.contentCaptureContext = ContentCaptureContext.forLocusId(id)
|
session.contentCaptureContext = ContentCaptureContext.forLocusId(id)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,11 +46,8 @@ class Api30Compatibility {
|
||||||
}
|
}
|
||||||
|
|
||||||
fun removeChatRoomShortcut(context: Context, chatRoom: ChatRoom) {
|
fun removeChatRoomShortcut(context: Context, chatRoom: ChatRoom) {
|
||||||
val peerAddress = chatRoom.peerAddress.asStringUriOnly()
|
|
||||||
val localAddress = chatRoom.localAddress.asStringUriOnly()
|
|
||||||
|
|
||||||
val shortcutManager = context.getSystemService(ShortcutManager::class.java)
|
val shortcutManager = context.getSystemService(ShortcutManager::class.java)
|
||||||
val id = LinphoneUtils.getChatRoomId(localAddress, peerAddress)
|
val id = LinphoneUtils.getChatRoomId(chatRoom.localAddress, chatRoom.peerAddress)
|
||||||
val shortcutsToRemoveList = arrayListOf(id)
|
val shortcutsToRemoveList = arrayListOf(id)
|
||||||
shortcutManager.removeLongLivedShortcuts(shortcutsToRemoveList)
|
shortcutManager.removeLongLivedShortcuts(shortcutsToRemoveList)
|
||||||
}
|
}
|
||||||
|
|
|
@ -636,7 +636,7 @@ class NotificationsManager(private val context: Context) {
|
||||||
PendingIntent.FLAG_UPDATE_CURRENT or PendingIntent.FLAG_MUTABLE
|
PendingIntent.FLAG_UPDATE_CURRENT or PendingIntent.FLAG_MUTABLE
|
||||||
)
|
)
|
||||||
|
|
||||||
val id = LinphoneUtils.getChatRoomId(localAddress, peerAddress)
|
val id = LinphoneUtils.getChatRoomId(room.localAddress, room.peerAddress)
|
||||||
val notification = createMessageNotification(notifiable, pendingIntent, bubbleIntent, id)
|
val notification = createMessageNotification(notifiable, pendingIntent, bubbleIntent, id)
|
||||||
notify(notifiable.notificationId, notification)
|
notify(notifiable.notificationId, notification)
|
||||||
}
|
}
|
||||||
|
|
|
@ -162,8 +162,12 @@ class LinphoneUtils {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun getChatRoomId(localAddress: String, remoteAddress: String): String {
|
fun getChatRoomId(localAddress: Address, remoteAddress: Address): String {
|
||||||
return "$localAddress~$remoteAddress"
|
val localSipUri = localAddress.clone()
|
||||||
|
localSipUri.clean()
|
||||||
|
val remoteSipUri = remoteAddress.clone()
|
||||||
|
remoteSipUri.clean()
|
||||||
|
return "${localSipUri.asStringUriOnly()}~${remoteSipUri.asStringUriOnly()}"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -151,9 +151,9 @@ class ShortcutsHelper(val context: Context) {
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun createChatRoomShortcut(context: Context, chatRoom: ChatRoom): ShortcutInfo? {
|
private fun createChatRoomShortcut(context: Context, chatRoom: ChatRoom): ShortcutInfo? {
|
||||||
val peerAddress = chatRoom.peerAddress.asStringUriOnly()
|
|
||||||
val localAddress = chatRoom.localAddress.asStringUriOnly()
|
val localAddress = chatRoom.localAddress.asStringUriOnly()
|
||||||
val id = LinphoneUtils.getChatRoomId(localAddress, peerAddress)
|
val peerAddress = chatRoom.peerAddress.asStringUriOnly()
|
||||||
|
val id = LinphoneUtils.getChatRoomId(chatRoom.localAddress, chatRoom.peerAddress)
|
||||||
|
|
||||||
try {
|
try {
|
||||||
val categories: ArraySet<String> = ArraySet()
|
val categories: ArraySet<String> = ArraySet()
|
||||||
|
|
Loading…
Reference in a new issue