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.

12 changes: 10 additions & 2 deletions Flipcash/Core/Controllers/ConversationController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -875,7 +875,7 @@ final class ConversationController {
// unknown chat here means the feed hasn't landed, and the feed will bring the state
// with it. Nothing to fetch.
return
case .titleChanged, .pictureChanged, .descriptionChanged:
case .titleChanged, .pictureChanged, .coverPictureChanged, .descriptionChanged:
// Only delivered to a chat's members, same reasoning as `.viewerStateChanged`: an unknown
// chat here means the feed hasn't landed yet, and it will bring the current title/picture
// with it. Nothing to fetch.
Expand Down Expand Up @@ -1171,6 +1171,9 @@ final class ConversationController {
if let picture = conversation.picture {
store.applyPictureChanged(picture, in: conversation.id)
}
if let coverPicture = conversation.coverPicture {
store.applyCoverPictureChanged(coverPicture, in: conversation.id)
}
persistConversation(conversation.id)
}

Expand Down Expand Up @@ -1223,6 +1226,10 @@ final class ConversationController {
guard userID == selfUserID else { continue }
store.setMembership(false, in: conversationID)
persistMembership(false, in: conversationID)
case .membershipChanged:
// Names no user, so there is no own-membership change to record; the store has
// already applied the summary.
continue
}
}
}
Expand Down Expand Up @@ -1382,7 +1389,8 @@ final class ConversationController {
// until the next metadata fetch — the same reason the roster summary is cached.
persistConversation(conversationID)
case .titleChanged(let conversationID, _),
.pictureChanged(let conversationID, _):
.pictureChanged(let conversationID, _),
.coverPictureChanged(let conversationID, _):
// Cached like the roster summary/mute above, so a cold restore shows the edited
// title/picture rather than the stale one until the next full metadata fetch.
persistConversation(conversationID)
Expand Down
2 changes: 1 addition & 1 deletion Flipcash/Core/Controllers/EncryptedChatClient.swift
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ extension EncryptedChatClient: ConversationEventStreaming {
case .metadataRefresh(let conversation):
return .metadataRefresh(await opened(conversation))
case .lastActivityChanged, .readPointersChanged, .typingChanged, .rosterChanged,
.viewerStateChanged, .titleChanged, .pictureChanged, .descriptionChanged, .reactionsChanged, .lobbyChanged:
.viewerStateChanged, .titleChanged, .pictureChanged, .coverPictureChanged, .descriptionChanged, .reactionsChanged, .lobbyChanged:
return event
}
}
Expand Down
2 changes: 2 additions & 0 deletions Flipcash/Utilities/Events.swift
Original file line number Diff line number Diff line change
Expand Up @@ -542,6 +542,7 @@ extension Analytics {
case .denied: "Denied"
case .titleModerated: "TitleModerated"
case .pictureBlobNotAccepted: "PictureBlobNotAccepted"
case .coverPictureBlobNotAccepted: "CoverPictureBlobNotAccepted"
case .invalidRules: "InvalidRules"
case .rulesNotSatisfied: "RulesNotSatisfied"
case .descriptionModerated: "DescriptionModerated"
Expand All @@ -553,6 +554,7 @@ extension Analytics {
case .notFound: "NotFound"
case .titleModerated: "TitleModerated"
case .pictureBlobNotAccepted: "PictureBlobNotAccepted"
case .coverPictureBlobNotAccepted: "CoverPictureBlobNotAccepted"
case .descriptionModerated: "DescriptionModerated"
case .unknown, .transportFailure, .cancelled, .rejected: "Network"
}
Expand Down
2 changes: 1 addition & 1 deletion FlipcashAPI/Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ enum ContractPackage: String, CaseIterable {
var version: Version {
switch self {
case .ocp: return "0.6.0"
case .flipcash2: return "0.17.0"
case .flipcash2: return "0.18.0"
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,33 @@ extension FlipClient {
return RosterPage(members: members, rosterSummary: rosterSummary)
}

/// A sample of up to 100 recent chatters in a public group, with whether more exist. Unlike
/// ``getRoster(owner:conversationID:)`` it needs no membership, so it is the call for a preview or
/// lobby view. `owner` is optional because a public group needs no auth; a private group or a DM
/// is `.denied`.
public func sampleChatters(owner: KeyPair?, conversationID: ConversationID) async throws -> (chatters: [SampledChatter], hasMore: Bool) {
let page = try await withCheckedThrowingContinuation { c in
chatService.sampleChatters(owner: owner, conversationID: conversationID) { c.resume(with: $0) }
}
return (page.chatters, page.hasMore)
}

/// Replaces the signed-in user's featured groups (at most 10, in order) and returns the
/// resulting list. A private group is `.denied`.
public func setFeaturedGroups(owner: KeyPair, conversationIDs: [ConversationID]) async throws -> [Conversation] {
try await withCheckedThrowingContinuation { c in
chatService.setFeaturedGroups(owner: owner, conversationIDs: conversationIDs) { c.resume(with: $0) }
}
}

/// The groups `username` features, list-view shaped: no members, viewer state, last message or
/// cover picture. `owner` is optional.
public func getFeaturedGroups(owner: KeyPair?, username: Username) async throws -> [Conversation] {
try await withCheckedThrowingContinuation { c in
chatService.getFeaturedGroups(owner: owner, username: username) { c.resume(with: $0) }
}
}

/// The people to suggest after an `@` in a group chat, most relevant first; see
/// ``MentionSuggestion``. Fetch it once per composing session and filter it locally.
public func getMentionSuggestions(owner: KeyPair, conversationID: ConversationID) async throws -> [MentionSuggestion] {
Expand Down
Loading
Loading