Refactor: Moved openPopup function to Global

The openPopup function was declared in AppMain
and used via dynamic scoping in many places in the
application. Moved function to Global component
and updated all places to call it via Global instead.

Closes #4267
This commit is contained in:
Alexandra Betouni 2021-12-07 22:33:12 +02:00 committed by Sale Djenic
parent 336f90a60f
commit f0b39ce4f6
39 changed files with 107 additions and 161 deletions

View File

@ -66,7 +66,7 @@ Item {
//% "Membership requests" //% "Membership requests"
title: qsTrId("membership-requests") title: qsTrId("membership-requests")
requestsCount: nbRequests requestsCount: nbRequests
sensor.onClicked: openPopup(membershipRequestPopup) sensor.onClicked: Global.openPopup(membershipRequestPopup)
} }
StatusModalDivider { StatusModalDivider {
@ -171,7 +171,7 @@ Item {
//% "View Profile" //% "View Profile"
text: qsTrId("view-profile") text: qsTrId("view-profile")
icon.name: "channel" icon.name: "channel"
onTriggered: openPopup(profilePopup, { onTriggered: Global.openPopup(profilePopup, {
noFooter: userProfile.pubKey !== model.pubKey, noFooter: userProfile.pubKey !== model.pubKey,
userName: model.userName, userName: model.userName,
fromAuthor: model.pubKey, fromAuthor: model.pubKey,

View File

@ -88,7 +88,7 @@ Rectangle {
anchors.horizontalCenter: parent.horizontalCenter anchors.horizontalCenter: parent.horizontalCenter
anchors.bottom: manageBtn.top anchors.bottom: manageBtn.top
anchors.bottomMargin: Style.current.halfPadding anchors.bottomMargin: Style.current.halfPadding
onClicked: openPopup(inviteFriendsToCommunityPopup, { onClicked: Global.openPopup(inviteFriendsToCommunityPopup, {
community: root.activeCommunity community: root.activeCommunity
}) })
} }
@ -100,7 +100,7 @@ Rectangle {
anchors.horizontalCenter: parent.horizontalCenter anchors.horizontalCenter: parent.horizontalCenter
anchors.bottom: parent.bottom anchors.bottom: parent.bottom
anchors.bottomMargin: Style.current.padding anchors.bottomMargin: Style.current.padding
onClicked: openPopup(communityProfilePopup, { onClicked: Global.openPopup(communityProfilePopup, {
store: rootStore, store: rootStore,
community: root.activeCommunity community: root.activeCommunity
}) })

View File

@ -178,7 +178,7 @@ StatusModal {
//% "Pinned messages" //% "Pinned messages"
text: qsTrId("pinned-messages") text: qsTrId("pinned-messages")
currentValue: pinnedCount currentValue: pinnedCount
onClicked: openPopup(pinnedMessagesPopupComponent) onClicked: Global.openPopup(pinnedMessagesPopupComponent)
iconSource: Style.svg("pin") iconSource: Style.svg("pin")
} }

View File

@ -299,7 +299,7 @@ StatusModal {
if(gasSelector.eip1599Enabled && stack.currentGroup === groupSelectGas && gasSelector.advancedMode){ if(gasSelector.eip1599Enabled && stack.currentGroup === groupSelectGas && gasSelector.advancedMode){
if(gasSelector.showPriceLimitWarning || gasSelector.showTipLimitWarning){ if(gasSelector.showPriceLimitWarning || gasSelector.showTipLimitWarning){
openPopup(transactionSettingsConfirmationPopupComponent, { Global.openPopup(transactionSettingsConfirmationPopupComponent, {
currentBaseFee: gasSelector.latestBaseFeeGwei, currentBaseFee: gasSelector.latestBaseFeeGwei,
currentMinimumTip: gasSelector.perGasTipLimitFloor, currentMinimumTip: gasSelector.perGasTipLimitFloor,
currentAverageTip: gasSelector.perGasTipLimitAverage, currentAverageTip: gasSelector.perGasTipLimitAverage,

View File

@ -40,7 +40,7 @@ StatusModal {
icon.name: "download" icon.name: "download"
//% "Access existing community" //% "Access existing community"
text: qsTrId("access-existing-community") text: qsTrId("access-existing-community")
onTriggered: openPopup(importCommunitiesPopupComponent) onTriggered: Global.openPopup(importCommunitiesPopupComponent)
} }
} }
} }
@ -132,7 +132,7 @@ StatusModal {
popup.setActiveCommunity(id); popup.setActiveCommunity(id);
} else { } else {
popup.setObservedCommunity(id); popup.setObservedCommunity(id);
openPopup(communityDetailPopup) Global.openPopup(communityDetailPopup)
} }
popup.close() popup.close()
} }
@ -146,7 +146,7 @@ StatusModal {
//% "Create a community" //% "Create a community"
text: qsTrId("create-community") text: qsTrId("create-community")
onClicked: { onClicked: {
openPopup(createCommunitiesPopupComponent) Global.openPopup(createCommunitiesPopupComponent)
popup.close() popup.close()
} }
} }

View File

@ -146,7 +146,7 @@ StatusModal {
icon.width: 20 icon.width: 20
rotation: 180 rotation: 180
onClicked: { onClicked: {
openPopup(communitiesPopupComponent) Global.openPopup(communitiesPopupComponent)
root.close() root.close()
} }
} }

View File

@ -63,12 +63,12 @@ StatusModal {
onNotificationsButtonClicked: { onNotificationsButtonClicked: {
root.store.setCommunityMuted(root.community.id, checked); root.store.setCommunityMuted(root.community.id, checked);
} }
onEditButtonClicked: openPopup(editCommunityPopup, { onEditButtonClicked: Global.openPopup(editCommunityPopup, {
store: root.store, store: root.store,
community: root.community, community: root.community,
onSave: root.close onSave: root.close
}) })
onTransferOwnershipButtonClicked: openPopup(transferOwnershiproot, { onTransferOwnershipButtonClicked: Global.openPopup(transferOwnershiproot, {
privateKey: root.store.exportCommunity(), privateKey: root.store.exportCommunity(),
store: root.store store: root.store
}) })

View File

@ -163,7 +163,7 @@ StatusModal {
icon.name: "delete" icon.name: "delete"
type: StatusListItem.Type.Danger type: StatusListItem.Type.Danger
sensor.onClicked: { sensor.onClicked: {
openPopup(deleteCategoryConfirmationDialogComponent, { Global.openPopup(deleteCategoryConfirmationDialogComponent, {
//% "Delete %1 category" //% "Delete %1 category"
title: qsTrId("delete--1-category").arg(root.contentItem.categoryName.input.text), title: qsTrId("delete--1-category").arg(root.contentItem.categoryName.input.text),
//% "Are you sure you want to delete %1 category? Channels inside the category wont be deleted." //% "Are you sure you want to delete %1 category? Channels inside the category wont be deleted."

View File

@ -180,7 +180,7 @@ StatusModal {
} }
] ]
sensor.onClicked: openPopup(pinnedMessagesPopupComponent) sensor.onClicked: Global.openPopup(pinnedMessagesPopupComponent)
} }
Item { Item {

View File

@ -200,7 +200,7 @@ Item {
chatInfoButton.pinnedMessagesCount: root.rootStore.chatsModelInst.messageView.pinnedMessagesList.count chatInfoButton.pinnedMessagesCount: root.rootStore.chatsModelInst.messageView.pinnedMessagesList.count
chatInfoButton.muted: root.rootStore.chatsModelInst.channelView.activeChannel.muted chatInfoButton.muted: root.rootStore.chatsModelInst.channelView.activeChannel.muted
chatInfoButton.onPinnedMessagesCountClicked: openPopup(pinnedMessagesPopupComponent) chatInfoButton.onPinnedMessagesCountClicked: Global.openPopup(pinnedMessagesPopupComponent)
chatInfoButton.onUnmute: root.rootStore.chatsModelInst.channelView.unmuteChatItem(chatsModel.channelView.activeChannel.id) chatInfoButton.onUnmute: root.rootStore.chatsModelInst.channelView.unmuteChatItem(chatsModel.channelView.activeChannel.id)
chatInfoButton.sensor.enabled: root.rootStore.chatsModelInst.channelView.activeChannel.chatType !== Constants.chatTypePublic && chatInfoButton.sensor.enabled: root.rootStore.chatsModelInst.channelView.activeChannel.chatType !== Constants.chatTypePublic &&
@ -208,7 +208,7 @@ Item {
chatInfoButton.onClicked: { chatInfoButton.onClicked: {
switch (root.rootStore.chatsModelInst.channelView.activeChannel.chatType) { switch (root.rootStore.chatsModelInst.channelView.activeChannel.chatType) {
case Constants.chatTypePrivateGroupChat: case Constants.chatTypePrivateGroupChat:
openPopup(groupInfoPopupComponent, { Global.openPopup(groupInfoPopupComponent, {
channelType: GroupInfoPopup.ChannelType.ActiveChannel, channelType: GroupInfoPopup.ChannelType.ActiveChannel,
channel: root.rootStore.chatsModelInst.channelView.activeChannel channel: root.rootStore.chatsModelInst.channelView.activeChannel
}) })

View File

@ -47,7 +47,7 @@ StatusPopupMenu {
) )
} }
if (chatItem.chatType === Constants.chatTypePrivateGroupChat) { if (chatItem.chatType === Constants.chatTypePrivateGroupChat) {
return openPopup(groupInfoPopupComponent, { return Global.openPopup(groupInfoPopupComponent, {
channel: chatItem, channel: chatItem,
channelType: GroupInfoPopup.ChannelType.ContextChannel channelType: GroupInfoPopup.ChannelType.ContextChannel
}) })
@ -104,7 +104,7 @@ StatusPopupMenu {
icon.name: "edit" icon.name: "edit"
enabled: communityActive && enabled: communityActive &&
root.store.chatsModelInst.communities.activeCommunity.admin root.store.chatsModelInst.communities.activeCommunity.admin
onTriggered: openPopup(editChannelPopup, { onTriggered: Global.openPopup(editChannelPopup, {
store: root.store, store: root.store,
communityId: root.store.chatsModelInst.communities.activeCommunity.id, communityId: root.store.chatsModelInst.communities.activeCommunity.id,
channel: chatItem channel: chatItem
@ -140,7 +140,7 @@ StatusPopupMenu {
type: StatusMenuItem.Type.Danger type: StatusMenuItem.Type.Danger
onTriggered: { onTriggered: {
openPopup(deleteChatConfirmationDialogComponent) Global.openPopup(deleteChatConfirmationDialogComponent)
} }
enabled: !communityActive || root.store.chatsModelInst.communities.activeCommunity.admin enabled: !communityActive || root.store.chatsModelInst.communities.activeCommunity.admin

View File

@ -46,7 +46,7 @@ Item {
// chatInfoButton.image.source: root.store.chatsModelInst.communities.activeCommunity.thumbnailImage // chatInfoButton.image.source: root.store.chatsModelInst.communities.activeCommunity.thumbnailImage
// chatInfoButton.icon.color: root.store.chatsModelInst.communities.activeCommunity.communityColor // chatInfoButton.icon.color: root.store.chatsModelInst.communities.activeCommunity.communityColor
// menuButton.visible: root.store.chatsModelInst.communities.activeCommunity.admin && root.store.chatsModelInst.communities.activeCommunity.canManageUsers // menuButton.visible: root.store.chatsModelInst.communities.activeCommunity.admin && root.store.chatsModelInst.communities.activeCommunity.canManageUsers
// chatInfoButton.onClicked: openPopup(communityProfilePopup, { // chatInfoButton.onClicked: Global.openPopup(communityProfilePopup, {
// store: root.store, // store: root.store,
// community: root.store.chatsModelInst.communities.activeCommunity // community: root.store.chatsModelInst.communities.activeCommunity
// }) // })
@ -57,7 +57,7 @@ Item {
text: qsTrId("create-channel") text: qsTrId("create-channel")
icon.name: "channel" icon.name: "channel"
//enabled: root.store.chatsModelInst.communities.activeCommunity.admin //enabled: root.store.chatsModelInst.communities.activeCommunity.admin
onTriggered: openPopup(createChannelPopup, {communityId: chatsModel.communities.activeCommunity.id}) onTriggered: Global.openPopup(createChannelPopup, {communityId: chatsModel.communities.activeCommunity.id})
} }
StatusMenuItem { StatusMenuItem {
@ -65,7 +65,7 @@ Item {
text: qsTrId("create-category") text: qsTrId("create-category")
icon.name: "channel-category" icon.name: "channel-category"
//enabled: root.store.chatsModelInst.communities.activeCommunity.admin //enabled: root.store.chatsModelInst.communities.activeCommunity.admin
onTriggered: openPopup(createCategoryPopup, {communityId: chatsModel.communities.activeCommunity.id}) onTriggered: Global.openPopup(createCategoryPopup, {communityId: chatsModel.communities.activeCommunity.id})
} }
StatusMenuSeparator {} StatusMenuSeparator {}
@ -75,7 +75,7 @@ Item {
text: qsTrId("invite-people") text: qsTrId("invite-people")
icon.name: "share-ios" icon.name: "share-ios"
//enabled: root.store.chatsModelInst.communities.activeCommunity.canManageUsers //enabled: root.store.chatsModelInst.communities.activeCommunity.canManageUsers
onTriggered: openPopup(inviteFriendsToCommunityPopup, { onTriggered: Global.openPopup(inviteFriendsToCommunityPopup, {
community: root.store.chatsModelInst.communities.activeCommunity community: root.store.chatsModelInst.communities.activeCommunity
}) })
} }
@ -101,7 +101,7 @@ Item {
//% "Membership requests" //% "Membership requests"
title: qsTrId("membership-requests") title: qsTrId("membership-requests")
requestsCount: membershipRequests.nbRequests requestsCount: membershipRequests.nbRequests
sensor.onClicked: openPopup(membershipRequestPopup) sensor.onClicked: Global.openPopup(membershipRequestPopup)
} }
} }
} }
@ -164,7 +164,7 @@ Item {
// root.store.chatsModelInst.communities.reorderCommunityCategories(chatsModel.communities.activeCommunity.id, categoryId, to); // root.store.chatsModelInst.communities.reorderCommunityCategories(chatsModel.communities.activeCommunity.id, categoryId, to);
// } // }
// onCategoryAddButtonClicked: openPopup(createChannelPopup, { // onCategoryAddButtonClicked: Global.openPopup(createChannelPopup, {
// communityId: root.store.chatsModelInst.communities.activeCommunity.id, // communityId: root.store.chatsModelInst.communities.activeCommunity.id,
// categoryId: id // categoryId: id
// }) // })
@ -175,7 +175,7 @@ Item {
text: qsTrId("create-channel") text: qsTrId("create-channel")
icon.name: "channel" icon.name: "channel"
enabled: chatsModel.communities.activeCommunity.admin enabled: chatsModel.communities.activeCommunity.admin
onTriggered: openPopup(createChannelPopup, {communityId: root.store.chatsModelInst.communities.activeCommunity.id}) onTriggered: Global.openPopup(createChannelPopup, {communityId: root.store.chatsModelInst.communities.activeCommunity.id})
} }
StatusMenuItem { StatusMenuItem {
@ -185,7 +185,7 @@ Item {
// Not Refactored Yet // Not Refactored Yet
enabled: false enabled: false
//enabled: root.store.chatsModelInst.communities.activeCommunity.admin //enabled: root.store.chatsModelInst.communities.activeCommunity.admin
onTriggered: openPopup(createCategoryPopup, {communityId: root.store.chatsModelInst.communities.activeCommunity.id}) onTriggered: Global.openPopup(createCategoryPopup, {communityId: root.store.chatsModelInst.communities.activeCommunity.id})
} }
StatusMenuSeparator {} StatusMenuSeparator {}
@ -197,7 +197,7 @@ Item {
// Not Refactored Yet // Not Refactored Yet
enabled: false enabled: false
//enabled: root.store.chatsModelInst.communities.activeCommunity.canManageUsers //enabled: root.store.chatsModelInst.communities.activeCommunity.canManageUsers
onTriggered: openPopup(inviteFriendsToCommunityPopup, { onTriggered: Global.openPopup(inviteFriendsToCommunityPopup, {
community: root.store.chatsModelInst.communities.activeCommunity community: root.store.chatsModelInst.communities.activeCommunity
}) })
} }
@ -219,7 +219,7 @@ Item {
text: qsTrId("edit-category") text: qsTrId("edit-category")
icon.name: "edit" icon.name: "edit"
onTriggered: { onTriggered: {
openPopup(createCategoryPopup, { Global.openPopup(createCategoryPopup, {
communityId: root.store.chatsModelInst.communities.activeCommunity.id, communityId: root.store.chatsModelInst.communities.activeCommunity.id,
isEdit: true, isEdit: true,
categoryId: categoryItem.id, categoryId: categoryItem.id,
@ -243,7 +243,7 @@ Item {
icon.name: "delete" icon.name: "delete"
type: StatusMenuItem.Type.Danger type: StatusMenuItem.Type.Danger
onTriggered: { onTriggered: {
openPopup(deleteCategoryConfirmationDialogComponent, { Global.openPopup(deleteCategoryConfirmationDialogComponent, {
//% "Delete %1 category" //% "Delete %1 category"
title: qsTrId("delete--1-category").arg(categoryItem.name), title: qsTrId("delete--1-category").arg(categoryItem.name),
//% "Are you sure you want to delete %1 category? Channels inside the category wont be deleted." //% "Are you sure you want to delete %1 category? Channels inside the category wont be deleted."
@ -301,7 +301,7 @@ Item {
id: backupBanner id: backupBanner
activeCommunity: store.activeCommunity activeCommunity: store.activeCommunity
onBackupButtonClicked: { onBackupButtonClicked: {
openPopup(transferOwnershipPopup, { Global.openPopup(transferOwnershipPopup, {
privateKey: root.store.exportCommunity(), privateKey: root.store.exportCommunity(),
store: root.store store: root.store
}) })

View File

@ -34,7 +34,7 @@ Item {
Component.onCompleted: { Component.onCompleted: {
appMain.openContactsPopup.connect(function(){ appMain.openContactsPopup.connect(function(){
openPopup(contactRequestsPopup) Global.openPopup(contactRequestsPopup)
}) })
} }
@ -161,28 +161,28 @@ Item {
//% "Start new chat" //% "Start new chat"
text: qsTrId("start-new-chat") text: qsTrId("start-new-chat")
icon.name: "private-chat" icon.name: "private-chat"
onTriggered: openPopup(privateChatPopupComponent) onTriggered: Global.openPopup(privateChatPopupComponent)
} }
StatusMenuItem { StatusMenuItem {
//% "Start group chat" //% "Start group chat"
text: qsTrId("start-group-chat") text: qsTrId("start-group-chat")
icon.name: "group-chat" icon.name: "group-chat"
onTriggered: openPopup(groupChatPopupComponent) onTriggered: Global.openPopup(groupChatPopupComponent)
} }
StatusMenuItem { StatusMenuItem {
//% "Join public chat" //% "Join public chat"
text: qsTrId("new-public-group-chat") text: qsTrId("new-public-group-chat")
icon.name: "public-chat" icon.name: "public-chat"
onTriggered: openPopup(publicChatPopupComponent) onTriggered: Global.openPopup(publicChatPopupComponent)
} }
StatusMenuItem { StatusMenuItem {
//% "Communities" //% "Communities"
text: qsTrId("communities") text: qsTrId("communities")
icon.name: "communities" icon.name: "communities"
onTriggered: openPopup(communitiesPopupComponent) onTriggered: Global.openPopup(communitiesPopupComponent)
enabled: localAccountSensitiveSettings.communitiesEnabled enabled: localAccountSensitiveSettings.communitiesEnabled
} }
} }
@ -205,7 +205,7 @@ Item {
title: qsTrId("contact-requests") title: qsTrId("contact-requests")
requestsCount: nbRequests requestsCount: nbRequests
sensor.onClicked: openPopup(contactRequestsPopup) sensor.onClicked: Global.openPopup(contactRequestsPopup)
} }
ScrollView { ScrollView {

View File

@ -19,7 +19,7 @@ RadioButtonSelector {
if (checked) { if (checked) {
if (profileModel.fleets.fleet === root.fleetName) return; if (profileModel.fleets.fleet === root.fleetName) return;
root.newFleet = root.fleetName; root.newFleet = root.fleetName;
openPopup(confirmDialogComponent) Global.openPopup(confirmDialogComponent)
} }
} }

View File

@ -20,7 +20,7 @@ RadioButtonSelector {
if (checked) { if (checked) {
if (profileModel.network.current === root.network) return; if (profileModel.network.current === root.network) return;
root.newNetwork = root.network; root.newNetwork = root.network;
openPopup(confirmDialogComponent) Global.openPopup(confirmDialogComponent)
} }
} }

View File

@ -282,7 +282,7 @@ ModalPopup {
validationError = ""; validationError = "";
txtFieldWord.text = ""; txtFieldWord.text = "";
openPopup(removeSeedPhraseConfirmDialogComponent); Global.openPopup(removeSeedPhraseConfirmDialogComponent);
} }
} }
} }

View File

@ -65,7 +65,7 @@ ModalPopup {
MouseArea { MouseArea {
anchors.fill: parent anchors.fill: parent
cursorShape: Qt.PointingHandCursor cursorShape: Qt.PointingHandCursor
onClicked: openPopup(addNetworkPopupComponent) onClicked: Global.openPopup(addNetworkPopupComponent)
} }
} }

View File

@ -54,7 +54,7 @@ ModalPopup {
checked: localAccountSettings.storeToKeychainValue === Constants.storeToKeychainValueStore checked: localAccountSettings.storeToKeychainValue === Constants.storeToKeychainValueStore
onCheckedChanged: { onCheckedChanged: {
if (checked && localAccountSettings.storeToKeychainValue !== Constants.storeToKeychainValueStore) { if (checked && localAccountSettings.storeToKeychainValue !== Constants.storeToKeychainValueStore) {
var storePassPopup = openPopup(storePasswordModal) var storePassPopup = Global.openPopup(storePasswordModal)
if(storePassPopup) if(storePassPopup)
{ {
storePassPopup.closed.connect(function(){ storePassPopup.closed.connect(function(){

View File

@ -59,7 +59,7 @@ Item {
} }
onClicked: { onClicked: {
root.store.checkForUpdates(); root.store.checkForUpdates();
openPopup(downloadModalComponent, {newVersionAvailable: newVersionJSON.available, downloadURL: newVersionJSON.url}) Global.openPopup(downloadModalComponent, {newVersionAvailable: newVersionJSON.available, downloadURL: newVersionJSON.url})
} }
} }
} }

View File

@ -281,7 +281,7 @@ ScrollView {
btnText: qsTrId("light-node") btnText: qsTrId("light-node")
onToggled: { onToggled: {
if (root.store.bloomLevel != "light") { if (root.store.bloomLevel != "light") {
openPopup(bloomConfirmationDialogComponent, {mode: "light"}) Global.openPopup(bloomConfirmationDialogComponent, {mode: "light"})
} else { } else {
btnBloomLight.click() btnBloomLight.click()
} }
@ -296,7 +296,7 @@ ScrollView {
btnText: qsTrId("normal") btnText: qsTrId("normal")
onToggled: { onToggled: {
if (root.store.bloomLevel != "normal") { if (root.store.bloomLevel != "normal") {
openPopup(bloomConfirmationDialogComponent, {mode: "normal"}) Global.openPopup(bloomConfirmationDialogComponent, {mode: "normal"})
} else { } else {
btnBloomNormal.click() btnBloomNormal.click()
} }
@ -311,7 +311,7 @@ ScrollView {
btnText: qsTrId("full-node") btnText: qsTrId("full-node")
onToggled: { onToggled: {
if (root.store.bloomLevel != "full") { if (root.store.bloomLevel != "full") {
openPopup(bloomConfirmationDialogComponent, {mode: "full"}) Global.openPopup(bloomConfirmationDialogComponent, {mode: "full"})
} else { } else {
btnBloomFull.click() btnBloomFull.click()
} }
@ -363,7 +363,7 @@ ScrollView {
btnText: qsTrId("light-node") btnText: qsTrId("light-node")
onToggled: { onToggled: {
if (!root.store.isWakuV2LightClient) { if (!root.store.isWakuV2LightClient) {
openPopup(wakuV2ModeConfirmationDialogComponent, {mode: true}) Global.openPopup(wakuV2ModeConfirmationDialogComponent, {mode: true})
} else { } else {
btnWakuV2Light.click() btnWakuV2Light.click()
} }
@ -378,7 +378,7 @@ ScrollView {
btnText: qsTrId("full-node") btnText: qsTrId("full-node")
onToggled: { onToggled: {
if (root.store.isWakuV2LightClient) { if (root.store.isWakuV2LightClient) {
openPopup(wakuV2ModeConfirmationDialogComponent, {mode: false}) Global.openPopup(wakuV2ModeConfirmationDialogComponent, {mode: false})
} else { } else {
btnWakuV2Full.click() btnWakuV2Full.click()
} }
@ -386,41 +386,6 @@ ScrollView {
} }
} }
StatusSectionHeadline {
text: qsTr("Developer features")
topPadding: Style.current.bigPadding
bottomPadding: Style.current.padding
}
Separator {
anchors.topMargin: Style.current.bigPadding
anchors.left: parent.left
anchors.leftMargin: -Style.current.padding
anchors.right: parent.right
anchors.rightMargin: -Style.current.padding
}
StatusSettingsLineButton {
text: qsTr("Full developer mode")
isEnabled: {
return !localAccountSensitiveSettings.downloadChannelMessagesEnabled ||
!root.store.profileModuleInst.isTelemetryEnabled ||
!root.store.profileModuleInst.isDebugEnabled ||
!root.store.profileModuleInst.isAutoMessageEnabled
}
onClicked: {
openPopup(enableDeveloperFeaturesConfirmationDialogComponent)
}
}
Separator {
anchors.topMargin: Style.current.bigPadding
anchors.left: parent.left
anchors.leftMargin: -Style.current.padding
anchors.right: parent.right
anchors.rightMargin: -Style.current.padding
}
// TODO: replace with StatusQ component // TODO: replace with StatusQ component
StatusSettingsLineButton { StatusSettingsLineButton {
text: qsTr("Download messages") text: qsTr("Download messages")
@ -433,11 +398,22 @@ ScrollView {
// TODO: replace with StatusQ component // TODO: replace with StatusQ component
StatusSettingsLineButton { StatusSettingsLineButton {
text: qsTr("Telemetry") text: qsTr("Stickers/ENS on ropsten")
visible: root.store.currentNetwork === Constants.networkRopsten
isSwitch: true
switchChecked: localAccountSensitiveSettings.stickersEnsRopsten
onClicked: {
localAccountSensitiveSettings.stickersEnsRopsten = !localAccountSensitiveSettings.stickersEnsRopsten
}
}
// TODO: replace with StatusQ component
StatusSettingsLineButton {
text: qsTr("Enable Telemetry")
isSwitch: true isSwitch: true
switchChecked: root.store.profileModuleInst.isTelemetryEnabled switchChecked: root.store.profileModuleInst.isTelemetryEnabled
onClicked: { onClicked: {
openPopup(enableTelemetryConfirmationDialogComponent) Global.openPopup(enableTelemetryConfirmationDialogComponent, {light: false})
} }
} }
@ -447,28 +423,17 @@ ScrollView {
isSwitch: true isSwitch: true
switchChecked: root.store.profileModuleInst.isDebugEnabled switchChecked: root.store.profileModuleInst.isDebugEnabled
onClicked: { onClicked: {
openPopup(enableDebugComponent) Global.openPopup(enableDebugComponent)
} }
} }
// TODO: replace with StatusQ component // TODO: replace with StatusQ component
StatusSettingsLineButton { StatusSettingsLineButton {
text: qsTr("Auto message") text: qsTr("Enable Auto message")
isSwitch: true isSwitch: true
switchChecked: root.store.profileModuleInst.isAutoMessageEnabled switchChecked: root.store.profileModuleInst.isAutoMessageEnabled
onClicked: { onClicked: {
openPopup(enableAutoMessageConfirmationDialogComponent) Global.openPopup(enableAutoMessageConfirmationDialogComponent, {light: false})
}
}
// TODO: replace with StatusQ component
StatusSettingsLineButton {
text: qsTr("Stickers/ENS on ropsten")
visible: root.store.currentNetwork === Constants.networkRopsten
isSwitch: true
switchChecked: localAccountSensitiveSettings.stickersEnsRopsten
onClicked: {
localAccountSensitiveSettings.stickersEnsRopsten = !localAccountSensitiveSettings.stickersEnsRopsten
} }
} }
} }
@ -481,26 +446,6 @@ ScrollView {
id: fleetModal id: fleetModal
} }
Component {
id: enableDeveloperFeaturesConfirmationDialogComponent
ConfirmationDialog {
property bool mode: false
id: confirmDialog
showCancelButton: true
confirmationText: qsTr("Are you sure you want to enable all the develoer features? The app will be restarted.")
onConfirmButtonClicked: {
localAccountSensitiveSettings.downloadChannelMessagesEnabled = true
Qt.callLater(root.store.profileModuleInst.enableDeveloperFeatures)
close()
}
onCancelButtonClicked: {
close()
}
}
}
Component { Component {
id: enableTelemetryConfirmationDialogComponent id: enableTelemetryConfirmationDialogComponent
ConfirmationDialog { ConfirmationDialog {
@ -544,7 +489,7 @@ ScrollView {
id: confirmDialog id: confirmDialog
showCancelButton: true showCancelButton: true
confirmationText: qsTr("Are you sure you want to %1 debug mode? You need to restart the app for this change to take effect.").arg(root.store.profileModuleInst.isDebugEnabled ? confirmationText: qsTr("Are you sure you want to %1 debug mode? The app will be restarted for this change to take effect.").arg(root.store.profileModuleInst.isDebugEnabled ?
qsTr("disable") : qsTr("disable") :
qsTr("enable")) qsTr("enable"))
onConfirmButtonClicked: { onConfirmButtonClicked: {

View File

@ -137,7 +137,7 @@ Item {
anchors.leftMargin: 24 anchors.leftMargin: 24
text: qsTrId("Release username") text: qsTrId("Release username")
onClicked: { onClicked: {
openPopup(transactionDialogComponent) Global.openPopup(transactionDialogComponent)
} }
} }

View File

@ -197,7 +197,7 @@ Item {
} }
if(ensStatus === Constants.ens_connected_dkey || ensStatus === Constants.ens_owned){ if(ensStatus === Constants.ens_connected_dkey || ensStatus === Constants.ens_owned){
openPopup(transactionDialogComponent) Global.openPopup(transactionDialogComponent)
return; return;
} }
} }

View File

@ -105,7 +105,7 @@ Item {
color: Theme.palette.baseColor1 color: Theme.palette.baseColor1
} }
] ]
sensor.onClicked: openPopup(storeToKeychainSelectionModal) sensor.onClicked: Global.openPopup(storeToKeychainSelectionModal)
Component { Component {
id: storePasswordModal id: storePasswordModal
@ -229,7 +229,7 @@ Item {
color: Theme.palette.baseColor1 color: Theme.palette.baseColor1
} }
] ]
sensor.onClicked: openPopup(chatLinksPreviewModal) sensor.onClicked: Global.openPopup(chatLinksPreviewModal)
} }
Component { Component {
@ -259,7 +259,7 @@ Item {
color: Theme.palette.baseColor1 color: Theme.palette.baseColor1
} }
] ]
sensor.onClicked: openPopup(openLinksWithModal) sensor.onClicked: Global.openPopup(openLinksWithModal)
} }
StatusListItem { StatusListItem {

View File

@ -147,7 +147,7 @@ Item {
//% "Receive" //% "Receive"
text: qsTrId("receive") text: qsTrId("receive")
onClicked: function () { onClicked: function () {
openPopup(receiveModalComponent); Global.openPopup(receiveModalComponent);
} }
anchors.left: sendBtn.right anchors.left: sendBtn.right
anchors.leftMargin: walletMenu.btnOuterMargin anchors.leftMargin: walletMenu.btnOuterMargin
@ -180,7 +180,7 @@ Item {
icon.source: Style.svg("manage-wallet") icon.source: Style.svg("manage-wallet")
icon.width: 16 icon.width: 16
icon.height: 16 icon.height: 16
onTriggered: openPopup(accountSettingsModalComponent) onTriggered: Global.openPopup(accountSettingsModalComponent)
} }
Action { Action {
//% "Manage Assets" //% "Manage Assets"
@ -189,7 +189,7 @@ Item {
icon.width: 16 icon.width: 16
icon.height: 16 icon.height: 16
onTriggered: { onTriggered: {
openPopup(tokenSettingsModalComponent) Global.openPopup(tokenSettingsModalComponent)
} }
} }
Action { Action {
@ -199,7 +199,7 @@ Item {
icon.width: 16 icon.width: 16
icon.height: 16 icon.height: 16
onTriggered: { onTriggered: {
openPopup(setCurrencyModalComponent) Global.openPopup(setCurrencyModalComponent)
} }
} }
} }

View File

@ -63,8 +63,7 @@ Item {
anchors.fill: accountRow anchors.fill: accountRow
cursorShape: Qt.PointingHandCursor cursorShape: Qt.PointingHandCursor
onClicked: { onClicked: {
//TOOD improve this to not use dynamic scoping Global.openPopup(shareModalComponent);
openPopup(shareModalComponent);
} }
} }

View File

@ -84,8 +84,7 @@ Item {
rightPadding: 11 rightPadding: 11
visible: !root.loading visible: !root.loading
onClicked: { onClicked: {
//TODO improve this to not use dynamic scoping Global.openPopup(addEditSavedAddress)
appMain.openPopup(addEditSavedAddress)
} }
} }
StatusLoadingIndicator { StatusLoadingIndicator {
@ -119,8 +118,7 @@ Item {
StatusRoundButton { StatusRoundButton {
icon.name: "pencil" icon.name: "pencil"
visible: showButtons visible: showButtons
//TODO improve this to not use dynamic scoping onClicked: Global.openPopup(addEditSavedAddress,
onClicked: appMain.openPopup(addEditSavedAddress,
{ {
edit: true, edit: true,
address: address, address: address,

View File

@ -47,7 +47,12 @@ Item {
browserLayoutContainer.item.openUrlInNewTab(link); browserLayoutContainer.item.openUrlInNewTab(link);
} }
onOpenChooseBrowserPopup: { onOpenChooseBrowserPopup: {
appMain.openPopup(chooseBrowserPopupComponent, {link: link}) Global.openPopup(chooseBrowserPopupComponent, {link: link});
}
onOpenPopupRequested: {
const popup = popupComponent.createObject(appMain, params);
popup.open();
return popup;
} }
} }
@ -75,12 +80,6 @@ Item {
return appMain.rootStore.contactsModuleInst.model.list.rowData(index, useLargeImage ? "largeImage" : "thumbnailImage") return appMain.rootStore.contactsModuleInst.model.list.rowData(index, useLargeImage ? "largeImage" : "thumbnailImage")
} }
function openPopup(popupComponent, params = {}) {
const popup = popupComponent.createObject(appMain, params);
popup.open()
return popup
}
function getContactListObject(dataModel) { function getContactListObject(dataModel) {
const nbContacts = appMain.rootStore.contactsModuleInst.model.list.rowCount() const nbContacts = appMain.rootStore.contactsModuleInst.model.list.rowCount()
const contacts = [] const contacts = []
@ -170,7 +169,7 @@ Item {
text: qsTr("A new version of Status (%1) is available").arg(newVersionJSON.version) text: qsTr("A new version of Status (%1) is available").arg(newVersionJSON.version)
btnText: qsTr("Download") btnText: qsTr("Download")
onClick: function(){ onClick: function(){
openPopup(downloadModalComponent, {newVersionAvailable: newVersionJSON.available, downloadURL: newVersionJSON.url}) Global.openPopup(downloadModalComponent, {newVersionAvailable: newVersionJSON.available, downloadURL: newVersionJSON.url})
} }
} }
@ -260,7 +259,7 @@ Item {
text: qsTrId("invite-people") text: qsTrId("invite-people")
icon.name: "share-ios" icon.name: "share-ios"
enabled: chatsModel.communities.observedCommunity.canManageUsers enabled: chatsModel.communities.observedCommunity.canManageUsers
onTriggered: openPopup(inviteFriendsToCommunityPopup, { onTriggered: Global.openPopup(inviteFriendsToCommunityPopup, {
community: chatsModel.communities.observedCommunity community: chatsModel.communities.observedCommunity
}) })
} }
@ -269,7 +268,7 @@ Item {
//% "View Community" //% "View Community"
text: qsTrId("view-community") text: qsTrId("view-community")
icon.name: "group-chat" icon.name: "group-chat"
onTriggered: openPopup(communityProfilePopup, { onTriggered: Global.openPopup(communityProfilePopup, {
store: appMain.rootStore, store: appMain.rootStore,
community: chatsModel.communities.observedCommunity community: chatsModel.communities.observedCommunity
}) })
@ -280,7 +279,7 @@ Item {
//% "Edit Community" //% "Edit Community"
text: qsTrId("edit-community") text: qsTrId("edit-community")
icon.name: "edit" icon.name: "edit"
onTriggered: openPopup(editCommunityPopup, {store: appMain.rootStore, community: chatsModel.communities.observedCommunity}) onTriggered: Global.openPopup(editCommunityPopup, {store: appMain.rootStore, community: chatsModel.communities.observedCommunity})
} }
StatusMenuSeparator {} StatusMenuSeparator {}

View File

@ -43,7 +43,7 @@ MouseArea {
isHovered = false; isHovered = false;
} }
//TODO remove dynamic scoping //TODO remove dynamic scoping
openPopup(statusStickerPackClickPopup, {packId: stickerPackId} ) Global.openPopup(statusStickerPackClickPopup, {packId: stickerPackId} )
return; return;
} }
} }

View File

@ -258,7 +258,7 @@ ModalPopup {
if(gasSelector.eip1599Enabled && stack.currentGroup === group2 && gasSelector.advancedMode){ if(gasSelector.eip1599Enabled && stack.currentGroup === group2 && gasSelector.advancedMode){
if(gasSelector.showPriceLimitWarning || gasSelector.showTipLimitWarning){ if(gasSelector.showPriceLimitWarning || gasSelector.showTipLimitWarning){
openPopup(transactionSettingsConfirmationPopupComponent, { Global.openPopup(transactionSettingsConfirmationPopupComponent, {
currentBaseFee: gasSelector.latestBaseFeeGwei, currentBaseFee: gasSelector.latestBaseFeeGwei,
currentMinimumTip: gasSelector.perGasTipLimitFloor, currentMinimumTip: gasSelector.perGasTipLimitFloor,
currentAverageTip: gasSelector.perGasTipLimitAverage, currentAverageTip: gasSelector.perGasTipLimitAverage,

View File

@ -299,7 +299,7 @@ StatusModal {
if(gasSelector.eip1599Enabled && stack.currentGroup === groupSelectGas && gasSelector.advancedMode){ if(gasSelector.eip1599Enabled && stack.currentGroup === groupSelectGas && gasSelector.advancedMode){
if(gasSelector.showPriceLimitWarning || gasSelector.showTipLimitWarning){ if(gasSelector.showPriceLimitWarning || gasSelector.showTipLimitWarning){
openPopup(transactionSettingsConfirmationPopupComponent, { Global.openPopup(transactionSettingsConfirmationPopupComponent, {
currentBaseFee: gasSelector.latestBaseFeeGwei, currentBaseFee: gasSelector.latestBaseFeeGwei,
currentMinimumTip: gasSelector.perGasTipLimitFloor, currentMinimumTip: gasSelector.perGasTipLimitFloor,
currentAverageTip: gasSelector.perGasTipLimitAverage, currentAverageTip: gasSelector.perGasTipLimitAverage,

View File

@ -215,7 +215,7 @@ ModalPopup {
if(gasSelector.eip1599Enabled && stack.currentGroup === group2 && gasSelector.advancedMode){ if(gasSelector.eip1599Enabled && stack.currentGroup === group2 && gasSelector.advancedMode){
if(gasSelector.showPriceLimitWarning || gasSelector.showTipLimitWarning){ if(gasSelector.showPriceLimitWarning || gasSelector.showTipLimitWarning){
openPopup(transactionSettingsConfirmationPopupComponent, { Global.openPopup(transactionSettingsConfirmationPopupComponent, {
currentBaseFee: gasSelector.latestBaseFeeGwei, currentBaseFee: gasSelector.latestBaseFeeGwei,
currentMinimumTip: gasSelector.perGasTipLimitFloor, currentMinimumTip: gasSelector.perGasTipLimitFloor,
currentAverageTip: gasSelector.perGasTipLimitAverage, currentAverageTip: gasSelector.perGasTipLimitAverage,

View File

@ -225,7 +225,7 @@ ModalPopup {
if(gasSelector.eip1599Enabled && stack.currentGroup === group2 && gasSelector.advancedMode){ if(gasSelector.eip1599Enabled && stack.currentGroup === group2 && gasSelector.advancedMode){
if(gasSelector.showPriceLimitWarning || gasSelector.showTipLimitWarning){ if(gasSelector.showPriceLimitWarning || gasSelector.showTipLimitWarning){
openPopup(transactionSettingsConfirmationPopupComponent, { Global.openPopup(transactionSettingsConfirmationPopupComponent, {
currentBaseFee: gasSelector.latestBaseFeeGwei, currentBaseFee: gasSelector.latestBaseFeeGwei,
currentMinimumTip: gasSelector.perGasTipLimitFloor, currentMinimumTip: gasSelector.perGasTipLimitFloor,
currentAverageTip: gasSelector.perGasTipLimitAverage, currentAverageTip: gasSelector.perGasTipLimitAverage,

View File

@ -89,7 +89,7 @@ Item {
onCancelClicked: root.cancelClicked(packId) onCancelClicked: root.cancelClicked(packId)
onUpdateClicked: root.updateClicked(packId) onUpdateClicked: root.updateClicked(packId)
onBuyClicked: { onBuyClicked: {
root.stickerPurchasePopup = openPopup(stickerPackPurchaseModal) root.stickerPurchasePopup = Global.openPopup(stickerPackPurchaseModal)
root.buyClicked(packId) root.buyClicked(packId)
} }
} }
@ -157,7 +157,7 @@ Item {
confirmationPopup.open() confirmationPopup.open()
return return
} }
root.stickerPurchasePopup = openPopup(stickerPackPurchaseModal) root.stickerPurchasePopup = Global.openPopup(stickerPackPurchaseModal)
root.buyClicked(packId) root.buyClicked(packId)
} }
} }
@ -171,7 +171,7 @@ Item {
onConfirmButtonClicked: { onConfirmButtonClicked: {
localAccountSensitiveSettings.isWalletEnabled = true localAccountSensitiveSettings.isWalletEnabled = true
close() close()
root.stickerPurchasePopup = openPopup(stickerPackPurchaseModal) root.stickerPurchasePopup = Global.openPopup(stickerPackPurchaseModal)
root.buyClicked(packId) root.buyClicked(packId)
} }

View File

@ -102,7 +102,7 @@ ModalPopup {
onCancelClicked: function(){} onCancelClicked: function(){}
onUpdateClicked: function(){} onUpdateClicked: function(){}
onBuyClicked: { onBuyClicked: {
openPopup(stickerPackPurchaseModal) Global.openPopup(stickerPackPurchaseModal)
root.buyClicked(packId) root.buyClicked(packId)
} }
} }

View File

@ -44,7 +44,7 @@ Item {
if (root.state === Constants.addressRequested) { if (root.state === Constants.addressRequested) {
selectAccountModal.open() selectAccountModal.open()
} else if (root.state === Constants.transactionRequested) { } else if (root.state === Constants.transactionRequested) {
openPopup(signTxComponent) Global.openPopup(signTxComponent)
} }
} }
} }

View File

@ -323,7 +323,7 @@ Item {
if (localAccountSensitiveSettings.communitiesEnabled) { if (localAccountSensitiveSettings.communitiesEnabled) {
onBtnClick(); onBtnClick();
} else { } else {
openPopup(confirmationPopupComponent, { onConfirmed: onBtnClick }); Global.openPopup(confirmationPopupComponent, { onConfirmed: onBtnClick });
} }
} }

View File

@ -307,7 +307,7 @@ StatusPopupMenu {
if (!canPin) { if (!canPin) {
// Open pin modal so that the user can unpin one // Open pin modal so that the user can unpin one
openPopup(pinnedMessagesPopupComponent, {messageToPin: messageId}) Global.openPopup(pinnedMessagesPopupComponent, {messageToPin: messageId})
return return
} }

View File

@ -205,8 +205,7 @@ Item {
} }
onSendTransaction: { onSendTransaction: {
root.store.walletModelInst.accountsView.setFocusedAccountByAddress(fromAddress); root.store.walletModelInst.accountsView.setFocusedAccountByAddress(fromAddress);
//TODO remove dynamic scoping Global.openPopup(signTxComponent, {selectedAccount: {
openPopup(signTxComponent, {selectedAccount: {
name: acc.name, name: acc.name,
address: fromAddress, address: fromAddress,
iconColor: acc.iconColor, iconColor: acc.iconColor,

View File

@ -3,15 +3,21 @@ pragma Singleton
import QtQuick 2.13 import QtQuick 2.13
QtObject { QtObject {
id: root
property int currentMenuTab: 0 property int currentMenuTab: 0
property var errorSound: Audio { property var errorSound: Audio {
id: errorSound id: errorSound
track: Qt.resolvedUrl("../assets/audio/error.mp3") track: Qt.resolvedUrl("../assets/audio/error.mp3")
} }
property var mainModuleInst: mainModule property var mainModuleInst: mainModule
signal openLinkInBrowser(string link) signal openLinkInBrowser(string link)
signal openChooseBrowserPopup(string link) signal openChooseBrowserPopup(string link)
signal openPopupRequested(var popupComponent, var params)
function openPopup(popupComponent, params = {}) {
root.openPopupRequested(popupComponent, params);
}
function changeAppSectionBySectionType(sectionType) { function changeAppSectionBySectionType(sectionType) {
mainModuleInst.setActiveSectionBySectionType(sectionType) mainModuleInst.setActiveSectionBySectionType(sectionType)