Skip to content

Commit d3cbb8c

Browse files
Merge pull request OwnTube-tv#284 from mykhailodanilenko/feature/linking
Add deep linking (OwnTube-tv#217)
2 parents 5558e2f + 5d884df commit d3cbb8c

5 files changed

Lines changed: 62 additions & 7 deletions

File tree

.github/workflows/deploy_web.yml

Lines changed: 32 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,6 @@ on:
1717
required: false
1818
type: boolean
1919
description: "Should a parent repo be used for customizations? (Required for branded builds)"
20-
custom_deployment_url:
21-
required: false
22-
type: string
23-
description: "Here you can specify a custom deployment url that you have configured in GitHub Pages settings"
2420

2521
jobs:
2622
deploy_web:
@@ -53,15 +49,45 @@ jobs:
5349
run: |
5450
echo "${{ inputs.customizations_env_content }}" > ./OwnTube.tv/.env
5551
52+
- name: Create association files for deeplinking
53+
run: |
54+
mkdir -p ./OwnTube.tv/public/.well-known
55+
56+
cat > ./OwnTube.tv/public/.well-known/apple-app-site-association << 'EOF'
57+
{
58+
"applinks": {
59+
"details": [
60+
{
61+
"appID": "${{ vars.APPLE_DEVELOPMENT_TEAM }}.${{ vars.APPLE_BUNDLE_ID }}",
62+
"paths": ["*"]
63+
}
64+
]
65+
}
66+
}
67+
EOF
68+
69+
cat > ./OwnTube.tv/public/.well-known/assetlinks.json << 'EOF'
70+
[
71+
{
72+
"relation": ["delegate_permission/common.handle_all_urls"],
73+
"target": {
74+
"namespace": "android_app",
75+
"package_name": "${{ vars.ANDROID_PACKAGE }}",
76+
"sha256_cert_fingerprints": [
77+
"${{ vars.ANDROID_FINGERPRINT }}"
78+
]
79+
}
80+
}
81+
]
82+
EOF
83+
5684
- name: Inject Build Info
5785
run: |
5886
cat > ./OwnTube.tv/build-info.json << 'EOF'
5987
${{ inputs.build_info }}
6088
EOF
6189
6290
- name: Build Web App by @${{ github.actor }}
63-
env:
64-
EXPO_PUBLIC_CUSTOM_DEPLOYMENT_URL: ${{ vars.CUSTOM_DEPLOYMENT_URL }}
6591
run: cd OwnTube.tv/ && cat build-info.json && npx expo export --platform web
6692

6793
- name: Setup Pages

OwnTube.tv/app.config.ts

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@ export default {
2828
buildNumber: getBuildNumber({ platform: "ios" }),
2929
supportsTablet: true,
3030
bundleIdentifier: process.env.EXPO_PUBLIC_IOS_BUNDLE_IDENTIFIER || "com.owntubetv.owntube",
31+
associatedDomains: process.env.EXPO_PUBLIC_CUSTOM_DEPLOYMENT_URL
32+
? [`applinks:${process.env.EXPO_PUBLIC_CUSTOM_DEPLOYMENT_URL}`]
33+
: undefined,
3134
},
3235
experiments: {
3336
baseUrl: !process.env.EXPO_PUBLIC_CUSTOM_DEPLOYMENT_URL
@@ -45,6 +48,22 @@ export default {
4548
backgroundColor: process.env.EXPO_PUBLIC_ANDROID_ADAPTIVE_ICON_BG_COLOR || "#F95F1E",
4649
},
4750
package: process.env.EXPO_PUBLIC_ANDROID_PACKAGE || "com.owntubetv.owntube",
51+
intentFilters: process.env.EXPO_PUBLIC_CUSTOM_DEPLOYMENT_URL
52+
? [
53+
{
54+
action: "VIEW",
55+
autoVerify: true,
56+
data: [
57+
{
58+
scheme: "https",
59+
host: process.env.EXPO_PUBLIC_CUSTOM_DEPLOYMENT_URL,
60+
pathPrefix: "/",
61+
},
62+
],
63+
category: ["BROWSABLE", "DEFAULT"],
64+
},
65+
]
66+
: undefined,
4867
},
4968
web: {
5069
output: "static",

OwnTube.tv/app/+html.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ export default function Root({ children }: PropsWithChildren) {
1111
name="viewport"
1212
content="height=device-height, width=device-width, initial-scale=1, shrink-to-fit=no, viewport-fit=cover"
1313
/>
14+
<meta name="apple-itunes-app" content={`app-id=${process.env.EXPO_PUBLIC_IOS_BUNDLE_IDENTIFIER}`} />
1415
{/* Link the PWA manifest file. */}
1516
<link rel="manifest" href="manifest.json" />
1617
<style id="expo-reset">{"html, body { height: 100%; } #root { display: flex; height: 100%; flex: 1; }"}</style>

OwnTube.tv/screens/LandingScreen/LandingScreen.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ export const LandingScreen = () => {
9191
<Screen
9292
style={{
9393
...styles.screenContainer,
94-
paddingTop: isDesktop ? spacing.xxxl : insets.top,
94+
paddingTop: insets.top || spacing.xxxl,
9595
}}
9696
>
9797
<View style={[styles.container, { maxWidth: isDesktop ? "38%" : "95%" }]}>

docs/pipeline.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,15 @@ You can set up a custom domain for your web client deployments, for this configu
1919
`github-pages` environment in repository environments settings. From then on, OwnTube should automatically switch to your
2020
custom website address. Please note that some of the changes needed to configure this may take considerable time, such as DNS cache propagation.
2121

22+
Setting up a custom domain also opens the road to having deep links set up. Fortunately, the build pipeline can handle this
23+
process automatically, all you need to do is add the following values to `github-pages` environment variables:
24+
25+
- `ANDROID_FINGERPRINT`: the SHA256 fingerprint of you app signing key certificate (obtained from Google Play console after first manual release);
26+
- `ANDROID_PACKAGE`: the Android package name for the app;
27+
- `APPLE_BUNDLE_ID`: bundle ID for the Apple version of the app;
28+
- `APPLE_DEVELOPMENT_TEAM`: Apple Development Team ID from App Store Connect;
29+
- `CUSTOM_DEPLOYMENT_URL`: should be added for custom domains to work in the first step;
30+
2231
## TestFlight upload ⏫
2332

2433
Before uploading to TestFlight, create an "`owntube`" environment in repository settings if you haven't already, then add the following secrets to the environment:

0 commit comments

Comments
 (0)