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
12 changes: 12 additions & 0 deletions apps/flipcash/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,18 @@
android:scheme="https" />
</intent-filter>

<intent-filter android:autoVerify="true">
<action android:name="android.intent.action.VIEW" />

<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />

<data
android:host="app.flipcash.com"
android:pathPattern="/chat/.*"
android:scheme="https" />
</intent-filter>


<intent-filter android:autoVerify="true">
<action android:name="android.intent.action.VIEW" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ import com.flipcash.app.currency.RegionSelectionScreen
import com.flipcash.app.deposit.DepositFlowScreen
import com.flipcash.app.directsend.SendFlowScreen
import com.flipcash.app.invite.InviteContactScreen
import com.flipcash.app.messenger.MessengerScreen
import com.flipcash.app.messenger.ChatFlowScreen
import com.flipcash.app.messenger.ChatAmountEntryScreen
import com.flipcash.app.discovery.TokenDiscoveryScreen
import com.flipcash.app.internal.ui.navigation.decorators.rememberNavMessagingEntryDecorator
Expand Down Expand Up @@ -96,10 +96,10 @@ fun appEntryProvider(

// Messaging
annotatedEntry<AppRoute.Messaging.Chat> { key ->
MessengerScreen(key.e164, key.displayName)
ChatFlowScreen(route = key, resultStateRegistry = resultStateRegistry)
}
annotatedEntry<AppRoute.Messaging.AmountEntry> { key ->
ChatAmountEntryScreen(key.e164, key.displayName)
ChatAmountEntryScreen(key.identifier)
}

// Tokens
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,12 @@ import com.flipcash.app.core.verification.VerificationResult
import com.flipcash.app.core.verification.VerificationStep
import com.flipcash.app.core.withdrawal.WithdrawalResult
import com.flipcash.app.core.withdrawal.WithdrawalStep
import com.flipcash.app.core.chat.ChatStep
import com.flipcash.app.core.onboarding.OnboardingStep
import com.getcode.navigation.flow.FlowRoute
import com.getcode.navigation.flow.FlowRouteWithResult
import com.getcode.opencode.model.financial.Fiat
import com.flipcash.services.models.chat.ChatId
import com.getcode.solana.keys.Mint
import com.getcode.ui.core.RestrictionType
import kotlinx.parcelize.Parcelize
Expand Down Expand Up @@ -236,20 +238,35 @@ sealed interface AppRoute : NavKey, Parcelable {
data object NavBarSettings : Menu, com.getcode.navigation.Sheet, com.getcode.navigation.WrapContentSheet
}

@Serializable
@Parcelize
sealed interface ChatIdentifier : Parcelable {
val key: String

@Serializable
@Parcelize
data class ByChatId(val chatId: ChatId) : ChatIdentifier {
override val key: String get() = chatId.toString()
}

@Serializable
@Parcelize
data class ByContact(val e164: String, val displayName: String, val chatId: ChatId? = null) : ChatIdentifier {
override val key: String get() = e164
}
}

@Serializable
@Parcelize
sealed interface Messaging : AppRoute {
@Serializable
data class Chat(
val e164: String,
val displayName: String,
) : Messaging
data class Chat(val identifier: ChatIdentifier) : Messaging, FlowRoute {
override val initialStack: List<NavKey>
get() = listOf(ChatStep.Conversation)
}

@Serializable
data class AmountEntry(
val e164: String,
val displayName: String,
) : Messaging
data class AmountEntry(val identifier: ChatIdentifier) : Messaging
}

@Serializable
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package com.flipcash.app.core.chat

import android.os.Parcelable
import com.getcode.navigation.flow.FlowStep
import kotlinx.parcelize.Parcelize
import kotlinx.serialization.Serializable

@Serializable
sealed interface ChatStep : FlowStep, Parcelable {
@Parcelize
@Serializable
data object Conversation : ChatStep

@Parcelize
@Serializable
data object AmountEntry : ChatStep
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package com.flipcash.app.core.navigation

import android.net.Uri
import android.os.Parcelable
import com.flipcash.services.models.chat.ChatId
import com.getcode.solana.keys.Mint
import kotlinx.parcelize.Parcelize
import kotlinx.serialization.Serializable
Expand All @@ -15,6 +16,8 @@ sealed interface DeeplinkType: Parcelable {

@Serializable data class TokenInfo(val mint: Mint): DeeplinkType, Navigatable

@Serializable data class Chat(val chatId: ChatId): DeeplinkType, Navigatable

@Serializable
data class EmailVerification(
val email: String,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
package com.flipcash.app.core.util

import com.flipcash.services.models.chat.ChatId
import com.getcode.opencode.model.financial.Token
import com.getcode.solana.keys.Mint
import com.getcode.solana.keys.base58
import com.getcode.utils.encodeBase64
import com.getcode.utils.urlEncode

object Linkify {
Expand All @@ -13,4 +15,5 @@ object Linkify {
fun tweet(message: String): String = "https://www.twitter.com/intent/tweet?text=${message.urlEncode()}"
fun tokenInfo(token: Token): String = tokenInfo(token.address)
fun tokenInfo(mint: Mint): String = "https://app.flipcash.com/token/${mint.base58()}"
fun chat(chatId: ChatId): String = "https://app.flipcash.com/chat/${chatId.bytes.encodeBase64(urlSafe = true)}"
}
2 changes: 2 additions & 0 deletions apps/flipcash/features/direct-send/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@ dependencies {
implementation(project(":apps:flipcash:shared:featureflags"))
implementation(project(":apps:flipcash:shared:payments"))
implementation(project(":apps:flipcash:shared:permissions"))
implementation(project(":apps:flipcash:shared:chat"))
implementation(project(":apps:flipcash:shared:contacts"))
implementation(project(":apps:flipcash:shared:phone"))
implementation(project(":apps:flipcash:shared:tokens"))
implementation(project(":services:flipcash"))
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,17 @@
package com.flipcash.app.directsend.internal

import com.flipcash.app.contacts.device.DeviceContact
import com.flipcash.services.models.chat.ChatId
import kotlin.time.Instant

internal sealed interface ContactListItem {
data class Header(val title: String) : ContactListItem
data class ContactRow(val contact: DeviceContact, val isOnFlipcash: Boolean) : ContactListItem
data class ContactRow(
val contact: DeviceContact,
val isOnFlipcash: Boolean,
val lastMessagePreview: String? = null,
val unreadCount: Int = 0,
val chatId: ChatId? = null,
val lastActivity: Instant? = null,
) : ContactListItem
}
Loading
Loading