Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Added SDK with no dependencies. Updated readme.

  • Loading branch information...
commit 080f7abef8cac3b0ba611f5d145b633c2f7796f6 1 parent 8f6fbcd
Ben Nichols authored
View
1  Framework+Dependencies/PTSDK.framework/Headers
View
1  Framework+Dependencies/PTSDK.framework/PTSDK
View
188 Framework+Dependencies/PTSDK.framework/Versions/A/Headers/PTController.h
@@ -0,0 +1,188 @@
+//
+// PTController.h
+// PTSDK
+//
+// Copyright 2013 PunchTab. All rights reserved.
+//
+
+#import <Foundation/Foundation.h>
+#import <UIKit/UIKit.h>
+
+#if !__has_feature(objc_arc)
+#error PTSDK must be built with ARC.
+// You can turn on ARC for only PTSDK files by adding -fobjc-arc to the build phase for each of its files.
+#endif
+
+/**
+ Response block for all network calls. If successful, success will be true
+ and the response will be populated with the custom object for the api.
+ If it fails, success will be false and the response will be an NSError object.
+ */
+typedef void (^ResponseBlock)(BOOL success, id response);
+
+@interface PTController : NSObject {
+
+}
+
+@property (nonatomic, strong) NSDictionary * userData;
+@property (unsafe_unretained, nonatomic, readonly) NSString * ptToken;
+@property (nonatomic, strong) NSString * clientId;
+
+@property (nonatomic, assign) BOOL disableOverlay;
+
+/**
+ @returns whether or not there is already a valid token stored
+ */
+@property (readonly) BOOL hasToken;
+
+/**
+ Pings the server so that a user that has downloaded the app through a link from a Giveaway will receive entries in the Giveaway. An App ID is not required for this method.
+ */
++ (void)enterGiveaway;
+
+/**
+ Handler for the single sign-on processing
+ @param url - the url of the redirect
+ @returns whether or not the method handled the url
+ */
+- (BOOL)handleOpenURL:(NSURL *)url;
+
+/**
+ Constructor to use punchtab for authentication
+ @param clientId - identifier received from punchtab.com
+ @returns instance of PTController
+ */
+- (id)initWithClientId:(NSString *)clientId;
+
+/**
+ Constructor to use SSO for authentication
+ @param clientId - identifier received from punchtab.com
+ @param domainName - domain of your website
+ @param accessKey - access key received from punchtab.com
+ @param secretKey - secret key received from punchtab.com
+ @returns instance of PTController
+ */
+- (id)initWithClientId:(NSString *)clientId domainName:(NSString *)domainName accessKey:(NSString *)accessKey secretKey:(NSString *)secretKey;
+
+/**
+ Logs the user in. If there is an existing token, it is used and the response is immediately returned. If not the user is sent through the external sign-on process.
+ Success Response - NSDictionary containing raw JSON user data
+ */
+- (void)loginBlock:(ResponseBlock)block;
+
+/**
+ Logs the user in. If there is an existing token, it is used and the response is immediately returned. If not the user is sent through the single sign-on process.
+ @param userId - unique identifier of the user
+ @param firstName - first name of the user
+ @param lastName - last name of the user
+ Success Response - NSDictionary containing raw JSON user data
+ */
+- (void)loginWithUserId:(NSString *)userId firstName:(NSString *)firstName lastName:(NSString *)lastName email:(NSString *)email block:(ResponseBlock)block;
+
+/**
+ Logs the user in. If there is an existing token, it is used and the response is immediately returned. If not the user is sent through the single sign-on process.
+ @param userId - unique identifier of the user
+ @param firstName - first name of the user
+ @param lastName - last name of the user
+ @param email - email address of the user
+ Success Response - NSDictionary containing raw JSON user data
+ */
+- (void)loginWithUserId:(NSString *)userId firstName:(NSString *)firstName lastName:(NSString *)lastName block:(ResponseBlock)block;
+
+/**
+ Logs the user out. Clears out all local PunchTab related data.
+ Success Response - server response if present
+ */
+- (void)logoutBlock:(ResponseBlock)block;
+
+/**
+ Gets the leaderboard for the reward program.
+ Success Response - NSArray of users in the leaderboard
+ */
+- (void)getLeaderboardBlock:(ResponseBlock)block;
+
+/**
+ Gets the leaderboard for the reward program.
+ @param showUser - whether or not the user should see their relative placement in the leaderboard
+ Success Response - NSArray of users in the leaderboard
+ */
+- (void)getLeaderboardWithMe:(BOOL)showUser block:(ResponseBlock)block;
+
+/**
+ Gets the user's PunchTab related activity stream
+ Success Response - NSArray of user's activities
+ */
+- (void)getActivitiesBlock:(ResponseBlock)block;
+
+/**
+ Gets the user's PunchTab related activity stream
+ @param filter - filter for a specific activity type
+ Success Response - NSArray of user's activities
+ */
+- (void)getActivitiesFilter:(NSString *)filter block:(ResponseBlock)block;
+
+
+/**
+ Gets the user's PunchTab related activity stream
+ @param limit - the max activities returned
+ Success Response - NSArray of user's activities
+ */
+- (void)getActivitiesLimit:(int)limit block:(ResponseBlock)block;
+
+/**
+ Gets the user's PunchTab related activity stream
+ @param filter - filter for a specific activity type
+ @param limit - the max activities returned
+ Success Response - NSArray of user's activities
+ */
+- (void)getActivitiesFilter:(NSString *)filter limit:(int)limit block:(ResponseBlock)block;
+
+/**
+ Gets the list of rewards available to the user
+ Success Response - NSArray of rewards for the program
+ */
+- (void)getRewardsBlock:(ResponseBlock)block;
+
+/**
+ Gets the list of rewards available to the user
+ @param limit - the max rewards returned
+ Success Response - NSArray of rewards for the program
+ */
+- (void)getRewardsLimit:(int)limit block:(ResponseBlock)block;
+
+/**
+ Send an activity to the server to score points. Default is 100 points.
+ Success Response - NSDictionary server response
+ */
+- (void)sendActivity:(NSString *)activity block:(ResponseBlock)block;
+
+/**
+ Send an activity to the server to score points. Default is 100 points.
+ @param points - the number of points to score
+ Success Response - NSDictionary server response
+ */
+- (void)sendActivity:(NSString *)activity withPoints:(int)points block:(ResponseBlock)block;
+
+- (void)sendActivity:(NSString *)activity withPoints:(int)points refId:(NSNumber *)refId block:(ResponseBlock)block;
+
+/**
+ Send an activity to the server. This is more of a direct interface to the API.
+ @param parameters - custom parameters sent to the server
+ Success Response - NSDictionary server response
+ */
+- (void)sendActivity:(NSString *)activity parameters:(NSDictionary *)parameters block:(ResponseBlock)block;
+
+/**
+ Forces a call to the server to update the local userData. Use the userData property in order to access local userData.
+ */
+- (void)getUserData;
+
+/**
+ Send a the redeem activity to the server with a reward id.
+ @param rewardId - the id to redeem from the getRewards method
+ Success Response - NSDictionary server response
+ */
+- (void)redeemReward:(NSNumber *)rewardId block:(ResponseBlock)block;
+
+@end
+
View
BIN  Framework+Dependencies/PTSDK.framework/Versions/A/PTSDK
Binary file not shown
View
1  Framework+Dependencies/PTSDK.framework/Versions/Current
View
BIN  PTSDK.framework/Versions/A/PTSDK
Binary file not shown
View
28 PTTest/PTTest.xcodeproj/project.pbxproj
@@ -7,6 +7,8 @@
objects = {
/* Begin PBXBuildFile section */
+ B50B7C9C17FDF294008D4EB9 /* PTSDK.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B50B7C9B17FDF294008D4EB9 /* PTSDK.framework */; };
+ B50B7C9E17FDF2C9008D4EB9 /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B50B7C9D17FDF2C9008D4EB9 /* QuartzCore.framework */; };
B530F603144DEB4300A9CBAF /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B530F602144DEB4300A9CBAF /* UIKit.framework */; };
B530F605144DEB4300A9CBAF /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B530F604144DEB4300A9CBAF /* Foundation.framework */; };
B530F60D144DEB4300A9CBAF /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = B530F60B144DEB4300A9CBAF /* InfoPlist.strings */; };
@@ -18,11 +20,11 @@
B530F632144E05FC00A9CBAF /* RewardsTableViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = B530F631144E05FC00A9CBAF /* RewardsTableViewController.m */; };
B551B25317E7AAA9009B5199 /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B530F606144DEB4300A9CBAF /* CoreGraphics.framework */; };
B551B25517E7AAAE009B5199 /* Security.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B551B25417E7AAAE009B5199 /* Security.framework */; };
- B59175B417F66EC90030009E /* PTSDK.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B59175B317F66EC90030009E /* PTSDK.framework */; };
- B5D9865D14E5DA6C000EE30A /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B530F626144DEF1400A9CBAF /* QuartzCore.framework */; };
/* End PBXBuildFile section */
/* Begin PBXFileReference section */
+ B50B7C9B17FDF294008D4EB9 /* PTSDK.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = PTSDK.framework; path = "../Framework+Dependencies/PTSDK.framework"; sourceTree = "<group>"; };
+ B50B7C9D17FDF2C9008D4EB9 /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = System/Library/Frameworks/QuartzCore.framework; sourceTree = SDKROOT; };
B530F5FE144DEB4300A9CBAF /* PTTest.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = PTTest.app; sourceTree = BUILT_PRODUCTS_DIR; };
B530F602144DEB4300A9CBAF /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; };
B530F604144DEB4300A9CBAF /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };
@@ -39,14 +41,12 @@
B530F623144DEF1400A9CBAF /* CFNetwork.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CFNetwork.framework; path = System/Library/Frameworks/CFNetwork.framework; sourceTree = SDKROOT; };
B530F624144DEF1400A9CBAF /* libz.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libz.dylib; path = usr/lib/libz.dylib; sourceTree = SDKROOT; };
B530F625144DEF1400A9CBAF /* MobileCoreServices.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = MobileCoreServices.framework; path = System/Library/Frameworks/MobileCoreServices.framework; sourceTree = SDKROOT; };
- B530F626144DEF1400A9CBAF /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = System/Library/Frameworks/QuartzCore.framework; sourceTree = SDKROOT; };
B530F627144DEF1400A9CBAF /* SystemConfiguration.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SystemConfiguration.framework; path = System/Library/Frameworks/SystemConfiguration.framework; sourceTree = SDKROOT; };
B530F62D144DF8A200A9CBAF /* LeaderboardTableViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LeaderboardTableViewController.h; sourceTree = "<group>"; };
B530F62E144DF8A200A9CBAF /* LeaderboardTableViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LeaderboardTableViewController.m; sourceTree = "<group>"; };
B530F630144E05FC00A9CBAF /* RewardsTableViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RewardsTableViewController.h; sourceTree = "<group>"; };
B530F631144E05FC00A9CBAF /* RewardsTableViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RewardsTableViewController.m; sourceTree = "<group>"; };
B551B25417E7AAAE009B5199 /* Security.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Security.framework; path = System/Library/Frameworks/Security.framework; sourceTree = SDKROOT; };
- B59175B317F66EC90030009E /* PTSDK.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = PTSDK.framework; path = ../PTSDK.framework; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
@@ -54,10 +54,10 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
+ B50B7C9E17FDF2C9008D4EB9 /* QuartzCore.framework in Frameworks */,
B551B25517E7AAAE009B5199 /* Security.framework in Frameworks */,
B551B25317E7AAA9009B5199 /* CoreGraphics.framework in Frameworks */,
- B5D9865D14E5DA6C000EE30A /* QuartzCore.framework in Frameworks */,
- B59175B417F66EC90030009E /* PTSDK.framework in Frameworks */,
+ B50B7C9C17FDF294008D4EB9 /* PTSDK.framework in Frameworks */,
B530F603144DEB4300A9CBAF /* UIKit.framework in Frameworks */,
B530F605144DEB4300A9CBAF /* Foundation.framework in Frameworks */,
);
@@ -86,12 +86,12 @@
B530F601144DEB4300A9CBAF /* Frameworks */ = {
isa = PBXGroup;
children = (
- B59175B317F66EC90030009E /* PTSDK.framework */,
+ B50B7C9D17FDF2C9008D4EB9 /* QuartzCore.framework */,
+ B50B7C9B17FDF294008D4EB9 /* PTSDK.framework */,
B551B25417E7AAAE009B5199 /* Security.framework */,
B530F623144DEF1400A9CBAF /* CFNetwork.framework */,
B530F624144DEF1400A9CBAF /* libz.dylib */,
B530F625144DEF1400A9CBAF /* MobileCoreServices.framework */,
- B530F626144DEF1400A9CBAF /* QuartzCore.framework */,
B530F627144DEF1400A9CBAF /* SystemConfiguration.framework */,
B530F602144DEB4300A9CBAF /* UIKit.framework */,
B530F604144DEB4300A9CBAF /* Foundation.framework */,
@@ -290,15 +290,13 @@
"$(inherited)",
"/Users/ben/Projects/tmp/PTSDK/DerivedData/Build/Products/Debug-iphonesimulator",
"/Users/ben/Projects/punchtab-ios-sdk",
+ "/Users/ben/Projects/punchtab-ios-sdk/Framework+Dependencies",
);
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "PTTest/PTTest-Prefix.pch";
INFOPLIST_FILE = "PTTest/PTTest-Info.plist";
LIBRARY_SEARCH_PATHS = "$(inherited)";
- OTHER_LDFLAGS = (
- "-ObjC",
- "-all_load",
- );
+ OTHER_LDFLAGS = "$(inherited)";
PRODUCT_NAME = "$(TARGET_NAME)";
WRAPPER_EXTENSION = app;
};
@@ -312,15 +310,13 @@
"$(inherited)",
"/Users/ben/Projects/tmp/PTSDK/DerivedData/Build/Products/Debug-iphonesimulator",
"/Users/ben/Projects/punchtab-ios-sdk",
+ "/Users/ben/Projects/punchtab-ios-sdk/Framework+Dependencies",
);
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "PTTest/PTTest-Prefix.pch";
INFOPLIST_FILE = "PTTest/PTTest-Info.plist";
LIBRARY_SEARCH_PATHS = "$(inherited)";
- OTHER_LDFLAGS = (
- "-ObjC",
- "-all_load",
- );
+ OTHER_LDFLAGS = "$(inherited)";
PRODUCT_NAME = "$(TARGET_NAME)";
WRAPPER_EXTENSION = app;
};
View
3  PTTest/PTTest/AppDelegate.m
@@ -30,8 +30,7 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(
//OR to use SSO, use this INSTEAD
#warning "You must fill in your client details here"
-// self.ptController = [[PTController alloc] initWithClientId:@"Your Client ID" domainName:@"http://www.yourdomain.com" accessKey:@"Your access key" secretKey:@"Your secret key"];
- self.ptController = [[PTController alloc] initWithClientId:@"1113066868" domainName:@"http://mobile.punchtab.com" accessKey:@"c7256286238e3f6a602db260302f7d03" secretKey:@"69675a827bfc8cec8135bf1a7cd8e0f2"];
+ self.ptController = [[PTController alloc] initWithClientId:@"Your Client ID" domainName:@"http://www.yourdomain.com" accessKey:@"Your access key" secretKey:@"Your secret key"];
self.viewController.ptController = _ptController;
View
7 PTTest/PTTest/MainViewController.m
@@ -98,19 +98,12 @@ - (void)loginButtonPressed:(id)sender
}];
*/
- [_ptController loginWithUserId:@"bgn+ssotest@punchtab.com" firstName:@"Ben" lastName:@"Nichols" block:^(BOOL success, id response) {
- // [controller loginBlock:^(BOOL success, id response) {
- if (success)
- [self setLoggedInState];
- }];
- /*
//Login with SSO
[_ptController loginWithUserId:@"user id" firstName:@"First name" lastName:@"last name" block:^(BOOL success, id response) {
if (success) {
[self setLoggedInState];
}
}];
- */
}
- (IBAction)logoutButtonPressed:(id)sender
View
8 readme.md
@@ -9,13 +9,11 @@ Note: Version 2.x of the SDK requires you to target iOS 5.0+ as it uses ARC and
##Integrating the PunchTab SDK into your project
1. Go to <http://www.github.com/PunchTab/punchtab-ios-sdk> and either download the package, or clone the git repository.
-2. Include the libPTSDK.a library and the PTController.h header in your project.
-3. The requires additional frameworks. Go to your project's **Build Phases** and choose **Link Binaries With Libraries** Add these frameworks, along with the **libPTSDK.a**:
+2. Include the PTSDK.framework in your project.
+3. If you are going to be creating your own network stack with AFNetworking or JSONKit, please use the framework in the base directory. You must include these dependencies (AFNetworking and JSONKit) in your project either manually or with Cocoapods. If you want us to handle the dependencies for you, use the framework in the Framework+Dependencies directory.
+3. The PTSDK framework requires additional frameworks. Go to your project's **Build Phases** and choose **Link Binaries With Libraries** Add these frameworks:
* QuartzCore
-4. Finally, make sure you have *"-ObjC -all_load"* to your "Other linker flags" in your build settings.
-![Frameworks](http://punchtab.github.com/punchtab-ios-sdk/linker.jpg)
-
##SDK Usage
Before you get started, you'll need to get a Client ID from [punchtab.com](http://www.punchtab.com)
Please sign in to comment.
Something went wrong with that request. Please try again.