mirror of
https://github.com/status-im/status-desktop.git
synced 2025-02-26 21:41:11 +00:00
feat: Fixes to modal
This commit is contained in:
parent
6556a356b7
commit
2d129c388a
@ -5,7 +5,7 @@ const DEFAULT_FLAG_DAPPS_ENABLED = true
|
|||||||
const DEFAULT_FLAG_SWAP_ENABLED = true
|
const DEFAULT_FLAG_SWAP_ENABLED = true
|
||||||
const DEFAULT_FLAG_CONNECTOR_ENABLED* = false
|
const DEFAULT_FLAG_CONNECTOR_ENABLED* = false
|
||||||
const DEFAULT_FLAG_SEND_VIA_PERSONAL_CHAT_ENABLED = true
|
const DEFAULT_FLAG_SEND_VIA_PERSONAL_CHAT_ENABLED = true
|
||||||
const DEFAULT_FLAG_PAYMENT_REQUEST_ENABLED = true
|
const DEFAULT_FLAG_PAYMENT_REQUEST_ENABLED = false
|
||||||
|
|
||||||
proc boolToEnv*(defaultValue: bool): string =
|
proc boolToEnv*(defaultValue: bool): string =
|
||||||
return if defaultValue: "1" else: "0"
|
return if defaultValue: "1" else: "0"
|
||||||
|
@ -51,7 +51,7 @@ SplitView {
|
|||||||
readonly property int selectedNetworkChainId: ctrlSelectedNetworkChainId.currentValue ?? -1
|
readonly property int selectedNetworkChainId: ctrlSelectedNetworkChainId.currentValue ?? -1
|
||||||
|
|
||||||
readonly property var tokenAdaptor: TokenSelectorViewAdaptor {
|
readonly property var tokenAdaptor: TokenSelectorViewAdaptor {
|
||||||
assetsModel: d.walletAssetsStore.groupedAccountAssetsModel
|
assetsModel: d.walletAssetsStore.baseGroupedAccountAssetModel
|
||||||
flatNetworksModel: d.flatNetworks
|
flatNetworksModel: d.flatNetworks
|
||||||
currentCurrency: d.currencyStore.currentCurrency
|
currentCurrency: d.currencyStore.currentCurrency
|
||||||
plainTokensBySymbolModel: d.walletAssetsStore.walletTokensStore.plainTokensBySymbolModel
|
plainTokensBySymbolModel: d.walletAssetsStore.walletTokensStore.plainTokensBySymbolModel
|
||||||
@ -85,7 +85,8 @@ SplitView {
|
|||||||
closePolicy: Popup.CloseOnEscape
|
closePolicy: Popup.CloseOnEscape
|
||||||
destroyOnClose: true
|
destroyOnClose: true
|
||||||
|
|
||||||
currencyStore: d.currencyStore
|
currentCurrency: d.currencyStore.currentCurrency
|
||||||
|
formatCurrencyAmount: d.currencyStore.formatCurrencyAmount
|
||||||
flatNetworksModel: d.flatNetworks
|
flatNetworksModel: d.flatNetworks
|
||||||
accountsModel: d.accounts
|
accountsModel: d.accounts
|
||||||
assetsModel: d.tokenAdaptor.outputAssetsModel
|
assetsModel: d.tokenAdaptor.outputAssetsModel
|
||||||
|
@ -15,17 +15,18 @@ import AppLayouts.Wallet.adaptors 1.0
|
|||||||
|
|
||||||
import shared.popups.send.views 1.0
|
import shared.popups.send.views 1.0
|
||||||
import shared.controls 1.0
|
import shared.controls 1.0
|
||||||
import shared.stores 1.0 as SharedStores
|
import StatusQ.Core.Utils 0.1 as SQUtils
|
||||||
import utils 1.0
|
import utils 1.0
|
||||||
|
|
||||||
StatusDialog {
|
StatusDialog {
|
||||||
id: root
|
id: root
|
||||||
|
|
||||||
// models
|
// models
|
||||||
required property SharedStores.CurrenciesStore currencyStore
|
required property string currentCurrency
|
||||||
required property var flatNetworksModel
|
required property var flatNetworksModel
|
||||||
required property var accountsModel
|
required property var accountsModel
|
||||||
required property var assetsModel
|
required property var assetsModel
|
||||||
|
property var formatCurrencyAmount: function() {}
|
||||||
|
|
||||||
// input / output
|
// input / output
|
||||||
property int selectedNetworkChainId: Constants.chains.mainnetChainId
|
property int selectedNetworkChainId: Constants.chains.mainnetChainId
|
||||||
@ -36,7 +37,7 @@ StatusDialog {
|
|||||||
if (!d.isSelectedHoldingValidAsset || !d.selectedHolding.item.marketDetails || !d.selectedHolding.item.marketDetails.currencyPrice) {
|
if (!d.isSelectedHoldingValidAsset || !d.selectedHolding.item.marketDetails || !d.selectedHolding.item.marketDetails.currencyPrice) {
|
||||||
return "0"
|
return "0"
|
||||||
}
|
}
|
||||||
return amountToSendInput.text
|
return SQUtils.AmountsArithmetic.toNumber(amountToSendInput.amount, amountToSendInput.multiplierIndex)
|
||||||
}
|
}
|
||||||
|
|
||||||
objectName: "paymentRequestModal"
|
objectName: "paymentRequestModal"
|
||||||
@ -106,9 +107,9 @@ StatusDialog {
|
|||||||
multiplierIndex: d.isSelectedHoldingValidAsset && !!d.selectedHolding.item.decimals ? d.selectedHolding.item.decimals : 0
|
multiplierIndex: d.isSelectedHoldingValidAsset && !!d.selectedHolding.item.decimals ? d.selectedHolding.item.decimals : 0
|
||||||
price: d.isSelectedHoldingValidAsset && !!d.selectedHolding.item.marketDetails ? d.selectedHolding.item.marketDetails.currencyPrice.amount : 1
|
price: d.isSelectedHoldingValidAsset && !!d.selectedHolding.item.marketDetails ? d.selectedHolding.item.marketDetails.currencyPrice.amount : 1
|
||||||
|
|
||||||
formatFiat: amount => root.currencyStore.formatCurrencyAmount(
|
formatFiat: amount => root.formatCurrencyAmount(
|
||||||
amount, root.currencyStore.currentCurrency)
|
amount, root.currentCurrency)
|
||||||
formatBalance: amount => root.currencyStore.formatCurrencyAmount(
|
formatBalance: amount => root.formatCurrencyAmount(
|
||||||
amount, root.selectedTokenKey)
|
amount, root.selectedTokenKey)
|
||||||
|
|
||||||
showSeparator: true
|
showSeparator: true
|
||||||
@ -159,6 +160,7 @@ StatusDialog {
|
|||||||
statusListItemTitle.customColor: Theme.palette.directColor1
|
statusListItemTitle.customColor: Theme.palette.directColor1
|
||||||
enabled: false
|
enabled: false
|
||||||
}
|
}
|
||||||
|
onCurrentAccountAddressChanged: root.selectedAccountAddress = currentAccountAddress
|
||||||
}
|
}
|
||||||
|
|
||||||
StatusBaseText {
|
StatusBaseText {
|
||||||
|
@ -272,14 +272,6 @@ QtObject {
|
|||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
|
|
||||||
function addPaymentRequest(symbol, amount, address, chainId) {
|
|
||||||
currentChatContentModule().inputAreaModule.paymentRequestModel.addPaymentRequest(address, amount, symbol, chainId)
|
|
||||||
}
|
|
||||||
|
|
||||||
function removePaymentRequest(index) {
|
|
||||||
currentChatContentModule().inputAreaModule.paymentRequestModel.removeItemWithIndex(index)
|
|
||||||
}
|
|
||||||
|
|
||||||
function openCloseCreateChatView() {
|
function openCloseCreateChatView() {
|
||||||
if (root.openCreateChat) {
|
if (root.openCreateChat) {
|
||||||
Global.closeCreateChatView()
|
Global.closeCreateChatView()
|
||||||
|
@ -297,6 +297,7 @@ Item {
|
|||||||
sharedStore: root.sharedRootStore
|
sharedStore: root.sharedRootStore
|
||||||
|
|
||||||
linkPreviewModel: !!d.activeChatContentModule ? d.activeChatContentModule.inputAreaModule.linkPreviewModel : null
|
linkPreviewModel: !!d.activeChatContentModule ? d.activeChatContentModule.inputAreaModule.linkPreviewModel : null
|
||||||
|
paymentRequestModel: !!d.activeChatContentModule ? d.activeChatContentModule.inputAreaModule.paymentRequestModel : null
|
||||||
urlsList: d.urlsList
|
urlsList: d.urlsList
|
||||||
askToEnableLinkPreview: {
|
askToEnableLinkPreview: {
|
||||||
if(!d.activeChatContentModule || !d.activeChatContentModule.inputAreaModule || !d.activeChatContentModule.inputAreaModule.preservedProperties)
|
if(!d.activeChatContentModule || !d.activeChatContentModule.inputAreaModule || !d.activeChatContentModule.inputAreaModule.preservedProperties)
|
||||||
@ -372,6 +373,7 @@ Item {
|
|||||||
chatInput.setText("")
|
chatInput.setText("")
|
||||||
chatInput.textInput.textFormat = TextEdit.PlainText;
|
chatInput.textInput.textFormat = TextEdit.PlainText;
|
||||||
chatInput.textInput.textFormat = TextEdit.RichText;
|
chatInput.textInput.textFormat = TextEdit.RichText;
|
||||||
|
d.activeChatContentModule.inputAreaModule.removeAllPaymentRequestPreviewData()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -396,7 +398,7 @@ Item {
|
|||||||
d.activeChatContentModule.inputAreaModule.setLinkPreviewEnabledForCurrentMessage(false)
|
d.activeChatContentModule.inputAreaModule.setLinkPreviewEnabledForCurrentMessage(false)
|
||||||
}
|
}
|
||||||
onDismissLinkPreview: (index) => d.activeChatContentModule.inputAreaModule.removeLinkPreviewData(index)
|
onDismissLinkPreview: (index) => d.activeChatContentModule.inputAreaModule.removeLinkPreviewData(index)
|
||||||
onOpenPaymentRequestModal: () => Global.openPaymentRequestModalRequested()
|
onOpenPaymentRequestModal: () => Global.openPaymentRequestModalRequested(d.activeChatContentModule.inputAreaModule)
|
||||||
}
|
}
|
||||||
|
|
||||||
ChatPermissionQualificationPanel {
|
ChatPermissionQualificationPanel {
|
||||||
|
@ -164,6 +164,7 @@ Page {
|
|||||||
closeGifPopupAfterSelection: true
|
closeGifPopupAfterSelection: true
|
||||||
usersModel: membersSelector.model
|
usersModel: membersSelector.model
|
||||||
sharedStore: root.sharedRootStore
|
sharedStore: root.sharedRootStore
|
||||||
|
paymentRequestEnabled: false
|
||||||
onStickerSelected: {
|
onStickerSelected: {
|
||||||
root.createChatPropertiesStore.createChatStickerHashId = hashId;
|
root.createChatPropertiesStore.createChatStickerHashId = hashId;
|
||||||
root.createChatPropertiesStore.createChatStickerPackId = packId;
|
root.createChatPropertiesStore.createChatStickerPackId = packId;
|
||||||
|
@ -44,9 +44,9 @@ QtObject {
|
|||||||
false, Constants.ephemeralNotificationType.success, "")
|
false, Constants.ephemeralNotificationType.success, "")
|
||||||
}
|
}
|
||||||
|
|
||||||
/* PRIVATE: This model renames the role "key" to "tokensKey" in TokensBySymbolModel so that
|
/* This model renames the role "key" to "tokensKey" in TokensBySymbolModel so that
|
||||||
it can be easily joined with the Account Assets model */
|
it can be easily joined with the Account Assets model */
|
||||||
readonly property var _renamedTokensBySymbolModel: RolesRenamingModel {
|
readonly property var renamedTokensBySymbolModel: RolesRenamingModel {
|
||||||
sourceModel: walletTokensStore.plainTokensBySymbolModel
|
sourceModel: walletTokensStore.plainTokensBySymbolModel
|
||||||
mapping: [
|
mapping: [
|
||||||
RoleRename {
|
RoleRename {
|
||||||
@ -87,7 +87,7 @@ QtObject {
|
|||||||
|
|
||||||
/* PRIVATE: This model joins the "Tokens By Symbol Model" and "Communities Model" by communityId */
|
/* PRIVATE: This model joins the "Tokens By Symbol Model" and "Communities Model" by communityId */
|
||||||
property LeftJoinModel _jointTokensBySymbolModel: LeftJoinModel {
|
property LeftJoinModel _jointTokensBySymbolModel: LeftJoinModel {
|
||||||
leftModel: _renamedTokensBySymbolModel
|
leftModel: renamedTokensBySymbolModel
|
||||||
rightModel: _renamedCommunitiesModel
|
rightModel: _renamedCommunitiesModel
|
||||||
joinRole: "communityId"
|
joinRole: "communityId"
|
||||||
}
|
}
|
||||||
|
@ -1395,6 +1395,8 @@ Item {
|
|||||||
emojiPopup: statusEmojiPopup.item
|
emojiPopup: statusEmojiPopup.item
|
||||||
stickersPopup: statusStickersPopupLoader.item
|
stickersPopup: statusStickersPopupLoader.item
|
||||||
sendViaPersonalChatEnabled: featureFlagsStore.sendViaPersonalChatEnabled && appMain.networkConnectionStore.sendBuyBridgeEnabled
|
sendViaPersonalChatEnabled: featureFlagsStore.sendViaPersonalChatEnabled && appMain.networkConnectionStore.sendBuyBridgeEnabled
|
||||||
|
areTestNetworksEnabled: appMain.rootStore.profileSectionStore.walletStore.areTestNetworksEnabled
|
||||||
|
paymentRequestEnabled: featureFlagsStore.paymentRequestEnabled
|
||||||
|
|
||||||
onProfileButtonClicked: {
|
onProfileButtonClicked: {
|
||||||
Global.changeAppSectionBySectionType(Constants.appSection.profile);
|
Global.changeAppSectionBySectionType(Constants.appSection.profile);
|
||||||
@ -1560,6 +1562,7 @@ Item {
|
|||||||
transactionStore: appMain.transactionStore
|
transactionStore: appMain.transactionStore
|
||||||
walletAssetsStore: appMain.walletAssetsStore
|
walletAssetsStore: appMain.walletAssetsStore
|
||||||
currencyStore: appMain.currencyStore
|
currencyStore: appMain.currencyStore
|
||||||
|
paymentRequestEnabled: featureFlagsStore.paymentRequestEnabled
|
||||||
|
|
||||||
onProfileButtonClicked: {
|
onProfileButtonClicked: {
|
||||||
Global.changeAppSectionBySectionType(Constants.appSection.profile);
|
Global.changeAppSectionBySectionType(Constants.appSection.profile);
|
||||||
|
@ -53,7 +53,6 @@ QtObject {
|
|||||||
property WalletStores.CollectiblesStore walletCollectiblesStore
|
property WalletStores.CollectiblesStore walletCollectiblesStore
|
||||||
property NetworkConnectionStore networkConnectionStore
|
property NetworkConnectionStore networkConnectionStore
|
||||||
property WalletStores.BuyCryptoStore buyCryptoStore
|
property WalletStores.BuyCryptoStore buyCryptoStore
|
||||||
property ChatStores.RootStore chatStore
|
|
||||||
property bool isDevBuild
|
property bool isDevBuild
|
||||||
|
|
||||||
signal openExternalLink(string link)
|
signal openExternalLink(string link)
|
||||||
@ -105,7 +104,7 @@ QtObject {
|
|||||||
Global.openSwapModalRequested.connect(openSwapModal)
|
Global.openSwapModalRequested.connect(openSwapModal)
|
||||||
Global.openBuyCryptoModalRequested.connect(openBuyCryptoModal)
|
Global.openBuyCryptoModalRequested.connect(openBuyCryptoModal)
|
||||||
Global.privacyPolicyRequested.connect(() => openPopup(privacyPolicyPopupComponent))
|
Global.privacyPolicyRequested.connect(() => openPopup(privacyPolicyPopupComponent))
|
||||||
Global.openPaymentRequestModalRequested.connect(() => openPopup(paymentRequestPopupComponent))
|
Global.openPaymentRequestModalRequested.connect(openPaymentRequestModal)
|
||||||
}
|
}
|
||||||
|
|
||||||
property var currentPopup
|
property var currentPopup
|
||||||
@ -406,6 +405,10 @@ QtObject {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function openPaymentRequestModal(inputAreaModule) {
|
||||||
|
openPopup(paymentRequestModalComponent, {inputAreaModule: inputAreaModule})
|
||||||
|
}
|
||||||
|
|
||||||
readonly property list<Component> _components: [
|
readonly property list<Component> _components: [
|
||||||
Component {
|
Component {
|
||||||
id: removeContactConfirmationDialog
|
id: removeContactConfirmationDialog
|
||||||
@ -1277,21 +1280,25 @@ QtObject {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
Component {
|
Component {
|
||||||
id: paymentRequestPopupComponent
|
id: paymentRequestModalComponent
|
||||||
PaymentRequestModal {
|
PaymentRequestModal {
|
||||||
|
id: paymentRequestModal
|
||||||
readonly property var tokenAdaptor: TokenSelectorViewAdaptor {
|
readonly property var tokenAdaptor: TokenSelectorViewAdaptor {
|
||||||
assetsModel: WalletStores.RootStore.walletAssetsStore.groupedAccountAssetsModel
|
assetsModel: WalletStores.RootStore.walletAssetsStore._renamedTokensBySymbolModel
|
||||||
flatNetworksModel: WalletStores.RootStore.filteredFlatModel
|
flatNetworksModel: WalletStores.RootStore.filteredFlatModel
|
||||||
currentCurrency: root.rootStore.currencyStore.currentCurrency
|
currentCurrency: root.currencyStore.currentCurrency
|
||||||
plainTokensBySymbolModel: WalletStores.RootStore.tokensStore.plainTokensBySymbolModel
|
plainTokensBySymbolModel: WalletStores.RootStore.tokensStore.plainTokensBySymbolModel
|
||||||
|
enabledChainIds: [paymentRequestModal.selectedNetworkChainId]
|
||||||
showAllTokens: true
|
showAllTokens: true
|
||||||
}
|
}
|
||||||
currencyStore: root.rootStore.currencyStore
|
property var inputAreaModule: null
|
||||||
|
currentCurrency: root.currencyStore.currentCurrency
|
||||||
|
formatCurrencyAmount: root.currencyStore.formatCurrencyAmount
|
||||||
flatNetworksModel: WalletStores.RootStore.filteredFlatModel
|
flatNetworksModel: WalletStores.RootStore.filteredFlatModel
|
||||||
accountsModel: WalletStores.RootStore.nonWatchAccounts
|
accountsModel: WalletStores.RootStore.nonWatchAccounts
|
||||||
assetsModel: tokenAdaptor.outputAssetsModel
|
assetsModel: tokenAdaptor.outputAssetsModel
|
||||||
|
|
||||||
onAccepted: root.chatStore.addPaymentRequest(selectedTokenKey, amount, selectedAccountAddress, selectedNetworkChainId)
|
onAccepted: inputAreaModule.addPaymentRequest(selectedAccountAddress, amount, selectedTokenKey, selectedNetworkChainId)
|
||||||
destroyOnClose: true
|
destroyOnClose: true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -34,7 +34,7 @@ Control {
|
|||||||
required property bool showLinkPreviewSettings
|
required property bool showLinkPreviewSettings
|
||||||
|
|
||||||
readonly property alias hoveredUrl: d.hoveredUrl
|
readonly property alias hoveredUrl: d.hoveredUrl
|
||||||
readonly property bool hasContent: imagePreviewArray.length > 0 || showLinkPreviewSettings || linkPreviewRepeater.count > 0 || paymentRequestRepeater.count > 0
|
readonly property bool hasContent: imagePreviewArray.length > 0 || showLinkPreviewSettings || linkPreviewRepeater.count > 0
|
||||||
|
|
||||||
signal imageRemoved(int index)
|
signal imageRemoved(int index)
|
||||||
signal imageClicked(var chatImage)
|
signal imageClicked(var chatImage)
|
||||||
|
@ -72,6 +72,7 @@ Rectangle {
|
|||||||
property var fileUrlsAndSources: []
|
property var fileUrlsAndSources: []
|
||||||
|
|
||||||
property var linkPreviewModel: null
|
property var linkPreviewModel: null
|
||||||
|
property var paymentRequestModel: null
|
||||||
|
|
||||||
property var urlsList: []
|
property var urlsList: []
|
||||||
|
|
||||||
@ -1020,7 +1021,7 @@ Rectangle {
|
|||||||
text: qsTr("Add payment request")
|
text: qsTr("Add payment request")
|
||||||
icon.name: "wallet"
|
icon.name: "wallet"
|
||||||
visibleOnDisabled: control.paymentRequestEnabled
|
visibleOnDisabled: control.paymentRequestEnabled
|
||||||
enabled: control.paymentRequestEnabled && !root.areTestNetworksEnabled
|
enabled: control.paymentRequestEnabled && !control.areTestNetworksEnabled
|
||||||
onTriggered: control.openPaymentRequestModal()
|
onTriggered: control.openPaymentRequestModal()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -92,7 +92,7 @@ QtObject {
|
|||||||
|
|
||||||
signal privacyPolicyRequested()
|
signal privacyPolicyRequested()
|
||||||
|
|
||||||
signal openPaymentRequestModalRequested()
|
signal openPaymentRequestModalRequested(var inputAreaModule)
|
||||||
|
|
||||||
// Swap
|
// Swap
|
||||||
signal openSwapModalRequested(var formDataParams)
|
signal openSwapModalRequested(var formDataParams)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user