Skip to content

Commit

Permalink
feat(ios): deeplink via https link
Browse files Browse the repository at this point in the history
  • Loading branch information
Guillaume Louvigny authored and gfanton committed Nov 6, 2018
1 parent 3b82365 commit 109c6f7
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 12 deletions.
17 changes: 8 additions & 9 deletions client/react-native/common/components/App.js
Expand Up @@ -82,7 +82,11 @@ export default class App extends PureComponent {
}

handleOpenURL (event) {
const prefixes = ['berty://']
const prefixes = [
'https://berty.tech/',
'berty://',
]

let url = event.url

for (let prefix of prefixes) {
Expand All @@ -92,19 +96,14 @@ export default class App extends PureComponent {
}
}

const urlParts = url.split('/')

if (
urlParts.length === 3 &&
urlParts[0] === 'add-contact' &&
urlParts[1] === 'public-key'
) {
if (url.indexOf('add-contact#public-key=') === 0) {
const initialKey = url.substr('add-contact#public-key='.length)
console.log('Adding new contact via public key')

this.navigation.dispatch(
NavigationActions.navigate({
routeName: 'modal/contacts/add/by-public-key',
params: { initialKey: urlParts[2] },
params: { initialKey: initialKey },
})
)
}
Expand Down
7 changes: 5 additions & 2 deletions client/react-native/ios/Berty.xcodeproj/project.pbxproj
Expand Up @@ -414,7 +414,6 @@
315E18D636B840518CA9A54F /* RNImagePicker.xcodeproj */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = "wrapper.pb-project"; name = RNImagePicker.xcodeproj; path = "../node_modules/react-native-image-picker/ios/RNImagePicker.xcodeproj"; sourceTree = "<group>"; };
404393F653304CE5B3D2FECF /* libRNVectorIcons-tvOS.a */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = archive.ar; path = "libRNVectorIcons-tvOS.a"; sourceTree = "<group>"; };
480E37922190872400BE10A5 /* RCTPushNotification.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTPushNotification.xcodeproj; path = "../node_modules/react-native/Libraries/PushNotificationIOS/RCTPushNotification.xcodeproj"; sourceTree = "<group>"; };
480E37C521908A6000BE10A5 /* Berty.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; name = Berty.entitlements; path = Berty/Berty.entitlements; sourceTree = "<group>"; };
4852AC444E8740FEAA4DFAE9 /* EvilIcons.ttf */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = unknown; name = EvilIcons.ttf; path = "../node_modules/react-native-vector-icons/Fonts/EvilIcons.ttf"; sourceTree = "<group>"; };
48B5C9A179E04E4CA39C6E06 /* RNVectorIcons.xcodeproj */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = "wrapper.pb-project"; name = RNVectorIcons.xcodeproj; path = "../node_modules/react-native-vector-icons/RNVectorIcons.xcodeproj"; sourceTree = "<group>"; };
48E2A93D2177575C005C6F40 /* Logger.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Logger.swift; sourceTree = "<group>"; };
Expand All @@ -434,6 +433,7 @@
C98BB2E01D1E436A800597C6 /* Entypo.ttf */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = unknown; name = Entypo.ttf; path = "../node_modules/react-native-vector-icons/Fonts/Entypo.ttf"; sourceTree = "<group>"; };
D2D26EFC3B0F4124BD3EB762 /* SimpleLineIcons.ttf */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = unknown; name = SimpleLineIcons.ttf; path = "../node_modules/react-native-vector-icons/Fonts/SimpleLineIcons.ttf"; sourceTree = "<group>"; };
E1C9A4F1DC6B4E75A55ACAF7 /* MaterialCommunityIcons.ttf */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = unknown; name = MaterialCommunityIcons.ttf; path = "../node_modules/react-native-vector-icons/Fonts/MaterialCommunityIcons.ttf"; sourceTree = "<group>"; };
F0BAE21221906E73003601A0 /* Berty.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; name = Berty.entitlements; path = Berty/Berty.entitlements; sourceTree = "<group>"; };
F8799D752136F3C5003B9FD7 /* CoreModule.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = CoreModule.m; sourceTree = "<group>"; };
F8799D772136F3EA003B9FD7 /* Berty-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Berty-Bridging-Header.h"; sourceTree = "<group>"; };
F8799D782136F3EA003B9FD7 /* CoreModule.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CoreModule.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -570,7 +570,7 @@
13B07FAE1A68108700A75B9A /* Berty */ = {
isa = PBXGroup;
children = (
480E37C521908A6000BE10A5 /* Berty.entitlements */,
F0BAE21221906E73003601A0 /* Berty.entitlements */,
008F07F21AC5B25A0029DE68 /* main.jsbundle */,
13B07FAF1A68108700A75B9A /* AppDelegate.h */,
13B07FB01A68108700A75B9A /* AppDelegate.m */,
Expand Down Expand Up @@ -888,6 +888,9 @@
com.apple.Push = {
enabled = 1;
};
com.apple.SafariKeychain = {
enabled = 1;
};
};
};
2D02E47A1E0B4A5D006451C7 = {
Expand Down
6 changes: 5 additions & 1 deletion client/react-native/ios/Berty/Berty.entitlements
Expand Up @@ -2,7 +2,11 @@
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>aps-environment</key>
<key>aps-environment</key>
<string>development</string>
<key>com.apple.developer.associated-domains</key>
<array>
<string>applinks:berty.tech</string>
</array>
</dict>
</plist>

0 comments on commit 109c6f7

Please sign in to comment.