fix(@desktop/wallet): Crash when staying on Advanced screen for ~30 minutes

fixes #6474
This commit is contained in:
Khushboo Mehta 2022-08-01 19:04:23 +02:00 committed by Khushboo-dev-cpp
parent e9e0161e3c
commit de2d4f405d
3 changed files with 18 additions and 5 deletions

View File

@ -1,5 +1,7 @@
import QtQuick 2.13 import QtQuick 2.13
import utils 1.0
import "../Profile/stores" import "../Profile/stores"
QtObject { QtObject {
@ -170,4 +172,11 @@ QtObject {
function setActiveCommunity(communityId) { function setActiveCommunity(communityId) {
mainModule.setActiveSectionById(communityId); mainModule.setActiveSectionById(communityId);
} }
function switchAccount(newIndex) {
if(Constants.isCppApp)
walletSectionAccounts.switchAccount(newIndex)
else
walletSection.switchAccount(newIndex)
}
} }

View File

@ -111,8 +111,11 @@ StatusDialog {
anchors.topMargin: -height - 18 anchors.topMargin: -height - 18
model: popup.store.accounts model: popup.store.accounts
selectedAccount: popup.selectedAccount selectedAccount: popup.selectedAccount
onUpdatedSelectedAccount: { changeSelectedAccount: function(newIndex) {
popup.selectedAccount = account if (newIndex > popup.store.accounts) {
return
}
popup.store.switchAccount(newIndex)
} }
} }

View File

@ -19,6 +19,7 @@ StatusFloatingButtonsSelector {
id: floatingHeader id: floatingHeader
property var selectedAccount property var selectedAccount
property var changeSelectedAccount: function(){}
repeater.objectName: "accountsListFloatingHeader" repeater.objectName: "accountsListFloatingHeader"
@ -50,7 +51,7 @@ StatusFloatingButtonsSelector {
hoverColor: Theme.palette.statusFloatingButtonHighlight hoverColor: Theme.palette.statusFloatingButtonHighlight
highlighted: index === floatingHeader.currentIndex highlighted: index === floatingHeader.currentIndex
onClicked: { onClicked: {
updatedSelectedAccount(model) changeSelectedAccount(index)
floatingHeader.currentIndex = index floatingHeader.currentIndex = index
} }
Component.onCompleted: { Component.onCompleted: {
@ -73,8 +74,8 @@ StatusFloatingButtonsSelector {
floatingHeader.currentIndex = index floatingHeader.currentIndex = index
} }
else { else {
changeSelectedAccount(0)
floatingHeader.currentIndex = 0 floatingHeader.currentIndex = 0
updatedSelectedAccount(d.firstModelData)
} }
} }
} }
@ -91,7 +92,7 @@ StatusFloatingButtonsSelector {
icon.isLetterIdenticon: !!model.emoji icon.isLetterIdenticon: !!model.emoji
icon.background.color: Theme.palette.indirectColor1 icon.background.color: Theme.palette.indirectColor1
onClicked: { onClicked: {
updatedSelectedAccount(model) changeSelectedAccount(index)
floatingHeader.itemSelected(index) floatingHeader.itemSelected(index)
} }
visible: !floatingHeader.visibleIndices.includes(index) && walletType !== Constants.watchWalletType visible: !floatingHeader.visibleIndices.includes(index) && walletType !== Constants.watchWalletType