Save & restore previous page when relaunching app
This commit is contained in:
parent
246058e647
commit
df920da2a6
|
@ -15,7 +15,15 @@ Item {
|
||||||
target: py
|
target: py
|
||||||
onWillLoadAccounts: will => {
|
onWillLoadAccounts: will => {
|
||||||
if (! will) { pageStack.showPage("SignIn") }
|
if (! will) { pageStack.showPage("SignIn") }
|
||||||
pageStack.show(window.uiState.page)
|
|
||||||
|
let page = window.uiState.page
|
||||||
|
let props = window.uiState.pageProperties
|
||||||
|
|
||||||
|
if (page == "Chat/Chat.qml") {
|
||||||
|
pageStack.showRoom(props.userId, props.category, props.roomId)
|
||||||
|
} else {
|
||||||
|
pageStack.show(page, props)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -65,12 +73,21 @@ Item {
|
||||||
}
|
}
|
||||||
|
|
||||||
function showPage(name, properties={}) {
|
function showPage(name, properties={}) {
|
||||||
show("Pages/" + name + ".qml", properties)
|
let path = "Pages/" + name + ".qml"
|
||||||
|
show(path, properties)
|
||||||
|
|
||||||
|
window.uiState.page = path
|
||||||
|
window.uiState.pageProperties = properties
|
||||||
|
window.uiStateChanged()
|
||||||
}
|
}
|
||||||
|
|
||||||
function showRoom(userId, category, roomId) {
|
function showRoom(userId, category, roomId) {
|
||||||
let roomInfo = rooms.find(userId, category, roomId)
|
let roomInfo = rooms.find(userId, category, roomId)
|
||||||
show("Chat/Chat.qml", {roomInfo})
|
show("Chat/Chat.qml", {roomInfo})
|
||||||
|
|
||||||
|
window.uiState.page = "Chat/Chat.qml"
|
||||||
|
window.uiState.pageProperties = {userId, category, roomId}
|
||||||
|
window.uiStateChanged()
|
||||||
}
|
}
|
||||||
|
|
||||||
onCurrentItemChanged: if (currentItem) {
|
onCurrentItemChanged: if (currentItem) {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user