2021-12-14 18:47:32 +00:00
|
|
|
import QtQuick 2.13
|
|
|
|
import utils 1.0
|
|
|
|
|
|
|
|
QtObject {
|
|
|
|
id: root
|
|
|
|
|
|
|
|
property var advancedModule
|
|
|
|
|
|
|
|
// Advanced Module Properties
|
2022-01-11 23:16:17 +00:00
|
|
|
property string currentNetworkName: advancedModule? advancedModule.currentNetworkName : ""
|
|
|
|
property string currentNetworkId: advancedModule? advancedModule.currentNetworkId : ""
|
|
|
|
property string fleet: advancedModule? advancedModule.fleet : ""
|
|
|
|
property string bloomLevel: advancedModule? advancedModule.bloomLevel : ""
|
|
|
|
property bool wakuV2LightClientEnabled: advancedModule? advancedModule.wakuV2LightClientEnabled : false
|
|
|
|
property bool isTelemetryEnabled: advancedModule? advancedModule.isTelemetryEnabled : false
|
|
|
|
property bool isAutoMessageEnabled: advancedModule? advancedModule.isAutoMessageEnabled : false
|
|
|
|
property bool isDebugEnabled: advancedModule? advancedModule.isDebugEnabled : false
|
2021-12-14 18:47:32 +00:00
|
|
|
|
2022-01-11 23:16:17 +00:00
|
|
|
property var customNetworksModel: advancedModule? advancedModule.customNetworksModel : []
|
2021-12-16 10:33:27 +00:00
|
|
|
|
2021-12-14 18:47:32 +00:00
|
|
|
property bool isWakuV2: root.fleet === Constants.waku_prod ||
|
2022-02-18 21:23:35 +00:00
|
|
|
root.fleet === Constants.waku_test ||
|
|
|
|
root.fleet === Constants.status_test
|
2021-12-14 18:47:32 +00:00
|
|
|
|
2021-12-24 08:24:26 +00:00
|
|
|
readonly property QtObject experimentalFeatures: QtObject {
|
|
|
|
readonly property string wallet: "wallet"
|
|
|
|
readonly property string browser: "browser"
|
|
|
|
readonly property string communities: "communities"
|
|
|
|
readonly property string activityCenter: "activityCenter"
|
|
|
|
readonly property string nodeManagement: "nodeManagement"
|
|
|
|
readonly property string onlineUsers: "onlineUsers"
|
|
|
|
readonly property string gifWidget: "gifWidget"
|
|
|
|
readonly property string keycard: "keycard"
|
2022-02-08 09:34:45 +00:00
|
|
|
readonly property string multiNetwork: "multiNetwork"
|
2021-12-24 08:24:26 +00:00
|
|
|
}
|
|
|
|
|
2022-01-13 19:25:38 +00:00
|
|
|
function setGlobalNetworkId() {
|
|
|
|
Global.currentNetworkId = currentNetworkId
|
|
|
|
}
|
|
|
|
Component.onCompleted: {
|
|
|
|
setGlobalNetworkId()
|
|
|
|
}
|
|
|
|
onCurrentNetworkIdChanged: {
|
|
|
|
setGlobalNetworkId()
|
|
|
|
}
|
|
|
|
|
2021-12-14 18:47:32 +00:00
|
|
|
function logDir() {
|
2022-01-11 23:16:17 +00:00
|
|
|
if(!root.advancedModule)
|
|
|
|
return ""
|
|
|
|
|
2021-12-14 18:47:32 +00:00
|
|
|
return root.advancedModule.logDir()
|
|
|
|
}
|
|
|
|
|
|
|
|
function setNetworkName(networkName) {
|
2022-01-11 23:16:17 +00:00
|
|
|
if(!root.advancedModule)
|
|
|
|
return
|
|
|
|
|
2021-12-14 18:47:32 +00:00
|
|
|
root.advancedModule.setNetworkName(networkName)
|
|
|
|
}
|
|
|
|
|
|
|
|
function setFleet(fleetName) {
|
2022-01-11 23:16:17 +00:00
|
|
|
if(!root.advancedModule)
|
|
|
|
return
|
|
|
|
|
2021-12-14 18:47:32 +00:00
|
|
|
root.advancedModule.setFleet(fleetName)
|
|
|
|
}
|
|
|
|
|
|
|
|
function setBloomLevel(mode) {
|
2022-01-11 23:16:17 +00:00
|
|
|
if(!root.advancedModule)
|
|
|
|
return
|
|
|
|
|
2021-12-14 18:47:32 +00:00
|
|
|
root.advancedModule.setBloomLevel(mode)
|
|
|
|
}
|
|
|
|
|
|
|
|
function setWakuV2LightClientEnabled(mode) {
|
2022-01-11 23:16:17 +00:00
|
|
|
if(!root.advancedModule)
|
|
|
|
return
|
|
|
|
|
2021-12-14 18:47:32 +00:00
|
|
|
root.advancedModule.setWakuV2LightClientEnabled(mode)
|
|
|
|
}
|
|
|
|
|
|
|
|
function toggleTelemetry() {
|
2022-01-11 23:16:17 +00:00
|
|
|
if(!root.advancedModule)
|
|
|
|
return
|
|
|
|
|
2021-12-14 18:47:32 +00:00
|
|
|
root.advancedModule.toggleTelemetry()
|
|
|
|
}
|
|
|
|
|
|
|
|
function toggleAutoMessage() {
|
2022-01-11 23:16:17 +00:00
|
|
|
if(!root.advancedModule)
|
|
|
|
return
|
|
|
|
|
2021-12-14 18:47:32 +00:00
|
|
|
root.advancedModule.toggleAutoMessage()
|
|
|
|
}
|
|
|
|
|
|
|
|
function toggleDebug() {
|
2022-01-11 23:16:17 +00:00
|
|
|
if(!root.advancedModule)
|
|
|
|
return
|
|
|
|
|
2021-12-14 18:47:32 +00:00
|
|
|
root.advancedModule.toggleDebug()
|
|
|
|
}
|
2021-12-16 10:33:27 +00:00
|
|
|
|
2022-02-02 22:06:23 +00:00
|
|
|
function enableDeveloperFeatures() {
|
|
|
|
if(!root.advancedModule)
|
|
|
|
return
|
|
|
|
|
|
|
|
root.advancedModule.enableDeveloperFeatures()
|
|
|
|
}
|
|
|
|
|
2021-12-16 10:33:27 +00:00
|
|
|
function addCustomNetwork(name, endpoint, networkId, networkType) {
|
2022-01-11 23:16:17 +00:00
|
|
|
if(!root.advancedModule)
|
|
|
|
return
|
|
|
|
|
2021-12-16 10:33:27 +00:00
|
|
|
root.advancedModule.addCustomNetwork(name, endpoint, networkId, networkType)
|
|
|
|
}
|
2021-12-24 08:24:26 +00:00
|
|
|
|
|
|
|
function toggleExperimentalFeature(feature) {
|
2022-01-11 23:16:17 +00:00
|
|
|
if(!root.advancedModule)
|
|
|
|
return
|
|
|
|
|
2021-12-24 08:24:26 +00:00
|
|
|
if (feature === experimentalFeatures.wallet) {
|
|
|
|
advancedModule.toggleWalletSection()
|
|
|
|
}
|
|
|
|
else if (feature === experimentalFeatures.browser) {
|
|
|
|
advancedModule.toggleBrowserSection()
|
|
|
|
}
|
|
|
|
else if (feature === experimentalFeatures.communities) {
|
|
|
|
advancedModule.toggleCommunitySection()
|
|
|
|
}
|
|
|
|
else if (feature === experimentalFeatures.activityCenter) {
|
|
|
|
localAccountSensitiveSettings.isActivityCenterEnabled = !localAccountSensitiveSettings.isActivityCenterEnabled
|
|
|
|
}
|
|
|
|
else if (feature === experimentalFeatures.nodeManagement) {
|
|
|
|
advancedModule.toggleNodeManagementSection()
|
|
|
|
}
|
|
|
|
else if (feature === experimentalFeatures.onlineUsers) {
|
|
|
|
localAccountSensitiveSettings.showOnlineUsers = !localAccountSensitiveSettings.showOnlineUsers
|
|
|
|
}
|
|
|
|
else if (feature === experimentalFeatures.gifWidget) {
|
|
|
|
localAccountSensitiveSettings.isGifWidgetEnabled = !localAccountSensitiveSettings.isGifWidgetEnabled
|
|
|
|
}
|
|
|
|
else if (feature === experimentalFeatures.keycard) {
|
|
|
|
localAccountSettings.isKeycardEnabled = !localAccountSettings.isKeycardEnabled
|
|
|
|
}
|
2022-02-08 09:34:45 +00:00
|
|
|
else if (feature === experimentalFeatures.multiNetwork) {
|
|
|
|
localAccountSensitiveSettings.isMultiNetworkEnabled = !localAccountSensitiveSettings.isMultiNetworkEnabled
|
|
|
|
}
|
2021-12-24 08:24:26 +00:00
|
|
|
}
|
2021-12-14 18:47:32 +00:00
|
|
|
}
|