Skip to content

Commit 08dc09e

Browse files
author
Edward Smith
committed
Version 0.22.2. Update TestBed for Android testing.
1 parent 38ac08d commit 08dc09e

File tree

8 files changed

+118
-40
lines changed

8 files changed

+118
-40
lines changed

Branch-SDK/Branch-SDK/BNCConfig.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,4 @@
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.22.1";
15+
NSString * const BNC_SDK_VERSION = @"0.22.2";

Branch-SDK/Branch-SDK/Branch.m

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -896,8 +896,8 @@ - (BOOL)checkAppleSearchAdsAttribution {
896896
^ void(NSDictionary *__nullable attrDetails, NSError *__nullable error) {
897897
BNCLogDebug(@"Elapsed Apple Search Ad callback time: %1.3fs.", - [startDate timeIntervalSinceNow]);
898898
BOOL localHasBeenCalled = atomic_exchange(&hasBeenCalled, YES);
899-
if (error) BNCLogError(@"Error while getting Apple Search Ad attribution: %@.", error);
900899
if (localHasBeenCalled) return;
900+
if (error) BNCLogError(@"Error while getting Apple Search Ad attribution: %@.", error);
901901

902902
self.asyncRequestCount--;
903903

@@ -1251,7 +1251,7 @@ - (BranchUniversalObject *)getLatestReferringBranchUniversalObject {
12511251

12521252
- (BranchLinkProperties *)getLatestReferringBranchLinkProperties {
12531253
NSDictionary *params = [self getLatestReferringParams];
1254-
if ([[params objectForKey:BRANCH_INIT_KEY_CLICKED_BRANCH_LINK] isEqual:@1]) {
1254+
if ([[params objectForKey:BRANCH_INIT_KEY_CLICKED_BRANCH_LINK] boolValue]) {
12551255
return [BranchLinkProperties getBranchLinkPropertiesFromDictionary:params];
12561256
}
12571257
return nil;

Branch-TestBed/Branch-TestBed/AppDelegate.m

Lines changed: 64 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -52,42 +52,79 @@ - (BOOL)application:(UIApplication *)application
5252
/*
5353
* Required: Initialize Branch, passing a deep link handler block:
5454
*/
55+
56+
#if 0
57+
5558
[branch initSessionWithLaunchOptions:launchOptions
5659
andRegisterDeepLinkHandler:^(NSDictionary * _Nullable params, NSError * _Nullable error) {
57-
if (!error) {
58-
59-
NSLog(@"initSession succeeded with params: %@", params);
60-
61-
NSString *deeplinkText = [params objectForKey:@"deeplink_text"];
62-
if ([params[BRANCH_INIT_KEY_CLICKED_BRANCH_LINK] boolValue]) {
63-
64-
UINavigationController *navigationController =
65-
(UINavigationController *)self.window.rootViewController;
66-
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
67-
LogOutputViewController *logOutputViewController =
68-
[storyboard instantiateViewControllerWithIdentifier:@"LogOutputViewController"];
69-
[navigationController pushViewController:logOutputViewController animated:YES];
70-
NSString *logOutput =
71-
[NSString stringWithFormat:@"Successfully Deeplinked:\n\n%@\nSession Details:\n\n%@",
72-
deeplinkText, [[branch getLatestReferringParams] description]];
73-
logOutputViewController.logOutput = logOutput;
74-
75-
} else {
76-
NSLog(@"Branch TestBed: Finished init with params\n%@", params.description);
77-
}
78-
79-
} else {
80-
NSLog(@"Branch TestBed: Initialization failed\n%@", error.localizedDescription);
81-
}
82-
60+
[self handleDeepLinkParams:parms error:error];
8361
}];
84-
62+
63+
#else
64+
65+
[branch initSessionWithLaunchOptions:launchOptions
66+
andRegisterDeepLinkHandlerUsingBranchUniversalObject:
67+
^ (BranchUniversalObject * _Nullable universalObject, BranchLinkProperties * _Nullable linkProperties, NSError * _Nullable error) {
68+
[self handleDeepLinkObject:universalObject linkProperties:linkProperties error:error];
69+
}];
70+
71+
#endif
72+
8573
// Push notification support (Optional)
8674
[self registerForPushNotifications:application];
8775

8876
return YES;
8977
}
9078

79+
- (void) handleDeepLinkParams:(NSDictionary*)params error:(NSError*)error {
80+
if (error) {
81+
NSLog(@"Branch TestBed: Error deep linking: %@.", error.localizedDescription);
82+
return;
83+
}
84+
85+
NSLog(@"Deep linked with params: %@", params);
86+
NSString *deeplinkText = [params objectForKey:@"deeplink_text"];
87+
if ([params[BRANCH_INIT_KEY_CLICKED_BRANCH_LINK] boolValue]) {
88+
89+
UINavigationController *navigationController =
90+
(UINavigationController *)self.window.rootViewController;
91+
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
92+
LogOutputViewController *logOutputViewController =
93+
[storyboard instantiateViewControllerWithIdentifier:@"LogOutputViewController"];
94+
[navigationController pushViewController:logOutputViewController animated:YES];
95+
NSString *logOutput =
96+
[NSString stringWithFormat:@"Successfully Deeplinked:\n\n%@\nSession Details:\n\n%@",
97+
deeplinkText, [[[Branch getInstance] getLatestReferringParams] description]];
98+
logOutputViewController.logOutput = logOutput;
99+
100+
} else {
101+
NSLog(@"Branch TestBed: Finished init with params\n%@", params.description);
102+
}
103+
}
104+
105+
- (void) handleDeepLinkObject:(BranchUniversalObject*)object
106+
linkProperties:(BranchLinkProperties*)linkProperties
107+
error:(NSError*)error {
108+
if (error) {
109+
NSLog(@"Branch TestBed: Error deep linking: %@.", error.localizedDescription);
110+
return;
111+
}
112+
113+
NSLog(@"Deep linked with object: %@.", object);
114+
NSString *deeplinkText = object.contentMetadata.customMetadata[@"deeplink_text"];
115+
if (object.contentMetadata.customMetadata[BRANCH_INIT_KEY_CLICKED_BRANCH_LINK].boolValue) {
116+
UINavigationController *navigationController =
117+
(UINavigationController *)self.window.rootViewController;
118+
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
119+
LogOutputViewController *logOutputViewController =
120+
[storyboard instantiateViewControllerWithIdentifier:@"LogOutputViewController"];
121+
[navigationController pushViewController:logOutputViewController animated:YES];
122+
NSString *logOutput =
123+
[NSString stringWithFormat:@"Successfully Deeplinked:\n\n%@\nSession Details:\n\n%@",
124+
deeplinkText, [[[Branch getInstance] getLatestReferringParams] description]];
125+
logOutputViewController.logOutput = logOutput;
126+
}
127+
}
91128

92129
- (void)onboardUserOnInstall {
93130
NSURL *urlForOnboarding = [NSURL URLWithString:@"http://example.com"]; // Put your onboarding link here

Branch-TestBed/Branch-TestBed/ViewController.m

Lines changed: 45 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -249,19 +249,59 @@ - (IBAction)oldShareLinkButtonTouchUpInside:(id)sender {
249249
- (IBAction)shareLinkButtonTouchUpInside:(id)sender {
250250
// The new hotness.
251251

252+
BranchUniversalObject *buo = [BranchUniversalObject new];
253+
254+
buo.contentMetadata.contentSchema = BranchContentSchemaCommerceProduct;
255+
buo.contentMetadata.quantity = 2;
256+
buo.contentMetadata.price = [NSDecimalNumber decimalNumberWithString:@"23.20"];
257+
buo.contentMetadata.currency = BNCCurrencyUSD;
258+
buo.contentMetadata.sku = @"1994320302";
259+
buo.contentMetadata.productName = @"my_product_name1";
260+
buo.contentMetadata.productBrand = @"my_prod_Brand1";
261+
buo.contentMetadata.productCategory = BNCProductCategoryBabyToddler;
262+
buo.contentMetadata.productVariant = @"3T";
263+
buo.contentMetadata.condition = BranchConditionFair;
264+
265+
buo.contentMetadata.ratingAverage = 5;
266+
buo.contentMetadata.ratingCount = 5;
267+
buo.contentMetadata.ratingMax = 7;
268+
buo.contentMetadata.addressStreet = @"Street_name1";
269+
buo.contentMetadata.addressCity = @"city1";
270+
buo.contentMetadata.addressRegion = @"Region1";
271+
buo.contentMetadata.addressCountry = @"Country1";
272+
buo.contentMetadata.addressPostalCode= @"postal_code";
273+
buo.contentMetadata.latitude = 12.07;
274+
buo.contentMetadata.longitude = -97.5;
275+
buo.contentMetadata.imageCaptions = (id) @[@"my_img_caption1", @"my_img_caption_2"];
276+
buo.contentMetadata.customMetadata = (id) @{
277+
@"Custom_Content_metadata_key1": @"Custom_Content_metadata_val1",
278+
@"Custom_Content_metadata_key2": @"Custom_Content_metadata_val2",
279+
@"~campaign": @"Parul's campaign"
280+
};
281+
buo.title = @"Parul Title";
282+
buo.canonicalIdentifier = @"item/12345";
283+
buo.canonicalUrl = @"https://branch.io/deepviews";
284+
buo.keywords = @[@"My_Keyword1", @"My_Keyword2"];
285+
buo.contentDescription = @"my_product_description1";
286+
buo.imageUrl = @"https://test_img_url";
287+
buo.expirationDate = [NSDate dateWithTimeIntervalSinceNow:24*60*60];
288+
buo.publiclyIndex = NO;
289+
buo.locallyIndex = YES;
290+
buo.creationDate = [NSDate date];
291+
252292
BranchLinkProperties *linkProperties = [[BranchLinkProperties alloc] init];
253293
linkProperties.feature = feature;
254294
linkProperties.campaign = @"sharing campaign";
255295

256296
BranchShareLink *shareLink =
257297
[[BranchShareLink alloc]
258-
initWithUniversalObject:self.branchUniversalObject
298+
initWithUniversalObject:buo
259299
linkProperties:linkProperties];
260300

261301
shareLink.title = @"Share your test link!";
262302
shareLink.delegate = self;
263303
shareLink.shareText = [NSString stringWithFormat:
264-
@"Shared from Branch's Branch-TestBed at %@.",
304+
@"Shared from Branch-TestBed at %@.",
265305
[self.dateFormatter stringFromDate:[NSDate date]]];
266306

267307
[shareLink presentActivityViewControllerFromViewController:self anchor:sender];
@@ -425,6 +465,7 @@ - (void) sendV2EventWithName:(NSString*)eventName {
425465
buo.contentMetadata.imageCaptions = (id) @[@"my_img_caption1", @"my_img_caption_2"];
426466
buo.contentMetadata.customMetadata = (id) @{
427467
@"Custom_Content_metadata_key1": @"Custom_Content_metadata_val1",
468+
@"Custom_Content_metadata_key2": @"Custom_Content_metadata_val2",
428469
@"~campaign": @"Parul's campaign"
429470
};
430471
buo.title = @"Parul Title";
@@ -433,10 +474,10 @@ - (void) sendV2EventWithName:(NSString*)eventName {
433474
buo.keywords = @[@"My_Keyword1", @"My_Keyword2"];
434475
buo.contentDescription = @"my_product_description1";
435476
buo.imageUrl = @"https://test_img_url";
436-
buo.expirationDate = [NSDate dateWithTimeIntervalSince1970:(double)212123232544.0/1000.0];
477+
buo.expirationDate = [NSDate dateWithTimeIntervalSinceNow:24*60*60];
437478
buo.publiclyIndex = NO;
438479
buo.locallyIndex = YES;
439-
buo.creationDate = [NSDate dateWithTimeIntervalSince1970:(double)1501869445321.0/1000.0];
480+
buo.creationDate = [NSDate date];
440481

441482
BranchEvent *event = [BranchEvent customEventWithName:eventName];
442483
event.transactionID = @"12344555";

Branch-TestBed/Framework-Info.plist

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,11 @@
1717
<key>CFBundlePackageType</key>
1818
<string>FMWK</string>
1919
<key>CFBundleShortVersionString</key>
20-
<string>0.22.1</string>
20+
<string>0.22.2</string>
2121
<key>CFBundleSignature</key>
2222
<string>????</string>
2323
<key>CFBundleVersion</key>
24-
<string>0.22.1</string>
24+
<string>0.22.2</string>
2525
<key>LSRequiresIPhoneOS</key>
2626
<true/>
2727
<key>NSHumanReadableCopyright</key>

Branch.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Pod::Spec.new do |s|
22
s.name = "Branch"
3-
s.version = "0.22.1"
3+
s.version = "0.22.2"
44
s.summary = "Create an HTTP URL for any piece of content in your app"
55
s.description = <<-DESC
66
- Want the highest possible conversions on your sharing feature?

carthage-files/Info.plist

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,11 @@
1515
<key>CFBundlePackageType</key>
1616
<string>FMWK</string>
1717
<key>CFBundleShortVersionString</key>
18-
<string>0.22.1</string>
18+
<string>0.22.2</string>
1919
<key>CFBundleSignature</key>
2020
<string>????</string>
2121
<key>CFBundleVersion</key>
22-
<string>0.22.1</string>
22+
<string>0.22.2</string>
2323
<key>NSPrincipalClass</key>
2424
<string></string>
2525
</dict>

scripts/version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ Options:
3131
USAGE
3232
}
3333

34-
version=0.22.1
34+
version=0.22.2
3535

3636
if (( $# == 0 )); then
3737
echo $version

0 commit comments

Comments
 (0)