feat: wakuV2 light client mode
This commit is contained in:
parent
b783e9a884
commit
a5d48a20b3
|
@ -38,6 +38,7 @@ QtObject:
|
||||||
stats*: Stats
|
stats*: Stats
|
||||||
peerSize: int
|
peerSize: int
|
||||||
bloomBitsSet: int
|
bloomBitsSet: int
|
||||||
|
wakuV2LightClient: bool
|
||||||
|
|
||||||
proc setup(self: NodeView) =
|
proc setup(self: NodeView) =
|
||||||
self.QObject.setup
|
self.QObject.setup
|
||||||
|
@ -50,6 +51,7 @@ QtObject:
|
||||||
result.lastMessage = ""
|
result.lastMessage = ""
|
||||||
result.wakuBloomFilterMode = false
|
result.wakuBloomFilterMode = false
|
||||||
result.fullNode = false
|
result.fullNode = false
|
||||||
|
result.wakuV2LightClient = false
|
||||||
result.setup
|
result.setup
|
||||||
|
|
||||||
proc delete*(self: NodeView) =
|
proc delete*(self: NodeView) =
|
||||||
|
@ -124,6 +126,7 @@ QtObject:
|
||||||
let nodeConfig = self.status.settings.getNodeConfig()
|
let nodeConfig = self.status.settings.getNodeConfig()
|
||||||
self.wakuBloomFilterMode = self.status.settings.getSetting[:bool](Setting.WakuBloomFilterMode)
|
self.wakuBloomFilterMode = self.status.settings.getSetting[:bool](Setting.WakuBloomFilterMode)
|
||||||
self.fullNode = nodeConfig["WakuConfig"]["FullNode"].getBool()
|
self.fullNode = nodeConfig["WakuConfig"]["FullNode"].getBool()
|
||||||
|
self.wakuV2LightClient = nodeConfig["WakuV2Config"]{"LightClient"}.getBool()
|
||||||
self.initialized()
|
self.initialized()
|
||||||
|
|
||||||
proc wakuVersion*(self: NodeView): int {.slot.} =
|
proc wakuVersion*(self: NodeView): int {.slot.} =
|
||||||
|
@ -202,3 +205,16 @@ QtObject:
|
||||||
notify = peerSizeChanged
|
notify = peerSizeChanged
|
||||||
|
|
||||||
proc log*(self: NodeView, logContent: string) {.signal.}
|
proc log*(self: NodeView, logContent: string) {.signal.}
|
||||||
|
|
||||||
|
proc getWakuV2LightClient(self: NodeView): bool {.slot.} = self.wakuV2LightClient
|
||||||
|
|
||||||
|
QtProperty[bool] WakuV2LightClient:
|
||||||
|
read = getWakuV2LightClient
|
||||||
|
notify = initialized
|
||||||
|
|
||||||
|
proc setWakuV2LightClient*(self: NodeView, enabled: bool) {.slot.} =
|
||||||
|
let statusGoResult = self.status.settings.setV2LightMode(enabled)
|
||||||
|
if statusGoResult.error != "":
|
||||||
|
error "Error saving updated node config", msg=statusGoResult.error
|
||||||
|
else:
|
||||||
|
quit(QuitSuccess) # quits the app TODO: change this to logout instead when supported
|
||||||
|
|
|
@ -12,6 +12,7 @@ ScrollView {
|
||||||
width: parent.width
|
width: parent.width
|
||||||
contentHeight: advancedContainer.height + 100
|
contentHeight: advancedContainer.height + 100
|
||||||
clip: true
|
clip: true
|
||||||
|
property bool isWakuV2: profileModel.fleets.fleet == Constants.waku_prod || profileModel.fleets.fleet === Constants.waku_test
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
id: advancedContainer
|
id: advancedContainer
|
||||||
|
@ -201,6 +202,7 @@ ScrollView {
|
||||||
}
|
}
|
||||||
|
|
||||||
StatusSectionHeadline {
|
StatusSectionHeadline {
|
||||||
|
visible: !isWakuV2
|
||||||
//% "Bloom filter level"
|
//% "Bloom filter level"
|
||||||
text: qsTrId("bloom-filter-level")
|
text: qsTrId("bloom-filter-level")
|
||||||
topPadding: Style.current.bigPadding
|
topPadding: Style.current.bigPadding
|
||||||
|
@ -208,6 +210,7 @@ ScrollView {
|
||||||
}
|
}
|
||||||
|
|
||||||
Row {
|
Row {
|
||||||
|
visible: !isWakuV2
|
||||||
spacing: 11
|
spacing: 11
|
||||||
|
|
||||||
Component {
|
Component {
|
||||||
|
@ -284,6 +287,78 @@ ScrollView {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
StatusSectionHeadline {
|
||||||
|
visible: isWakuV2
|
||||||
|
text: qsTr("WakuV2 mode")
|
||||||
|
topPadding: Style.current.bigPadding
|
||||||
|
bottomPadding: Style.current.padding
|
||||||
|
}
|
||||||
|
|
||||||
|
Row {
|
||||||
|
spacing: 11
|
||||||
|
visible: isWakuV2
|
||||||
|
Component {
|
||||||
|
id: wakuV2ModeConfirmationDialogComponent
|
||||||
|
ConfirmationDialog {
|
||||||
|
property bool mode: false
|
||||||
|
|
||||||
|
id: confirmDialog
|
||||||
|
//% "Warning!"
|
||||||
|
title: qsTrId("close-app-title")
|
||||||
|
//% "The account will be logged out. When you login again, the selected mode will be enabled"
|
||||||
|
confirmationText: qsTrId("the-account-will-be-logged-out--when-you-login-again--the-selected-mode-will-be-enabled")
|
||||||
|
onConfirmButtonClicked: {
|
||||||
|
nodeModel.setWakuV2LightClient(mode)
|
||||||
|
}
|
||||||
|
onClosed: {
|
||||||
|
if(nodeModel.WakuV2LightClient){
|
||||||
|
btnWakuV2Light.click()
|
||||||
|
} else {
|
||||||
|
btnWakuV2Full.click();
|
||||||
|
}
|
||||||
|
destroy()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ButtonGroup {
|
||||||
|
id: wakuV2Group
|
||||||
|
}
|
||||||
|
|
||||||
|
BloomSelectorButton {
|
||||||
|
id: btnWakuV2Light
|
||||||
|
buttonGroup: wakuV2Group
|
||||||
|
checkedByDefault: nodeModel.WakuV2LightClient
|
||||||
|
//% "Light Node"
|
||||||
|
btnText: qsTrId("light-node")
|
||||||
|
onToggled: {
|
||||||
|
if (!nodeModel.WakuV2LightClient) {
|
||||||
|
openPopup(wakuV2ModeConfirmationDialogComponent, {light: true})
|
||||||
|
} else {
|
||||||
|
btnWakuV2Light.click()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
BloomSelectorButton {
|
||||||
|
id: btnWakuV2Full
|
||||||
|
buttonGroup: wakuV2Group
|
||||||
|
checkedByDefault: !nodeModel.WakuV2LightClient
|
||||||
|
//% "Full Node"
|
||||||
|
btnText: qsTrId("full-node")
|
||||||
|
onToggled: {
|
||||||
|
if (nodeModel.WakuV2LightClient) {
|
||||||
|
openPopup(wakuV2ModeConfirmationDialogComponent, {light: false})
|
||||||
|
} else {
|
||||||
|
btnWakuV2Full.click()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
StatusSettingsLineButton {
|
StatusSettingsLineButton {
|
||||||
text: qsTr("Download messages")
|
text: qsTr("Download messages")
|
||||||
isSwitch: true
|
isSwitch: true
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
Subproject commit a80869872d822bdc239cc67f98c6fb3a7f54febe
|
Subproject commit 8fe7a571bf3600e280a60dc776843236baeea9ff
|
Loading…
Reference in New Issue