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
17 changes: 2 additions & 15 deletions Flipcash/Core/Navigation/AppRouter+Destination.swift
Original file line number Diff line number Diff line change
Expand Up @@ -111,14 +111,6 @@ extension AppRouter {
/// trace shows "post-tip, keyboard up" distinctly, and so the ordinary
/// tip-list / push-notification opens stay keyboard-closed untouched.
case tipConversationWithKeyboard(ConversationID)
/// A tip DM named by its counterpart rather than its chat id — the
/// username lookup's destination. The chat is created by the first tip,
/// so before then there is no id to push; the screen derives one.
case tipConversationForUser(UserID)
/// Same chat as `tipConversationForUser`, opened with Send Cash already started — the
/// profile's Send Cash button. A sibling case for the same reason as
/// `tipConversationWithKeyboard`: the trace shows the send-first open distinctly.
case tipConversationForUserSendingCash(UserID)
/// A person's Flipcash profile, pushed from a tip DM's title/card or a group member's face;
/// hosts the Block action. `origin` decides whether it offers a way into the DM.
case userProfile(UserID, origin: UserProfileOrigin)
Expand Down Expand Up @@ -156,8 +148,7 @@ extension AppRouter {
.settingsApplicationLogs, .blockedUsers, .accessKey, .withdraw:
return .you
case .profileName, .profilePhoto, .tipcard, .usernameLookup, .newChat, .newPublicGroup,
.tipConversation, .tipConversationWithKeyboard, .tipConversationForUser,
.tipConversationForUserSendingCash, .userProfile, .chatProfile,
.tipConversation, .tipConversationWithKeyboard, .userProfile, .chatProfile,
.editGroup, .editGroupName, .editGroupPicture, .archivedChats:
return .tips
}
Expand Down Expand Up @@ -209,8 +200,6 @@ extension AppRouter {
case .newPublicGroup: "newPublicGroup"
case .tipConversation: "tipConversation"
case .tipConversationWithKeyboard: "tipConversationWithKeyboard"
case .tipConversationForUser: "tipConversationForUser"
case .tipConversationForUserSendingCash: "tipConversationForUserSendingCash"
case .userProfile: "userProfile"
case .chatProfile: "chatProfile"
case .editGroup: "editGroup"
Expand Down Expand Up @@ -244,9 +233,7 @@ extension AppRouter {
.editGroupName(let conversationID),
.editGroupPicture(let conversationID):
return conversationID.description
case .userProfile(let userID, _),
.tipConversationForUser(let userID),
.tipConversationForUserSendingCash(let userID):
case .userProfile(let userID, _):
return userID.uuidString
case .username(let username):
return username?.value
Expand Down
11 changes: 0 additions & 11 deletions Flipcash/Core/Navigation/AppRouter+DestinationView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -210,17 +210,6 @@ struct DestinationView: View {
ConversationScreen(context: .existing(conversationID), openKeyboard: true)
.id(conversationID)

case .tipConversationForUser(let userID):
// Opened before the chat exists, so the screen is given the person
// and derives the chat id itself. `.id` forces fresh view identity.
ConversationScreen(context: .tipDM(counterpart: userID))
.id(userID)

case .tipConversationForUserSendingCash(let userID):
// The profile's Send Cash: the same chat, with the send started on open.
ConversationScreen(context: .tipDM(counterpart: userID), startSendCash: true)
.id(userID)

case .userProfile(let userID, let origin):
UserProfileScreen(userID: userID, origin: origin)
.id(userID)
Expand Down
22 changes: 22 additions & 0 deletions Flipcash/Core/Navigation/DMRoute.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
//
// DMRoute.swift
// Flipcash
//

import FlipcashCore

/// Where opening a person lands: their DM once it exists, their profile until then.
nonisolated enum DMRoute {

/// The destination for opening `userID`, given the DM with them if there is one.
static func destination(
for userID: UserID,
dmID: ConversationID?,
origin: UserProfileOrigin
) -> AppRouter.Destination {
if let dmID {
return .tipConversation(dmID)
}
return .userProfile(userID, origin: origin)
}
}
12 changes: 2 additions & 10 deletions Flipcash/Core/Screens/Conversation/ChatScreenRepresentable.swift
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,6 @@ struct ChatScreenRepresentable: UIViewControllerRepresentable {
/// Fired when the long-press strip's "+" is tapped, with the row's stable id.
let onReactionStripAdd: (String) -> Void
let showsSendCash: Bool
let chatExists: Bool
let conversationID: ConversationID?
let symbol: String
let onSendCash: () -> Void
Expand All @@ -95,10 +94,6 @@ struct ChatScreenRepresentable: UIViewControllerRepresentable {
/// the composer field in `viewDidAppear` — a hosted SwiftUI `@FocusState` never presents the
/// keyboard across the hosting boundary.
let focusOnAppear: Bool
/// Whether this is a tip DM, whose Send Cash reads Start Chatting until the chat exists.
let isTipDm: Bool
/// The floor the first tip has to clear to open this chat, named on the CTA.
let startChattingFee: FiatAmount?
/// Whether the chat's participation rules leave this user anything to type, and whether they
/// may read at all. Drives the gate panel in place of the bar and the blur over the transcript.
let gate: ConversationGatePresentation
Expand Down Expand Up @@ -150,7 +145,7 @@ struct ChatScreenRepresentable: UIViewControllerRepresentable {
screen.focusesComposerOnAppear = focusOnAppear
screen.isTranscriptObscured = gate.obscuresTranscript
screen.showsGatePlaceholder = showsGatePlaceholder
screen.barRestingDrop = chatExists ? BarMetrics.compactDrop : 0
screen.barRestingDrop = BarMetrics.compactDrop
screen.authorAvatars = authorAvatars
screen.onReachTop = onReachTop
screen.onRetry = onRetry
Expand Down Expand Up @@ -206,7 +201,7 @@ struct ChatScreenRepresentable: UIViewControllerRepresentable {
context.coordinator.barHost?.rootView = bar(coordinator: context.coordinator)
screen.isTranscriptObscured = gate.obscuresTranscript
screen.showsGatePlaceholder = showsGatePlaceholder
screen.barRestingDrop = chatExists ? BarMetrics.compactDrop : 0
screen.barRestingDrop = BarMetrics.compactDrop
screen.authorAvatars = authorAvatars
screen.onReachTop = onReachTop
screen.onRetry = onRetry
Expand Down Expand Up @@ -313,14 +308,11 @@ struct ChatScreenRepresentable: UIViewControllerRepresentable {
return AnyView(
ConversationBottomBar(
showsSendCash: showsSendCash,
chatExists: chatExists,
conversationID: conversationID,
symbol: symbol,
onSendCash: onSendCash,
model: barModel,
composer: composer,
isTipDm: isTipDm,
startChattingFee: startChattingFee,
gate: gate,
gateMintName: gateMintName,
onGateAddFunds: onGateAddFunds,
Expand Down
Loading
Loading