feat: migrate to navigation3 (#7)

Reviewed-on: https://git.reya.su/reya/coop-mobile/pulls/7
This commit is contained in:
2026-05-31 01:28:09 +00:00
parent b88674d6e2
commit a3ab489d44
16 changed files with 318 additions and 285 deletions
@@ -1,8 +1,25 @@
package su.reya.coop
import android.content.Intent
import androidx.navigation3.runtime.NavKey
import kotlinx.serialization.Serializable
sealed interface Screen {
sealed interface Screen : NavKey {
companion object {
fun fromIntent(intent: Intent): Screen? {
val data = intent.data ?: return null
if (data.scheme != "coop") return null
return when (data.host) {
// Matches coop://chat/{id}
"chat" -> data.pathSegments.firstOrNull()?.toLongOrNull()?.let { Chat(it) }
// Matches coop://profile/{pubkey}
"profile" -> data.pathSegments.firstOrNull()?.let { Profile(it) }
else -> null
}
}
}
@Serializable
data object Home : Screen