Hyber 2.2.4

Hyber 2.2.4

TestsTested
LangLanguage SwiftSwift
License MIT
ReleasedLast Release Apr 2017
SwiftSwift Version 3.0
SPMSupports SPM

Maintained by Markevych T.



 
Depends on:
Alamofire~> 4.4.0
Firebase/Core= 3.11
Firebase/Messaging= 3.11
RealmSwift= 2.6.1
RxSwift= 3.4.0
SwiftyJSON= 3.1.4
CryptoSwift= 0.6.8
 

Hyber 2.2.4

  • By
  • Taras Markevych

Hyber SDK for iOS

Release

Installation

Hyber is available through CocoaPods. To install it, simply add the following line to your Podfile:

platform :ios, '9.0'

pod 'Hyber'

Then, run the following command:

$ pod install

Add files

Add HyberFirebaseMessagingDelegate.swift file to your project

Modify AppDelegate

Add import statement
import Hyber

In func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool add following

HyberFirebaseMessagingDelegate.sharedInstance.configureFirebaseMessaging()

Hyber.initialise(clientApiKey:"ClientApiKey",
firebaseMessagingHelper: HyberFirebaseMessagingDelegate.sharedInstance, launchOptions: launchOptions)

In func application(application: UIApplication, didReceiveRemoteNotification userInfo: [NSObject : AnyObject], fetchCompletionHandler completionHandler: (UIBackgroundFetchResult) -> Void) add following

	Hyber.didReceiveRemoteNotification(userInfo: userInfo)

	completionHandler(.newData)

Register your application for Remote Notification

Certificates

Configure push-notifications in Certificates, Identifiers & Profiles section of Apple Developer Member Center (manual)

Registering for Remote Notifications

Register your application to receive remote push-notifications (manual)

Don't forget add Push Notifications for your target (see Capabilities tab). And add turn on Background Modes, whith Remote Notifications flag ON) Use method for allow push notification

HyberFirebaseMessagingDelegate.sharedInstance.registerForRemoteNotification()

Usage

To start using Hyber framework you should provide correct subscriber e-mail & phone (optionally)

Use logger

By default logger enabled

  • Disable HyberLogger by setting enabled to false:
HyberLogger.enabled = false

By default HyberLogger print all messages

  • Define a minimum level of severity to only print the messages with a greater or equal severity:
HyberLogger.minLevel = .warning

The severity levels are trace, debug, info, warning, and error.

Subscriber information

Add new user

To add new subscriber you should call, phoneNumber is required

Hyber.registration(phoneId: String, password:String,  completionHandler: { (success) -> Void in
	if success {

	} else {
	//catch errors here
	}
})

In completion handler result you will get Hyber sessionData if success

Get delivered push's data array

All messages what you get via Hyber push will be saved to local storage. Import RealmSwift to your header Example:

import RealmSwift
//device array
var deviceList : Results<Device>! //RealmObject
	deviceList = realm.objects(Device.self)
//Messages array
var messageList : Results<Message>! //RealmObject
	messageList = realm.objects(Message.self)

let devices = Array(deviceList)
print("Devices: \(devices)")

let array = Array(messageList) //NSArray Object
//Do anything with array

Load massege history

For Loading message history from Hyber-SDK use method: Message history list include all channels messages: push/viber/sms

Hyber.getMessageList(completionHandler: { (success) -> Void in
if success {

   } else {
//catch errors here
	}
})

Get device's list

For Loading list of registred devices: Message history list include all channels messages: push/viber/sms

Hyber.getDeviceList(completionHandler: { (success) -> Void in
  if success {
      
      } else {
//catch errors here
   }
})

Fetch massege history

Message history list include all channels messages: push/viber/sms

	Hyber.fetchMessageArea { AnyObject, Error in
   	 	print("responseObject = \(AnyObject); error = \(Error)")
    	return
	}

Fetch device's list

For fetch list of registred devices:

 	Hyber.fetchDeviceList { AnyObject, Error in
        print("responseObject = \(AnyObject); error = \(Error)")
        return
    }

Revoke device

For for revoke old devices call this method:

 Hyber.revokeDevice(deviceId:[Array] , completionHandler: { (success) -> Void in
        if success {
                          
        } else {
//catch errors here
        }
})

Sent Callback message

For reply to message use Callback method:

Hyber.sendMessageCallback(messageId: String, message: String, completionHandler: { (success) -> Void in
	if success {

		} else {
//catch errors here
	}
})

Support information

Project include demo app with all SDK methods.For any question contact Hyber

How to get keys, push-notifications, IDs

Hyber application key

Contact Hyber

Firebase Messaging (push-notifications)

Create new project in Firebase console. Add iOS aaplication into your project. Enable Cloud Messaging API for you project in Go to project Settings, switch to Cloud Messaging tab. Upload APNs certificates (Manual). Than download GoogleService-Info.plist from General tab (Firebase console, project settings). Add this file to yours application project.

License

MIT

3rdparties

Firebase Messaging RXSwift RealmSwift Alamofire