mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-11-08 01:40:09 +00:00
Collapse participants list in group info if there are more than 50 members
This commit is contained in:
parent
7e1cd1b3ae
commit
48827d2b36
@ -5091,3 +5091,10 @@ Any member of this group will be able to see messages in the channel.";
|
|||||||
|
|
||||||
"UserInfo.StartSecretChatConfirmation" = "Are you sure you want to start a secret chat with\n%@?";
|
"UserInfo.StartSecretChatConfirmation" = "Are you sure you want to start a secret chat with\n%@?";
|
||||||
"UserInfo.StartSecretChatStart" = "Start";
|
"UserInfo.StartSecretChatStart" = "Start";
|
||||||
|
|
||||||
|
"GroupInfo.ShowMoreMembers_0" = "%@ more";
|
||||||
|
"GroupInfo.ShowMoreMembers_1" = "%@ more";
|
||||||
|
"GroupInfo.ShowMoreMembers_2" = "%@ more";
|
||||||
|
"GroupInfo.ShowMoreMembers_3_10" = "%@ more";
|
||||||
|
"GroupInfo.ShowMoreMembers_many" = "%@ more";
|
||||||
|
"GroupInfo.ShowMoreMembers_any" = "%@ more";
|
||||||
|
|||||||
@ -40,6 +40,8 @@ import AppBundle
|
|||||||
import Markdown
|
import Markdown
|
||||||
import LocalizedPeerData
|
import LocalizedPeerData
|
||||||
|
|
||||||
|
private let maxParticipantsDisplayedCount: Int32 = 50
|
||||||
|
|
||||||
private final class GroupInfoArguments {
|
private final class GroupInfoArguments {
|
||||||
let context: AccountContext
|
let context: AccountContext
|
||||||
|
|
||||||
@ -71,8 +73,9 @@ private final class GroupInfoArguments {
|
|||||||
let openLocation: (PeerGeoLocation) -> Void
|
let openLocation: (PeerGeoLocation) -> Void
|
||||||
let changeLocation: () -> Void
|
let changeLocation: () -> Void
|
||||||
let displayLocationContextMenu: (String) -> Void
|
let displayLocationContextMenu: (String) -> Void
|
||||||
|
let expandParticipants: () -> Void
|
||||||
|
|
||||||
init(context: AccountContext, avatarAndNameInfoContext: ItemListAvatarAndNameInfoItemContext, tapAvatarAction: @escaping () -> Void, changeProfilePhoto: @escaping () -> Void, pushController: @escaping (ViewController) -> Void, presentController: @escaping (ViewController, ViewControllerPresentationArguments) -> Void, changeNotificationMuteSettings: @escaping () -> Void, openPreHistory: @escaping () -> Void, openSharedMedia: @escaping () -> Void, openAdministrators: @escaping () -> Void, openPermissions: @escaping () -> Void, updateEditingName: @escaping (ItemListAvatarAndNameInfoItemName) -> Void, updateEditingDescriptionText: @escaping (String) -> Void, setPeerIdWithRevealedOptions: @escaping (PeerId?, PeerId?) -> Void, addMember: @escaping () -> Void, promotePeer: @escaping (RenderedChannelParticipant) -> Void, restrictPeer: @escaping (RenderedChannelParticipant) -> Void, removePeer: @escaping (PeerId) -> Void, leave: @escaping () -> Void, displayUsernameShareMenu: @escaping (String) -> Void, displayUsernameContextMenu: @escaping (String) -> Void, displayAboutContextMenu: @escaping (String) -> Void, aboutLinkAction: @escaping (TextLinkItemActionType, TextLinkItem) -> Void, openStickerPackSetup: @escaping () -> Void, openGroupTypeSetup: @escaping () -> Void, openLinkedChannelSetup: @escaping () -> Void, openLocation: @escaping (PeerGeoLocation) -> Void, changeLocation: @escaping () -> Void, displayLocationContextMenu: @escaping (String) -> Void) {
|
init(context: AccountContext, avatarAndNameInfoContext: ItemListAvatarAndNameInfoItemContext, tapAvatarAction: @escaping () -> Void, changeProfilePhoto: @escaping () -> Void, pushController: @escaping (ViewController) -> Void, presentController: @escaping (ViewController, ViewControllerPresentationArguments) -> Void, changeNotificationMuteSettings: @escaping () -> Void, openPreHistory: @escaping () -> Void, openSharedMedia: @escaping () -> Void, openAdministrators: @escaping () -> Void, openPermissions: @escaping () -> Void, updateEditingName: @escaping (ItemListAvatarAndNameInfoItemName) -> Void, updateEditingDescriptionText: @escaping (String) -> Void, setPeerIdWithRevealedOptions: @escaping (PeerId?, PeerId?) -> Void, addMember: @escaping () -> Void, promotePeer: @escaping (RenderedChannelParticipant) -> Void, restrictPeer: @escaping (RenderedChannelParticipant) -> Void, removePeer: @escaping (PeerId) -> Void, leave: @escaping () -> Void, displayUsernameShareMenu: @escaping (String) -> Void, displayUsernameContextMenu: @escaping (String) -> Void, displayAboutContextMenu: @escaping (String) -> Void, aboutLinkAction: @escaping (TextLinkItemActionType, TextLinkItem) -> Void, openStickerPackSetup: @escaping () -> Void, openGroupTypeSetup: @escaping () -> Void, openLinkedChannelSetup: @escaping () -> Void, openLocation: @escaping (PeerGeoLocation) -> Void, changeLocation: @escaping () -> Void, displayLocationContextMenu: @escaping (String) -> Void, expandParticipants: @escaping () -> Void) {
|
||||||
self.context = context
|
self.context = context
|
||||||
self.avatarAndNameInfoContext = avatarAndNameInfoContext
|
self.avatarAndNameInfoContext = avatarAndNameInfoContext
|
||||||
self.tapAvatarAction = tapAvatarAction
|
self.tapAvatarAction = tapAvatarAction
|
||||||
@ -102,6 +105,7 @@ private final class GroupInfoArguments {
|
|||||||
self.openLocation = openLocation
|
self.openLocation = openLocation
|
||||||
self.changeLocation = changeLocation
|
self.changeLocation = changeLocation
|
||||||
self.displayLocationContextMenu = displayLocationContextMenu
|
self.displayLocationContextMenu = displayLocationContextMenu
|
||||||
|
self.expandParticipants = expandParticipants
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -189,6 +193,7 @@ private enum GroupInfoEntry: ItemListNodeEntry {
|
|||||||
case permissions(PresentationTheme, String, String)
|
case permissions(PresentationTheme, String, String)
|
||||||
case addMember(PresentationTheme, String, editing: Bool)
|
case addMember(PresentationTheme, String, editing: Bool)
|
||||||
case member(PresentationTheme, PresentationStrings, PresentationDateTimeFormat, PresentationPersonNameOrder, index: Int, peerId: PeerId, peer: Peer, participant: RenderedChannelParticipant?, presence: PeerPresence?, memberStatus: GroupInfoMemberStatus, editing: ItemListPeerItemEditing, revealActions: [ParticipantRevealAction], enabled: Bool, selectable: Bool)
|
case member(PresentationTheme, PresentationStrings, PresentationDateTimeFormat, PresentationPersonNameOrder, index: Int, peerId: PeerId, peer: Peer, participant: RenderedChannelParticipant?, presence: PeerPresence?, memberStatus: GroupInfoMemberStatus, editing: ItemListPeerItemEditing, revealActions: [ParticipantRevealAction], enabled: Bool, selectable: Bool)
|
||||||
|
case expand(PresentationTheme, String)
|
||||||
case leave(PresentationTheme, String)
|
case leave(PresentationTheme, String)
|
||||||
|
|
||||||
var section: ItemListSectionId {
|
var section: ItemListSectionId {
|
||||||
@ -203,7 +208,7 @@ private enum GroupInfoEntry: ItemListNodeEntry {
|
|||||||
return GroupInfoSection.sharedMediaAndNotifications.rawValue
|
return GroupInfoSection.sharedMediaAndNotifications.rawValue
|
||||||
case .permissions, .administrators:
|
case .permissions, .administrators:
|
||||||
return GroupInfoSection.memberManagement.rawValue
|
return GroupInfoSection.memberManagement.rawValue
|
||||||
case .addMember, .member:
|
case .addMember, .member, .expand:
|
||||||
return GroupInfoSection.members.rawValue
|
return GroupInfoSection.members.rawValue
|
||||||
case .leave:
|
case .leave:
|
||||||
return GroupInfoSection.leave.rawValue
|
return GroupInfoSection.leave.rawValue
|
||||||
@ -213,40 +218,40 @@ private enum GroupInfoEntry: ItemListNodeEntry {
|
|||||||
static func ==(lhs: GroupInfoEntry, rhs: GroupInfoEntry) -> Bool {
|
static func ==(lhs: GroupInfoEntry, rhs: GroupInfoEntry) -> Bool {
|
||||||
switch lhs {
|
switch lhs {
|
||||||
case let .info(lhsTheme, lhsStrings, lhsDateTimeFormat, lhsPeer, lhsCachedData, lhsState, lhsUpdatingAvatar):
|
case let .info(lhsTheme, lhsStrings, lhsDateTimeFormat, lhsPeer, lhsCachedData, lhsState, lhsUpdatingAvatar):
|
||||||
if case let .info(rhsTheme, rhsStrings, rhsDateTimeFormat, rhsPeer, rhsCachedData, rhsState, rhsUpdatingAvatar) = rhs {
|
if case let .info(rhsTheme, rhsStrings, rhsDateTimeFormat, rhsPeer, rhsCachedData, rhsState, rhsUpdatingAvatar) = rhs {
|
||||||
if lhsTheme !== rhsTheme {
|
if lhsTheme !== rhsTheme {
|
||||||
return false
|
|
||||||
}
|
|
||||||
if lhsStrings !== rhsStrings {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
if lhsDateTimeFormat != rhsDateTimeFormat {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
if let lhsPeer = lhsPeer, let rhsPeer = rhsPeer {
|
|
||||||
if !lhsPeer.isEqual(rhsPeer) {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
} else if (lhsPeer == nil) != (rhsPeer != nil) {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
if let lhsCachedData = lhsCachedData, let rhsCachedData = rhsCachedData {
|
|
||||||
if !lhsCachedData.isEqual(to: rhsCachedData) {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
} else if (lhsCachedData != nil) != (rhsCachedData != nil) {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
if lhsState != rhsState {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
if lhsUpdatingAvatar != rhsUpdatingAvatar {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
return true
|
|
||||||
} else {
|
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
if lhsStrings !== rhsStrings {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
if lhsDateTimeFormat != rhsDateTimeFormat {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
if let lhsPeer = lhsPeer, let rhsPeer = rhsPeer {
|
||||||
|
if !lhsPeer.isEqual(rhsPeer) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
} else if (lhsPeer == nil) != (rhsPeer != nil) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
if let lhsCachedData = lhsCachedData, let rhsCachedData = rhsCachedData {
|
||||||
|
if !lhsCachedData.isEqual(to: rhsCachedData) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
} else if (lhsCachedData != nil) != (rhsCachedData != nil) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
if lhsState != rhsState {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
if lhsUpdatingAvatar != rhsUpdatingAvatar {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
return true
|
||||||
|
} else {
|
||||||
|
return false
|
||||||
|
}
|
||||||
case let .setGroupPhoto(lhsTheme, lhsText):
|
case let .setGroupPhoto(lhsTheme, lhsText):
|
||||||
if case let .setGroupPhoto(rhsTheme, rhsText) = rhs, lhsTheme === rhsTheme, lhsText == rhsText {
|
if case let .setGroupPhoto(rhsTheme, rhsText) = rhs, lhsTheme === rhsTheme, lhsText == rhsText {
|
||||||
return true
|
return true
|
||||||
@ -419,6 +424,12 @@ private enum GroupInfoEntry: ItemListNodeEntry {
|
|||||||
} else {
|
} else {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
case let .expand(lhsTheme, lhsText):
|
||||||
|
if case let .expand(rhsTheme, rhsText) = rhs, lhsTheme === rhsTheme, lhsText == rhsText {
|
||||||
|
return true
|
||||||
|
} else {
|
||||||
|
return false
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -469,8 +480,10 @@ private enum GroupInfoEntry: ItemListNodeEntry {
|
|||||||
return 16
|
return 16
|
||||||
case let .member(_, _, _, _, index, _, _, _, _, _, _, _, _, _):
|
case let .member(_, _, _, _, index, _, _, _, _, _, _, _, _, _):
|
||||||
return 20 + index
|
return 20 + index
|
||||||
case .leave:
|
case .expand:
|
||||||
return 200000 + 1
|
return 200000 + 1
|
||||||
|
case .leave:
|
||||||
|
return 200000 + 2
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -592,6 +605,10 @@ private enum GroupInfoEntry: ItemListNodeEntry {
|
|||||||
}, removePeer: { peerId in
|
}, removePeer: { peerId in
|
||||||
arguments.removePeer(peerId)
|
arguments.removePeer(peerId)
|
||||||
})
|
})
|
||||||
|
case let .expand(theme, title):
|
||||||
|
return ItemListPeerActionItem(theme: theme, icon: PresentationResourcesItemList.downArrowImage(theme), title: title, sectionId: self.section, editing: false, action: {
|
||||||
|
arguments.expandParticipants()
|
||||||
|
})
|
||||||
case let .leave(theme, title):
|
case let .leave(theme, title):
|
||||||
return ItemListActionItem(theme: theme, title: title, kind: .destructive, alignment: .center, sectionId: self.section, style: .blocks, action: {
|
return ItemListActionItem(theme: theme, title: title, kind: .destructive, alignment: .center, sectionId: self.section, style: .blocks, action: {
|
||||||
arguments.leave()
|
arguments.leave()
|
||||||
@ -627,6 +644,7 @@ private struct GroupInfoState: Equatable {
|
|||||||
let editingState: GroupInfoEditingState?
|
let editingState: GroupInfoEditingState?
|
||||||
let updatingName: ItemListAvatarAndNameInfoItemName?
|
let updatingName: ItemListAvatarAndNameInfoItemName?
|
||||||
let peerIdWithRevealedOptions: PeerId?
|
let peerIdWithRevealedOptions: PeerId?
|
||||||
|
let expandedParticipants: Bool
|
||||||
|
|
||||||
let temporaryParticipants: [TemporaryParticipant]
|
let temporaryParticipants: [TemporaryParticipant]
|
||||||
let successfullyAddedParticipantIds: Set<PeerId>
|
let successfullyAddedParticipantIds: Set<PeerId>
|
||||||
@ -649,6 +667,9 @@ private struct GroupInfoState: Equatable {
|
|||||||
if lhs.peerIdWithRevealedOptions != rhs.peerIdWithRevealedOptions {
|
if lhs.peerIdWithRevealedOptions != rhs.peerIdWithRevealedOptions {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
if lhs.expandedParticipants != rhs.expandedParticipants {
|
||||||
|
return false
|
||||||
|
}
|
||||||
if lhs.temporaryParticipants != rhs.temporaryParticipants {
|
if lhs.temporaryParticipants != rhs.temporaryParticipants {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
@ -668,39 +689,43 @@ private struct GroupInfoState: Equatable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func withUpdatedUpdatingAvatar(_ updatingAvatar: ItemListAvatarAndNameInfoItemUpdatingAvatar?) -> GroupInfoState {
|
func withUpdatedUpdatingAvatar(_ updatingAvatar: ItemListAvatarAndNameInfoItemUpdatingAvatar?) -> GroupInfoState {
|
||||||
return GroupInfoState(updatingAvatar: updatingAvatar, editingState: self.editingState, updatingName: self.updatingName, peerIdWithRevealedOptions: self.peerIdWithRevealedOptions, temporaryParticipants: self.temporaryParticipants, successfullyAddedParticipantIds: self.successfullyAddedParticipantIds, removingParticipantIds: self.removingParticipantIds, savingData: self.savingData, searchingMembers: self.searchingMembers)
|
return GroupInfoState(updatingAvatar: updatingAvatar, editingState: self.editingState, updatingName: self.updatingName, peerIdWithRevealedOptions: self.peerIdWithRevealedOptions, expandedParticipants: self.expandedParticipants, temporaryParticipants: self.temporaryParticipants, successfullyAddedParticipantIds: self.successfullyAddedParticipantIds, removingParticipantIds: self.removingParticipantIds, savingData: self.savingData, searchingMembers: self.searchingMembers)
|
||||||
}
|
}
|
||||||
|
|
||||||
func withUpdatedEditingState(_ editingState: GroupInfoEditingState?) -> GroupInfoState {
|
func withUpdatedEditingState(_ editingState: GroupInfoEditingState?) -> GroupInfoState {
|
||||||
return GroupInfoState(updatingAvatar: self.updatingAvatar, editingState: editingState, updatingName: self.updatingName, peerIdWithRevealedOptions: self.peerIdWithRevealedOptions, temporaryParticipants: self.temporaryParticipants, successfullyAddedParticipantIds: self.successfullyAddedParticipantIds, removingParticipantIds: self.removingParticipantIds, savingData: self.savingData, searchingMembers: self.searchingMembers)
|
return GroupInfoState(updatingAvatar: self.updatingAvatar, editingState: editingState, updatingName: self.updatingName, peerIdWithRevealedOptions: self.peerIdWithRevealedOptions, expandedParticipants: self.expandedParticipants, temporaryParticipants: self.temporaryParticipants, successfullyAddedParticipantIds: self.successfullyAddedParticipantIds, removingParticipantIds: self.removingParticipantIds, savingData: self.savingData, searchingMembers: self.searchingMembers)
|
||||||
}
|
}
|
||||||
|
|
||||||
func withUpdatedUpdatingName(_ updatingName: ItemListAvatarAndNameInfoItemName?) -> GroupInfoState {
|
func withUpdatedUpdatingName(_ updatingName: ItemListAvatarAndNameInfoItemName?) -> GroupInfoState {
|
||||||
return GroupInfoState(updatingAvatar: self.updatingAvatar, editingState: self.editingState, updatingName: updatingName, peerIdWithRevealedOptions: self.peerIdWithRevealedOptions, temporaryParticipants: self.temporaryParticipants, successfullyAddedParticipantIds: self.successfullyAddedParticipantIds, removingParticipantIds: self.removingParticipantIds, savingData: self.savingData, searchingMembers: self.searchingMembers)
|
return GroupInfoState(updatingAvatar: self.updatingAvatar, editingState: self.editingState, updatingName: updatingName, peerIdWithRevealedOptions: self.peerIdWithRevealedOptions, expandedParticipants: self.expandedParticipants, temporaryParticipants: self.temporaryParticipants, successfullyAddedParticipantIds: self.successfullyAddedParticipantIds, removingParticipantIds: self.removingParticipantIds, savingData: self.savingData, searchingMembers: self.searchingMembers)
|
||||||
}
|
}
|
||||||
|
|
||||||
func withUpdatedPeerIdWithRevealedOptions(_ peerIdWithRevealedOptions: PeerId?) -> GroupInfoState {
|
func withUpdatedPeerIdWithRevealedOptions(_ peerIdWithRevealedOptions: PeerId?) -> GroupInfoState {
|
||||||
return GroupInfoState(updatingAvatar: self.updatingAvatar, editingState: self.editingState, updatingName: self.updatingName, peerIdWithRevealedOptions: peerIdWithRevealedOptions, temporaryParticipants: self.temporaryParticipants, successfullyAddedParticipantIds: self.successfullyAddedParticipantIds, removingParticipantIds: self.removingParticipantIds, savingData: self.savingData, searchingMembers: self.searchingMembers)
|
return GroupInfoState(updatingAvatar: self.updatingAvatar, editingState: self.editingState, updatingName: self.updatingName, peerIdWithRevealedOptions: peerIdWithRevealedOptions, expandedParticipants: self.expandedParticipants, temporaryParticipants: self.temporaryParticipants, successfullyAddedParticipantIds: self.successfullyAddedParticipantIds, removingParticipantIds: self.removingParticipantIds, savingData: self.savingData, searchingMembers: self.searchingMembers)
|
||||||
|
}
|
||||||
|
|
||||||
|
func withUpdatedExpandedParticipants(_ expandedParticipants: Bool) -> GroupInfoState {
|
||||||
|
return GroupInfoState(updatingAvatar: self.updatingAvatar, editingState: self.editingState, updatingName: self.updatingName, peerIdWithRevealedOptions: self.peerIdWithRevealedOptions, expandedParticipants: expandedParticipants, temporaryParticipants: self.temporaryParticipants, successfullyAddedParticipantIds: self.successfullyAddedParticipantIds, removingParticipantIds: self.removingParticipantIds, savingData: self.savingData, searchingMembers: self.searchingMembers)
|
||||||
}
|
}
|
||||||
|
|
||||||
func withUpdatedTemporaryParticipants(_ temporaryParticipants: [TemporaryParticipant]) -> GroupInfoState {
|
func withUpdatedTemporaryParticipants(_ temporaryParticipants: [TemporaryParticipant]) -> GroupInfoState {
|
||||||
return GroupInfoState(updatingAvatar: self.updatingAvatar, editingState: self.editingState, updatingName: self.updatingName, peerIdWithRevealedOptions: self.peerIdWithRevealedOptions, temporaryParticipants: temporaryParticipants, successfullyAddedParticipantIds: self.successfullyAddedParticipantIds, removingParticipantIds: self.removingParticipantIds, savingData: self.savingData, searchingMembers: self.searchingMembers)
|
return GroupInfoState(updatingAvatar: self.updatingAvatar, editingState: self.editingState, updatingName: self.updatingName, peerIdWithRevealedOptions: self.peerIdWithRevealedOptions, expandedParticipants: self.expandedParticipants, temporaryParticipants: temporaryParticipants, successfullyAddedParticipantIds: self.successfullyAddedParticipantIds, removingParticipantIds: self.removingParticipantIds, savingData: self.savingData, searchingMembers: self.searchingMembers)
|
||||||
}
|
}
|
||||||
|
|
||||||
func withUpdatedSuccessfullyAddedParticipantIds(_ successfullyAddedParticipantIds: Set<PeerId>) -> GroupInfoState {
|
func withUpdatedSuccessfullyAddedParticipantIds(_ successfullyAddedParticipantIds: Set<PeerId>) -> GroupInfoState {
|
||||||
return GroupInfoState(updatingAvatar: self.updatingAvatar, editingState: self.editingState, updatingName: self.updatingName, peerIdWithRevealedOptions: self.peerIdWithRevealedOptions, temporaryParticipants: self.temporaryParticipants, successfullyAddedParticipantIds: successfullyAddedParticipantIds, removingParticipantIds: self.removingParticipantIds, savingData: self.savingData, searchingMembers: self.searchingMembers)
|
return GroupInfoState(updatingAvatar: self.updatingAvatar, editingState: self.editingState, updatingName: self.updatingName, peerIdWithRevealedOptions: self.peerIdWithRevealedOptions, expandedParticipants: self.expandedParticipants, temporaryParticipants: self.temporaryParticipants, successfullyAddedParticipantIds: successfullyAddedParticipantIds, removingParticipantIds: self.removingParticipantIds, savingData: self.savingData, searchingMembers: self.searchingMembers)
|
||||||
}
|
}
|
||||||
|
|
||||||
func withUpdatedRemovingParticipantIds(_ removingParticipantIds: Set<PeerId>) -> GroupInfoState {
|
func withUpdatedRemovingParticipantIds(_ removingParticipantIds: Set<PeerId>) -> GroupInfoState {
|
||||||
return GroupInfoState(updatingAvatar: self.updatingAvatar, editingState: self.editingState, updatingName: self.updatingName, peerIdWithRevealedOptions: self.peerIdWithRevealedOptions, temporaryParticipants: self.temporaryParticipants, successfullyAddedParticipantIds: self.successfullyAddedParticipantIds, removingParticipantIds: removingParticipantIds, savingData: self.savingData, searchingMembers: self.searchingMembers)
|
return GroupInfoState(updatingAvatar: self.updatingAvatar, editingState: self.editingState, updatingName: self.updatingName, peerIdWithRevealedOptions: self.peerIdWithRevealedOptions, expandedParticipants: self.expandedParticipants, temporaryParticipants: self.temporaryParticipants, successfullyAddedParticipantIds: self.successfullyAddedParticipantIds, removingParticipantIds: removingParticipantIds, savingData: self.savingData, searchingMembers: self.searchingMembers)
|
||||||
}
|
}
|
||||||
|
|
||||||
func withUpdatedSavingData(_ savingData: Bool) -> GroupInfoState {
|
func withUpdatedSavingData(_ savingData: Bool) -> GroupInfoState {
|
||||||
return GroupInfoState(updatingAvatar: self.updatingAvatar, editingState: self.editingState, updatingName: self.updatingName, peerIdWithRevealedOptions: self.peerIdWithRevealedOptions, temporaryParticipants: self.temporaryParticipants, successfullyAddedParticipantIds: self.successfullyAddedParticipantIds, removingParticipantIds: self.removingParticipantIds, savingData: savingData, searchingMembers: self.searchingMembers)
|
return GroupInfoState(updatingAvatar: self.updatingAvatar, editingState: self.editingState, updatingName: self.updatingName, peerIdWithRevealedOptions: self.peerIdWithRevealedOptions, expandedParticipants: self.expandedParticipants, temporaryParticipants: self.temporaryParticipants, successfullyAddedParticipantIds: self.successfullyAddedParticipantIds, removingParticipantIds: self.removingParticipantIds, savingData: savingData, searchingMembers: self.searchingMembers)
|
||||||
}
|
}
|
||||||
|
|
||||||
func withUpdatedSearchingMembers(_ searchingMembers: Bool) -> GroupInfoState {
|
func withUpdatedSearchingMembers(_ searchingMembers: Bool) -> GroupInfoState {
|
||||||
return GroupInfoState(updatingAvatar: self.updatingAvatar, editingState: self.editingState, updatingName: self.updatingName, peerIdWithRevealedOptions: self.peerIdWithRevealedOptions, temporaryParticipants: self.temporaryParticipants, successfullyAddedParticipantIds: self.successfullyAddedParticipantIds, removingParticipantIds: self.removingParticipantIds, savingData: self.savingData, searchingMembers: searchingMembers)
|
return GroupInfoState(updatingAvatar: self.updatingAvatar, editingState: self.editingState, updatingName: self.updatingName, peerIdWithRevealedOptions: self.peerIdWithRevealedOptions, expandedParticipants: self.expandedParticipants, temporaryParticipants: self.temporaryParticipants, successfullyAddedParticipantIds: self.successfullyAddedParticipantIds, removingParticipantIds: self.removingParticipantIds, savingData: self.savingData, searchingMembers: searchingMembers)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1157,8 +1182,11 @@ private func groupInfoEntries(account: Account, presentationData: PresentationDa
|
|||||||
sortedParticipants = updatedParticipants
|
sortedParticipants = updatedParticipants
|
||||||
}
|
}
|
||||||
|
|
||||||
for i in 0 ..< sortedParticipants.count {
|
var expand = state.expandedParticipants
|
||||||
let participant = sortedParticipants[i]
|
let participants = expand ? sortedParticipants : Array(sortedParticipants.prefix(Int(maxParticipantsDisplayedCount)))
|
||||||
|
|
||||||
|
for i in 0 ..< participants.count {
|
||||||
|
let participant = participants[i]
|
||||||
let memberStatus: GroupInfoMemberStatus
|
let memberStatus: GroupInfoMemberStatus
|
||||||
switch participant.participant {
|
switch participant.participant {
|
||||||
case let .creator(_, rank):
|
case let .creator(_, rank):
|
||||||
@ -1220,6 +1248,10 @@ private func groupInfoEntries(account: Account, presentationData: PresentationDa
|
|||||||
|
|
||||||
entries.append(GroupInfoEntry.member(presentationData.theme, presentationData.strings, presentationData.dateTimeFormat, presentationData.nameDisplayOrder, index: i, peerId: participant.peer.id, peer: participant.peer, participant: participant, presence: participant.presences[participant.peer.id], memberStatus: memberStatus, editing: ItemListPeerItemEditing(editable: !peerActions.isEmpty, editing: state.editingState != nil && canRemoveAnyMember, revealed: state.peerIdWithRevealedOptions == participant.peer.id), revealActions: peerActions, enabled: true, selectable: participant.peer.id != account.peerId))
|
entries.append(GroupInfoEntry.member(presentationData.theme, presentationData.strings, presentationData.dateTimeFormat, presentationData.nameDisplayOrder, index: i, peerId: participant.peer.id, peer: participant.peer, participant: participant, presence: participant.presences[participant.peer.id], memberStatus: memberStatus, editing: ItemListPeerItemEditing(editable: !peerActions.isEmpty, editing: state.editingState != nil && canRemoveAnyMember, revealed: state.peerIdWithRevealedOptions == participant.peer.id), revealActions: peerActions, enabled: true, selectable: participant.peer.id != account.peerId))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if !expand && memberCount > maxParticipantsDisplayedCount {
|
||||||
|
entries.append(GroupInfoEntry.expand(presentationData.theme, presentationData.strings.GroupInfo_ShowMoreMembers(Int32(memberCount - maxParticipantsDisplayedCount))))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if let group = view.peers[view.peerId] as? TelegramGroup {
|
if let group = view.peers[view.peerId] as? TelegramGroup {
|
||||||
@ -1288,8 +1320,8 @@ private func valuesRequiringUpdate(state: GroupInfoState, view: PeerView) -> (ti
|
|||||||
}
|
}
|
||||||
|
|
||||||
public func groupInfoController(context: AccountContext, peerId originalPeerId: PeerId, membersLoaded: @escaping () -> Void = {}) -> ViewController {
|
public func groupInfoController(context: AccountContext, peerId originalPeerId: PeerId, membersLoaded: @escaping () -> Void = {}) -> ViewController {
|
||||||
let statePromise = ValuePromise(GroupInfoState(updatingAvatar: nil, editingState: nil, updatingName: nil, peerIdWithRevealedOptions: nil, temporaryParticipants: [], successfullyAddedParticipantIds: Set(), removingParticipantIds: Set(), savingData: false, searchingMembers: false), ignoreRepeated: true)
|
let statePromise = ValuePromise(GroupInfoState(updatingAvatar: nil, editingState: nil, updatingName: nil, peerIdWithRevealedOptions: nil, expandedParticipants: false, temporaryParticipants: [], successfullyAddedParticipantIds: Set(), removingParticipantIds: Set(), savingData: false, searchingMembers: false), ignoreRepeated: true)
|
||||||
let stateValue = Atomic(value: GroupInfoState(updatingAvatar: nil, editingState: nil, updatingName: nil, peerIdWithRevealedOptions: nil, temporaryParticipants: [], successfullyAddedParticipantIds: Set(), removingParticipantIds: Set(), savingData: false, searchingMembers: false))
|
let stateValue = Atomic(value: GroupInfoState(updatingAvatar: nil, editingState: nil, updatingName: nil, peerIdWithRevealedOptions: nil, expandedParticipants: false, temporaryParticipants: [], successfullyAddedParticipantIds: Set(), removingParticipantIds: Set(), savingData: false, searchingMembers: false))
|
||||||
let updateState: ((GroupInfoState) -> GroupInfoState) -> Void = { f in
|
let updateState: ((GroupInfoState) -> GroupInfoState) -> Void = { f in
|
||||||
statePromise.set(stateValue.modify { f($0) })
|
statePromise.set(stateValue.modify { f($0) })
|
||||||
}
|
}
|
||||||
@ -2077,6 +2109,10 @@ public func groupInfoController(context: AccountContext, peerId originalPeerId:
|
|||||||
})
|
})
|
||||||
}, displayLocationContextMenu: { text in
|
}, displayLocationContextMenu: { text in
|
||||||
displayCopyContextMenuImpl?(text, .location)
|
displayCopyContextMenuImpl?(text, .location)
|
||||||
|
}, expandParticipants: {
|
||||||
|
updateState {
|
||||||
|
$0.withUpdatedExpandedParticipants(true)
|
||||||
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
let loadMoreControl = Atomic<(PeerId, PeerChannelMemberCategoryControl)?>(value: nil)
|
let loadMoreControl = Atomic<(PeerId, PeerChannelMemberCategoryControl)?>(value: nil)
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@ -31,6 +31,7 @@ public enum PresentationResourceKey: Int32 {
|
|||||||
case navigationPlayerMaximizedRateActiveIcon
|
case navigationPlayerMaximizedRateActiveIcon
|
||||||
case navigationPlayerMaximizedRateInactiveIcon
|
case navigationPlayerMaximizedRateInactiveIcon
|
||||||
|
|
||||||
|
case itemListDownArrow
|
||||||
case itemListDisclosureArrow
|
case itemListDisclosureArrow
|
||||||
case itemListCheckIcon
|
case itemListCheckIcon
|
||||||
case itemListSecondaryCheckIcon
|
case itemListSecondaryCheckIcon
|
||||||
|
|||||||
@ -21,6 +21,12 @@ public func generateItemListPlusIcon(_ color: UIColor) -> UIImage? {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public struct PresentationResourcesItemList {
|
public struct PresentationResourcesItemList {
|
||||||
|
public static func downArrowImage(_ theme: PresentationTheme) -> UIImage? {
|
||||||
|
return theme.image(PresentationResourceKey.itemListDownArrow.rawValue, { theme in
|
||||||
|
return generateTintedImage(image: UIImage(bundleImageName: "Chat/Input/Search/DownButton"), color: theme.list.itemAccentColor)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
public static func disclosureArrowImage(_ theme: PresentationTheme) -> UIImage? {
|
public static func disclosureArrowImage(_ theme: PresentationTheme) -> UIImage? {
|
||||||
return theme.image(PresentationResourceKey.itemListDisclosureArrow.rawValue, { theme in
|
return theme.image(PresentationResourceKey.itemListDisclosureArrow.rawValue, { theme in
|
||||||
return generateTintedImage(image: UIImage(bundleImageName: "Item List/DisclosureArrow"), color: theme.list.disclosureArrowColor)
|
return generateTintedImage(image: UIImage(bundleImageName: "Item List/DisclosureArrow"), color: theme.list.disclosureArrowColor)
|
||||||
|
|||||||
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user