Skip to content

Commit a5e5a20

Browse files
authored
Enhance web example (#725)
* Added 'About the App' view. * Updated the Branch parameters in the Dashboard and app. * Demonstrated opening Branch link in web view. * Added forward and back buttons. * Updated code from review suggestions.
1 parent 51337c9 commit a5e5a20

File tree

26 files changed

+399
-52
lines changed

26 files changed

+399
-52
lines changed

Branch-SDK/Branch-SDK/Branch.m

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -319,8 +319,9 @@ + (void) setBranchKey:(NSString*)branchKey {
319319
return;
320320
}
321321
if (![branchKey isKindOfClass:[NSString class]]) {
322+
NSString *typeName = (branchKey) ? NSStringFromClass(branchKey.class) : @"<nil>";
322323
[NSException raise:NSInternalInconsistencyException
323-
format:@"Invalid Branch key of type '%@'.", NSStringFromClass(branchKey.class)];
324+
format:@"Invalid Branch key of type '%@'.", typeName];
324325
return;
325326
}
326327

Branch-SDK/Branch-SDK/BranchUniversalObject.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ typedef NS_ENUM(NSInteger, ContentIndexMode) {
2121

2222
@interface BranchUniversalObject : NSObject
2323

24-
@property (nonatomic, strong, nonnull) NSString *canonicalIdentifier;
24+
@property (nonatomic, strong, nonnull) NSString *canonicalIdentifier;
2525
@property (nonatomic, strong, nullable) NSString *canonicalUrl;
2626
@property (nonatomic, strong, nullable) NSString *title;
2727
@property (nonatomic, strong, nullable) NSString *contentDescription;

Branch-SDK/Branch-SDK/Networking/BNCServerRequestQueue.m

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,9 @@ - (void)remove:(BNCServerRequest *)request {
102102
}
103103

104104
- (BNCServerRequest *)peek {
105-
return [self peekAt:0];
105+
@synchronized (self) {
106+
return [self peekAt:0];
107+
}
106108
}
107109

108110
- (BNCServerRequest *)peekAt:(unsigned int)index {

Branch-TestBed/Branch-SDK-Tests/BranchNetworkScenario.Test.m

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -459,7 +459,6 @@ - (void)testScenario8 {
459459
[branch getShortURLWithCallback:^(NSString *url, NSError *error) {
460460
XCTAssertNotNil(error);
461461
XCTAssertEqual(error.code, BNCInitError);
462-
463462
[self safelyFulfillExpectation:expecation];
464463
}];
465464
}];
6.65 KB
Loading
13.8 KB
Loading
18.9 KB
Loading
1.29 MB
Loading
1.42 KB
Loading
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<meta http-equiv="Content-type" content="text/html; charset=UTF-8">
5+
<meta name="apple-mobile-web-app-capable" content="yes">
6+
<meta name="apple-mobile-web-app-status-bar-style" content="black">
7+
<meta name="viewport" content="width=device-width, minimal-ui">
8+
<link href="./favicon.png" type="image/png" rel="shortcut icon">
9+
<title>The Planets : About</title>
10+
<link rel="stylesheet" type="text/css" href="style.css">
11+
</head>
12+
13+
<body>
14+
<br><br>
15+
<img id="logo" src="Branch.png" alt="Branch">
16+
<div id='message-box'>
17+
<h1>The Planets WebView Example</h1>
18+
<p>
19+
The Planets WebView Example shows how Branch links can be used in apps with web views.
20+
</p>
21+
<p>
22+
It demonstrates a few common tasks:
23+
</p>
24+
25+
<ul>
26+
<li>
27+
This page is a web view, and this link to
28+
<a href="https://branchwebview.app.link/85pG2tDhyG">the planet Saturn</a>
29+
is a deep link that opens back into content in this app.
30+
</li>
31+
32+
<li>
33+
This Branch link, a link to
34+
<a href="https://branchwebview.app.link/HhqIIgIxJG">the planet Jupiter,</a>
35+
is a Branch deep link that opens into this same web view. You can use the buttons at the top right
36+
to navigate between web pages in this same web view. This example shows forward and back navigation
37+
between web page that contain a Branch link.
38+
</li>
39+
40+
<li>
41+
Each planet page has a 'Share' button that demonstrates how to share Branch links that point to app
42+
content that is in a web view.
43+
<br><br>
44+
The planet info can be shared as a link by email, etc., and those links will open to the
45+
content in the app if the user has the app. Otherwise those links open to content on the web.
46+
</li>
47+
</ul>
48+
49+
</div>
50+
</body>
51+
</html>

0 commit comments

Comments
 (0)