Skip to content

Commit a23bfb5

Browse files
Release 12.1.0
1 parent 9a1ce54 commit a23bfb5

File tree

34 files changed

+355
-188
lines changed

34 files changed

+355
-188
lines changed

CHANGELOG.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,15 @@
1+
## 12.1.0
2+
###### Release Date: 31-3-2022
3+
4+
### 🚀 Enhancements
5+
* We've renamed some of our API methods. The term register has been replaced with login. As part of this change, we've also added success and failure callbacks to the updated login methods. For more information on the deprecated methods and their replacements, please read our [docs](https://developers.intercom.com/installing-intercom/docs/intercom-for-ios)
6+
* Added support to connect to Intercom workspaces that are hosted on servers in our Australian region
7+
8+
### NOTE
9+
* The underlaying functionality behind these new methods remains the same as the deprecated ones, but now you can take action on success or failure.
10+
11+
Check out [release v12.0.0](https://github.com/intercom/intercom-ios/releases/tag/12.0.0) for details about Intercom's great new Surveys feature.
12+
113
## 12.0.0
214
###### Release Date: 23-03-2022
315

Intercom.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Pod::Spec.new do |s|
22
s.name = 'Intercom'
3-
s.version = '12.0.0'
3+
s.version = '12.1.0'
44
s.summary = 'The Intercom iOS SDK, for integrating Intercom into your iOS application.'
55
s.license = { :type => "Apache 2.0", :file => "LICENSE" }
66
s.authors = {"Brian Boyle"=>"[email protected]", "Mike McNamara"=>"[email protected]", "Katherine Brennan"=>"[email protected]", "Himanshi Goyal"=>"[email protected]", "Niamh Coleman"=>"[email protected]"}

Intercom.xcframework/ios-arm64/Intercom.framework/Headers/ICMHTTPClient.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222

2323
#pragma mark - Push Notification Tokens
2424

25-
+ (void)submitDeviceToken;
25+
+ (void)submitDeviceTokenWithFailure:(void(^)(NSError *error))failure;
2626
+ (void)deleteDeviceToken:(NSString *)deviceTokenString
2727
forUserIdentity:(ICMUserIdentity *)userIdentity
2828
completion:(ICMHTTPEmptyBlock)completion;

Intercom.xcframework/ios-arm64/Intercom.framework/Headers/ICMUserAttributes.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,4 +101,9 @@
101101
*/
102102
- (nonnull NSDictionary<NSString *, id> *)attributes;
103103

104+
/**
105+
A dictionary representation for the user attributes formatted for registration.
106+
*/
107+
- (nonnull NSDictionary<NSNumber *, NSString *> *)registrationAttributes;
108+
104109
@end
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
//
2+
// ICMUserAttributesValidation.h
3+
// Pods
4+
//
5+
// Created by James Treanor on 17/02/2017.
6+
//
7+
//
8+
#import <Foundation/Foundation.h>
9+
10+
NS_ASSUME_NONNULL_BEGIN
11+
12+
@class ICMCompany;
13+
14+
@interface ICMUserAttributesValidation : NSObject
15+
16+
+ (BOOL)validateNonEmptyString:(NSString *)value forKey:(NSString *)key;
17+
+ (BOOL)validateDate:(NSDate *)value forKey:(NSString *)key;
18+
+ (BOOL)validateNumber:(NSNumber *)value forKey:(NSString *)key;
19+
+ (BOOL)validateCompanies:(NSArray<ICMCompany *> *)companies forKey:(NSString *)key;
20+
+ (BOOL)validateCustomAttributes:(NSDictionary<NSString *, id> *)customAttributes forKey:(NSString *)key;
21+
22+
+ (NSDictionary<NSString *, id> *)replaceNullAttributesAttributesWithNSNull:(NSDictionary<NSString *, id> *)customAttributes;
23+
24+
+ (NSString *)nullStringAttribute;
25+
+ (NSNumber *)nullNumberAttribute;
26+
+ (NSDate *)nullDateAttribute;
27+
28+
@end
29+
30+
NS_ASSUME_NONNULL_END

Intercom.xcframework/ios-arm64/Intercom.framework/Headers/ICMUtils.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@
2323

2424
#define run_or_dispatch_main(block) if ([NSThread isMainThread]) { block(); } else { dispatch_async(dispatch_get_main_queue(), block); }
2525

26+
#define block_exec(block, ...) if (block) { block(__VA_ARGS__); };
27+
2628
#define WEAK_TYPE(x) __weak __typeof(x)
2729
#define STRONG_TYPE(x) __strong __typeof(x)
2830

Intercom.xcframework/ios-arm64/Intercom.framework/Headers/Intercom-Swift.h

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -329,6 +329,20 @@ SWIFT_CLASS("_TtC8Intercom16EmojiImageButton")
329329
- (nonnull instancetype)initWithFrame:(CGRect)frame SWIFT_UNAVAILABLE;
330330
@end
331331

332+
@class NSError;
333+
334+
SWIFT_CLASS("_TtC8Intercom14ErrorProcessor")
335+
@interface ErrorProcessor : NSObject
336+
+ (NSError * _Nonnull)generateHTTPErrorWithCode:(NSInteger)code message:(NSString * _Nonnull)message SWIFT_WARN_UNUSED_RESULT;
337+
+ (NSError * _Nonnull)generateInvalidUserIdOrEmailError SWIFT_WARN_UNUSED_RESULT;
338+
+ (NSError * _Nonnull)generateInvalidUpdateObjectError SWIFT_WARN_UNUSED_RESULT;
339+
+ (NSError * _Nonnull)generatePushNotificationsNotEnabledError SWIFT_WARN_UNUSED_RESULT;
340+
+ (NSError * _Nonnull)generatePushNotificationNilDeviceTokenError SWIFT_WARN_UNUSED_RESULT;
341+
+ (NSError * _Nonnull)generateInvalidIdentityVerificationError SWIFT_WARN_UNUSED_RESULT;
342+
+ (NSError * _Nonnull)generateInvalidDeviceTokenError SWIFT_WARN_UNUSED_RESULT;
343+
- (nonnull instancetype)init OBJC_DESIGNATED_INITIALIZER;
344+
@end
345+
332346

333347
SWIFT_CLASS("_TtC8Intercom26HelpCenterArticle_Internal")
334348
@interface HelpCenterArticle_Internal : NSObject

Intercom.xcframework/ios-arm64/Intercom.framework/Headers/Intercom.h

Lines changed: 68 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
#import <Foundation/Foundation.h>
1010
#import <UIKit/UIKit.h>
1111
#import <Intercom/ICMUserAttributes.h>
12+
#import <Intercom/ICMUserAttributesValidation.h>
13+
#import <Intercom/ICMCompany.h>
1214
#import <Intercom/ICMHelpCenterCollection.h>
1315
#import <Intercom/ICMHelpCenterSection.h>
1416
#import <Intercom/ICMHelpCenterArticle.h>
@@ -84,61 +86,6 @@
8486

8587
NS_ASSUME_NONNULL_BEGIN
8688

87-
/**
88-
Intercom is your direct line of communication to every user, right inside your app. Intercom’s in-app messages
89-
are up to 10 times more effective than email too! Send the right messages, to the right users, at exactly the right time.
90-
91-
## How do I track my users?
92-
93-
In order to see your users in Intercom's user list, you must first register them via your iOS application. If you have a
94-
place in your application where you become aware of the user's identity such as a log in view controller, call one of the
95-
following depending on the information you have available for that user:
96-
97-
If you have both a unique user identifier and an email for your users::
98-
99-
[Intercom registerUserWithUserId:@"123456" email:@"[email protected]"];
100-
101-
If you only have a unique identifier for your users:
102-
103-
[Intercom registerUserWithUserId:@"123456"];
104-
105-
Finally, if you only have an email address for your users:
106-
107-
[Intercom registerUserWithEmail:@"[email protected]"];
108-
109-
## Can I track unidentified users?
110-
111-
Yes, absolutely. If you have an application that doesn't require users to log in, you can call:
112-
113-
[Intercom registerUnidentifiedUser];
114-
115-
If the user subsequently logs in or you learn additional information about them (e.g. get an email address),
116-
calling any of the other user registration methods will update that user's identity in Intercom and contain
117-
all user data tracked previously.
118-
119-
## How do push notifications work?
120-
121-
Intercom for iOS enables your users to receive push notifications for new messages. Simply call:
122-
123-
- (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken {
124-
[Intercom setDeviceToken:deviceToken];
125-
}
126-
127-
in your `didRegisterForRemoteNotificationsWithDeviceToken:` method once you have registered your app for
128-
push notifications with the `UIApplicationDelegate`.
129-
130-
When your app receives a push notification Intercom for iOS checks to see if it is an Intercom push notification
131-
and opens the message. You do not need to implement any additional code in order to launch the message window.
132-
133-
To do this we [safely swizzle](http://blog.newrelic.com/2014/04/16/right-way-to-swizzle/) the public methods
134-
in `UIApplicationDelegate` that handle receiving push notifications. We do not use any private APIs to do this.
135-
136-
## More information
137-
138-
Full documentation is available [here](https://developers.intercom.com/docs/ios-installation ) and please contact
139-
us directly via Intercom for any support or questions you may have.
140-
141-
*/
14289
@interface Intercom : NSObject
14390

14491
#pragma mark - Intercom Initialisation
@@ -165,70 +112,94 @@ NS_ASSUME_NONNULL_BEGIN
165112
and which can store a secret. More information on Identity Verification can be found [here](https://developers.intercom.com/docs/ios-identity-verification)
166113
167114
168-
@note This should be called before any user registration takes place.
115+
@note This should be called before any user login takes place.
169116
@param userHash A HMAC digest of the user ID or email.
170117
*/
171118
+ (void)setUserHash:(NSString *)userHash;
172119

173-
#pragma mark - User Registration
120+
#pragma mark - User Login
174121

175122
//=========================================================================================================
176123
/*! @name Working with anonymous users */
177124
//=========================================================================================================
125+
/*!
126+
If you call loginUnidentifiedUserWithSuccess:failure:, all activity will be tracked anonymously. If you choose to
127+
subsequently identify that user, all that anonymous activity will be merged into the identified user. This means that
128+
you will no longer see the anonymous user in Intercom, but rather the identified one.
129+
130+
We recommend this is called from within the application delegate's didFinishLaunchingWithOptions: method.
131+
@param success A nullable success callback with no parameters.
132+
@param failure A failure callback with an error parameter.
133+
@note You must call one of the user login methods in order to start communicating with Intercom.
134+
*/
135+
+ (void)loginUnidentifiedUserWithSuccess:(void(^ __nullable)(void))success failure:(void(^ __nullable)(NSError *_Nonnull error))failure NS_REFINED_FOR_SWIFT;
136+
178137
/*!
179138
If you call registerUnidentifiedUser, all activity will be tracked anonymously. If you choose to subsequently
180139
identify that user, all that anonymous activity will be merged into the identified user. This means that you
181140
will no longer see the anonymous user in Intercom, but rather the identified one.
182141
183142
We recommend this is called from within the application delegate's didFinishLaunchingWithOptions: method.
184143
185-
@note You must call one of the user registration methods in order to start communicating with Intercom.
144+
@note You must call one of the user login methods in order to start communicating with Intercom.
186145
*/
187-
+ (void)registerUnidentifiedUser;
146+
+ (void)registerUnidentifiedUser __attribute((deprecated("'+[Intercom registerUnidentifiedUser]' is deprecated. 'Use +[Intercom loginUnidentifiedUserWithSuccess:failure:]' instead.")));
188147

189148
//=========================================================================================================
190149
/*! @name Working with identified users */
191150
//=========================================================================================================
192151
/*!
193-
In order to keep track of a specific user, you must identify it with a unique user identifier, an email
194-
address, or both. By supplying information like this Intercom provides richer user profiles for your users.
195-
This is a userId, supplied by you (e.g. from an existing web service for your product) to represent your
196-
user in Intercom, once set it cannot be changed.
152+
In order to keep track of a specific user, you must identify it with a unique user identity, an email
153+
address, or both. To provide these, you must first create a new `ICMUserAttributes` object and then populate
154+
the `email` and/or `userId` properties for that object. This is a userId, supplied by you (e.g. from an
155+
existing web service for your product) to represent your user in Intercom, once set it cannot be changed.
156+
157+
As well as the `email` and `userId` fields, you can populate the other user attribute fields within
158+
`ICMUserAttributes` when you login as an identified user. By supplying information like this, Intercom
159+
provides richer user profiles for your users.
197160
198161
If you are putting Intercom for iOS into an app that has persisted an authentication token or equivalent
199-
so your users don't have to log in repeatedly (like most apps) then we advise putting the user registration
162+
so your users don't have to log in repeatedly (like most apps) then we advise putting the user login
200163
call in the `didBecomeActive:` method in your application delegate. This won't have any negative impact if
201164
you also add it to your authentication success method elsewhere in your app.
202165
203-
@param userId A unique identifier for your user.
204-
@param email Your user's email address.
205-
@note You must call one of the user registration methods in order to start communicating with Intercom.
166+
@param userAttributes An `ICMUserAttributes` object. Either or both `email` and `userId` properties must be populated.
167+
@param success A nullable success callback with no parameters.
168+
@param failure A failure callback with an error parameter.
206169
*/
207-
+ (void)registerUserWithUserId:(NSString *)userId email:(NSString *)email;
170+
+ (void)loginUserWithUserAttributes:(ICMUserAttributes *)userAttributes success:(void(^ __nullable)(void))success failure:(void(^ __nullable)(NSError *_Nonnull error))failure NS_REFINED_FOR_SWIFT;
208171

209172
/*!
210-
Register a user just with their userId.
173+
Login as a user just with their userId and email.
174+
175+
@param userId A unique identifier for your user.
176+
@param email Your user's email address.
177+
@note You must call one of the user registration methods in order to start communicating with Intercom.
178+
*/
179+
+ (void)registerUserWithUserId:(NSString *)userId email:(NSString *)email __attribute((deprecated("'+[Intercom registerUserWithUserId:email:]' is deprecated. 'Use +[Intercom loginUserWithUserAttributes:success:failure:]' instead.")));
211180

181+
/*!
182+
Login as a user just with their userId.
212183
@param userId A unique identifier for your user.
213184
@note You must call one of the user registration methods in order to start communicating with Intercom.
214185
*/
215-
+ (void)registerUserWithUserId:(NSString *)userId;
186+
+ (void)registerUserWithUserId:(NSString *)userId __attribute((deprecated("'+[Intercom registerUserWithUserId:]' is deprecated. 'Use +[Intercom loginUserWithUserAttributes:success:failure:]' instead.")));
216187

217188
/*!
218-
Register a user with just their email address.
189+
Login as a user with just their email address.
219190
220191
@param email Your user's email address.
221192
@note You must call one of the user registration methods in order to start communicating with Intercom.
222193
*/
223-
+ (void)registerUserWithEmail:(NSString *)email;
194+
+ (void)registerUserWithEmail:(NSString *)email __attribute((deprecated("'+[Intercom registerUserWithEmail:]' is deprecated. 'Use +[Intercom loginUserWithUserAttributes:success:failure:]' instead.")));
224195

225196
//=========================================================================================================
226197
/*! @name Logging the user out */
227198
//=========================================================================================================
228199
/*!
229200
logout is used to clear all local caches and user data Intercom has created. Logout will also close any active
230201
UI that is on screen. Use this at a time when you wish to log a user out of your app or change a user.
231-
Once called, Intercom for iOS will no longer communicate with Intercom until a further registration is made.
202+
Once called, Intercom for iOS will no longer communicate with Intercom until a further login is made.
232203
*/
233204
+ (void)logout;
234205

@@ -240,6 +211,19 @@ NS_ASSUME_NONNULL_BEGIN
240211
//=========================================================================================================
241212
/** @name Updating the user */
242213
//=========================================================================================================
214+
/*!
215+
You can send any data you like to Intercom. Typically our customers see a lot of value in sending data that
216+
relates to customer development, such as price plan, value of purchases, etc. Once these have been sent to
217+
Intercom you can then apply filters based on these attributes.
218+
219+
Details on attributes available to update can be found in ICMUserAttributes.
220+
221+
@param userAttributes The attributes to update the user with.
222+
@param success A nullable success callback with no parameters.
223+
@param failure A failure callback with an error parameter.
224+
*/
225+
+ (void)updateUser:(ICMUserAttributes *)userAttributes success:(void(^ __nullable)(void))success failure:(void(^ __nullable)(NSError *_Nonnull error))failure NS_REFINED_FOR_SWIFT;
226+
243227
/*!
244228
You can send any data you like to Intercom. Typically our customers see a lot of value in sending data that
245229
relates to customer development, such as price plan, value of purchases, etc. Once these have been sent to
@@ -249,7 +233,7 @@ NS_ASSUME_NONNULL_BEGIN
249233
250234
@param userAttributes The attributes to update the user with.
251235
*/
252-
+ (void)updateUser:(ICMUserAttributes *)userAttributes;
236+
+ (void)updateUser:(ICMUserAttributes *)userAttributes __attribute((deprecated("'+[Intercom updateUser:]' is deprecated. 'Use +[Intercom updateUser:success:failure:]' instead.")));
253237

254238
#pragma mark - Log Event
255239

@@ -373,14 +357,23 @@ NS_ASSUME_NONNULL_BEGIN
373357
//=========================================================================================================
374358
/*! @name Working with push notifications */
375359
//=========================================================================================================
360+
/*!
361+
Set the device token for push notifications. Once the device token is set, the methods for receiving push
362+
notifications are safely swizzled so ones sent from Intercom can be intercepted. When a push notification from
363+
Intercom is received, Intercom for iOS will automatically launch the message from the notification.
364+
@param deviceToken The device token provided in the `didRegisterForRemoteNotificationsWithDeviceToken` method.
365+
@param failure A failure callback with an error parameter.
366+
*/
367+
+ (void)setDeviceToken:(NSData *)deviceToken failure:(void(^ __nullable)(NSError * _Nullable error))failure;
368+
376369
/*!
377370
Set the device token for push notifications. Once the device token is set, the methods for receiving push
378371
notifications are safely swizzled so ones sent from Intercom can be intercepted. When a push notification from
379372
Intercom is received, Intercom for iOS will automatically launch the message from the notification.
380373
381374
@param deviceToken The device token provided in the `didRegisterForRemoteNotificationsWithDeviceToken` method.
382375
*/
383-
+ (void)setDeviceToken:(NSData *)deviceToken;
376+
+ (void)setDeviceToken:(NSData *)deviceToken __attribute((deprecated("'+[Intercom setDeviceToken:]' is deprecated. 'Use +[Intercom setDeviceToken:failure:]' instead.")));
384377

385378
/*!
386379
Use this method to check if a push notification payload was sent by Intercom. Typically you should call
0 Bytes
Binary file not shown.
97.1 KB
Binary file not shown.

0 commit comments

Comments
 (0)