Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Sources/BranchSDK/BNCODMInfoCollector.m
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ typedef NS_ENUM(NSInteger, ODCInteractionType) {
};

[invocation setArgument:&_odmFetchCompletion atIndex:3];
[invocation retainArguments];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this needed because ODM info goes out of scope and garbage collected?

[invocation invoke];
[[BranchLogger shared] logDebug:[NSString stringWithFormat:@"fetchInfo:completion: invoked successfully."] error:nil];

Expand Down
6 changes: 6 additions & 0 deletions Sources/BranchSDK/Branch.m
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,7 @@ - (id)initWithInterface:(BNCServerInterface *)interface
}

static Class bnc_networkServiceClass = NULL;
static callbackForTracingRequests bnc_tracingCallback = nil;

+ (void)setNetworkServiceClass:(Class)networkServiceClass {
@synchronized ([Branch class]) {
Expand Down Expand Up @@ -706,6 +707,10 @@ - (void)initSessionWithLaunchOptions:(NSDictionary *)options automaticallyDispla
[self initSessionWithLaunchOptions:options isReferrable:isReferrable explicitlyRequestedReferrable:YES automaticallyDisplayController:automaticallyDisplayController registerDeepLinkHandler:callback];
}

+ (void) setCallbackForTracingRequests: (callbackForTracingRequests) callback {
bnc_tracingCallback = callback;
}

#pragma mark - Actual Init Session

- (void)initSessionWithLaunchOptions:(NSDictionary *)options isReferrable:(BOOL)isReferrable explicitlyRequestedReferrable:(BOOL)explicitlyRequestedReferrable automaticallyDisplayController:(BOOL)automaticallyDisplayController registerDeepLinkHandlerUsingBranchUniversalObject:(callbackWithBranchUniversalObject)callback {
Expand Down Expand Up @@ -2170,6 +2175,7 @@ - (void)initializeSessionAndCallCallback:(BOOL)callCallback sceneIdentifier:(NSS
}
req.callback = initSessionCallback;
req.urlString = urlString;
req.traceCallback = bnc_tracingCallback;

[self.requestQueue insert:req at:0];

Expand Down
5 changes: 4 additions & 1 deletion Sources/BranchSDK/BranchInstallRequest.m
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,10 @@ - (void)makeRequest:(BNCServerInterface *)serverInterface key:(NSString *)key ca
BNCRequestFactory *factory = [[BNCRequestFactory alloc] initWithBranchKey:key UUID:self.requestUUID TimeStamp:self.requestCreationTimeStamp];
NSDictionary *params = [factory dataForInstallWithURLString:self.urlString];

[serverInterface postRequest:params url:[[BNCServerAPI sharedInstance] installServiceURL] key:key callback:callback];
self.requestParams = [params copy];
self.requestServiceURL = [[BNCServerAPI sharedInstance] installServiceURL];

[serverInterface postRequest:params url:self.requestServiceURL key:key callback:callback];
}

- (NSString *)getActionName {
Expand Down
10 changes: 8 additions & 2 deletions Sources/BranchSDK/BranchOpenRequest.m
Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,20 @@ - (id)initWithCallback:(callbackWithStatus)callback isInstall:(BOOL)isInstall {
- (void)makeRequest:(BNCServerInterface *)serverInterface key:(NSString *)key callback:(BNCServerCallback)callback {
BNCRequestFactory *factory = [[BNCRequestFactory alloc] initWithBranchKey:key UUID:self.requestUUID TimeStamp:self.requestCreationTimeStamp];
NSDictionary *params = [factory dataForOpenWithURLString:self.urlString];

self.requestParams = [params copy];
self.requestServiceURL = [[BNCServerAPI sharedInstance] openServiceURL];
[serverInterface postRequest:params
url:[[BNCServerAPI sharedInstance] openServiceURL]
url: self.requestServiceURL
key:key
callback:callback];
}

- (void)processResponse:(BNCServerResponse *)response error:(NSError *)error {

if (self.traceCallback) {
self.traceCallback(self.urlString, self.requestParams, response.data, error, self.requestServiceURL);
}

BNCPreferenceHelper *preferenceHelper = [BNCPreferenceHelper sharedInstance];
if (error && preferenceHelper.dropURLOpen) {
// Ignore this response from the server. Dummy up a response:
Expand Down
3 changes: 3 additions & 0 deletions Sources/BranchSDK/Private/BranchOpenRequest.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@
@property (nonatomic, copy, readwrite) NSString *urlString;
@property (assign, nonatomic) BOOL isFromArchivedQueue;
@property (nonatomic, copy) callbackWithStatus callback;
@property (nonatomic, copy) callbackForTracingRequests traceCallback;
@property (strong, nonatomic) NSDictionary *requestParams;
@property (nonatomic, copy, readwrite) NSString *requestServiceURL;

+ (void) waitForOpenResponseLock;
+ (void) releaseOpenResponseLock;
Expand Down
1 change: 1 addition & 0 deletions Sources/BranchSDK/Public/BNCCallbacks.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,4 @@ typedef void (^callbackWithList) (NSArray * _Nullable list, NSError * _Nullable
typedef void (^callbackWithUrlAndSpotlightIdentifier) (NSString * _Nullable url, NSString * _Nullable spotlightIdentifier, NSError * _Nullable error);
typedef void (^callbackWithBranchUniversalObject) (BranchUniversalObject * _Nullable universalObject, BranchLinkProperties * _Nullable linkProperties, NSError * _Nullable error);
typedef void (^callbackWithData) (NSData * _Nullable data, NSError * _Nullable error);
typedef void (^callbackForTracingRequests) ( NSString * _Nullable url, NSDictionary * _Nullable request, NSDictionary * _Nullable response, NSError * _Nullable error, NSString * requestServiceURL);
2 changes: 2 additions & 0 deletions Sources/BranchSDK/Public/Branch.h
Original file line number Diff line number Diff line change
Expand Up @@ -602,6 +602,8 @@ Sets a custom base safetrack URL for non-linking calls to the Branch API.

+ (void)setSafetrackAPIURL:(NSString *)url ;

+ (void)setCallbackForTracingRequests: (callbackForTracingRequests) callback ;

/**
@brief Use the `validateSDKIntegration` method as a debugging aid to assure that you've
integrated the Branch SDK correctly.
Expand Down