File tree Expand file tree Collapse file tree 4 files changed +13
-2
lines changed
Expand file tree Collapse file tree 4 files changed +13
-2
lines changed Original file line number Diff line number Diff line change @@ -12,3 +12,4 @@ extern NSString * const BNC_SDK_VERSION;
1212extern NSString * const BNC_API_BASE_URL ;
1313extern NSString * const BNC_LINK_URL ;
1414extern NSString * const BNC_API_VERSION ;
15+ extern BOOL const BNC_API_PINNED ;
Original file line number Diff line number Diff line change 99#include " BNCConfig.h"
1010
1111NSString * const BNC_API_BASE_URL = @" https://api.branch.io" ;
12+ BOOL const BNC_API_PINNED = YES ;
1213NSString * const BNC_API_VERSION = @" v1" ;
1314NSString * const BNC_LINK_URL = @" https://bnc.lt" ;
1415NSString * const BNC_SDK_VERSION = @" 0.19.5" ;
16+
Original file line number Diff line number Diff line change 1111#import " BNCLog.h"
1212#import " BNCDebug.h"
1313#import " BNCError.h"
14+ #import " BNCConfig.h"
1415
1516#pragma mark BNCNetworkOperation
1617
@@ -275,6 +276,11 @@ - (void) URLSession:(NSURLSession *)session
275276 }
276277 }
277278
279+ if (!BNC_API_PINNED) {
280+ trusted = YES ;
281+ goto exit;
282+ }
283+
278284exit:
279285 if (err) {
280286 NSError *error = [NSError errorWithDomain: NSOSStatusErrorDomain code: err userInfo: nil ];
Original file line number Diff line number Diff line change @@ -591,7 +591,8 @@ - (NSError*) verifyNetworkOperation:(id<BNCNetworkOperationProtocol>)operation {
591591
592592 if (!operation) {
593593 NSString *message = BNCLocalizedString (
594- @" A network operation instance is expected to be returned by the networkOperationWithURLRequest:completion: method."
594+ @" A network operation instance is expected to be returned by the"
595+ " networkOperationWithURLRequest:completion: method."
595596 );
596597 NSError *error = [NSError branchErrorWithCode: BNCNetworkServiceInterfaceError localizedMessage: message];
597598 return error;
@@ -641,7 +642,8 @@ - (BNCServerResponse *)genericHTTPRequestSynchronous:(NSURLRequest *)request {
641642 networkOperationWithURLRequest: request.copy
642643 completion: ^void (id <BNCNetworkOperationProtocol>operation) {
643644 serverResponse =
644- [self processServerResponse: operation.response data: operation.responseData error: operation.error];
645+ [self processServerResponse: operation.response
646+ data: operation.responseData error: operation.error];
645647 [self collectInstrumentationMetricsWithOperation: operation];
646648 dispatch_semaphore_signal (semaphore);
647649 }];
You can’t perform that action at this time.
0 commit comments