References to Global.userProfile removed from multiple components
This commit is contained in:
parent
8fb9440235
commit
02993196e9
|
@ -5,6 +5,8 @@ import QtQuick.Layouts 1.15
|
||||||
import Qt.labs.settings 1.0
|
import Qt.labs.settings 1.0
|
||||||
|
|
||||||
import AppLayouts.Communities.panels 1.0
|
import AppLayouts.Communities.panels 1.0
|
||||||
|
import AppLayouts.Chat.stores 1.0 as ChatStores
|
||||||
|
import AppLayouts.Profile.stores 1.0 as ProfileStores
|
||||||
|
|
||||||
import utils 1.0
|
import utils 1.0
|
||||||
|
|
||||||
|
@ -15,6 +17,7 @@ import Storybook 1.0
|
||||||
import StatusQ 0.1
|
import StatusQ 0.1
|
||||||
import StatusQ.Core.Utils 0.1 as SQUtils
|
import StatusQ.Core.Utils 0.1 as SQUtils
|
||||||
|
|
||||||
|
|
||||||
SplitView {
|
SplitView {
|
||||||
id: root
|
id: root
|
||||||
|
|
||||||
|
@ -48,17 +51,6 @@ SplitView {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Global.userProfile mock
|
|
||||||
QtObject {
|
|
||||||
readonly property string pubKey: "0x043a7ed0e8d1012cf04" // Mike from UsersModel
|
|
||||||
Component.onCompleted: {
|
|
||||||
Global.userProfile = this
|
|
||||||
}
|
|
||||||
Component.onDestruction: {
|
|
||||||
Global.userProfile = {}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
MembersTabPanel {
|
MembersTabPanel {
|
||||||
id: membersTabPanelPage
|
id: membersTabPanelPage
|
||||||
SplitView.fillWidth: true
|
SplitView.fillWidth: true
|
||||||
|
@ -67,6 +59,12 @@ SplitView {
|
||||||
model: usersModelWithMembershipState
|
model: usersModelWithMembershipState
|
||||||
panelType: viewStateSelector.currentValue
|
panelType: viewStateSelector.currentValue
|
||||||
|
|
||||||
|
rootStore: ChatStores.RootStore {
|
||||||
|
contactsStore: ProfileStores.ContactsStore {
|
||||||
|
readonly property string myPublicKey: "0x000"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
onKickUserClicked: {
|
onKickUserClicked: {
|
||||||
logs.logEvent("MembersTabPanel::onKickUserClicked", ["id", "name"], arguments)
|
logs.logEvent("MembersTabPanel::onKickUserClicked", ["id", "name"], arguments)
|
||||||
}
|
}
|
||||||
|
|
|
@ -100,14 +100,6 @@ SplitView {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Component.onCompleted: {
|
|
||||||
Global.userProfile = {
|
|
||||||
name: "Anna",
|
|
||||||
pubKey: "Oxdeadbeef",
|
|
||||||
icon: ModelsData.collectibles.cryptoPunks
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
ListModel {
|
ListModel {
|
||||||
id: linksModel
|
id: linksModel
|
||||||
ListElement {
|
ListElement {
|
||||||
|
|
|
@ -150,7 +150,7 @@ Item {
|
||||||
// The admin that initited the pending state can change the state. Actions are not visible for other admins
|
// The admin that initited the pending state can change the state. Actions are not visible for other admins
|
||||||
readonly property bool ctaAllowed: !isRejectedPending && !isAcceptedPending && !isBanPending && !isUnbanPending && !isKickPending
|
readonly property bool ctaAllowed: !isRejectedPending && !isAcceptedPending && !isBanPending && !isUnbanPending && !isKickPending
|
||||||
|
|
||||||
readonly property bool itsMe: model.pubKey.toLowerCase() === Global.userProfile.pubKey.toLowerCase()
|
readonly property bool itsMe: model.pubKey.toLowerCase() === rootStore.contactsStore.myPublicKey.toLowerCase()
|
||||||
readonly property bool isHovered: memberItem.hovered
|
readonly property bool isHovered: memberItem.hovered
|
||||||
readonly property bool canBeBanned: {
|
readonly property bool canBeBanned: {
|
||||||
if (memberItem.itsMe) {
|
if (memberItem.itsMe) {
|
||||||
|
@ -315,7 +315,6 @@ Item {
|
||||||
|
|
||||||
Global.openMenu(memberContextMenuComponent, this, {
|
Global.openMenu(memberContextMenuComponent, this, {
|
||||||
profileType, trustStatus, contactType, ensVerified, onlineStatus, hasLocalNickname,
|
profileType, trustStatus, contactType, ensVerified, onlineStatus, hasLocalNickname,
|
||||||
myPublicKey: Global.userProfile.pubKey,
|
|
||||||
publicKey: model.pubKey,
|
publicKey: model.pubKey,
|
||||||
displayName: memberItem.title || model.displayName,
|
displayName: memberItem.title || model.displayName,
|
||||||
userIcon: icon.name,
|
userIcon: icon.name,
|
||||||
|
|
|
@ -496,6 +496,7 @@ StatusSectionLayout {
|
||||||
id: keycardPopup
|
id: keycardPopup
|
||||||
active: false
|
active: false
|
||||||
sourceComponent: KeycardPopup {
|
sourceComponent: KeycardPopup {
|
||||||
|
myKeyUid: store.profileStore.keyUid
|
||||||
sharedKeycardModule: root.store.keycardStore.keycardModule.keycardSharedModule
|
sharedKeycardModule: root.store.keycardStore.keycardModule.keycardSharedModule
|
||||||
emojiPopup: root.emojiPopup
|
emojiPopup: root.emojiPopup
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,7 +11,7 @@ QtObject {
|
||||||
property var globalUtilsInst: globalUtils
|
property var globalUtilsInst: globalUtils
|
||||||
property var mainModuleInst: Global.appIsReady? mainModule : null
|
property var mainModuleInst: Global.appIsReady? mainModule : null
|
||||||
|
|
||||||
property string myPublicKey: !!Global.userProfile? Global.userProfile.pubKey : ""
|
property string myPublicKey: userProfile.pubKey
|
||||||
|
|
||||||
// contactsModel holds all available contacts
|
// contactsModel holds all available contacts
|
||||||
property var contactsModel: contactsModule.contactsModel
|
property var contactsModel: contactsModule.contactsModel
|
||||||
|
|
|
@ -17,12 +17,12 @@ QtObject {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
property string pubkey: !!Global.userProfile? Global.userProfile.pubKey : ""
|
property string pubkey: userProfile.pubKey
|
||||||
property string icon: !!Global.userProfile? Global.userProfile.icon : ""
|
property string icon: userProfile.icon
|
||||||
property string preferredUsername: !!Global.userProfile? Global.userProfile.preferredName : ""
|
property string preferredUsername: userProfile.preferredName
|
||||||
readonly property string chainId: mainModule.appNetworkId
|
readonly property string chainId: mainModule.appNetworkId
|
||||||
|
|
||||||
property string username: !!Global.userProfile? Global.userProfile.username : ""
|
property string username: userProfile.username
|
||||||
|
|
||||||
function setPrefferedEnsUsername(ensName) {
|
function setPrefferedEnsUsername(ensName) {
|
||||||
if(!root.ensUsernamesModule)
|
if(!root.ensUsernamesModule)
|
||||||
|
|
|
@ -421,6 +421,7 @@ Item {
|
||||||
rootStore: appMain.rootStore
|
rootStore: appMain.rootStore
|
||||||
communityTokensStore: appMain.communityTokensStore
|
communityTokensStore: appMain.communityTokensStore
|
||||||
communitiesStore: appMain.communitiesStore
|
communitiesStore: appMain.communitiesStore
|
||||||
|
profileStore: appMain.profileStore
|
||||||
devicesStore: appMain.rootStore.profileSectionStore.devicesStore
|
devicesStore: appMain.rootStore.profileSectionStore.devicesStore
|
||||||
currencyStore: appMain.currencyStore
|
currencyStore: appMain.currencyStore
|
||||||
walletAssetsStore: appMain.walletAssetsStore
|
walletAssetsStore: appMain.walletAssetsStore
|
||||||
|
@ -1870,6 +1871,7 @@ Item {
|
||||||
id: keycardPopupForAuthenticationOrSigning
|
id: keycardPopupForAuthenticationOrSigning
|
||||||
active: false
|
active: false
|
||||||
sourceComponent: KeycardPopup {
|
sourceComponent: KeycardPopup {
|
||||||
|
myKeyUid: appMain.profileStore.keyUid
|
||||||
sharedKeycardModule: appMain.rootStore.mainModuleInst.keycardSharedModuleForAuthenticationOrSigning
|
sharedKeycardModule: appMain.rootStore.mainModuleInst.keycardSharedModuleForAuthenticationOrSigning
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1882,6 +1884,7 @@ Item {
|
||||||
id: keycardPopup
|
id: keycardPopup
|
||||||
active: false
|
active: false
|
||||||
sourceComponent: KeycardPopup {
|
sourceComponent: KeycardPopup {
|
||||||
|
myKeyUid: appMain.profileStore.keyUid
|
||||||
sharedKeycardModule: appMain.rootStore.mainModuleInst.keycardSharedModule
|
sharedKeycardModule: appMain.rootStore.mainModuleInst.keycardSharedModule
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -43,6 +43,7 @@ QtObject {
|
||||||
required property AppLayoutStores.RootStore rootStore
|
required property AppLayoutStores.RootStore rootStore
|
||||||
required property CommunityTokensStore communityTokensStore
|
required property CommunityTokensStore communityTokensStore
|
||||||
property CommunitiesStore communitiesStore
|
property CommunitiesStore communitiesStore
|
||||||
|
property ProfileStores.ProfileStore profileStore
|
||||||
property ProfileStores.DevicesStore devicesStore
|
property ProfileStores.DevicesStore devicesStore
|
||||||
property CurrenciesStore currencyStore
|
property CurrenciesStore currencyStore
|
||||||
property WalletStore.WalletAssetsStore walletAssetsStore
|
property WalletStore.WalletAssetsStore walletAssetsStore
|
||||||
|
@ -446,6 +447,9 @@ QtObject {
|
||||||
Component {
|
Component {
|
||||||
id: contactOutgoingVerificationRequestPopupComponent
|
id: contactOutgoingVerificationRequestPopupComponent
|
||||||
OutgoingContactVerificationRequestPopup {
|
OutgoingContactVerificationRequestPopup {
|
||||||
|
|
||||||
|
profileStore: root.profileStore
|
||||||
|
|
||||||
onVerificationRequestCanceled: {
|
onVerificationRequestCanceled: {
|
||||||
rootStore.contactStore.cancelVerificationRequest(publicKey)
|
rootStore.contactStore.cancelVerificationRequest(publicKey)
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,9 +10,13 @@ import StatusQ.Controls 0.1
|
||||||
|
|
||||||
import shared.views.chat 1.0
|
import shared.views.chat 1.0
|
||||||
|
|
||||||
|
import AppLayouts.Profile.stores 1.0 as ProfileStores
|
||||||
|
|
||||||
CommonContactDialog {
|
CommonContactDialog {
|
||||||
id: root
|
id: root
|
||||||
|
|
||||||
|
property ProfileStores.ProfileStore profileStore
|
||||||
|
|
||||||
property int verificationStatus
|
property int verificationStatus
|
||||||
property string verificationChallenge
|
property string verificationChallenge
|
||||||
property string verificationResponse
|
property string verificationResponse
|
||||||
|
@ -70,13 +74,13 @@ CommonContactDialog {
|
||||||
id: challengeMessage
|
id: challengeMessage
|
||||||
timestamp: root.verificationRequestedAt
|
timestamp: root.verificationRequestedAt
|
||||||
messageDetails.messageText: root.verificationChallenge
|
messageDetails.messageText: root.verificationChallenge
|
||||||
messageDetails.sender.id: Global.userProfile.pubKey
|
messageDetails.sender.id: root.profileStore.pubkey
|
||||||
messageDetails.sender.displayName: Global.userProfile.name
|
messageDetails.sender.displayName: root.profileStore.name
|
||||||
messageDetails.sender.profileImage.name: Global.userProfile.icon
|
messageDetails.sender.profileImage.name: root.profileStore.icon
|
||||||
messageDetails.sender.profileImage.assetSettings.isImage: true
|
messageDetails.sender.profileImage.assetSettings.isImage: true
|
||||||
messageDetails.sender.profileImage.colorId: Utils.colorIdForPubkey(Global.userProfile.pubKey)
|
messageDetails.sender.profileImage.colorId: Utils.colorIdForPubkey(root.profileStore.pubkey)
|
||||||
messageDetails.sender.profileImage.colorHash: Utils.getColorHashAsJson(Global.userProfile.pubKey, !!Global.userProfile.preferredName)
|
messageDetails.sender.profileImage.colorHash: Utils.getColorHashAsJson(root.profileStore.pubkey, !!root.profileStore.preferredName)
|
||||||
messageDetails.sender.isEnsVerified: !!Global.userProfile.preferredName
|
messageDetails.sender.isEnsVerified: !!root.profileStore.preferredName
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -11,6 +11,8 @@ import utils 1.0
|
||||||
StatusModal {
|
StatusModal {
|
||||||
id: root
|
id: root
|
||||||
|
|
||||||
|
property alias myKeyUid: content.myKeyUid
|
||||||
|
|
||||||
property var sharedKeycardModule
|
property var sharedKeycardModule
|
||||||
property var emojiPopup
|
property var emojiPopup
|
||||||
|
|
||||||
|
|
|
@ -7,6 +7,8 @@ import "./states"
|
||||||
Item {
|
Item {
|
||||||
id: root
|
id: root
|
||||||
|
|
||||||
|
property string myKeyUid
|
||||||
|
|
||||||
property var sharedKeycardModule
|
property var sharedKeycardModule
|
||||||
property var emojiPopup
|
property var emojiPopup
|
||||||
readonly property alias primaryButtonEnabled: d.primaryButtonEnabled
|
readonly property alias primaryButtonEnabled: d.primaryButtonEnabled
|
||||||
|
@ -158,6 +160,7 @@ Item {
|
||||||
Component {
|
Component {
|
||||||
id: confirmationComponent
|
id: confirmationComponent
|
||||||
KeycardConfirmation {
|
KeycardConfirmation {
|
||||||
|
myKeyUid: root.myKeyUid
|
||||||
sharedKeycardModule: root.sharedKeycardModule
|
sharedKeycardModule: root.sharedKeycardModule
|
||||||
|
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
|
|
|
@ -13,6 +13,8 @@ import "../helpers"
|
||||||
Item {
|
Item {
|
||||||
id: root
|
id: root
|
||||||
|
|
||||||
|
property string myKeyUid
|
||||||
|
|
||||||
property var sharedKeycardModule
|
property var sharedKeycardModule
|
||||||
|
|
||||||
signal confirmationUpdated(bool value)
|
signal confirmationUpdated(bool value)
|
||||||
|
@ -73,10 +75,8 @@ Item {
|
||||||
horizontalAlignment: Text.AlignHCenter
|
horizontalAlignment: Text.AlignHCenter
|
||||||
Layout.preferredHeight: Constants.keycard.general.titleHeight
|
Layout.preferredHeight: Constants.keycard.general.titleHeight
|
||||||
text: {
|
text: {
|
||||||
// we need to check userProfile since factory reset flow is also available before user logs in the app
|
if (!!root.sharedKeycardModule.keyPairForProcessing &&
|
||||||
if (!!Global.userProfile &&
|
root.sharedKeycardModule.keyPairForProcessing.keyUid === root.myKeyUid)
|
||||||
!!root.sharedKeycardModule.keyPairForProcessing &&
|
|
||||||
root.sharedKeycardModule.keyPairForProcessing.keyUid === Global.userProfile.keyUid)
|
|
||||||
return qsTr("Warning, this Keycard stores your main Status profile and\naccounts. A factory reset will permanently delete it.")
|
return qsTr("Warning, this Keycard stores your main Status profile and\naccounts. A factory reset will permanently delete it.")
|
||||||
|
|
||||||
return qsTr("A factory reset will delete the key on this Keycard.\nAre you sure you want to do this?")
|
return qsTr("A factory reset will delete the key on this Keycard.\nAre you sure you want to do this?")
|
||||||
|
|
Loading…
Reference in New Issue