The modular SDK exposes all of the network functionality in a way that means developers can consume only the pieces they need in order to:
- Send custom notifications
- Use Donky's messaging features
- Automate actions and messaging
- Track in app analytics
- Build complex M2M, A2P and P2P applications
Using Donky as a data network allows developers to focus on writing the apps code rather than having to worry about building a reliable and secure network. The complexities of transferring data across the internet are taken care of, allowing developers to just build their applications.
##Requirements
The minimal technical requirements for the Donky Module SDK are:
- Xcode 5.0+
- iOS 7.0+
- Arc must be enabled.
Read our complete documentation here
Donky Networks Ltd, sdk@mobiledonky.com
DonkySDK-iOS-Modular is available under the MIT license. See the LICENSE file for more info.
##Installation
To install please use one of the following methods:
Cloning the Git Repo:
git clone git@github.com:Donky-Network/DonkySDK-iOS-Modular.git
Using CocoaPods
Please see below for all the information specific to the CocoaPods
##Support
Please contact sdk@mobiledonky.com if you have any issues with integrating or using this SDK.
##Contribute
We accept pull requests!
##CocoaPods
[![CI Status](http://img.shields.io/travis/Dynmark LtD/Donky-Core-SDK.svg?style=flat)](https://travis-ci.org/Donky Networks Ltd/Donky-Core-SDK)
Only add this to your 'PodFile' if this is the only part of the SDK you are going to use. Adding this to your ‘Podfile’ is not necessary if using any of the additional optional modules.
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
//Start analytics (optional)
[[DCAAnalyticsController sharedInstance] start];
//Initialise Donky with API key.
[[DNDonkyCore sharedInstance] initialiseWithAPIKey:@"API-KEY"];
return YES;
}
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
//Start analytics (optional)
[[DCAAnalyticsController sharedInstance] start];
//Create a new user and populate with details. Country code is optional is NO mobile number is provided. If a
//mobile number is provided then a country code is mandatory. Failing to provide a country code that matches the
//mobile number will result in a server validation error.
DNUserDetails *userDetails = [[DNUserDetails alloc] initWithUserID:@""
displayName:@""
emailAddress:@""
mobileNumber:@""
countryCode:@""
firstName:@""
lastName:@""
avatarID:@""
selectedTags:@[]
additionalProperties:@{}];
//Initialise Donky with API key.
[[DNDonkyCore sharedInstance] initialiseWithAPIKey:@"API-KEY" userDetails:userDetails success:^(NSURLSessionDataTask *task, id responseData) {
NSLog(@"Successfully Initialised with user...");
} failure:^(NSURLSessionDataTask *task, NSError *error) {
NSLog(@"%@", [error localizedDescription]);
}];
return YES
}
You must also invoke the following of your applications delegate to ensure that custom content notifications are received and processed promptly:
To ensure that your device token is sent to the Donky Network:
- (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken {
[DNNotificationController registerDeviceToken:deviceToken];
}
To handle incoming notifications, using this method allows your application to process content enabled notifications:
- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo fetchCompletionHandler:(void (^)(UIBackgroundFetchResult result))completionHandler {
[DNNotificationController didReceiveNotification:userInfo handleActionIdentifier:nil completionHandler:^(NSString *string) {
completionHandler(UIBackgroundFetchResultNewData);
}];
}
To handle interactive notifications (iOS 8+ only)
- (void)application:(UIApplication *)application handleActionWithIdentifier:(NSString *)identifier forRemoteNotification:(NSDictionary *)userInfo completionHandler:(void (^)())completionHandler {
[DNNotificationController didReceiveNotification:userInfo handleActionIdentifier:identifier completionHandler:^(NSString *string) {
completionHandler();
}];
}
##Samples
The sample project can be found:
│
├───src
├───workspaces
├───Donky Core SDK Demo
- iOS 7.0+
- Arc must be enabled.
#Third Party Dependencies
Donky-Core-SDK is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod "Donky-Core-SDK"
[![CI Status](http://img.shields.io/travis/Dynmark LtD/Donky-SimplePush-Logic.svg?style=flat)](https://travis-ci.org/Donky Networks Ltd/Donky-SimplePush-Logic)
Use the Simple Push module to enable your application to receive Simple Push messages.
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
//Start analytics (optional)
[[DCAAnalyticsController sharedInstance] start];
//Start push logic:
[[DPPushNotificationController sharedInstance] start];
//Initialise Donky
[[DNDonkyCore sharedInstance] initialiseWithAPIKey:@"API-KEY"];
return YES;
}
You must also invoke the following of your applications delegate:
To ensure that your device token is sent to the Donky Network:
- (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken {
[DNNotificationController registerDeviceToken:deviceToken];
}
To handle incoming notifications, using this method allows your application to process content enabled notifications:
- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo fetchCompletionHandler:(void (^)(UIBackgroundFetchResult result))completionHandler {
[DNNotificationController didReceiveNotification:userInfo handleActionIdentifier:nil completionHandler:^(NSString *string) {
completionHandler(UIBackgroundFetchResultNewData);
}];
}
To handle interactive notifications (iOS 8+ only)
- (void)application:(UIApplication *)application handleActionWithIdentifier:(NSString *)identifier forRemoteNotification:(NSDictionary *)userInfo completionHandler:(void (^)())completionHandler {
[DNNotificationController didReceiveNotification:userInfo handleActionIdentifier:identifier completionHandler:^(NSString *string) {
completionHandler();
}];
}
##Samples
The sample project can be found:
│
├───src
├───workspaces
├───Donky Simple Push Logic Demo
- iOS 7.0+
- Arc must be enabled.
- For Interactive notifications iOS 8.0+ is required.
pod "Donky-SimplePush-Logic"
Including this in your podfile will automatically pull in the following other modules, as they are hard dependent. There is no need to manually incldue any of the below manually:
- Donky Core SDK
- Donky Common Messaging Logic
[![CI Status](http://img.shields.io/travis/Dynmark LtD/Donky-SimplePush-UI.svg?style=flat)](https://travis-ci.org/Donky Networks Ltd/Donky-SimplePush-UI)
The following code samples is the minimum required to start receiving simple push messages from the Donky network as well as utilising our pre-built UI to display the message(s) to the user while their application is open. It includes a pre-built UI to display button options and reporting against which button a user selectes for interative notifications.
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
//Start analytics (optional)
[[DCAAnalyticsController sharedInstance] start];
//Start the Push UI controller, there is no need to start the logic controller as well:
[[DPUINotificationController sharedInstance] start];
//Initialise Donky
[[DNDonkyCore sharedInstance] initialiseWithAPIKey:@"API-KEY"];
return YES;
}
You must also invoke the following of your applications delegate:
To ensure that your device token is sent to the Donky Network:
- (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken {
[DNNotificationController registerDeviceToken:deviceToken];
}
To handle incoming notifications, using this method allows your application to process content enabled notifications:
- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo fetchCompletionHandler:(void (^)(UIBackgroundFetchResult result))completionHandler {
[DNNotificationController didReceiveNotification:userInfo handleActionIdentifier:nil completionHandler:^(NSString *string) {
completionHandler(UIBackgroundFetchResultNewData);
}];
}
To handle interactive notifications (iOS 8+ only)
- (void)application:(UIApplication *)application handleActionWithIdentifier:(NSString *)identifier forRemoteNotification:(NSDictionary *)userInfo completionHandler:(void (^)())completionHandler {
[DNNotificationController didReceiveNotification:userInfo handleActionIdentifier:identifier completionHandler:^(NSString *string) {
completionHandler();
}];
}
##Samples
The sample project can be found:
│
├───src
├───workspaces
├───Donky Simple Push UI Demo
- iOS 7.0+
- Arc must be enabled.
pod "Donky-SimplePush-UI"
Including this in your podfile will automatically pull in the following other modules, as they are hard dependent. There is no need to manually incldue any of the below manually:
- Donky Core SDK
- Donky Simple Push Logic
- Donky Common Messaging Logic
- Donky Common Messaging UI
[![CI Status](http://img.shields.io/travis/Dynmark LtD/Donky-RichMessage-Logic.svg?style=flat)](https://travis-ci.org/Donky Networks Ltd/Donky-RichMessage-Logic)
Use the Rich Message module to enable your application to receive Rich Messages from the netowrk and save them to Donky's local database. You can then retrieve and delete messages
through the APIs provided in the objective-c DRLogicMainController
.
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
// Override point for customization after application launch.
//Start analytics controller (optional)
[[DCAAnalyticsController sharedInstance] start];
//Start the Rich Logic
[[DRLogicMainController sharedInstance] start];
//Initialise Donky
[[DNDonkyCore sharedInstance] initialiseWithAPIKey:@"API-Key"];
return YES;
}
You must also invoke the following of your applications delegate:
To ensure that your device token is sent to the Donky Network:
- (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken {
[DNNotificationController registerDeviceToken:deviceToken];
}
To handle incoming notifications, using this method allows your application to process content enabled notifications:
- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo fetchCompletionHandler:(void (^)(UIBackgroundFetchResult result))completionHandler {
[DNNotificationController didReceiveNotification:userInfo handleActionIdentifier:nil completionHandler:^(NSString *string) {
completionHandler(UIBackgroundFetchResultNewData);
}];
}
To handle interactive notifications (iOS 8+ only)
- (void)application:(UIApplication *)application handleActionWithIdentifier:(NSString *)identifier forRemoteNotification:(NSDictionary *)userInfo completionHandler:(void (^)())completionHandler {
[DNNotificationController didReceiveNotification:userInfo handleActionIdentifier:identifier completionHandler:^(NSString *string) {
completionHandler();
}];
}
##Samples
The sample project can be found:
│
├───src
├───workspaces
├───Donky Rich Message Logic Demo
- iOS 7.0+
- Arc must be enabled.
pod "Donky-RichMessage-Logic"
Including this in your podfile will automatically pull in the following other modules, as they are hard dependent. There is no need to manually incldue any of the below manually:
- Donky Core SDK
- Donky Common Messaging Logic
[![CI Status](http://img.shields.io/travis/Dynmark LtD/Donky-RichMessage-PopUp.svg?style=flat)](https://travis-ci.org/Donky Networks Ltd/Donky-RichMessage-PopUp)
Use the Rich Message module to enable your application to receive rich messages and display them automatically to the user in the form of a pop up.
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
// Override point for customization after application launch.
//Start the analytics controller (optional)
[[DCAAnalyticsController sharedInstance] start];
//Start the Rich Pop Up UI controller:
[[DRUIPopUpMainController sharedInstance] start];
//Optional Settings:
//Whether rich messages should be automatically deleted from the database after the user has dismissed the pop up (default = YES):
[[DRUIPopUpMainController sharedInstance] setAutoDelete:YES];
//The style in which the pop up should be presented for iPads (default = UIModalPresentationFormSheet):
[[DRUIPopUpMainController sharedInstance] setRichPopUpPresentationStyle:UIModalPresentationFormSheet];
[[DNDonkyCore sharedInstance] initialiseWithAPIKey:@"API-KEY"];
return YES;
}
You must also invoke the following of your applications delegate:
To ensure that your device token is sent to the Donky Network:
- (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken {
[DNNotificationController registerDeviceToken:deviceToken];
}
To handle incoming notifications, using this method allows your application to process content enabled notifications:
- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo fetchCompletionHandler:(void (^)(UIBackgroundFetchResult result))completionHandler {
[DNNotificationController didReceiveNotification:userInfo handleActionIdentifier:nil completionHandler:^(NSString *string) {
completionHandler(UIBackgroundFetchResultNewData);
}];
}
To handle interactive notifications (iOS 8+ only)
- (void)application:(UIApplication *)application handleActionWithIdentifier:(NSString *)identifier forRemoteNotification:(NSDictionary *)userInfo completionHandler:(void (^)())completionHandler {
[DNNotificationController didReceiveNotification:userInfo handleActionIdentifier:identifier completionHandler:^(NSString *string) {
completionHandler();
}];
}
##Samples
The sample project can be found:
│
├───src
├───workspaces
├───Donky Rich Message PopUp Demo
- iOS 7.0+
- Arc must be enabled.
pod "Donky-RichMessage-PopUp"
Including this in your podfile will automatically pull in the following other modules, as they are hard dependent. There is no need to manually incldue any of the below manually:
- Donky Core SDK
- Donky Rich Message Logic
- Donky Common Messaging Logic
- Donky Common Messaging UI
[![CI Status](http://img.shields.io/travis/Dynmark LtD/Donky-RichMessage-Inbox.svg?style=flat)](https://travis-ci.org/Donky Networks Ltd/Donky-RichMessage-Inbox)
Use the Rich Message module to enable your application to receive and display rich message in our pre-built UI.
##Samples
The sample project can be found:
│
├───src
├───workspaces
├───Donky Rich Message Inbox Demo
- iOS 7.0+
- Arc must be enabled.
pod "Donky-RichMessage-Inbox"
Including this in your podfile will automatically pull in the following other modules, as they are hard dependent. There is no need to manually incldue any of the below manually:
- Donky Core SDK
- Donky Rich Message Logic
- Donky Common Messaging Logic
- Donky Common Messaging UI
[![CI Status](http://img.shields.io/travis/Dynmark LtD/Donky-Automation-Logic.svg?style=flat)](https://travis-ci.org/Donky Networks Ltd/Donky-Automation-Logic)
Use the Automation module to enable to trigger campaigns setup on Campaign Builder/Donky Control here.
Start the Donky SDK and analytics controller as normal.
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
// Override point for customization after application launch.
//Start analytics module (optional)
[[DCAAnalyticsController sharedInstance] start];
//Initialise Donky
[[DNDonkyCore sharedInstance] initialiseWithAPIKey:@"API-KEY"];
return YES;
}
To fire a trigger use either of the following methods:
[DAAutomationController executeThirdPartyTriggerWithKey:@"Trigger-Key" customData:@{}];
[DAAutomationController executeThirdPartyTriggerWithKeyImmediately:@"Trigger-Key" customData:@{}];
##Samples
The sample project can be found:
│
├───src
├───workspaces
├───Donky Automation Demo
- iOS 7.0+
- Arc must be enabled.
pod "Donky-Automation-Logic"
Including this in your podfile will automatically pull in the following other modules, as they are hard dependent. There is no need to manually incldue any of the below manually:
- Donky Core SDK
[![CI Status](http://img.shields.io/travis/Dynmark LtD/Donky-CommonMessaging-Audio.svg?style=flat)](https://travis-ci.org/Donky Networks Ltd/Donky-CommonMessaging-Audio)
Use of this module allows you to save audio files against various message types and allow them to be play automatically when that type of message is recevied. here.
Start the controller:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
// Override point for customization after application launch.
[[DAMainController sharedInstance] start];
//Other donky modules or custom code:
return YES;
}
To set a sound file, this method accepts an NSURL to the file.
[[DAMainController sharedInstance] setAudioFile:<#(NSURL *)#> forMessageType:<#(DonkyAudioMessageTypes)#>];
To play a sound file:
[[DAMainController sharedInstance] playAudioFileForMessage:<#(DonkyAudioMessageTypes)#>];
##Samples
│
├───src
├───workspaces
├───Donky Audio
- iOS 7.0+
- Arc must be enabled.
pod "Donky-CommonMessaging-Audio"
None
[![CI Status](http://img.shields.io/travis/Dynmark LtD/Donky-Core-Sequencing.svg?style=flat)](https://travis-ci.org/Donky Networks Ltd/Donky-Core-Sequencing)
Use of this module allows you to perform multiple calls to some account controller methods without needing to implement call backs or worry about sequencing when changing local and network state.
This module overides the following methods inside
DNSequencingAccountController
+ (void)updateAdditionalProperties:(NSDictionary *)newAdditionalProperties success:(DNNetworkSuccessBlock)successBlock failure:(DNNetworkFailureBlock)failureBlock;
+ (void)saveUserTags:(NSMutableArray *)tags success:(DNNetworkSuccessBlock)successBlock failure:(DNNetworkFailureBlock)failureBlock;
+ (void)updateUserDetails:(DNUserDetails *)userDetails success:(DNNetworkSuccessBlock)successBlock failure:(DNNetworkFailureBlock)failureBlock;
+ (void)updateRegistrationDetails:(DNUserDetails *)userDetails deviceDetails:(DNDeviceDetails *)deviceDetails success:(DNNetworkSuccessBlock)successBlock failure:(DNNetworkFailureBlock)failureBlock;
+ (void)updateDeviceDetails:(DNDeviceDetails *)deviceDetails success:(DNNetworkSuccessBlock)successBlock failure:(DNNetworkFailureBlock)failureBlock;
##Samples
- iOS 7.0+
- Arc must be enabled.
pod "Donky-Core-Sequencing"
Including this in your podfile will automatically pull in the following other modules, as they are hard dependent. There is no need to manually incldue any of the below manually:
- Donky Core SDK
[![CI Status](http://img.shields.io/travis/Dynmark LtD/Donky-CommonMessaging-Logic.svg?style=flat)](https://travis-ci.org/Donky Networks Ltd/CommonMessaging-Logic)
You will never need to manually add the common logic module into your application, it is a PodSpec dependency and therefore isn't required to be manually added to your PodFile.
[![CI Status](http://img.shields.io/travis/Dynmark LtD/Donky-CommonMessaging-UI.svg?style=flat)](https://travis-ci.org/Donky Networks Ltd/CommonMessaging-UI)
You will never need to manually add the common UI module into your application, it is a PodSpec dependency and therefore isn't required to be manually added to your PodFile.