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 utils 1.0
import "../Profile/stores"
QtObject {
@ -170,4 +172,11 @@ QtObject {
function setActiveCommunity(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
model: popup.store.accounts
selectedAccount: popup.selectedAccount
onUpdatedSelectedAccount: {
popup.selectedAccount = account
changeSelectedAccount: function(newIndex) {
if (newIndex > popup.store.accounts) {
return
}
popup.store.switchAccount(newIndex)
}
}

View File

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