Skip to content

Commit

Permalink
Small deeplink support improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
MkhytarMkhoian committed Jun 5, 2024
1 parent 08112fe commit d222402
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 8 deletions.
4 changes: 1 addition & 3 deletions app/src/main/java/com/moove/app/di/MainModule.kt
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,7 @@ import org.koin.dsl.module
val mainModule = module {

factory {
AppNavigator(
navController = get(),
)
AppNavigator(navController = get())
} binds arrayOf(
ScreenNavigator::class,
GlobalAppNavigator::class,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@ class AppDeepLinkLocalDataSource(

private fun String.isThat(type: String): Boolean {
/**
* Handle two cases
* app/profile/ and app/profile
* Handle two cases with slash symbol at the end and without it
* app/home/ and app/home
*/
return contains(type, ignoreCase = true)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,14 @@ import kotlinx.coroutines.withContext

class FirebaseDynamicLinkDataSource(
private val host: String,
// private val firebaseDynamicLinks: FirebaseDynamicLinks,
private val firebaseDynamicLinks: FirebaseDynamicLinks,
private val backgroundDispatcher: CoroutineDispatcher = Dispatchers.IO,
) {

suspend fun parseLink(uri: String): String? = withContext(backgroundDispatcher) {
if (uri.matchesPattern(host).not()) return@withContext null
try {
// firebaseDynamicLinks.getDynamicLink(Uri.parse(uri)).await().link?.toString()
"https://moove.page.link/45hj45j"
firebaseDynamicLinks.getDynamicLink(Uri.parse(uri)).await().link?.toString()
} catch (e: Exception) {
throw DynamicLinkParseException(cause = e)
}
Expand Down

0 comments on commit d222402

Please sign in to comment.