move status specific logic of the application view
This commit is contained in:
parent
70c15d9266
commit
03b6209f6b
|
@ -1,18 +1,8 @@
|
||||||
import NimQml
|
import NimQml
|
||||||
import status
|
# import status
|
||||||
import libstatus
|
# import libstatus
|
||||||
import json
|
import json
|
||||||
|
|
||||||
var signalHandler: SignalCallback = proc(p0: cstring): void =
|
|
||||||
setupForeignThreadGc()
|
|
||||||
|
|
||||||
var jsonSignal = ($p0).parseJson
|
|
||||||
if $jsonSignal["type"].getStr == "messages.new":
|
|
||||||
echo $p0
|
|
||||||
|
|
||||||
tearDownForeignThreadGc()
|
|
||||||
|
|
||||||
|
|
||||||
# Probably all QT classes will look like this:
|
# Probably all QT classes will look like this:
|
||||||
QtObject:
|
QtObject:
|
||||||
type ApplicationLogic* = ref object of QObject
|
type ApplicationLogic* = ref object of QObject
|
||||||
|
@ -28,15 +18,6 @@ QtObject:
|
||||||
result.callResult = "Use this tool to call JSONRPC methods"
|
result.callResult = "Use this tool to call JSONRPC methods"
|
||||||
result.setup()
|
result.setup()
|
||||||
|
|
||||||
status.setSignalHandler(signalHandler)
|
|
||||||
|
|
||||||
status.setupNewAccount()
|
|
||||||
discard status.addPeer("enode://2c8de3cbb27a3d30cbb5b3e003bc722b126f5aef82e2052aaef032ca94e0c7ad219e533ba88c70585ebd802de206693255335b100307645ab5170e88620d2a81@47.244.221.14:443")
|
|
||||||
echo status.callPrivateRPC("{\"jsonrpc\":\"2.0\", \"method\":\"wakuext_requestMessages\", \"params\":[{\"topics\": [\"0x7998f3c8\"]}], \"id\": 1}")
|
|
||||||
|
|
||||||
result.accountResult = status.queryAccounts()
|
|
||||||
status.subscribeToTest()
|
|
||||||
|
|
||||||
# ¯\_(ツ)_/¯ dunno what is this
|
# ¯\_(ツ)_/¯ dunno what is this
|
||||||
proc setup(self: ApplicationLogic) =
|
proc setup(self: ApplicationLogic) =
|
||||||
# discard status.onMessage(self.onMessage)
|
# discard status.onMessage(self.onMessage)
|
||||||
|
@ -73,7 +54,7 @@ QtObject:
|
||||||
notify = callResultChanged
|
notify = callResultChanged
|
||||||
|
|
||||||
proc onSend*(self: ApplicationLogic, inputJSON: string) {.slot.} =
|
proc onSend*(self: ApplicationLogic, inputJSON: string) {.slot.} =
|
||||||
self.setCallResult(status.callPrivateRPC(inputJSON))
|
# self.setCallResult(status.callPrivateRPC(inputJSON))
|
||||||
echo "Done!: ", self.callResult
|
echo "Done!: ", self.callResult
|
||||||
|
|
||||||
# proc onMessage*(self: ApplicationLogic, message: string) {.slot.} =
|
# proc onMessage*(self: ApplicationLogic, message: string) {.slot.} =
|
||||||
|
|
|
@ -2,6 +2,18 @@ import NimQml
|
||||||
import applicationLogic
|
import applicationLogic
|
||||||
import chats
|
import chats
|
||||||
import state
|
import state
|
||||||
|
import status
|
||||||
|
import libstatus
|
||||||
|
import json
|
||||||
|
|
||||||
|
var signalHandler: SignalCallback = proc(p0: cstring): void =
|
||||||
|
setupForeignThreadGc()
|
||||||
|
|
||||||
|
var jsonSignal = ($p0).parseJson
|
||||||
|
if $jsonSignal["type"].getStr == "messages.new":
|
||||||
|
echo $p0
|
||||||
|
|
||||||
|
tearDownForeignThreadGc()
|
||||||
|
|
||||||
proc mainProc() =
|
proc mainProc() =
|
||||||
|
|
||||||
|
@ -20,6 +32,17 @@ proc mainProc() =
|
||||||
defer: engine.delete()
|
defer: engine.delete()
|
||||||
|
|
||||||
|
|
||||||
|
status.setSignalHandler(signalHandler)
|
||||||
|
|
||||||
|
status.setupNewAccount()
|
||||||
|
discard status.addPeer("enode://2c8de3cbb27a3d30cbb5b3e003bc722b126f5aef82e2052aaef032ca94e0c7ad219e533ba88c70585ebd802de206693255335b100307645ab5170e88620d2a81@47.244.221.14:443")
|
||||||
|
echo status.callPrivateRPC("{\"jsonrpc\":\"2.0\", \"method\":\"wakuext_requestMessages\", \"params\":[{\"topics\": [\"0x7998f3c8\"]}], \"id\": 1}")
|
||||||
|
|
||||||
|
# result.accountResult = status.queryAccounts()
|
||||||
|
status.subscribeToTest()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
let logic = newApplicationLogic(app)
|
let logic = newApplicationLogic(app)
|
||||||
defer: logic.delete
|
defer: logic.delete
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue