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) =
if(self.controller.setLightClient(enabled)):
echo "setLightClient"
quit(QuitSuccess) # quits the app TODO: change this to logout instead when supported
method isLightClient*(self: Module): bool =

View File

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

View File

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

View File

@ -35,22 +35,36 @@ proc newService*(events: EventEmitter, settingsService: settings_service.Service
result.settingsService = settingsService
proc fetchNetworks*(self: Service): seq[CombinedNetworkItem]=
# try:
echo "Getting chains"
let response = backend.getEthereumChains()
echo "got chains ", response
if not response.error.isNil:
echo 1
raise newException(Exception, "Error getting combinedNetworks: " & response.error.message)
echo 2
let combinedNetworksDto = if response.result.isNil or response.result.kind == JNull: @[]
else: Json.decode($response.result, seq[CombinedNetworkDto], allowUnknownFields = true)
echo 3
result = combinedNetworksDto.map(x => x.combinedNetworkDtoToCombinedItem())
echo 4
self.combinedNetworks = result
echo 5
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
echo 6
for n in self.combinedNetworks:
n.test.enabledState = networkEnabledToUxEnabledState(n.test.isEnabled, allTestEnabled)
n.prod.enabledState = networkEnabledToUxEnabledState(n.prod.isEnabled, allProdEnabled)
echo 7
self.flatNetworks = @[]
echo 8
for network in self.combinedNetworks:
self.flatNetworks.add(network.test)
self.flatNetworks.add(network.prod)
echo 9
# except Exception as e:
# error "error fetching networks", msg=e.msg
proc init*(self: Service) =
discard self.fetchNetworks()
@ -126,7 +140,7 @@ proc setNetworksState*(self: Service, chainIds: seq[int], enabled: bool) =
discard self.upsertNetwork(network)
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.
##
## Should be used for:

View File

@ -210,6 +210,7 @@ following the \"Add existing Status user\" flow, using your seed phrase.")
standardButtons: Dialog.Ok
onAccepted: {
if (msgDialog.errType == Constants.startupErrorType.convertToRegularAccError) {
console.log('quit convertToRegularAccError')
Qt.quit();
}
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.")
confirmButtonLabel: qsTr("Sign out & Quit")
onConfirmButtonClicked: {
console.log('quit onConfirmButtonClicked')
Qt.quit()
}
}

View File

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

View File

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