mirror of
https://github.com/simplex-chat/simplexmq.git
synced 2026-05-28 05:24:08 +00:00
ntf: refactor NtfSubAction (#445)
This commit is contained in:
@@ -4,22 +4,7 @@
|
||||
{-# LANGUAGE NamedFieldPuns #-}
|
||||
{-# LANGUAGE OverloadedStrings #-}
|
||||
|
||||
module Simplex.Messaging.Notifications.Types
|
||||
( NtfServer,
|
||||
NtfTknAction (..),
|
||||
NtfToken (..),
|
||||
newNtfToken,
|
||||
NtfSubAction (..),
|
||||
NtfSubActionData (..),
|
||||
NtfSubNTFActionData (..),
|
||||
NtfSubNTFAction (..),
|
||||
NtfSubSMPActionData (..),
|
||||
NtfSubSMPAction (..),
|
||||
NtfAgentSubStatus (..),
|
||||
NtfSubscription (..),
|
||||
newNtfSubscription,
|
||||
)
|
||||
where
|
||||
module Simplex.Messaging.Notifications.Types where
|
||||
|
||||
import qualified Data.Attoparsec.ByteString.Char8 as A
|
||||
import Data.Text.Encoding (decodeLatin1, encodeUtf8)
|
||||
@@ -97,17 +82,7 @@ newNtfToken deviceToken ntfServer (ntfPubKey, ntfPrivKey) ntfDhKeys ntfMode =
|
||||
|
||||
data NtfSubAction = NtfSubNTFAction NtfSubNTFAction | NtfSubSMPAction NtfSubSMPAction
|
||||
|
||||
data NtfSubActionData = NtfSubActionData
|
||||
{ action :: NtfSubAction,
|
||||
actionTs :: UTCTime,
|
||||
ntfSubscription :: NtfSubscription
|
||||
}
|
||||
|
||||
data NtfSubNTFActionData = NtfSubNTFActionData
|
||||
{ ntfAction :: NtfSubNTFAction,
|
||||
actionTs :: UTCTime,
|
||||
ntfSubscription :: NtfSubscription
|
||||
}
|
||||
type NtfActionTs = UTCTime
|
||||
|
||||
data NtfSubNTFAction
|
||||
= NSACreate
|
||||
@@ -131,12 +106,6 @@ instance FromField NtfSubNTFAction where fromField = blobFieldDecoder smpDecode
|
||||
|
||||
instance ToField NtfSubNTFAction where toField = toField . smpEncode
|
||||
|
||||
data NtfSubSMPActionData = NtfSubSMPActionData
|
||||
{ smpAction :: NtfSubSMPAction,
|
||||
actionTs :: UTCTime,
|
||||
ntfSubscription :: NtfSubscription
|
||||
}
|
||||
|
||||
data NtfSubSMPAction
|
||||
= NSASmpKey
|
||||
| NSASmpDelete
|
||||
@@ -212,4 +181,4 @@ newNtfSubscription connId smpServer ntfQueueId ntfServer ntfSubStatus =
|
||||
ntfServer,
|
||||
ntfSubId = Nothing,
|
||||
ntfSubStatus
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user