mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-06-16 05:55:20 +00:00
Merge commit 'c2f53ea3a4b8da54ff0431b80fe062cfa252880e'
This commit is contained in:
commit
9e7107ef4e
@ -17,7 +17,7 @@
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>XPC!</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>5.12</string>
|
||||
<string>5.11.1</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>${BUILD_NUMBER}</string>
|
||||
<key>NSExtension</key>
|
||||
|
@ -17,7 +17,7 @@
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>XPC!</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>5.12</string>
|
||||
<string>5.11.1</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>${BUILD_NUMBER}</string>
|
||||
<key>NSExtension</key>
|
||||
|
@ -17,7 +17,7 @@
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>XPC!</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>5.12</string>
|
||||
<string>5.11.1</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>${BUILD_NUMBER}</string>
|
||||
<key>NSExtension</key>
|
||||
|
@ -17,7 +17,7 @@
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>XPC!</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>5.12</string>
|
||||
<string>5.11.1</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>${BUILD_NUMBER}</string>
|
||||
<key>NSExtension</key>
|
||||
|
@ -185,7 +185,7 @@
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>APPL</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>5.12</string>
|
||||
<string>5.11.1</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleURLTypes</key>
|
||||
|
@ -4744,8 +4744,11 @@ Any member of this group will be able to see messages in the channel.";
|
||||
|
||||
"ContactList.Context.SendMessage" = "Send Message";
|
||||
"ContactList.Context.StartSecretChat" = "Start Secret Chat";
|
||||
"ContactList.Context.Call" = "Cal";
|
||||
"ContactList.Context.Call" = "Call";
|
||||
|
||||
"Theme.Context.Apply" = "Apply";
|
||||
|
||||
"Settings.Context.Logout" = "Logout";
|
||||
|
||||
"Channel.EditAdmin.PermissionDeleteMessagesOfOthers" = "Delete Messages of Others";
|
||||
"Channel.AdminLog.CanDeleteMessagesOfOthers" = "Delete Messages of Others";
|
||||
|
@ -17,7 +17,7 @@
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>APPL</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>5.12</string>
|
||||
<string>5.11.1</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>${BUILD_NUMBER}</string>
|
||||
<key>UIDeviceFamily</key>
|
||||
|
@ -17,7 +17,7 @@
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>XPC!</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>5.12</string>
|
||||
<string>5.11.1</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>${BUILD_NUMBER}</string>
|
||||
<key>NSExtension</key>
|
||||
|
@ -17,7 +17,7 @@
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>XPC!</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>5.12</string>
|
||||
<string>5.11.1</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>${BUILD_NUMBER}</string>
|
||||
<key>NSExtension</key>
|
||||
|
@ -155,7 +155,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)
|
||||
}
|
||||
|
@ -415,9 +415,8 @@ final class ChatItemGalleryFooterContentNode: GalleryFooterContentNode, UIScroll
|
||||
func setMessage(_ message: Message) {
|
||||
self.currentMessage = message
|
||||
|
||||
self.actionButton.isHidden = message.containsSecretMedia || Namespaces.Message.allScheduled.contains(message.id.namespace)
|
||||
|
||||
let canDelete: Bool
|
||||
var canShare = !message.containsSecretMedia && !Namespaces.Message.allScheduled.contains(message.id.namespace)
|
||||
if let peer = message.peers[message.id.peerId] {
|
||||
if peer is TelegramUser || peer is TelegramSecretChat {
|
||||
canDelete = true
|
||||
@ -434,6 +433,7 @@ final class ChatItemGalleryFooterContentNode: GalleryFooterContentNode, UIScroll
|
||||
}
|
||||
} else {
|
||||
canDelete = false
|
||||
canShare = false
|
||||
}
|
||||
|
||||
var authorNameText: String?
|
||||
@ -466,7 +466,10 @@ final class ChatItemGalleryFooterContentNode: GalleryFooterContentNode, UIScroll
|
||||
messageText = galleryCaptionStringWithAppliedEntities(message.text, entities: entities)
|
||||
}
|
||||
|
||||
if self.currentMessageText != messageText || canDelete != !self.deleteButton.isHidden || self.currentAuthorNameText != authorNameText || self.currentDateText != dateText {
|
||||
self.actionButton.isHidden = message.containsSecretMedia || Namespaces.Message.allScheduled.contains(message.id.namespace)
|
||||
|
||||
|
||||
if self.currentMessageText != messageText || canDelete != !self.deleteButton.isHidden || canShare != !self.actionButton.isHidden || self.currentAuthorNameText != authorNameText || self.currentDateText != dateText {
|
||||
self.currentMessageText = messageText
|
||||
|
||||
if messageText.length == 0 {
|
||||
@ -485,6 +488,7 @@ final class ChatItemGalleryFooterContentNode: GalleryFooterContentNode, UIScroll
|
||||
self.dateNode.attributedText = NSAttributedString(string: dateText, font: dateFont, textColor: .white)
|
||||
|
||||
self.deleteButton.isHidden = !canDelete
|
||||
self.actionButton.isHidden = !canShare
|
||||
|
||||
self.requestLayout?(.immediate)
|
||||
}
|
||||
|
@ -124,7 +124,7 @@ private func readPacketCallback(userData: UnsafeMutableRawPointer?, buffer: Unsa
|
||||
let readingOffset = context.readingOffset
|
||||
let readCount = max(0, min(fileSize - readingOffset, Int(bufferSize)))
|
||||
let range = readingOffset ..< (readingOffset + readCount)
|
||||
precondition(readCount < 1 * 1024 * 1024)
|
||||
assert(readCount < 16 * 1024 * 1024)
|
||||
|
||||
lseek(fd, off_t(range.lowerBound), SEEK_SET)
|
||||
var data = Data(count: readCount)
|
||||
@ -147,7 +147,7 @@ private func readPacketCallback(userData: UnsafeMutableRawPointer?, buffer: Unsa
|
||||
let readCount = max(0, min(next.size - readingOffset, Int(bufferSize)))
|
||||
let range = readingOffset ..< (readingOffset + readCount)
|
||||
|
||||
precondition(readCount < 1 * 1024 * 1024)
|
||||
assert(readCount < 16 * 1024 * 1024)
|
||||
|
||||
let fd = open(next.path, O_RDONLY, S_IRUSR)
|
||||
if fd >= 0 {
|
||||
|
@ -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)
|
||||
|
@ -241,7 +241,7 @@ public final class ThemePreviewController: ViewController {
|
||||
return telegramThemes(postbox: context.account.postbox, network: context.account.network, accountManager: context.sharedContext.accountManager)
|
||||
|> take(1)
|
||||
|> mapToSignal { themes -> Signal<PresentationThemeReference, NoError> in
|
||||
let similarTheme = themes.filter { $0.isCreator && $0.title == info.title }.first
|
||||
let similarTheme = themes.first(where: { $0.isCreator && $0.title == info.title })
|
||||
if let similarTheme = similarTheme {
|
||||
return updateTheme(account: context.account, accountManager: context.sharedContext.accountManager, theme: similarTheme, title: nil, slug: nil, resource: info.resource, thumbnailData: themeThumbnailData)
|
||||
|> map(Optional.init)
|
||||
|
@ -576,7 +576,7 @@ public func actualizedTheme(account: Account, accountManager: AccountManager, th
|
||||
}
|
||||
}
|
||||
|> map { themes -> TelegramTheme in
|
||||
let updatedTheme = themes.filter { $0.id == theme.id }.first
|
||||
let updatedTheme = themes.first(where: { $0.id == theme.id })
|
||||
if let updatedTheme = updatedTheme {
|
||||
if !areThemesEqual(updatedTheme, currentTheme) {
|
||||
currentTheme = updatedTheme
|
||||
|
@ -520,6 +520,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
@ -484,7 +484,7 @@ final class SharedApplicationContext {
|
||||
return UIApplication.shared.open(parsedUrl, options: [UIApplication.OpenExternalURLOptionsKey.universalLinksOnly: true as NSNumber], completionHandler: { value in
|
||||
completion.completion(value)
|
||||
})
|
||||
} else if let escapedUrl = url.addingPercentEncoding(withAllowedCharacters: .urlQueryAllowed), let parsedUrl = URL(string: escapedUrl) {
|
||||
} else if let escapedUrl = (url.removingPercentEncoding ?? url).addingPercentEncoding(withAllowedCharacters: .urlQueryAllowed), let parsedUrl = URL(string: escapedUrl) {
|
||||
return UIApplication.shared.open(parsedUrl, options: [UIApplication.OpenExternalURLOptionsKey.universalLinksOnly: true as NSNumber], completionHandler: { value in
|
||||
completion.completion(value)
|
||||
})
|
||||
|
@ -1585,7 +1585,9 @@ class ChatControllerNode: ASDisplayNode, UIScrollViewDelegate {
|
||||
}
|
||||
|
||||
func sendButtonFrame() -> CGRect? {
|
||||
if let frame = self.textInputPanelNode?.actionButtons.frame {
|
||||
if let mediaPreviewNode = self.inputPanelNode as? ChatRecordingPreviewInputPanelNode {
|
||||
return mediaPreviewNode.convert(mediaPreviewNode.sendButton.frame, to: self)
|
||||
} else if let frame = self.textInputPanelNode?.actionButtons.frame {
|
||||
return self.textInputPanelNode?.convert(frame, to: self)
|
||||
} else {
|
||||
return nil
|
||||
|
@ -36,7 +36,7 @@ private func canEditMessage(accountPeerId: PeerId, limitsConfiguration: LimitsCo
|
||||
if let peer = message.peers[message.id.peerId], let channel = peer as? TelegramChannel {
|
||||
switch channel.info {
|
||||
case .broadcast:
|
||||
if message.author?.id == message.id.peerId || channel.hasPermission(.editAllMessages) {
|
||||
if channel.hasPermission(.editAllMessages) || !message.flags.contains(.Incoming) {
|
||||
hasEditRights = true
|
||||
}
|
||||
default:
|
||||
@ -53,7 +53,7 @@ private func canEditMessage(accountPeerId: PeerId, limitsConfiguration: LimitsCo
|
||||
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:
|
||||
|
@ -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),
|
||||
|
@ -19,7 +19,7 @@ private func generatePlayIcon(_ theme: PresentationTheme) -> UIImage? {
|
||||
|
||||
final class ChatRecordingPreviewInputPanelNode: ChatInputPanelNode {
|
||||
private let deleteButton: HighlightableButtonNode
|
||||
private let sendButton: HighlightableButtonNode
|
||||
let sendButton: HighlightTrackingButtonNode
|
||||
private var sendButtonRadialStatusNode: ChatSendButtonRadialStatusNode?
|
||||
private let playButton: HighlightableButtonNode
|
||||
private let pauseButton: HighlightableButtonNode
|
||||
@ -42,7 +42,7 @@ final class ChatRecordingPreviewInputPanelNode: ChatInputPanelNode {
|
||||
self.deleteButton.displaysAsynchronously = false
|
||||
self.deleteButton.setImage(generateTintedImage(image: UIImage(bundleImageName: "Chat/Input/Accessory Panels/MessageSelectionTrash"), color: theme.chat.inputPanel.panelControlAccentColor), for: [])
|
||||
|
||||
self.sendButton = HighlightableButtonNode()
|
||||
self.sendButton = HighlightTrackingButtonNode()
|
||||
self.sendButton.displaysAsynchronously = false
|
||||
self.sendButton.setImage(PresentationResourcesChat.chatInputPanelSendButtonImage(theme), for: [])
|
||||
|
||||
@ -87,6 +87,16 @@ final class ChatRecordingPreviewInputPanelNode: ChatInputPanelNode {
|
||||
self.addSubnode(self.durationLabel)
|
||||
self.addSubnode(self.waveformButton)
|
||||
|
||||
self.sendButton.highligthedChanged = { [weak self] highlighted in
|
||||
if let strongSelf = self {
|
||||
if highlighted {
|
||||
strongSelf.sendButton.layer.animateScale(from: 1.0, to: 0.75, duration: 0.4, removeOnCompletion: false)
|
||||
} else if let presentationLayer = strongSelf.sendButton.layer.presentation() {
|
||||
strongSelf.sendButton.layer.animateScale(from: CGFloat((presentationLayer.value(forKeyPath: "transform.scale.y") as? NSNumber)?.floatValue ?? 1.0), to: 1.0, duration: 0.25, removeOnCompletion: false)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
self.deleteButton.addTarget(self, action: #selector(self.deletePressed), forControlEvents: [.touchUpInside])
|
||||
self.sendButton.addTarget(self, action: #selector(self.sendPressed), forControlEvents: [.touchUpInside])
|
||||
|
||||
@ -98,8 +108,18 @@ final class ChatRecordingPreviewInputPanelNode: ChatInputPanelNode {
|
||||
self.statusDisposable.dispose()
|
||||
}
|
||||
|
||||
@objc func buttonPressed() {
|
||||
self.interfaceInteraction?.deleteChat()
|
||||
override func didLoad() {
|
||||
super.didLoad()
|
||||
|
||||
let gestureRecognizer = UILongPressGestureRecognizer(target: self, action: #selector(self.handleLongPress(_:)))
|
||||
gestureRecognizer.minimumPressDuration = 0.4
|
||||
self.sendButton.view.addGestureRecognizer(gestureRecognizer)
|
||||
}
|
||||
|
||||
@objc func handleLongPress(_ gestureRecognizer: UILongPressGestureRecognizer) {
|
||||
if gestureRecognizer.state == .began {
|
||||
self.interfaceInteraction?.displaySendMessageOptions()
|
||||
}
|
||||
}
|
||||
|
||||
override func updateLayout(width: CGFloat, leftInset: CGFloat, rightInset: CGFloat, maxHeight: CGFloat, transition: ContainedViewLayoutTransition, interfaceState: ChatPresentationInterfaceState, metrics: LayoutMetrics) -> CGFloat {
|
||||
|
@ -273,7 +273,7 @@ func openResolvedUrlImpl(_ resolvedUrl: ResolvedUrl, context: AccountContext, ur
|
||||
}
|
||||
}))
|
||||
} else {
|
||||
subscriber.putError(.generic)
|
||||
subscriber.putError(.unsupported)
|
||||
}
|
||||
|
||||
return disposables
|
||||
|
Binary file not shown.
@ -414,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)
|
||||
}
|
||||
}
|
||||
|
@ -63,7 +63,7 @@
|
||||
NSData *jsonData = [[NSData alloc] initWithContentsOfFile:filePath];
|
||||
NSDictionary *JSONObject = jsonData ? [NSJSONSerialization JSONObjectWithData:jsonData
|
||||
options:0 error:&error] : nil;
|
||||
if (JSONObject && !error) {
|
||||
if (JSONObject && [JSONObject isKindOfClass:[NSDictionary class]] && !error) {
|
||||
LOTComposition *laScene = [[self alloc] initWithJSON:JSONObject withAssetBundle:[NSBundle mainBundle]];
|
||||
laScene.rootDirectory = [filePath stringByDeletingLastPathComponent];
|
||||
[[LOTAnimationCache sharedCache] addAnimation:laScene forKey:animationName];
|
||||
|
Loading…
x
Reference in New Issue
Block a user