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

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions FlipcashAPI/Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ let contractDependencies: [Package.Dependency] = protoLocalRoot.map { root in
.package(path: "\(root)/flipcash2-client-protocol"),
]
} ?? [
.package(url: "https://github.com/code-payments/ocp-client-protocol", exact: "0.2.0"),
.package(url: "https://github.com/code-payments/flipcash2-client-protocol", exact: "0.2.0"),
.package(url: "https://github.com/code-payments/ocp-client-protocol", exact: "0.3.0"),
.package(url: "https://github.com/code-payments/flipcash2-client-protocol", exact: "0.4.0"),
]

let package = Package(
Expand Down
12 changes: 11 additions & 1 deletion FlipcashCore/Sources/FlipcashCore/Models/UserFlags.swift
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,14 @@ public struct UserFlags: Codable, Sendable {
/// Server-defined tip amounts per fiat currency, in major units.
public let tipPresets: [TipPresets]

/// Duration after message creation when a message can be edited, or `nil` when the
/// server did not send a window.
public let messageEditWindow: TimeInterval?

/// Duration after message creation when a message can be deleted, or `nil` when the
/// server did not send a window.
public let messageDeleteWindow: TimeInterval?

/// Returns the tip presets for a currency, falling back to the USD row —
/// mirroring the server's minimum-enforcement fallback — or `nil` when the
/// server provided no presets at all.
Expand Down Expand Up @@ -147,7 +155,9 @@ extension UserFlags {
enablePhoneNumberSend: proto.enablePhoneNumberSend,
requireCoinbaseEmailVerification: proto.requireCoinbaseEmailVerification,
preferredOnrampUsdcLiquidityPool: UsdcLiquidityPool(proto.preferredOnRampUsdcLiquidityPool),
tipPresets: proto.tipPresets.compactMap { TipPresets($0) }
tipPresets: proto.tipPresets.compactMap { TipPresets($0) },
messageEditWindow: proto.hasMessageEditWindow ? TimeInterval(proto.messageEditWindow.seconds) : nil,
messageDeleteWindow: proto.hasMessageDeleteWindow ? TimeInterval(proto.messageDeleteWindow.seconds) : nil
)
}
}
Expand Down
8 changes: 6 additions & 2 deletions FlipcashTests/Database/Database+ProfileTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@ struct DatabaseProfileTests {
tipPresets: [
UserFlags.TipPresets(currency: .usd, minimum: 1, low: 5, medium: 10, high: 20),
UserFlags.TipPresets(currency: .cad, minimum: 2, low: 5, medium: 10, high: 25),
]
],
messageEditWindow: 900,
messageDeleteWindow: 300
)

/// Restricted account: no onramp providers, unset timeout, zero fees.
Expand All @@ -48,7 +50,9 @@ struct DatabaseProfileTests {
enablePhoneNumberSend: false,
requireCoinbaseEmailVerification: false,
preferredOnrampUsdcLiquidityPool: .unknown,
tipPresets: []
tipPresets: [],
messageEditWindow: nil,
messageDeleteWindow: nil
)

// MARK: - Empty (fresh install) -
Expand Down
4 changes: 3 additions & 1 deletion FlipcashTests/SessionTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -707,7 +707,9 @@ struct SessionOfflineCacheTests {
enablePhoneNumberSend: false,
requireCoinbaseEmailVerification: false,
preferredOnrampUsdcLiquidityPool: .unknown,
tipPresets: []
tipPresets: [],
messageEditWindow: nil,
messageDeleteWindow: nil
)
}

Expand Down
4 changes: 3 additions & 1 deletion FlipcashTests/TestSupport/UserFlags+Fixtures.swift
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@ extension UserFlags {
enablePhoneNumberSend: false,
requireCoinbaseEmailVerification: requireCoinbaseEmailVerification,
preferredOnrampUsdcLiquidityPool: .unknown,
tipPresets: tipPresets
tipPresets: tipPresets,
messageEditWindow: nil,
messageDeleteWindow: nil
)
}
}
8 changes: 6 additions & 2 deletions FlipcashTests/TestSupport/WithdrawViewModel+TestSupport.swift
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,9 @@ enum WithdrawViewModelTestHelpers {
enablePhoneNumberSend: false,
requireCoinbaseEmailVerification: false,
preferredOnrampUsdcLiquidityPool: .unknown,
tipPresets: []
tipPresets: [],
messageEditWindow: nil,
messageDeleteWindow: nil
)

return WithdrawViewModel(
Expand Down Expand Up @@ -139,7 +141,9 @@ enum WithdrawViewModelTestHelpers {
enablePhoneNumberSend: false,
requireCoinbaseEmailVerification: false,
preferredOnrampUsdcLiquidityPool: .unknown,
tipPresets: []
tipPresets: [],
messageEditWindow: nil,
messageDeleteWindow: nil
)
}
let stored = try #require(container.session.balance(for: .usdf))
Expand Down
4 changes: 3 additions & 1 deletion FlipcashTests/WithdrawViewModelTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,9 @@ struct WithdrawViewModelTests {
enablePhoneNumberSend: false,
requireCoinbaseEmailVerification: false,
preferredOnrampUsdcLiquidityPool: .unknown,
tipPresets: []
tipPresets: [],
messageEditWindow: nil,
messageDeleteWindow: nil
)
}
let stored = try #require(container.session.balance(for: mint))
Expand Down
Loading