Skip to content

Commit 90bbf23

Browse files
authored
Merge pull request #441 from fmasa/app-links
Replace Firebase Dynamic Links by Android App Links
2 parents 0e6c2d0 + a48c81b commit 90bbf23

File tree

7 files changed

+37
-27
lines changed

7 files changed

+37
-27
lines changed

app/src/main/AndroidManifest.xml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,18 @@
3939
<action android:name="android.intent.action.MAIN" />
4040
<category android:name="android.intent.category.LAUNCHER" />
4141
</intent-filter>
42-
<intent-filter>
42+
<intent-filter android:autoVerify="true">
4343
<action android:name="android.intent.action.VIEW"/>
4444
<category android:name="android.intent.category.DEFAULT"/>
4545
<category android:name="android.intent.category.BROWSABLE"/>
4646
<data android:host="dnd-master-58fca.web.app" android:pathPrefix="/app/" android:scheme="https"/>
4747
</intent-filter>
48+
<intent-filter>
49+
<action android:name="android.intent.action.VIEW"/>
50+
<category android:name="android.intent.category.DEFAULT"/>
51+
<category android:name="android.intent.category.BROWSABLE"/>
52+
<data android:scheme="wfrp-master"/>
53+
</intent-filter>
4854
</activity>
4955
</application>
5056
</manifest>

common/build.gradle.kts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,6 @@ kotlin {
124124

125125
// Authentication
126126
api(libs.play.services.auth)
127-
implementation(libs.firebase.dynamic.links.ktx)
128127

129128
// Shared Preferences DataStore
130129
api(libs.datastore.preferences)

common/src/androidMain/kotlin/cz/frantisekmasa/wfrp_master/common/invitation/InvitationDialogContent.kt

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -16,19 +16,13 @@ import androidx.compose.runtime.remember
1616
import androidx.compose.ui.Modifier
1717
import androidx.compose.ui.platform.LocalContext
1818
import androidx.compose.ui.text.style.TextAlign
19-
import androidx.core.net.toUri
20-
import com.google.firebase.dynamiclinks.ktx.androidParameters
21-
import com.google.firebase.dynamiclinks.ktx.dynamicLinks
22-
import com.google.firebase.dynamiclinks.ktx.shortLinkAsync
23-
import com.google.firebase.ktx.Firebase
2419
import cz.frantisekmasa.wfrp_master.common.Str
2520
import cz.frantisekmasa.wfrp_master.common.core.domain.party.Invitation
2621
import cz.frantisekmasa.wfrp_master.common.core.logging.Reporting
2722
import cz.frantisekmasa.wfrp_master.common.core.ui.primitives.FullScreenProgress
2823
import cz.frantisekmasa.wfrp_master.common.core.ui.primitives.VISUAL_ONLY_ICON_DESCRIPTION
2924
import dev.icerock.moko.resources.compose.stringResource
3025
import kotlinx.coroutines.Dispatchers
31-
import kotlinx.coroutines.tasks.await
3226
import kotlinx.coroutines.withContext
3327

3428
@Composable
@@ -74,15 +68,10 @@ private suspend fun buildSharingOptions(
7468
): SharingOptions {
7569
return withContext(Dispatchers.IO) {
7670
val json = screenModel.serializeInvitation(invitation)
77-
val link =
78-
Firebase.dynamicLinks.shortLinkAsync {
79-
link = InvitationLinkScreen.deepLink(json).toString().toUri()
80-
androidParameters { }
81-
domainUriPrefix = "https://wfrp.page.link"
82-
}
71+
val link = InvitationLinkScreen.deepLink(json).toString()
8372

8473
SharingOptions(
85-
link = link.await().shortLink.toString(),
74+
link = link,
8675
json = json,
8776
)
8877
}

gradle/libs.versions.toml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ datastore-preferences = "1.1.2"
1313
datetime-dialog = "0.5.1"
1414
debounce = "1.2.0"
1515
desugar-jdk-libs = "2.1.4"
16-
firebase-dynamic-links-ktx = "22.1.0"
1716
gitlive-firebase = "2.1.0"
1817
google-services = "4.4.2"
1918
junit-jupiter-engine = "5.8.2"
@@ -58,7 +57,6 @@ debounce = { module = "io.github.mmolosay:debounce", version.ref = "debounce" }
5857
desugar-jdk-libs = { module = "com.android.tools:desugar_jdk_libs", version.ref = "desugar-jdk-libs" }
5958
firebase-auth = { module = "dev.gitlive:firebase-auth", version.ref = "gitlive-firebase" }
6059
firebase-common = { module = "dev.gitlive:firebase-common", version.ref = "gitlive-firebase" }
61-
firebase-dynamic-links-ktx = { module = "com.google.firebase:firebase-dynamic-links-ktx", version.ref = "firebase-dynamic-links-ktx" }
6260
firebase-analytics = { module = "dev.gitlive:firebase-analytics", version.ref = "gitlive-firebase" }
6361
firebase-crashlytics = { module = "dev.gitlive:firebase-crashlytics", version.ref = "gitlive-firebase" }
6462
firebase-firestore = { module = "dev.gitlive:firebase-firestore", version.ref = "gitlive-firebase" }

webapp/.well-known/assetlinks.json

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
[
2+
{
3+
"relation": [
4+
"delegate_permission/common.handle_all_urls"
5+
],
6+
"target": {
7+
"namespace": "android_app",
8+
"package_name": "cz.frantisekmasa.dnd",
9+
"sha256_cert_fingerprints": [
10+
"E2:C6:D6:EC:B9:ED:D4:ED:BE:0B:98:3A:69:9D:70:EB:95:71:C0:6F:7E:A1:CB:FF:6D:92:75:80:8F:80:CE:1B"
11+
]
12+
}
13+
}
14+
]

webapp/app.css

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,10 @@ body {
9494
clear: both;
9595
}
9696

97+
.text-center {
98+
text-align: center;
99+
}
100+
97101
@media (max-width: 600px) {
98102
body, #message {
99103
margin-top: 0;

webapp/app/invitation.html

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,27 +11,25 @@
1111
<div id="header">
1212
<h1>WFRP Master</h1>
1313
</div>
14-
<div id="message">
15-
<div class="main-screenshot">
16-
<img src="/screenshot.png" alt="Screenshot of WFRP Master" style="width: 100%">
17-
<a href="https://play.google.com/store/apps/details?id=cz.frantisekmasa.dnd&pcampaignid=pcampaignidMKT-Other-global-all-co-prtnr-py-PartBadge-Mar2515-1"><img
18-
alt="Get it on Google Play"
19-
width="200"
20-
src="https://play.google.com/intl/en_us/badges/static/images/badges/en_badge_web_generic.png"/></a>
21-
</div>
14+
<div id="message" class="text-center">
2215
<h1>Invitation</h1>
2316
<p>You have been invited to WFRP Master party.</p>
2417
<p>Open this page on your Android device to join it, or scan QR code below in WFRP Master app.</p>
2518
<div id="qrCode" style="margin: auto; width: 200px"></div>
26-
<div class="clear"></div>
19+
<p>If you are visiting this page on your Android device and the app did not open <a id="open-app" href="">click here</a>.</p>
20+
<p>If you don't have the app installed yet, you can <a href="https://play.google.com/store/apps/details?id=cz.frantisekmasa.dnd&pcampaignid=pcampaignidMKT-Other-global-all-co-prtnr-py-PartBadge-Mar2515-1">install it from Google Play</a>.</p>
21+
<a href="https://play.google.com/store/apps/details?id=cz.frantisekmasa.dnd&pcampaignid=pcampaignidMKT-Other-global-all-co-prtnr-py-PartBadge-Mar2515-1"><img
22+
alt="Get it on Google Play"
23+
width="200"
24+
src="https://play.google.com/intl/en_us/badges/static/images/badges/en_badge_web_generic.png"/></a>
2725
</div>
2826
<div id="footer">
2927
<p>WFRP Master</p>
3028
<p>Google Play and the Google Play logo are trademarks of Google LLC.</p>
3129
<a href="/privacy-policy.html">Privacy Policy</a>
3230
</div>
3331
<script src="https://cdn.rawgit.com/davidshimjs/qrcodejs/gh-pages/qrcode.min.js"></script>
34-
<script>
32+
<script type="text/javascript">
3533
const urlParams = new URLSearchParams(window.location.search);
3634
const invitation = urlParams.get('invitation');
3735

@@ -40,6 +38,8 @@ <h1>Invitation</h1>
4038
width: 200,
4139
height: 200,
4240
});
41+
42+
document.getElementById("open-app").href = "wfrp-master://invitation?invitation=" + encodeURIComponent(invitation);
4343
</script>
4444
</body>
4545
</html>

0 commit comments

Comments
 (0)