XBPushChat 0.5.3.13

XBPushChat 0.5.3.13

TestsTested
LangLanguage Obj-CObjective C
License MIT
ReleasedLast Release Oct 2015

Maintained by Eugene Nguyen.



 
Depends on:
JSQMessagesViewController>= 0
XBMobile>= 0
UIImage+ImageCompress>= 0
IDMPhotoBrowser>= 0
XBLanguage>= 0
XBGallery>= 0
 

XBPushChat 0.5.3.13

  • By
  • eugenenguyen

Usage

To run the example project, clone the repo, and run pod install from the Example directory first.

Requirements

Installation

How to use

  1. Install XBPushChat & PushChat + (a module of PlusIgniter)
  2. Config XBPushChat when app start:
[[XBPushChat sharedInstance] registerPush]; // register push notification, support all iOS
[[XBPushChat sharedInstance] setHost:@"http://ciplustest.libre.com.vn"]; // setup host of PushChat+

and some bootstrap

- (void)applicationWillResignActive:(UIApplication *)application
{
    [[XBPushChat sharedInstance] setPresence:0];
}

- (void)applicationDidEnterBackground:(UIApplication *)application
{
    [[XBPushChat sharedInstance] setPresence:0];
}

- (void)applicationWillEnterForeground:(UIApplication *)application
{
    [[XBPushChat sharedInstance] setPresence:1];
}

- (void)applicationDidBecomeActive:(UIApplication *)application
{
    [[XBPushChat sharedInstance] setPresence:1];
}

- (void)applicationWillTerminate:(UIApplication *)application
{
    [[XBPushChat sharedInstance] setPresence:0 synchronous:YES];
}

#pragma mark - Push Delegate

- (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken
{
    [[XBPushChat sharedInstance] didReceiveToken:deviceToken];
}

- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo
{
    [[XBPushChat sharedInstance] didReceiveRemoteNotification:userInfo];
}

- (void)application:(UIApplication *)application didFailToRegisterForRemoteNotificationsWithError:(NSError *)error
{
    [[XBPushChat sharedInstance] didFailToRegisterForRemoteNotification:error];
}
  1. After get your userid (after login / register), you can start to chat:
[[XBPushChat sharedInstance] setSender_id:99]; // 99 is your userid
```objc

4. Fetch your history
```objc
[[XBPushChat sharedInstance] fetchAllRequest]; //get all history
//or 
[[XBPushChat sharedInstance] fetchRequestWith:100]; //get all message between you and user 100
  1. Setup your presence
[[XBPushChat sharedInstance] setPresence:1]; //1 is online. 0 is offline
  1. And show the chat view anytime you need

Author

eugenenguyen, [email protected]

Contact

Any question, request, suggest, please feel free to send to us. You're always welcome.

LIBRETeamStudio

License

XBMobile is available under the MIT license. See the LICENSE file for more info.

Donation

This is open-source project. If you want to support us to keep develop this, or just give me a beer, don't be shy :) i will always appreciate that.

License

XBPushChat is available under the MIT license. See the LICENSE file for more info.