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
57 changes: 57 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,63 @@ called out explicitly even when nothing else did.
release notes, so a version with no entry here does not release. Write the entry in the same PR that
syncs the contract, while the diff is still in front of you.

## 0.13.0

Synced to [`flipcash2-protobuf-api@3d6de707`](https://github.com/code-payments/flipcash2-protobuf-api/commit/3d6de707e8b013435b802ea3c37ddf6fff21ba6d),
picking up [#123](https://github.com/code-payments/flipcash2-protobuf-api/pull/123) through
[#126](https://github.com/code-payments/flipcash2-protobuf-api/pull/126). `chat.v1`, `intent.v1`,
`messaging.v1` and `profile.v1` moved.

The binary wire format is unchanged, but tip DMs are now plain DMs, and that rename breaks source in
both languages. Every other change is additive.

### Added

- `messaging.v1.WidgetContent`, a new `Content.type` case (`widget = 8`), for messages that clients
render as a native widget. Its required `type` oneof has one case, `share_profile = 1`, holding
the new `ShareProfileWidget` with a required `username` (field 1, `common.v1.Username`). A client
that does not recognize the widget variant renders the message as unsupported.
- `chat.v1.Never`, a new empty message and a new `SpeakerRules` rule case (`never = 3`): nobody may
speak.
- `profile.v1.SetDisplayNameResponse.username` (field 3, `common.v1.Username`). The server may now
auto-assign a username derived from the display name, so this carries the caller's current
username. It is set only when `result == OK`, and unset if the caller has no username.

### Changed

Renamed, with numbers unchanged:

| Before | After | Swift | Kotlin |
|---|---|---|---|
| `chat.v1.ChatType.TIP_DM = 2` | `DM = 2` | `.tipDm` → `.dm` | `TIP_DM` → `DM` |
| `intent.v1.ChatMetadata.TipDmPayment` | `DmPayment` | `.TipDmPayment` → `.DmPayment` | `TipDmPayment` → `DmPayment` |
| `ChatMetadata.tip_dm_payment = 3` | `dm_payment = 3` | `tipDmPayment` / `.tipDmPayment` → `dmPayment` / `.dmPayment` | `getTipDmPayment()` / `TIP_DM_PAYMENT` → `getDmPayment()` / `DM_PAYMENT` |
| `DmPayment.Location.TIPCARD = 0` | `FLIPCARD = 0` | `.tipcard` → `.flipcard` | `TIPCARD` → `FLIPCARD` |

`DmPayment.Action.DEFAULT` is now documented as meaning `SEND`: the payment shows as sent, not
tipped. The value did not change.

### Upgrading

**The renames are compile errors, not wire changes.** Binary protobuf carries field and enum
numbers, so an old client and a new one still read each other's messages. Code that names any of
the four symbols above has to be updated before it builds. Proto JSON encodes enums by name, so
anything that serializes these enums as JSON sees `DM` and `FLIPCARD` in place of the old names.

**Read `username` back after `SetDisplayName`.** Setting a display name can now change the
caller's username. A client that caches the username should replace it with the response's value
on `OK`.

**`WidgetContent` needs a fallback before the server sends it.** A client that switches
exhaustively over `Content.type` needs a case for `widget`, and an unknown widget variant renders
as unsupported.

### Unchanged

Nothing was renumbered. `Content.widget` and `SpeakerRules.never` are appended to their oneofs, and
`SetDisplayNameResponse.username` takes a free number. No service, RPC or enum case was removed.
Everything else in the diff is comments.

## 0.12.0

Synced to [`flipcash2-protobuf-api@9ebf55fe`](https://github.com/code-payments/flipcash2-protobuf-api/commit/9ebf55fef834c1a47ae995ae22cad28d79080f2c),
Expand Down
4 changes: 2 additions & 2 deletions Sources/Flipcash2ClientProtocol/ContractInfo.swift
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// Generated by scripts/generate-swift.sh. Do not edit.

public enum Flipcash2ContractInfo {
public static let version = "0.11.0-dev"
public static let protoCommit = "9ebf55fef834c1a47ae995ae22cad28d79080f2c"
public static let version = "0.12.0-dev"
public static let protoCommit = "3d6de707e8b013435b802ea3c37ddf6fff21ba6d"

public static var isLocal: Bool { protoCommit == localSentinel }

Expand Down
72 changes: 64 additions & 8 deletions Sources/Flipcash2ClientProtocol/chat_v1_model.pb.swift
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public enum Flipcash_Chat_V1_ChatType: SwiftProtobuf.Enum, Swift.CaseIterable {
public typealias RawValue = Int
case unknown // = 0
case contactDm // = 1
case tipDm // = 2
case dm // = 2
case group // = 3
case UNRECOGNIZED(Int)

Expand All @@ -37,7 +37,7 @@ public enum Flipcash_Chat_V1_ChatType: SwiftProtobuf.Enum, Swift.CaseIterable {
switch rawValue {
case 0: self = .unknown
case 1: self = .contactDm
case 2: self = .tipDm
case 2: self = .dm
case 3: self = .group
default: self = .UNRECOGNIZED(rawValue)
}
Expand All @@ -47,7 +47,7 @@ public enum Flipcash_Chat_V1_ChatType: SwiftProtobuf.Enum, Swift.CaseIterable {
switch self {
case .unknown: return 0
case .contactDm: return 1
case .tipDm: return 2
case .dm: return 2
case .group: return 3
case .UNRECOGNIZED(let i): return i
}
Expand All @@ -57,7 +57,7 @@ public enum Flipcash_Chat_V1_ChatType: SwiftProtobuf.Enum, Swift.CaseIterable {
public static let allCases: [Flipcash_Chat_V1_ChatType] = [
.unknown,
.contactDm,
.tipDm,
.dm,
.group,
]

Expand Down Expand Up @@ -196,8 +196,8 @@ public struct Flipcash_Chat_V1_Metadata: @unchecked Sendable {
public mutating func clearCreator() {_uniqueStorage()._creator = nil}

/// Whether messages in this chat are end-to-end encrypted (see
/// messaging.v1.EncryptedContent). Only supported for DMs (CONTACT_DM or
/// TIP_DM); always false for group chats.
/// messaging.v1.EncryptedContent). Only supported for DMs (CONTACT_DM or DM);
/// always false for group chats.
///
/// Used to migrate DMs to E2EE: when true, clients send all new content in
/// the chat as EncryptedContent. When false, clients send content in the
Expand Down Expand Up @@ -304,11 +304,20 @@ public struct Flipcash_Chat_V1_SpeakerRules: Sendable {
set {kind = .staff(newValue)}
}

public var never: Flipcash_Chat_V1_Never {
get {
if case .never(let v)? = kind {return v}
return Flipcash_Chat_V1_Never()
}
set {kind = .never(newValue)}
}

public var unknownFields = SwiftProtobuf.UnknownStorage()

public enum OneOf_Kind: Equatable, Sendable {
case minimumBalance(Flipcash_Chat_V1_MinimumBalanceRequirement)
case staff(Flipcash_Chat_V1_StaffRequirement)
case never(Flipcash_Chat_V1_Never)

}

Expand All @@ -327,6 +336,17 @@ public struct Flipcash_Chat_V1_StaffRequirement: Sendable {
public init() {}
}

/// A special rule indicating that an action can never be taken.
public struct Flipcash_Chat_V1_Never: Sendable {
// SwiftProtobuf.Message conformance is added in an extension below. See the
// `Message` and `Message+*Additions` files in the SwiftProtobuf library for
// methods supported on all messages.

public var unknownFields = SwiftProtobuf.UnknownStorage()

public init() {}
}

/// MinimumBalanceRequirement requires a user to hold a minimum balance,
/// denominated in fiat, in an acceptable mint.
public struct Flipcash_Chat_V1_MinimumBalanceRequirement: Sendable {
Expand Down Expand Up @@ -947,7 +967,7 @@ public struct Flipcash_Chat_V1_IdempotencyKey: Sendable {
fileprivate let _protobuf_package = "flipcash.chat.v1"

extension Flipcash_Chat_V1_ChatType: SwiftProtobuf._ProtoNameProviding {
public static let _protobuf_nameMap = SwiftProtobuf._NameMap(bytecode: "\0\u{2}\0UNKNOWN\0\u{1}CONTACT_DM\0\u{1}TIP_DM\0\u{1}GROUP\0")
public static let _protobuf_nameMap = SwiftProtobuf._NameMap(bytecode: "\0\u{2}\0UNKNOWN\0\u{1}CONTACT_DM\0\u{1}DM\0\u{1}GROUP\0")
}

extension Flipcash_Chat_V1_Metadata: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
Expand Down Expand Up @@ -1215,7 +1235,7 @@ extension Flipcash_Chat_V1_ListenerRules: SwiftProtobuf.Message, SwiftProtobuf._

extension Flipcash_Chat_V1_SpeakerRules: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
public static let protoMessageName: String = _protobuf_package + ".SpeakerRules"
public static let _protobuf_nameMap = SwiftProtobuf._NameMap(bytecode: "\0\u{3}minimum_balance\0\u{1}staff\0")
public static let _protobuf_nameMap = SwiftProtobuf._NameMap(bytecode: "\0\u{3}minimum_balance\0\u{1}staff\0\u{1}never\0")

public mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
while let fieldNumber = try decoder.nextFieldNumber() {
Expand Down Expand Up @@ -1249,6 +1269,19 @@ extension Flipcash_Chat_V1_SpeakerRules: SwiftProtobuf.Message, SwiftProtobuf._M
self.kind = .staff(v)
}
}()
case 3: try {
var v: Flipcash_Chat_V1_Never?
var hadOneofValue = false
if let current = self.kind {
hadOneofValue = true
if case .never(let m) = current {v = m}
}
try decoder.decodeSingularMessageField(value: &v)
if let v = v {
if hadOneofValue {try decoder.handleConflictingOneOf()}
self.kind = .never(v)
}
}()
default: break
}
}
Expand All @@ -1268,6 +1301,10 @@ extension Flipcash_Chat_V1_SpeakerRules: SwiftProtobuf.Message, SwiftProtobuf._M
guard case .staff(let v)? = self.kind else { preconditionFailure() }
try visitor.visitSingularMessageField(value: v, fieldNumber: 2)
}()
case .never?: try {
guard case .never(let v)? = self.kind else { preconditionFailure() }
try visitor.visitSingularMessageField(value: v, fieldNumber: 3)
}()
case nil: break
}
try unknownFields.traverse(visitor: &visitor)
Expand Down Expand Up @@ -1299,6 +1336,25 @@ extension Flipcash_Chat_V1_StaffRequirement: SwiftProtobuf.Message, SwiftProtobu
}
}

extension Flipcash_Chat_V1_Never: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
public static let protoMessageName: String = _protobuf_package + ".Never"
public static let _protobuf_nameMap = SwiftProtobuf._NameMap()

public mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
// Load everything into unknown fields
while try decoder.nextFieldNumber() != nil {}
}

public func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
try unknownFields.traverse(visitor: &visitor)
}

public static func ==(lhs: Flipcash_Chat_V1_Never, rhs: Flipcash_Chat_V1_Never) -> Bool {
if lhs.unknownFields != rhs.unknownFields {return false}
return true
}
}

extension Flipcash_Chat_V1_MinimumBalanceRequirement: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
public static let protoMessageName: String = _protobuf_package + ".MinimumBalanceRequirement"
public static let _protobuf_nameMap = SwiftProtobuf._NameMap(bytecode: "\0\u{1}amount\0\u{1}mints\0")
Expand Down
Loading
Loading