Updated on 2026-08-14
This commit is contained in:
parent
64c7c64b3a
commit
713cad5fd7
26 changed files with 100 additions and 359 deletions
|
|
@ -4,7 +4,6 @@ import android.os.Bundle
|
|||
import com.tangem.common.routing.bundle.RouteBundleParams
|
||||
import com.tangem.common.routing.bundle.bundle
|
||||
import com.tangem.common.routing.entity.InitScreenLaunchMode
|
||||
import com.tangem.common.routing.entity.SerializableIntent
|
||||
import com.tangem.core.decompose.navigation.Route
|
||||
import com.tangem.domain.appcurrency.model.AppCurrency
|
||||
import com.tangem.domain.feedback.models.WalletMetaInfo
|
||||
|
|
@ -32,9 +31,6 @@ sealed class AppRoute(val path: String) : Route {
|
|||
data class Welcome(
|
||||
@Deprecated("No longer used, will be removed in future releases")
|
||||
val launchMode: InitScreenLaunchMode = InitScreenLaunchMode.Standard,
|
||||
// we still have this param to be handled by WalletConnectLinkIntentHandler in WelcomeMiddleware
|
||||
@Deprecated("No longer used, will be removed in future releases")
|
||||
val intent: SerializableIntent? = null,
|
||||
) : AppRoute(path = "/welcome"), RouteBundleParams {
|
||||
|
||||
override fun getBundle(): Bundle = bundle(serializer())
|
||||
|
|
|
|||
|
|
@ -1,24 +0,0 @@
|
|||
package com.tangem.common.routing.entity
|
||||
|
||||
import android.os.Bundle
|
||||
import kotlinx.serialization.Serializable
|
||||
|
||||
@Serializable
|
||||
data class SerializableBundle(
|
||||
val map: Map<String, String>,
|
||||
) {
|
||||
|
||||
constructor(bundle: Bundle) : this(
|
||||
map = bundle.keySet().mapNotNull { key ->
|
||||
bundle.getString(key)?.let { key to it }
|
||||
}.toMap(),
|
||||
)
|
||||
|
||||
fun toBundle(): Bundle {
|
||||
return Bundle().apply {
|
||||
map.forEach { (key, value) ->
|
||||
putString(key, value)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,52 +0,0 @@
|
|||
package com.tangem.common.routing.entity
|
||||
|
||||
import android.content.ComponentName
|
||||
import android.content.Intent
|
||||
import android.net.Uri
|
||||
import kotlinx.serialization.Serializable
|
||||
|
||||
@Serializable
|
||||
data class SerializableIntent(
|
||||
val action: String?,
|
||||
val dataString: String?,
|
||||
val categories: Set<String>?,
|
||||
val type: String?,
|
||||
val packageValue: String?,
|
||||
val component: String?,
|
||||
val flags: Int,
|
||||
// CAUTION: works wrong with SerializableBundle constructor(bundle: Bundle), need to be removed
|
||||
val extras: SerializableBundle?,
|
||||
) {
|
||||
|
||||
constructor(intent: Intent) : this(
|
||||
action = intent.action,
|
||||
dataString = intent.dataString,
|
||||
categories = intent.categories,
|
||||
type = intent.type,
|
||||
packageValue = intent.`package`,
|
||||
component = intent.component?.flattenToString(),
|
||||
flags = intent.flags,
|
||||
extras = intent.extras?.let(::SerializableBundle),
|
||||
)
|
||||
|
||||
fun toIntent(): Intent {
|
||||
val intent = Intent()
|
||||
|
||||
intent.action = action
|
||||
intent.setDataAndType(
|
||||
dataString?.let { Uri.parse(it) },
|
||||
type,
|
||||
)
|
||||
categories?.let { categories ->
|
||||
for (category in categories) {
|
||||
intent.addCategory(category)
|
||||
}
|
||||
}
|
||||
intent.`package` = packageValue
|
||||
intent.component = component?.let { ComponentName.unflattenFromString(it) }
|
||||
intent.flags = flags
|
||||
extras?.let { intent.putExtras(it.toBundle()) }
|
||||
|
||||
return intent
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue