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
18 changes: 18 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,24 @@ 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.14.1

Synced to [`flipcash2-protobuf-api@d082b0a3`](https://github.com/code-payments/flipcash2-protobuf-api/commit/d082b0a3dd268f884f75402ccd355b6548612221),
picking up [#129](https://github.com/code-payments/flipcash2-protobuf-api/pull/129). Only `chat.v1`
moved.

### Added

- `chat.v1.CreatorRequirement`, a new empty message and a new `SpeakerRules` rule case
(`creator = 4`): only the chat's creator, as given by `Metadata.creator`, may speak.

### Upgrading

Nothing existing changed: no renames, and no field or enum renumbering. A client that switches
exhaustively over the `SpeakerRules` rule needs a case for `creator`. Until it has one, a chat with
this rule reaches that client as an unset or unknown rule, so decide what an unrecognized speaker
rule does before the server starts sending it.

## 0.14.0

Synced to [`flipcash2-protobuf-api@df1cb04e`](https://github.com/code-payments/flipcash2-protobuf-api/commit/df1cb04e71fef7ce77a6a537e0a106fde6452a8f),
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.13.0-dev"
public static let protoCommit = "df1cb04e71fef7ce77a6a537e0a106fde6452a8f"
public static let version = "0.14.0-dev"
public static let protoCommit = "d082b0a3dd268f884f75402ccd355b6548612221"

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

Expand Down
59 changes: 58 additions & 1 deletion Sources/Flipcash2ClientProtocol/chat_v1_model.pb.swift
Original file line number Diff line number Diff line change
Expand Up @@ -312,12 +312,21 @@ public struct Flipcash_Chat_V1_SpeakerRules: Sendable {
set {kind = .never(newValue)}
}

public var creator: Flipcash_Chat_V1_CreatorRequirement {
get {
if case .creator(let v)? = kind {return v}
return Flipcash_Chat_V1_CreatorRequirement()
}
set {kind = .creator(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)
case creator(Flipcash_Chat_V1_CreatorRequirement)

}

Expand Down Expand Up @@ -347,6 +356,18 @@ public struct Flipcash_Chat_V1_Never: Sendable {
public init() {}
}

/// CreatorRequirement requires the user to be the chat's creator, as indicated
/// by Metadata.creator.
public struct Flipcash_Chat_V1_CreatorRequirement: 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 @@ -1235,7 +1256,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\u{1}never\0")
public static let _protobuf_nameMap = SwiftProtobuf._NameMap(bytecode: "\0\u{3}minimum_balance\0\u{1}staff\0\u{1}never\0\u{1}creator\0")

public mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
while let fieldNumber = try decoder.nextFieldNumber() {
Expand Down Expand Up @@ -1282,6 +1303,19 @@ extension Flipcash_Chat_V1_SpeakerRules: SwiftProtobuf.Message, SwiftProtobuf._M
self.kind = .never(v)
}
}()
case 4: try {
var v: Flipcash_Chat_V1_CreatorRequirement?
var hadOneofValue = false
if let current = self.kind {
hadOneofValue = true
if case .creator(let m) = current {v = m}
}
try decoder.decodeSingularMessageField(value: &v)
if let v = v {
if hadOneofValue {try decoder.handleConflictingOneOf()}
self.kind = .creator(v)
}
}()
default: break
}
}
Expand All @@ -1305,6 +1339,10 @@ extension Flipcash_Chat_V1_SpeakerRules: SwiftProtobuf.Message, SwiftProtobuf._M
guard case .never(let v)? = self.kind else { preconditionFailure() }
try visitor.visitSingularMessageField(value: v, fieldNumber: 3)
}()
case .creator?: try {
guard case .creator(let v)? = self.kind else { preconditionFailure() }
try visitor.visitSingularMessageField(value: v, fieldNumber: 4)
}()
case nil: break
}
try unknownFields.traverse(visitor: &visitor)
Expand Down Expand Up @@ -1355,6 +1393,25 @@ extension Flipcash_Chat_V1_Never: SwiftProtobuf.Message, SwiftProtobuf._MessageI
}
}

extension Flipcash_Chat_V1_CreatorRequirement: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
public static let protoMessageName: String = _protobuf_package + ".CreatorRequirement"
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_CreatorRequirement, rhs: Flipcash_Chat_V1_CreatorRequirement) -> 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
4 changes: 2 additions & 2 deletions flipcash2.lock
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Pinned upstream contract. Regenerate with scripts/sync-protos.sh <sha>.
upstream: code-payments/flipcash2-protobuf-api
commit: df1cb04e71fef7ce77a6a537e0a106fde6452a8f
subject: Add is_username_auto_assigned to UserProfile (#128)
commit: d082b0a3dd268f884f75402ccd355b6548612221
subject: Add a creator requirement for speaker rules (#129)
6 changes: 6 additions & 0 deletions proto/chat/v1/model.proto
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ message SpeakerRules {
MinimumBalanceRequirement minimum_balance = 1;
StaffRequirement staff = 2;
Never never = 3;
CreatorRequirement creator = 4;
}
}

Expand All @@ -151,6 +152,11 @@ message StaffRequirement {
message Never {
}

// CreatorRequirement requires the user to be the chat's creator, as indicated
// by Metadata.creator.
message CreatorRequirement {
}

// MinimumBalanceRequirement requires a user to hold a minimum balance,
// denominated in fiat, in an acceptable mint.
message MinimumBalanceRequirement {
Expand Down
Loading