This commit is contained in:
Jonathan Rainville 2024-10-04 12:56:32 -04:00
parent ffc5da3805
commit f301e9ee8d
8 changed files with 32 additions and 2 deletions

View File

@ -56,6 +56,7 @@ method sendRPCMessageRaw*(self: Module, inputJSON: string): string =
method setLightClient*(self: Module, enabled: bool) = method setLightClient*(self: Module, enabled: bool) =
if(self.controller.setLightClient(enabled)): if(self.controller.setLightClient(enabled)):
echo "setLightClient"
quit(QuitSuccess) # quits the app TODO: change this to logout instead when supported quit(QuitSuccess) # quits the app TODO: change this to logout instead when supported
method isLightClient*(self: Module): bool = method isLightClient*(self: Module): bool =

View File

@ -72,6 +72,7 @@ proc enableDeveloperFeatures*(self: Controller) =
discard self.settingsService.saveAutoMessageEnabled(true) discard self.settingsService.saveAutoMessageEnabled(true)
discard self.nodeConfigurationService.setLogLevel(LogLevel.DEBUG) discard self.nodeConfigurationService.setLogLevel(LogLevel.DEBUG)
echo "enableDeveloperFeatures"
quit(QuitSuccess) # quits the app TODO: change this to logout instead when supported quit(QuitSuccess) # quits the app TODO: change this to logout instead when supported
proc isTelemetryEnabled*(self: Controller): bool = proc isTelemetryEnabled*(self: Controller): bool =

View File

@ -7,8 +7,12 @@ type
proc asyncLoadCommunitiesDataTask(argEncoded: string) {.gcsafe, nimcall.} = proc asyncLoadCommunitiesDataTask(argEncoded: string) {.gcsafe, nimcall.} =
let arg = decode[AsyncLoadCommunitiesDataTaskArg](argEncoded) let arg = decode[AsyncLoadCommunitiesDataTaskArg](argEncoded)
try: try:
echo "get tags"
let responseTags = status_go.getCommunityTags() let responseTags = status_go.getCommunityTags()
echo "Hot tags ", responseTags
echo "get comms ples"
let responseCommunities = status_go.getAllCommunities() let responseCommunities = status_go.getAllCommunities()
echo "got comms ", responseCommunities
let responseSettings = status_go.getCommunitiesSettings() let responseSettings = status_go.getCommunitiesSettings()
let responseNonApprovedRequestsToJoin = status_go.allNonApprovedCommunitiesRequestsToJoin() let responseNonApprovedRequestsToJoin = status_go.allNonApprovedCommunitiesRequestsToJoin()
let responseCollapsedCommunityCategories = status_go.collapsedCommunityCategories() let responseCollapsedCommunityCategories = status_go.collapsedCommunityCategories()

View File

@ -35,22 +35,36 @@ proc newService*(events: EventEmitter, settingsService: settings_service.Service
result.settingsService = settingsService result.settingsService = settingsService
proc fetchNetworks*(self: Service): seq[CombinedNetworkItem]= proc fetchNetworks*(self: Service): seq[CombinedNetworkItem]=
# try:
echo "Getting chains"
let response = backend.getEthereumChains() let response = backend.getEthereumChains()
echo "got chains ", response
if not response.error.isNil: if not response.error.isNil:
echo 1
raise newException(Exception, "Error getting combinedNetworks: " & response.error.message) raise newException(Exception, "Error getting combinedNetworks: " & response.error.message)
echo 2
let combinedNetworksDto = if response.result.isNil or response.result.kind == JNull: @[] let combinedNetworksDto = if response.result.isNil or response.result.kind == JNull: @[]
else: Json.decode($response.result, seq[CombinedNetworkDto], allowUnknownFields = true) else: Json.decode($response.result, seq[CombinedNetworkDto], allowUnknownFields = true)
echo 3
result = combinedNetworksDto.map(x => x.combinedNetworkDtoToCombinedItem()) result = combinedNetworksDto.map(x => x.combinedNetworkDtoToCombinedItem())
echo 4
self.combinedNetworks = result self.combinedNetworks = result
echo 5
let allTestEnabled = self.combinedNetworks.filter(n => n.test.isEnabled).len == self.combinedNetworks.len let allTestEnabled = self.combinedNetworks.filter(n => n.test.isEnabled).len == self.combinedNetworks.len
let allProdEnabled = self.combinedNetworks.filter(n => n.prod.isEnabled).len == self.combinedNetworks.len let allProdEnabled = self.combinedNetworks.filter(n => n.prod.isEnabled).len == self.combinedNetworks.len
echo 6
for n in self.combinedNetworks: for n in self.combinedNetworks:
n.test.enabledState = networkEnabledToUxEnabledState(n.test.isEnabled, allTestEnabled) n.test.enabledState = networkEnabledToUxEnabledState(n.test.isEnabled, allTestEnabled)
n.prod.enabledState = networkEnabledToUxEnabledState(n.prod.isEnabled, allProdEnabled) n.prod.enabledState = networkEnabledToUxEnabledState(n.prod.isEnabled, allProdEnabled)
echo 7
self.flatNetworks = @[] self.flatNetworks = @[]
echo 8
for network in self.combinedNetworks: for network in self.combinedNetworks:
self.flatNetworks.add(network.test) self.flatNetworks.add(network.test)
self.flatNetworks.add(network.prod) self.flatNetworks.add(network.prod)
echo 9
# except Exception as e:
# error "error fetching networks", msg=e.msg
proc init*(self: Service) = proc init*(self: Service) =
discard self.fetchNetworks() discard self.fetchNetworks()
@ -126,7 +140,7 @@ proc setNetworksState*(self: Service, chainIds: seq[int], enabled: bool) =
discard self.upsertNetwork(network) discard self.upsertNetwork(network)
discard self.fetchNetworks() discard self.fetchNetworks()
## This procedure retuns the network to be used based on the app mode (testnet/mainnet). ## This procedure returns the network to be used based on the app mode (testnet/mainnet).
## We don't need to check if retuned network is nil cause it should never be, but if somehow it is, the app will be closed. ## We don't need to check if retuned network is nil cause it should never be, but if somehow it is, the app will be closed.
## ##
## Should be used for: ## Should be used for:

View File

@ -210,6 +210,7 @@ following the \"Add existing Status user\" flow, using your seed phrase.")
standardButtons: Dialog.Ok standardButtons: Dialog.Ok
onAccepted: { onAccepted: {
if (msgDialog.errType == Constants.startupErrorType.convertToRegularAccError) { if (msgDialog.errType == Constants.startupErrorType.convertToRegularAccError) {
console.log('quit convertToRegularAccError')
Qt.quit(); Qt.quit();
} }
console.log("TODO: restart flow...") console.log("TODO: restart flow...")

View File

@ -80,6 +80,7 @@ Item {
confirmationText: qsTr("Make sure you have your account password and seed phrase stored. Without them you can lock yourself out of your account and lose funds.") confirmationText: qsTr("Make sure you have your account password and seed phrase stored. Without them you can lock yourself out of your account and lose funds.")
confirmButtonLabel: qsTr("Sign out & Quit") confirmButtonLabel: qsTr("Sign out & Quit")
onConfirmButtonClicked: { onConfirmButtonClicked: {
console.log('quit onConfirmButtonClicked')
Qt.quit() Qt.quit()
} }
} }

View File

@ -40,7 +40,10 @@ SystemTrayIcon {
MenuItem { MenuItem {
text: qsTr("Quit") text: qsTr("Quit")
onTriggered: Qt.quit() onTriggered: {
console.log('quit tray')
Qt.quit()
}
} }
} }

View File

@ -145,6 +145,7 @@ StatusWindow {
Action { Action {
shortcut: StandardKey.Quit shortcut: StandardKey.Quit
onTriggered: { onTriggered: {
console.log('quit key')
Qt.quit() Qt.quit()
} }
} }
@ -230,10 +231,12 @@ StatusWindow {
close.accepted = true close.accepted = true
} else { } else {
if (loader.sourceComponent != app) { if (loader.sourceComponent != app) {
console.log('quit sourceComponent')
Qt.quit(); Qt.quit();
} }
else if (loader.sourceComponent == app) { else if (loader.sourceComponent == app) {
if (localAccountSensitiveSettings.quitOnClose) { if (localAccountSensitiveSettings.quitOnClose) {
console.log('quit quitOnClose')
Qt.quit(); Qt.quit();
} else { } else {
applicationWindow.visible = false; applicationWindow.visible = false;
@ -397,11 +400,13 @@ StatusWindow {
onClose: { onClose: {
if (loader.sourceComponent != app) { if (loader.sourceComponent != app) {
console.log('quit MacTrafficLights')
Qt.quit() Qt.quit()
return return
} }
if (localAccountSensitiveSettings.quitOnClose) { if (localAccountSensitiveSettings.quitOnClose) {
console.log('quit MacTrafficLights2')
Qt.quit(); Qt.quit();
return return
} }