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
6 changes: 6 additions & 0 deletions Flipcash/Core/Controllers/ConversationController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -1691,6 +1691,12 @@ final class ConversationController {
}
}

/// The ID of the tip DM with `userID`, or nil when the chat hasn't started. The single "chat
/// started" rule: the visible DM. Hidden chats are excluded, and a block takes precedence anyway.
func tipDMID(withUserID userID: UserID) -> ConversationID? {
tipDM(withUserID: userID)?.id
}

private func contactName(for conversationID: ConversationID) -> String? {
guard let name = contactNaming.contactDisplayName(forDMChat: conversationID),
!name.isEmpty else {
Expand Down
13 changes: 13 additions & 0 deletions Flipcash/Core/Navigation/AppRouter.swift
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,19 @@ final class AppRouter {
return StackPosition(stack: stack, depth: max(self[stack].count - 1, 0))
}

/// The topmost stack and how many destinations it holds — the position of the screen on top of it.
/// `nil` when there is no topmost stack.
func positionOfTopmost() -> StackPosition? {
guard let stack = topmostStack else { return nil }
return StackPosition(stack: stack, depth: self[stack].count)
}

/// Whether `position` is still the topmost stack's top, so nothing has been pushed over it and no
/// other tab or sheet is in front.
func isTopmost(_ position: StackPosition) -> Bool {
positionOfTopmost() == position
}

/// Pops `position.stack` back down to `position.depth`, leaving whatever sat beneath intact.
func popTo(_ position: StackPosition) {
popLast(self[position.stack].count - position.depth, on: position.stack)
Expand Down
12 changes: 10 additions & 2 deletions Flipcash/Core/Screens/Conversation/StartChattingSheet.swift
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,15 @@ struct StartChattingSheet: View {
/// opened for once the send lands and the floor no longer applies.
let fee: FiatAmount

/// Called once the payment lands, before the sheet's success hold and dismissal.
var didSucceed: () -> Void = {}

var body: some View {
StartChattingSheetContent(
sessionContainer: sessionContainer,
target: target,
fee: fee
fee: fee,
onSuccess: didSucceed
)
}
}
Expand All @@ -51,15 +55,18 @@ private struct StartChattingSheetContent: View {
@State private var didSucceed: Bool = false

private let fee: FiatAmount
private let onSuccess: () -> Void

// MARK: - Init -

init(
sessionContainer: SessionContainer,
target: SendTarget,
fee: FiatAmount
fee: FiatAmount,
onSuccess: @escaping () -> Void
) {
self.fee = fee
self.onSuccess = onSuccess
_viewModel = State(initialValue: SendAmountViewModel(
sessionContainer: sessionContainer,
target: target
Expand Down Expand Up @@ -108,6 +115,7 @@ private struct StartChattingSheetContent: View {
switch await viewModel.submit(entered: amount.value) {
case .success:
didSucceed = true
onSuccess()
case .recipientNotFound:
dismiss()
throw StartChattingDismissed()
Expand Down
92 changes: 0 additions & 92 deletions Flipcash/Core/Screens/Main/You/ProfileTutorial.swift

This file was deleted.

Loading
Loading