fix: ensure app tab buuttons match correct app section

Since the timeline was removed, this introduced a little hiccup in
the application section selection.

This commit ensures navigation tab buttons match the correct section.
This commit is contained in:
Pascal Precht 2021-12-06 10:12:36 +01:00 committed by r4bbit.eth
parent b1746d6d8e
commit 23cd46e831
3 changed files with 7 additions and 20 deletions

View File

@ -316,16 +316,6 @@ Item {
onClicked: appMain.changeAppSection(Constants.browser) onClicked: appMain.changeAppSection(Constants.browser)
}, },
StatusNavBarTabButton {
enabled: isExperimental === "1" || localAccountSensitiveSettings.timelineEnabled
visible: enabled
//% "Timeline"
tooltip.text: qsTrId("timeline")
icon.name: "status-update"
checked: appView.currentIndex == Utils.getAppSectionIndex(Constants.timeline)
onClicked: appMain.changeAppSection(Constants.timeline)
},
StatusNavBarTabButton { StatusNavBarTabButton {
enabled: isExperimental === "1" || localAccountSensitiveSettings.nodeManagementEnabled enabled: isExperimental === "1" || localAccountSensitiveSettings.nodeManagementEnabled
visible: enabled visible: enabled
@ -412,7 +402,7 @@ Item {
if(obj === walletV2LayoutContainer){ if(obj === walletV2LayoutContainer){
walletV2LayoutContainer.showSigningPhrasePopup(); walletV2LayoutContainer.showSigningPhrasePopup();
} }
localAccountSensitiveSettings.lastModeActiveTab = (currentIndex === Utils.getAppSectionIndex(Constants.timeline)) ? 0 : currentIndex localAccountSensitiveSettings.lastModeActiveTab = currentIndex
} }
ChatLayout { ChatLayout {

View File

@ -131,15 +131,15 @@ QtObject {
case Constants.chat: sectionId = 0; break; case Constants.chat: sectionId = 0; break;
case Constants.wallet: sectionId = 1; break; case Constants.wallet: sectionId = 1; break;
case Constants.browser: sectionId = 2; break; case Constants.browser: sectionId = 2; break;
case Constants.timeline: sectionId = 3; break; case Constants.profile: sectionId = 3; break;
case Constants.profile: sectionId = 4; break; case Constants.node: sectionId = 4; break;
case Constants.node: sectionId = 5; break; case Constants.ui: sectionId = 5; break;
case Constants.ui: sectionId = 6; break; case Constants.walletv2: sectionId = 6; break;
case Constants.walletv2: sectionId = 7; break;
case Constants.community: sectionId = 99; break; case Constants.community: sectionId = 99; break;
} }
if (sectionId === -1) { if (sectionId === -1) {
throw new Exception ("Unknown section name. Check the Constants to know the available ones") console.warn("Unknown section name. Defaulting to chat section")
return 0
} }
return sectionId return sectionId
} }

View File

@ -421,7 +421,6 @@ StatusWindow {
signal droppedOnValidScreen(var drop) signal droppedOnValidScreen(var drop)
property alias droppedUrls: rptDraggedPreviews.model property alias droppedUrls: rptDraggedPreviews.model
readonly property int chatView: Utils.getAppSectionIndex(Constants.chat) readonly property int chatView: Utils.getAppSectionIndex(Constants.chat)
readonly property int timelineView: Utils.getAppSectionIndex(Constants.timeline)
property bool enabled: !drag.source && !!loader.item && !!loader.item.appLayout && property bool enabled: !drag.source && !!loader.item && !!loader.item.appLayout &&
( (
// in chat view // in chat view
@ -433,8 +432,6 @@ StatusWindow {
chatsModel.channelView.activeChannel.chatType === Constants.chatTypePrivateGroupChat chatsModel.channelView.activeChannel.chatType === Constants.chatTypePrivateGroupChat
) )
) || ) ||
// in timeline view
loader.item.appLayout.appView.currentIndex === timelineView ||
// In community section // In community section
loader.item.appLayout.appView.currentIndex === chatsModel.communities.activeCommunity.active loader.item.appLayout.appView.currentIndex === chatsModel.communities.activeCommunity.active
) )