diff --git a/status/notifications/os_notifications.nim b/status/notifications/os_notifications.nim deleted file mode 100644 index a379134..0000000 --- a/status/notifications/os_notifications.nim +++ /dev/null @@ -1,20 +0,0 @@ -import json - -import ../types/[os_notification] -import ../../eventemitter - -type OsNotifications* = ref object - events: EventEmitter - -proc delete*(self: OsNotifications) = - discard - -proc newOsNotifications*(events: EventEmitter): OsNotifications = - result = OsNotifications() - result.events = events - -proc onNotificationClicked*(self: OsNotifications, identifier: string) = - ## This slot is called once user clicks a notificaiton bubble, "identifier" - ## contains data which uniquely define that notification. - let details = toOsNotificationDetails(parseJson(identifier)) - self.events.emit("osNotificationClicked", OsNotificationsArgs(details: details)) \ No newline at end of file diff --git a/status/status.nim b/status/status.nim index fc254b0..e6a9273 100644 --- a/status/status.nim +++ b/status/status.nim @@ -1,8 +1,7 @@ import statusgo_backend/accounts as statusgo_backend_accounts import statusgo_backend/core as statusgo_backend_core import statusgo_backend/settings as statusgo_backend_settings -import chat, accounts, wallet, wallet2, node, network, messages, contacts, profile, stickers, permissions, fleet, settings, tokens -import notifications/os_notifications +import chat, accounts, wallet, wallet2, node, network, messages, contacts, profile, stickers, permissions, fleet, settings, mailservers, tokens, provider import ../eventemitter import bitops, stew/byteutils, chronicles import ./types/[setting] @@ -29,7 +28,7 @@ type Status* = ref object permissions*: PermissionsModel settings*: SettingsModel tokens*: TokensModel - osnotifications*: OsNotifications + provider*: ProviderModel keycard*: KeycardModel proc newStatusInstance*(fleetConfig: string, backendName: string = "statusgo"): Status = @@ -51,7 +50,7 @@ proc newStatusInstance*(fleetConfig: string, backendName: string = "statusgo"): result.permissions = permissions.newPermissionsModel(result.events) result.settings = settings.newSettingsModel(result.events) result.tokens = tokens.newTokensModel(result.events) - result.osnotifications = newOsNotifications(result.events) + result.provider = provider.newProviderModel(result.events, result.permissions, result.wallet) result.keycard = newKeycardModel(result.backend) proc initNode*(self: Status, statusGoDir, keystoreDir: string) = diff --git a/status/types/os_notification.nim b/status/types/os_notification.nim deleted file mode 100644 index e9eda5e..0000000 --- a/status/types/os_notification.nim +++ /dev/null @@ -1,46 +0,0 @@ -{.used.} - -import json - -import ../../eventemitter - -type - OsNotificationType* {.pure.} = enum - NewContactRequest = 1, - AcceptedContactRequest, - JoinCommunityRequest, - AcceptedIntoCommunity, - RejectedByCommunity, - NewMessage - - OsNotificationDetails* = object - notificationType*: OsNotificationType - communityId*: string - channelId*: string - messageId*: string - -type - OsNotificationsArgs* = ref object of Args - details*: OsNotificationDetails - -proc toOsNotificationDetails*(json: JsonNode): OsNotificationDetails = - if (not (json.contains("notificationType") and - json.contains("communityId") and - json.contains("channelId") and - json.contains("messageId"))): - return OsNotificationDetails() - - return OsNotificationDetails( - notificationType: json{"notificationType"}.getInt.OsNotificationType, - communityId: json{"communityId"}.getStr, - channelId: json{"channelId"}.getStr, - messageId: json{"messageId"}.getStr - ) - -proc toJsonNode*(self: OsNotificationDetails): JsonNode = - result = %* { - "notificationType": self.notificationType.int, - "communityId": self.communityId, - "channelId": self.channelId, - "messageId": self.messageId - } \ No newline at end of file diff --git a/vendor/status-go b/vendor/status-go index 2b8b2be..6e1eece 160000 --- a/vendor/status-go +++ b/vendor/status-go @@ -1 +1 @@ -Subproject commit 2b8b2be1f2cad3c46a46055ee402ea4583c3b764 +Subproject commit 6e1eece54560016515e04ca379c57b713ded8435