Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expand privacy mode #2468

Merged
merged 5 commits into from
Aug 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions atomic_defi_design/Dex/Components/DexLabel.qml
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,10 @@ Text
}
}

text: privacy && Dex.General.privacy_mode ? Dex.General.privacy_text : text_value
font: monospace ? Dex.DexTypo.monoSmall : Dex.DexTypo.body2

color: enabled ? Dex.CurrentTheme.foregroundColor : Dex.CurrentTheme.textDisabledColor

text: privacy && Dex.General.privacy_mode ? Dex.General.privacy_text : text_value
wrapMode: Text.WordWrap

onLinkActivated: Qt.openUrlExternally(link)
linkColor: color
}
35 changes: 17 additions & 18 deletions atomic_defi_design/Dex/Components/PairItemBadge.qml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ DexRectangle
Layout.leftMargin: 10
Layout.rightMargin: 20

Dex.Text{
DexLabel
{
anchors.bottom: parent.top
anchors.bottomMargin: 5
anchors.horizontalCenter: parent.horizontalCenter
Expand All @@ -46,6 +47,7 @@ DexRectangle
Layout.leftMargin: 20
Layout.rightMargin: 20

// Coin Icon
Dex.Image
{
id: icon
Expand All @@ -58,49 +60,46 @@ DexRectangle
Layout.topMargin: 0
Layout.bottomMargin: 0
}

//
ColumnLayout
{
spacing: 2
Layout.alignment: Qt.AlignVCenter

Dex.Text
DexLabel
{
Layout.preferredWidth: parent.width - 15

text_value: `<font color="${Style.getCoinColor(ticker)}"><b>${ticker}</b></font>&nbsp;&nbsp;&nbsp;<font color="${Dex.CurrentTheme.foregroundColor}">${fullname}</font>`
font.pixelSize: Style.textSizeSmall3
font: Dex.DexTypo.body2
elide: Text.ElideRight
wrapMode: Text.NoWrap
}

Dex.Text
DexLabel
{
id: middle_line

property string coin_value: amount
text: coin_value
text_value: coin_value
Layout.fillWidth: true
elide: Text.ElideRight
color: Dex.CurrentTheme.foregroundColor
font: DexTypo.body2
wrapMode: Label.NoWrap
ToolTip.text: coin_value
Component.onCompleted: font.pixelSize = 11.5
font: DexTypo.body3
ToolTip.text: text_value
privacy: true
}

Dex.Text
DexLabel
{
id: bottom_line

property string fiat_value: General.getFiatText(amount, ticker)
text: fiat_value
text_value: fiat_value
Layout.fillWidth: true
elide: Text.ElideRight
color: Dex.CurrentTheme.foregroundColor
font: DexTypo.body2
font: DexTypo.body3
wrapMode: Label.NoWrap
ToolTip.text: fiat_value
Component.onCompleted: font.pixelSize = 11.5
ToolTip.text: text_value
privacy: true
}
}
}
Expand Down
29 changes: 20 additions & 9 deletions atomic_defi_design/Dex/Constants/General.qml
Original file line number Diff line number Diff line change
Expand Up @@ -419,6 +419,14 @@ QtObject {
}

function getFeesDetail(fees) {
if (privacy_mode) {
return [
{"label": privacy_text},
{"label": privacy_text},
{"label": privacy_text},
{"label": privacy_text}
]
}
return [
{"label": qsTr("<b>Taker tx fee:</b> "), "fee": fees.base_transaction_fees, "ticker": fees.base_transaction_fees_ticker},
{"label": qsTr("<b>Dex tx fee:</b> "), "fee": fees.fee_to_send_taker_fee, "ticker": fees.fee_to_send_taker_fee_ticker},
Expand All @@ -435,6 +443,10 @@ QtObject {
}

function getSimpleFromPlaceholder(selectedTicker, selectedOrder, sell_ticker_balance) {
if (privacy_mode)
{
return "0"
}
if (sell_ticker_balance == 0)
{
return qsTr("%1 balance is zero").arg(selectedTicker)
Expand Down Expand Up @@ -489,6 +501,7 @@ QtObject {
}

function getTxExplorerURL(ticker, txid, add_0x=true) {
if (privacy_mode) return ''
if(txid !== '') {
const coin_info = API.app.portfolio_pg.global_cfg_mdl.get_coin_info(ticker)
const txid_prefix = (add_0x && coin_info.is_erc_family) ? '0x' : ''
Expand All @@ -497,6 +510,7 @@ QtObject {
}

function getAddressExplorerURL(ticker, address) {
if (privacy_mode) return ''
if(address !== '') {
const coin_info = API.app.portfolio_pg.global_cfg_mdl.get_coin_info(ticker)
return coin_info.explorer_url + addressTxUri(coin_info) + address
Expand All @@ -505,12 +519,14 @@ QtObject {
}

function viewTxAtExplorer(ticker, txid, add_0x=true) {
if (privacy_mode) return ''
if(txid !== '') {
Qt.openUrlExternally(getTxExplorerURL(ticker, txid, add_0x))
}
}

function viewAddressAtExplorer(ticker, address) {
if (privacy_mode) return ''
if(address !== '') {
Qt.openUrlExternally(getAddressExplorerURL(ticker, address))
}
Expand Down Expand Up @@ -555,6 +571,7 @@ QtObject {
}

function convertUsd(v) {
if (privacy_mode) return ''
let rate = API.app.get_rate_conversion("USD", API.app.settings_pg.current_currency)
let value = parseFloat(v) / parseFloat(rate)

Expand All @@ -566,6 +583,7 @@ QtObject {
}

function formatFiat(received, amount, fiat, precision=2) {
if (privacy_mode) return ''
if (precision == 2 && fiat == "BTC") {
precision = 8
}
Expand All @@ -575,6 +593,7 @@ QtObject {
}

function formatPercent(value, show_prefix=true) {
if (privacy_mode) return ''
let prefix = ''
if(value > 0) prefix = '+ '
else if(value < 0) {
Expand Down Expand Up @@ -619,6 +638,7 @@ QtObject {
}

function formatCrypto(received, amount, ticker, fiat_amount, fiat, precision, trail_zeros) {
if (privacy_mode) return ''
return diffPrefix(received) + ticker + " " + formatDouble(amount, precision, trail_zeros) + (fiat_amount ? " (" + formatFiat("", fiat_amount, fiat) + ")" : "")
}

Expand Down Expand Up @@ -777,15 +797,10 @@ QtObject {
}

function feeText(trade_info, base_ticker, has_info_icon=true, has_limited_space=false) {


if(!trade_info || !trade_info.trading_fee) return ""

const tx_fee = txFeeText(trade_info, base_ticker, has_info_icon, has_limited_space)
const trading_fee = tradingFeeText(trade_info, base_ticker, has_info_icon)
const minimum_amount = minimumtradingFeeText(trade_info, base_ticker, has_info_icon)


return tx_fee + "\n" + trading_fee +"<br>"+minimum_amount
}

Expand All @@ -804,13 +819,9 @@ QtObject {
}

function txFeeText(trade_info, base_ticker, has_info_icon=true, has_limited_space=false) {

if(!trade_info || !trade_info.trading_fee) return ""

const has_parent_coin_fees = hasParentCoinFees(trade_info)

var info = qsTr('%1 Transaction Fee'.arg(trade_info.base_transaction_fees_ticker))+': '+ trade_info.base_transaction_fees + " (%1)".arg(getFiatText(trade_info.base_transaction_fees, trade_info.base_transaction_fees_ticker, has_info_icon))

if (has_parent_coin_fees) {
info = info+"<br>"+qsTr('%1 Transaction Fee'.arg(trade_info.rel_transaction_fees_ticker))+': '+ trade_info.rel_transaction_fees + " (%1)".arg(getFiatText(trade_info.rel_transaction_fees, trade_info.rel_transaction_fees_ticker, has_info_icon))
}
Expand Down
7 changes: 4 additions & 3 deletions atomic_defi_design/Dex/Exchange/ProView/DexComboBoxLine.qml
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,9 @@ RowLayout
Dex.Text
{
id: middle_line

property string coin_value: !details ? "" : details.balance
text: coin_value
text_value: coin_value
privacy: true
Layout.fillWidth: true
elide: Text.ElideRight
color: Dex.CurrentTheme.foregroundColor
Expand All @@ -105,13 +105,14 @@ RowLayout

property string fiat_value: !details ? "" :
General.formatFiat("", details.main_currency_balance, API.app.settings_pg.current_currency)
text: fiat_value
text_value: fiat_value
Layout.fillWidth: true
elide: Text.ElideRight
color: Dex.CurrentTheme.foregroundColor
font: DexTypo.body2
wrapMode: Label.NoWrap
ToolTip.text: fiat_value
privacy: true
Component.onCompleted: font.pixelSize = 11
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,7 @@ ColumnLayout
setVolume(text)
reset_fees_state()
}
enabled: !General.privacy_mode
}

OrderFormSubfield
Expand Down Expand Up @@ -204,9 +205,9 @@ ColumnLayout
left_label: "25%"
middle_label: "50%"
right_label: qsTr("Max")
left_tooltip_text: qsTr("Swap 25% of your tradable balance.")
middle_tooltip_text: qsTr("Swap 50% of your tradable balance.")
right_tooltip_text: qsTr("Swap 100% of your tradable balance.")
left_tooltip_text: General.privacy_mode ? qsTr("Diasble privacy mode to trade") : qsTr("Swap 25% of your tradable balance.")
middle_tooltip_text: General.privacy_mode ? qsTr("Diasble privacy mode to trade") : qsTr("Swap 50% of your tradable balance.")
right_tooltip_text: General.privacy_mode ? qsTr("Diasble privacy mode to trade") : qsTr("Swap 100% of your tradable balance.")
}
}

Expand Down Expand Up @@ -419,6 +420,7 @@ ColumnLayout
radius: 16
text: API.app.trading_pg.maker_mode ? qsTr("CREATE MAKER SWAP") : qsTr("START TAKER SWAP")
font.weight: Font.Medium
enabled: !General.privacy_mode
}
}
}
Loading
Loading