I've got a custom history method to pull messages stored in a database from a php api, this all works fine as below:
getMessageHistory(userId: any): Observable<Message[]> {
return this.api.post('user/messages/history/'+userId,{hideLoader:true}).pipe(
map((response:ApiResponseInterface)=>{
let messages = <PrivateMessageInterface[]>response.data.messages;
console.log("MESSAGE HISTORY",messages);
return messages.map((message: PrivateMessageInterface)=>{
let m = new Message();
m.dateSent = new Date(message.sentOn);
m.message = message.message;
m.toId = message.sentTo.apiKey;
m.fromId = message.sentFrom.apiKey;
m.type = 1;
m.dateSeen = null;
return m;
})
})
);
}
As you can see, i set the dateSeen to null so i can get the number appearing and your document states an event is fired when a message is seen "onMessagesSeen" - but you don't explain how to implement this event? Just adding onMessagesSeen() to my adapter doesn't do anything when a chat is opened with unseen messages.
Hi
I've got a custom history method to pull messages stored in a database from a php api, this all works fine as below:
As you can see, i set the dateSeen to null so i can get the number appearing and your document states an event is fired when a message is seen "onMessagesSeen" - but you don't explain how to implement this event? Just adding onMessagesSeen() to my adapter doesn't do anything when a chat is opened with unseen messages.