Skip to content
Open
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
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
package dev.hotwire.navigation.routing

import android.content.ActivityNotFoundException
import androidx.browser.customtabs.CustomTabColorSchemeParams
import androidx.browser.customtabs.CustomTabsIntent
import androidx.core.net.toUri
import com.google.android.material.R
import dev.hotwire.navigation.activities.HotwireActivity
import dev.hotwire.navigation.logging.logError
import dev.hotwire.navigation.navigator.NavigatorConfiguration
import dev.hotwire.navigation.util.colorFromThemeAttr

Expand Down Expand Up @@ -39,13 +41,17 @@ class BrowserTabRouteDecisionHandler : Router.RouteDecisionHandler {
.setNavigationBarColor(color)
.build()

CustomTabsIntent.Builder()
.setShowTitle(true)
.setShareState(CustomTabsIntent.SHARE_STATE_ON)
.setUrlBarHidingEnabled(false)
.setDefaultColorSchemeParams(colorParams)
.build()
.launchUrl(activity, location.toUri())
try {
CustomTabsIntent.Builder()
.setShowTitle(true)
.setShareState(CustomTabsIntent.SHARE_STATE_ON)
.setUrlBarHidingEnabled(false)
.setDefaultColorSchemeParams(colorParams)
.build()
.launchUrl(activity, location.toUri())
} catch (e: ActivityNotFoundException) {
logError("BrowserTabRouteDecisionHandler", e)
}

return Router.Decision.CANCEL
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ class SystemNavigationRouteDecisionHandler : Router.RouteDecisionHandler {
activity.startActivity(intent)
} catch (e: ActivityNotFoundException) {
logError("SystemNavigationRouteDecisionHandler", e)
} catch (e: SecurityException) {
logError("SystemNavigationRouteDecisionHandler", e)
}

return Router.Decision.CANCEL
Expand Down