refactor(wallet2): the old way of fetching crypto services asynchronous is removed
This commit is contained in:
parent
141b664a0c
commit
5c0bb9b0b9
|
@ -1,16 +0,0 @@
|
|||
include status/utils/json_utils
|
||||
|
||||
#################################################
|
||||
# Async request for the list of services to buy/sell crypto
|
||||
#################################################
|
||||
|
||||
const asyncGetCryptoServicesTask: Task = proc(argEncoded: string) {.gcsafe, nimcall.} =
|
||||
let arg = decode[QObjectTaskArg](argEncoded)
|
||||
var success: bool
|
||||
let response = status_wallet.fetchCryptoServices(success)
|
||||
|
||||
var list: JsonNode
|
||||
if(success):
|
||||
list = response.parseJson()["result"]
|
||||
|
||||
arg.finish($list)
|
|
@ -1,42 +0,0 @@
|
|||
import NimQml
|
||||
import json, chronicles
|
||||
|
||||
import ../../tasks/[qt, threadpool]
|
||||
import status/[status, wallet2]
|
||||
import status/statusgo_backend/wallet as status_wallet
|
||||
|
||||
include async_tasks
|
||||
|
||||
logScope:
|
||||
topics = "wallet-async-service"
|
||||
|
||||
QtObject:
|
||||
type WalletService* = ref object of QObject
|
||||
status: Status
|
||||
threadpool: ThreadPool
|
||||
|
||||
proc setup(self: WalletService) =
|
||||
self.QObject.setup
|
||||
|
||||
proc delete*(self: WalletService) =
|
||||
self.QObject.delete
|
||||
|
||||
proc newWalletService*(status: Status, threadpool: ThreadPool): WalletService =
|
||||
new(result, delete)
|
||||
result.status = status
|
||||
result.threadpool = threadpool
|
||||
result.setup()
|
||||
|
||||
proc onAsyncFetchCryptoServices*(self: WalletService, response: string) {.slot.} =
|
||||
self.status.wallet2.onAsyncFetchCryptoServices(response)
|
||||
|
||||
proc asyncFetchCryptoServices*(self: WalletService) =
|
||||
## Asynchronous request for the list of services to buy/sell crypto.
|
||||
let arg = QObjectTaskArg(
|
||||
tptr: cast[ByteAddress](asyncGetCryptoServicesTask),
|
||||
vptr: cast[ByteAddress](self.vptr),
|
||||
slot: "onAsyncFetchCryptoServices"
|
||||
)
|
||||
self.threadpool.start(arg)
|
||||
|
||||
|
|
@ -7,12 +7,10 @@ import
|
|||
./signals/signal_controller
|
||||
|
||||
import service/os_notification/service as os_notification_service
|
||||
import async_service/wallet/service as wallet_async_service
|
||||
|
||||
export status_lib_status
|
||||
export marathon, task_runner, signal_controller
|
||||
export os_notification_service
|
||||
export wallet_async_service
|
||||
|
||||
logScope:
|
||||
topics = "app-services"
|
||||
|
@ -26,7 +24,6 @@ type AppService* = ref object
|
|||
# services
|
||||
osNotificationService*: OsNotificationService
|
||||
# async services
|
||||
walletService*: WalletService
|
||||
|
||||
proc newAppService*(status: Status, worker: MarathonWorker): AppService =
|
||||
result = AppService()
|
||||
|
@ -35,14 +32,12 @@ proc newAppService*(status: Status, worker: MarathonWorker): AppService =
|
|||
result.marathon = newMarathon(worker)
|
||||
result.signalController = newSignalsController(status)
|
||||
result.osNotificationService = newOsNotificationService(status)
|
||||
result.walletService = newWalletService(status, result.threadpool)
|
||||
|
||||
proc delete*(self: AppService) =
|
||||
self.threadpool.teardown()
|
||||
self.marathon.teardown()
|
||||
self.signalController.delete()
|
||||
self.osNotificationService.delete()
|
||||
self.walletService.delete()
|
||||
|
||||
proc onLoggedIn*(self: AppService) =
|
||||
self.marathon.onLoggedIn()
|
||||
|
|
Loading…
Reference in New Issue