mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-16 03:09:56 +00:00
Various UI fixes
This commit is contained in:
parent
c5136bb97e
commit
edafa2e961
@ -4724,3 +4724,6 @@ Any member of this group will be able to see messages in the channel.";
|
||||
"Theme.UsersCount_0" = "%@ people are using this theme";
|
||||
|
||||
"Conversation.SendMessageErrorTooMuchScheduled" = "Sorry, you can not schedule more than 100 messages.";
|
||||
|
||||
"Channel.EditAdmin.PermissionDeleteMessagesOfOthers" = "Delete Messages of Others";
|
||||
"Channel.AdminLog.CanDeleteMessagesOfOthers" = "Delete Messages of Others";
|
||||
|
||||
@ -159,7 +159,6 @@ private func checkIsPreviewingView(_ view: UIView) -> Bool {
|
||||
private func applyThemeToPreviewingView(_ view: UIView, accentColor: UIColor, darkBlur: Bool) {
|
||||
if let previewingActionGroupClass = previewingActionGroupClass, view.isKind(of: previewingActionGroupClass) {
|
||||
view.tintColor = accentColor
|
||||
testZoomBlurEffect((view.superview?.superview?.subviews[1] as? UIVisualEffectView)?.effect)
|
||||
if darkBlur {
|
||||
applyThemeToPreviewingEffectView(view)
|
||||
}
|
||||
|
||||
@ -461,7 +461,7 @@ private func stringForRight(strings: PresentationStrings, right: TelegramChatAdm
|
||||
} else if right.contains(.canEditMessages) {
|
||||
return strings.Channel_EditAdmin_PermissionEditMessages
|
||||
} else if right.contains(.canDeleteMessages) {
|
||||
return strings.Channel_EditAdmin_PermissionDeleteMessages
|
||||
return isGroup ? strings.Channel_EditAdmin_PermissionDeleteMessages : strings.Channel_EditAdmin_PermissionDeleteMessagesOfOthers
|
||||
} else if right.contains(.canBanUsers) {
|
||||
return strings.Channel_EditAdmin_PermissionBanUsers
|
||||
} else if right.contains(.canInviteUsers) {
|
||||
|
||||
@ -380,7 +380,7 @@ private func channelAdminsControllerEntries(presentationData: PresentationData,
|
||||
switch participant.participant {
|
||||
case .creator:
|
||||
canEdit = false
|
||||
canOpen = false
|
||||
canOpen = isGroup && peer.flags.contains(.isCreator)
|
||||
case let .member(id, _, adminInfo, _, _):
|
||||
if id == accountPeerId {
|
||||
canEdit = false
|
||||
|
||||
@ -718,7 +718,7 @@ public final class MessageHistoryView {
|
||||
for entry in state.entries {
|
||||
if mutableView.namespaces.contains(entry.message.id.namespace) {
|
||||
let read: Bool
|
||||
if !entry.message.flags.intersection(.IsIncomingMask).isEmpty {
|
||||
if entry.message.flags.contains(.Incoming) {
|
||||
read = false
|
||||
} else if let readState = states[entry.message.id.peerId] {
|
||||
read = readState.isOutgoingMessageIndexRead(entry.message.index)
|
||||
|
||||
@ -335,9 +335,9 @@ func generateThemeName(accentColor: UIColor) -> String {
|
||||
|
||||
if let color = nearest?.color, let colorName = colors[color]?.capitalized {
|
||||
if arc4random() % 2 == 0 {
|
||||
return "\(adjectives[Int(arc4random()) % adjectives.count].capitalized) \(colorName)"
|
||||
return "\((adjectives.randomElement() ?? "").capitalized) \(colorName)"
|
||||
} else {
|
||||
return "\(colorName) \(subjectives[Int(arc4random()) % subjectives.count].capitalized)"
|
||||
return "\(colorName) \((subjectives.randomElement() ?? "").capitalized)"
|
||||
}
|
||||
} else {
|
||||
return ""
|
||||
|
||||
@ -83,6 +83,8 @@ final class ThemePreviewControllerNode: ASDisplayNode, UIScrollViewDelegate {
|
||||
self.chatListBackgroundNode = ASDisplayNode()
|
||||
|
||||
self.chatContainerNode = ASDisplayNode()
|
||||
self.chatContainerNode.clipsToBounds = true
|
||||
|
||||
self.instantChatBackgroundNode = WallpaperBackgroundNode()
|
||||
self.instantChatBackgroundNode.displaysAsynchronously = false
|
||||
self.instantChatBackgroundNode.image = chatControllerBackgroundImage(theme: previewTheme, wallpaper: previewTheme.chat.defaultWallpaper, mediaBox: context.sharedContext.accountManager.mediaBox, knockoutMode: context.sharedContext.immediateExperimentalUISettings.knockoutWallpaper)
|
||||
@ -94,7 +96,6 @@ final class ThemePreviewControllerNode: ASDisplayNode, UIScrollViewDelegate {
|
||||
self.remoteChatBackgroundNode.view.contentMode = .scaleAspectFill
|
||||
|
||||
self.blurredNode = BlurredImageNode()
|
||||
self.blurredNode.clipsToBounds = true
|
||||
self.blurredNode.blurView.contentMode = .scaleAspectFill
|
||||
|
||||
self.toolbarNode = WallpaperGalleryToolbarNode(theme: self.previewTheme, strings: self.presentationData.strings)
|
||||
|
||||
@ -519,6 +519,10 @@ public func updatedPresentationData(accountManager: AccountManager, applicationI
|
||||
switch effectiveChatWallpaper {
|
||||
case .builtin, .color:
|
||||
effectiveChatWallpaper = themeValue.chat.defaultWallpaper
|
||||
case let .file(file):
|
||||
if file.isPattern {
|
||||
effectiveChatWallpaper = themeValue.chat.defaultWallpaper
|
||||
}
|
||||
default:
|
||||
break
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -30,7 +30,7 @@ func canEditMessage(context: AccountContext, limitsConfiguration: LimitsConfigur
|
||||
if let peer = message.peers[message.id.peerId], let channel = peer as? TelegramChannel {
|
||||
switch channel.info {
|
||||
case .broadcast:
|
||||
if channel.hasPermission(.editAllMessages) {
|
||||
if channel.hasPermission(.editAllMessages) || !message.flags.contains(.Incoming) {
|
||||
hasEditRights = true
|
||||
}
|
||||
default:
|
||||
@ -47,7 +47,7 @@ func canEditMessage(context: AccountContext, limitsConfiguration: LimitsConfigur
|
||||
if let peer = peer as? TelegramChannel {
|
||||
switch peer.info {
|
||||
case .broadcast:
|
||||
if peer.hasPermission(.editAllMessages) {
|
||||
if peer.hasPermission(.editAllMessages) || !message.flags.contains(.Incoming) {
|
||||
hasEditRights = true
|
||||
}
|
||||
case .group:
|
||||
|
||||
@ -31,6 +31,7 @@ struct ChatMessageItemBubbleLayoutConstants {
|
||||
let minimumSize: CGSize
|
||||
let contentInsets: UIEdgeInsets
|
||||
let borderInset: CGFloat
|
||||
let strokeInsets: UIEdgeInsets
|
||||
}
|
||||
|
||||
struct ChatMessageItemTextLayoutConstants {
|
||||
@ -81,7 +82,7 @@ struct ChatMessageItemLayoutConstants {
|
||||
self.avatarDiameter = 37.0
|
||||
self.timestampHeaderHeight = 34.0
|
||||
|
||||
self.bubble = ChatMessageItemBubbleLayoutConstants(edgeInset: 4.0, defaultSpacing: 2.0 + UIScreenPixel, mergedSpacing: 1.0, maximumWidthFill: ChatMessageItemWidthFill(compactInset: 36.0, compactWidthBoundary: 500.0, freeMaximumFillFactor: 0.85), minimumSize: CGSize(width: 40.0, height: 35.0), contentInsets: UIEdgeInsets(top: 0.0, left: 6.0, bottom: 0.0, right: 0.0), borderInset: UIScreenPixel)
|
||||
self.bubble = ChatMessageItemBubbleLayoutConstants(edgeInset: 4.0, defaultSpacing: 2.0 + UIScreenPixel, mergedSpacing: 1.0, maximumWidthFill: ChatMessageItemWidthFill(compactInset: 36.0, compactWidthBoundary: 500.0, freeMaximumFillFactor: 0.85), minimumSize: CGSize(width: 40.0, height: 35.0), contentInsets: UIEdgeInsets(top: 0.0, left: 6.0, bottom: 0.0, right: 0.0), borderInset: UIScreenPixel, strokeInsets: UIEdgeInsets(top: 1.0 - UIScreenPixel, left: 1.0 - UIScreenPixel, bottom: 1.0 - UIScreenPixel, right: 1.0 - UIScreenPixel))
|
||||
self.text = ChatMessageItemTextLayoutConstants(bubbleInsets: UIEdgeInsets(top: 6.0 + UIScreenPixel, left: 12.0, bottom: 6.0 - UIScreenPixel, right: 12.0))
|
||||
self.image = ChatMessageItemImageLayoutConstants(bubbleInsets: UIEdgeInsets(top: 1.0 + UIScreenPixel, left: 1.0 + UIScreenPixel, bottom: 1.0 + UIScreenPixel, right: 1.0 + UIScreenPixel), statusInsets: UIEdgeInsets(top: 0.0, left: 0.0, bottom: 6.0, right: 6.0), defaultCornerRadius: 17.0, mergedCornerRadius: 5.0, contentMergedCornerRadius: 5.0, maxDimensions: CGSize(width: 300.0, height: 300.0), minDimensions: CGSize(width: 170.0, height: 74.0))
|
||||
self.video = ChatMessageItemVideoLayoutConstants(maxHorizontalHeight: 250.0, maxVerticalHeight: 360.0)
|
||||
|
||||
@ -6,6 +6,7 @@ import SwiftSignalKit
|
||||
import Postbox
|
||||
import TelegramCore
|
||||
import TelegramUIPreferences
|
||||
import TelegramPresentationData
|
||||
import AccountContext
|
||||
import GridMessageSelectionNode
|
||||
|
||||
@ -115,7 +116,17 @@ class ChatMessageMediaBubbleContentNode: ChatMessageBubbleContentNode {
|
||||
switch preparePosition {
|
||||
case .linear:
|
||||
if case .color = item.presentationData.theme.wallpaper {
|
||||
bubbleInsets = UIEdgeInsets()
|
||||
let colors: PresentationThemeBubbleColorComponents
|
||||
if item.message.effectivelyIncoming(item.context.account.peerId) {
|
||||
colors = item.presentationData.theme.theme.chat.message.incoming.bubble.withoutWallpaper
|
||||
} else {
|
||||
colors = item.presentationData.theme.theme.chat.message.outgoing.bubble.withoutWallpaper
|
||||
}
|
||||
if colors.fill == colors.stroke {
|
||||
bubbleInsets = UIEdgeInsets()
|
||||
} else {
|
||||
bubbleInsets = layoutConstants.bubble.strokeInsets
|
||||
}
|
||||
} else {
|
||||
bubbleInsets = layoutConstants.image.bubbleInsets
|
||||
}
|
||||
|
||||
@ -670,7 +670,7 @@ struct ChatRecentActionsEntry: Comparable, Identifiable {
|
||||
order = [
|
||||
(.canChangeInfo, self.presentationData.strings.Channel_AdminLog_CanChangeInfo),
|
||||
(.canPostMessages, self.presentationData.strings.Channel_AdminLog_CanSendMessages),
|
||||
(.canDeleteMessages, self.presentationData.strings.Channel_AdminLog_CanDeleteMessages),
|
||||
(.canDeleteMessages, self.presentationData.strings.Channel_AdminLog_CanDeleteMessagesOfOthers),
|
||||
(.canEditMessages, self.presentationData.strings.Channel_AdminLog_CanEditMessages),
|
||||
(.canInviteUsers, self.presentationData.strings.Channel_AdminLog_CanInviteUsers),
|
||||
(.canPinMessages, self.presentationData.strings.Channel_AdminLog_CanPinMessages),
|
||||
|
||||
@ -273,7 +273,7 @@ func openResolvedUrlImpl(_ resolvedUrl: ResolvedUrl, context: AccountContext, ur
|
||||
}
|
||||
}))
|
||||
} else {
|
||||
subscriber.putError(.generic)
|
||||
subscriber.putError(.unsupported)
|
||||
}
|
||||
|
||||
return disposables
|
||||
|
||||
Binary file not shown.
@ -8,6 +8,7 @@ import Postbox
|
||||
import TelegramPresentationData
|
||||
import RadialStatusNode
|
||||
import PhotoResources
|
||||
import StickerResources
|
||||
|
||||
final class VerticalListContextResultsChatInputPanelItem: ListViewItem {
|
||||
fileprivate let account: Account
|
||||
@ -165,7 +166,6 @@ final class VerticalListContextResultsChatInputPanelItemNode: ListViewItemNode {
|
||||
var textString: NSAttributedString?
|
||||
var iconText: NSAttributedString?
|
||||
|
||||
var iconImageRepresentation: TelegramMediaImageRepresentation?
|
||||
var updateIconImageSignal: Signal<(TransformImageArguments) -> DrawingContext?, NoError>?
|
||||
var updatedStatusSignal: Signal<MediaResourceStatus, NoError>?
|
||||
|
||||
@ -178,8 +178,9 @@ final class VerticalListContextResultsChatInputPanelItemNode: ListViewItemNode {
|
||||
}
|
||||
|
||||
var imageResource: TelegramMediaResource?
|
||||
var stickerFile: TelegramMediaFile?
|
||||
switch item.result {
|
||||
case let .externalReference(_, _, _, title, _, url, content, thumbnail, _):
|
||||
case let .externalReference(_, _, _, _, _, url, content, thumbnail, _):
|
||||
if let thumbnail = thumbnail {
|
||||
imageResource = thumbnail.resource
|
||||
}
|
||||
@ -198,11 +199,16 @@ final class VerticalListContextResultsChatInputPanelItemNode: ListViewItemNode {
|
||||
iconText = NSAttributedString(string: host.substring(to: host.index(after: host.startIndex)).uppercased(), font: iconFont, textColor: UIColor.white)
|
||||
}
|
||||
}
|
||||
case let .internalReference(_, _, _, title, _, image, file, _):
|
||||
case let .internalReference(_, _, _, _, _, image, file, _):
|
||||
if let image = image {
|
||||
imageResource = imageRepresentationLargerThan(image.representations, size: CGSize(width: 200.0, height: 200.0))?.resource
|
||||
} else if let file = file {
|
||||
imageResource = smallestImageRepresentation(file.previewRepresentations)?.resource
|
||||
if file.isSticker {
|
||||
stickerFile = file
|
||||
imageResource = file.resource
|
||||
} else {
|
||||
imageResource = smallestImageRepresentation(file.previewRepresentations)?.resource
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -215,9 +221,15 @@ final class VerticalListContextResultsChatInputPanelItemNode: ListViewItemNode {
|
||||
|
||||
var iconImageApply: (() -> Void)?
|
||||
if let imageResource = imageResource {
|
||||
let iconSize = CGSize(width: 55.0, height: 55.0)
|
||||
let boundingSize = CGSize(width: 55.0, height: 55.0)
|
||||
let iconSize: CGSize
|
||||
if let stickerFile = stickerFile, let dimensions = stickerFile.dimensions {
|
||||
iconSize = dimensions.fitted(boundingSize)
|
||||
} else {
|
||||
iconSize = boundingSize
|
||||
}
|
||||
let imageCorners = ImageCorners(topLeft: .Corner(2.0), topRight: .Corner(2.0), bottomLeft: .Corner(2.0), bottomRight: .Corner(2.0))
|
||||
let arguments = TransformImageArguments(corners: imageCorners, imageSize: iconSize, boundingSize: iconSize, intrinsicInsets: UIEdgeInsets())
|
||||
let arguments = TransformImageArguments(corners: imageCorners, imageSize: iconSize, boundingSize: boundingSize, intrinsicInsets: UIEdgeInsets())
|
||||
iconImageApply = iconImageLayout(arguments)
|
||||
|
||||
updatedStatusSignal = item.account.postbox.mediaBox.resourceStatus(imageResource)
|
||||
@ -235,9 +247,13 @@ final class VerticalListContextResultsChatInputPanelItemNode: ListViewItemNode {
|
||||
|
||||
if updatedIconImageResource {
|
||||
if let imageResource = imageResource {
|
||||
let tmpRepresentation = TelegramMediaImageRepresentation(dimensions: CGSize(width: 55.0, height: 55.0), resource: imageResource)
|
||||
let tmpImage = TelegramMediaImage(imageId: MediaId(namespace: 0, id: 0), representations: [tmpRepresentation], immediateThumbnailData: nil, reference: nil, partialReference: nil)
|
||||
updateIconImageSignal = chatWebpageSnippetPhoto(account: item.account, photoReference: .standalone(media: tmpImage))
|
||||
if let stickerFile = stickerFile {
|
||||
updateIconImageSignal = chatMessageSticker(account: item.account, file: stickerFile, small: false, fetched: true)
|
||||
} else {
|
||||
let tmpRepresentation = TelegramMediaImageRepresentation(dimensions: CGSize(width: 55.0, height: 55.0), resource: imageResource)
|
||||
let tmpImage = TelegramMediaImage(imageId: MediaId(namespace: 0, id: 0), representations: [tmpRepresentation], immediateThumbnailData: nil, reference: nil, partialReference: nil)
|
||||
updateIconImageSignal = chatWebpageSnippetPhoto(account: item.account, photoReference: .standalone(media: tmpImage))
|
||||
}
|
||||
} else {
|
||||
updateIconImageSignal = .complete()
|
||||
}
|
||||
@ -398,6 +414,6 @@ final class VerticalListContextResultsChatInputPanelItemNode: ListViewItemNode {
|
||||
guard let item = self.item else {
|
||||
return
|
||||
}
|
||||
item.resultSelected(item.result, self, self.bounds)
|
||||
let _ = item.resultSelected(item.result, self, self.bounds)
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user