parent
5967ce6ce8
commit
92d047173f
|
@ -1,8 +1,8 @@
|
|||
import json
|
||||
include ../../../common/json_utils
|
||||
|
||||
type StatusType* {.pure.}= enum
|
||||
Offline = 0,
|
||||
type StatusType* {.pure.} = enum
|
||||
Offline = 0
|
||||
Online
|
||||
DoNotDisturb
|
||||
Idle
|
||||
|
|
|
@ -3,8 +3,10 @@ import chronicles, json, strutils, sequtils, tables, sugar
|
|||
import ../../common/[network_constants]
|
||||
import ../../../app/core/fleets/fleet_configuration
|
||||
import ../../../backend/settings as status_settings
|
||||
import ../../../backend/status_update as status_update
|
||||
|
||||
import ./dto/settings as settings_dto
|
||||
import ../contacts/dto/status_update as status_update_dto
|
||||
import ../stickers/dto/stickers as stickers_dto
|
||||
import ../../../app/core/fleets/fleet_configuration
|
||||
|
||||
|
@ -294,10 +296,18 @@ proc getWalletRootAddress*(self: Service): string =
|
|||
return self.settings.walletRootAddress
|
||||
|
||||
proc saveSendStatusUpdates*(self: Service, value: bool): bool =
|
||||
var newStatus = StatusType.Online
|
||||
if not value:
|
||||
newStatus = StatusType.Offline
|
||||
|
||||
try:
|
||||
let r = status_update.setUserStatus(int(newStatus))
|
||||
if(self.saveSetting(KEY_SEND_STATUS_UPDATES, value)):
|
||||
self.settings.sendStatusUpdates = value
|
||||
return true
|
||||
return false
|
||||
except:
|
||||
return false
|
||||
|
||||
proc getSendStatusUpdates*(self: Service): bool =
|
||||
self.settings.sendStatusUpdates
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
import json
|
||||
import ./core, ./response_type
|
||||
|
||||
export response_type
|
||||
|
||||
proc setUserStatus*(newStatus: int): RpcResponse[JsonNode] {.raises: [Exception].} =
|
||||
let payload = %* [newStatus, ""]
|
||||
result = core.callPrivateRPC("wakuext_setUserStatus", payload)
|
Loading…
Reference in New Issue