Once authenticed, users can send or received messages such as: text, photo, video, audio, location, contact...
You can create a message by constructors. Example:
// Text message
StringeeMessage *textMsg = [[StringeeTextMessage alloc] initWithText:@"Hello" metadata:nil];
// Location message
StringeeMessage *locationMsg = [[StringeeLocationMessage alloc] initWithlatitude:latitude longitude:longitude metadata:nil];
// Photo message from PickerController
UIImage *image = (UIImage *)info[UIImagePickerControllerOriginalImage];
StringeeMessage *photoMsg = [[StringeePhotoMessage alloc] initWithImage: metadata:nil];
Send a Message by calling:
NSError *error;
[conversation sendMessage:msg error:&error];
Messages are stored on Stringee server and cached on Local Database as well. You can get messages as follows:
To get local messages of a conversation which are saved in the local database, you call:
[conversation getLocalMessagesWithCount:25 completionHandler:^(BOOL status, int code, NSString *message, id data) {
}];
In which:
To get latest messages from Stringee server, you call:
[conversation getLastMessagesWithCount:25 completionHandler:^(BOOL status, int code, NSString *message, id data) {
}];
In which:
To get a list of messages tied to a conversation from server which have sequence greater than seq, you call:
[conversation getMessagesAfter:sequence withCount:25 completionHandler:^(BOOL status, int code, NSString *message, id data) {
}];
In which:
To get a list of messages tied to a conversation from server which have sequence smaller than seq, you call:
[conversation getMessagesBefore:sequence withCount:25 completionHandler:^(BOOL status, int code, NSString *message, id data) {
}];
In which:
Stringee keeps track of the recipient status of each message. There are five possible statuses: Pending, Sending, Sent, Delivered, Read. Stringee automatically updates the recipient status to sent, delivered. The only update your app can perform is to mark a conversation's messages as read:
[conversation markAllMessagesAsSeenWithCompletionHandler:^(BOOL status, int code, NSString *message) {
}];
Stringee will notify you of the status update of a message via the onObjectChange event of StringeeClient.
To delete a message, you call:
[message deleteWithCompletionHandler:^(BOOL status, int code, NSString *message) {
NSLog(@"deleteMessage %@", message);
}];
In order to pin a message, you call:
[conversation pinMessage:msg isPin:true completion:^(BOOL status, int code, NSString *message) {
NSLog(@"pinMessage %@", message);
}];
In which:
In order to edit a message, you call:
[conversation editMessage:msg newContent:newContent completion:^(BOOL status, int code, NSString *message) {
NSLog(@"editMessage %@", message);
}];
In which:
In order to revoke a message, you call:
[conversation revokeMessage:msg completion:^(BOOL status, int code, NSString *message) {
NSLog(@"revokeMessage %@", message);
}];
In which: