Skip to content

Commit 733da87

Browse files
authored
Merge pull request #1084 from BranchMetrics/SDK-1111
SDK-1111 support error return for latd method
2 parents 821e89f + 5202ece commit 733da87

File tree

4 files changed

+6
-6
lines changed

4 files changed

+6
-6
lines changed

Branch-SDK/Branch.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1120,7 +1120,7 @@ typedef NS_ENUM(NSUInteger, BranchCreditHistoryOrder) {
11201120
@param window attribution window in days. If the window is 0, the server will use the server side default. If the window is outside the server supported range, it will default to 30 days.
11211121
@param completion callback with attribution data
11221122
*/
1123-
- (void)lastAttributedTouchDataWithAttributionWindow:(NSInteger)window completion:(void(^) (BranchLastAttributedTouchData * _Nullable latd))completion;
1123+
- (void)lastAttributedTouchDataWithAttributionWindow:(NSInteger)window completion:(void(^) (BranchLastAttributedTouchData * _Nullable latd, NSError * _Nullable error))completion;
11241124

11251125
#pragma mark - Short Url Sync methods
11261126

Branch-SDK/Branch.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1285,7 +1285,7 @@ - (void)crossPlatformIdDataWithCompletion:(void(^) (BranchCrossPlatformID * _Nul
12851285
});
12861286
}
12871287

1288-
- (void)lastAttributedTouchDataWithAttributionWindow:(NSInteger)window completion:(void(^) (BranchLastAttributedTouchData * _Nullable latd))completion {
1288+
- (void)lastAttributedTouchDataWithAttributionWindow:(NSInteger)window completion:(void(^) (BranchLastAttributedTouchData * _Nullable latd, NSError * _Nullable error))completion {
12891289
[self initSafetyCheck];
12901290
dispatch_async(self.isolationQueue, ^(){
12911291
[BranchLastAttributedTouchData requestLastTouchAttributedData:self.serverInterface key:self.class.branchKey attributionWindow:window completion:completion];

Branch-SDK/BranchLastAttributedTouchData.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ NS_ASSUME_NONNULL_BEGIN
2020

2121
+ (nullable BranchLastAttributedTouchData *)buildFromJSON:(NSDictionary *)json;
2222

23-
+ (void)requestLastTouchAttributedData:(BNCServerInterface *)serverInterface key:(NSString *)key attributionWindow:(NSInteger)window completion:(void(^) (BranchLastAttributedTouchData *latd))completion;
23+
+ (void)requestLastTouchAttributedData:(BNCServerInterface *)serverInterface key:(NSString *)key attributionWindow:(NSInteger)window completion:(void(^) (BranchLastAttributedTouchData *latd, NSError *error))completion;
2424

2525
@end
2626

Branch-SDK/BranchLastAttributedTouchData.m

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ + (BranchLastAttributedTouchData *)buildFromJSON:(NSDictionary *)json {
2626
return nil;
2727
}
2828

29-
+ (void)requestLastTouchAttributedData:(BNCServerInterface *)serverInterface key:(NSString *)key attributionWindow:(NSInteger)window completion:(void(^) (BranchLastAttributedTouchData *latd))completion {
29+
+ (void)requestLastTouchAttributedData:(BNCServerInterface *)serverInterface key:(NSString *)key attributionWindow:(NSInteger)window completion:(void (^)(BranchLastAttributedTouchData *__nullable latd, NSError *__nullable error))completion {
3030
BranchLATDRequest *request = [BranchLATDRequest new];
3131

3232
// Limit attribution range to about a year. Although the server only supports up to 90 days as of Nov. 2019, it will fail gracefully for higher values.
@@ -41,14 +41,14 @@ + (void)requestLastTouchAttributedData:(BNCServerInterface *)serverInterface key
4141
// error is logged by the network service, skip parsing on error
4242
if (error) {
4343
if (completion) {
44-
completion(nil);
44+
completion(nil, error);
4545
}
4646
return;
4747
}
4848

4949
BranchLastAttributedTouchData *latd = [self buildFromJSON:response.data];
5050
if (completion) {
51-
completion(latd);
51+
completion(latd, error);
5252
}
5353
}];
5454
}

0 commit comments

Comments
 (0)