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

View File

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

View File

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

View File

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