chore(beta): hioe ENS community permission creation (#15664)

Fixes #15663
This commit is contained in:
Jonathan Rainville 2024-07-19 14:45:40 -04:00 committed by GitHub
parent 32aff401d6
commit a357299928
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
10 changed files with 72 additions and 17 deletions

View File

@ -12,6 +12,8 @@ const LSS_KEY_IS_COMMUNITY_TOKENS_ENABLED* = "isExperimentalCommunityTokensEnabl
const DEFAULT_IS_COMMUNITY_TOKENS_ENABLED = false
const LSS_KEY_NODE_MANAGEMENT_ENABLED* = "nodeManagementEnabled"
const DEFAULT_NODE_MANAGEMENT_ENABLED = false
const LSS_KEY_ENS_COMMUNITY_PERMISSIONS_ENABLED* = "ensCommunityPermissionsEnabled"
const DEFAULT_COMMUNITY_PERMISSIONS_ENABLED = false
const LSS_KEY_IS_BROWSER_ENABLED* = "isExperimentalBrowserEnabled"
const DEFAULT_IS_BROWSER_ENABLED = false
const LSS_KEY_SHOW_ONLINE_USERS* = "showOnlineUsers"
@ -243,6 +245,18 @@ QtObject:
write = setIsBrowserEnabled
notify = isBrowserEnabledChanged
proc ensCommunityPermissionsEnabledChanged*(self: LocalAccountSensitiveSettings) {.signal.}
proc getEnsCommunityPermissionsEnabled*(self: LocalAccountSensitiveSettings): bool {.slot.} =
getSettingsProp[bool](self, LSS_KEY_ENS_COMMUNITY_PERMISSIONS_ENABLED, newQVariant(DEFAULT_COMMUNITY_PERMISSIONS_ENABLED))
proc setEnsCommunityPermissionsEnabled*(self: LocalAccountSensitiveSettings, value: bool) {.slot.} =
setSettingsProp(self, LSS_KEY_ENS_COMMUNITY_PERMISSIONS_ENABLED, newQVariant(value)):
self.ensCommunityPermissionsEnabledChanged()
QtProperty[bool] ensCommunityPermissionsEnabled:
read = getEnsCommunityPermissionsEnabled
write = setEnsCommunityPermissionsEnabled
notify = ensCommunityPermissionsEnabledChanged
proc showOnlineUsersChanged*(self: LocalAccountSensitiveSettings) {.signal.}
proc getShowOnlineUsers*(self: LocalAccountSensitiveSettings): bool {.slot.} =
getSettingsProp[bool](self, LSS_KEY_SHOW_ONLINE_USERS, newQVariant(DEFAULT_SHOW_ONLINE_USERS))
@ -691,6 +705,7 @@ QtObject:
of LSS_KEY_WALLET_SPLIT_VIEW: self.walletSplitViewChanged()
of LSS_KEY_PROFILE_SPLIT_VIEW: self.profileSplitViewChanged()
of LSS_KEY_NODE_MANAGEMENT_ENABLED: self.nodeManagementEnabledChanged()
of LSS_KEY_ENS_COMMUNITY_PERMISSIONS_ENABLED: self.ensCommunityPermissionsEnabledChanged()
of LSS_KEY_IS_BROWSER_ENABLED: self.isBrowserEnabledChanged()
of LSS_KEY_SHOW_ONLINE_USERS: self.showOnlineUsersChanged()
of LSS_KEY_EXPAND_USERS_LIST: self.expandUsersListChanged()

View File

@ -169,6 +169,8 @@ QtObject {
readonly property bool permissionsCheckOngoing: chatCommunitySectionModule.permissionsCheckOngoing
readonly property bool ensCommunityPermissionsEnabled: localAccountSensitiveSettings.ensCommunityPermissionsEnabled
signal importingCommunityStateChanged(string communityId, int state, string errorMsg)
signal communityAdded(string communityId)

View File

@ -23,6 +23,7 @@ StackView {
required property var collectiblesModel
required property var channelsModel
property bool showChannelSelector: true
property bool ensCommunityPermissionsEnabled
property alias initialPage: initialItem
// id, name, image, color, owner properties expected
@ -202,6 +203,7 @@ StackView {
communityDetails: root.communityDetails
showChannelSelector: root.showChannelSelector
isEditState: newPermissionViewPage.isEditState
ensCommunityPermissionsEnabled: root.ensCommunityPermissionsEnabled
holdingsRequired: selectedHoldingsModel
? selectedHoldingsModel.count > 0 : false

View File

@ -33,6 +33,7 @@ StatusStackModal {
property bool isDeleteable: false
property bool viewOnlyCanAddReaction
property bool hideIfPermissionsNotMet: false
property bool ensCommunityPermissionsEnabled: false
property string communityId: ""
property string chatId: "_newChannel"
@ -928,6 +929,7 @@ StatusStackModal {
channelsModel: d.channelEditModel.liveChannelsModel
communityDetails: d.communityDetails
showChannelSelector: false
ensCommunityPermissionsEnabled: root.ensCommunityPermissionsEnabled
readonly property string nextButtonText: !!currentItem.permissionKeyToEdit ?
qsTr("Update permission") : qsTr("Create permission")

View File

@ -19,6 +19,7 @@ StatusDropdown {
property var assetsModel
property var collectiblesModel
property bool isENSTab: true
property bool ensCommunityPermissionsEnabled
property string noDataText: {
if(d.currentHoldingType === Constants.TokenType.ERC20)
return noDataTextForAssets
@ -90,10 +91,22 @@ StatusDropdown {
id: d
// Internal management properties and signals:
readonly property var holdingTypes: [
Constants.TokenType.ERC20, Constants.TokenType.ERC721, Constants.TokenType.ENS
]
readonly property var tabsModel: [qsTr("Assets"), qsTr("Collectibles"), qsTr("ENS")]
readonly property var holdingTypes: {
let types = [
Constants.TokenType.ERC20, Constants.TokenType.ERC721
]
if (root.ensCommunityPermissionsEnabled) {
types.push(Constants.TokenType.ENS)
}
return types
}
readonly property var tabsModel: {
let tabs = [qsTr("Assets"), qsTr("Collectibles")]
if (root.ensCommunityPermissionsEnabled) {
tabs.push(qsTr("ENS"))
}
return tabs
}
readonly property var tabsModelNoEns: [qsTr("Assets"), qsTr("Collectibles")]
readonly property bool assetsReady: root.assetAmount !== "0" && root.assetKey

View File

@ -541,6 +541,7 @@ Item {
communitiesStore: root.communitiesStore
assetsModel: root.store.assetsModel
collectiblesModel: root.store.collectiblesModel
ensCommunityPermissionsEnabled: root.store.ensCommunityPermissionsEnabled
permissionsModel: {
root.store.prepareTokenModelForCommunity(communityData.id)
return root.store.permissionsModel

View File

@ -306,6 +306,8 @@ StatusSectionLayout {
collectiblesModel: rootStore.collectiblesModel
channelsModel: rootStore.chatCommunitySectionModule.model
ensCommunityPermissionsEnabled: rootStore.ensCommunityPermissionsEnabled
communityDetails: d.communityDetails
onCreatePermissionRequested:

View File

@ -51,6 +51,7 @@ StatusScrollView {
property bool isPrivate: false
property bool holdingsRequired: true
property bool showChannelSelector: true
property bool ensCommunityPermissionsEnabled
// roles: type, key, name, amount, imageSource
property var selectedHoldingsModel: ListModel {}
@ -243,6 +244,7 @@ StatusScrollView {
assetsModel: root.assetsModel
collectiblesModel: root.collectiblesModel
showTokenAmount: false
ensCommunityPermissionsEnabled: root.ensCommunityPermissionsEnabled
function addItem(type, item, amount) {
const key = item.key

View File

@ -19,6 +19,7 @@ QtObject {
property int logMaxBackups: advancedModule ? advancedModule.logMaxBackups : 1
property bool isRuntimeLogLevelSet: advancedModule ? advancedModule.isRuntimeLogLevelSet: false
readonly property bool archiveProtocolEnabled: advancedModule ? advancedModule.archiveProtocolEnabled : false
readonly property bool ensCommunityPermissionsEnabled: localAccountSensitiveSettings.ensCommunityPermissionsEnabled
property var customNetworksModel: advancedModule? advancedModule.customNetworksModel : []
@ -164,6 +165,10 @@ QtObject {
}
}
function toggleEnsCommunityPermissionsEnabled() {
localAccountSensitiveSettings.ensCommunityPermissionsEnabled = !root.ensCommunityPermissionsEnabled
}
function toggleManageCommunityOnTestnet() {
root.isManageCommunityOnTestModeEnabled = !root.isManageCommunityOnTestModeEnabled
}

View File

@ -171,8 +171,6 @@ SettingsContentBase {
}
}
/////////////////////////////////////////////////////
// WalletConnect POC - to remove
StatusSettingsLineButton {
anchors.leftMargin: 0
anchors.rightMargin: 0
@ -185,6 +183,30 @@ SettingsContentBase {
}
}
StatusSettingsLineButton {
anchors.leftMargin: 0
anchors.rightMargin: 0
text: qsTr("Archive Protocol Enabled")
isSwitch: true
switchChecked: root.advancedStore.archiveProtocolEnabled
onClicked: {
root.advancedStore.toggleArchiveProtocolEnabled()
}
}
StatusSettingsLineButton {
anchors.leftMargin: 0
anchors.rightMargin: 0
text: qsTr("ENS Community Permissions Enabled")
isSwitch: true
switchChecked: root.advancedStore.ensCommunityPermissionsEnabled
onClicked: {
root.advancedStore.toggleEnsCommunityPermissionsEnabled()
}
}
/////////////////////////////////////////////////////
// WalletConnect POC - to remove
StatusSettingsLineButton {
anchors.leftMargin: 0
anchors.rightMargin: 0
@ -197,17 +219,6 @@ SettingsContentBase {
}
/////////////////////////////////////////////////////
StatusSettingsLineButton {
anchors.leftMargin: 0
anchors.rightMargin: 0
text: qsTr("Archive Protocol Enabled")
isSwitch: true
switchChecked: root.advancedStore.archiveProtocolEnabled
onClicked: {
root.advancedStore.toggleArchiveProtocolEnabled()
}
}
Separator {
width: parent.width
}