Delay link/notification handling until chatListCreated
(hopefully) fixes #412
This commit is contained in:
parent
bd9df7b10c
commit
df1f20cb30
1 changed files with 32 additions and 6 deletions
|
@ -36,6 +36,10 @@ Page {
|
||||||
property int ownUserId;
|
property int ownUserId;
|
||||||
property bool chatListCreated: false;
|
property bool chatListCreated: false;
|
||||||
|
|
||||||
|
// link handler:
|
||||||
|
property string urlToOpen: null;
|
||||||
|
property var chatToOpen: null; //null or [chatId, messageId]
|
||||||
|
|
||||||
onStatusChanged: {
|
onStatusChanged: {
|
||||||
if (status === PageStatus.Active && initializationCompleted && !chatListCreated && !logoutLoading) {
|
if (status === PageStatus.Active && initializationCompleted && !chatListCreated && !logoutLoading) {
|
||||||
updateContent();
|
updateContent();
|
||||||
|
@ -45,15 +49,12 @@ Page {
|
||||||
Connections {
|
Connections {
|
||||||
target: dBusAdaptor
|
target: dBusAdaptor
|
||||||
onPleaseOpenMessage: {
|
onPleaseOpenMessage: {
|
||||||
Debug.log("[OverviewPage] Opening chat from external call...")
|
Debug.log("[OverviewPage] Opening chat from external requested: ", chatId);
|
||||||
if (chatListCreated) {
|
openMessage(chatId, messageId);
|
||||||
pageStack.pop(overviewPage, PageStackAction.Immediate)
|
|
||||||
pageStack.push(Qt.resolvedUrl("../pages/ChatPage.qml"), { "chatInformation" : chatListModel.getById(chatId) }, PageStackAction.Immediate)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
onPleaseOpenUrl: {
|
onPleaseOpenUrl: {
|
||||||
Debug.log("[OverviewPage] Opening URL requested: ", url);
|
Debug.log("[OverviewPage] Opening URL requested: ", url);
|
||||||
Functions.handleLink(url);
|
openUrl(url);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -73,6 +74,8 @@ Page {
|
||||||
titleInteractionHint.opacity = 1.0;
|
titleInteractionHint.opacity = 1.0;
|
||||||
appSettings.remainingInteractionHints = remainingInteractionHints - 1;
|
appSettings.remainingInteractionHints = remainingInteractionHints - 1;
|
||||||
}
|
}
|
||||||
|
openUrl();
|
||||||
|
openMessage();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -115,6 +118,29 @@ Page {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function openMessage(chatId, messageId) {
|
||||||
|
if(chatId && messageId) {
|
||||||
|
chatToOpen = [chatId, messageId];
|
||||||
|
}
|
||||||
|
if(chatListCreated && chatToOpen && chatToOpen.length === 2) { // messageId not handled (yet)
|
||||||
|
Debug.log("[OverviewPage] Opening Chat: ", chatToOpen[0]);
|
||||||
|
pageStack.pop(overviewPage, PageStackAction.Immediate);
|
||||||
|
pageStack.push(Qt.resolvedUrl("../pages/ChatPage.qml"), { "chatInformation" : chatListModel.getById(chatToOpen[0]) }, PageStackAction.Immediate);
|
||||||
|
chatToOpen = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function openUrl(url) {
|
||||||
|
if(url && url.length > 0) {
|
||||||
|
urlToOpen = url;
|
||||||
|
}
|
||||||
|
if(chatListCreated && urlToOpen && urlToOpen.length > 1) {
|
||||||
|
Debug.log("[OverviewPage] Opening URL: ", urlToOpen);
|
||||||
|
Functions.handleLink(urlToOpen);
|
||||||
|
urlToOpen = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function setPageStatus() {
|
function setPageStatus() {
|
||||||
switch (overviewPage.connectionState) {
|
switch (overviewPage.connectionState) {
|
||||||
case TelegramAPI.WaitingForNetwork:
|
case TelegramAPI.WaitingForNetwork:
|
||||||
|
|
Loading…
Reference in a new issue