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
14 changes: 13 additions & 1 deletion app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@
<category android:name="android.intent.category.BROWSABLE" />

<data
android:host="cash.getcode.com"
android:host="@string/root_url_cash_no_protocol"
android:pathPattern="/cash/.*"
android:scheme="https" />
</intent-filter>
Expand All @@ -127,6 +127,18 @@
android:pathPattern="/c/.*"
android:scheme="https" />
</intent-filter>

<intent-filter>
<action android:name="android.intent.action.VIEW" />

<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />

<data
android:host="jump.getcode.com"
android:scheme="https" />
</intent-filter>

<intent-filter>
<action android:name="android.intent.action.VIEW" />

Expand Down
11 changes: 10 additions & 1 deletion app/src/main/java/com/getcode/util/DeeplinkHandler.kt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import android.net.Uri
import android.os.Parcelable
import androidx.core.net.toUri
import cafe.adriel.voyager.core.screen.Screen
import com.getcode.R
import com.getcode.model.PrefsBool
import com.getcode.models.DeepLinkRequest
import com.getcode.navigation.screens.ScanScreen
Expand Down Expand Up @@ -55,7 +56,7 @@ class DeeplinkHandler @Inject constructor(

suspend fun handle(intent: Intent? = debounceIntent): DeeplinkResult? {
println(intent)
val uri = when {
var uri = when {
intent?.data != null -> intent.data
intent?.getStringExtra(Intent.EXTRA_TEXT) != null -> {
val sharedLink = intent.getStringExtra(Intent.EXTRA_TEXT)?.toUri() ?: return null
Expand All @@ -68,6 +69,14 @@ class DeeplinkHandler @Inject constructor(
else -> null
} ?: return null

// check for jump
if (uri.host == context.getString(R.string.root_url_jump_no_protocol)) {
val source = uri.getQueryParameter("source")
if (source != null) {
uri = Uri.parse(source)
}
}

return when (val type = uri.deeplinkType) {
is Type.Login -> {
DeeplinkResult(
Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/values/strings-universal.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
<string translatable="false" name="root_url_cash">https://cash.getcode.com</string>
<string translatable="false" name="app_url_cash">codewallet://cash.getcode.com</string>
<string translatable="false" name="root_url_app_no_protocol">app.getcode.com</string>
<string translatable="false" name="root_url_jump_no_protocol">jump.getcode.com</string>
<string translatable="false" name="root_url_cash_no_protocol">cash.getcode.com</string>
<string translatable="false" name="root_url_sdk_no_protocol">sdk.getcode.com</string>
<string translatable="false" name="root_url_tipcard_no_protocol">tipcard.getcode.com</string>
Expand Down