Skip to content

Commit

Permalink
feat(android): handle deep links
Browse files Browse the repository at this point in the history
  • Loading branch information
Guillaume Louvigny committed Oct 25, 2018
1 parent bfb23c1 commit ecb312a
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
7 changes: 7 additions & 0 deletions client/react-native/android/app/src/main/AndroidManifest.xml
Expand Up @@ -15,13 +15,20 @@
android:theme="@style/AppTheme">
<activity
android:name=".MainActivity"
android:launchMode="singleTask"
android:label="@string/app_name"
android:configChanges="keyboard|keyboardHidden|orientation|screenSize"
android:windowSoftInputMode="adjustResize">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<intent-filter android:label="filter_react_native">
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="berty" />
</intent-filter>
</activity>
<activity android:name="com.facebook.react.devsupport.DevSettingsActivity" />
</application>
Expand Down
8 changes: 7 additions & 1 deletion client/react-native/common/components/App.js
Expand Up @@ -52,6 +52,12 @@ export default class App extends PureComponent {
subscriptions.eventStream.dispose()
}

Linking.getInitialURL().then(url => {
if (url !== null) {
this.handleOpenURL({ url })
}
}).catch(() => {})

if (this._handleOpenURL === undefined) {
this._handleOpenURL = this.handleOpenURL.bind(this)
}
Expand All @@ -68,7 +74,7 @@ export default class App extends PureComponent {
}

handleOpenURL (event) {
const prefixes = ['berty:']
const prefixes = ['berty://']
let url = event.url

for (let prefix of prefixes) {
Expand Down

0 comments on commit ecb312a

Please sign in to comment.