close open dialogs when deep linking to composer (#3020)
parent
d2c6edacb6
commit
60eb6e23d1
|
@ -3,6 +3,7 @@ import * as Linking from 'expo-linking'
|
||||||
import {isNative} from 'platform/detection'
|
import {isNative} from 'platform/detection'
|
||||||
import {useComposerControls} from 'state/shell'
|
import {useComposerControls} from 'state/shell'
|
||||||
import {useSession} from 'state/session'
|
import {useSession} from 'state/session'
|
||||||
|
import {useCloseAllActiveElements} from 'state/util'
|
||||||
|
|
||||||
type IntentType = 'compose'
|
type IntentType = 'compose'
|
||||||
|
|
||||||
|
@ -42,6 +43,7 @@ export function useIntentHandler() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function useComposeIntent() {
|
function useComposeIntent() {
|
||||||
|
const closeAllActiveElements = useCloseAllActiveElements()
|
||||||
const {openComposer} = useComposerControls()
|
const {openComposer} = useComposerControls()
|
||||||
const {hasSession} = useSession()
|
const {hasSession} = useSession()
|
||||||
|
|
||||||
|
@ -55,6 +57,8 @@ function useComposeIntent() {
|
||||||
}) => {
|
}) => {
|
||||||
if (!hasSession) return
|
if (!hasSession) return
|
||||||
|
|
||||||
|
closeAllActiveElements()
|
||||||
|
|
||||||
const imageUris = imageUrisStr
|
const imageUris = imageUrisStr
|
||||||
?.split(',')
|
?.split(',')
|
||||||
.filter(part => {
|
.filter(part => {
|
||||||
|
@ -82,6 +86,6 @@ function useComposeIntent() {
|
||||||
})
|
})
|
||||||
}, 500)
|
}, 500)
|
||||||
},
|
},
|
||||||
[openComposer, hasSession],
|
[hasSession, closeAllActiveElements, openComposer],
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue