Skip to content
This repository has been archived by the owner on Jul 22, 2020. It is now read-only.

Commit

Permalink
Feature/si 92 fix (#29)
Browse files Browse the repository at this point in the history
* Adding headers for initWithApiKey back in.

* adding back in implementation of initWithApiKey

* prepare for 4.0.1
  • Loading branch information
davidtruong authored Oct 14, 2016
1 parent 5388f34 commit d184fa5
Show file tree
Hide file tree
Showing 5 changed files with 86 additions and 39 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@ This project adheres to [Semantic Versioning](http://semver.org/).
#### Fixed
- nothing yet

## [4.0.1](https://github.com/Iterable/iterable-ios-sdk/releases/tag/4.0.1)
#### Added
- added back in `initWithApiKey`


## [4.0.0](https://github.com/Iterable/iterable-ios-sdk/releases/tag/4.0.0)
#### Added
- added `userId` property
Expand Down
50 changes: 50 additions & 0 deletions Iterable-iOS-SDK/IterableAPI.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,56 @@ typedef NS_ENUM(NSInteger, PushServicePlatform) {
/// @name Creating an IterableAPI
/////////////////////////////////

/*!
@method
@abstract Initializes Iterable with just an API key and email, but no launchOptions
@param apiKey your Iterable apiKey
@param email the email of the user logged in
@return an instance of IterableAPI
*/
- (instancetype) initWithApiKey:(NSString *)apiKey andEmail:(NSString *) email;

/*!
@method
@abstract Initializes Iterable with launchOptions
@param apiKey your Iterable apiKey
@param email the email of the user logged in
@param launchOptions launchOptions from application:didFinishLaunchingWithOptions
@return an instance of IterableAPI
*/
- (instancetype) initWithApiKey:(NSString *)apiKey andEmail:(NSString *)email launchOptions:(nullable NSDictionary *)launchOptions;

/*!
@method
@abstract Initializes Iterable with just an API key and email, but no launchOptions
@param apiKey your Iterable apiKey
@param userId the userId of the user logged in
@return an instance of IterableAPI
*/
- (instancetype) initWithApiKey:(NSString *)apiKey andUserId:(NSString *) userId;

/*!
@method
@abstract Initializes Iterable with launchOptions
@param apiKey your Iterable apiKey
@param userId the userId of the user logged in
@param launchOptions launchOptions from application:didFinishLaunchingWithOptions
@return an instance of IterableAPI
*/
- (instancetype) initWithApiKey:(NSString *)apiKey andUserId:(NSString *)userId launchOptions:(nullable NSDictionary *)launchOptions;

/*!
@method
Expand Down
66 changes: 29 additions & 37 deletions Iterable-iOS-SDK/IterableAPI.m
Original file line number Diff line number Diff line change
Expand Up @@ -253,14 +253,31 @@ + (OnFailureHandler)defaultOnFailure:(NSString *)identifier
/*!
@method
@abstract Initializes Iterable with launchOptions
@abstract creates an iterable session with launchOptions
@param apiKey your Iterable apiKey
@param email the email of the user logged in
@param launchOptions launchOptions from application:didFinishLaunchingWithOptions
@return an instance of IterableAPI
*/
- (instancetype)createSession:(NSDictionary *)launchOptions
{
// the url session doesn't depend on any options/params, so we'll use a singleton that gets created whenever the class is instantiated
// if it gets instantiated again that's fine; we don't need to reconfigure the session, just keep using the old singleton
[self createUrlSession];

if (launchOptions && launchOptions[UIApplicationLaunchOptionsRemoteNotificationKey]) {
// Automatically try to track a pushOpen
[self trackPushOpen:launchOptions[UIApplicationLaunchOptionsRemoteNotificationKey]];
}

return self;
}

//////////////////////////////////////////////////////////////
/// @name Implementations of things documents in IterableAPI.h
//////////////////////////////////////////////////////////////

// documented in IterableAPI.h
- (instancetype)initWithApiKey:(NSString *)apiKey andEmail:(NSString *)email launchOptions:(NSDictionary *)launchOptions
{
if (self = [super init]) {
Expand All @@ -271,17 +288,7 @@ - (instancetype)initWithApiKey:(NSString *)apiKey andEmail:(NSString *)email lau
return [self createSession:launchOptions];
}

/*!
@method
@abstract Initializes Iterable with launchOptions
@param apiKey your Iterable apiKey
@param userId the userId of the user logged in
@param launchOptions launchOptions from application:didFinishLaunchingWithOptions
@return an instance of IterableAPI
*/
// documented in IterableAPI.h
- (instancetype)initWithApiKey:(NSString *)apiKey andUserId:(NSString *)userId launchOptions:(NSDictionary *)launchOptions
{
if (self = [super init]) {
Expand All @@ -291,32 +298,17 @@ - (instancetype)initWithApiKey:(NSString *)apiKey andUserId:(NSString *)userId l
return [self createSession:launchOptions];
}

/*!
@method
@abstract creates an iterable session with launchOptions
@param launchOptions launchOptions from application:didFinishLaunchingWithOptions
@return an instance of IterableAPI
*/
- (instancetype)createSession:(NSDictionary *)launchOptions
// documented in IterableAPI.h
- (instancetype)initWithApiKey:(NSString *)apiKey andEmail:(NSString *)email
{
// the url session doesn't depend on any options/params, so we'll use a singleton that gets created whenever the class is instantiated
// if it gets instantiated again that's fine; we don't need to reconfigure the session, just keep using the old singleton
[self createUrlSession];

if (launchOptions && launchOptions[UIApplicationLaunchOptionsRemoteNotificationKey]) {
// Automatically try to track a pushOpen
[self trackPushOpen:launchOptions[UIApplicationLaunchOptionsRemoteNotificationKey]];
}

return self;
return [self initWithApiKey:apiKey andEmail:email launchOptions:nil];
}

//////////////////////////////////////////////////////////////
/// @name Implementations of things documents in IterableAPI.h
//////////////////////////////////////////////////////////////
// documented in IterableAPI.h
- (instancetype)initWithApiKey:(NSString *)apiKey andUserId:(NSString *)userId
{
return [self initWithApiKey:apiKey andUserId:userId launchOptions:nil];
}

// documented in IterableAPI.h
+ (IterableAPI *)sharedInstance
Expand Down
2 changes: 1 addition & 1 deletion IterableSDK.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Pod::Spec.new do |s|
#

s.name = "IterableSDK"
s.version = "4.0.0"
s.version = "4.0.1"
s.summary = "Iterable's official SDK for iOS"

s.description = <<-DESC
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[![CocoaPods](https://img.shields.io/cocoapods/v/IterableSDK.svg?style=flat)](https://cocoapods.org/pods/IterableSDK)
[![License](https://img.shields.io/cocoapods/l/IterableSDK.svg?style=flat)](https://opensource.org/licenses/MIT)
[![Docs](https://img.shields.io/cocoapods/metrics/doc-percent/IterableSDK.svg?style=flat)](http://cocoadocs.org/docsets/IterableSDK/4.0.0/)
[![Docs](https://img.shields.io/cocoapods/metrics/doc-percent/IterableSDK.svg?style=flat)](http://cocoadocs.org/docsets/IterableSDK/4.0.1/)

# Iterable iOS SDK

Expand Down

0 comments on commit d184fa5

Please sign in to comment.