chore(experemantal_features): Remove community settings and enable it by default
Part of: #5922
This commit is contained in:
parent
bdf4656405
commit
d6cc1ed1ab
|
@ -6,8 +6,6 @@ import ../../constants
|
|||
const LSS_KEY_CHAT_SPLIT_VIEW* = "chatSplitView"
|
||||
const LSS_KEY_WALLET_SPLIT_VIEW* = "walletSplitView"
|
||||
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 DEFAULT_IS_WALLET_ENABLED = false
|
||||
const LSS_KEY_NODE_MANAGEMENT_ENABLED* = "nodeManagementEnabled"
|
||||
|
@ -196,20 +194,6 @@ QtObject:
|
|||
write = setProfileSplitView
|
||||
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 getIsWalletEnabled*(self: LocalAccountSensitiveSettings): bool {.slot.} =
|
||||
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_WALLET_SPLIT_VIEW: self.walletSplitViewChanged()
|
||||
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_NODE_MANAGEMENT_ENABLED: self.nodeManagementEnabledChanged()
|
||||
of LSS_KEY_IS_BROWSER_ENABLED: self.isBrowserEnabledChanged()
|
||||
|
|
|
@ -211,8 +211,7 @@ proc createChannelGroupItem[T](self: Module[T], c: ChannelGroupDto): SectionItem
|
|||
hasNotification,
|
||||
notificationsCount,
|
||||
active,
|
||||
enabled = (not isCommunity or
|
||||
singletonInstance.localAccountSensitiveSettings.getCommunitiesEnabled()),
|
||||
enabled = true,
|
||||
if (isCommunity): communityDetails.joined else: true,
|
||||
if (isCommunity): communityDetails.canJoin else: true,
|
||||
c.canManageUsers,
|
||||
|
@ -540,10 +539,6 @@ method toggleSection*[T](self: Module[T], sectionType: SectionType) =
|
|||
let enabled = singletonInstance.localAccountSensitiveSettings.getIsBrowserEnabled()
|
||||
self.setSectionAvailability(sectionType, 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):
|
||||
let enabled = singletonInstance.localAccountSensitiveSettings.getNodeManagementEnabled()
|
||||
self.setSectionAvailability(sectionType, not enabled)
|
||||
|
|
|
@ -76,8 +76,6 @@ proc initModel(self: Module) =
|
|||
var items: seq[Item]
|
||||
for cg in channelGroups:
|
||||
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)
|
||||
items.add(item)
|
||||
elif cg.channelGroupType == ChannelGroupType.Personal:
|
||||
|
@ -115,19 +113,14 @@ method onToggleSection*(self: Module, sectionType: SectionType) =
|
|||
if(sectionType != SectionType.Community):
|
||||
return
|
||||
|
||||
if(singletonInstance.localAccountSensitiveSettings.getCommunitiesEnabled()):
|
||||
let channelGroups = self.controller.getChannelGroups()
|
||||
for cg in channelGroups:
|
||||
if cg.channelGroupType == ChannelGroupType.Community:
|
||||
let ind = self.view.exemptionsModel().findIndexForItemId(cg.id)
|
||||
if(ind != -1):
|
||||
continue
|
||||
let item = self.createItem(cg.id, cg.name, cg.images.thumbnail, cg.color, joinedTimestamp = 0, item.Type.Community)
|
||||
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)
|
||||
let channelGroups = self.controller.getChannelGroups()
|
||||
for cg in channelGroups:
|
||||
if cg.channelGroupType == ChannelGroupType.Community:
|
||||
let ind = self.view.exemptionsModel().findIndexForItemId(cg.id)
|
||||
if(ind != -1):
|
||||
continue
|
||||
let item = self.createItem(cg.id, cg.name, cg.images.thumbnail, cg.color, joinedTimestamp = 0, item.Type.Community)
|
||||
self.view.exemptionsModel().addItem(item)
|
||||
|
||||
method addCommunity*(self: Module, communityDto: CommunityDto) =
|
||||
let ind = self.view.exemptionsModel().findIndexForItemId(communityDto.id)
|
||||
|
|
|
@ -104,7 +104,6 @@ Item {
|
|||
text: qsTrId("communities")
|
||||
icon.name: "communities"
|
||||
onTriggered: Global.openPopup(communitiesPopupComponent)
|
||||
enabled: localAccountSensitiveSettings.communitiesEnabled
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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 {
|
||||
anchors.leftMargin: 0
|
||||
anchors.rightMargin: 0
|
||||
|
|
|
@ -62,7 +62,6 @@ Item {
|
|||
//% "I understand"
|
||||
confirmButtonLabel: qsTrId("i-understand")
|
||||
onConfirmButtonClicked: {
|
||||
localAccountSensitiveSettings.communitiesEnabled = true
|
||||
onConfirmed()
|
||||
close()
|
||||
}
|
||||
|
@ -206,7 +205,6 @@ Item {
|
|||
Layout.leftMargin: root.innerMargin
|
||||
font.pixelSize: 13
|
||||
}
|
||||
|
||||
StatusBaseText {
|
||||
id: invitedYou
|
||||
visible: text != ""
|
||||
|
|
Loading…
Reference in New Issue