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 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 HyberFirebaseMessagingDelegate.swift
file to your project
import
statementimport 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)
Configure push-notifications in Certificates, Identifiers & Profiles section of Apple Developer Member Center (manual)
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()
To start using Hyber framework you should provide correct subscriber e-mail & phone (optionally)
By default logger enabled
HyberLogger
by setting enabled
to false
:HyberLogger.enabled = false
By default HyberLogger print all messages
HyberLogger.minLevel = .warning
The severity levels are
trace
,debug
,info
,warning
, anderror
.
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
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
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
}
})
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
}
})
Message history list include all channels messages: push/viber/sms
Hyber.fetchMessageArea { AnyObject, Error in
print("responseObject = \(AnyObject); error = \(Error)")
return
}
For fetch list of registred devices:
Hyber.fetchDeviceList { AnyObject, Error in
print("responseObject = \(AnyObject); error = \(Error)")
return
}
For for revoke old devices call this method:
Hyber.revokeDevice(deviceId:[Array] , completionHandler: { (success) -> Void in
if success {
} else {
//catch errors here
}
})
For reply to message use Callback method:
Hyber.sendMessageCallback(messageId: String, message: String, completionHandler: { (success) -> Void in
if success {
} else {
//catch errors here
}
})
Project include demo app with all SDK methods.For any question contact Hyber
Contact Hyber
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.