Skip to content

Commit e999ee3

Browse files
committed
chore: INTENG-4503 update the iOS native plugin
1 parent f94449a commit e999ee3

30 files changed

+187
-100
lines changed

src/ios/dependencies/Branch-SDK/BNCCommerceEvent.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,7 @@ NSArray<BNCCurrency>*_Nonnull BNCCurrencyAllCurrencies(void);
263263
@end
264264

265265

266-
@interface BranchCommerceEventRequest : BNCServerRequest <NSCoding>
266+
@interface BranchCommerceEventRequest : BNCServerRequest <NSSecureCoding>
267267

268268
- (instancetype _Nonnull) initWithCommerceEvent:(BNCCommerceEvent*_Nonnull)commerceEvent
269269
metadata:(NSDictionary*_Nullable)dictionary

src/ios/dependencies/Branch-SDK/BNCCommerceEvent.m

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -599,14 +599,13 @@ - (void)processResponse:(BNCServerResponse*)response
599599
self.completion(dictionary, error);
600600
}
601601

602-
#pragma mark BranchCommerceEventRequest NSCoding
602+
#pragma mark BranchCommerceEventRequest NSSecureCoding
603603

604604
- (instancetype)initWithCoder:(NSCoder *)decoder {
605605
self = [super initWithCoder:decoder];
606606
if (!self) return self;
607-
608-
self.commerceDictionary = [decoder decodeObjectForKey:@"commerceDictionary"];
609-
self.metadata = [decoder decodeObjectForKey:@"metaData"];
607+
self.commerceDictionary = [decoder decodeObjectOfClass:NSDictionary.class forKey:@"commerceDictionary"];
608+
self.metadata = [decoder decodeObjectOfClass:NSDictionary.class forKey:@"metaData"];
610609
return self;
611610
}
612611

@@ -616,4 +615,8 @@ - (void)encodeWithCoder:(NSCoder *)coder {
616615
[coder encodeObject:self.metadata forKey:@"metadata"];
617616
}
618617

618+
+ (BOOL) supportsSecureCoding {
619+
return YES;
620+
}
621+
619622
@end

src/ios/dependencies/Branch-SDK/BNCConfig.m

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88

99
#include "BNCConfig.h"
1010

11-
NSString * const BNC_API_BASE_URL = @"https://api.branch.io";
11+
NSString * const BNC_API_BASE_URL = @"https://api2.branch.io";
1212
BOOL const BNC_API_PINNED = YES;
1313
NSString * const BNC_API_VERSION = @"v1";
1414
NSString * const BNC_LINK_URL = @"https://bnc.lt";
15-
NSString * const BNC_SDK_VERSION = @"0.25.5";
15+
NSString * const BNC_SDK_VERSION = @"0.25.10";

src/ios/dependencies/Branch-SDK/BNCEncodingUtils.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,10 @@ extern NSString* BNCWireFormatFromString(NSString *string);
5252
+ (NSString*) stringByPercentDecodingString:(NSString*)string;
5353
+ (NSString*) stringByPercentEncodingStringForQuery:(NSString *)string;
5454

55+
+ (NSString *)sanitizedStringFromString:(NSString *)dirtyString;
5556
+ (NSDictionary *)decodeJsonDataToDictionary:(NSData *)jsonData;
5657
+ (NSDictionary *)decodeJsonStringToDictionary:(NSString *)jsonString;
58+
5759
+ (NSDictionary *)decodeQueryStringToDictionary:(NSString *)queryString;
5860
+ (NSString *)encodeDictionaryToQueryString:(NSDictionary *)dictionary;
5961

src/ios/dependencies/Branch-SDK/BNCEncodingUtils.m

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -143,10 +143,15 @@ + (NSString *)iso8601StringFromDate:(NSDate *)date {
143143

144144
+ (NSString *)sanitizedStringFromString:(NSString *)dirtyString {
145145
NSString *dirtyCopy = [dirtyString copy]; // dirtyString seems to get dealloc'ed sometimes. Make a copy.
146-
NSString *cleanString = [[[[dirtyCopy stringByReplacingOccurrencesOfString:@"\"" withString:@"\\\""]
147-
stringByReplacingOccurrencesOfString:@"\n" withString:@"\\n"]
148-
stringByReplacingOccurrencesOfString:@"" withString:@"'"]
149-
stringByReplacingOccurrencesOfString:@"\r" withString:@"\\r"];
146+
NSString *cleanString = [[[[[[[[dirtyCopy
147+
stringByReplacingOccurrencesOfString:@"\\" withString:@"\\\\"]
148+
stringByReplacingOccurrencesOfString:@"\b" withString:@"\\b"]
149+
stringByReplacingOccurrencesOfString:@"\f" withString:@"\\f"]
150+
stringByReplacingOccurrencesOfString:@"\n" withString:@"\\n"]
151+
stringByReplacingOccurrencesOfString:@"\r" withString:@"\\r"]
152+
stringByReplacingOccurrencesOfString:@"\t" withString:@"\\t"]
153+
stringByReplacingOccurrencesOfString:@"\"" withString:@"\\\""]
154+
stringByReplacingOccurrencesOfString:@"`" withString:@"'"];
150155
return cleanString;
151156
}
152157

src/ios/dependencies/Branch-SDK/BNCKeyChain.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ + (id) retrieveValueForService:(NSString*)service key:(NSString*)key error:(NSEr
124124
};
125125
CFDataRef valueData = NULL;
126126
OSStatus status = SecItemCopyMatching((__bridge CFDictionaryRef)dictionary, (CFTypeRef *)&valueData);
127-
if (status) {
127+
if (status != errSecSuccess) {
128128
NSError *localError = [self errorWithKey:key OSStatus:status];
129129
BNCLogDebugSDK(@"Can't retrieve key: %@.", localError);
130130
if (error) *error = localError;

src/ios/dependencies/Branch-SDK/BNCLinkData.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ typedef NS_ENUM(NSUInteger, BranchLinkType) {
1717
BranchLinkTypeOneTimeUse = 1
1818
};
1919

20-
@interface BNCLinkData : NSObject
20+
@interface BNCLinkData : NSObject <NSSecureCoding>
2121

2222
@property (strong, nonatomic) NSMutableDictionary *data;
2323

src/ios/dependencies/Branch-SDK/BNCLinkData.m

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -170,20 +170,24 @@ - (void)encodeWithCoder:(NSCoder *)coder {
170170

171171
- (id)initWithCoder:(NSCoder *)coder {
172172
if ((self = [super init])) {
173-
self.tags = [coder decodeObjectForKey:BRANCH_REQUEST_KEY_URL_TAGS];
174-
self.alias = [coder decodeObjectForKey:BRANCH_REQUEST_KEY_URL_ALIAS];
175-
self.type = [[coder decodeObjectForKey:BRANCH_REQUEST_KEY_URL_LINK_TYPE] integerValue];
176-
self.channel = [coder decodeObjectForKey:BRANCH_REQUEST_KEY_URL_CHANNEL];
177-
self.feature = [coder decodeObjectForKey:BRANCH_REQUEST_KEY_URL_FEATURE];
178-
self.stage = [coder decodeObjectForKey:BRANCH_REQUEST_KEY_URL_STAGE];
179-
self.campaign = [coder decodeObjectForKey:BRANCH_REQUEST_KEY_URL_CAMPAIGN];
180-
self.duration = [[coder decodeObjectForKey:BRANCH_REQUEST_KEY_URL_DURATION] integerValue];
173+
self.tags = [coder decodeObjectOfClass:NSArray.class forKey:BRANCH_REQUEST_KEY_URL_TAGS];
174+
self.alias = [coder decodeObjectOfClass:NSString.class forKey:BRANCH_REQUEST_KEY_URL_ALIAS];
175+
self.type = [[coder decodeObjectOfClass:NSNumber.class forKey:BRANCH_REQUEST_KEY_URL_LINK_TYPE] integerValue];
176+
self.channel = [coder decodeObjectOfClass:NSString.class forKey:BRANCH_REQUEST_KEY_URL_CHANNEL];
177+
self.feature = [coder decodeObjectOfClass:NSString.class forKey:BRANCH_REQUEST_KEY_URL_FEATURE];
178+
self.stage = [coder decodeObjectOfClass:NSString.class forKey:BRANCH_REQUEST_KEY_URL_STAGE];
179+
self.campaign = [coder decodeObjectOfClass:NSString.class forKey:BRANCH_REQUEST_KEY_URL_CAMPAIGN];
180+
self.duration = [[coder decodeObjectOfClass:NSNumber.class forKey:BRANCH_REQUEST_KEY_URL_DURATION] integerValue];
181181

182-
NSString *encodedParams = [coder decodeObjectForKey:BRANCH_REQUEST_KEY_URL_DATA];
182+
NSString *encodedParams = [coder decodeObjectOfClass:NSString.class forKey:BRANCH_REQUEST_KEY_URL_DATA];
183183
self.params = [BNCEncodingUtils decodeJsonStringToDictionary:encodedParams];
184184
}
185185

186186
return self;
187187
}
188188

189+
+ (BOOL) supportsSecureCoding {
190+
return YES;
191+
}
192+
189193
@end

src/ios/dependencies/Branch-SDK/BNCLog.m

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ void BNCLogInternalErrorFunction(int linenumber, NSString*format, ...) {
4242

4343

4444
inline static void BNCLogInitializeClient_Internal() {
45+
BNCLogInitialize();
4546
BNCLogClientInitializeFunctionPtr initFunction = BNCLogSetClientInitializeFunction(NULL);
4647
if (initFunction) {
4748
initFunction();
@@ -470,6 +471,7 @@ void BNCLogSetOutputToURLByteWrap(NSURL *_Nullable URL, long maxBytes) {
470471
static BNCLogLevel bnc_LogDisplayLevel = BNCLogLevelWarning;
471472

472473
BNCLogLevel BNCLogDisplayLevel() {
474+
BNCLogInitializeClient_Internal();
473475
__block BNCLogLevel level = BNCLogLevelAll;
474476
dispatch_sync(bnc_LogQueue, ^{
475477
level = bnc_LogDisplayLevel;

src/ios/dependencies/Branch-SDK/BNCPreferenceHelper.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,5 +94,6 @@ NSURL* /* _Nonnull */ BNCURLForBranchDirectory(void);
9494

9595
- (NSMutableString*) sanitizedMutableBaseURL:(NSString*)baseUrl;
9696
- (void) synchronize; // Flushes preference queue to persistence.
97+
+ (void) clearAll;
9798

9899
@end

0 commit comments

Comments
 (0)