mirror of
https://github.com/balzack/databag.git
synced 2025-02-12 03:29:16 +00:00
fixing race where shared intent not showing on sealed channel
This commit is contained in:
parent
82e15f5ec7
commit
245b05d192
@ -18,7 +18,8 @@ export function AddTopic({ contentKey, shareIntent, setShareIntent }) {
|
|||||||
const { state, actions } = useAddTopic(contentKey);
|
const { state, actions } = useAddTopic(contentKey);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (shareIntent) {
|
if (shareIntent && state.loaded) {
|
||||||
|
if (!state.locked || contentKey) {
|
||||||
shareIntent.forEach(share => {
|
shareIntent.forEach(share => {
|
||||||
if (share.text) {
|
if (share.text) {
|
||||||
actions.setMessage(share.text);
|
actions.setMessage(share.text);
|
||||||
@ -39,7 +40,8 @@ export function AddTopic({ contentKey, shareIntent, setShareIntent }) {
|
|||||||
});
|
});
|
||||||
setShareIntent(null);
|
setShareIntent(null);
|
||||||
}
|
}
|
||||||
}, [shareIntent]);
|
}
|
||||||
|
}, [shareIntent, state.loaded, state.locked, contentKey]);
|
||||||
|
|
||||||
const addImage = async () => {
|
const addImage = async () => {
|
||||||
try {
|
try {
|
||||||
|
@ -25,6 +25,7 @@ export function useAddTopic(contentKey) {
|
|||||||
enableAudio: false,
|
enableAudio: false,
|
||||||
enableVideo: false,
|
enableVideo: false,
|
||||||
locked: true,
|
locked: true,
|
||||||
|
loaded: false,
|
||||||
conflict: false,
|
conflict: false,
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -100,11 +101,13 @@ export function useAddTopic(contentKey) {
|
|||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const { enableVideo, enableAudio, enableImage } = conversation.state.channel?.detail || {};
|
const { enableVideo, enableAudio, enableImage } = conversation.state.channel?.detail || {};
|
||||||
const locked = conversation.state.channel?.detail?.dataType === 'superbasic' ? false : true;
|
const locked = conversation.state.channel?.detail?.dataType === 'superbasic' ? false : true;
|
||||||
updateState({ enableImage, enableAudio, enableVideo, locked });
|
const loaded = conversation.state.loaded;
|
||||||
|
updateState({ enableImage, enableAudio, enableVideo, locked, loaded });
|
||||||
}, [conversation.state]);
|
}, [conversation.state]);
|
||||||
|
|
||||||
const setAsset = async (file, scale) => {
|
const setAsset = async (file, scale) => {
|
||||||
const url = file.startsWith('file:') ? file : `file://${file}`;
|
const url = file.startsWith('file:') ? file : `file://${file}`;
|
||||||
|
|
||||||
if (contentKey) {
|
if (contentKey) {
|
||||||
const scaled = scale ? await scale(url) : url;
|
const scaled = scale ? await scale(url) : url;
|
||||||
const stat = await RNFS.stat(scaled);
|
const stat = await RNFS.stat(scaled);
|
||||||
|
Loading…
Reference in New Issue
Block a user