Skip to content
Merged
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
Expand Up @@ -60,9 +60,6 @@ sealed interface DeeplinkType: Parcelable {
* send as a photo. A new route type is refused until someone adds it here, which is the
* property an `else -> false` would not have.
*
* [GroupChatInvite] is false because no scan path opens one -- `Scanner`'s `Navigatable`
* branch has no case for it. It is a gap named rather than a risk.
*
* iOS's equivalent is `ScanViewModel.canScanQR`.
*/
val isScannable: Boolean
Expand All @@ -72,11 +69,11 @@ sealed interface DeeplinkType: Parcelable {
is TipChat,
is Tipcard,
is TipcardByUsername,
is GroupChatInvite,
-> true

is Login,
is EmailVerification,
is GroupChatInvite,
-> false
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ class DeeplinkScanPolicyTest {
assertTrue(DeeplinkType.TipChat(ChatIdentifier.ByChatId(CHAT_ID)).isScannable)
assertTrue(DeeplinkType.Tipcard(USER_ID).isScannable)
assertTrue(DeeplinkType.TipcardByUsername(USERNAME).isScannable)
assertTrue(DeeplinkType.GroupChatInvite(CHAT_ID).isScannable)
}

@Test
Expand All @@ -31,17 +32,6 @@ class DeeplinkScanPolicyTest {
assertFalse(DeeplinkType.EmailVerification(EMAIL, CODE).isScannable)
}

/**
* Not a security judgement -- an invite is harmless. It is that no scan path has ever opened
* one: `Scanner`'s `Navigatable` branch has no case for it and falls to `emptyList()`. Naming
* it here keeps that a stated decision rather than a gap, and flipping it means adding the
* destination too.
*/
@Test
fun `a group chat invite is not a scan destination`() {
assertFalse(DeeplinkType.GroupChatInvite(CHAT_ID).isScannable)
}

private companion object {
const val ENTROPY = "0123456789abcdef"
const val USERNAME = "someone"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import androidx.lifecycle.compose.collectAsStateWithLifecycle
import com.flipcash.app.analytics.rememberAnalytics
import com.flipcash.app.core.AppRoute
import com.flipcash.app.core.AppRoute.Token.*
import com.flipcash.app.core.chat.ChatIdentifier
import com.flipcash.app.core.extensions.navigateAll
import com.flipcash.app.core.navigation.DeeplinkType
import com.flipcash.app.core.tipping.TipCardOwner
Expand Down Expand Up @@ -119,6 +120,12 @@ internal fun Scanner() {
AppRoute.Sheets.Tips(),
AppRoute.Messaging.Chat(deeplink.identifier),
)
// Same destination as the tapped /chat/{uuid} link: the chat screen is the
// gated preview when the viewer is not yet a member.
is DeeplinkType.GroupChatInvite -> listOf(
AppRoute.Sheets.Tips(),
AppRoute.Messaging.Chat(ChatIdentifier.ByChatId(deeplink.chatId)),
)
else -> emptyList()
}
if (routes.isNotEmpty()) {
Expand Down
Loading