mirror of
https://gitlab.linphone.org/BC/public/linphone-android.git
synced 2026-01-17 11:28:06 +00:00
Prevent external file sharing to attach file in already opened conversation if any
This commit is contained in:
parent
3190a1869d
commit
51dd246971
3 changed files with 22 additions and 0 deletions
|
|
@ -615,6 +615,16 @@ class MainActivity : GenericActivity() {
|
|||
Log.i("$TAG Drawer menu is opened, closing it")
|
||||
closeDrawerMenu()
|
||||
}
|
||||
if (findNavController().currentDestination?.id == R.id.conversationsListFragment) {
|
||||
if (sharedViewModel.displayedChatRoom != null) {
|
||||
Log.w(
|
||||
"$TAG Closing already opened conversation to prevent attaching file in it directly"
|
||||
)
|
||||
sharedViewModel.hideConversationEvent.postValue(Event(true))
|
||||
} else {
|
||||
Log.i("$TAG No chat room currently displayed, nothing to close")
|
||||
}
|
||||
}
|
||||
|
||||
val paths = deferred.awaitAll()
|
||||
for (path in paths) {
|
||||
|
|
|
|||
|
|
@ -364,6 +364,7 @@ open class ConversationFragment : SlidingPaneChildFragment() {
|
|||
|
||||
override fun goBack(): Boolean {
|
||||
sharedViewModel.closeSlidingPaneEvent.value = Event(true)
|
||||
sharedViewModel.displayedChatRoom = null
|
||||
|
||||
if (findNavController().currentDestination?.id == R.id.conversationFragment) {
|
||||
// If not done this fragment won't be paused, which will cause us issues
|
||||
|
|
@ -784,6 +785,13 @@ open class ConversationFragment : SlidingPaneChildFragment() {
|
|||
}
|
||||
}
|
||||
|
||||
sharedViewModel.hideConversationEvent.observe(viewLifecycleOwner) {
|
||||
it.consume {
|
||||
Log.w("$TAG We were asked to close conversation, going back")
|
||||
goBack()
|
||||
}
|
||||
}
|
||||
|
||||
sharedViewModel.textToShareFromIntent.observe(viewLifecycleOwner) { text ->
|
||||
if (text.isNotEmpty()) {
|
||||
Log.i("$TAG Found text to share from intent")
|
||||
|
|
|
|||
|
|
@ -120,6 +120,10 @@ class SharedMainViewModel @UiThread constructor() : ViewModel() {
|
|||
MutableLiveData<Event<Pair<String, String>>>()
|
||||
}
|
||||
|
||||
val hideConversationEvent: MutableLiveData<Event<Boolean>> by lazy {
|
||||
MutableLiveData<Event<Boolean>>()
|
||||
}
|
||||
|
||||
// When using keyboard to share gif or other, see RichContentReceiver & RichEditText classes
|
||||
val richContentUri = MutableLiveData<Event<Uri>>()
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue