When leaving room, try to go to previous page

This commit is contained in:
miruka 2019-11-09 14:21:01 -04:00
parent 46ff911bfa
commit de59948214
2 changed files with 7 additions and 2 deletions

View File

@ -21,7 +21,11 @@ HPage {
onRoomInfoChanged: {
if (roomInfo.left) {
// If left, the room will most likely be gone on client restart
// If left, the room will most likely be gone on client restart.
// Try to switch back to the previous page.
if (pageLoader.showPrevious()) return
// If there wasn't any previous page, show default page.
window.uiState.page = "Pages/Default.qml"
window.uiState.pageProperties = {}
window.uiStateChanged()

View File

@ -134,7 +134,7 @@ Item {
function showPrevious(timesBack=1) {
timesBack = Math.min(timesBack, history.length - 1)
if (timesBack < 1) return
if (timesBack < 1) return false
let [componentUrl, properties] = history[timesBack]
@ -143,6 +143,7 @@ Item {
window.uiState.page = componentUrl
window.uiState.pageProperties = properties
window.uiStateChanged()
return true
}
onStatusChanged: if (status == Loader.Ready) {