chore(experemantal_features): Remove community settings and enable it by default

Part of: #5922
This commit is contained in:
Boris Melnik 2022-06-01 11:04:32 +03:00 committed by Iuri Matias
parent bdf4656405
commit d6cc1ed1ab
6 changed files with 9 additions and 59 deletions

View File

@ -6,8 +6,6 @@ import ../../constants
const LSS_KEY_CHAT_SPLIT_VIEW* = "chatSplitView" const LSS_KEY_CHAT_SPLIT_VIEW* = "chatSplitView"
const LSS_KEY_WALLET_SPLIT_VIEW* = "walletSplitView" const LSS_KEY_WALLET_SPLIT_VIEW* = "walletSplitView"
const LSS_KEY_PROFILE_SPLIT_VIEW* = "profileSplitView" const LSS_KEY_PROFILE_SPLIT_VIEW* = "profileSplitView"
const LSS_KEY_COMMUNITIES_ENABLED* = "communitiesEnabled"
const DEFAULT_COMMUNITIES_ENABLED = false
const LSS_KEY_IS_WALLET_ENABLED* = "isExperimentalWalletEnabled" const LSS_KEY_IS_WALLET_ENABLED* = "isExperimentalWalletEnabled"
const DEFAULT_IS_WALLET_ENABLED = false const DEFAULT_IS_WALLET_ENABLED = false
const LSS_KEY_NODE_MANAGEMENT_ENABLED* = "nodeManagementEnabled" const LSS_KEY_NODE_MANAGEMENT_ENABLED* = "nodeManagementEnabled"
@ -196,20 +194,6 @@ QtObject:
write = setProfileSplitView write = setProfileSplitView
notify = profileSplitViewChanged notify = profileSplitViewChanged
proc communitiesEnabledChanged*(self: LocalAccountSensitiveSettings) {.signal.}
proc getCommunitiesEnabled*(self: LocalAccountSensitiveSettings): bool {.slot.} =
getSettingsProp[bool](self, LSS_KEY_COMMUNITIES_ENABLED, newQVariant(DEFAULT_COMMUNITIES_ENABLED))
proc setCommunitiesEnabled*(self: LocalAccountSensitiveSettings, value: bool) {.slot.} =
setSettingsProp(self, LSS_KEY_COMMUNITIES_ENABLED, newQVariant(value)):
self.communitiesEnabledChanged()
QtProperty[bool] communitiesEnabled:
read = getCommunitiesEnabled
write = setCommunitiesEnabled
notify = communitiesEnabledChanged
proc isWalletEnabledChanged*(self: LocalAccountSensitiveSettings) {.signal.} proc isWalletEnabledChanged*(self: LocalAccountSensitiveSettings) {.signal.}
proc getIsWalletEnabled*(self: LocalAccountSensitiveSettings): bool {.slot.} = proc getIsWalletEnabled*(self: LocalAccountSensitiveSettings): bool {.slot.} =
getSettingsProp[bool](self, LSS_KEY_IS_WALLET_ENABLED, newQVariant(DEFAULT_IS_WALLET_ENABLED)) getSettingsProp[bool](self, LSS_KEY_IS_WALLET_ENABLED, newQVariant(DEFAULT_IS_WALLET_ENABLED))
@ -785,7 +769,6 @@ QtObject:
of LSS_KEY_CHAT_SPLIT_VIEW: self.chatSplitViewChanged() of LSS_KEY_CHAT_SPLIT_VIEW: self.chatSplitViewChanged()
of LSS_KEY_WALLET_SPLIT_VIEW: self.walletSplitViewChanged() of LSS_KEY_WALLET_SPLIT_VIEW: self.walletSplitViewChanged()
of LSS_KEY_PROFILE_SPLIT_VIEW: self.profileSplitViewChanged() of LSS_KEY_PROFILE_SPLIT_VIEW: self.profileSplitViewChanged()
of LSS_KEY_COMMUNITIES_ENABLED: self.communitiesEnabledChanged()
of LSS_KEY_IS_WALLET_ENABLED: self.isWalletEnabledChanged() of LSS_KEY_IS_WALLET_ENABLED: self.isWalletEnabledChanged()
of LSS_KEY_NODE_MANAGEMENT_ENABLED: self.nodeManagementEnabledChanged() of LSS_KEY_NODE_MANAGEMENT_ENABLED: self.nodeManagementEnabledChanged()
of LSS_KEY_IS_BROWSER_ENABLED: self.isBrowserEnabledChanged() of LSS_KEY_IS_BROWSER_ENABLED: self.isBrowserEnabledChanged()

View File

@ -211,8 +211,7 @@ proc createChannelGroupItem[T](self: Module[T], c: ChannelGroupDto): SectionItem
hasNotification, hasNotification,
notificationsCount, notificationsCount,
active, active,
enabled = (not isCommunity or enabled = true,
singletonInstance.localAccountSensitiveSettings.getCommunitiesEnabled()),
if (isCommunity): communityDetails.joined else: true, if (isCommunity): communityDetails.joined else: true,
if (isCommunity): communityDetails.canJoin else: true, if (isCommunity): communityDetails.canJoin else: true,
c.canManageUsers, c.canManageUsers,
@ -540,10 +539,6 @@ method toggleSection*[T](self: Module[T], sectionType: SectionType) =
let enabled = singletonInstance.localAccountSensitiveSettings.getIsBrowserEnabled() let enabled = singletonInstance.localAccountSensitiveSettings.getIsBrowserEnabled()
self.setSectionAvailability(sectionType, not enabled) self.setSectionAvailability(sectionType, not enabled)
singletonInstance.localAccountSensitiveSettings.setIsBrowserEnabled(not enabled) singletonInstance.localAccountSensitiveSettings.setIsBrowserEnabled(not enabled)
elif (sectionType == SectionType.Community):
let enabled = singletonInstance.localAccountSensitiveSettings.getCommunitiesEnabled()
self.setSectionAvailability(sectionType, not enabled)
singletonInstance.localAccountSensitiveSettings.setCommunitiesEnabled(not enabled)
elif (sectionType == SectionType.NodeManagement): elif (sectionType == SectionType.NodeManagement):
let enabled = singletonInstance.localAccountSensitiveSettings.getNodeManagementEnabled() let enabled = singletonInstance.localAccountSensitiveSettings.getNodeManagementEnabled()
self.setSectionAvailability(sectionType, not enabled) self.setSectionAvailability(sectionType, not enabled)

View File

@ -76,8 +76,6 @@ proc initModel(self: Module) =
var items: seq[Item] var items: seq[Item]
for cg in channelGroups: for cg in channelGroups:
if cg.channelGroupType == ChannelGroupType.Community: if cg.channelGroupType == ChannelGroupType.Community:
if(not singletonInstance.localAccountSensitiveSettings.getCommunitiesEnabled()):
continue
let item = self.createItem(cg.id, cg.name, cg.images.thumbnail, cg.color, joinedTimestamp = 0, item.Type.Community) let item = self.createItem(cg.id, cg.name, cg.images.thumbnail, cg.color, joinedTimestamp = 0, item.Type.Community)
items.add(item) items.add(item)
elif cg.channelGroupType == ChannelGroupType.Personal: elif cg.channelGroupType == ChannelGroupType.Personal:
@ -115,7 +113,6 @@ method onToggleSection*(self: Module, sectionType: SectionType) =
if(sectionType != SectionType.Community): if(sectionType != SectionType.Community):
return return
if(singletonInstance.localAccountSensitiveSettings.getCommunitiesEnabled()):
let channelGroups = self.controller.getChannelGroups() let channelGroups = self.controller.getChannelGroups()
for cg in channelGroups: for cg in channelGroups:
if cg.channelGroupType == ChannelGroupType.Community: if cg.channelGroupType == ChannelGroupType.Community:
@ -124,10 +121,6 @@ method onToggleSection*(self: Module, sectionType: SectionType) =
continue continue
let item = self.createItem(cg.id, cg.name, cg.images.thumbnail, cg.color, joinedTimestamp = 0, item.Type.Community) let item = self.createItem(cg.id, cg.name, cg.images.thumbnail, cg.color, joinedTimestamp = 0, item.Type.Community)
self.view.exemptionsModel().addItem(item) self.view.exemptionsModel().addItem(item)
else:
for item in self.view.exemptionsModel().modelIterator():
if(item.itemType == Type.Community and self.controller.removeNotifSettingExemptions(item.id)):
self.view.exemptionsModel().removeItemById(item.id)
method addCommunity*(self: Module, communityDto: CommunityDto) = method addCommunity*(self: Module, communityDto: CommunityDto) =
let ind = self.view.exemptionsModel().findIndexForItemId(communityDto.id) let ind = self.view.exemptionsModel().findIndexForItemId(communityDto.id)

View File

@ -104,7 +104,6 @@ Item {
text: qsTrId("communities") text: qsTrId("communities")
icon.name: "communities" icon.name: "communities"
onTriggered: Global.openPopup(communitiesPopupComponent) onTriggered: Global.openPopup(communitiesPopupComponent)
enabled: localAccountSensitiveSettings.communitiesEnabled
} }
} }

View File

@ -145,24 +145,6 @@ SettingsContentBase {
} }
} }
// TODO: replace with StatusQ component
StatusSettingsLineButton {
anchors.leftMargin: 0
anchors.rightMargin: 0
//% "Communities"
text: qsTrId("communities")
isSwitch: true
switchChecked: localAccountSensitiveSettings.communitiesEnabled
onClicked: {
if (!localAccountSensitiveSettings.communitiesEnabled) {
confirmationPopup.experimentalFeature = root.advancedStore.experimentalFeatures.communities
confirmationPopup.open()
} else {
root.advancedStore.toggleExperimentalFeature(root.advancedStore.experimentalFeatures.communities)
}
}
}
StatusSettingsLineButton { StatusSettingsLineButton {
anchors.leftMargin: 0 anchors.leftMargin: 0
anchors.rightMargin: 0 anchors.rightMargin: 0

View File

@ -62,7 +62,6 @@ Item {
//% "I understand" //% "I understand"
confirmButtonLabel: qsTrId("i-understand") confirmButtonLabel: qsTrId("i-understand")
onConfirmButtonClicked: { onConfirmButtonClicked: {
localAccountSensitiveSettings.communitiesEnabled = true
onConfirmed() onConfirmed()
close() close()
} }
@ -206,7 +205,6 @@ Item {
Layout.leftMargin: root.innerMargin Layout.leftMargin: root.innerMargin
font.pixelSize: 13 font.pixelSize: 13
} }
StatusBaseText { StatusBaseText {
id: invitedYou id: invitedYou
visible: text != "" visible: text != ""