Skip to content

Commit 137d9dc

Browse files
committed
chore(fc): update protos; handle member updates and untie flush dependency
Signed-off-by: Brandon McAnsh <git@bmcreations.dev>
1 parent fd02681 commit 137d9dc

28 files changed

Lines changed: 369 additions & 135 deletions

File tree

definitions/flipchat/protos/src/main/proto/account/v1/account_service.proto

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,7 @@ message RegisterRequest {
3131
common.v1.PublicKey public_key = 1;
3232
// Signature of this message (without the signature), using the provided keypaid.
3333
common.v1.Signature signature = 2;
34-
// Optional DisplayName of the new user
35-
//
36-
// If the user already exists, this is not used.
34+
// Deprecated: New account creation flow requires using profile service after IAP
3735
string display_name = 3 ;
3836
}
3937
message RegisterResponse {
@@ -42,6 +40,7 @@ message RegisterResponse {
4240
OK = 0;
4341
INVALID_SIGNATURE = 1;
4442
INVALID_DISPLAY_NAME = 2;
43+
DENIED = 3;
4544
}
4645
// Error reason contains the reason for the error, if the
4746
// result > 1. This allows for server to impose moderation restrictions

definitions/flipchat/protos/src/main/proto/chat/v1/chat_service.proto

Lines changed: 89 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@ service Chat {
4141
rpc SetDisplayName(SetDisplayNameRequest) returns (SetDisplayNameResponse);
4242
// SetCoverCharge sets a chat's cover charge
4343
rpc SetCoverCharge(SetCoverChargeRequest) returns (SetCoverChargeResponse);
44+
// GetMemberUpdates gets member updates for a given chat
45+
rpc GetMemberUpdates(GetMemberUpdatesRequest) returns (GetMemberUpdatesResponse);
4446
// RemoveUser removes a user from a chat
4547
rpc RemoveUser(RemoveUserRequest) returns (RemoveUserResponse);
4648
// MuteUser mutes a user in the chat and removes their ability to send messages
@@ -116,75 +118,6 @@ message StreamChatEventsResponse {
116118
// IsTyping indicates whether or not someone is typing in the group.
117119
messaging.v1.IsTyping is_typing = 6;
118120
}
119-
message MetadataUpdate {
120-
oneof kind {
121-
FullRefresh full_refresh = 1;
122-
UnreadCountChanged unread_count_changed = 2;
123-
DisplayNameChanged display_name_changed = 3;
124-
CoverChargeChanged cover_charge_changed = 4;
125-
LastActivityChanged last_activity_changed = 5;
126-
}
127-
// Refreshes the entire chat metadata
128-
message FullRefresh {
129-
Metadata metadata = 1;
130-
}
131-
// New message in the chat has generated a new unread count
132-
message UnreadCountChanged {
133-
// Number of (estimated) unread message
134-
uint32 num_unread = 1;
135-
// If there are more unread messages than indicated by num_unread.
136-
// If this is true, client should show num_unread+ as the unread count.
137-
bool has_more_unread = 2;
138-
}
139-
// The chat display name has been updated to a new value
140-
message DisplayNameChanged {
141-
string new_display_name = 1 ;
142-
}
143-
// The chat cover charge has been updated to a new value
144-
message CoverChargeChanged {
145-
common.v1.PaymentAmount new_cover_charge = 1;
146-
}
147-
// The last activity timestamp has changed to a newer value
148-
message LastActivityChanged {
149-
google.protobuf.Timestamp new_last_activity = 1;
150-
}
151-
}
152-
message MemberUpdate {
153-
oneof kind {
154-
FullRefresh full_refresh = 1;
155-
IndividualRefresh individual_refresh = 2;
156-
Joined joined = 3;
157-
Left left = 4;
158-
Removed removed = 5;
159-
Muted muted = 6;
160-
}
161-
// Refreshes the state of the entire chat membership
162-
message FullRefresh {
163-
repeated Member members = 1 ;
164-
}
165-
// Refreshes the state of an individual member in the chat
166-
message IndividualRefresh {
167-
Member member = 1;
168-
}
169-
// Member joined the chat via the JoinChat RPC
170-
message Joined {
171-
Member member = 1;
172-
}
173-
// Member left the chat via the LeaveChat RPC
174-
message Left {
175-
common.v1.UserId member = 1;
176-
}
177-
// Member was removed from the chat via the RemoveUser RPC
178-
message Removed {
179-
common.v1.UserId member = 1;
180-
common.v1.UserId removed_by = 2;
181-
}
182-
// Member was muted in the chat via the MuteUser RPC
183-
message Muted {
184-
common.v1.UserId member = 1;
185-
common.v1.UserId muted_by = 2;
186-
}
187-
}
188121
}
189122
message GetChatsRequest {
190123
common.v1.QueryOptions query_options = 1;
@@ -333,6 +266,23 @@ message SetCoverChargeResponse {
333266
CANT_SET = 2;
334267
}
335268
}
269+
message GetMemberUpdatesRequest {
270+
common.v1.ChatId chat_id = 1;
271+
// If not provided, a full refresh is performed. Server may also choose
272+
// to compact updates into a full or individual refresh.
273+
common.v1.PagingToken paging_token = 2;
274+
// Auth is an optional field that authenticates the call, which
275+
// can be used to fill out extra information.
276+
common.v1.Auth auth = 3;
277+
}
278+
message GetMemberUpdatesResponse {
279+
Result result = 1;
280+
enum Result {
281+
OK = 0;
282+
NOT_FOUND = 1;
283+
}
284+
repeated MemberUpdate updates = 2 ;
285+
}
336286
message RemoveUserRequest{
337287
common.v1.ChatId chat_id = 1;
338288
common.v1.UserId user_id = 2;
@@ -422,6 +372,39 @@ message Metadata {
422372
// The timestamp of the last activity in this chat
423373
google.protobuf.Timestamp last_activity = 10;
424374
}
375+
message MetadataUpdate {
376+
oneof kind {
377+
FullRefresh full_refresh = 1;
378+
UnreadCountChanged unread_count_changed = 2;
379+
DisplayNameChanged display_name_changed = 3;
380+
CoverChargeChanged cover_charge_changed = 4;
381+
LastActivityChanged last_activity_changed = 5;
382+
}
383+
// Refreshes the entire chat metadata
384+
message FullRefresh {
385+
Metadata metadata = 1;
386+
}
387+
// New message in the chat has generated a new unread count
388+
message UnreadCountChanged {
389+
// Number of (estimated) unread message
390+
uint32 num_unread = 1;
391+
// If there are more unread messages than indicated by num_unread.
392+
// If this is true, client should show num_unread+ as the unread count.
393+
bool has_more_unread = 2;
394+
}
395+
// The chat display name has been updated to a new value
396+
message DisplayNameChanged {
397+
string new_display_name = 1 ;
398+
}
399+
// The chat cover charge has been updated to a new value
400+
message CoverChargeChanged {
401+
common.v1.PaymentAmount new_cover_charge = 1;
402+
}
403+
// The last activity timestamp has changed to a newer value
404+
message LastActivityChanged {
405+
google.protobuf.Timestamp new_last_activity = 1;
406+
}
407+
}
425408
message Member {
426409
common.v1.UserId user_id = 1;
427410
// The chat member's identity/profile information.
@@ -455,3 +438,40 @@ message MemberIdentity {
455438
// If present, the URL of the users profile pic.
456439
string profile_pic_url = 2 ;
457440
}
441+
message MemberUpdate {
442+
oneof kind {
443+
FullRefresh full_refresh = 1;
444+
IndividualRefresh individual_refresh = 2;
445+
Joined joined = 3;
446+
Left left = 4;
447+
Removed removed = 5;
448+
Muted muted = 6;
449+
}
450+
common.v1.PagingToken paging_token = 1000;
451+
// Refreshes the state of the entire chat membership
452+
message FullRefresh {
453+
repeated Member members = 1 ;
454+
}
455+
// Refreshes the state of an individual member in the chat
456+
message IndividualRefresh {
457+
Member member = 1;
458+
}
459+
// Member joined the chat via the JoinChat RPC
460+
message Joined {
461+
Member member = 1;
462+
}
463+
// Member left the chat via the LeaveChat RPC
464+
message Left {
465+
common.v1.UserId member = 1;
466+
}
467+
// Member was removed from the chat via the RemoveUser RPC
468+
message Removed {
469+
common.v1.UserId member = 1;
470+
common.v1.UserId removed_by = 2;
471+
}
472+
// Member was muted in the chat via the MuteUser RPC
473+
message Muted {
474+
common.v1.UserId member = 1;
475+
common.v1.UserId muted_by = 2;
476+
}
477+
}

definitions/flipchat/protos/src/main/proto/messaging/v1/messaging_service.proto

Lines changed: 13 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,6 @@ import "messaging/v1/model.proto";
88

99
service Messaging {
1010
// StreamMessages streams all messages/message states for the requested chat.
11-
//
12-
// By default, streams will resume messages from the last acknowledged delivery
13-
// pointer of the caller. This can be overridden by setting 'last_message',
14-
// 'latest_only'.
1511
rpc StreamMessages(stream StreamMessagesRequest) returns (stream StreamMessagesResponse);
1612
// GetMessage gets a single message in a chat
1713
rpc GetMessage(GetMessageRequest) returns (GetMessageResponse);
@@ -25,8 +21,6 @@ service Messaging {
2521
//
2622
// These requests are transient, and may be dropped at any point.
2723
rpc NotifyIsTyping(NotifyIsTypingRequest) returns (NotifyIsTypingResponse);
28-
// DeleteMessage deletes a message
29-
rpc DeleteMessage(DeleteMessageRequest) returns (DeleteMessageResponse);
3024
}
3125
message StreamMessagesRequest {
3226
oneof type {
@@ -35,11 +29,9 @@ message StreamMessagesRequest {
3529
}
3630
message Params {
3731
common.v1.ChatId chat_id = 1;
38-
// Callers may optionally specify a resume mode other than last delivery pointer.
32+
// Deprecated: stream flushes are no longer supported
3933
oneof resume {
40-
// Server will return all messages newer than this message id.
4134
MessageId last_known_message_id = 2;
42-
// Server will not load any previous messages.
4335
bool latest_only = 3;
4436
}
4537
common.v1.Auth auth = 4;
@@ -94,8 +86,12 @@ message SendMessageRequest {
9486
// - TextContent
9587
// - ReactionContent
9688
// - ReplyContent
89+
// - TipContent
90+
// - DeleteMessageContent
9791
repeated Content content = 2 ;
9892
common.v1.Auth auth = 3;
93+
// Intent ID for message contents that require a payment
94+
common.v1.IntentId payment_intent = 4;
9995
}
10096
message SendMessageResponse {
10197
Result result = 1;
@@ -107,6 +103,14 @@ message SendMessageResponse {
107103
// server-side metadata like the generated message ID and official timestamp
108104
Message message = 2;
109105
}
106+
message SendTipMessagePaymentMetadata {
107+
// The chat where the message is being tipped
108+
common.v1.ChatId chat_id = 1;
109+
// The message that is being tipped
110+
MessageId message_id = 2;
111+
// The user sending the tip
112+
common.v1.UserId tipper_id = 3;
113+
}
110114
message AdvancePointerRequest {
111115
common.v1.ChatId chat_id = 1;
112116
Pointer pointer = 2;
@@ -132,14 +136,3 @@ message NotifyIsTypingResponse {
132136
DENIED = 1;
133137
}
134138
}
135-
message DeleteMessageRequest {
136-
MessageId message_id = 1;
137-
common.v1.Auth auth = 2;
138-
}
139-
message DeleteMessageResponse {
140-
Result result = 1;
141-
enum Result {
142-
OK = 0;
143-
DENIED = 1;
144-
}
145-
}

definitions/flipchat/protos/src/main/proto/messaging/v1/model.proto

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,8 @@ message Content {
5454
LocalizedAnnouncementContent localized_announcement = 2;
5555
ReactionContent reaction = 5;
5656
ReplyContent reply = 6;
57+
TipContent tip = 7;
58+
DeleteMessageContent deleted = 8;
5759
}
5860
reserved 3; // ExchangeDataContent
5961
reserved 4; // NaclBoxEncryptedContent
@@ -83,3 +85,13 @@ message ReplyContent {
8385
// The reply text, which can be handled similarly to TextContent
8486
string reply_text = 2 ;
8587
}
88+
message TipContent {
89+
// The message ID of the message this tip is referencing
90+
MessageId original_message_id = 1 ;
91+
// The amount tipped for the message
92+
common.v1.PaymentAmount tip_amount = 2;
93+
}
94+
message DeleteMessageContent {
95+
// The message ID of the message that was deleted
96+
MessageId original_message_id = 1 ;
97+
}

definitions/flipchat/protos/src/main/proto/profile/v1/profile_service.proto

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,5 +35,6 @@ message SetDisplayNameResponse {
3535
enum Result {
3636
OK = 0;
3737
INVALID_DISPLAY_NAME = 1;
38+
DENIED = 2;
3839
}
3940
}

flipchatApp/src/main/kotlin/xyz/flipchat/app/beta/LabsController.kt

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,14 @@ sealed interface Lab {
4949
override val launched: Boolean = true
5050
}
5151

52+
data object DeleteMessage : Lab {
53+
override val key: String = "delete_message_enabled"
54+
override val default: Boolean = false
55+
override val launched: Boolean = false
56+
}
57+
5258
companion object {
53-
val entries = listOf(ReplyToMessage, FollowerMode, StartChatAtUnread, RoomNameChanges)
59+
val entries = listOf(ReplyToMessage, FollowerMode, StartChatAtUnread, RoomNameChanges, DeleteMessage)
5460
internal fun byKey(key: Preferences.Key<*>): Lab? {
5561
return entries.firstOrNull { it.key == key.name }
5662
}

flipchatApp/src/main/kotlin/xyz/flipchat/app/features/beta/BetaFlagsScreen.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@ private val Lab.title: String
103103
Lab.ReplyToMessage -> "Swipe To Reply"
104104
Lab.StartChatAtUnread -> "Open Conversation @ Last Unread"
105105
Lab.RoomNameChanges -> "Room Name Changes For Hosts"
106+
Lab.DeleteMessage -> "Delete Message Support"
106107
}
107108

108109
private val Lab.message: String
@@ -111,4 +112,5 @@ private val Lab.message: String
111112
Lab.ReplyToMessage -> "When enabled, you will gain the ability to swipe to reply to messages in chat"
112113
Lab.StartChatAtUnread -> "When enabled, conversations will resume at the last message you read"
113114
Lab.RoomNameChanges -> "When enabled, hosts will gain the ability to set a desired name for their room"
115+
Lab.DeleteMessage -> "When enabled, hosts will gain the ability to delete messages"
114116
}

0 commit comments

Comments
 (0)