mirror of
https://github.com/Qortal/qortal-mobile.git
synced 2025-04-24 11:57:52 +00:00
fix navigation issue
This commit is contained in:
parent
943ce42486
commit
93fb833df5
@ -53,7 +53,7 @@ export const AppViewer = React.forwardRef(({ app , hide}, iframeRef) => {
|
|||||||
|
|
||||||
// Signal non-manual navigation
|
// Signal non-manual navigation
|
||||||
iframeRef.current.contentWindow.postMessage(
|
iframeRef.current.contentWindow.postMessage(
|
||||||
{ action: 'PERFORMING_NON_MANUAL' }, '*'
|
{ action: 'PERFORMING_NON_MANUAL', currentIndex: previousPageIndex }, '*'
|
||||||
);
|
);
|
||||||
console.log('previousPageIndex', previousPageIndex)
|
console.log('previousPageIndex', previousPageIndex)
|
||||||
// Update the current index locally
|
// Update the current index locally
|
||||||
@ -88,10 +88,8 @@ export const AppViewer = React.forwardRef(({ app , hide}, iframeRef) => {
|
|||||||
await navigationPromise;
|
await navigationPromise;
|
||||||
console.log('Navigation succeeded within 200ms.');
|
console.log('Navigation succeeded within 200ms.');
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
iframeRef.current.contentWindow.postMessage(
|
|
||||||
{ action: 'PERFORMING_NON_MANUAL' }, '*'
|
setUrl(`${getBaseApiReact()}/render/${app?.service}/${app?.name}${previousPath != null ? previousPath : ''}?theme=dark&identifier=${(app?.identifier != null && app?.identifier != 'null') ? app?.identifier : ''}&time=${new Date().getMilliseconds()}&isManualNavigation=false`)
|
||||||
);
|
|
||||||
setUrl(`${getBaseApiReact()}/render/${app?.service}/${app?.name}${app?.previousPath != null ? previousPath : ''}?theme=dark&identifier=${(app?.identifier != null && app?.identifier != 'null') ? app?.identifier : ''}&time=${new Date().getMilliseconds()}&isManualNavigation=false`)
|
|
||||||
// iframeRef.current.contentWindow.location.href = previousPath; // Fallback URL update
|
// iframeRef.current.contentWindow.location.href = previousPath; // Fallback URL update
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -426,15 +426,13 @@ isDOMContentLoaded: false
|
|||||||
setHistory((prev)=> {
|
setHistory((prev)=> {
|
||||||
const copyPrev = {...prev}
|
const copyPrev = {...prev}
|
||||||
if((copyPrev?.customQDNHistoryPaths || []).at(-1) === (event?.data?.payload?.customQDNHistoryPaths || []).at(-1)) {
|
if((copyPrev?.customQDNHistoryPaths || []).at(-1) === (event?.data?.payload?.customQDNHistoryPaths || []).at(-1)) {
|
||||||
console.log('customQDNHistoryPaths.length', prev?.customQDNHistoryPaths.length)
|
|
||||||
return {
|
return {
|
||||||
...prev,
|
...prev,
|
||||||
currentIndex: prev.customQDNHistoryPaths.length - 1 === -1 ? 0 : prev.customQDNHistoryPaths.length - 1
|
currentIndex: prev.customQDNHistoryPaths.length - 1 === -1 ? 0 : prev.customQDNHistoryPaths.length - 1
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const copyHistory = {...prev}
|
const copyHistory = {...prev}
|
||||||
const paths = [...(copyHistory?.customQDNHistoryPaths || []), ...(event?.data?.payload?.customQDNHistoryPaths || [])]
|
const paths = [...(copyHistory?.customQDNHistoryPaths.slice(0, copyHistory.currentIndex + 1) || []), ...(event?.data?.payload?.customQDNHistoryPaths || [])]
|
||||||
console.log('paths', paths)
|
|
||||||
return {
|
return {
|
||||||
...prev,
|
...prev,
|
||||||
customQDNHistoryPaths: paths,
|
customQDNHistoryPaths: paths,
|
||||||
@ -445,7 +443,7 @@ isDOMContentLoaded: false
|
|||||||
setHistory(event?.data?.payload)
|
setHistory(event?.data?.payload)
|
||||||
|
|
||||||
}
|
}
|
||||||
} else if(event?.data?.action === 'SET_TAB'){
|
} else if(event?.data?.action === 'SET_TAB'){
|
||||||
executeEvent("addTab", {
|
executeEvent("addTab", {
|
||||||
data: event?.data?.payload
|
data: event?.data?.payload
|
||||||
})
|
})
|
||||||
|
Loading…
x
Reference in New Issue
Block a user