compressedPubKey exposed via backend models, usages of Utils.getCompressedPk removed, SB pages simplified
This commit is contained in:
parent
2853284751
commit
ba80ba97f7
|
@ -3,6 +3,8 @@ import NimQml
|
|||
import ../../constants as main_constants
|
||||
import local_account_settings
|
||||
|
||||
import ../../app_service/service/accounts/utils
|
||||
|
||||
QtObject:
|
||||
type UserProfile* = ref object of QObject
|
||||
localAccountSettings: LocalAccountSettings
|
||||
|
@ -46,6 +48,11 @@ QtObject:
|
|||
QtProperty[string] pubKey:
|
||||
read = getPubKey
|
||||
|
||||
proc getCompressedPubKey*(self: UserProfile): string {.slot.} =
|
||||
compressPk(self.pubKey)
|
||||
QtProperty[string] compressedPubKey:
|
||||
read = getCompressedPubKey
|
||||
|
||||
proc getIsKeycardUser*(self: UserProfile): bool {.slot.} =
|
||||
self.isKeycardUser
|
||||
QtProperty[bool] isKeycardUser:
|
||||
|
|
|
@ -43,6 +43,7 @@ import ../../../app_service/service/wallet_account/service as wallet_account_ser
|
|||
import ../../../app_service/service/provider/service as provider_service
|
||||
import ../../../app_service/service/profile/service as profile_service
|
||||
import ../../../app_service/service/accounts/service as accounts_service
|
||||
import ../../../app_service/service/accounts/utils as accounts_utils
|
||||
import ../../../app_service/service/settings/service as settings_service
|
||||
import ../../../app_service/service/contacts/service as contacts_service
|
||||
import ../../../app_service/service/about/service as about_service
|
||||
|
@ -1137,6 +1138,7 @@ method getContactDetailsAsJson*[T](self: Module[T], publicKey: string, getVerifi
|
|||
# contact dto props
|
||||
"displayName": contactDetails.dto.displayName,
|
||||
"publicKey": contactDetails.dto.id,
|
||||
"compressedPublicKey": accounts_utils.compressPk(contactDetails.dto.id),
|
||||
"name": contactDetails.dto.name,
|
||||
"ensVerified": contactDetails.dto.ensVerified,
|
||||
"alias": contactDetails.dto.alias,
|
||||
|
|
|
@ -3,6 +3,7 @@ import NimQml, Tables, stew/shims/strformat, sequtils, sugar
|
|||
|
||||
import ../../../app_service/common/types
|
||||
import ../../../app_service/service/contacts/dto/contacts
|
||||
import ../../../app_service/service/accounts/utils
|
||||
import member_item
|
||||
import contacts_utils
|
||||
import model_utils
|
||||
|
@ -10,6 +11,7 @@ import model_utils
|
|||
type
|
||||
ModelRole {.pure.} = enum
|
||||
PubKey = UserRole + 1
|
||||
CompressedPubKey
|
||||
DisplayName
|
||||
PreferredDisplayName
|
||||
EnsName
|
||||
|
@ -79,6 +81,7 @@ QtObject:
|
|||
method roleNames(self: Model): Table[int, string] =
|
||||
{
|
||||
ModelRole.PubKey.int: "pubKey",
|
||||
ModelRole.CompressedPubKey.int: "compressedPubKey",
|
||||
ModelRole.DisplayName.int: "displayName",
|
||||
ModelRole.PreferredDisplayName.int: "preferredDisplayName",
|
||||
ModelRole.EnsName.int: "ensName",
|
||||
|
@ -116,6 +119,8 @@ QtObject:
|
|||
case enumRole:
|
||||
of ModelRole.PubKey:
|
||||
result = newQVariant(item.pubKey)
|
||||
of ModelRole.CompressedPubKey:
|
||||
result = newQVariant(compressPk(item.pubKey))
|
||||
of ModelRole.DisplayName:
|
||||
result = newQVariant(item.displayName)
|
||||
of ModelRole.PreferredDisplayName:
|
||||
|
|
|
@ -2,12 +2,14 @@ import NimQml, Tables, stew/shims/strformat, sequtils, sugar
|
|||
import user_item
|
||||
|
||||
import ../../../app_service/common/types
|
||||
import ../../../app_service/service/accounts/utils
|
||||
import contacts_utils
|
||||
import model_utils
|
||||
|
||||
type
|
||||
ModelRole {.pure.} = enum
|
||||
PubKey = UserRole + 1
|
||||
CompressedPubKey
|
||||
DisplayName
|
||||
PreferredDisplayName
|
||||
EnsName
|
||||
|
@ -83,6 +85,7 @@ QtObject:
|
|||
method roleNames(self: Model): Table[int, string] =
|
||||
{
|
||||
ModelRole.PubKey.int: "pubKey",
|
||||
ModelRole.CompressedPubKey.int: "compressedPubKey",
|
||||
ModelRole.DisplayName.int: "displayName",
|
||||
ModelRole.PreferredDisplayName.int: "preferredDisplayName",
|
||||
ModelRole.EnsName.int: "ensName",
|
||||
|
@ -126,6 +129,8 @@ QtObject:
|
|||
case enumRole:
|
||||
of ModelRole.PubKey:
|
||||
result = newQVariant(item.pubKey)
|
||||
of ModelRole.CompressedPubKey:
|
||||
result = newQVariant(compressPk(item.pubKey))
|
||||
of ModelRole.DisplayName:
|
||||
result = newQVariant(item.displayName)
|
||||
of ModelRole.PreferredDisplayName:
|
||||
|
|
|
@ -7,56 +7,12 @@ import AppLayouts.Communities.controls 1.0
|
|||
import Models 1.0
|
||||
import Storybook 1.0
|
||||
|
||||
import utils 1.0
|
||||
|
||||
|
||||
SplitView {
|
||||
property bool globalUtilsReady: false
|
||||
property bool mainModuleReady: false
|
||||
|
||||
orientation: Qt.Vertical
|
||||
|
||||
Logs { id: logs }
|
||||
|
||||
QtObject {
|
||||
function isCompressedPubKey(publicKey) {
|
||||
return true
|
||||
}
|
||||
|
||||
function getCompressedPk(publicKey) {
|
||||
return "compressed_" + publicKey
|
||||
}
|
||||
|
||||
function getColorId(publicKey) {
|
||||
return Math.floor(Math.random() * 10)
|
||||
}
|
||||
|
||||
Component.onCompleted: {
|
||||
Utils.globalUtilsInst = this
|
||||
globalUtilsReady = true
|
||||
|
||||
}
|
||||
Component.onDestruction: {
|
||||
globalUtilsReady = false
|
||||
Utils.globalUtilsInst = {}
|
||||
}
|
||||
}
|
||||
|
||||
QtObject {
|
||||
function getContactDetailsAsJson() {
|
||||
return JSON.stringify({ ensVerified: true })
|
||||
}
|
||||
|
||||
Component.onCompleted: {
|
||||
mainModuleReady = true
|
||||
Utils.mainModuleInst = this
|
||||
}
|
||||
Component.onDestruction: {
|
||||
mainModuleReady = false
|
||||
Utils.mainModuleInst = {}
|
||||
}
|
||||
}
|
||||
|
||||
Pane {
|
||||
SplitView.fillWidth: true
|
||||
SplitView.fillHeight: true
|
||||
|
@ -84,6 +40,7 @@ SplitView {
|
|||
localNickname: "",
|
||||
onlineStatus: 1,
|
||||
pubKey: key,
|
||||
compressedPubKey: "compressed_" + key,
|
||||
isVerified: true,
|
||||
isUntrustworthy: false
|
||||
})
|
||||
|
@ -95,41 +52,36 @@ SplitView {
|
|||
}
|
||||
}
|
||||
|
||||
Loader {
|
||||
id: loader
|
||||
AirdropRecipientsSelector {
|
||||
id: selector
|
||||
|
||||
anchors.centerIn: parent
|
||||
active: globalUtilsReady && mainModuleReady
|
||||
|
||||
sourceComponent: AirdropRecipientsSelector {
|
||||
id: selector
|
||||
addressesModel: addresses
|
||||
loadingAddresses: timer.running
|
||||
membersModel: members
|
||||
showAddressesInputWhenEmpty:
|
||||
showAddressesInputWhenEmptyCheckBox.checked
|
||||
|
||||
addressesModel: addresses
|
||||
loadingAddresses: timer.running
|
||||
membersModel: members
|
||||
showAddressesInputWhenEmpty:
|
||||
showAddressesInputWhenEmptyCheckBox.checked
|
||||
infiniteMaxNumberOfRecipients:
|
||||
infiniteMaxNumberOfRecipientsCheckBox.checked
|
||||
|
||||
infiniteMaxNumberOfRecipients:
|
||||
infiniteMaxNumberOfRecipientsCheckBox.checked
|
||||
maxNumberOfRecipients: maxNumberOfRecipientsSpinBox.value
|
||||
|
||||
maxNumberOfRecipients: maxNumberOfRecipientsSpinBox.value
|
||||
onAddAddressesRequested: timer.start()
|
||||
onRemoveAddressRequested: addresses.remove(index)
|
||||
onRemoveMemberRequested: members.remove(index)
|
||||
|
||||
onAddAddressesRequested: timer.start()
|
||||
onRemoveAddressRequested: addresses.remove(index)
|
||||
onRemoveMemberRequested: members.remove(index)
|
||||
Timer {
|
||||
id: timer
|
||||
|
||||
Timer {
|
||||
id: timer
|
||||
interval: 1000
|
||||
|
||||
interval: 1000
|
||||
|
||||
onTriggered: {
|
||||
addresses.addAddressesFromString(
|
||||
selector.addressesInputText)
|
||||
selector.clearAddressesInput()
|
||||
selector.positionAddressesListAtEnd()
|
||||
}
|
||||
onTriggered: {
|
||||
addresses.addAddressesFromString(
|
||||
selector.addressesInputText)
|
||||
selector.clearAddressesInput()
|
||||
selector.positionAddressesListAtEnd()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,14 +23,6 @@ SplitView {
|
|||
Logs { id: logs }
|
||||
|
||||
QtObject {
|
||||
function isCompressedPubKey(publicKey) {
|
||||
return true
|
||||
}
|
||||
|
||||
function getCompressedPk(publicKey) {
|
||||
return "compressed_" + publicKey
|
||||
}
|
||||
|
||||
function getColorId(publicKey) {
|
||||
return Math.floor(Math.random() * 10)
|
||||
}
|
||||
|
@ -104,6 +96,8 @@ SplitView {
|
|||
assetsModel: AssetsModel {}
|
||||
collectiblesModel: ListModel {}
|
||||
|
||||
enabledChainIds: "1"
|
||||
|
||||
CollectiblesModel {
|
||||
id: collectiblesModel
|
||||
}
|
||||
|
|
|
@ -15,50 +15,8 @@ SplitView {
|
|||
orientation: Qt.Vertical
|
||||
SplitView.fillWidth: true
|
||||
|
||||
property bool globalUtilsReady: false
|
||||
property bool mainModuleReady: false
|
||||
|
||||
Logs { id: logs }
|
||||
|
||||
QtObject {
|
||||
function isCompressedPubKey(publicKey) {
|
||||
return true
|
||||
}
|
||||
|
||||
function getCompressedPk(publicKey) {
|
||||
return "compressed_" + publicKey
|
||||
}
|
||||
|
||||
function getColorId(publicKey) {
|
||||
return Math.floor(Math.random() * 10)
|
||||
}
|
||||
|
||||
Component.onCompleted: {
|
||||
Utils.globalUtilsInst = this
|
||||
globalUtilsReady = true
|
||||
|
||||
}
|
||||
Component.onDestruction: {
|
||||
globalUtilsReady = false
|
||||
Utils.globalUtilsInst = {}
|
||||
}
|
||||
}
|
||||
|
||||
QtObject {
|
||||
function getContactDetailsAsJson() {
|
||||
return JSON.stringify({ ensVerified: true })
|
||||
}
|
||||
|
||||
Component.onCompleted: {
|
||||
mainModuleReady = true
|
||||
Utils.mainModuleInst = this
|
||||
}
|
||||
Component.onDestruction: {
|
||||
mainModuleReady = false
|
||||
Utils.mainModuleInst = {}
|
||||
}
|
||||
}
|
||||
|
||||
ListModel {
|
||||
id: members
|
||||
|
||||
|
@ -109,14 +67,13 @@ SplitView {
|
|||
}
|
||||
|
||||
function requestMockedFees(contractKeysAndAmounts) {
|
||||
if (!loader.item)
|
||||
if (!contractKeysAndAmounts)
|
||||
return
|
||||
|
||||
const view = loader.item
|
||||
view.feesAvailable = false
|
||||
view.totalFeeText = ""
|
||||
view.feeErrorText = ""
|
||||
view.feesPerSelectedContract = []
|
||||
editAirdropView.feesAvailable = false
|
||||
editAirdropView.totalFeeText = ""
|
||||
editAirdropView.feeErrorText = ""
|
||||
editAirdropView.feesPerSelectedContract = []
|
||||
|
||||
const fees = []
|
||||
|
||||
|
@ -133,14 +90,10 @@ SplitView {
|
|||
}
|
||||
|
||||
onTriggered: {
|
||||
if (!loader.item)
|
||||
return
|
||||
|
||||
const view = loader.item
|
||||
view.totalFeeText = createAmount(0.0002120115 * feesPerContract.length, "ETH", 4) + "(" ,createAmount(123.15 * feesPerContract.length, "USD", 2),"USD)"
|
||||
view.feeErrorText = feesErrorsButtonGroup.checkedButton.code ? feesErrorsButtonGroup.checkedButton.text : ""
|
||||
view.feesAvailable = true
|
||||
view.feesPerSelectedContract = feesCalculationTimer.feesPerContract
|
||||
editAirdropView.totalFeeText = createAmount(0.0002120115 * feesPerContract.length, "ETH", 4) + "(" ,createAmount(123.15 * feesPerContract.length, "USD", 2),"USD)"
|
||||
editAirdropView.feeErrorText = feesErrorsButtonGroup.checkedButton.code ? feesErrorsButtonGroup.checkedButton.text : ""
|
||||
editAirdropView.feesAvailable = true
|
||||
editAirdropView.feesPerSelectedContract = feesCalculationTimer.feesPerContract
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -148,155 +101,149 @@ SplitView {
|
|||
SplitView.fillWidth: true
|
||||
SplitView.fillHeight: true
|
||||
|
||||
Loader {
|
||||
id: loader
|
||||
EditAirdropView {
|
||||
id: editAirdropView
|
||||
|
||||
anchors.fill: parent
|
||||
active: globalUtilsReady && mainModuleReady
|
||||
|
||||
sourceComponent: EditAirdropView {
|
||||
id: editAirdropView
|
||||
CollectiblesModel {
|
||||
id: collectiblesModel
|
||||
}
|
||||
|
||||
CollectiblesModel {
|
||||
id: collectiblesModel
|
||||
}
|
||||
SortFilterProxyModel {
|
||||
id: collectiblesModelWithSupply
|
||||
|
||||
SortFilterProxyModel {
|
||||
id: collectiblesModelWithSupply
|
||||
sourceModel: collectiblesModel
|
||||
|
||||
sourceModel: collectiblesModel
|
||||
proxyRoles: [
|
||||
ExpressionRole {
|
||||
name: "supply"
|
||||
expression: ((model.index + 1) * 115).toString()
|
||||
},
|
||||
ExpressionRole {
|
||||
name: "infiniteSupply"
|
||||
expression: !(model.index % 4)
|
||||
},
|
||||
ExpressionRole {
|
||||
name: "accountName"
|
||||
expression: "StatusAccount"
|
||||
},
|
||||
ExpressionRole {
|
||||
name: "contractUniqueKey"
|
||||
expression: "contractUniqueKey_" + model.index
|
||||
},
|
||||
ExpressionRole {
|
||||
name: "chainName"
|
||||
expression: model.index ? "Optimism" : "Arbitrum"
|
||||
},
|
||||
ExpressionRole {
|
||||
readonly property string icon1: "network/Network=Optimism"
|
||||
readonly property string icon2: "network/Network=Arbitrum"
|
||||
|
||||
proxyRoles: [
|
||||
ExpressionRole {
|
||||
name: "supply"
|
||||
expression: ((model.index + 1) * 115).toString()
|
||||
},
|
||||
ExpressionRole {
|
||||
name: "infiniteSupply"
|
||||
expression: !(model.index % 4)
|
||||
},
|
||||
ExpressionRole {
|
||||
name: "accountName"
|
||||
expression: "StatusAccount"
|
||||
},
|
||||
ExpressionRole {
|
||||
name: "contractUniqueKey"
|
||||
expression: "contractUniqueKey_" + model.index
|
||||
},
|
||||
ExpressionRole {
|
||||
name: "chainName"
|
||||
expression: model.index ? "Optimism" : "Arbitrum"
|
||||
},
|
||||
ExpressionRole {
|
||||
readonly property string icon1: "network/Network=Optimism"
|
||||
readonly property string icon2: "network/Network=Arbitrum"
|
||||
|
||||
name: "chainIcon"
|
||||
expression: model.index ? icon1 : icon2
|
||||
}
|
||||
]
|
||||
|
||||
filters: ValueFilter {
|
||||
roleName: "category"
|
||||
value: TokenCategories.Category.Community
|
||||
name: "chainIcon"
|
||||
expression: model.index ? icon1 : icon2
|
||||
}
|
||||
]
|
||||
|
||||
Component.onCompleted: {
|
||||
Qt.callLater(() => editAirdropView.collectiblesModel = this)
|
||||
filters: ValueFilter {
|
||||
roleName: "category"
|
||||
value: TokenCategories.Category.Community
|
||||
}
|
||||
|
||||
Component.onCompleted: {
|
||||
Qt.callLater(() => editAirdropView.collectiblesModel = this)
|
||||
}
|
||||
}
|
||||
|
||||
AssetsModel {
|
||||
id: assetsModel
|
||||
}
|
||||
|
||||
SortFilterProxyModel {
|
||||
id: assetsModelWithSupply
|
||||
|
||||
sourceModel: assetsModel
|
||||
|
||||
proxyRoles: [
|
||||
ExpressionRole {
|
||||
name: "supply"
|
||||
expression: ((model.index + 1) * 258).toString()
|
||||
},
|
||||
ExpressionRole {
|
||||
name: "infiniteSupply"
|
||||
expression: !(model.index % 4)
|
||||
},
|
||||
ExpressionRole {
|
||||
name: "accountName"
|
||||
expression: "StatusAccount"
|
||||
},
|
||||
ExpressionRole {
|
||||
name: "contractUniqueKey"
|
||||
expression: "contractUniqueKey_" + model.index
|
||||
},
|
||||
ExpressionRole {
|
||||
name: "chainName"
|
||||
expression: model.index ? "Ethereum Mainnet" : "Sepolia"
|
||||
},
|
||||
ExpressionRole {
|
||||
readonly property string icon1: "network/Network=Ethereum"
|
||||
readonly property string icon2: "network/Network=Testnet"
|
||||
|
||||
name: "chainIcon"
|
||||
expression: model.index ? icon1 : icon2
|
||||
}
|
||||
]
|
||||
|
||||
filters: ValueFilter {
|
||||
roleName: "category"
|
||||
value: TokenCategories.Category.Community
|
||||
}
|
||||
|
||||
AssetsModel {
|
||||
id: assetsModel
|
||||
Component.onCompleted: {
|
||||
Qt.callLater(() => editAirdropView.assetsModel = this)
|
||||
}
|
||||
}
|
||||
|
||||
SortFilterProxyModel {
|
||||
id: assetsModelWithSupply
|
||||
assetsModel: AssetsModel {}
|
||||
collectiblesModel: CollectiblesModel {}
|
||||
membersModel: members
|
||||
totalFeeText: ""
|
||||
feeErrorText: ""
|
||||
feesPerSelectedContract: []
|
||||
feesAvailable: false
|
||||
|
||||
sourceModel: assetsModel
|
||||
onShowingFeesChanged: {
|
||||
feesCalculationTimer.requestMockedFees(editAirdropView.selectedContractKeysAndAmounts)
|
||||
}
|
||||
|
||||
proxyRoles: [
|
||||
ExpressionRole {
|
||||
name: "supply"
|
||||
expression: ((model.index + 1) * 258).toString()
|
||||
},
|
||||
ExpressionRole {
|
||||
name: "infiniteSupply"
|
||||
expression: !(model.index % 4)
|
||||
},
|
||||
ExpressionRole {
|
||||
name: "accountName"
|
||||
expression: "StatusAccount"
|
||||
},
|
||||
ExpressionRole {
|
||||
name: "contractUniqueKey"
|
||||
expression: "contractUniqueKey_" + model.index
|
||||
},
|
||||
ExpressionRole {
|
||||
name: "chainName"
|
||||
expression: model.index ? "Ethereum Mainnet" : "Sepolia"
|
||||
},
|
||||
ExpressionRole {
|
||||
readonly property string icon1: "network/Network=Ethereum"
|
||||
readonly property string icon2: "network/Network=Testnet"
|
||||
|
||||
name: "chainIcon"
|
||||
expression: model.index ? icon1 : icon2
|
||||
}
|
||||
]
|
||||
|
||||
filters: ValueFilter {
|
||||
roleName: "category"
|
||||
value: TokenCategories.Category.Community
|
||||
}
|
||||
|
||||
Component.onCompleted: {
|
||||
Qt.callLater(() => editAirdropView.assetsModel = this)
|
||||
}
|
||||
accountsModel: ListModel {
|
||||
ListElement {
|
||||
name: "Test account"
|
||||
emoji: "😋"
|
||||
address: "0x7F47C2e18a4BBf5487E6fb082eC2D9Ab0E6d7240"
|
||||
color: "red"
|
||||
}
|
||||
|
||||
assetsModel: AssetsModel {}
|
||||
collectiblesModel: CollectiblesModel {}
|
||||
membersModel: members
|
||||
totalFeeText: ""
|
||||
feeErrorText: ""
|
||||
feesPerSelectedContract: []
|
||||
feesAvailable: false
|
||||
|
||||
onShowingFeesChanged: {
|
||||
feesCalculationTimer.requestMockedFees(loader.item.selectedContractKeysAndAmounts)
|
||||
ListElement {
|
||||
name: "Another account - generated"
|
||||
emoji: "🚗"
|
||||
address: "0x7F47C2e98a4BBf5487E6fb082eC2D9Ab0E6d8888"
|
||||
color: "blue"
|
||||
}
|
||||
}
|
||||
|
||||
accountsModel: ListModel {
|
||||
ListElement {
|
||||
name: "Test account"
|
||||
emoji: "😋"
|
||||
address: "0x7F47C2e18a4BBf5487E6fb082eC2D9Ab0E6d7240"
|
||||
color: "red"
|
||||
}
|
||||
communityDetails: QtObject {
|
||||
readonly property string name: "Socks"
|
||||
readonly property string id: "SOCKS"
|
||||
readonly property string image: ModelsData.icons.socks
|
||||
readonly property string color: "red"
|
||||
readonly property bool owner: true
|
||||
}
|
||||
|
||||
ListElement {
|
||||
name: "Another account - generated"
|
||||
emoji: "🚗"
|
||||
address: "0x7F47C2e98a4BBf5487E6fb082eC2D9Ab0E6d8888"
|
||||
color: "blue"
|
||||
}
|
||||
}
|
||||
|
||||
communityDetails: QtObject {
|
||||
readonly property string name: "Socks"
|
||||
readonly property string id: "SOCKS"
|
||||
readonly property string image: ModelsData.icons.socks
|
||||
readonly property string color: "red"
|
||||
readonly property bool owner: true
|
||||
}
|
||||
|
||||
onAirdropClicked: {
|
||||
logs.logEvent("EditAirdropView::airdropClicked",
|
||||
["airdropTokens", "addresses",
|
||||
"membersPubKeys", "feeAccountAddress"],
|
||||
arguments)
|
||||
}
|
||||
onAirdropClicked: {
|
||||
logs.logEvent("EditAirdropView::airdropClicked",
|
||||
["airdropTokens", "addresses",
|
||||
"membersPubKeys", "feeAccountAddress"],
|
||||
arguments)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -323,10 +270,7 @@ SplitView {
|
|||
|
||||
buttons: feesErrorsRow.children
|
||||
onCheckedButtonChanged: {
|
||||
if(!loader.item)
|
||||
return
|
||||
|
||||
feesCalculationTimer.requestMockedFees(loader.item.selectedContractKeysAndAmounts)
|
||||
feesCalculationTimer.requestMockedFees(editAirdropView.selectedContractKeysAndAmounts)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -133,45 +133,7 @@ SplitView {
|
|||
timer.start()
|
||||
}
|
||||
}
|
||||
QtObject {
|
||||
id: utilsMock
|
||||
|
||||
function getContactDetailsAsJson(arg1, arg2) {
|
||||
return JSON.stringify({
|
||||
displayName: "Mock user",
|
||||
displayIcon: Theme.png("tokens/AST"),
|
||||
publicKey: 123456789,
|
||||
name: "",
|
||||
ensVerified: false,
|
||||
alias: "",
|
||||
lastUpdated: 0,
|
||||
lastUpdatedLocally: 0,
|
||||
localNickname: "",
|
||||
thumbnailImage: "",
|
||||
largeImage: "",
|
||||
isContact: false,
|
||||
isAdded: false,
|
||||
isBlocked: false,
|
||||
requestReceived: false,
|
||||
isSyncing: false,
|
||||
removed: false,
|
||||
trustStatus: Constants.trustStatus.unknown,
|
||||
verificationStatus: Constants.verificationStatus.unverified,
|
||||
})
|
||||
}
|
||||
|
||||
function getCommunityDataFromSharedLink(link) {
|
||||
return d.knownCommunityDetails
|
||||
}
|
||||
|
||||
function getCompressedPk(publicKey) {
|
||||
return d.knownCommunityCompressedPublicKey
|
||||
}
|
||||
|
||||
signal importingCommunityStateChanged(string communityId, int state, string errorMsg)
|
||||
|
||||
// sharedUrlsModuleInst
|
||||
|
||||
QtObject { // sharedUrlsModuleInst
|
||||
function parseCommunitySharedUrl(link) {
|
||||
if (link === d.knownCommunityLink)
|
||||
return JSON.stringify({ communityId: d.knownCommunityPublicKey })
|
||||
|
@ -182,13 +144,11 @@ SplitView {
|
|||
|
||||
Component.onCompleted: {
|
||||
Utils.sharedUrlsModuleInst = this
|
||||
Utils.globalUtilsInst = this
|
||||
d.utilsReady = true
|
||||
}
|
||||
Component.onDestruction: {
|
||||
d.utilsReady = false
|
||||
Utils.sharedUrlsModuleInst = {}
|
||||
Utils.globalUtilsInst = {}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -23,15 +23,11 @@ SplitView {
|
|||
QtObject {
|
||||
function getColorId(publicKey) { return 4 }
|
||||
|
||||
function getCompressedPk(publicKey) { return "zx3sh" + publicKey }
|
||||
|
||||
function getColorHashAsJson(publicKey) {
|
||||
return JSON.stringify([{4: 0, segmentLength: 1},
|
||||
{5: 19, segmentLength: 2}])
|
||||
}
|
||||
|
||||
function isCompressedPubKey(publicKey) { return true }
|
||||
|
||||
Component.onCompleted: {
|
||||
Utils.globalUtilsInst = this
|
||||
root.globalUtilsReady = true
|
||||
|
@ -51,6 +47,10 @@ SplitView {
|
|||
id: previewCard
|
||||
|
||||
utilsStore: UtilsStore {
|
||||
function getCompressedPk(publicKey) { return "zx3sh" + publicKey }
|
||||
|
||||
function isCompressedPubKey(publicKey) { return true }
|
||||
|
||||
function getEmojiHash(publicKey) {
|
||||
return JSON.stringify(["👨🏻🍼", "🏃🏿♂️", "🌇", "🤶🏿", "🏮","🤷🏻♂️", "🤦🏻", "📣", "🤎", "👷🏽", "😺", "🥞", "🔃", "🧝🏽♂️"])
|
||||
}
|
||||
|
|
|
@ -5,7 +5,6 @@ import QtQml 2.15
|
|||
|
||||
import AppLayouts.Communities.popups 1.0
|
||||
|
||||
import utils 1.0
|
||||
import SortFilterProxyModel 0.2
|
||||
|
||||
import Storybook 1.0
|
||||
|
@ -13,53 +12,10 @@ import Storybook 1.0
|
|||
SplitView {
|
||||
id: root
|
||||
|
||||
property bool globalUtilsReady: false
|
||||
property bool mainModuleReady: false
|
||||
|
||||
orientation: Qt.Vertical
|
||||
|
||||
Logs { id: logs }
|
||||
|
||||
QtObject {
|
||||
function isCompressedPubKey(publicKey) {
|
||||
return true
|
||||
}
|
||||
|
||||
function getCompressedPk(publicKey) {
|
||||
return "compressed_" + publicKey
|
||||
}
|
||||
|
||||
function getColorId(publicKey) {
|
||||
return Math.floor(Math.random() * 10)
|
||||
}
|
||||
|
||||
Component.onCompleted: {
|
||||
Utils.globalUtilsInst = this
|
||||
globalUtilsReady = true
|
||||
|
||||
}
|
||||
Component.onDestruction: {
|
||||
globalUtilsReady = false
|
||||
Utils.globalUtilsInst = {}
|
||||
}
|
||||
}
|
||||
|
||||
QtObject {
|
||||
function getContactDetailsAsJson() {
|
||||
return JSON.stringify({ ensVerified: true })
|
||||
}
|
||||
|
||||
Component.onCompleted: {
|
||||
mainModuleReady = true
|
||||
Utils.mainModuleInst = this
|
||||
}
|
||||
Component.onDestruction: {
|
||||
mainModuleReady = false
|
||||
Utils.mainModuleInst = {}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
ListModel {
|
||||
id: members
|
||||
|
||||
|
@ -84,6 +40,7 @@ SplitView {
|
|||
localNickname: "",
|
||||
onlineStatus: 1,
|
||||
pubKey: key,
|
||||
compressedPubKey: "compressed_" + key,
|
||||
isVerified: true,
|
||||
isUntrustworthy: false,
|
||||
airdropAddress: `0x${firstLetter}${i}`
|
||||
|
@ -126,57 +83,46 @@ SplitView {
|
|||
}
|
||||
}
|
||||
|
||||
Loader {
|
||||
id: loader
|
||||
MembersDropdown {
|
||||
id: membersDropdown
|
||||
|
||||
anchors.centerIn: parent
|
||||
active: globalUtilsReady && mainModuleReady
|
||||
closePolicy: Popup.NoAutoClose
|
||||
|
||||
sourceComponent: MembersDropdown {
|
||||
id: membersDropdown
|
||||
model: SortFilterProxyModel {
|
||||
sourceModel: members
|
||||
|
||||
closePolicy: Popup.NoAutoClose
|
||||
filters: [
|
||||
ExpressionFilter {
|
||||
enabled: membersDropdown.searchText !== ""
|
||||
|
||||
model: SortFilterProxyModel {
|
||||
Binding on sourceModel {
|
||||
when: globalUtilsReady && mainModuleReady
|
||||
value: members
|
||||
restoreMode: Binding.RestoreBindingOrValue
|
||||
}
|
||||
|
||||
filters: [
|
||||
ExpressionFilter {
|
||||
enabled: membersDropdown.searchText !== ""
|
||||
|
||||
function matchesAlias(name, filter) {
|
||||
return name.split(" ").some(p => p.startsWith(filter))
|
||||
}
|
||||
|
||||
expression: {
|
||||
membersDropdown.searchText
|
||||
|
||||
const filter = membersDropdown.searchText.toLowerCase()
|
||||
return matchesAlias(model.alias.toLowerCase(), filter)
|
||||
|| model.displayName.toLowerCase().includes(filter)
|
||||
|| model.ensName.toLowerCase().includes(filter)
|
||||
|| model.localNickname.toLowerCase().includes(filter)
|
||||
|| model.pubKey.toLowerCase().includes(filter)
|
||||
}
|
||||
function matchesAlias(name, filter) {
|
||||
return name.split(" ").some(p => p.startsWith(filter))
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
onBackButtonClicked: {
|
||||
logs.logEvent("MembersDropdown::backButtonClicked")
|
||||
}
|
||||
expression: {
|
||||
membersDropdown.searchText
|
||||
|
||||
onAddButtonClicked: {
|
||||
logs.logEvent("MembersDropdown::addButtonClicked, keys: "
|
||||
+ [...membersDropdown.selectedKeys])
|
||||
}
|
||||
|
||||
Component.onCompleted: open()
|
||||
const filter = membersDropdown.searchText.toLowerCase()
|
||||
return matchesAlias(model.alias.toLowerCase(), filter)
|
||||
|| model.displayName.toLowerCase().includes(filter)
|
||||
|| model.ensName.toLowerCase().includes(filter)
|
||||
|| model.localNickname.toLowerCase().includes(filter)
|
||||
|| model.pubKey.toLowerCase().includes(filter)
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
onBackButtonClicked: {
|
||||
logs.logEvent("MembersDropdown::backButtonClicked")
|
||||
}
|
||||
|
||||
onAddButtonClicked: {
|
||||
logs.logEvent("MembersDropdown::addButtonClicked, keys: "
|
||||
+ [...membersDropdown.selectedKeys])
|
||||
}
|
||||
|
||||
Component.onCompleted: open()
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -186,164 +132,158 @@ SplitView {
|
|||
|
||||
logsView.logText: logs.logText
|
||||
|
||||
Loader {
|
||||
active: loader.item
|
||||
|
||||
ColumnLayout {
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
|
||||
sourceComponent: ColumnLayout {
|
||||
readonly property MembersDropdown membersDropdown: loader.item
|
||||
RowLayout {
|
||||
RadioButton {
|
||||
id: addModeRadioButton
|
||||
|
||||
RowLayout {
|
||||
RadioButton {
|
||||
id: addModeRadioButton
|
||||
|
||||
text: "add mode"
|
||||
checked: true
|
||||
|
||||
Binding {
|
||||
target: membersDropdown
|
||||
property: "mode"
|
||||
value: addModeRadioButton.checked
|
||||
? MembersDropdown.Mode.Add
|
||||
: MembersDropdown.Mode.Update
|
||||
}
|
||||
}
|
||||
|
||||
RadioButton {
|
||||
text: "update mode"
|
||||
}
|
||||
|
||||
CheckBox {
|
||||
id: forceButtonDisabledCheckBox
|
||||
|
||||
text: "force button disabled"
|
||||
|
||||
Binding {
|
||||
target: membersDropdown
|
||||
property: "forceButtonDisabled"
|
||||
value: forceButtonDisabledCheckBox.checked
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
RowLayout {
|
||||
Label {
|
||||
text: "maximum list height:"
|
||||
}
|
||||
|
||||
Slider {
|
||||
id: maxListHeightSlider
|
||||
from: 100
|
||||
to: 500
|
||||
stepSize: 1
|
||||
|
||||
Component.onCompleted: {
|
||||
value = membersDropdown.maximumListHeight
|
||||
membersDropdown.maximumListHeight
|
||||
= Qt.binding(() => value)
|
||||
}
|
||||
}
|
||||
|
||||
Label {
|
||||
text: maxListHeightSlider.value
|
||||
}
|
||||
}
|
||||
|
||||
RowLayout {
|
||||
Label {
|
||||
text: "margins:"
|
||||
}
|
||||
|
||||
Slider {
|
||||
id: marginsSlider
|
||||
from: -1
|
||||
to: 50
|
||||
stepSize: 1
|
||||
|
||||
Component.onCompleted: {
|
||||
value = membersDropdown.margins
|
||||
membersDropdown.margins = Qt.binding(() => value)
|
||||
}
|
||||
}
|
||||
|
||||
Label {
|
||||
text: marginsSlider.value
|
||||
}
|
||||
}
|
||||
|
||||
RowLayout {
|
||||
Label {
|
||||
text: "bottom inset:"
|
||||
}
|
||||
|
||||
Slider {
|
||||
id: bottomInsetSlider
|
||||
from: 0
|
||||
to: 50
|
||||
stepSize: 1
|
||||
|
||||
Component.onCompleted: {
|
||||
value = membersDropdown.bottomInset
|
||||
membersDropdown.bottomInset = Qt.binding(() => value)
|
||||
}
|
||||
}
|
||||
|
||||
Label {
|
||||
text: bottomInsetSlider.value
|
||||
}
|
||||
}
|
||||
|
||||
RowLayout {
|
||||
RadioButton {
|
||||
id: anchorToItemRadioButton
|
||||
text: "anchor to item"
|
||||
|
||||
checked: true
|
||||
}
|
||||
RadioButton {
|
||||
id: anchorToOverlayRadioButton
|
||||
text: "anchor to overlay"
|
||||
|
||||
}
|
||||
text: "add mode"
|
||||
checked: true
|
||||
|
||||
Binding {
|
||||
target: membersDropdown
|
||||
property: "parent"
|
||||
value: anchorToItemRadioButton.checked
|
||||
? startRect : membersDropdown.Overlay.overlay
|
||||
property: "mode"
|
||||
value: addModeRadioButton.checked
|
||||
? MembersDropdown.Mode.Add
|
||||
: MembersDropdown.Mode.Update
|
||||
}
|
||||
}
|
||||
|
||||
Binding {
|
||||
target: membersDropdown.anchors
|
||||
when: anchorToOverlayRadioButton.checked
|
||||
property: "centerIn"
|
||||
value: membersDropdown.parent
|
||||
restoreMode: Binding.RestoreBindingOrValue
|
||||
}
|
||||
RadioButton {
|
||||
text: "update mode"
|
||||
}
|
||||
|
||||
CheckBox {
|
||||
id: forceButtonDisabledCheckBox
|
||||
|
||||
text: "force button disabled"
|
||||
|
||||
Binding {
|
||||
target: membersDropdown
|
||||
property: "x"
|
||||
value: anchorToItemRadioButton.checked
|
||||
? startRect.width / 2 : 0
|
||||
property: "forceButtonDisabled"
|
||||
value: forceButtonDisabledCheckBox.checked
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Binding {
|
||||
target: membersDropdown
|
||||
property: "y"
|
||||
value: anchorToItemRadioButton.checked
|
||||
? startRect.height / 2 : 0
|
||||
RowLayout {
|
||||
Label {
|
||||
text: "maximum list height:"
|
||||
}
|
||||
|
||||
Slider {
|
||||
id: maxListHeightSlider
|
||||
from: 100
|
||||
to: 500
|
||||
stepSize: 1
|
||||
|
||||
Component.onCompleted: {
|
||||
value = membersDropdown.maximumListHeight
|
||||
membersDropdown.maximumListHeight
|
||||
= Qt.binding(() => value)
|
||||
}
|
||||
}
|
||||
|
||||
Label {
|
||||
Layout.fillWidth: true
|
||||
text: `selected members: ${[...membersDropdown.selectedKeys]}`
|
||||
wrapMode: Label.Wrap
|
||||
text: maxListHeightSlider.value
|
||||
}
|
||||
}
|
||||
|
||||
RowLayout {
|
||||
Label {
|
||||
text: "margins:"
|
||||
}
|
||||
|
||||
Slider {
|
||||
id: marginsSlider
|
||||
from: -1
|
||||
to: 50
|
||||
stepSize: 1
|
||||
|
||||
Component.onCompleted: {
|
||||
value = membersDropdown.margins
|
||||
membersDropdown.margins = Qt.binding(() => value)
|
||||
}
|
||||
}
|
||||
|
||||
Label {
|
||||
text: marginsSlider.value
|
||||
}
|
||||
}
|
||||
|
||||
RowLayout {
|
||||
Label {
|
||||
text: "bottom inset:"
|
||||
}
|
||||
|
||||
Slider {
|
||||
id: bottomInsetSlider
|
||||
from: 0
|
||||
to: 50
|
||||
stepSize: 1
|
||||
|
||||
Component.onCompleted: {
|
||||
value = membersDropdown.bottomInset
|
||||
membersDropdown.bottomInset = Qt.binding(() => value)
|
||||
}
|
||||
}
|
||||
|
||||
Label {
|
||||
text: bottomInsetSlider.value
|
||||
}
|
||||
}
|
||||
|
||||
RowLayout {
|
||||
RadioButton {
|
||||
id: anchorToItemRadioButton
|
||||
text: "anchor to item"
|
||||
|
||||
checked: true
|
||||
}
|
||||
RadioButton {
|
||||
id: anchorToOverlayRadioButton
|
||||
text: "anchor to overlay"
|
||||
|
||||
}
|
||||
|
||||
Binding {
|
||||
target: membersDropdown
|
||||
property: "parent"
|
||||
value: anchorToItemRadioButton.checked
|
||||
? startRect : membersDropdown.Overlay.overlay
|
||||
}
|
||||
|
||||
Binding {
|
||||
target: membersDropdown.anchors
|
||||
when: anchorToOverlayRadioButton.checked
|
||||
property: "centerIn"
|
||||
value: membersDropdown.parent
|
||||
restoreMode: Binding.RestoreBindingOrValue
|
||||
}
|
||||
|
||||
Binding {
|
||||
target: membersDropdown
|
||||
property: "x"
|
||||
value: anchorToItemRadioButton.checked
|
||||
? startRect.width / 2 : 0
|
||||
}
|
||||
|
||||
Binding {
|
||||
target: membersDropdown
|
||||
property: "y"
|
||||
value: anchorToItemRadioButton.checked
|
||||
? startRect.height / 2 : 0
|
||||
}
|
||||
}
|
||||
|
||||
Label {
|
||||
Layout.fillWidth: true
|
||||
text: `selected members: ${[...membersDropdown.selectedKeys]}`
|
||||
wrapMode: Label.Wrap
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,14 +18,6 @@ SplitView {
|
|||
property bool mainModuleReady: false
|
||||
|
||||
QtObject {
|
||||
function isCompressedPubKey(publicKey) {
|
||||
return true
|
||||
}
|
||||
|
||||
function getCompressedPk(publicKey) {
|
||||
return "123456789"
|
||||
}
|
||||
|
||||
function getColorHashAsJson(publicKey) {
|
||||
return JSON.stringify([{colorId: 0, segmentLength: 1},
|
||||
{colorId: 19, segmentLength: 2}])
|
||||
|
@ -35,10 +27,6 @@ SplitView {
|
|||
return Math.floor(Math.random() * 10)
|
||||
}
|
||||
|
||||
function isEnsVerified(publicKey) {
|
||||
return false
|
||||
}
|
||||
|
||||
Component.onCompleted: {
|
||||
Utils.globalUtilsInst = this
|
||||
root.globalUtilsReady = true
|
||||
|
@ -132,6 +120,7 @@ SplitView {
|
|||
const obj = temporaryModel.get(i)
|
||||
users.push({
|
||||
pubKey: obj.pubKey,
|
||||
compressedPubKey: "compressed_" + obj.pubKey,
|
||||
displayName: obj.displayName,
|
||||
localNickname: "",
|
||||
alias: "three word name(%1)".arg(obj.pubKey),
|
||||
|
@ -193,6 +182,10 @@ SplitView {
|
|||
function isChatKey() {
|
||||
return true
|
||||
}
|
||||
|
||||
function isCompressedPubKey(publicKey) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -42,7 +42,6 @@ SplitView {
|
|||
|
||||
// globalUtilsInst mock
|
||||
QtObject {
|
||||
function getCompressedPk(publicKey) { return "zx3sh" + publicKey }
|
||||
function getColorHashAsJson(publicKey) {
|
||||
return JSON.stringify([{"segmentLength":1,"colorId":12},{"segmentLength":5,"colorId":18},
|
||||
{"segmentLength":3,"colorId":25},{"segmentLength":3,"colorId":23},
|
||||
|
@ -51,7 +50,6 @@ SplitView {
|
|||
{"segmentLength":4,"colorId":28},{"segmentLength":1,"colorId":17},
|
||||
{"segmentLength":2,"colorId":2}])
|
||||
}
|
||||
function isCompressedPubKey(publicKey) { return true }
|
||||
function getColorId(publicKey) { return Math.floor(Math.random() * 10) }
|
||||
|
||||
Component.onCompleted: {
|
||||
|
@ -71,6 +69,7 @@ SplitView {
|
|||
displayName: "ArianaP",
|
||||
displayIcon: "",
|
||||
publicKey: publicKey,
|
||||
compressedPublicKey: "compressed",
|
||||
name: "",
|
||||
alias: "",
|
||||
localNickname: "",
|
||||
|
|
|
@ -18,6 +18,7 @@ Item {
|
|||
const pubKey = "0x%1".arg(seed)
|
||||
return {
|
||||
pubKey: pubKey,
|
||||
compressedPubKey: "compressed_" + pubKey,
|
||||
displayName: seed%8 ? "_user%1".arg(seed) : "",
|
||||
preferredDisplayName: "user%1".arg(seed),
|
||||
localNickname: seed%3 ? "" : "nickname%1".arg(seed),
|
||||
|
|
|
@ -48,7 +48,7 @@ Page {
|
|||
}
|
||||
compressedKeyGetter: function(pubKey) {
|
||||
//for simulation purposes only, in real app
|
||||
//this would be Utils.getCompressedPk(pubKey);
|
||||
//this would be utilsStore.getCompressedPk(pubKey);
|
||||
var possibleCharacters = pubKey.split('');
|
||||
var randomStringLength = 12; // assuming you want random strings of 12 characters
|
||||
var randomString = [];
|
||||
|
|
|
@ -5,6 +5,7 @@ QtObject {
|
|||
id: root
|
||||
|
||||
property string id: ""
|
||||
property string compressedPubKey: ""
|
||||
property string displayName: ""
|
||||
property string secondaryName: ""
|
||||
|
||||
|
|
|
@ -110,7 +110,7 @@ Item {
|
|||
width: ListView.view.width
|
||||
nickName: model.localNickname
|
||||
userName: ProfileUtils.displayName("", model.ensName, model.displayName, model.alias)
|
||||
pubKey: model.isEnsVerified ? "" : model.compressedKey
|
||||
pubKey: model.isEnsVerified ? "" : model.compressedPubKey
|
||||
isContact: model.isContact
|
||||
isVerified: model.isVerified
|
||||
isUntrustworthy: model.isUntrustworthy
|
||||
|
|
|
@ -190,18 +190,11 @@ StatusSectionLayout {
|
|||
usersModel: SortFilterProxyModel {
|
||||
sourceModel: usersStore.usersModel
|
||||
|
||||
proxyRoles: [
|
||||
FastExpressionRole {
|
||||
name: "emojiHash"
|
||||
expression: root.utilsStore.getEmojiHash(model.pubKey)
|
||||
expectedRoles: ["pubKey"]
|
||||
},
|
||||
FastExpressionRole {
|
||||
name: "compressedKey"
|
||||
expression: root.utilsStore.getCompressedPk(model.pubKey)
|
||||
expectedRoles: ["pubKey"]
|
||||
}
|
||||
]
|
||||
proxyRoles: FastExpressionRole {
|
||||
name: "emojiHash"
|
||||
expression: root.utilsStore.getEmojiHash(model.pubKey)
|
||||
expectedRoles: ["pubKey"]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -106,7 +106,7 @@ ItemDelegate {
|
|||
hoverEnabled: false
|
||||
nickName: root.contactDetails.localNickname
|
||||
userName: ProfileUtils.displayName("", root.contactDetails.ensName, root.contactDetails.displayName, root.contactDetails.alias)
|
||||
pubKey: root.contactDetails.isEnsVerified ? "" : Utils.getCompressedPk(root.contactId)
|
||||
pubKey: root.contactDetails.isEnsVerified ? "" : root.contactDetails.compressedPublicKey
|
||||
isContact: root.contactDetails.isContact
|
||||
isVerified: root.contactDetails.trustStatus === Constants.trustStatus.trusted
|
||||
isUntrustworthy: root.contactDetails.trustStatus === Constants.trustStatus.untrustworthy
|
||||
|
|
|
@ -316,7 +316,7 @@ StatusScrollView {
|
|||
|
||||
nickName: model.localNickname
|
||||
userName: ProfileUtils.displayName("", model.ensName, model.displayName, model.alias)
|
||||
pubKey: model.isEnsVerified ? "" : Utils.getCompressedPk(model.pubKey)
|
||||
pubKey: model.isEnsVerified ? "" : model.compressedPubKey
|
||||
isContact: model.isContact
|
||||
isVerified: model.trustStatus === Constants.trustStatus.trusted
|
||||
isUntrustworthy: model.trustStatus === Constants.trustStatus.untrustworthy
|
||||
|
|
|
@ -10,7 +10,6 @@ import StatusQ.Core.Theme 0.1
|
|||
import shared 1.0
|
||||
import shared.panels 1.0
|
||||
import shared.popups 1.0
|
||||
import shared.stores 1.0 as SharedStores
|
||||
import utils 1.0
|
||||
|
||||
import SortFilterProxyModel 0.2
|
||||
|
@ -20,7 +19,6 @@ Item {
|
|||
implicitHeight: (title.height + contactsList.height)
|
||||
|
||||
property var contactsModel
|
||||
property SharedStores.UtilsStore utilsStore
|
||||
|
||||
property int panelUsage: Constants.contactsPanelUsage.unknownPosition
|
||||
|
||||
|
@ -71,13 +69,12 @@ Item {
|
|||
return true
|
||||
}
|
||||
|
||||
function searchPredicate(name, pubkey) {
|
||||
function searchPredicate(name, pubkey, compressedPubKey) {
|
||||
const lowerCaseSearchString = root.searchString.toLowerCase()
|
||||
const compressedPubkey = root.utilsStore.getCompressedPk(pubkey)
|
||||
|
||||
return name.toLowerCase().includes(lowerCaseSearchString) ||
|
||||
pubkey.toLowerCase().includes(lowerCaseSearchString) ||
|
||||
compressedPubkey.toLowerCase().includes(lowerCaseSearchString)
|
||||
compressedPubKey.toLowerCase().includes(lowerCaseSearchString)
|
||||
}
|
||||
|
||||
filters: [
|
||||
|
@ -85,12 +82,13 @@ Item {
|
|||
expression: filteredModel.panelUsagePredicate(model.isVerified)
|
||||
expectedRoles: ["isVerified"]
|
||||
},
|
||||
ExpressionFilter {
|
||||
FastExpressionFilter {
|
||||
enabled: root.searchString !== ""
|
||||
expression: {
|
||||
root.searchString // ensure expression is reevaluated when searchString changes
|
||||
return filteredModel.searchPredicate(model.displayName, model.pubKey)
|
||||
return filteredModel.searchPredicate(model.displayName, model.pubKey, model.compressedPubKey)
|
||||
}
|
||||
expectedRoles: ["displayName", "pubKey", "compressedPubKey"]
|
||||
}
|
||||
]
|
||||
|
||||
|
|
|
@ -9,6 +9,7 @@ QtObject {
|
|||
property var profileModule
|
||||
|
||||
property string pubkey: userProfile.pubKey
|
||||
property string compressedPubKey: userProfile.compressedPubKey
|
||||
property string name: userProfile.name
|
||||
property string username: userProfile.username
|
||||
property string displayName: userProfile.displayName
|
||||
|
|
|
@ -168,7 +168,6 @@ SettingsContentBase {
|
|||
title: qsTr("Trusted Contacts")
|
||||
visible: !noFriendsItem.visible && count > 0
|
||||
contactsModel: root.contactsStore.myContactsModel
|
||||
utilsStore: root.utilsStore
|
||||
searchString: searchBox.text
|
||||
onOpenContactContextMenu: function (publicKey, name, icon) {
|
||||
root.openContextMenu(publicKey, name, icon)
|
||||
|
@ -185,7 +184,6 @@ SettingsContentBase {
|
|||
visible: !noFriendsItem.visible && count > 0
|
||||
title: qsTr("Contacts")
|
||||
contactsModel: root.contactsStore.myContactsModel
|
||||
utilsStore: root.utilsStore
|
||||
searchString: searchBox.text
|
||||
onOpenContactContextMenu: function (publicKey, name, icon) {
|
||||
root.openContextMenu(publicKey, name, icon)
|
||||
|
@ -232,7 +230,6 @@ SettingsContentBase {
|
|||
root.openContextMenu(publicKey, name, icon)
|
||||
}
|
||||
contactsModel: root.contactsStore.receivedContactRequestsModel
|
||||
utilsStore: root.utilsStore
|
||||
panelUsage: Constants.contactsPanelUsage.receivedContactRequest
|
||||
|
||||
onSendMessageActionTriggered: {
|
||||
|
@ -259,7 +256,6 @@ SettingsContentBase {
|
|||
root.openContextMenu(publicKey, name, icon)
|
||||
}
|
||||
contactsModel: root.contactsStore.sentContactRequestsModel
|
||||
utilsStore: root.utilsStore
|
||||
panelUsage: Constants.contactsPanelUsage.sentContactRequest
|
||||
}
|
||||
}
|
||||
|
@ -318,7 +314,6 @@ SettingsContentBase {
|
|||
root.openContextMenu(publicKey, name, icon)
|
||||
}
|
||||
contactsModel: root.contactsStore.blockedContactsModel
|
||||
utilsStore: root.utilsStore
|
||||
panelUsage: Constants.contactsPanelUsage.blockedContacts
|
||||
visible: (stackLayout.currentIndex === 2)
|
||||
onVisibleChanged: {
|
||||
|
|
|
@ -5,7 +5,6 @@ import QtQuick.Dialogs 1.3
|
|||
import QtQml.Models 2.15
|
||||
import QtQml 2.15
|
||||
|
||||
import StatusQ 0.1
|
||||
import StatusQ.Core 0.1
|
||||
import StatusQ.Controls 0.1
|
||||
import StatusQ.Components 0.1
|
||||
|
@ -33,8 +32,6 @@ import shared.status 1.0
|
|||
import shared.stores 1.0
|
||||
import shared.views 1.0
|
||||
|
||||
import SortFilterProxyModel 0.2
|
||||
|
||||
import utils 1.0
|
||||
|
||||
QtObject {
|
||||
|
@ -444,15 +441,7 @@ QtObject {
|
|||
InviteFriendsToCommunityPopup {
|
||||
rootStore: root.rootStore
|
||||
|
||||
contactsModel: SortFilterProxyModel {
|
||||
sourceModel: root.rootStore.contactStore.myContactsModel
|
||||
|
||||
proxyRoles: FastExpressionRole {
|
||||
name: "compressedKey"
|
||||
expression: root.utilsStore.getCompressedPk(model.pubKey)
|
||||
expectedRoles: ["pubKey"]
|
||||
}
|
||||
}
|
||||
contactsModel: root.rootStore.contactStore.myContactsModel
|
||||
|
||||
onClosed: destroy()
|
||||
}
|
||||
|
|
|
@ -17,6 +17,7 @@ StatusDialog {
|
|||
id: root
|
||||
|
||||
property StatusMessageDetails messageDetails
|
||||
property string compressedPubKey
|
||||
property double timestamp: 0
|
||||
|
||||
signal accepted
|
||||
|
@ -56,7 +57,7 @@ StatusDialog {
|
|||
sender: root.messageDetails.sender
|
||||
amISender: root.messageDetails.amISender
|
||||
messageOriginInfo: root.messageDetails.messageOriginInfo
|
||||
tertiaryDetail: Utils.getCompressedPk(sender.id)
|
||||
tertiaryDetail: root.compressedPubKey
|
||||
timestamp: root.timestamp
|
||||
}
|
||||
|
||||
|
|
|
@ -61,6 +61,7 @@ ActivityNotificationMessage {
|
|||
onDetailsClicked: {
|
||||
Global.openPopup(reviewContactRequestPopupComponent, {
|
||||
messageDetails: root.messageDetails,
|
||||
compressedPubKey: contactDetails ? contactDetails.compressedPublicKey : "",
|
||||
timestamp: notification ? notification.timestamp : 0
|
||||
})
|
||||
}
|
||||
|
|
|
@ -26,6 +26,7 @@ ActivityNotificationBase {
|
|||
messageText: notification && notification.message ? notification.message.messageText : ""
|
||||
amISender: false
|
||||
sender.id: contactId
|
||||
sender.compressedPubKey: contactDetails ? contactDetails.compressedPublicKey : ""
|
||||
sender.displayName: contactName
|
||||
sender.secondaryName: contactDetails && contactDetails.localNickname ?
|
||||
ProfileUtils.displayName("", contactDetails.name, contactDetails.displayName, contactDetails.alias) : ""
|
||||
|
|
|
@ -15,7 +15,7 @@ StatusMemberListItem {
|
|||
|
||||
readonly property string _pubKey: model.pubKey // expose uncompressed pubkey
|
||||
|
||||
pubKey: model.isEnsVerified ? "" : Utils.getCompressedPk(model.pubKey)
|
||||
pubKey: model.isEnsVerified ? "" : model.compressedPubKey
|
||||
nickName: model.localNickname
|
||||
userName: ProfileUtils.displayName("", model.ensName, model.displayName, model.alias)
|
||||
isVerified: model.isVerified
|
||||
|
|
|
@ -82,7 +82,7 @@ Item {
|
|||
|
||||
delegate: StatusMemberListItem {
|
||||
width: contactListView.availableWidth
|
||||
pubKey: model.isEnsVerified ? "" : model.compressedKey
|
||||
pubKey: model.isEnsVerified ? "" : model.compressedPubKey
|
||||
isContact: model.isContact
|
||||
status: model.onlineStatus
|
||||
height: visible ? implicitHeight : 0
|
||||
|
|
|
@ -35,7 +35,7 @@ Item {
|
|||
|
||||
delegate: StatusMemberListItem {
|
||||
width: contactGridView.cellWidth
|
||||
pubKey: model.isEnsVerified ? "" : model.compressedKey
|
||||
pubKey: model.isEnsVerified ? "" : model.compressedPubKey
|
||||
isContact: model.isContact
|
||||
status: model.onlineStatus
|
||||
nickName: model.localNickname
|
||||
|
|
|
@ -56,7 +56,7 @@ RowLayout {
|
|||
sender: root.messageDetails.sender
|
||||
amISender: root.messageDetails.amISender
|
||||
messageOriginInfo: root.messageDetails.messageOriginInfo
|
||||
tertiaryDetail: sender.isEnsVerified ? "" : Utils.getCompressedPk(sender.id)
|
||||
tertiaryDetail: sender.isEnsVerified ? "" : root.messageDetails.sender.compressedPubKey
|
||||
timestamp: root.timestamp
|
||||
onClicked: root.openProfilePopup()
|
||||
}
|
||||
|
|
|
@ -723,6 +723,7 @@ QtObject {
|
|||
colorHash: "",
|
||||
displayName: "",
|
||||
publicKey: publicKey,
|
||||
compressedPublicKey: "",
|
||||
name: "",
|
||||
ensVerified: false,
|
||||
alias: "",
|
||||
|
@ -824,7 +825,8 @@ QtObject {
|
|||
}
|
||||
}
|
||||
|
||||
function getCompressedPk(publicKey) {
|
||||
// TODO: remove when getElidedCompressedPk moved to utilsStore
|
||||
function _getCompressedPk(publicKey) {
|
||||
if (publicKey === "") {
|
||||
return ""
|
||||
}
|
||||
|
@ -837,7 +839,7 @@ QtObject {
|
|||
if (publicKey === "") {
|
||||
return ""
|
||||
}
|
||||
let compressedPk = getCompressedPk(publicKey)
|
||||
let compressedPk = _getCompressedPk(publicKey)
|
||||
return getElidedPk(compressedPk)
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue