Added AppBlade PhoneGap plugin for iOS

This commit is contained in:
Michele
2012-05-29 10:01:32 -04:00
parent 45cb16534b
commit ac586ac65e
4 changed files with 134 additions and 0 deletions

40
iOS/AppBlade/AppBlade.js Normal file
View File

@@ -0,0 +1,40 @@
/**
* AppBlade.js
*
* Phonegap AppBlade Instance plugin
* Copyright (c) AppBlade 2012
*
*/
// --------------------------------------------------------
var AppBlade = function(){};
// --------------------------------------------------------
AppBlade.prototype.setupAppBlade = function(project, token, secret, timestamp) {
cordova.exec("AppBlade.setupAppBlade", [project, token, secret, timestamp]);
};
AppBlade.prototype.catchAndReportCrashes = function() {
cordova.exec("AppBlade.catchAndReportCrashes");
};
AppBlade.prototype.checkAuthentication = function() {
cordova.exec("AppBlade.checkAuthentication");
};
AppBlade.prototype.allowFeedbackReporting = function() {
cordova.exec("AppBlade.allowFeedbackReporting");
};
// --------------------------------------------------------
cordova.addConstructor(function() {
if (!window.Cordova) {
window.Cordova = cordova;
};
if(!window.plugins) window.plugins = {};
window.plugins.appBlade = new AppBlade();
});

View File

@@ -0,0 +1,19 @@
//
// AppBladePlugin.h
// HelloWorld
//
// Created by Michele Titolo on 5/14/12.
// Copyright (c) 2012 AppBlade. All rights reserved.
//
#import <Cordova/CDVPlugin.h>
@interface AppBladePlugin : CDVPlugin
- (void)setupAppBlade:(NSMutableArray*)args withDict:(NSMutableDictionary*)options;
- (void)catchAndReportCrashes:(NSMutableArray*)args withDict:(NSMutableDictionary*)options;
- (void)allowFeedbackReporting:(NSMutableArray*)args withDict:(NSMutableDictionary*)options;
- (void)checkAuthentication:(NSMutableArray*)args withDict:(NSMutableDictionary*)options;
@end

View File

@@ -0,0 +1,55 @@
//
// AppBladePlugin.m
// HelloWorld
//
// Created by Michele Titolo on 5/14/12.
// Copyright (c) 2012 AppBlade. All rights reserved.
//
#import "AppBladePlugin.h"
#import "AppBlade.h"
enum {
ABProjectID = 0,
ABToken,
ABSecretKey,
ABTimestamp
};
@implementation AppBladePlugin
- (void)setupAppBlade:(NSMutableArray*)args withDict:(NSMutableDictionary*)options
{
NSArray* keys = [args objectAtIndex:0];
NSLog(@"Setup with stuff: %@", keys);
NSString* project = [keys objectAtIndex:ABProjectID];
NSString* token = [keys objectAtIndex:ABToken];
NSString* secret = [keys objectAtIndex:ABSecretKey];
NSString* timestamp = [keys objectAtIndex:ABTimestamp];
AppBlade *blade = [AppBlade sharedManager];
blade.appBladeProjectID = project;
blade.appBladeProjectToken = token;
blade.appBladeProjectSecret = secret;
blade.appBladeProjectIssuedTimestamp = timestamp;
}
- (void)catchAndReportCrashes:(NSMutableArray *)args withDict:(NSMutableDictionary *)options
{
NSLog(@"Catch and Report Crashes");
[[AppBlade sharedManager] catchAndReportCrashes];
}
- (void)checkAuthentication:(NSMutableArray *)args withDict:(NSMutableDictionary *)options
{
NSLog(@"Check approval");
[[AppBlade sharedManager] checkApproval];
}
- (void)allowFeedbackReporting:(NSMutableArray *)args withDict:(NSMutableDictionary *)options
{
NSLog(@"Allow Feedback");
[[AppBlade sharedManager] allowFeedbackReporting];
}
@end

20
iOS/AppBlade/README.md Normal file
View File

@@ -0,0 +1,20 @@
AppBladeSDK PhoneGap Plugin
===================
Plugin for PhoneGap that uses the AppBlade SDK.
##Installation - iOS
1. Copy `AppBlade.js` from into your `www` directory.
2. Copy `AppBladePlugin.[hm]` into your Plugins folder.
3. Follow directions for [adding plugins to your iOS project](http://wiki.phonegap.com/w/page/43708792/How%20to%20Install%20a%20PhoneGap%20Plugin%20for%20iOS).
3. Follow directions for [adding the AppBlade SDK to your project](http://github.com/AppBlade/SDK), but do not edit the `AppDelegate`.
4. Add `-all_load` to the `other linker flags` build setting for your target.
5. In your `index.html`, register for the `"deviceready"` eventListener, and call the setup method with your SDK keys in this order: project, token, secret, issued timestamp.
See the Example project included for examples using the other functions of the SDK.
##Resources:
###[AppBlade.com](https://appblade.com/)
###[License and Terms](https://appblade.com/terms_of_use)