Donky Modular SDK (V2.8.6.4)
The Donky iOS SDK is a kit for adding push notifications and rich content services to your application. For detailed documentation, tutorials and guides, visit our online documentation.
##Requirements
The minimal technical requirements for the Donky Modular SDK are:
- Xcode 6.0+
- iOS 8.0+
- Arc must be enabled.
- Library should be included as Cocoa Touch Framework when integrated via CocoaPods
Importing via CocoaPods
If using Cocoapods, please include use_frameworks!
in your Podfile
.
Due to the way the library is constructe, importing some of its resources which is used internally cannot be achieved when SDK is used as Static Library.
Frameworks are modern way for including external libraries in the projects, as well it is requirement for Swift support, so please use this way to integrate Donky SDK.
Read our complete documentation here
Author
Donky Networks Ltd, [email protected]
License
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 [email protected]:Donky-Network/DonkySDK-iOS-Modular.git
Using CocoaPods
Please see below for all the information specific to the CocoaPods
##Support
Please contact [email protected] if you have any issues with integrating or using this SDK.
##Contribute
We accept pull requests!
##CocoaPods
Donky-Core-SDK
Usage
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.
Initialise anonymously
- (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;
}
Initialise with a known user
- (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
Requirements
- iOS 7.0+
- Arc must be enabled.
#Third Party Dependencies
Installation
Donky-Core-SDK is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod "Donky-Core-SDK"
Donky-Push
Usage
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
Requirements
- iOS 8.0+
- Arc must be enabled.
- For Interactive notifications iOS 8.0+ is required.
Installation
pod "Donky-Push"
Pod Dependencies
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
Donky-RichMessage-Logic
Usage
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
Requirements
- iOS 8.0+
- Arc must be enabled.
Installation
pod "Donky-RichMessage-Logic"
Pod Dependencies
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
Donky-RichMessage-Inbox
Usage
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
Requirements
- iOS 8.0+
- Arc must be enabled.
Installation
pod "Donky-RichMessage-Inbox"
Pod Dependencies
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
Donky-Automation-Logic
Usage
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
Requirements
- iOS 8.0+
- Arc must be enabled.
Installation
pod "Donky-Automation-Logic"
Pod Dependencies
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-CommonMessaging-Audio
Usage
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
Requirements
- iOS 8.0+
- Arc must be enabled.
Installation
pod "Donky-CommonMessaging-Audio"
Pod Dependencies
None
Donky-Core-Sequencing
Usage
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
Requirements
- iOS 8.0+
- Arc must be enabled.
Installation
pod "Donky-Core-Sequencing"
Pod Dependencies
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-CommonMessaging-Logic
Usage
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.
Donky-CommonMessaging-UI
Usage
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.
Donky-CoreLocation
Usage
Adding this will allow you to use Donkys location and reporting, please see here