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

Commit d184fa5

Browse files
authored
Feature/si 92 fix (#29)
* Adding headers for initWithApiKey back in. * adding back in implementation of initWithApiKey * prepare for 4.0.1
1 parent 5388f34 commit d184fa5

File tree

5 files changed

+86
-39
lines changed

5 files changed

+86
-39
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,11 @@ This project adheres to [Semantic Versioning](http://semver.org/).
1515
#### Fixed
1616
- nothing yet
1717

18+
## [4.0.1](https://github.com/Iterable/iterable-ios-sdk/releases/tag/4.0.1)
19+
#### Added
20+
- added back in `initWithApiKey`
21+
22+
1823
## [4.0.0](https://github.com/Iterable/iterable-ios-sdk/releases/tag/4.0.0)
1924
#### Added
2025
- added `userId` property

Iterable-iOS-SDK/IterableAPI.h

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,56 @@ typedef NS_ENUM(NSInteger, PushServicePlatform) {
6666
/// @name Creating an IterableAPI
6767
/////////////////////////////////
6868

69+
/*!
70+
@method
71+
72+
@abstract Initializes Iterable with just an API key and email, but no launchOptions
73+
74+
@param apiKey your Iterable apiKey
75+
@param email the email of the user logged in
76+
77+
@return an instance of IterableAPI
78+
*/
79+
- (instancetype) initWithApiKey:(NSString *)apiKey andEmail:(NSString *) email;
80+
81+
/*!
82+
@method
83+
84+
@abstract Initializes Iterable with launchOptions
85+
86+
@param apiKey your Iterable apiKey
87+
@param email the email of the user logged in
88+
@param launchOptions launchOptions from application:didFinishLaunchingWithOptions
89+
90+
@return an instance of IterableAPI
91+
*/
92+
- (instancetype) initWithApiKey:(NSString *)apiKey andEmail:(NSString *)email launchOptions:(nullable NSDictionary *)launchOptions;
93+
94+
/*!
95+
@method
96+
97+
@abstract Initializes Iterable with just an API key and email, but no launchOptions
98+
99+
@param apiKey your Iterable apiKey
100+
@param userId the userId of the user logged in
101+
102+
@return an instance of IterableAPI
103+
*/
104+
- (instancetype) initWithApiKey:(NSString *)apiKey andUserId:(NSString *) userId;
105+
106+
/*!
107+
@method
108+
109+
@abstract Initializes Iterable with launchOptions
110+
111+
@param apiKey your Iterable apiKey
112+
@param userId the userId of the user logged in
113+
@param launchOptions launchOptions from application:didFinishLaunchingWithOptions
114+
115+
@return an instance of IterableAPI
116+
*/
117+
- (instancetype) initWithApiKey:(NSString *)apiKey andUserId:(NSString *)userId launchOptions:(nullable NSDictionary *)launchOptions;
118+
69119
/*!
70120
@method
71121

Iterable-iOS-SDK/IterableAPI.m

Lines changed: 29 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -253,14 +253,31 @@ + (OnFailureHandler)defaultOnFailure:(NSString *)identifier
253253
/*!
254254
@method
255255
256-
@abstract Initializes Iterable with launchOptions
256+
@abstract creates an iterable session with launchOptions
257257
258-
@param apiKey your Iterable apiKey
259-
@param email the email of the user logged in
260258
@param launchOptions launchOptions from application:didFinishLaunchingWithOptions
261259
262260
@return an instance of IterableAPI
263261
*/
262+
- (instancetype)createSession:(NSDictionary *)launchOptions
263+
{
264+
// the url session doesn't depend on any options/params, so we'll use a singleton that gets created whenever the class is instantiated
265+
// if it gets instantiated again that's fine; we don't need to reconfigure the session, just keep using the old singleton
266+
[self createUrlSession];
267+
268+
if (launchOptions && launchOptions[UIApplicationLaunchOptionsRemoteNotificationKey]) {
269+
// Automatically try to track a pushOpen
270+
[self trackPushOpen:launchOptions[UIApplicationLaunchOptionsRemoteNotificationKey]];
271+
}
272+
273+
return self;
274+
}
275+
276+
//////////////////////////////////////////////////////////////
277+
/// @name Implementations of things documents in IterableAPI.h
278+
//////////////////////////////////////////////////////////////
279+
280+
// documented in IterableAPI.h
264281
- (instancetype)initWithApiKey:(NSString *)apiKey andEmail:(NSString *)email launchOptions:(NSDictionary *)launchOptions
265282
{
266283
if (self = [super init]) {
@@ -271,17 +288,7 @@ - (instancetype)initWithApiKey:(NSString *)apiKey andEmail:(NSString *)email lau
271288
return [self createSession:launchOptions];
272289
}
273290

274-
/*!
275-
@method
276-
277-
@abstract Initializes Iterable with launchOptions
278-
279-
@param apiKey your Iterable apiKey
280-
@param userId the userId of the user logged in
281-
@param launchOptions launchOptions from application:didFinishLaunchingWithOptions
282-
283-
@return an instance of IterableAPI
284-
*/
291+
// documented in IterableAPI.h
285292
- (instancetype)initWithApiKey:(NSString *)apiKey andUserId:(NSString *)userId launchOptions:(NSDictionary *)launchOptions
286293
{
287294
if (self = [super init]) {
@@ -291,32 +298,17 @@ - (instancetype)initWithApiKey:(NSString *)apiKey andUserId:(NSString *)userId l
291298
return [self createSession:launchOptions];
292299
}
293300

294-
/*!
295-
@method
296-
297-
@abstract creates an iterable session with launchOptions
298-
299-
@param launchOptions launchOptions from application:didFinishLaunchingWithOptions
300-
301-
@return an instance of IterableAPI
302-
*/
303-
- (instancetype)createSession:(NSDictionary *)launchOptions
301+
// documented in IterableAPI.h
302+
- (instancetype)initWithApiKey:(NSString *)apiKey andEmail:(NSString *)email
304303
{
305-
// the url session doesn't depend on any options/params, so we'll use a singleton that gets created whenever the class is instantiated
306-
// if it gets instantiated again that's fine; we don't need to reconfigure the session, just keep using the old singleton
307-
[self createUrlSession];
308-
309-
if (launchOptions && launchOptions[UIApplicationLaunchOptionsRemoteNotificationKey]) {
310-
// Automatically try to track a pushOpen
311-
[self trackPushOpen:launchOptions[UIApplicationLaunchOptionsRemoteNotificationKey]];
312-
}
313-
314-
return self;
304+
return [self initWithApiKey:apiKey andEmail:email launchOptions:nil];
315305
}
316306

317-
//////////////////////////////////////////////////////////////
318-
/// @name Implementations of things documents in IterableAPI.h
319-
//////////////////////////////////////////////////////////////
307+
// documented in IterableAPI.h
308+
- (instancetype)initWithApiKey:(NSString *)apiKey andUserId:(NSString *)userId
309+
{
310+
return [self initWithApiKey:apiKey andUserId:userId launchOptions:nil];
311+
}
320312

321313
// documented in IterableAPI.h
322314
+ (IterableAPI *)sharedInstance

IterableSDK.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ Pod::Spec.new do |s|
1616
#
1717

1818
s.name = "IterableSDK"
19-
s.version = "4.0.0"
19+
s.version = "4.0.1"
2020
s.summary = "Iterable's official SDK for iOS"
2121

2222
s.description = <<-DESC

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[![CocoaPods](https://img.shields.io/cocoapods/v/IterableSDK.svg?style=flat)](https://cocoapods.org/pods/IterableSDK)
22
[![License](https://img.shields.io/cocoapods/l/IterableSDK.svg?style=flat)](https://opensource.org/licenses/MIT)
3-
[![Docs](https://img.shields.io/cocoapods/metrics/doc-percent/IterableSDK.svg?style=flat)](http://cocoadocs.org/docsets/IterableSDK/4.0.0/)
3+
[![Docs](https://img.shields.io/cocoapods/metrics/doc-percent/IterableSDK.svg?style=flat)](http://cocoadocs.org/docsets/IterableSDK/4.0.1/)
44

55
# Iterable iOS SDK
66

0 commit comments

Comments
 (0)