From 6e3ac7d5dc3c98e22654cda8334b36cf1a366205 Mon Sep 17 00:00:00 2001 From: Khushboo Mehta Date: Thu, 23 Sep 2021 13:59:29 +0200 Subject: [PATCH] fix(@desktop/chat): Remember the last tab (in nav bar) opened when status app is reopened With this fix after a restart the tab which the user was last one (chat, community, wallet, browser, settings) will be the active one. If the user was on the timeline tab when the app is closed, the app will be launched with the chat tab. fixes #3559 --- ui/app/AppMain.qml | 9 +++++++++ ui/main.qml | 2 ++ 2 files changed, 11 insertions(+) diff --git a/ui/app/AppMain.qml b/ui/app/AppMain.qml index a73e62822c..87fbc518c0 100644 --- a/ui/app/AppMain.qml +++ b/ui/app/AppMain.qml @@ -36,6 +36,7 @@ Item { signal openContactsPopup() function changeAppSection(section) { + appSettings.lastModeActiveCommunity = "" chatsModel.communities.activeCommunity.active = false appView.currentIndex = Utils.getAppSectionIndex(section) } @@ -217,6 +218,7 @@ Item { onClicked: { appMain.changeAppSection(Constants.chat) chatsModel.communities.setActiveCommunity(model.id) + appSettings.lastModeActiveCommunity = model.id } anchors.horizontalCenter: parent.horizontalCenter @@ -406,6 +408,7 @@ Item { if(obj === walletV2LayoutContainer){ walletV2LayoutContainer.showSigningPhrasePopup(); } + appSettings.lastModeActiveTab = (currentIndex === Utils.getAppSectionIndex(Constants.timeline)) ? 0 : currentIndex } ChatLayout { @@ -758,6 +761,12 @@ Item { } } } + + Component.onCompleted: { + appView.currentIndex = appSettings.lastModeActiveTab + if(!!appSettings.lastModeActiveCommunity) + chatsModel.communities.setActiveCommunity(appSettings.lastModeActiveCommunity) + } } /*##^## Designer { diff --git a/ui/main.qml b/ui/main.qml index 8a3ac1020c..c8a6147f4e 100644 --- a/ui/main.qml +++ b/ui/main.qml @@ -78,6 +78,8 @@ StatusWindow { property string skinColor: "" property bool showDeleteMessageWarning: true property bool downloadChannelMessagesEnabled: false + property int lastModeActiveTab: 0 + property string lastModeActiveCommunity: "" // Browser settings property bool showBrowserSelector: true