If you've left a group, we shouldn't show it in any pickers except the blocking manager (`AddToBlockListViewController`). Before this commit, we were showing it in a few places. That might let you sorta-send a message to a group you'd left. I enumerated all the places where we have pickers, and what their behavior should be. | Description | Code | Show groups? | Show left groups? | | --------------------------------------------------------------------- | ------------------------------------------- | ------------------------ | ------------------------ | | Various group member pickers (adding members, group story recipients) | `BaseMemberViewController` | No | N/A | | Send payment screen | `PaymentsSendRecipientViewController` | No | N/A | | Gift badging “choose recipient” screen | `BadgeGiftingChooseRecipientViewController` | No | N/A | | Composer | `ComposeViewController` | Yes, only when searching | No | | Add to block list (in Settings → Privacy) | `AddToBlockListViewController` | Yes, only when searching | Yes, only when searching | | Share sheet | `SharingThreadPickerViewController` | Yes | No | | Message forwarding | `ForwardMessageViewController` | Yes | No | | In-app camera | `CameraFirstCaptureSendFlow` | Yes | No | | Share group link via Signal | `GroupLinkViewController` | Yes | No | | Share sticker pack, from in a chat | `StickerPackViewController` | Yes | No | | Share sticker pack, from sticker management screen | `ManageStickersViewController` | Yes | No | | “New Group Story” screen | `NewGroupStoryViewController` | Yes (exclusively) | No | This doesn't intend to change the behavior of *deleted* groups. Those will show up when searching if groups are shown at all. For example, a deleted group will show in the composer if you search for it just like any other group. A deleted group will *not* show in the "send payment" screen because groups are never shown there. Again, the behavior around deleted groups should remain unchanged. Co-authored-by: Max Radermacher <max@signal.org>
35 lines
1.1 KiB
Swift
35 lines
1.1 KiB
Swift
//
|
|
// Copyright (c) 2022 Open Whisper Systems. All rights reserved.
|
|
//
|
|
|
|
import Foundation
|
|
|
|
extension RecipientPickerViewController {
|
|
@objc(groupSectionForSearchResults:)
|
|
public func groupSection(for searchResults: ComposeScreenSearchResultSet) -> OWSTableSection? {
|
|
let groupThreads: [TSGroupThread]
|
|
switch groupsToShow {
|
|
case .showNoGroups:
|
|
return nil
|
|
case .showGroupsThatUserIsMemberOfWhenSearching:
|
|
groupThreads = searchResults.groupThreads.filter { thread in
|
|
thread.isLocalUserFullMember
|
|
}
|
|
case .showAllGroupsWhenSearching:
|
|
groupThreads = searchResults.groupThreads
|
|
}
|
|
|
|
guard !groupThreads.isEmpty else { return nil }
|
|
|
|
return OWSTableSection(
|
|
title: NSLocalizedString(
|
|
"COMPOSE_MESSAGE_GROUP_SECTION_TITLE",
|
|
comment: "Table section header for group listing when composing a new message"
|
|
),
|
|
items: groupThreads.map {
|
|
self.item(forRecipient: PickedRecipient.for(groupThread: $0))
|
|
}
|
|
)
|
|
}
|
|
}
|