mirror of
https://github.com/status-im/status-desktop.git
synced 2025-02-16 16:47:24 +00:00
feat(Settings): Enable Community Archive by default and remove toggle
Closes: #6098 Original commit by @borismelnik
This commit is contained in:
parent
8720fe6949
commit
b65211ac94
@ -34,9 +34,6 @@ proc delete*(self: Controller) =
|
||||
discard
|
||||
|
||||
proc init*(self: Controller) =
|
||||
self.events.on(SIGNAL_ENABLE_COMMUNITY_ARCHIVE_FAILED) do(e:Args):
|
||||
let args = ErrorArgs(e)
|
||||
self.delegate.enableCommunityHistoryArchiveSupportFailed(args.msg)
|
||||
discard
|
||||
|
||||
proc getFleet*(self: Controller): string =
|
||||
@ -61,25 +58,6 @@ proc setBloomLevel*(self: Controller, bloomLevel: string) =
|
||||
|
||||
self.delegate.onBloomLevelSet()
|
||||
|
||||
method toggleCommunityHistoryArchiveSupport*(self: Controller) =
|
||||
let enabled = self.nodeConfigurationService.isCommunityHistoryArchiveSupportEnabled()
|
||||
|
||||
if enabled:
|
||||
if (not self.nodeConfigurationService.disableCommunityHistoryArchiveSupport()):
|
||||
# in the future we may do a call from here to show a popup about this error
|
||||
error "an error occurred, we couldn't enable community history archive support"
|
||||
return
|
||||
else:
|
||||
if (not self.nodeConfigurationService.enableCommunityHistoryArchiveSupport()):
|
||||
# in the future we may do a call from here to show a popup about this error
|
||||
error "an error occurred, we couldn't disable community history archive support"
|
||||
return
|
||||
|
||||
self.delegate.onCommunityHistoryArchiveSupportToggled()
|
||||
|
||||
method isCommunityHistoryArchiveSupportEnabled*(self: Controller): bool =
|
||||
return self.nodeConfigurationService.isCommunityHistoryArchiveSupportEnabled()
|
||||
|
||||
proc getWakuV2LightClientEnabled*(self: Controller): bool =
|
||||
return self.nodeConfigurationService.getV2LightMode()
|
||||
|
||||
|
@ -21,9 +21,6 @@ method onFleetSet*(self: AccessInterface) {.base.} =
|
||||
method onBloomLevelSet*(self: AccessInterface) {.base.} =
|
||||
raise newException(ValueError, "No implementation available")
|
||||
|
||||
method onCommunityHistoryArchiveSupportToggled*(self: AccessInterface) {.base.} =
|
||||
raise newException(ValueError, "No implementation available")
|
||||
|
||||
method onWakuV2LightClientSet*(self: AccessInterface) {.base.} =
|
||||
raise newException(ValueError, "No implementation available")
|
||||
|
||||
@ -95,12 +92,3 @@ method toggleNodeManagementSection*(self: AccessInterface) {.base.} =
|
||||
|
||||
method enableDeveloperFeatures*(self: AccessInterface) {.base.} =
|
||||
raise newException(ValueError, "No implementation available")
|
||||
|
||||
method isCommunityHistoryArchiveSupportEnabled*(self: AccessInterface): bool {.base.} =
|
||||
raise newException(ValueError, "No implementation available")
|
||||
|
||||
method toggleCommunityHistoryArchiveSupport*(self: AccessInterface) {.base.} =
|
||||
raise newException(ValueError, "No implementation available")
|
||||
|
||||
method enableCommunityHistoryArchiveSupportFailed*(self: AccessInterface, msg: string) {.base.} =
|
||||
raise newException(ValueError, "No implementation available")
|
||||
|
@ -130,16 +130,3 @@ method toggleCommunitiesPortalSection*(self: Module) =
|
||||
|
||||
method toggleNodeManagementSection*(self: Module) =
|
||||
self.controller.toggleNodeManagementSection()
|
||||
|
||||
method onCommunityHistoryArchiveSupportToggled*(self: Module) =
|
||||
self.view.emitCommunityHistoryArchiveSupportEnabledSignal()
|
||||
|
||||
method toggleCommunityHistoryArchiveSupport*(self: Module) =
|
||||
self.controller.toggleCommunityHistoryArchiveSupport()
|
||||
|
||||
method isCommunityHistoryArchiveSupportEnabled*(self: Module): bool =
|
||||
self.controller.isCommunityHistoryArchiveSupportEnabled()
|
||||
|
||||
method enableCommunityHistoryArchiveSupportFailed*(self: Module, msg: string) =
|
||||
self.view.setEnableCommunityHistoryArchiveSupportFailedMsg(msg)
|
||||
self.view.enableCommunityHistoryArchiveSupportFailed()
|
||||
|
@ -5,7 +5,6 @@ QtObject:
|
||||
type
|
||||
View* = ref object of QObject
|
||||
delegate: io_interface.AccessInterface
|
||||
enableCommunityHistoryArchiveSupportFailedMsg*: string
|
||||
|
||||
proc delete*(self: View) =
|
||||
self.QObject.delete
|
||||
@ -18,19 +17,6 @@ QtObject:
|
||||
proc load*(self: View) =
|
||||
self.delegate.viewDidLoad()
|
||||
|
||||
proc enableCommunityHistoryArchiveSupportFailedMsgChanged*(self: View) {.signal.}
|
||||
proc getEnableCommunityHistoryArchiveSupportFailedMsg*(self: View): string {.slot.} =
|
||||
return self.enableCommunityHistoryArchiveSupportFailedMsg
|
||||
QtProperty[string] enableCommunityHistoryArchiveSupportFailedMsg:
|
||||
read = getEnableCommunityHistoryArchiveSupportFailedMsg
|
||||
notify = enableCommunityHistoryArchiveSupportFailedMsgChanged
|
||||
|
||||
proc setEnableCommunityHistoryArchiveSupportFailedMsg*(self: View, msg: string) {.slot.} =
|
||||
self.enableCommunityHistoryArchiveSupportFailedMsg = msg
|
||||
self.enableCommunityHistoryArchiveSupportFailedMsgChanged()
|
||||
|
||||
proc enableCommunityHistoryArchiveSupportFailed*(self: View) {.signal.}
|
||||
|
||||
proc fleetChanged*(self: View) {.signal.}
|
||||
proc getFleet*(self: View): string {.slot.} =
|
||||
return self.delegate.getFleet()
|
||||
@ -102,19 +88,6 @@ QtObject:
|
||||
proc toggleAutoMessage*(self: View) {.slot.} =
|
||||
self.delegate.toggleAutoMessage()
|
||||
|
||||
proc isCommunityHistoryArchiveSupportEnabledChanged*(self: View) {.signal.}
|
||||
proc getIsCommunityHistoryArchiveSupportEnabled*(self: View): bool {.slot.} =
|
||||
return self.delegate.isCommunityHistoryArchiveSupportEnabled()
|
||||
QtProperty[bool] isCommunityHistoryArchiveSupportEnabled:
|
||||
read = getIsCommunityHistoryArchiveSupportEnabled
|
||||
notify = isCommunityHistoryArchiveSupportEnabledChanged
|
||||
|
||||
proc emitCommunityHistoryArchiveSupportEnabledSignal*(self: View) =
|
||||
self.isCommunityHistoryArchiveSupportEnabledChanged()
|
||||
|
||||
proc toggleCommunityHistoryArchiveSupport*(self: View) {.slot.} =
|
||||
self.delegate.toggleCommunityHistoryArchiveSupport()
|
||||
|
||||
proc isDebugEnabledChanged*(self: View) {.signal.}
|
||||
proc getIsDebugEnabled*(self: View): bool {.slot.} =
|
||||
return self.delegate.isDebugEnabled()
|
||||
|
@ -310,7 +310,7 @@ var NODE_CONFIG* = %* {
|
||||
},
|
||||
"Networks": NETWORKS,
|
||||
"TorrentConfig": {
|
||||
"Enabled": false,
|
||||
"Enabled": true,
|
||||
"Port": DEFAULT_TORRENT_CONFIG_PORT,
|
||||
"DataDir": DEFAULT_TORRENT_CONFIG_DATADIR,
|
||||
"TorrentDir": DEFAULT_TORRENT_CONFIG_TORRENTDIR
|
||||
|
@ -120,7 +120,6 @@ const SIGNAL_COMMUNITY_MUTED* = "communityMuted"
|
||||
const SIGNAL_CATEGORY_MUTED* = "categoryMuted"
|
||||
const SIGNAL_CATEGORY_UNMUTED* = "categoryUnmuted"
|
||||
|
||||
const SIGNAL_ENABLE_COMMUNITY_ARCHIVE_FAILED* = "enableCommunityHistoryArchiveSupportFailed"
|
||||
const SIGNAL_DISCORD_CATEGORIES_AND_CHANNELS_EXTRACTED* = "discordCategoriesAndChannelsExtracted"
|
||||
const SIGNAL_DISCORD_COMMUNITY_IMPORT_FINISHED* = "discordCommunityImportFinished"
|
||||
const SIGNAL_DISCORD_COMMUNITY_IMPORT_PROGRESS* = "discordCommunityImportProgress"
|
||||
|
@ -29,6 +29,11 @@ type
|
||||
settingsService: settings_service.Service
|
||||
events: EventEmitter
|
||||
|
||||
# Forward declarations
|
||||
proc isCommunityHistoryArchiveSupportEnabled*(self: Service): bool
|
||||
proc enableCommunityHistoryArchiveSupport*(self: Service): bool
|
||||
|
||||
|
||||
proc delete*(self: Service) =
|
||||
discard
|
||||
|
||||
@ -44,6 +49,14 @@ proc adaptNodeSettingsForTheAppNeed(self: Service) =
|
||||
self.configuration.LogFile = "./geth.log"
|
||||
self.configuration.ShhextConfig.BackupDisabledDataDir = "./"
|
||||
|
||||
if (not self.isCommunityHistoryArchiveSupportEnabled):
|
||||
# Force community archive support true on Desktop
|
||||
# TODO those lines can be removed in the future once we are sure no one has used a legacy client where it is off
|
||||
if (self.enableCommunityHistoryArchiveSupport()):
|
||||
self.configuration.TorrentConfig.Enabled = true
|
||||
else:
|
||||
error "Setting Community History Archive On failed"
|
||||
|
||||
proc init*(self: Service) =
|
||||
try:
|
||||
let response = status_node_config.getNodeConfig()
|
||||
@ -72,28 +85,6 @@ proc saveConfiguration(self: Service, configuration: NodeConfigDto): bool =
|
||||
self.configuration = configuration
|
||||
return true
|
||||
|
||||
method enableCommunityHistoryArchiveSupport*(self: Service): bool =
|
||||
try:
|
||||
let response = status_node_config.enableCommunityHistoryArchiveSupport()
|
||||
if(not response.error.isNil):
|
||||
error "error enabling community history archive support: ", errDescription = response.error.message
|
||||
return false
|
||||
|
||||
self.fetchNodeConfig()
|
||||
return true
|
||||
except Exception as e:
|
||||
error "Error enabling community history archive support", msg = e.msg
|
||||
self.events.emit(SIGNAL_ENABLE_COMMUNITY_ARCHIVE_FAILED, ErrorArgs(msg: e.msg))
|
||||
|
||||
method disableCommunityHistoryArchiveSupport*(self: Service): bool =
|
||||
let response = status_node_config.disableCommunityHistoryArchiveSupport()
|
||||
if(not response.error.isNil):
|
||||
error "error disabling community history archive support: ", errDescription = response.error.message
|
||||
return false
|
||||
|
||||
self.fetchNodeConfig()
|
||||
return true
|
||||
|
||||
proc getWakuVersion*(self: Service): int =
|
||||
if self.configuration.WakuConfig.Enabled:
|
||||
return WAKU_VERSION_1
|
||||
@ -144,9 +135,17 @@ proc setWakuVersion*(self: Service, wakuVersion: int): bool =
|
||||
let newConfiguration = setWakuConfig(self.configuration, wakuVersion)
|
||||
return self.saveConfiguration(newConfiguration)
|
||||
|
||||
method isCommunityHistoryArchiveSupportEnabled*(self: Service): bool =
|
||||
proc isCommunityHistoryArchiveSupportEnabled*(self: Service): bool =
|
||||
return self.configuration.TorrentConfig.Enabled
|
||||
|
||||
proc enableCommunityHistoryArchiveSupport*(self: Service): bool =
|
||||
let response = status_node_config.enableCommunityHistoryArchiveSupport()
|
||||
if(not response.error.isNil):
|
||||
error "error enabling community history archive support: ", errDescription = response.error.message
|
||||
return false
|
||||
|
||||
return true
|
||||
|
||||
proc setBloomFilterMode*(self: Service, bloomFilterMode: bool): bool =
|
||||
if(not self.settingsService.saveWakuBloomFilterMode(bloomFilterMode)):
|
||||
error "error saving waku bloom filter mode ", procName="setBloomFilterMode"
|
||||
|
@ -55,14 +55,6 @@ proc getPasswordStrengthScore*(password: string, userInputs: seq[string]): RpcRe
|
||||
error "error", methodName = "getPasswordStrengthScore", exception=e.msg
|
||||
raise newException(RpcException, e.msg)
|
||||
|
||||
proc enableCommunityHistoryArchiveSupport*(): RpcResponse[JsonNode] {.raises: [Exception].} =
|
||||
let payload = %* []
|
||||
result = core.callPrivateRPC("enableCommunityHistoryArchiveProtocol", payload)
|
||||
|
||||
proc disableCommunityHistoryArchiveSupport*(): RpcResponse[JsonNode] {.raises: [Exception].} =
|
||||
let payload = %* []
|
||||
result = core.callPrivateRPC("disableCommunityHistoryArchiveProtocol", payload)
|
||||
|
||||
proc generateImages*(imagePath: string, aX, aY, bX, bY: int): RpcResponse[JsonNode] {.raises: [Exception].} =
|
||||
try:
|
||||
let response = status_go.generateImages(imagePath, aX, aY, bX, bY)
|
||||
|
@ -30,16 +30,7 @@ proc switchFleet*(fleet: string, nodeConfig: JsonNode): RpcResponse[JsonNode] {.
|
||||
|
||||
proc enableCommunityHistoryArchiveSupport*(): RpcResponse[JsonNode] {.raises: [Exception].} =
|
||||
try:
|
||||
let payload = %* []
|
||||
result = core.callPrivateRPC("enableCommunityHistoryArchiveProtocol".prefix)
|
||||
except RpcException as e:
|
||||
error "error doing rpc request", methodName = "enableCommunityHistoryArchiveProtocol", exception=e.msg
|
||||
raise newException(RpcException, e.msg)
|
||||
|
||||
proc disableCommunityHistoryArchiveSupport*(): RpcResponse[JsonNode] {.raises: [Exception].} =
|
||||
try:
|
||||
let payload = %* []
|
||||
result = core.callPrivateRPC("disableCommunityHistoryArchiveProtocol".prefix)
|
||||
except RpcException as e:
|
||||
error "error doing rpc request", methodName = "disableCommunityHistoryArchiveProtocol", exception=e.msg
|
||||
raise newException(RpcException, e.msg)
|
@ -9,8 +9,6 @@ import StatusQ.Controls 0.1
|
||||
ColumnLayout {
|
||||
id: root
|
||||
|
||||
property alias archiveSupportOptionVisible: archiveSupport.visible
|
||||
|
||||
property alias archiveSupportEnabled: archiveSupportToggle.checked
|
||||
property alias requestToJoinEnabled: requestToJoinToggle.checked
|
||||
property alias pinMessagesEnabled: pinMessagesToggle.checked
|
||||
@ -41,6 +39,7 @@ ColumnLayout {
|
||||
|
||||
StatusCheckBox {
|
||||
id: archiveSupportToggle
|
||||
checked: true
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -31,7 +31,6 @@ StackLayout {
|
||||
property bool pinMessagesEnabled
|
||||
property bool encrypted
|
||||
|
||||
property bool archiveSupportOptionVisible: false
|
||||
property bool editable: false
|
||||
property bool owned: false
|
||||
|
||||
@ -183,7 +182,6 @@ StackLayout {
|
||||
logoImageData: root.logoImageData
|
||||
bannerImageData: root.bannerImageData
|
||||
options {
|
||||
archiveSupportOptionVisible: root.archiveSupportOptionVisible
|
||||
archiveSupportEnabled: root.archiveSupportEnabled
|
||||
requestToJoinEnabled: root.requestToJoinEnabled
|
||||
pinMessagesEnabled: root.pinMessagesEnabled
|
||||
|
@ -145,8 +145,6 @@ QtObject {
|
||||
|
||||
property var walletSectionTransactionsInst: walletSectionTransactions
|
||||
|
||||
property bool isCommunityHistoryArchiveSupportEnabled: advancedModule? advancedModule.isCommunityHistoryArchiveSupportEnabled : false
|
||||
|
||||
property string communityTags: communitiesModule.tags
|
||||
|
||||
property var stickersModuleInst: stickersModule
|
||||
|
@ -185,7 +185,6 @@ StatusSectionLayout {
|
||||
onCurrentIndexChanged: {
|
||||
root.backButtonName = (currentIndex === 1) ? qsTr("Overview") : "";
|
||||
}
|
||||
archiveSupportOptionVisible: root.rootStore.isCommunityHistoryArchiveSupportEnabled
|
||||
editable: root.community.amISectionAdmin
|
||||
|
||||
onEdited: {
|
||||
|
@ -450,9 +450,6 @@ StatusStackModal {
|
||||
|
||||
CommunityOptions {
|
||||
id: options
|
||||
|
||||
archiveSupportOptionVisible: root.store.isCommunityHistoryArchiveSupportEnabled
|
||||
archiveSupportEnabled: archiveSupportOptionVisible
|
||||
}
|
||||
|
||||
Item {
|
||||
|
@ -26,7 +26,6 @@ QtObject {
|
||||
property var discordImportTasks: root.communitiesModuleInst.discordImportTasks
|
||||
property string locale: localAppSettings.language
|
||||
property var advancedModule: profileSectionModule.advancedModule
|
||||
property bool isCommunityHistoryArchiveSupportEnabled: advancedModule? advancedModule.isCommunityHistoryArchiveSupportEnabled : false
|
||||
|
||||
// TODO: Could the backend provide directly 2 filtered models??
|
||||
//property var featuredCommunitiesModel: root.communitiesModuleInst.curatedFeaturedCommunities
|
||||
|
@ -13,8 +13,6 @@ QtObject {
|
||||
property bool isTelemetryEnabled: advancedModule? advancedModule.isTelemetryEnabled : false
|
||||
property bool isAutoMessageEnabled: advancedModule? advancedModule.isAutoMessageEnabled : false
|
||||
property bool isDebugEnabled: advancedModule? advancedModule.isDebugEnabled : false
|
||||
property bool isCommunityHistoryArchiveSupportEnabled: advancedModule? advancedModule.isCommunityHistoryArchiveSupportEnabled : false
|
||||
property string enableCommunityHistoryArchiveSupportFailedMsg: advancedModule ? advancedModule.enableCommunityHistoryArchiveSupportFailedMsg : ""
|
||||
|
||||
property var customNetworksModel: advancedModule? advancedModule.customNetworksModel : []
|
||||
|
||||
@ -31,23 +29,11 @@ QtObject {
|
||||
readonly property string nodeManagement: "nodeManagement"
|
||||
readonly property string onlineUsers: "onlineUsers"
|
||||
readonly property string gifWidget: "gifWidget"
|
||||
readonly property string communityHistoryArchiveSupport: "communityHistoryArchiveSupport"
|
||||
readonly property string communitiesPortal: "communitiesPortal"
|
||||
readonly property string communityPermissions: "communityPermissions"
|
||||
readonly property string discordImportTool: "discordImportTool"
|
||||
}
|
||||
|
||||
readonly property Connections connections: Connections {
|
||||
target: advancedModule
|
||||
function onEnableCommunityHistoryArchiveSupportFailed() {
|
||||
root.enableCommunityHistoryArchiveSupportFailed()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
signal enableCommunityHistoryArchiveSupportFailed()
|
||||
|
||||
|
||||
function logDir() {
|
||||
if(!root.advancedModule)
|
||||
return ""
|
||||
@ -127,10 +113,6 @@ QtObject {
|
||||
else if (feature === experimentalFeatures.communitiesPortal) {
|
||||
advancedModule.toggleCommunitiesPortalSection()
|
||||
}
|
||||
else if (feature === experimentalFeatures.communityHistoryArchiveSupport) {
|
||||
// toggle history archive support
|
||||
advancedModule.toggleCommunityHistoryArchiveSupport()
|
||||
}
|
||||
else if (feature === experimentalFeatures.activityCenter) {
|
||||
localAccountSensitiveSettings.isActivityCenterEnabled = !localAccountSensitiveSettings.isActivityCenterEnabled
|
||||
}
|
||||
|
@ -134,22 +134,6 @@ SettingsContentBase {
|
||||
}
|
||||
}
|
||||
|
||||
StatusSettingsLineButton {
|
||||
anchors.leftMargin: 0
|
||||
anchors.rightMargin: 0
|
||||
text: qsTr("Community History Archive Protocol")
|
||||
isSwitch: true
|
||||
switchChecked: root.advancedStore.isCommunityHistoryArchiveSupportEnabled
|
||||
onClicked: {
|
||||
if (!root.advancedStore.isCommunityHistoryArchiveSupportEnabled) {
|
||||
confirmationPopup.experimentalFeature = root.advancedStore.experimentalFeatures.communityHistoryArchiveSupport
|
||||
confirmationPopup.open()
|
||||
} else {
|
||||
root.advancedStore.toggleExperimentalFeature(root.advancedStore.experimentalFeatures.communityHistoryArchiveSupport)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: replace with StatusQ component
|
||||
StatusSettingsLineButton {
|
||||
anchors.leftMargin: 0
|
||||
@ -540,17 +524,6 @@ SettingsContentBase {
|
||||
}
|
||||
}
|
||||
|
||||
Connections {
|
||||
target: advancedStore
|
||||
function onEnableCommunityHistoryArchiveSupportFailed() {
|
||||
if (root.advancedStore.enableCommunityHistoryArchiveSupportFailedMsg !== "") {
|
||||
Global.openPopup(errorMessageDialogCmp, {
|
||||
errorMessage: root.advancedStore.enableCommunityHistoryArchiveSupportFailedMsg
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Component {
|
||||
id: errorMessageDialogCmp
|
||||
StatusDialog {
|
||||
|
Loading…
x
Reference in New Issue
Block a user