mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-16 11:20:18 +00:00
UI fixes
This commit is contained in:
parent
d544c2dd06
commit
a78493367b
@ -1220,6 +1220,10 @@ public final class ChatController: TelegramController, KeyShortcutResponder, Gal
|
||||
if strongSelf.peerView === peerView {
|
||||
return
|
||||
}
|
||||
var upgradedToPeerId: PeerId?
|
||||
if let previous = strongSelf.peerView, let group = previous.peers[previous.peerId] as? TelegramGroup, group.migrationReference == nil, let updatedGroup = peerView.peers[peerView.peerId] as? TelegramGroup, let migrationReference = updatedGroup.migrationReference {
|
||||
upgradedToPeerId = migrationReference.peerId
|
||||
}
|
||||
var wasGroupChannel: Bool?
|
||||
if let previousPeerView = strongSelf.peerView, let info = (previousPeerView.peers[previousPeerView.peerId] as? TelegramChannel)?.info {
|
||||
if case .group = info {
|
||||
@ -1307,6 +1311,15 @@ public final class ChatController: TelegramController, KeyShortcutResponder, Gal
|
||||
strongSelf.didSetChatLocationInfoReady = true
|
||||
strongSelf._chatLocationInfoReady.set(.single(true))
|
||||
}
|
||||
if let upgradedToPeerId = upgradedToPeerId {
|
||||
if let navigationController = strongSelf.navigationController as? NavigationController {
|
||||
var viewControllers = navigationController.viewControllers
|
||||
if let index = viewControllers.index(where: { $0 === strongSelf }) {
|
||||
viewControllers[index] = ChatController(account: strongSelf.account, chatLocation: .peer(upgradedToPeerId))
|
||||
navigationController.setViewControllers(viewControllers, animated: false)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}))
|
||||
}
|
||||
@ -4000,17 +4013,17 @@ public final class ChatController: TelegramController, KeyShortcutResponder, Gal
|
||||
legacyController.bind(controller: controller)
|
||||
legacyController.deferScreenEdgeGestures = [.top]
|
||||
|
||||
configureLegacyAssetPicker(controller, account: strongSelf.account, peer: peer, presentWebSearch: { [weak self] in
|
||||
configureLegacyAssetPicker(controller, account: strongSelf.account, peer: peer, presentWebSearch: { [weak self, weak legacyController] in
|
||||
if let strongSelf = self {
|
||||
let controller = WebSearchController(account: strongSelf.account, peer: peer, configuration: searchBotsConfiguration, mode: .media(completion: { [weak self, weak legacyController] results, selectionState, editingState in
|
||||
let controller = WebSearchController(account: strongSelf.account, peer: peer, configuration: searchBotsConfiguration, mode: .media(completion: { results, selectionState, editingState in
|
||||
if let legacyController = legacyController {
|
||||
legacyController.dismiss()
|
||||
}
|
||||
legacyEnqueueWebSearchMessages(selectionState, editingState, enqueueChatContextResult: { [weak self] result in
|
||||
legacyEnqueueWebSearchMessages(selectionState, editingState, enqueueChatContextResult: { result in
|
||||
if let strongSelf = self {
|
||||
strongSelf.enqueueChatContextResult(results, result, hideVia: true)
|
||||
}
|
||||
}, enqueueMediaMessages: { [weak self] signals in
|
||||
}, enqueueMediaMessages: { signals in
|
||||
if let strongSelf = self {
|
||||
strongSelf.enqueueMediaMessages(signals: signals)
|
||||
}
|
||||
|
||||
@ -362,9 +362,9 @@ public class ChatListController: TelegramController, KeyShortcutResponder, UIVie
|
||||
canStop = true
|
||||
deleteTitle = strongSelf.presentationData.strings.ChatList_DeleteChat
|
||||
} else if let _ = chatPeer as? TelegramSecretChat {
|
||||
deleteTitle = strongSelf.presentationData.strings.ChatList_DeleteSecretChat
|
||||
deleteTitle = strongSelf.presentationData.strings.ChatList_DeleteChat
|
||||
}
|
||||
items.append(DeleteChatPeerActionSheetItem(account: strongSelf.account, peer: mainPeer, strings: strongSelf.presentationData.strings))
|
||||
items.append(DeleteChatPeerActionSheetItem(account: strongSelf.account, peer: mainPeer, chatPeer: chatPeer, strings: strongSelf.presentationData.strings))
|
||||
if canClear {
|
||||
items.append(ActionSheetButtonItem(title: strongSelf.presentationData.strings.DialogList_ClearHistoryConfirmation, color: .accent, action: { [weak actionSheet] in
|
||||
actionSheet?.dismissAnimated()
|
||||
@ -1063,13 +1063,25 @@ public class ChatListController: TelegramController, KeyShortcutResponder, UIVie
|
||||
self.chatListDisplayNode.chatListNode.setCurrentRemovingPeerId(nil)
|
||||
let statusText: String
|
||||
if let channel = chatPeer as? TelegramChannel {
|
||||
if deleteGloballyIfPossible {
|
||||
if case .broadcast = channel.info {
|
||||
statusText = self.presentationData.strings.Undo_DeletedChannel
|
||||
} else {
|
||||
statusText = self.presentationData.strings.Undo_DeletedGroup
|
||||
}
|
||||
} else {
|
||||
if case .broadcast = channel.info {
|
||||
statusText = self.presentationData.strings.Undo_LeftChannel
|
||||
} else {
|
||||
statusText = self.presentationData.strings.Undo_LeftGroup
|
||||
}
|
||||
}
|
||||
} else if let _ = chatPeer as? TelegramGroup {
|
||||
if deleteGloballyIfPossible {
|
||||
statusText = self.presentationData.strings.Undo_DeletedGroup
|
||||
} else {
|
||||
statusText = self.presentationData.strings.Undo_LeftGroup
|
||||
}
|
||||
} else if let _ = chatPeer as? TelegramSecretChat {
|
||||
statusText = self.presentationData.strings.Undo_SecretChatDeleted
|
||||
} else {
|
||||
|
||||
@ -575,8 +575,6 @@ struct ChatRecentActionsEntry: Comparable, Identifiable {
|
||||
text += "\n"
|
||||
}
|
||||
|
||||
let prevFlags = prevBanInfo?.rights.flags ?? []
|
||||
|
||||
let order: [(TelegramChatBannedRightsFlags, String)] = [
|
||||
(.banReadMessages, self.presentationData.strings.Channel_AdminLog_BanReadMessages),
|
||||
(.banSendMessages, self.presentationData.strings.Channel_AdminLog_BanSendMessages),
|
||||
@ -584,6 +582,10 @@ struct ChatRecentActionsEntry: Comparable, Identifiable {
|
||||
(.banSendStickers, self.presentationData.strings.Channel_AdminLog_BanSendStickers),
|
||||
(.banSendGifs, self.presentationData.strings.Channel_AdminLog_BanSendGifs),
|
||||
(.banEmbedLinks, self.presentationData.strings.Channel_AdminLog_BanEmbedLinks),
|
||||
(.banSendPolls, self.presentationData.strings.Channel_AdminLog_SendPolls),
|
||||
(.banAddMembers, self.presentationData.strings.Channel_AdminLog_AddMembers),
|
||||
(.banPinMessages, self.presentationData.strings.Channel_AdminLog_PinMessages),
|
||||
(.banChangeInfo, self.presentationData.strings.Channel_AdminLog_ChangeInfo)
|
||||
]
|
||||
|
||||
for (flag, string) in order {
|
||||
|
||||
@ -6,16 +6,18 @@ import TelegramCore
|
||||
final class DeleteChatPeerActionSheetItem: ActionSheetItem {
|
||||
let account: Account
|
||||
let peer: Peer
|
||||
let chatPeer: Peer
|
||||
let strings: PresentationStrings
|
||||
|
||||
init(account: Account, peer: Peer, strings: PresentationStrings) {
|
||||
init(account: Account, peer: Peer, chatPeer: Peer, strings: PresentationStrings) {
|
||||
self.account = account
|
||||
self.peer = peer
|
||||
self.chatPeer = chatPeer
|
||||
self.strings = strings
|
||||
}
|
||||
|
||||
func node(theme: ActionSheetControllerTheme) -> ActionSheetItemNode {
|
||||
return DeleteChatPeerActionSheetItemNode(theme: theme, strings: self.strings, account: self.account, peer: self.peer)
|
||||
return DeleteChatPeerActionSheetItemNode(theme: theme, strings: self.strings, account: self.account, peer: self.peer, chatPeer: self.chatPeer)
|
||||
}
|
||||
|
||||
func updateNode(_ node: ActionSheetItemNode) {
|
||||
@ -31,7 +33,7 @@ private final class DeleteChatPeerActionSheetItemNode: ActionSheetItemNode {
|
||||
private let avatarNode: AvatarNode
|
||||
private let textNode: ImmediateTextNode
|
||||
|
||||
init(theme: ActionSheetControllerTheme, strings: PresentationStrings, account: Account, peer: Peer) {
|
||||
init(theme: ActionSheetControllerTheme, strings: PresentationStrings, account: Account, peer: Peer, chatPeer: Peer) {
|
||||
self.theme = theme
|
||||
self.strings = strings
|
||||
|
||||
@ -49,9 +51,9 @@ private final class DeleteChatPeerActionSheetItemNode: ActionSheetItemNode {
|
||||
self.avatarNode.setPeer(account: account, peer: peer)
|
||||
|
||||
let text: (String, [(Int, NSRange)])
|
||||
if peer is TelegramGroup || peer is TelegramChannel {
|
||||
if chatPeer is TelegramGroup || chatPeer is TelegramChannel {
|
||||
text = strings.ChatList_LeaveGroupConfirmation(peer.displayTitle)
|
||||
} else if peer is TelegramSecretChat {
|
||||
} else if chatPeer is TelegramSecretChat {
|
||||
text = strings.ChatList_DeleteSecretChatConfirmation(peer.displayTitle)
|
||||
} else {
|
||||
text = strings.ChatList_DeleteChatConfirmation(peer.displayTitle)
|
||||
|
||||
@ -1342,7 +1342,7 @@ func mediaGridMessagePhoto(account: Account, photoReference: ImageMediaReference
|
||||
if let fullSizeData = fullSizeData {
|
||||
if fullSizeComplete {
|
||||
let options = NSMutableDictionary()
|
||||
options.setValue(max(fittedSize.width * context.scale, fittedSize.height * context.scale) as NSNumber, forKey: kCGImageSourceThumbnailMaxPixelSize as String)
|
||||
options.setValue(400 as NSNumber, forKey: kCGImageSourceThumbnailMaxPixelSize as String)
|
||||
options.setValue(true as NSNumber, forKey: kCGImageSourceCreateThumbnailFromImageAlways as String)
|
||||
if let imageSource = CGImageSourceCreateWithData(fullSizeData as CFData, nil), let image = CGImageSourceCreateThumbnailAtIndex(imageSource, 0, options as CFDictionary) {
|
||||
imageOrientation = imageOrientationFromSource(imageSource)
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Binary file not shown.
@ -149,7 +149,7 @@ public func transformOutgoingMessageMedia(postbox: Postbox, network: Network, me
|
||||
|> mapToSignal { data -> Signal<AnyMediaReference?, NoError> in
|
||||
if data.complete {
|
||||
if let smallest = smallestImageRepresentation(image.representations), smallest.dimensions.width > 100.0 || smallest.dimensions.height > 100.0 {
|
||||
let smallestSize = smallest.dimensions.fitted(CGSize(width: 90.0, height: 90.0))
|
||||
let smallestSize = smallest.dimensions.fitted(CGSize(width: 320.0, height: 320.0))
|
||||
if let fullImage = UIImage(contentsOfFile: data.path), let smallestImage = generateScaledImage(image: fullImage, size: smallestSize, scale: 1.0), let smallestData = compressImageToJPEG(smallestImage, quality: 0.7) {
|
||||
var representations = image.representations
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user