Skip to content
Open
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
4 changes: 2 additions & 2 deletions ui/StatusQ/src/StatusQ/Components/StatusQrCodeCapture.qml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ Item {
forwardVideoSink: videoOutput.videoSink
scanning: true

captureRect: contentZoneHighlight
captureRect: captureRectangle

onCapturedChanged: (tag) => {
d.lastTag = tag
Expand All @@ -74,7 +74,7 @@ Item {
fillMode: VideoOutput.PreserveAspectCrop
}
Rectangle {
id: captureRect
id: captureRectangle
width: root.captureRectWidth
height: root.captureRectHeight
anchors.centerIn: parent
Expand Down
11 changes: 11 additions & 0 deletions ui/app/mainui/AppMain.qml
Original file line number Diff line number Diff line change
Expand Up @@ -952,6 +952,17 @@ Item {
}
}
onTransferOwnershipRequested: (tokenId, senderAddress) => popupRequestsHandler.sendModalHandler.transferOwnership(tokenId, senderAddress)
onWcUriScanned: uri => {
if (!dAppsServiceLoader.active || !dAppsServiceLoader.item) {
return
}
function pairingHandler() {
dAppsServiceLoader.item.dappsModule.pair(uri)
dAppsServiceLoader.item.pairingValidated.disconnect(pairingHandler)
}
dAppsServiceLoader.item.pairingValidated.connect(pairingHandler)
dAppsServiceLoader.item.validatePairingUri(uri)
}
}

HandlersManager {
Expand Down
4 changes: 4 additions & 0 deletions ui/app/mainui/Popups.qml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import AppLayouts.Wallet.popups.buy
import AppLayouts.Wallet.popups
import AppLayouts.Communities.stores
import AppLayouts.Profile.helpers
import AppLayouts.Wallet.services.dapps

import AppLayouts.Wallet.stores as WalletStores
import AppLayouts.Chat.stores as ChatStores
Expand Down Expand Up @@ -75,6 +76,7 @@ QtObject {
signal saveDomainToUnfurledWhitelist(string domain)
signal ownershipDeclined(string communityId, string communityName)
signal transferOwnershipRequested(string tokenId, string senderAddress)
signal wcUriScanned(string uri)

property var activePopupComponents: []

Expand Down Expand Up @@ -1509,6 +1511,8 @@ QtObject {
return
}
Global.requestOpenLink(tag)
} else if (tagType === QRCodeScannerDialog.TagType.WCUri) {
root.wcUriScanned(tag)
}
}
}
Expand Down
28 changes: 20 additions & 8 deletions ui/imports/shared/popups/QRCodeScannerDialog.qml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ import StatusQ.Components
import StatusQ.Controls.Validators
import StatusQ.Popups.Dialog

import AppLayouts.Wallet.services.dapps

import utils

StatusDialog {
Expand All @@ -32,13 +34,15 @@ StatusDialog {

enum TagType {
Link,
Address
Address,
WCUri
}

QtObject {
id: d

property string validTag: ""
property int validTagType
}

contentItem: QRCodeScanner {
Expand All @@ -49,11 +53,7 @@ StatusDialog {
running: !!d.validTag
repeat: false
onTriggered: {
if (Utils.isURL(d.validTag)) {
root.tagFound(QRCodeScannerDialog.TagType.Link, d.validTag)
} else if (Utils.isValidAddress(d.validTag)) {
root.tagFound(QRCodeScannerDialog.TagType.Address, d.validTag)
}
root.tagFound(d.validTagType, d.validTag)
root.close()
}
}
Expand All @@ -63,8 +63,20 @@ StatusDialog {
name: "isValidQR"
errorMessage: qsTr("We cannot read that QR code.")
validate: function (tag) {
// We accept URLs and addresses
return Utils.isURL(tag) || Utils.isValidAddress(tag)
// We accept URLs, addresses and WalletConnect URIs
if (Utils.isURL(tag)) {
d.validTagType = QRCodeScannerDialog.TagType.Link
return true
}
if (Utils.isValidAddress(tag)) {
d.validTagType = QRCodeScannerDialog.TagType.Address
return true
}
if (DAppsHelpers.validURI(tag)) {
d.validTagType = QRCodeScannerDialog.TagType.WCUri
return true
}
return false
}
}
]
Expand Down