Skip to content

Commit 66ee9dc

Browse files
committed
chore: updated iOS to 0.14.12
1 parent df39b9a commit 66ee9dc

26 files changed

+1980
-243
lines changed

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,9 @@ - (NSDictionary*) dictionary {
8484

8585
assign(revenue);
8686
assign(currency);
87-
assign(transactionID);
87+
if (self.transactionID) {
88+
dictionary[@"transaction_id"] = self.transactionID;
89+
}
8890
assign(shipping);
8991
assign(tax);
9092
assign(coupon);

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

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,7 @@
88

99
#include "BNCConfig.h"
1010

11-
#if defined(BNCTesting)
12-
NSString * const BNC_API_BASE_URL = @"https://auhong.api.beta.branch.io";
13-
#else
1411
NSString * const BNC_API_BASE_URL = @"https://api.branch.io";
15-
#endif
16-
1712
NSString * const BNC_API_VERSION = @"v1";
1813
NSString * const BNC_LINK_URL = @"https://bnc.lt";
19-
NSString * const BNC_SDK_VERSION = @"0.13.5";
14+
NSString * const BNC_SDK_VERSION = @"0.14.12";
Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
2+
3+
//--------------------------------------------------------------------------------------------------
4+
//
5+
// BNCDebug.h
6+
// Branch.framework
7+
//
8+
// Debugging Support
9+
// Edward Smith, October 2016
10+
//
11+
// -©- Copyright © 2016 Branch, all rights reserved. -©-
12+
//
13+
//--------------------------------------------------------------------------------------------------
14+
15+
16+
//--------------------------------------------------------------------------------------------------
17+
/**
18+
19+
BNCDebug
20+
========
21+
22+
# Useful run time debugging environmental variables
23+
24+
Set DYLD_IMAGE_SUFFIX to _debug to load debug versions of dynamic libraries.
25+
Set NSDebugEnabled to YES to enable obj-c debug checks.
26+
Set NSZombieEnabled to YES to enable zombies to help catch the referencing of released objects.
27+
Set NSAutoreleaseFreedObjectCheckEnabled to YES to catch autorelease problems.
28+
Set MallocStackLoggingNoCompact to YES to track and save all memory allocations. Memory intensive.
29+
30+
Check NSDebug.h for more debug switches. Also check Technical Note TN2124 and TN2239 for more info.
31+
32+
Useful exception breakpoints to set:
33+
34+
objc_exception_throw
35+
NSInternalInconsistencyException
36+
37+
May be helpful for iPhone Simulator: GTM_DISABLE_IPHONE_LAUNCH_DAEMONS 1
38+
39+
Useful lldb macros (Works after Xcode 5.0):
40+
41+
command script import lldb.macosx.heap
42+
43+
Search the heap for all references to the pointer 0x0000000116e13920:
44+
45+
ptr_refs -m 0x0000000116e13920
46+
47+
*/
48+
//--------------------------------------------------------------------------------------------------
49+
50+
51+
#import <Foundation/Foundation.h>
52+
53+
54+
#ifdef __cplusplus
55+
extern "C" {
56+
#endif
57+
58+
59+
///@functiongroup Debugging Functions
60+
61+
62+
///@return Returns true if the app is currently attached to a debugger.
63+
extern BOOL BNCDebuggerIsAttached();
64+
65+
66+
///@param object An obj-c instance, class, or meta-class.
67+
///@return Returns an NSString with a dump of the methods and member variables of the instance,
68+
/// class, or meta-class.
69+
extern NSString* _Nonnull BNCDebugStringFromObject(id _Nullable object);
70+
71+
72+
///@return Returns the names of all loaded classes as an array of NSStrings.
73+
extern NSArray<NSString*> * _Nonnull BNCDebugArrayOfReqisteredClasses();
74+
75+
76+
///@return Returns an NSString indicating the name of the enclosing method.
77+
#define BNCSStringForCurrentMethod() \
78+
NSStringFromSelector(_cmd)
79+
80+
81+
///@return Returns an NSString indicating the name of the enclosing function.
82+
#define BNCSStringForCurrentFunction() \
83+
[NSString stringWithFormat:@"%s", __FUNCTION__]
84+
85+
86+
/// Stops execution at the current execution point.
87+
/// If attached to a debugger, current app will halt and wait for the debugger.
88+
/// If not attached to a debugger then the current app will probably quit executing.
89+
#define BNCDebugBreakpoint() \
90+
do { raise(SIGINT); } while (0)
91+
92+
93+
#ifdef __cplusplus
94+
}
95+
#endif
Lines changed: 226 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,226 @@
1+
2+
3+
//--------------------------------------------------------------------------------------------------
4+
//
5+
// BNCDebug.m
6+
// Branch.framework
7+
//
8+
// Debugging Support
9+
// Edward Smith, October 2016
10+
//
11+
// -©- Copyright © 2016 Branch, all rights reserved. -©-
12+
//
13+
//--------------------------------------------------------------------------------------------------
14+
15+
16+
#import "BNCDebug.h"
17+
#import <sys/sysctl.h>
18+
#import <objc/runtime.h>
19+
20+
21+
BOOL BNCDebuggerIsAttached() {
22+
// From an Apple tech note that I've lost --EB Smith
23+
24+
// Returns true if the current process is being debugged (either
25+
// running under the debugger or has a debugger attached post facto).
26+
27+
int junk;
28+
int mib[4];
29+
struct kinfo_proc info;
30+
size_t size;
31+
32+
// Initialize the flags so that, if sysctl fails for some bizarre
33+
// reason, we get a predictable result.
34+
35+
info.kp_proc.p_flag = 0;
36+
37+
// Initialize mib, which tells sysctl the info we want, in this case
38+
// we're looking for information about a specific process ID.
39+
40+
mib[0] = CTL_KERN;
41+
mib[1] = KERN_PROC;
42+
mib[2] = KERN_PROC_PID;
43+
mib[3] = getpid();
44+
45+
// Call sysctl.
46+
47+
size = sizeof(info);
48+
junk = sysctl(mib, sizeof(mib) / sizeof(*mib), &info, &size, NULL, 0);
49+
if (junk != 0) {
50+
NSLog(@"Program error in BNCDebuggerIsAttached. Junk != 0!");
51+
}
52+
53+
// We're being debugged if the P_TRACED flag is set.
54+
55+
return ( (info.kp_proc.p_flag & P_TRACED) != 0 );
56+
}
57+
58+
NSString * _Nonnull BNCDebugStringFromObject(id _Nullable instance) {
59+
// Dump the class --
60+
61+
if (!instance) return @"Object is nil.\n";
62+
63+
const char* superclassname = "nil";
64+
Class class = object_getClass(instance);
65+
Class superclass = class_getSuperclass(class);
66+
if (superclass) superclassname = class_getName(superclass);
67+
if (!superclassname) superclassname = "<nil>";
68+
69+
NSMutableString *result = [NSMutableString stringWithCapacity:512];
70+
if (class_isMetaClass(class)) {
71+
[result appendFormat:@"\nClass %p is class '%s' of class '%s':\n",
72+
instance, class_getName(class), superclassname];
73+
class = instance;
74+
} else {
75+
[result appendFormat:@"\nInstance %p is of class '%s' of class '%s':\n",
76+
instance, class_getName(class), superclassname];
77+
}
78+
79+
// Ivars --
80+
81+
#define isTypeOf(encoding, type) \
82+
(strncmp(encoding, @encode(type), strlen(encoding)) == 0)
83+
84+
#define AppendValueOfType(type, format) \
85+
if (isTypeOf(encoding, type)) { \
86+
if (ivarPtr) { \
87+
[result appendFormat:@"\tIvar '%s' type '%s' value '"format"'.\n", \
88+
ivarName, #type, *((type*)ivarPtr)]; \
89+
} else { \
90+
[result appendFormat:@"\tIvar '%s' type '%s'.\n", \
91+
ivarName, #type]; \
92+
} \
93+
} else
94+
95+
uint count = 0;
96+
Ivar *ivars = class_copyIvarList(class, &count);
97+
for (int i = 0; i < count; ++i) {
98+
const char* encoding = ivar_getTypeEncoding(ivars[i]);
99+
const char* ivarName = ivar_getName(ivars[i]);
100+
const void* ivarPtr = nil;
101+
if (class == instance) {
102+
// instance is a class, so there aren't any ivar values.
103+
} else if (encoding[0] == '@' || encoding[0] == '#') {
104+
ivarPtr = (__bridge void*) object_getIvar(instance, ivars[i]);
105+
} else {
106+
ivarPtr = (void*) (((__bridge void*)instance) + ivar_getOffset(ivars[i]));
107+
}
108+
109+
if (encoding[0] == '@') {
110+
if (ivarPtr)
111+
[result appendFormat:@"\tIvar '%s' type '%@' value '%@'.\n",
112+
ivarName, NSStringFromClass(((__bridge id<NSObject>)ivarPtr).class), ivarPtr];
113+
else {
114+
NSString *className = [NSString stringWithFormat:@"%s", encoding];
115+
if ([className hasPrefix:@"@\""])
116+
className = [className substringFromIndex:2];
117+
if ([className hasSuffix:@"\""])
118+
className = [className substringToIndex:className.length-1];
119+
[result appendFormat:@"\tIvar '%s' type '%@'.\n", ivarName, className];
120+
}
121+
} else if (isTypeOf(encoding, Class)) {
122+
if (ivarPtr)
123+
[result appendFormat:@"\tIvar '%s' type 'class' value '%@'.\n",
124+
ivarName, NSStringFromClass((__bridge Class _Nonnull)(ivarPtr))];
125+
else
126+
[result appendFormat:@"\tIvar '%s' type 'class'.\n",
127+
ivarName];
128+
} else if (isTypeOf(encoding, char*)) {
129+
if (ivarPtr)
130+
[result appendFormat:@"\tIvar '%s' type 'char*' value '%s'.\n",
131+
ivarName, *(char**)ivarPtr];
132+
else
133+
[result appendFormat:@"\tIvar '%s' type 'char*'.\n",
134+
ivarName];
135+
} else if (isTypeOf(encoding, BOOL)) {
136+
if (ivarPtr)
137+
[result appendFormat:@"\tIvar '%s' type 'BOOL' value '%s'.\n",
138+
ivarName, (*(BOOL*)ivarPtr)?"YES":"NO"];
139+
else
140+
[result appendFormat:@"\tIvar '%s' type 'BOOL'.\n",
141+
ivarName];
142+
} else if (isTypeOf(encoding, int)) {
143+
if (ivarPtr)
144+
[result appendFormat:@"\tIvar '%s' type '%s' value '%d'.\n",
145+
ivarName, "int", *((int*)ivarPtr)];
146+
else
147+
[result appendFormat:@"\tIvar '%s' type '%s'.\n",
148+
ivarName, "int"];
149+
} else
150+
// clang-format off
151+
AppendValueOfType(float, "%f")
152+
AppendValueOfType(double, "%f")
153+
AppendValueOfType(long double, "%Lf")
154+
AppendValueOfType(char, "%c")
155+
AppendValueOfType(int, "%d")
156+
AppendValueOfType(short, "%hd")
157+
AppendValueOfType(long, "%ld")
158+
AppendValueOfType(long long, "%lld")
159+
AppendValueOfType(unsigned char, "%c")
160+
AppendValueOfType(unsigned int, "%u")
161+
AppendValueOfType(unsigned short, "%hu")
162+
AppendValueOfType(unsigned long, "%lu")
163+
AppendValueOfType(unsigned long long, "%llu")
164+
[result appendFormat:@"\tIvar '%s' type '%s' (un-handled type).\n",
165+
ivarName,
166+
encoding];
167+
// clang-format off
168+
}
169+
if (ivars) free(ivars);
170+
171+
#undef AppendValueOfType
172+
#undef isTypeOf
173+
174+
// Properties --
175+
176+
count = 0;
177+
objc_property_t *properties = class_copyPropertyList(class, &count);
178+
for (int i = 0; i < count; ++i)
179+
[result appendFormat:@"\tProperty name: '%s'.\n", property_getName(properties[i])];
180+
if (properties) free(properties);
181+
182+
// Class methods --
183+
184+
count = 0;
185+
Method *methods = class_copyMethodList(object_getClass(class), &count);
186+
for (int i = 0; i < count; ++i)
187+
[result appendFormat:@"\tClass method name: '%s'.\n",
188+
sel_getName(method_getName(methods[i]))];
189+
if (methods) free(methods);
190+
191+
// Instance methods --
192+
193+
count = 0;
194+
methods = class_copyMethodList(class, &count);
195+
for (int i = 0; i < count; ++i)
196+
[result appendFormat:@"\tMethod name: '%s'.\n",
197+
sel_getName(method_getName(methods[i]))];
198+
if (methods) free(methods);
199+
200+
return result;
201+
}
202+
203+
NSArray<NSString*> * _Nonnull BNCDebugArrayOfReqisteredClasses() {
204+
// Add all loaded classes to the NSString array:
205+
206+
int numClasses = 0;
207+
Class * classes = NULL;
208+
209+
numClasses = objc_getClassList(NULL, 0);
210+
if (numClasses <= 0) return @[];
211+
212+
classes = (__unsafe_unretained Class*) malloc(sizeof(Class) * numClasses);
213+
numClasses = objc_getClassList(classes, numClasses);
214+
215+
NSMutableArray<NSString*> *result = [[NSMutableArray alloc] initWithCapacity:numClasses];
216+
217+
Class *class = classes;
218+
for (int i = 0; i < numClasses; ++i) {
219+
NSString* s = NSStringFromClass(*class);
220+
if (s) [result addObject:s];
221+
++class;
222+
}
223+
224+
free(classes);
225+
return result;
226+
}

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

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -176,12 +176,7 @@ + (NSString*) userAgentString {
176176
dispatch_async(dispatch_get_main_queue(), agentBlock);
177177

178178
dispatch_time_t timeoutTime = dispatch_time(DISPATCH_TIME_NOW, timeoutDelta);
179-
#if defined(BNCTesting)
180-
long result = dispatch_block_wait(agentBlock, timeoutTime);
181-
NSLog(@"Wait result: %ld.", result);
182-
#else
183179
dispatch_block_wait(agentBlock, timeoutTime);
184-
#endif
185180
retries--;
186181
}
187182
return browserUserAgentString;

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

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,12 @@ + (NSDictionary *)prepareBranchDataForAnswers:(NSDictionary *)dictionary {
4141
temp[@"referring_branch_identity"] = dictionary[key];
4242
}
4343
}
44-
45-
BNCPreferenceHelper *preferenceHelper = [BNCPreferenceHelper preferenceHelper];
46-
temp[@"branch_identity"] = preferenceHelper.identityID;
44+
45+
[[BNCPreferenceHelper preferenceHelper] synchronize];
46+
NSString *identity = [[BNCPreferenceHelper preferenceHelper].identityID copy];
47+
if (identity) {
48+
temp[@"branch_identity"] = identity;
49+
}
4750

4851
return temp;
4952
}

0 commit comments

Comments
 (0)