fix(SendModal): hide the Custom network mode in `production`

- manage the lifetime of the Custom tab button dynamically; setting the
tab button to `visible: false` doesn't unfortunately remove it from the
tab bar

Fixes #16052
This commit is contained in:
Lukáš Tinkl 2024-08-10 14:39:56 +02:00 committed by Lukáš Tinkl
parent 1df3503dfb
commit 7f4ca098de
4 changed files with 36 additions and 6 deletions

View File

@ -210,6 +210,7 @@ SplitView {
preSelectedSendType: loader.preSelectedSendType
preSelectedHoldingID: loader.preSelectedHoldingID
preSelectedHoldingType: loader.preSelectedHoldingType
showCustomRoutingMode: ctrlShowCustomMode.checked
}
Component.onCompleted: loader.active = true
}
@ -222,7 +223,7 @@ SplitView {
ColumnLayout {
width: parent.width
spacing: 20
spacing: 10
ColumnLayout {
spacing: 0
@ -346,6 +347,12 @@ SplitView {
}
}
CheckBox {
id: ctrlShowCustomMode
text: "Show custom network routing panel"
checked: true
}
CheckBox {
id: showCommunityAssetsCheckBox
text: "Show community assets when sending tokens"

View File

@ -1,10 +1,10 @@
import QtQuick 2.15
import QtQuick.Controls 2.13
import QtQuick.Layouts 1.13
import QtMultimedia 5.13
import QtQuick.Controls 2.15
import QtQuick.Layouts 1.15
import QtMultimedia 5.15
import Qt.labs.platform 1.1
import Qt.labs.settings 1.1
import QtQml.Models 2.14
import QtQml.Models 2.15
import QtQml 2.15
import AppLayouts.Wallet 1.0
@ -1595,6 +1595,8 @@ Item {
store: appMain.transactionStore
collectiblesStore: appMain.walletCollectiblesStore
showCustomRoutingMode: !production
onClosed: {
sendModal.closed()
sendModal.preSelectedSendType = Constants.SendType.Unknown

View File

@ -58,6 +58,7 @@ StatusDialog {
property var bestRoutes
property bool isLoading: false
property int loginType
property bool showCustomRoutingMode
property MessageDialog sendingError: MessageDialog {
id: sendingError
@ -657,6 +658,7 @@ StatusDialog {
totalFeesInFiat: d.totalFeesInFiat
fromNetworksList: fromNetworksRouteModel
toNetworksList: toNetworksRouteModel
showCustomRoutingMode: popup.showCustomRoutingMode
routerError: d.routerError
routerErrorDetails: d.routerErrorDetails

View File

@ -36,6 +36,7 @@ Item {
property int errorType: Constants.NoError
property var bestRoutes
property double totalFeesInFiat
property bool showCustomRoutingMode
property string routerError: ""
property string routerErrorDetails: ""
@ -46,6 +47,9 @@ Item {
QtObject {
id: d
property var customButton
readonly property int backgroundRectRadius: 13
readonly property color backgroundRectColor: Theme.palette.indirectColor1
}
@ -62,9 +66,24 @@ Item {
text: qsTr("Advanced")
showBetaTag: true
}
}
// not visible in `production` for now, see https://github.com/status-im/status-desktop/issues/16052
Component {
id: customButtonComponent
StatusSwitchTabButton {
text: qsTr("Custom")
enabled: false
}
}
onShowCustomRoutingModeChanged: {
if (root.showCustomRoutingMode) {
if (!!d.customButton)
d.customButton.destroy()
d.customButton = customButtonComponent.createObject(tabBar)
tabBar.addItem(d.customButton)
} else if (!!d.customButton) {
d.customButton.destroy()
}
}