diff --git a/src/app/global/local_account_sensitive_settings.nim b/src/app/global/local_account_sensitive_settings.nim index 2518e2b33c..0b7481b805 100644 --- a/src/app/global/local_account_sensitive_settings.nim +++ b/src/app/global/local_account_sensitive_settings.nim @@ -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() diff --git a/ui/app/AppLayouts/Chat/stores/RootStore.qml b/ui/app/AppLayouts/Chat/stores/RootStore.qml index b99456326e..9fc163f560 100644 --- a/ui/app/AppLayouts/Chat/stores/RootStore.qml +++ b/ui/app/AppLayouts/Chat/stores/RootStore.qml @@ -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) diff --git a/ui/app/AppLayouts/Communities/panels/PermissionsSettingsPanel.qml b/ui/app/AppLayouts/Communities/panels/PermissionsSettingsPanel.qml index b03801b7f3..a2dc27ea5f 100644 --- a/ui/app/AppLayouts/Communities/panels/PermissionsSettingsPanel.qml +++ b/ui/app/AppLayouts/Communities/panels/PermissionsSettingsPanel.qml @@ -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 diff --git a/ui/app/AppLayouts/Communities/popups/CreateChannelPopup.qml b/ui/app/AppLayouts/Communities/popups/CreateChannelPopup.qml index 1afae5ac60..69b0a81317 100644 --- a/ui/app/AppLayouts/Communities/popups/CreateChannelPopup.qml +++ b/ui/app/AppLayouts/Communities/popups/CreateChannelPopup.qml @@ -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") diff --git a/ui/app/AppLayouts/Communities/popups/HoldingsDropdown.qml b/ui/app/AppLayouts/Communities/popups/HoldingsDropdown.qml index f68001802a..9be043cd67 100644 --- a/ui/app/AppLayouts/Communities/popups/HoldingsDropdown.qml +++ b/ui/app/AppLayouts/Communities/popups/HoldingsDropdown.qml @@ -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 diff --git a/ui/app/AppLayouts/Communities/views/CommunityColumnView.qml b/ui/app/AppLayouts/Communities/views/CommunityColumnView.qml index 69a5229d71..9620ed8ac7 100644 --- a/ui/app/AppLayouts/Communities/views/CommunityColumnView.qml +++ b/ui/app/AppLayouts/Communities/views/CommunityColumnView.qml @@ -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 diff --git a/ui/app/AppLayouts/Communities/views/CommunitySettingsView.qml b/ui/app/AppLayouts/Communities/views/CommunitySettingsView.qml index 55f4db3583..8a480c01e5 100644 --- a/ui/app/AppLayouts/Communities/views/CommunitySettingsView.qml +++ b/ui/app/AppLayouts/Communities/views/CommunitySettingsView.qml @@ -306,6 +306,8 @@ StatusSectionLayout { collectiblesModel: rootStore.collectiblesModel channelsModel: rootStore.chatCommunitySectionModule.model + ensCommunityPermissionsEnabled: rootStore.ensCommunityPermissionsEnabled + communityDetails: d.communityDetails onCreatePermissionRequested: diff --git a/ui/app/AppLayouts/Communities/views/EditPermissionView.qml b/ui/app/AppLayouts/Communities/views/EditPermissionView.qml index 290d83f78b..cd668deb44 100644 --- a/ui/app/AppLayouts/Communities/views/EditPermissionView.qml +++ b/ui/app/AppLayouts/Communities/views/EditPermissionView.qml @@ -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 diff --git a/ui/app/AppLayouts/Profile/stores/AdvancedStore.qml b/ui/app/AppLayouts/Profile/stores/AdvancedStore.qml index 12811b9da3..0d270e3f65 100644 --- a/ui/app/AppLayouts/Profile/stores/AdvancedStore.qml +++ b/ui/app/AppLayouts/Profile/stores/AdvancedStore.qml @@ -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 } diff --git a/ui/app/AppLayouts/Profile/views/AdvancedView.qml b/ui/app/AppLayouts/Profile/views/AdvancedView.qml index 7b82f3ecc8..f1e326f110 100644 --- a/ui/app/AppLayouts/Profile/views/AdvancedView.qml +++ b/ui/app/AppLayouts/Profile/views/AdvancedView.qml @@ -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 }