Skip to content

Commit 8f417dc

Browse files
committed
Add FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS, Code review and update example
1 parent 484a819 commit 8f417dc

File tree

7 files changed

+6587
-46
lines changed

7 files changed

+6587
-46
lines changed

android/src/main/java/com/proyecto26/inappbrowser/RNInAppBrowser.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,7 @@ public void open(Context context, final ReadableMap options, final Promise promi
122122
options.getBoolean(KEY_FORCE_CLOSE_ON_REDIRECTION)) {
123123
customTabsIntent.intent.addFlags(Intent.FLAG_ACTIVITY_NO_HISTORY);
124124
customTabsIntent.intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
125+
customTabsIntent.intent.addFlags(Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS);
125126
}
126127

127128
Intent intent = customTabsIntent.intent;

example/App.js

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@ export default class App extends Component {
3232
super(props);
3333

3434
this.state = {
35-
url: 'https://www.google.com'
35+
url: 'https://www.google.com',
36+
statusBarStyle: 'dark-content'
3637
};
3738
}
3839

@@ -41,20 +42,21 @@ export default class App extends Component {
4142
}
4243

4344
async openLink() {
44-
const { url } = this.state;
45+
const { url, statusBarStyle } = this.state;
4546
try {
4647
if (await InAppBrowser.isAvailable()) {
47-
StatusBar.setBarStyle('light-content');
48+
// A delay to change the StatusBar when the browser is opened
49+
setTimeout(() => StatusBar.setBarStyle('light-content'), 500);
4850
const result = await InAppBrowser.open(url, {
4951
// iOS Properties
5052
dismissButtonStyle: 'cancel',
5153
preferredBarTintColor: '#453AA4',
5254
preferredControlTintColor: 'white',
5355
readerMode: false,
54-
animated: true,
55-
modalPresentationStyle: 'none',
56-
modalTransitionStyle: 'coverVertical',
57-
modalEnabled: true,
56+
animated: false,
57+
modalPresentationStyle: 'overFullScreen',
58+
modalTransitionStyle: 'partialCurl',
59+
modalEnabled: false,
5860
// Android Properties
5961
showTitle: true,
6062
toolbarColor: '#6200EE',
@@ -74,13 +76,17 @@ export default class App extends Component {
7476
'my-custom-header': 'my custom header value'
7577
}
7678
});
79+
// A delay to show an alert when the browser is closed
7780
await this.sleep(800);
7881
Alert.alert('Response', JSON.stringify(result));
7982
} else {
8083
Linking.openURL(url);
8184
}
8285
} catch (error) {
8386
Alert.alert(error.message);
87+
} finally {
88+
// Restore the previous StatusBar of the App
89+
StatusBar.setBarStyle(statusBarStyle);
8490
}
8591
}
8692

@@ -110,9 +116,10 @@ export default class App extends Component {
110116
}
111117

112118
render() {
119+
const { statusBarStyle } = this.state;
113120
return (
114121
<View style={styles.container}>
115-
<StatusBar barStyle="dark-content" />
122+
<StatusBar barStyle={statusBarStyle} />
116123
<Text style={styles.welcome}>
117124
{'Welcome InAppBrowser\nfor React Native!'}
118125
</Text>

example/ios/example.xcodeproj/project.pbxproj

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,6 @@
161161
18F3EFC24A336ACE19C2D3D7 /* Pods-exampleTests.debug.xcconfig */,
162162
AFE3BE2BE7B697F5B2BC1E30 /* Pods-exampleTests.release.xcconfig */,
163163
);
164-
name = Pods;
165164
path = Pods;
166165
sourceTree = "<group>";
167166
};
@@ -292,6 +291,9 @@
292291
CreatedOnToolsVersion = 6.2;
293292
TestTargetID = 13B07F861A680F5B00A75B9A;
294293
};
294+
13B07F861A680F5B00A75B9A = {
295+
DevelopmentTeam = N8PGQE7K5F;
296+
};
295297
2D02E47A1E0B4A5D006451C7 = {
296298
CreatedOnToolsVersion = 8.2.1;
297299
ProvisioningStyle = Automatic;
@@ -308,6 +310,7 @@
308310
developmentRegion = English;
309311
hasScannedForEncodings = 0;
310312
knownRegions = (
313+
English,
311314
en,
312315
Base,
313316
);
@@ -628,6 +631,7 @@
628631
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
629632
CURRENT_PROJECT_VERSION = 1;
630633
DEAD_CODE_STRIPPING = NO;
634+
DEVELOPMENT_TEAM = N8PGQE7K5F;
631635
INFOPLIST_FILE = example/Info.plist;
632636
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
633637
OTHER_LDFLAGS = (
@@ -647,6 +651,7 @@
647651
buildSettings = {
648652
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
649653
CURRENT_PROJECT_VERSION = 1;
654+
DEVELOPMENT_TEAM = N8PGQE7K5F;
650655
INFOPLIST_FILE = example/Info.plist;
651656
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
652657
OTHER_LDFLAGS = (
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<dict>
5+
<key>IDEDidComputeMac32BitWarning</key>
6+
<true/>
7+
</dict>
8+
</plist>

example/ios/example/Base.lproj/LaunchScreen.xib

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
1-
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
2-
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="7702" systemVersion="14D136" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES">
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="14490.70" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" colorMatched="YES">
3+
<device id="retina4_7" orientation="portrait">
4+
<adaptation id="fullscreen"/>
5+
</device>
36
<dependencies>
47
<deployment identifier="iOS"/>
5-
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="7701"/>
6-
<capability name="Constraints with non-1.0 multipliers" minToolsVersion="5.1"/>
8+
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14490.49"/>
9+
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
710
</dependencies>
811
<objects>
912
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
@@ -25,7 +28,7 @@
2528
<nil key="highlightedColor"/>
2629
</label>
2730
</subviews>
28-
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
31+
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
2932
<constraints>
3033
<constraint firstItem="kId-c2-rCX" firstAttribute="centerY" secondItem="iN0-l3-epB" secondAttribute="bottom" multiplier="1/3" constant="1" id="5cJ-9S-tgC"/>
3134
<constraint firstAttribute="centerX" secondItem="kId-c2-rCX" secondAttribute="centerX" id="Koa-jz-hwk"/>

0 commit comments

Comments
 (0)