MessageStore
Represents the message storage.
Represents the message storage. This interface provides all the methods to save, load, and delete messages and threads from local storage.
Functions
Name | Return Type | Description |
---|---|---|
deleteAll | Boolean | Deletes complete threads & messages |
deleteMessage | Boolean | Deletes single InAppMessage from local storage based on transactionId |
deleteThread | Boolean | Deletes single InAppThread from local storage based on threadId |
getMessageCount | Int | Gives the count of messages from local storage based on threadId |
getThreadCount | Int | Gives the total number of threads count from local storage |
getUnreadMessageCount | String | Gives the count of messages from local storage based on threadId |
getUnreadThreadCount | Int | Gives the count of unread messages threads count |
loadMessage | String | Loads single InAppMessage from local storage based on transactionId |
loadMessages | String | Loads InAppMessage from local storage based on threadId and submitted date with a specific limit |
loadThread | String | Loads single InAppThread from local storage based on threadId |
loadThreads | Int | Loads InAppThreads from local storage based date modifiedBefore with a specific limit |
loadUnreadThreads | Int | Loads unread InAppThreads from local storage with a specific limit |
saveMessage | Boolean | Saves multiple InAppMessages |
saveThread | Boolean | Saves multiple InAppThreads |
deleteAll
This method deletes complete InAppThreads & InAppMessages.
Syntax: fun MessageStore.deleteAll(callback: (Boolean) -> Unit)
Return Value: Returns true
if deletion completes, false
otherwise.
deleteMessage
This method deletes a single InAppMessage from local storage based on transactionId.
Syntax: fun MessageStore.deleteMessage(transactionId: String, callback: (Boolean) -> Unit)
Return Value: Returns true
if delete message completes, false
otherwise.
Parameters
Parameters | Type | Description |
---|---|---|
transactionId | String | The transactionId is to be deleted from local storage. |
deleteThread
This method allows us to delete a single InAppThread from local storage based on threadId
Syntax: fun MessageStore.deleteThread(threadId: String, callback: (Boolean) -> Unit)
Return Value: Returns true
if delete thread completes, false
otherwise.
Parameters:
Parameters | Type | Description |
---|---|---|
threadId | String | The threadId to be deleted from local storage |
getMessageCount
This method provides a count of messages from local storage based on threadId.
Syntax: fun MessageStore.getMessageCount(threadId: String, callback: (Int) -> Unit)
Return Value: Returns count of messages.
Parameters
Parameters | Type | Description |
---|---|---|
threadId | String | The threadId to be fetched count from local storage |
getThreadCount
This method provides the total number of threads count from local storage.
Syntax: fun MessageStore.getThreadCount(callback: (Int) -> Unit)
Return Value: Returns count of threads.
getUnreadMessageCount
This method provides a count of unread messages from local storage based on threadId.
Syntax: fun MessageStore.getUnreadMessageCount(threadId: String, callback: (Int) -> Unit)
Return Value: Returns count of unread messages.
Parameters
Parameters | Type | Description |
---|---|---|
threadId | String | the threadId to be fetched count from local storage |
getUnreadThreadCount
This method gives the total number of threads containing unread messages.
Syntax: fun MessageStore.getUnreadThreadCount(callback: (Int) -> Unit)
Return Value: The number of threads containing unread messages.
loadMessage
This method loads single InAppMessage from local storage based on transactionId.
Syntax: fun MessageStore.loadMessage(transactionId: String, callback: (InAppMessage?) -> Unit)
Return Value: Returns InAppMessage instance if a message exists with transactionId.
Parameters
Parameters | Type | Description |
---|---|---|
transactionId | String | the transactionId to be retrieved from local storage |
loadMessages
This method loads messages from local storage for a specific thread, based on optional date parameters submittedBefore and submittedAfter, with the specified limit.
Syntax: fun MessageStore.loadMessages(threadId: String, limit: Int, submittedBefore: Date? = null, submittedAfter: Date? = null, callback: (List<InAppMessage>) -> Unit)
Return Value: Array of InAppMessage instance if messages exist with threadId.
Parameters
Parameters | Type | Description |
---|---|---|
threadId | String | The threadId to be retrieved from local storage |
limit | Int | the limit to be used to fetch limited number of messages from local storage |
submittedBefore | Date | the submittedBefore to be used to fetch messages before the submitted time from local storage |
submittedAfter | Date | the submittedAfter to be used to fetch messages after the submitted time from local storage |
loadThread
This method loads a specific InAppThread from local storage based on the provided threadId.
Syntax: fun MessageStore.loadThread(threadId: String, callback: (InAppThread?) -> Unit)
Return Value: Returns InAppThread instance if thread exists with threadId.
Parameters:
Parameters | Type | Description |
---|---|---|
threadId | String | The threadId to be retrieved from local storage |
callback | InAppThread |
loadThreads
This method Loads InAppThreads from local storage based date modifiedBefore with the specific limit.
Syntax: fun MessageStore.loadThreads(limit: Int, modifiedBefore: Date? = null, modifiedAfter: Date? = null, callback: (List<InAppThread>) -> Unit)
Return: Returns array of InAppThread instances, if threads exists between before & after modified date with limit.
Parameters
Parameters | Type | Description |
---|---|---|
limit | Int | The limit to be used to fetch limited number of threads from local storage |
modifiedBefore | Date | The modifiedBefore to be used to fetch threads modified before from local storage |
modifiedAfter | Date | The modifiedAfter to be used to fetch threads modified after from local storage |
loadUnreadThreads
This method loads unread InAppThreads containing at least one unread message from local storage with specific limit.
Syntax: fun MessageStore.loadUnreadThreads(limit: Int, callback: (List<InAppThread>) -> Unit)
Return Value: An array of InAppThread instances with some unread messages.
Parameters:
Parameters | Type | Description |
---|---|---|
limit | Int | the limit to be used to fetch limited number of threads from local storage |
saveMessage
This method saves multiple InAppMessages.
Syntax: fun MessageStore.saveMessage(vararg messages: InAppMessage, callback: (Boolean) -> Unit)
Return: Returns true
if message storage completes, false
otherwise.
Parameters:
Parameters | Type | Description |
---|---|---|
messages | InAppMessage | the array of InAppMessages to be saved |
saveThread
This method saves multiple InAppThreads.
Syntax: fun MessageStore.saveThread(vararg threads: InAppThread, callback: (Boolean) -> Unit)
Return value: Return true
if thread storage completes, false
otherwise.
Parameters:
Parameters | Type | Description |
---|---|---|
threads | InAppThread | the array of InAppThreads to be saved |
Updated about 1 month ago