Skip to content

Commit

Permalink
Releasing 4.1.3
Browse files Browse the repository at this point in the history
  • Loading branch information
Rover Release Bot 🤖 committed Apr 28, 2023
1 parent 786cedb commit 2d184ee
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 14 deletions.
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.

// The version number for the build SDK modules and testbench app.
val roverSdkVersion by extra("4.1.2")
val roverSdkVersion by extra("4.1.3")

// Definitions of several core shared dependencies:
val kotlinVersion by extra("1.8.20") // NB: when changing this one check the two duplicates of this number below
Expand Down
10 changes: 2 additions & 8 deletions core/src/main/kotlin/io/rover/sdk/core/routing/Interfaces.kt
Original file line number Diff line number Diff line change
Expand Up @@ -54,20 +54,14 @@ interface LinkOpenInterface {
*
* Returns null if this link not handled by Rover.
*/
fun intentForLink(context: Context, uri: Uri): Intent? {
val androidUri = URI(uri.toString())
return if (localIntentForReceived(androidUri).isNotEmpty()) {
TransientLinkLaunchActivity.makeIntent(context, androidUri)
} else {
null
}
}
fun intentForLink(context: Context, uri: Uri): Intent?

/**
* Map a URI just received for a deep link to an explicit, mapped intent.
*
* May return more than one intent, meant for synthesizing a back stack in the event
* of the target needing synthesized back stack entries.
*/
@Deprecated("Use intentForLink() instead.")
fun localIntentForReceived(receivedUri: URI): List<Intent>
}
Original file line number Diff line number Diff line change
Expand Up @@ -46,15 +46,25 @@ open class TransientLinkLaunchActivity : Activity() {
return
}

val uri = URI(intent.data.toString())
val uri = intent.data ?: run {
log.e("Transient link launch activity was launched, but no URI was provided. Ignoring.")
return
}

log.v("Transient link launch activity running for received URI: '${intent.data}'")

val intentStack = linkOpen.localIntentForReceived(uri)
val linkIntent = linkOpen.intentForLink(this, uri) ?: run {
// no fallback to making a stock ACTION_VIEW intent for this uri is needed if Rover
// Router fails to produce a Uri is needed. This is because Link Launch activity
// is only used for *inbound* links being launched with the Rover SDK.
log.e("Rover router could not give us a URL for the URI: '$uri'. Ignoring.")
return
}

log.v("Launching intent: $linkIntent")

log.v("Launching stack ${intentStack.size} deep: ${intentStack.joinToString("\n") { it.toString() }}")
ContextCompat.startActivity(this, linkIntent, null)

if (intentStack.isNotEmpty()) ContextCompat.startActivities(this, intentStack.toTypedArray())
finish()
}

Expand Down
16 changes: 15 additions & 1 deletion core/src/main/kotlin/io/rover/sdk/core/ui/LinkOpen.kt
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,28 @@

package io.rover.sdk.core.ui

import android.content.Context
import android.content.Intent
import android.net.Uri
import io.rover.sdk.core.logging.log
import io.rover.sdk.core.routing.LinkOpenInterface
import io.rover.sdk.core.routing.Router
import io.rover.sdk.core.routing.TransientLinkLaunchActivity
import java.net.URI

class LinkOpen(
private val router: Router
private val router: Router,
) : LinkOpenInterface {

override fun intentForLink(context: Context, uri: Uri): Intent? {
val javaURI = try { URI(uri.toString()) } catch (e: Throwable) {
log.e("Unable to parse URI: $uri")
return null
}
return router.route(javaURI)
}

@Deprecated("Use intentForLink() instead.")
override fun localIntentForReceived(receivedUri: URI): List<Intent> {
return listOfNotNull(router.route(receivedUri))
}
Expand Down

0 comments on commit 2d184ee

Please sign in to comment.