Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions androidApp/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,9 @@
<!-- Must match the prod BASE_URL_PUBLIC host (and the web CNAME). -->
<data android:host="app.tabmates.de" />

<data android:pathPrefix="/api/auth/verify" />
<data android:pathPrefix="/api/auth/reset-password" />
<data android:pathPrefix="/j/" />
<data android:pathPrefix="/verify/" />
<data android:pathPrefix="/reset-password/" />
<data android:pathPrefix="/join/" />
<!-- Stateless "open the app" target. Carries no data: it exists so the web
client's intent:// promo has a path this app claims, and so a plain
https://app.tabmates.de/open link opens the app when it is installed.
Expand All @@ -61,9 +61,9 @@
<data android:scheme="tabmates" />
<data android:host="app.tabmates.de" />

<data android:pathPrefix="/api/auth/verify" />
<data android:pathPrefix="/api/auth/reset-password" />
<data android:pathPrefix="/j/" />
<data android:pathPrefix="/verify/" />
<data android:pathPrefix="/reset-password/" />
<data android:pathPrefix="/join/" />
<data android:pathPrefix="/open" />
</intent-filter>
</activity>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,14 @@ class MainActivityDeepLinkTest {
val intent =
Intent(
Intent.ACTION_VIEW,
Uri.parse("https://app.tabmates.de/api/auth/verify?token=abc123"),
Uri.parse("https://app.tabmates.de/verify/abc123"),
)

Robolectric
.buildActivity(MainActivity::class.java, intent)
.create()

assertEquals("https://app.tabmates.de/api/auth/verify?token=abc123", received)
assertEquals("https://app.tabmates.de/verify/abc123", received)
}

@Test
Expand Down Expand Up @@ -65,11 +65,11 @@ class MainActivityDeepLinkTest {
val newIntent =
Intent(
Intent.ACTION_VIEW,
Uri.parse("https://app.tabmates.de/api/auth/reset-password?token=xyz789"),
Uri.parse("https://app.tabmates.de/reset-password/xyz789"),
)
activityController.newIntent(newIntent)

assertEquals("https://app.tabmates.de/api/auth/reset-password?token=xyz789", received)
assertEquals("https://app.tabmates.de/reset-password/xyz789", received)
}

// region — custom tabmates:// scheme (matches second intent-filter in AndroidManifest)
Expand All @@ -82,14 +82,14 @@ class MainActivityDeepLinkTest {
val intent =
Intent(
Intent.ACTION_VIEW,
Uri.parse("tabmates://app.tabmates.de/api/auth/verify?token=abc123"),
Uri.parse("tabmates://app.tabmates.de/verify/abc123"),
)

Robolectric
.buildActivity(MainActivity::class.java, intent)
.create()

assertEquals("tabmates://app.tabmates.de/api/auth/verify?token=abc123", received)
assertEquals("tabmates://app.tabmates.de/verify/abc123", received)
}

@Test
Expand All @@ -100,14 +100,14 @@ class MainActivityDeepLinkTest {
val intent =
Intent(
Intent.ACTION_VIEW,
Uri.parse("tabmates://app.tabmates.de/api/auth/reset-password?token=xyz789"),
Uri.parse("tabmates://app.tabmates.de/reset-password/xyz789"),
)

Robolectric
.buildActivity(MainActivity::class.java, intent)
.create()

assertEquals("tabmates://app.tabmates.de/api/auth/reset-password?token=xyz789", received)
assertEquals("tabmates://app.tabmates.de/reset-password/xyz789", received)
}

@Test
Expand All @@ -124,11 +124,11 @@ class MainActivityDeepLinkTest {
val newIntent =
Intent(
Intent.ACTION_VIEW,
Uri.parse("tabmates://app.tabmates.de/api/auth/verify?token=abc123"),
Uri.parse("tabmates://app.tabmates.de/verify/abc123"),
)
activityController.newIntent(newIntent)

assertEquals("tabmates://app.tabmates.de/api/auth/verify?token=abc123", received)
assertEquals("tabmates://app.tabmates.de/verify/abc123", received)
}

// endregion
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,9 +117,9 @@ private val savedStateConfiguration = SavedStateConfiguration {
// Matched against the user-facing public host (BASE_URL_PUBLIC, e.g. https://app.tabmates.de),
// not the backend API host — the same URL an installed app (App Links) and the web client resolve.
private val deepLinks = listOf(
navDeepLink<EmailVerification>(basePath = "${BuildKonfig.BASE_URL_PUBLIC}/api/auth/verify"),
navDeepLink<ResetPassword>(basePath = "${BuildKonfig.BASE_URL_PUBLIC}/api/auth/reset-password"),
navDeepLink<JoinGroup>(basePath = "${BuildKonfig.BASE_URL_PUBLIC}/j", pathSuffixParam = "token"),
navDeepLink<EmailVerification>(basePath = "${BuildKonfig.BASE_URL_PUBLIC}/verify", pathSuffixParam = "token"),
navDeepLink<ResetPassword>(basePath = "${BuildKonfig.BASE_URL_PUBLIC}/reset-password", pathSuffixParam = "token"),
navDeepLink<JoinGroup>(basePath = "${BuildKonfig.BASE_URL_PUBLIC}/join", pathSuffixParam = "token"),
navDeepLink<GroupDetail>(basePath = "${BuildKonfig.BASE_URL_PUBLIC}/groups", pathSuffixParam = "groupId"),
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import kotlinx.serialization.serializer
* TODO: Replace with `androidx.navigation3.NavDeepLink` when available.
*
* @param basePath Full URI prefix including scheme, host, and path
* (e.g. `https://example.com/api/auth/verify`).
* (e.g. `https://example.com/verify`).
* @param serializer The KotlinX [KSerializer] for the target NavKey type.
*/
data class NavDeepLink<T : NavKey>(
Expand All @@ -31,7 +31,7 @@ data class NavDeepLink<T : NavKey>(
* TODO: Replace import with `androidx.navigation3.navDeepLink` when available.
*
* @param pathSuffixParam If set, the path segment immediately following [basePath]
* (e.g. `abc123` in `/j/abc123`) is decoded as the value for this query param.
* (e.g. `abc123` in `/join/abc123`) is decoded as the value for this query param.
*/
inline fun <reified T : NavKey> navDeepLink(
basePath: String,
Expand Down
Loading