Notifications happen whenever data on the server changes and needs to update the client. Primarily there are two types of notifications that come through:
We are transitioning from using the notification center a custom notification system.
Copy #define bHookDidAuthenticate @"bHookDidAuthenticate"
#define bHook_AuthenticationType @"bHook_AuthenticationType"
#define bHook_AuthenticationTypeLogin @"login"
#define bHook_AuthenticationTypeSignUp @"signup"
#define bHook_AuthenticationTypeCached @"cached"
#define bHookWillLogout @"bHookWillLogout"
#define bHookDidLogout @"bHookDidLogout"
#define bHookUserOn @"bHookUserOn"
#define bHookContactWillBeAdded @"bHookContactWillBeAdded"
#define bHookContactWasAdded @"bHookContactWasAdded"
#define bHookContactWillBeDeleted @"bHookContactWillBeDeleted"
#define bHookContactWasDeleted @"bHookContactWasDeleted"
#define bHookMessageRecieved @"bHookMessageRecieved"
#define bHookMessageWillSend @"bHookMessageWillSend"
#define bHookMessageSending @"bHookMessageSending"
#define bHookMessageDidSend @"bHookMessageDidSend"
#define bHookMessageWillUpload @"bHookMessageWillUpload"
#define bHookMessageDidUpload @"bHookMessageDidUpload"
#define bHookMessageWillBeDeleted @"bHookMessageWillBeDeleted"
#define bHookMessageWasDeleted @"bHookMessageWasDeleted"
#define bHookThreadAdded @"bHookThreadAdded"
#define bHookThreadRemoved @"bHookThreadRemoved"
#define bHook_PMessage @"bHook_PMessage"
#define bHook_PUser @"bHook_PUser"
#define bHook_PThread @"bHook_PThread"
#define bHookInternetConnectivityDidChange @"bHookInternetConnectivityDidChange"
#define bHookUserWillDisconnect @"bHookUserWillDisconnect"
Copy [BChatSDK.hook addHook:[BHook hook:^(NSDictionary * dict) {
id<PMessage> messageModel = dict[bHook_PMessage];
}] withNames: @[bHookMessageRecieved]];
Copy #define bNotificationLogout @"bNLogout"
#define bNotificationMessageUpdated @"bNMessageUpdated"
#define bNotificationMessageUpdatedKeyMessage @"bNMessageUpdatedKeyMessage"
#define bNotificationFlaggedMessageAdded @"bNFlaggedMessageAdded"
#define bNotificationFlaggedMessageAdded_PMessage @"bNFlaggedMessageAdded_PMessage"
#define bNotificationFlaggedMessageRemoved @"bNFlaggedMessageRemoved"
#define bNotificationFlaggedMessageRemoved_PMessage @"bNFlaggedMessageRemoved_PMessage"
#define bNotificationThreadRead @"bNThreadRead"
#define bNotificationBadgeUpdated @"bNBadgeUpdated"
#define bNotificationPresentChatView @"bNPresentChatView"
#define bNotificationPresentChatView_PThread @"bNPresentChatView_PThread"
#define bNotificationThreadLastMessageUpdated @"bNThreadLastMessageUpdated"
#define bNotificationThreadLastMessageUpdated_Text @"bNThreadLastMessageUpdated_Text"
#define bNotificationReadReceiptUpdated @"bNReadReceiptUpdated"
#define bNotificationReadReceiptUpdatedKeyMessage @"bNReadReceiptUpdatedKeyMessage"
#define bNotificationTypingStateChanged @"bNTypingStateChanged"
#define bNotificationTypingStateChangedKeyThread @"bNTypingStateChangedKeyThread"
#define bNotificationTypingStateChangedKeyMessage @"bNTypingStateChangedKeyMessage"
#define bNotificationAuthenticationComplete @"bNAuthenticationComplete"
Copy [[NSNotificationCenter defaultCenter] addObserverForName:bNotificationThreadUsersUpdated
object:Nil
queue:Nil
usingBlock:^(NSNotification * notification) {
dispatch_async(dispatch_get_main_queue(), ^{
// Handle here });
}]