mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-08-08 08:31:13 +00:00
UI Fixes
This commit is contained in:
parent
62730b9c0b
commit
afc97ff44c
@ -112,6 +112,7 @@
|
|||||||
D005808B21CAB8F000CB7CD3 /* VoipDerivedState.swift in Sources */ = {isa = PBXBuildFile; fileRef = D005808A21CAB8F000CB7CD3 /* VoipDerivedState.swift */; };
|
D005808B21CAB8F000CB7CD3 /* VoipDerivedState.swift in Sources */ = {isa = PBXBuildFile; fileRef = D005808A21CAB8F000CB7CD3 /* VoipDerivedState.swift */; };
|
||||||
D00580A021DCF0A200CB7CD3 /* WallpaperListPreviewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D005809F21DCF0A200CB7CD3 /* WallpaperListPreviewController.swift */; };
|
D00580A021DCF0A200CB7CD3 /* WallpaperListPreviewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D005809F21DCF0A200CB7CD3 /* WallpaperListPreviewController.swift */; };
|
||||||
D00580A221DCF0B700CB7CD3 /* WallpaperListPreviewControllerNode.swift in Sources */ = {isa = PBXBuildFile; fileRef = D00580A121DCF0B700CB7CD3 /* WallpaperListPreviewControllerNode.swift */; };
|
D00580A221DCF0B700CB7CD3 /* WallpaperListPreviewControllerNode.swift in Sources */ = {isa = PBXBuildFile; fileRef = D00580A121DCF0B700CB7CD3 /* WallpaperListPreviewControllerNode.swift */; };
|
||||||
|
D00580B121E3DEF200CB7CD3 /* MergedItemListItem.swift in Sources */ = {isa = PBXBuildFile; fileRef = D00580B021E3DEF200CB7CD3 /* MergedItemListItem.swift */; };
|
||||||
D0068FA821760FA300D1B315 /* StoreDownloadedMedia.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0068FA721760FA300D1B315 /* StoreDownloadedMedia.swift */; };
|
D0068FA821760FA300D1B315 /* StoreDownloadedMedia.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0068FA721760FA300D1B315 /* StoreDownloadedMedia.swift */; };
|
||||||
D007019C2029E8F2006B9E34 /* LegqacyICloudFileController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D007019B2029E8F2006B9E34 /* LegqacyICloudFileController.swift */; };
|
D007019C2029E8F2006B9E34 /* LegqacyICloudFileController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D007019B2029E8F2006B9E34 /* LegqacyICloudFileController.swift */; };
|
||||||
D007019E2029EFDD006B9E34 /* ICloudResources.swift in Sources */ = {isa = PBXBuildFile; fileRef = D007019D2029EFDD006B9E34 /* ICloudResources.swift */; };
|
D007019E2029EFDD006B9E34 /* ICloudResources.swift in Sources */ = {isa = PBXBuildFile; fileRef = D007019D2029EFDD006B9E34 /* ICloudResources.swift */; };
|
||||||
@ -1232,6 +1233,7 @@
|
|||||||
D005808A21CAB8F000CB7CD3 /* VoipDerivedState.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = VoipDerivedState.swift; sourceTree = "<group>"; };
|
D005808A21CAB8F000CB7CD3 /* VoipDerivedState.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = VoipDerivedState.swift; sourceTree = "<group>"; };
|
||||||
D005809F21DCF0A200CB7CD3 /* WallpaperListPreviewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WallpaperListPreviewController.swift; sourceTree = "<group>"; };
|
D005809F21DCF0A200CB7CD3 /* WallpaperListPreviewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WallpaperListPreviewController.swift; sourceTree = "<group>"; };
|
||||||
D00580A121DCF0B700CB7CD3 /* WallpaperListPreviewControllerNode.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WallpaperListPreviewControllerNode.swift; sourceTree = "<group>"; };
|
D00580A121DCF0B700CB7CD3 /* WallpaperListPreviewControllerNode.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WallpaperListPreviewControllerNode.swift; sourceTree = "<group>"; };
|
||||||
|
D00580B021E3DEF200CB7CD3 /* MergedItemListItem.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MergedItemListItem.swift; sourceTree = "<group>"; };
|
||||||
D0068FA721760FA300D1B315 /* StoreDownloadedMedia.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StoreDownloadedMedia.swift; sourceTree = "<group>"; };
|
D0068FA721760FA300D1B315 /* StoreDownloadedMedia.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StoreDownloadedMedia.swift; sourceTree = "<group>"; };
|
||||||
D007019B2029E8F2006B9E34 /* LegqacyICloudFileController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LegqacyICloudFileController.swift; sourceTree = "<group>"; };
|
D007019B2029E8F2006B9E34 /* LegqacyICloudFileController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LegqacyICloudFileController.swift; sourceTree = "<group>"; };
|
||||||
D007019D2029EFDD006B9E34 /* ICloudResources.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ICloudResources.swift; sourceTree = "<group>"; };
|
D007019D2029EFDD006B9E34 /* ICloudResources.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ICloudResources.swift; sourceTree = "<group>"; };
|
||||||
@ -3924,6 +3926,7 @@
|
|||||||
D0E305AE1E5BA8E000D7A3A2 /* ItemListLoadingIndicatorEmptyStateItem.swift */,
|
D0E305AE1E5BA8E000D7A3A2 /* ItemListLoadingIndicatorEmptyStateItem.swift */,
|
||||||
D09AEFD31E5BAF67005C1A8B /* ItemListTextEmptyStateItem.swift */,
|
D09AEFD31E5BAF67005C1A8B /* ItemListTextEmptyStateItem.swift */,
|
||||||
D0BFAE5A20AB35D200793CF2 /* IconSwitchNode.swift */,
|
D0BFAE5A20AB35D200793CF2 /* IconSwitchNode.swift */,
|
||||||
|
D00580B021E3DEF200CB7CD3 /* MergedItemListItem.swift */,
|
||||||
);
|
);
|
||||||
name = Items;
|
name = Items;
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
@ -5484,6 +5487,7 @@
|
|||||||
9F06830B21A404C4001D8EDB /* NotificationExcetionSettingsController.swift in Sources */,
|
9F06830B21A404C4001D8EDB /* NotificationExcetionSettingsController.swift in Sources */,
|
||||||
D0EC6D891EB9F58800EBF1C3 /* ChatSecretAutoremoveTimerActionSheet.swift in Sources */,
|
D0EC6D891EB9F58800EBF1C3 /* ChatSecretAutoremoveTimerActionSheet.swift in Sources */,
|
||||||
D05D8B782195E0050064586F /* SetupTwoStepVerificationContentNode.swift in Sources */,
|
D05D8B782195E0050064586F /* SetupTwoStepVerificationContentNode.swift in Sources */,
|
||||||
|
D00580B121E3DEF200CB7CD3 /* MergedItemListItem.swift in Sources */,
|
||||||
D0EC6D8A1EB9F58800EBF1C3 /* ChatInfo.swift in Sources */,
|
D0EC6D8A1EB9F58800EBF1C3 /* ChatInfo.swift in Sources */,
|
||||||
D0EC6D8B1EB9F58800EBF1C3 /* ChatHistoryNavigationStack.swift in Sources */,
|
D0EC6D8B1EB9F58800EBF1C3 /* ChatHistoryNavigationStack.swift in Sources */,
|
||||||
D0EC6D8C1EB9F58800EBF1C3 /* NavigateToChatController.swift in Sources */,
|
D0EC6D8C1EB9F58800EBF1C3 /* NavigateToChatController.swift in Sources */,
|
||||||
|
@ -66,6 +66,8 @@ final class BotPaymentSwitchItemNode: BotPaymentItemNode {
|
|||||||
self.switchNode.frameColor = theme.list.itemSwitchColors.frameColor
|
self.switchNode.frameColor = theme.list.itemSwitchColors.frameColor
|
||||||
self.switchNode.contentColor = theme.list.itemSwitchColors.contentColor
|
self.switchNode.contentColor = theme.list.itemSwitchColors.contentColor
|
||||||
self.switchNode.handleColor = theme.list.itemSwitchColors.handleColor
|
self.switchNode.handleColor = theme.list.itemSwitchColors.handleColor
|
||||||
|
self.switchNode.positiveContentColor = theme.list.itemSwitchColors.positiveColor
|
||||||
|
self.switchNode.negativeContentColor = theme.list.itemSwitchColors.negativeColor
|
||||||
}
|
}
|
||||||
|
|
||||||
let leftInset: CGFloat = 16.0
|
let leftInset: CGFloat = 16.0
|
||||||
|
@ -510,7 +510,7 @@ public func channelBannedMemberController(account: Account, peerId: PeerId, memb
|
|||||||
if state.updating {
|
if state.updating {
|
||||||
rightNavigationButton = ItemListNavigationButton(content: .none, style: .activity, enabled: true, action: {})
|
rightNavigationButton = ItemListNavigationButton(content: .none, style: .activity, enabled: true, action: {})
|
||||||
} else {
|
} else {
|
||||||
rightNavigationButton = ItemListNavigationButton(content: .text(presentationData.strings.Common_Done), style: .bold, enabled: true, action: {
|
rightNavigationButton = ItemListNavigationButton(content: .text(presentationData.strings.GroupPermission_ApplyAlertAction), style: .bold, enabled: true, action: {
|
||||||
let _ = (peerView.get()
|
let _ = (peerView.get()
|
||||||
|> take(1)
|
|> take(1)
|
||||||
|> deliverOnMainQueue).start(next: { view in
|
|> deliverOnMainQueue).start(next: { view in
|
||||||
|
@ -301,15 +301,15 @@ private enum ChannelInfoEntry: ItemListNodeEntry {
|
|||||||
|
|
||||||
})
|
})
|
||||||
case let .admins(theme, text, value):
|
case let .admins(theme, text, value):
|
||||||
return ItemListDisclosureItem(theme: theme, icon: PresentationResourcesChat.groupInfoAdminsIcon(theme), title: text, label: value, sectionId: self.section, style: .plain, action: {
|
return ItemListDisclosureItem(theme: theme, title: text, label: value, sectionId: self.section, style: .plain, action: {
|
||||||
arguments.openAdmins()
|
arguments.openAdmins()
|
||||||
})
|
})
|
||||||
case let .members(theme, text, value):
|
case let .members(theme, text, value):
|
||||||
return ItemListDisclosureItem(theme: theme, icon: PresentationResourcesChat.groupInfoMembersIcon(theme), title: text, label: value, sectionId: self.section, style: .plain, action: {
|
return ItemListDisclosureItem(theme: theme, title: text, label: value, sectionId: self.section, style: .plain, action: {
|
||||||
arguments.openMembers()
|
arguments.openMembers()
|
||||||
})
|
})
|
||||||
case let .banned(theme, text, value):
|
case let .banned(theme, text, value):
|
||||||
return ItemListDisclosureItem(theme: theme, icon: PresentationResourcesChat.groupInfoBannedIcon(theme), title: text, label: value, sectionId: self.section, style: .plain, action: {
|
return ItemListDisclosureItem(theme: theme, title: text, label: value, sectionId: self.section, style: .plain, action: {
|
||||||
arguments.openBanned()
|
arguments.openBanned()
|
||||||
})
|
})
|
||||||
case let .signMessages(theme, text, value):
|
case let .signMessages(theme, text, value):
|
||||||
@ -473,6 +473,8 @@ private func channelInfoEntries(account: Account, presentationData: Presentation
|
|||||||
} else {
|
} else {
|
||||||
notificationsText = presentationData.strings.UserInfo_NotificationsDisabled
|
notificationsText = presentationData.strings.UserInfo_NotificationsDisabled
|
||||||
}
|
}
|
||||||
|
} else if case .default = notificationSettings.messageSound {
|
||||||
|
notificationsText = presentationData.strings.UserInfo_NotificationsEnabled
|
||||||
} else {
|
} else {
|
||||||
notificationsText = localizedPeerNotificationSoundString(strings: presentationData.strings, sound: notificationSettings.messageSound, default: globalNotificationSettings.effective.channels.sound)
|
notificationsText = localizedPeerNotificationSoundString(strings: presentationData.strings, sound: notificationSettings.messageSound, default: globalNotificationSettings.effective.channels.sound)
|
||||||
}
|
}
|
||||||
@ -794,6 +796,11 @@ public func channelInfoController(account: Account, peerId: PeerId) -> ViewContr
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var canEditChannel = false
|
||||||
|
if let peer = view.peers[view.peerId] as? TelegramChannel {
|
||||||
|
canEditChannel = peer.hasPermission(.changeInfo)
|
||||||
|
}
|
||||||
|
|
||||||
var leftNavigationButton: ItemListNavigationButton?
|
var leftNavigationButton: ItemListNavigationButton?
|
||||||
var rightNavigationButton: ItemListNavigationButton?
|
var rightNavigationButton: ItemListNavigationButton?
|
||||||
if let editingState = state.editingState {
|
if let editingState = state.editingState {
|
||||||
@ -856,7 +863,7 @@ public func channelInfoController(account: Account, peerId: PeerId) -> ViewContr
|
|||||||
}))
|
}))
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
} else {
|
} else if canEditChannel {
|
||||||
rightNavigationButton = ItemListNavigationButton(content: .text(presentationData.strings.Common_Edit), style: .regular, enabled: true, action: {
|
rightNavigationButton = ItemListNavigationButton(content: .text(presentationData.strings.Common_Edit), style: .regular, enabled: true, action: {
|
||||||
if let channel = peer as? TelegramChannel, case .broadcast = channel.info {
|
if let channel = peer as? TelegramChannel, case .broadcast = channel.info {
|
||||||
var text = ""
|
var text = ""
|
||||||
|
@ -113,7 +113,7 @@ func chatHistoryEntriesForView(location: ChatLocation, view: MessageHistoryView,
|
|||||||
entries.insert(.ChatInfoEntry(botInfo.description, presentationData), at: 0)
|
entries.insert(.ChatInfoEntry(botInfo.description, presentationData), at: 0)
|
||||||
}
|
}
|
||||||
var isEmpty = true
|
var isEmpty = true
|
||||||
if entries.count <= 2 {
|
if entries.count <= 3 {
|
||||||
loop: for entry in view.entries {
|
loop: for entry in view.entries {
|
||||||
switch entry {
|
switch entry {
|
||||||
case let .MessageEntry(entry):
|
case let .MessageEntry(entry):
|
||||||
@ -121,7 +121,7 @@ func chatHistoryEntriesForView(location: ChatLocation, view: MessageHistoryView,
|
|||||||
for media in entry.0.media {
|
for media in entry.0.media {
|
||||||
if let action = media as? TelegramMediaAction {
|
if let action = media as? TelegramMediaAction {
|
||||||
switch action.action {
|
switch action.action {
|
||||||
case .groupCreated, .photoUpdated:
|
case .groupCreated, .photoUpdated, .channelMigratedFromGroup, .groupMigratedToChannel:
|
||||||
isEmptyMedia = true
|
isEmptyMedia = true
|
||||||
default:
|
default:
|
||||||
break
|
break
|
||||||
|
@ -121,27 +121,48 @@ struct ChatHistoryListViewTransition {
|
|||||||
let animateIn: Bool
|
let animateIn: Bool
|
||||||
}
|
}
|
||||||
|
|
||||||
private func maxMessageIndexForEntries(_ entries: [ChatHistoryEntry], indexRange: (Int, Int)) -> (incoming: MessageIndex?, overall: MessageIndex?) {
|
private func maxMessageIndexForEntries(_ view: ChatHistoryView, indexRange: (Int, Int)) -> (incoming: MessageIndex?, overall: MessageIndex?) {
|
||||||
|
var incoming: MessageIndex?
|
||||||
var overall: MessageIndex?
|
var overall: MessageIndex?
|
||||||
for i in (indexRange.0 ... indexRange.1).reversed() {
|
var nextLowestIndex: MessageIndex?
|
||||||
if case let .MessageEntry(message, _, _, _, _, _) = entries[i] {
|
if indexRange.0 >= 0 && indexRange.0 < view.filteredEntries.count {
|
||||||
if overall == nil {
|
if indexRange.0 > 0 {
|
||||||
overall = MessageIndex(message)
|
nextLowestIndex = view.filteredEntries[indexRange.0 - 1].index
|
||||||
}
|
}
|
||||||
if message.flags.contains(.Incoming) {
|
|
||||||
return (MessageIndex(message), overall)
|
|
||||||
}
|
}
|
||||||
} else if case let .MessageGroupEntry(_, messages, _) = entries[i] {
|
var nextHighestIndex: MessageIndex?
|
||||||
let index = MessageIndex(messages[messages.count - 1].0)
|
if indexRange.1 >= 0 && indexRange.1 < view.filteredEntries.count {
|
||||||
if overall == nil {
|
if indexRange.1 < view.filteredEntries.count - 1 {
|
||||||
|
nextHighestIndex = view.filteredEntries[indexRange.1 + 1].index
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for i in (0 ..< view.originalView.entries.count).reversed() {
|
||||||
|
let index = view.originalView.entries[i].index
|
||||||
|
if let nextLowestIndex = nextLowestIndex {
|
||||||
|
if index <= nextLowestIndex {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if let nextHighestIndex = nextHighestIndex {
|
||||||
|
if index >= nextHighestIndex {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if case let .MessageEntry(messageEntry) = view.originalView.entries[i] {
|
||||||
|
if overall == nil || overall! < index {
|
||||||
overall = index
|
overall = index
|
||||||
}
|
}
|
||||||
if messages[messages.count - 1].0.flags.contains(.Incoming) {
|
if messageEntry.0.flags.contains(.Incoming) {
|
||||||
return (index, overall)
|
if incoming == nil || incoming! < index {
|
||||||
|
incoming = index
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if incoming != nil {
|
||||||
|
return (incoming, overall)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return (nil, overall)
|
return (incoming, overall)
|
||||||
}
|
}
|
||||||
|
|
||||||
private func mappedInsertEntries(account: Account, chatLocation: ChatLocation, associatedData: ChatMessageItemAssociatedData, controllerInteraction: ChatControllerInteraction, mode: ChatHistoryListMode, entries: [ChatHistoryViewTransitionInsertEntry]) -> [ListViewInsertItem] {
|
private func mappedInsertEntries(account: Account, chatLocation: ChatLocation, associatedData: ChatMessageItemAssociatedData, controllerInteraction: ChatControllerInteraction, mode: ChatHistoryListMode, entries: [ChatHistoryViewTransitionInsertEntry]) -> [ListViewInsertItem] {
|
||||||
@ -654,7 +675,7 @@ public final class ChatHistoryListNode: ListView, ChatHistoryNode {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if readIndexRange.0 <= readIndexRange.1 {
|
if readIndexRange.0 <= readIndexRange.1 {
|
||||||
let (maxIncomingIndex, maxOverallIndex) = maxMessageIndexForEntries(historyView.filteredEntries, indexRange: readIndexRange)
|
let (maxIncomingIndex, maxOverallIndex) = maxMessageIndexForEntries(historyView, indexRange: readIndexRange)
|
||||||
|
|
||||||
if let maxIncomingIndex = maxIncomingIndex {
|
if let maxIncomingIndex = maxIncomingIndex {
|
||||||
strongSelf.updateMaxVisibleReadIncomingMessageIndex(maxIncomingIndex)
|
strongSelf.updateMaxVisibleReadIncomingMessageIndex(maxIncomingIndex)
|
||||||
@ -980,7 +1001,7 @@ public final class ChatHistoryListNode: ListView, ChatHistoryNode {
|
|||||||
visibleFirstIndex += 1
|
visibleFirstIndex += 1
|
||||||
}*/
|
}*/
|
||||||
if visibleFirstIndex <= visible.lastIndex {
|
if visibleFirstIndex <= visible.lastIndex {
|
||||||
let (messageIndex, _) = maxMessageIndexForEntries(transition.historyView.filteredEntries, indexRange: (transition.historyView.filteredEntries.count - 1 - visible.lastIndex, transition.historyView.filteredEntries.count - 1 - visibleFirstIndex))
|
let (messageIndex, _) = maxMessageIndexForEntries(transition.historyView, indexRange: (transition.historyView.filteredEntries.count - 1 - visible.lastIndex, transition.historyView.filteredEntries.count - 1 - visibleFirstIndex))
|
||||||
if let messageIndex = messageIndex {
|
if let messageIndex = messageIndex {
|
||||||
strongSelf.updateMaxVisibleReadIncomingMessageIndex(messageIndex)
|
strongSelf.updateMaxVisibleReadIncomingMessageIndex(messageIndex)
|
||||||
}
|
}
|
||||||
|
@ -436,10 +436,11 @@ public class ChatListController: TelegramController, KeyShortcutResponder, UIVie
|
|||||||
|
|
||||||
self.chatListDisplayNode.requestOpenMessageFromSearch = { [weak self] peer, messageId in
|
self.chatListDisplayNode.requestOpenMessageFromSearch = { [weak self] peer, messageId in
|
||||||
if let strongSelf = self {
|
if let strongSelf = self {
|
||||||
strongSelf.openMessageFromSearchDisposable.set((storedMessageFromSearchPeer(account: strongSelf.account, peer: peer) |> deliverOnMainQueue).start(completed: { [weak strongSelf] in
|
strongSelf.openMessageFromSearchDisposable.set((storedMessageFromSearchPeer(account: strongSelf.account, peer: peer)
|
||||||
|
|> deliverOnMainQueue).start(next: { [weak strongSelf] actualPeerId in
|
||||||
if let strongSelf = strongSelf {
|
if let strongSelf = strongSelf {
|
||||||
if let navigationController = strongSelf.navigationController as? NavigationController {
|
if let navigationController = strongSelf.navigationController as? NavigationController {
|
||||||
navigateToChatController(navigationController: navigationController, account: strongSelf.account, chatLocation: .peer(messageId.peerId), messageId: messageId, purposefulAction: {
|
navigateToChatController(navigationController: navigationController, account: strongSelf.account, chatLocation: .peer(actualPeerId), messageId: messageId, purposefulAction: {
|
||||||
self?.deactivateSearch(animated: false)
|
self?.deactivateSearch(animated: false)
|
||||||
})
|
})
|
||||||
strongSelf.chatListDisplayNode.chatListNode.clearHighlightAnimated(true)
|
strongSelf.chatListDisplayNode.chatListNode.clearHighlightAnimated(true)
|
||||||
|
@ -100,8 +100,10 @@ class ChatListItem: ListViewItem {
|
|||||||
func selected(listView: ListView) {
|
func selected(listView: ListView) {
|
||||||
switch self.content {
|
switch self.content {
|
||||||
case let .peer(message, peer, _, _, _, _, _, isAd, _):
|
case let .peer(message, peer, _, _, _, _, _, isAd, _):
|
||||||
if let message = message {
|
if let message = message, let peer = peer.peer {
|
||||||
self.interaction.messageSelected(message, isAd)
|
self.interaction.messageSelected(peer, message, isAd)
|
||||||
|
} else if let peer = peer.peer {
|
||||||
|
self.interaction.peerSelected(peer)
|
||||||
} else if let peer = peer.peers[peer.peerId] {
|
} else if let peer = peer.peers[peer.peerId] {
|
||||||
self.interaction.peerSelected(peer)
|
self.interaction.peerSelected(peer)
|
||||||
}
|
}
|
||||||
|
@ -60,7 +60,7 @@ final class ChatListNodeInteraction {
|
|||||||
let activateSearch: () -> Void
|
let activateSearch: () -> Void
|
||||||
let peerSelected: (Peer) -> Void
|
let peerSelected: (Peer) -> Void
|
||||||
let togglePeerSelected: (PeerId) -> Void
|
let togglePeerSelected: (PeerId) -> Void
|
||||||
let messageSelected: (Message, Bool) -> Void
|
let messageSelected: (Peer, Message, Bool) -> Void
|
||||||
let groupSelected: (PeerGroupId) -> Void
|
let groupSelected: (PeerGroupId) -> Void
|
||||||
let addContact: (String) -> Void
|
let addContact: (String) -> Void
|
||||||
let setPeerIdWithRevealedOptions: (PeerId?, PeerId?) -> Void
|
let setPeerIdWithRevealedOptions: (PeerId?, PeerId?) -> Void
|
||||||
@ -72,7 +72,7 @@ final class ChatListNodeInteraction {
|
|||||||
|
|
||||||
var highlightedChatLocation: ChatListHighlightedLocation?
|
var highlightedChatLocation: ChatListHighlightedLocation?
|
||||||
|
|
||||||
init(activateSearch: @escaping () -> Void, peerSelected: @escaping (Peer) -> Void, togglePeerSelected: @escaping (PeerId) -> Void, messageSelected: @escaping (Message, Bool) -> Void, groupSelected: @escaping (PeerGroupId) -> Void, addContact: @escaping (String) -> Void, setPeerIdWithRevealedOptions: @escaping (PeerId?, PeerId?) -> Void, setItemPinned: @escaping (PinnedItemId, Bool) -> Void, setPeerMuted: @escaping (PeerId, Bool) -> Void, deletePeer: @escaping (PeerId) -> Void, updatePeerGrouping: @escaping (PeerId, Bool) -> Void, togglePeerMarkedUnread: @escaping (PeerId, Bool) -> Void) {
|
init(activateSearch: @escaping () -> Void, peerSelected: @escaping (Peer) -> Void, togglePeerSelected: @escaping (PeerId) -> Void, messageSelected: @escaping (Peer, Message, Bool) -> Void, groupSelected: @escaping (PeerGroupId) -> Void, addContact: @escaping (String) -> Void, setPeerIdWithRevealedOptions: @escaping (PeerId?, PeerId?) -> Void, setItemPinned: @escaping (PinnedItemId, Bool) -> Void, setPeerMuted: @escaping (PeerId, Bool) -> Void, deletePeer: @escaping (PeerId) -> Void, updatePeerGrouping: @escaping (PeerId, Bool) -> Void, togglePeerMarkedUnread: @escaping (PeerId, Bool) -> Void) {
|
||||||
self.activateSearch = activateSearch
|
self.activateSearch = activateSearch
|
||||||
self.peerSelected = peerSelected
|
self.peerSelected = peerSelected
|
||||||
self.togglePeerSelected = togglePeerSelected
|
self.togglePeerSelected = togglePeerSelected
|
||||||
@ -386,9 +386,9 @@ final class ChatListNode: ListView {
|
|||||||
}
|
}
|
||||||
return state
|
return state
|
||||||
}
|
}
|
||||||
}, messageSelected: { [weak self] message, isAd in
|
}, messageSelected: { [weak self] peer, message, isAd in
|
||||||
if let strongSelf = self, let peerSelected = strongSelf.peerSelected {
|
if let strongSelf = self, let peerSelected = strongSelf.peerSelected {
|
||||||
peerSelected(message.id.peerId, true, isAd)
|
peerSelected(peer.id, true, isAd)
|
||||||
}
|
}
|
||||||
}, groupSelected: { [weak self] groupId in
|
}, groupSelected: { [weak self] groupId in
|
||||||
if let strongSelf = self, let groupSelected = strongSelf.groupSelected {
|
if let strongSelf = self, let groupSelected = strongSelf.groupSelected {
|
||||||
|
@ -842,7 +842,7 @@ final class ChatListSearchContainerNode: SearchDisplayControllerContentNode {
|
|||||||
let _ = addRecentlySearchedPeer(postbox: account.postbox, peerId: peer.id).start()
|
let _ = addRecentlySearchedPeer(postbox: account.postbox, peerId: peer.id).start()
|
||||||
self?.listNode.clearHighlightAnimated(true)
|
self?.listNode.clearHighlightAnimated(true)
|
||||||
}, togglePeerSelected: { _ in
|
}, togglePeerSelected: { _ in
|
||||||
}, messageSelected: { [weak self] message, _ in
|
}, messageSelected: { [weak self] peer, message, _ in
|
||||||
if let peer = message.peers[message.id.peerId] {
|
if let peer = message.peers[message.id.peerId] {
|
||||||
openMessage(peer, message.id)
|
openMessage(peer, message.id)
|
||||||
}
|
}
|
||||||
|
@ -232,7 +232,7 @@ private func universalServiceMessageString(theme: ChatPresentationThemeData?, st
|
|||||||
case .joinedByLink:
|
case .joinedByLink:
|
||||||
attributedString = addAttributesToStringWithRanges(strings.Notification_JoinedGroupByLink(authorName), body: bodyAttributes, argumentAttributes: peerMentionsAttributes(primaryTextColor: primaryTextColor, peerIds: [(0, message.author?.id)]))
|
attributedString = addAttributesToStringWithRanges(strings.Notification_JoinedGroupByLink(authorName), body: bodyAttributes, argumentAttributes: peerMentionsAttributes(primaryTextColor: primaryTextColor, peerIds: [(0, message.author?.id)]))
|
||||||
case .channelMigratedFromGroup, .groupMigratedToChannel:
|
case .channelMigratedFromGroup, .groupMigratedToChannel:
|
||||||
attributedString = NSAttributedString(string: strings.Notification_ChannelMigratedFrom, font: titleFont, textColor: primaryTextColor)
|
attributedString = NSAttributedString(string: "", font: titleFont, textColor: primaryTextColor)
|
||||||
case let .messageAutoremoveTimeoutUpdated(timeout):
|
case let .messageAutoremoveTimeoutUpdated(timeout):
|
||||||
if timeout > 0 {
|
if timeout > 0 {
|
||||||
let timeValue = timeIntervalString(strings: strings, value: timeout)
|
let timeValue = timeIntervalString(strings: strings, value: timeout)
|
||||||
|
@ -136,7 +136,7 @@ class ContactMultiselectionController: ViewController {
|
|||||||
let rightNavigationButton = UIBarButtonItem(title: self.presentationData.strings.Common_Next, style: .done, target: self, action: #selector(self.rightNavigationButtonPressed))
|
let rightNavigationButton = UIBarButtonItem(title: self.presentationData.strings.Common_Next, style: .done, target: self, action: #selector(self.rightNavigationButtonPressed))
|
||||||
self.rightNavigationButton = rightNavigationButton
|
self.rightNavigationButton = rightNavigationButton
|
||||||
self.navigationItem.rightBarButtonItem = self.rightNavigationButton
|
self.navigationItem.rightBarButtonItem = self.rightNavigationButton
|
||||||
rightNavigationButton.isEnabled = false
|
rightNavigationButton.isEnabled = count != 0
|
||||||
case .channelCreation:
|
case .channelCreation:
|
||||||
self.titleView.title = CounterContollerTitle(title: self.presentationData.strings.GroupInfo_AddParticipantTitle, counter: "")
|
self.titleView.title = CounterContollerTitle(title: self.presentationData.strings.GroupInfo_AddParticipantTitle, counter: "")
|
||||||
let rightNavigationButton = UIBarButtonItem(title: self.presentationData.strings.Common_Next, style: .done, target: self, action: #selector(self.rightNavigationButtonPressed))
|
let rightNavigationButton = UIBarButtonItem(title: self.presentationData.strings.Common_Next, style: .done, target: self, action: #selector(self.rightNavigationButtonPressed))
|
||||||
|
@ -57,7 +57,9 @@ private let rootController = PresentationThemeRootController(
|
|||||||
private let switchColors = PresentationThemeSwitch(
|
private let switchColors = PresentationThemeSwitch(
|
||||||
frameColor: UIColor(rgb: 0xDBF5FF, alpha: 0.5),
|
frameColor: UIColor(rgb: 0xDBF5FF, alpha: 0.5),
|
||||||
handleColor: UIColor(rgb: 0x121212),
|
handleColor: UIColor(rgb: 0x121212),
|
||||||
contentColor: accentColor
|
contentColor: accentColor,
|
||||||
|
positiveColor: accentColor,
|
||||||
|
negativeColor: destructiveColor
|
||||||
)
|
)
|
||||||
|
|
||||||
private let list = PresentationThemeList(
|
private let list = PresentationThemeList(
|
||||||
|
@ -57,7 +57,9 @@ private let rootController = PresentationThemeRootController(
|
|||||||
private let switchColors = PresentationThemeSwitch(
|
private let switchColors = PresentationThemeSwitch(
|
||||||
frameColor: UIColor(rgb: 0x545454),
|
frameColor: UIColor(rgb: 0x545454),
|
||||||
handleColor: UIColor(rgb: 0x121212),
|
handleColor: UIColor(rgb: 0x121212),
|
||||||
contentColor: UIColor(rgb: 0xb2b2b2)
|
contentColor: UIColor(rgb: 0xb2b2b2),
|
||||||
|
positiveColor: UIColor(rgb: 0x000000),
|
||||||
|
negativeColor: destructiveColor
|
||||||
)
|
)
|
||||||
|
|
||||||
private let list = PresentationThemeList(
|
private let list = PresentationThemeList(
|
||||||
|
@ -57,7 +57,9 @@ private func makeDefaultPresentationTheme(accentColor: UIColor, serviceBackgroun
|
|||||||
let switchColors = PresentationThemeSwitch(
|
let switchColors = PresentationThemeSwitch(
|
||||||
frameColor: UIColor(rgb: 0xe0e0e0),
|
frameColor: UIColor(rgb: 0xe0e0e0),
|
||||||
handleColor: UIColor(rgb: 0xffffff),
|
handleColor: UIColor(rgb: 0xffffff),
|
||||||
contentColor: UIColor(rgb: 0x42d451)
|
contentColor: UIColor(rgb: 0x42d451),
|
||||||
|
positiveColor: UIColor(rgb: 0x00B12C),
|
||||||
|
negativeColor: destructiveColor
|
||||||
)
|
)
|
||||||
|
|
||||||
let list = PresentationThemeList(
|
let list = PresentationThemeList(
|
||||||
|
@ -28,7 +28,6 @@ private final class GroupInfoArguments {
|
|||||||
let promotePeer: (RenderedChannelParticipant) -> Void
|
let promotePeer: (RenderedChannelParticipant) -> Void
|
||||||
let restrictPeer: (RenderedChannelParticipant) -> Void
|
let restrictPeer: (RenderedChannelParticipant) -> Void
|
||||||
let removePeer: (PeerId) -> Void
|
let removePeer: (PeerId) -> Void
|
||||||
let convertToSupergroup: () -> Void
|
|
||||||
let leave: () -> Void
|
let leave: () -> Void
|
||||||
let displayUsernameShareMenu: (String) -> Void
|
let displayUsernameShareMenu: (String) -> Void
|
||||||
let displayUsernameContextMenu: (String) -> Void
|
let displayUsernameContextMenu: (String) -> Void
|
||||||
@ -37,7 +36,7 @@ private final class GroupInfoArguments {
|
|||||||
let openStickerPackSetup: () -> Void
|
let openStickerPackSetup: () -> Void
|
||||||
let openGroupTypeSetup: () -> Void
|
let openGroupTypeSetup: () -> Void
|
||||||
|
|
||||||
init(account: Account, peerId: PeerId, 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, convertToSupergroup: @escaping () -> 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) {
|
init(account: Account, peerId: PeerId, 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) {
|
||||||
self.account = account
|
self.account = account
|
||||||
self.peerId = peerId
|
self.peerId = peerId
|
||||||
self.avatarAndNameInfoContext = avatarAndNameInfoContext
|
self.avatarAndNameInfoContext = avatarAndNameInfoContext
|
||||||
@ -57,7 +56,6 @@ private final class GroupInfoArguments {
|
|||||||
self.promotePeer = promotePeer
|
self.promotePeer = promotePeer
|
||||||
self.restrictPeer = restrictPeer
|
self.restrictPeer = restrictPeer
|
||||||
self.removePeer = removePeer
|
self.removePeer = removePeer
|
||||||
self.convertToSupergroup = convertToSupergroup
|
|
||||||
self.leave = leave
|
self.leave = leave
|
||||||
self.displayUsernameShareMenu = displayUsernameShareMenu
|
self.displayUsernameShareMenu = displayUsernameShareMenu
|
||||||
self.displayUsernameContextMenu = displayUsernameContextMenu
|
self.displayUsernameContextMenu = displayUsernameContextMenu
|
||||||
@ -147,7 +145,6 @@ 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)
|
case member(PresentationTheme, PresentationStrings, PresentationDateTimeFormat, PresentationPersonNameOrder, index: Int, peerId: PeerId, peer: Peer, participant: RenderedChannelParticipant?, presence: PeerPresence?, memberStatus: GroupInfoMemberStatus, editing: ItemListPeerItemEditing, revealActions: [ParticipantRevealAction], enabled: Bool)
|
||||||
case convertToSupergroup(PresentationTheme, String)
|
|
||||||
case leave(PresentationTheme, String)
|
case leave(PresentationTheme, String)
|
||||||
|
|
||||||
var section: ItemListSectionId {
|
var section: ItemListSectionId {
|
||||||
@ -164,7 +161,7 @@ private enum GroupInfoEntry: ItemListNodeEntry {
|
|||||||
return GroupInfoSection.memberManagement.rawValue
|
return GroupInfoSection.memberManagement.rawValue
|
||||||
case .addMember, .member:
|
case .addMember, .member:
|
||||||
return GroupInfoSection.members.rawValue
|
return GroupInfoSection.members.rawValue
|
||||||
case .convertToSupergroup, .leave:
|
case .leave:
|
||||||
return GroupInfoSection.leave.rawValue
|
return GroupInfoSection.leave.rawValue
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -230,12 +227,6 @@ private enum GroupInfoEntry: ItemListNodeEntry {
|
|||||||
} else {
|
} else {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
case let .convertToSupergroup(lhsTheme, lhsText):
|
|
||||||
if case let .convertToSupergroup(rhsTheme, rhsText) = rhs, lhsTheme === rhsTheme, lhsText == rhsText {
|
|
||||||
return true
|
|
||||||
} else {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
case let .aboutHeader(lhsTheme, lhsText):
|
case let .aboutHeader(lhsTheme, lhsText):
|
||||||
if case let .aboutHeader(rhsTheme, rhsText) = rhs, lhsTheme === rhsTheme, lhsText == rhsText {
|
if case let .aboutHeader(rhsTheme, rhsText) = rhs, lhsTheme === rhsTheme, lhsText == rhsText {
|
||||||
return true
|
return true
|
||||||
@ -407,8 +398,6 @@ private enum GroupInfoEntry: ItemListNodeEntry {
|
|||||||
return 17
|
return 17
|
||||||
case let .member(_, _, _, _, index, _, _, _, _, _, _, _, _):
|
case let .member(_, _, _, _, index, _, _, _, _, _, _, _, _):
|
||||||
return 20 + index
|
return 20 + index
|
||||||
case .convertToSupergroup:
|
|
||||||
return 100000
|
|
||||||
case .leave:
|
case .leave:
|
||||||
return 100000 + 1
|
return 100000 + 1
|
||||||
}
|
}
|
||||||
@ -516,10 +505,6 @@ private enum GroupInfoEntry: ItemListNodeEntry {
|
|||||||
}, removePeer: { peerId in
|
}, removePeer: { peerId in
|
||||||
arguments.removePeer(peerId)
|
arguments.removePeer(peerId)
|
||||||
})
|
})
|
||||||
case let .convertToSupergroup(theme, title):
|
|
||||||
return ItemListActionItem(theme: theme, title: title, kind: .generic, alignment: .center, sectionId: self.section, style: .blocks, action: {
|
|
||||||
arguments.convertToSupergroup()
|
|
||||||
})
|
|
||||||
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()
|
||||||
@ -746,6 +731,8 @@ private func groupInfoEntries(account: Account, presentationData: PresentationDa
|
|||||||
} else {
|
} else {
|
||||||
notificationsText = presentationData.strings.UserInfo_NotificationsDisabled
|
notificationsText = presentationData.strings.UserInfo_NotificationsDisabled
|
||||||
}
|
}
|
||||||
|
} else if case .default = peerNotificationSettings.messageSound {
|
||||||
|
notificationsText = presentationData.strings.UserInfo_NotificationsEnabled
|
||||||
} else {
|
} else {
|
||||||
notificationsText = localizedPeerNotificationSoundString(strings: presentationData.strings, sound: peerNotificationSettings.messageSound, default: globalNotificationSettings.effective.channels.sound)
|
notificationsText = localizedPeerNotificationSoundString(strings: presentationData.strings, sound: peerNotificationSettings.messageSound, default: globalNotificationSettings.effective.channels.sound)
|
||||||
}
|
}
|
||||||
@ -1023,6 +1010,10 @@ private func groupInfoEntries(account: Account, presentationData: PresentationDa
|
|||||||
|
|
||||||
var canPromote: Bool
|
var canPromote: Bool
|
||||||
var canRestrict: Bool
|
var canRestrict: Bool
|
||||||
|
if participant.peer.id == account.peerId {
|
||||||
|
canPromote = false
|
||||||
|
canRestrict = false
|
||||||
|
} else {
|
||||||
switch participant.participant {
|
switch participant.participant {
|
||||||
case .creator:
|
case .creator:
|
||||||
canPromote = false
|
canPromote = false
|
||||||
@ -1053,6 +1044,7 @@ private func groupInfoEntries(account: Account, presentationData: PresentationDa
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
var peerActions: [ParticipantRevealAction] = []
|
var peerActions: [ParticipantRevealAction] = []
|
||||||
if canPromote {
|
if canPromote {
|
||||||
@ -1069,9 +1061,6 @@ private func groupInfoEntries(account: Account, presentationData: PresentationDa
|
|||||||
|
|
||||||
if let group = view.peers[view.peerId] as? TelegramGroup {
|
if let group = view.peers[view.peerId] as? TelegramGroup {
|
||||||
if case .Member = group.membership {
|
if case .Member = group.membership {
|
||||||
if case .creator = group.role, state.editingState != nil {
|
|
||||||
entries.append(.convertToSupergroup(presentationData.theme, presentationData.strings.GroupInfo_ConvertToSupergroup))
|
|
||||||
}
|
|
||||||
entries.append(.leave(presentationData.theme, presentationData.strings.Group_LeaveGroup))
|
entries.append(.leave(presentationData.theme, presentationData.strings.Group_LeaveGroup))
|
||||||
}
|
}
|
||||||
} else if let channel = view.peers[view.peerId] as? TelegramChannel {
|
} else if let channel = view.peers[view.peerId] as? TelegramChannel {
|
||||||
@ -1659,8 +1648,6 @@ public func groupInfoController(account: Account, peerId: PeerId) -> ViewControl
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
removeMemberDisposable.set(signal.start())
|
removeMemberDisposable.set(signal.start())
|
||||||
}, convertToSupergroup: {
|
|
||||||
pushControllerImpl?(convertToSupergroupController(account: account, peerId: peerId))
|
|
||||||
}, leave: {
|
}, leave: {
|
||||||
let _ = (peerView.get()
|
let _ = (peerView.get()
|
||||||
|> take(1)
|
|> take(1)
|
||||||
@ -1761,7 +1748,24 @@ public func groupInfoController(account: Account, peerId: PeerId) -> ViewControl
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let rightNavigationButton: ItemListNavigationButton
|
var canEditGroupInfo = false
|
||||||
|
if let group = view.peers[view.peerId] as? TelegramGroup {
|
||||||
|
switch group.role {
|
||||||
|
case .admin, .creator:
|
||||||
|
canEditGroupInfo = true
|
||||||
|
case .member:
|
||||||
|
break
|
||||||
|
}
|
||||||
|
if !group.hasBannedPermission(.banChangeInfo) {
|
||||||
|
canEditGroupInfo = true
|
||||||
|
}
|
||||||
|
} else if let channel = view.peers[view.peerId] as? TelegramChannel {
|
||||||
|
if channel.hasPermission(.changeInfo) {
|
||||||
|
canEditGroupInfo = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var rightNavigationButton: ItemListNavigationButton?
|
||||||
var secondaryRightNavigationButton: ItemListNavigationButton?
|
var secondaryRightNavigationButton: ItemListNavigationButton?
|
||||||
if let editingState = state.editingState {
|
if let editingState = state.editingState {
|
||||||
var doneEnabled = true
|
var doneEnabled = true
|
||||||
@ -1820,7 +1824,7 @@ public func groupInfoController(account: Account, peerId: PeerId) -> ViewControl
|
|||||||
}))
|
}))
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
} else {
|
} else if canEditGroupInfo {
|
||||||
rightNavigationButton = ItemListNavigationButton(content: .text(presentationData.strings.Common_Edit), style: .regular, enabled: true, action: {
|
rightNavigationButton = ItemListNavigationButton(content: .text(presentationData.strings.Common_Edit), style: .regular, enabled: true, action: {
|
||||||
if let peer = peer as? TelegramGroup {
|
if let peer = peer as? TelegramGroup {
|
||||||
var text = ""
|
var text = ""
|
||||||
@ -1847,7 +1851,14 @@ public func groupInfoController(account: Account, peerId: PeerId) -> ViewControl
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
if peer is TelegramChannel {
|
||||||
|
rightNavigationButton = ItemListNavigationButton(content: .icon(.search), style: .regular, enabled: true, action: {
|
||||||
|
updateState { state in
|
||||||
|
return state.withUpdatedSearchingMembers(true)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var searchItem: ItemListControllerSearch?
|
var searchItem: ItemListControllerSearch?
|
||||||
|
@ -44,15 +44,13 @@ final class HashtagSearchController: TelegramController {
|
|||||||
let interaction = ChatListNodeInteraction(activateSearch: {
|
let interaction = ChatListNodeInteraction(activateSearch: {
|
||||||
}, peerSelected: { peer in
|
}, peerSelected: { peer in
|
||||||
}, togglePeerSelected: { _ in
|
}, togglePeerSelected: { _ in
|
||||||
}, messageSelected: { [weak self] message, _ in
|
}, messageSelected: { [weak self] peer, message, _ in
|
||||||
if let strongSelf = self {
|
if let strongSelf = self {
|
||||||
if let peer = message.peers[message.id.peerId] {
|
strongSelf.openMessageFromSearchDisposable.set((storedMessageFromSearchPeer(account: strongSelf.account, peer: peer) |> deliverOnMainQueue).start(next: { actualPeerId in
|
||||||
strongSelf.openMessageFromSearchDisposable.set((storedMessageFromSearchPeer(account: strongSelf.account, peer: peer) |> deliverOnMainQueue).start(completed: {
|
|
||||||
if let strongSelf = self {
|
if let strongSelf = self {
|
||||||
(strongSelf.navigationController as? NavigationController)?.pushViewController(ChatController(account: strongSelf.account, chatLocation: .peer(message.id.peerId), messageId: message.id))
|
(strongSelf.navigationController as? NavigationController)?.pushViewController(ChatController(account: strongSelf.account, chatLocation: .peer(actualPeerId), messageId: message.id.peerId == actualPeerId ? message.id : nil))
|
||||||
}
|
}
|
||||||
}))
|
}))
|
||||||
}
|
|
||||||
strongSelf.controllerNode.listNode.clearHighlightAnimated(true)
|
strongSelf.controllerNode.listNode.clearHighlightAnimated(true)
|
||||||
}
|
}
|
||||||
}, groupSelected: { _ in
|
}, groupSelected: { _ in
|
||||||
|
@ -38,6 +38,20 @@ class IconSwitchNode: ASDisplayNode {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
public var positiveContentColor = UIColor(rgb: 0x00ff00) {
|
||||||
|
didSet {
|
||||||
|
if self.isNodeLoaded {
|
||||||
|
(self.view as! IconSwitchNodeView).setPositiveContentColor(self.positiveContentColor)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public var negativeContentColor = UIColor(rgb: 0xff0000) {
|
||||||
|
didSet {
|
||||||
|
if self.isNodeLoaded {
|
||||||
|
(self.view as! IconSwitchNodeView).setNegativeContentColor(self.negativeContentColor)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private var _isOn: Bool = false
|
private var _isOn: Bool = false
|
||||||
public var isOn: Bool {
|
public var isOn: Bool {
|
||||||
@ -68,6 +82,8 @@ class IconSwitchNode: ASDisplayNode {
|
|||||||
(self.view as! UISwitch).tintColor = self.frameColor
|
(self.view as! UISwitch).tintColor = self.frameColor
|
||||||
//(self.view as! UISwitch).thumbTintColor = self.handleColor
|
//(self.view as! UISwitch).thumbTintColor = self.handleColor
|
||||||
(self.view as! UISwitch).onTintColor = self.contentColor
|
(self.view as! UISwitch).onTintColor = self.contentColor
|
||||||
|
(self.view as! IconSwitchNodeView).setNegativeContentColor(self.negativeContentColor)
|
||||||
|
(self.view as! IconSwitchNodeView).setPositiveContentColor(self.positiveContentColor)
|
||||||
|
|
||||||
(self.view as! UISwitch).setOn(self._isOn, animated: false)
|
(self.view as! UISwitch).setOn(self._isOn, animated: false)
|
||||||
|
|
||||||
|
@ -75,10 +75,25 @@ private protocol ItemListSwitchNodeImpl {
|
|||||||
var frameColor: UIColor { get set }
|
var frameColor: UIColor { get set }
|
||||||
var contentColor: UIColor { get set }
|
var contentColor: UIColor { get set }
|
||||||
var handleColor: UIColor { get set }
|
var handleColor: UIColor { get set }
|
||||||
|
var positiveContentColor: UIColor { get set }
|
||||||
|
var negativeContentColor: UIColor { get set }
|
||||||
}
|
}
|
||||||
|
|
||||||
extension SwitchNode: ItemListSwitchNodeImpl {
|
extension SwitchNode: ItemListSwitchNodeImpl {
|
||||||
|
var positiveContentColor: UIColor {
|
||||||
|
get {
|
||||||
|
return .white
|
||||||
|
} set(value) {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
var negativeContentColor: UIColor {
|
||||||
|
get {
|
||||||
|
return .white
|
||||||
|
} set(value) {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
extension IconSwitchNode: ItemListSwitchNodeImpl {
|
extension IconSwitchNode: ItemListSwitchNodeImpl {
|
||||||
@ -214,6 +229,8 @@ class ItemListSwitchItemNode: ListViewItemNode {
|
|||||||
strongSelf.switchNode.frameColor = item.theme.list.itemSwitchColors.frameColor
|
strongSelf.switchNode.frameColor = item.theme.list.itemSwitchColors.frameColor
|
||||||
strongSelf.switchNode.contentColor = item.theme.list.itemSwitchColors.contentColor
|
strongSelf.switchNode.contentColor = item.theme.list.itemSwitchColors.contentColor
|
||||||
strongSelf.switchNode.handleColor = item.theme.list.itemSwitchColors.handleColor
|
strongSelf.switchNode.handleColor = item.theme.list.itemSwitchColors.handleColor
|
||||||
|
strongSelf.switchNode.positiveContentColor = item.theme.list.itemSwitchColors.positiveColor
|
||||||
|
strongSelf.switchNode.negativeContentColor = item.theme.list.itemSwitchColors.negativeColor
|
||||||
}
|
}
|
||||||
|
|
||||||
let _ = titleApply()
|
let _ = titleApply()
|
||||||
|
3
TelegramUI/MergedItemListItem.swift
Normal file
3
TelegramUI/MergedItemListItem.swift
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
import Foundation
|
||||||
|
|
||||||
|
|
@ -219,7 +219,6 @@ enum PresentationResourceKey: Int32 {
|
|||||||
case groupInfoAdminsIcon
|
case groupInfoAdminsIcon
|
||||||
case groupInfoPermissionsIcon
|
case groupInfoPermissionsIcon
|
||||||
case groupInfoMembersIcon
|
case groupInfoMembersIcon
|
||||||
case groupInfoBannedIcon
|
|
||||||
|
|
||||||
case emptyChatListCheckIcon
|
case emptyChatListCheckIcon
|
||||||
}
|
}
|
||||||
|
@ -953,12 +953,6 @@ struct PresentationResourcesChat {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
static func groupInfoBannedIcon(_ theme: PresentationTheme) -> UIImage? {
|
|
||||||
return theme.image(PresentationResourceKey.groupInfoBannedIcon.rawValue, { _ in
|
|
||||||
return UIImage(bundleImageName: "Chat/Info/GroupBannedIcon")?.precomposed()
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
static func emptyChatListCheckIcon(_ theme: PresentationTheme) -> UIImage? {
|
static func emptyChatListCheckIcon(_ theme: PresentationTheme) -> UIImage? {
|
||||||
return theme.image(PresentationResourceKey.emptyChatListCheckIcon.rawValue, { _ in
|
return theme.image(PresentationResourceKey.emptyChatListCheckIcon.rawValue, { _ in
|
||||||
return generateTintedImage(image: UIImage(bundleImageName: "Chat/Empty Chat/ListCheckIcon"), color: theme.chat.serviceMessage.components.withDefaultWallpaper.primaryText)
|
return generateTintedImage(image: UIImage(bundleImageName: "Chat/Empty Chat/ListCheckIcon"), color: theme.chat.serviceMessage.components.withDefaultWallpaper.primaryText)
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -210,11 +210,15 @@ public final class PresentationThemeSwitch {
|
|||||||
public let frameColor: UIColor
|
public let frameColor: UIColor
|
||||||
public let handleColor: UIColor
|
public let handleColor: UIColor
|
||||||
public let contentColor: UIColor
|
public let contentColor: UIColor
|
||||||
|
public let positiveColor: UIColor
|
||||||
|
public let negativeColor: UIColor
|
||||||
|
|
||||||
public init(frameColor: UIColor, handleColor: UIColor, contentColor: UIColor) {
|
public init(frameColor: UIColor, handleColor: UIColor, contentColor: UIColor, positiveColor: UIColor, negativeColor: UIColor) {
|
||||||
self.frameColor = frameColor
|
self.frameColor = frameColor
|
||||||
self.handleColor = handleColor
|
self.handleColor = handleColor
|
||||||
self.contentColor = contentColor
|
self.contentColor = contentColor
|
||||||
|
self.positiveColor = positiveColor
|
||||||
|
self.negativeColor = negativeColor
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Binary file not shown.
@ -3,13 +3,17 @@ import Postbox
|
|||||||
import TelegramCore
|
import TelegramCore
|
||||||
import SwiftSignalKit
|
import SwiftSignalKit
|
||||||
|
|
||||||
func storedMessageFromSearchPeer(account: Account, peer: Peer) -> Signal<Void, NoError> {
|
func storedMessageFromSearchPeer(account: Account, peer: Peer) -> Signal<PeerId, NoError> {
|
||||||
return account.postbox.transaction { transaction -> Void in
|
return account.postbox.transaction { transaction -> PeerId in
|
||||||
if transaction.getPeer(peer.id) == nil {
|
if transaction.getPeer(peer.id) == nil {
|
||||||
updatePeers(transaction: transaction, peers: [peer], update: { previousPeer, updatedPeer in
|
updatePeers(transaction: transaction, peers: [peer], update: { previousPeer, updatedPeer in
|
||||||
return updatedPeer
|
return updatedPeer
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
if let group = transaction.getPeer(peer.id) as? TelegramGroup, let migrationReference = group.migrationReference {
|
||||||
|
return migrationReference.peerId
|
||||||
|
}
|
||||||
|
return peer.id
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -665,6 +665,8 @@ private func userInfoEntries(account: Account, presentationData: PresentationDat
|
|||||||
} else {
|
} else {
|
||||||
notificationsLabel = presentationData.strings.UserInfo_NotificationsDisabled
|
notificationsLabel = presentationData.strings.UserInfo_NotificationsDisabled
|
||||||
}
|
}
|
||||||
|
} else if case .default = notificationSettings.messageSound {
|
||||||
|
notificationsLabel = presentationData.strings.UserInfo_NotificationsEnabled
|
||||||
} else {
|
} else {
|
||||||
notificationsLabel = localizedPeerNotificationSoundString(strings: presentationData.strings, sound: notificationSettings.messageSound, default: globalNotificationSettings.effective.channels.sound)
|
notificationsLabel = localizedPeerNotificationSoundString(strings: presentationData.strings, sound: notificationSettings.messageSound, default: globalNotificationSettings.effective.channels.sound)
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user