TestsTested | ✗ |
LangLanguage | Obj-CObjective C |
License | MIT |
ReleasedLast Release | Feb 2016 |
Maintained by Donky Networks Ltd.
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.
The minimal technical requirements for the Donky Module SDK are:
Read our complete documentation here
Donky Networks Ltd, [email protected]
DonkySDK-iOS-Modular is available under the MIT license. See the LICENSE file for more info.
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
Please contact [email protected] if you have any issues with integrating or using this SDK.
We accept pull requests!
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();
}];
}
The sample project can be found:
│
├───src
├───workspaces
├───Donky Core SDK Demo
Donky-Core-SDK is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod "Donky-Core-SDK"
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();
}];
}
The sample project can be found:
│
├───src
├───workspaces
├───Donky Simple Push Logic Demo
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:
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();
}];
}
The sample project can be found:
│
├───src
├───workspaces
├───Donky Rich Message Logic Demo
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:
Use the Rich Message module to enable your application to receive and display rich message in our pre-built UI.
The sample project can be found:
│
├───src
├───workspaces
├───Donky Rich Message Inbox Demo
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:
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:@{}];
The sample project can be found:
│
├───src
├───workspaces
├───Donky Automation Demo
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:
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)#>];
│
├───src
├───workspaces
├───Donky Audio
pod "Donky-CommonMessaging-Audio"
None
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;
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:
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.
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.