@@ -4,6 +4,8 @@ import androidx.navigation3.runtime.NavKey
44import dev.dimension.flare.data.model.TimelineTabItem
55import dev.dimension.flare.model.AccountType
66import dev.dimension.flare.model.MicroBlogKey
7+ import kotlinx.collections.immutable.ImmutableMap
8+ import kotlinx.collections.immutable.toImmutableMap
79import kotlinx.serialization.Serializable
810
911@Serializable
@@ -404,110 +406,151 @@ internal sealed interface Route : NavKey {
404406 @Serializable
405407 data object AccountSelection : Route
406408
409+ @Serializable
410+ data class DeepLinkAccountPicker (
411+ val originalUrl : String ,
412+ val data : ImmutableMap <MicroBlogKey , Route >,
413+ ) : Route
414+
407415 companion object {
408416 public fun parse (url : String ): Route ? {
409417 val deeplinkRoute = DeeplinkRoute .parse(url) ? : return null
418+ return from(deeplinkRoute)
419+ }
420+
421+ public fun from (deeplinkRoute : DeeplinkRoute ): Route ? {
410422 return when (deeplinkRoute) {
411- is DeeplinkRoute .Login -> Route .ServiceSelect .Selection
412- is DeeplinkRoute .Callback -> null
423+ is DeeplinkRoute .OpenLinkDirectly -> null
424+ is DeeplinkRoute .DeepLinkAccountPicker ->
425+ DeepLinkAccountPicker (
426+ originalUrl = deeplinkRoute.originalUrl,
427+ data =
428+ deeplinkRoute.data
429+ .mapNotNull { (key, value) ->
430+ val route = Route .from(value) ? : return @mapNotNull null
431+ key to route
432+ }.toMap()
433+ .toImmutableMap(),
434+ )
435+
436+ is DeeplinkRoute .Login -> ServiceSelect .Selection
413437 is DeeplinkRoute .Compose .New ->
414- Route .Compose .New (accountType = deeplinkRoute.accountType)
438+ Compose .New (accountType = deeplinkRoute.accountType)
439+
415440 is DeeplinkRoute .Compose .Quote ->
416- Route . Compose .Quote (
441+ Compose .Quote (
417442 accountKey = deeplinkRoute.accountKey,
418443 statusKey = deeplinkRoute.statusKey,
419444 )
445+
420446 is DeeplinkRoute .Compose .Reply ->
421- Route . Compose .Reply (
447+ Compose .Reply (
422448 accountKey = deeplinkRoute.accountKey,
423449 statusKey = deeplinkRoute.statusKey,
424450 )
451+
425452 is DeeplinkRoute .Compose .VVOReplyComment ->
426- Route . Compose .VVOReplyComment (
453+ Compose .VVOReplyComment (
427454 accountKey = deeplinkRoute.accountKey,
428455 replyTo = deeplinkRoute.replyTo,
429456 rootId = deeplinkRoute.rootId,
430457 )
458+
431459 is DeeplinkRoute .Media .Image ->
432- Route . Media .Image (
460+ Media .Image (
433461 uri = deeplinkRoute.uri,
434462 previewUrl = deeplinkRoute.previewUrl,
435463 )
464+
436465 is DeeplinkRoute .Media .Podcast ->
437- Route . Media .Podcast (
466+ Media .Podcast (
438467 accountType = deeplinkRoute.accountType,
439468 id = deeplinkRoute.id,
440469 )
470+
441471 is DeeplinkRoute .Media .StatusMedia ->
442- Route . Media .StatusMedia (
472+ Media .StatusMedia (
443473 statusKey = deeplinkRoute.statusKey,
444474 accountType = deeplinkRoute.accountType,
445475 index = deeplinkRoute.index,
446476 preview = deeplinkRoute.preview,
447477 )
478+
448479 is DeeplinkRoute .Profile .User ->
449- Route . Profile .User (
480+ Profile .User (
450481 accountType = deeplinkRoute.accountType,
451482 userKey = deeplinkRoute.userKey,
452483 )
484+
453485 is DeeplinkRoute .Profile .UserNameWithHost ->
454- Route . Profile .UserNameWithHost (
486+ Profile .UserNameWithHost (
455487 accountType = deeplinkRoute.accountType,
456488 name = deeplinkRoute.userName,
457489 host = deeplinkRoute.host,
458490 )
491+
459492 is DeeplinkRoute .Rss .Detail ->
460- Route . Rss .Detail (
493+ Rss .Detail (
461494 url = deeplinkRoute.url,
462495 )
496+
463497 is DeeplinkRoute .Search ->
464- Route . Search (
498+ Search (
465499 accountType = deeplinkRoute.accountType,
466500 query = deeplinkRoute.query,
467501 )
502+
468503 is DeeplinkRoute .Status .AddReaction ->
469- Route . Status .AddReaction (
504+ Status .AddReaction (
470505 statusKey = deeplinkRoute.statusKey,
471506 accountType = deeplinkRoute.accountType,
472507 )
508+
473509 is DeeplinkRoute .Status .AltText ->
474- Route . Status .AltText (
510+ Status .AltText (
475511 text = deeplinkRoute.text,
476512 )
513+
477514 is DeeplinkRoute .Status .BlueskyReport ->
478- Route . Status .BlueskyReport (
515+ Status .BlueskyReport (
479516 statusKey = deeplinkRoute.statusKey,
480517 accountType = deeplinkRoute.accountType,
481518 )
519+
482520 is DeeplinkRoute .Status .DeleteConfirm ->
483- Route . Status .DeleteConfirm (
521+ Status .DeleteConfirm (
484522 statusKey = deeplinkRoute.statusKey,
485523 accountType = deeplinkRoute.accountType,
486524 )
525+
487526 is DeeplinkRoute .Status .Detail ->
488- Route . Status .Detail (
527+ Status .Detail (
489528 statusKey = deeplinkRoute.statusKey,
490529 accountType = deeplinkRoute.accountType,
491530 )
531+
492532 is DeeplinkRoute .Status .MastodonReport ->
493- Route . Status .MastodonReport (
533+ Status .MastodonReport (
494534 userKey = deeplinkRoute.userKey,
495535 statusKey = deeplinkRoute.statusKey,
496536 accountType = deeplinkRoute.accountType,
497537 )
538+
498539 is DeeplinkRoute .Status .MisskeyReport ->
499- Route . Status .MisskeyReport (
540+ Status .MisskeyReport (
500541 userKey = deeplinkRoute.userKey,
501542 statusKey = deeplinkRoute.statusKey,
502543 accountType = deeplinkRoute.accountType,
503544 )
545+
504546 is DeeplinkRoute .Status .VVOComment ->
505- Route . Status .VVOComment (
547+ Status .VVOComment (
506548 commentKey = deeplinkRoute.commentKey,
507549 accountType = deeplinkRoute.accountType,
508550 )
551+
509552 is DeeplinkRoute .Status .VVOStatus ->
510- Route . Status .VVOStatus (
553+ Status .VVOStatus (
511554 statusKey = deeplinkRoute.statusKey,
512555 accountType = deeplinkRoute.accountType,
513556 )
0 commit comments