diff --git a/Images.xcassets/Chat/Input/Text/AccessoryIconKeyboard.imageset/Contents.json b/Images.xcassets/Chat/Input/Text/AccessoryIconKeyboard.imageset/Contents.json index 5785acf156..217d187faf 100644 --- a/Images.xcassets/Chat/Input/Text/AccessoryIconKeyboard.imageset/Contents.json +++ b/Images.xcassets/Chat/Input/Text/AccessoryIconKeyboard.imageset/Contents.json @@ -2,7 +2,17 @@ "images" : [ { "idiom" : "universal", - "filename" : "ic_keyboard.pdf" + "scale" : "1x" + }, + { + "idiom" : "universal", + "filename" : "ConversationInputFieldKeyboardIcon@2x.png", + "scale" : "2x" + }, + { + "idiom" : "universal", + "filename" : "ConversationInputFieldKeyboardIcon@3x.png", + "scale" : "3x" } ], "info" : { diff --git a/Images.xcassets/Chat/Input/Text/AccessoryIconKeyboard.imageset/ConversationInputFieldKeyboardIcon@2x.png b/Images.xcassets/Chat/Input/Text/AccessoryIconKeyboard.imageset/ConversationInputFieldKeyboardIcon@2x.png new file mode 100644 index 0000000000..90a1f74a91 Binary files /dev/null and b/Images.xcassets/Chat/Input/Text/AccessoryIconKeyboard.imageset/ConversationInputFieldKeyboardIcon@2x.png differ diff --git a/Images.xcassets/Chat/Input/Text/AccessoryIconKeyboard.imageset/ConversationInputFieldKeyboardIcon@3x.png b/Images.xcassets/Chat/Input/Text/AccessoryIconKeyboard.imageset/ConversationInputFieldKeyboardIcon@3x.png new file mode 100644 index 0000000000..005f85dabc Binary files /dev/null and b/Images.xcassets/Chat/Input/Text/AccessoryIconKeyboard.imageset/ConversationInputFieldKeyboardIcon@3x.png differ diff --git a/Images.xcassets/Chat/Input/Text/AccessoryIconKeyboard.imageset/ic_keyboard.pdf b/Images.xcassets/Chat/Input/Text/AccessoryIconKeyboard.imageset/ic_keyboard.pdf deleted file mode 100644 index b713289f1b..0000000000 Binary files a/Images.xcassets/Chat/Input/Text/AccessoryIconKeyboard.imageset/ic_keyboard.pdf and /dev/null differ diff --git a/Images.xcassets/Chat/Input/Text/AccessoryIconStickers.imageset/Contents.json b/Images.xcassets/Chat/Input/Text/AccessoryIconStickers.imageset/Contents.json index ef827e8385..468f40a72c 100644 --- a/Images.xcassets/Chat/Input/Text/AccessoryIconStickers.imageset/Contents.json +++ b/Images.xcassets/Chat/Input/Text/AccessoryIconStickers.imageset/Contents.json @@ -2,7 +2,17 @@ "images" : [ { "idiom" : "universal", - "filename" : "ic_sticker.pdf" + "scale" : "1x" + }, + { + "idiom" : "universal", + "filename" : "ConversationInputFieldStickerIcon@2x.png", + "scale" : "2x" + }, + { + "idiom" : "universal", + "filename" : "ConversationInputFieldStickerIcon@3x.png", + "scale" : "3x" } ], "info" : { diff --git a/Images.xcassets/Chat/Input/Text/AccessoryIconStickers.imageset/ConversationInputFieldStickerIcon@2x.png b/Images.xcassets/Chat/Input/Text/AccessoryIconStickers.imageset/ConversationInputFieldStickerIcon@2x.png new file mode 100644 index 0000000000..442fd2cf5e Binary files /dev/null and b/Images.xcassets/Chat/Input/Text/AccessoryIconStickers.imageset/ConversationInputFieldStickerIcon@2x.png differ diff --git a/Images.xcassets/Chat/Input/Text/AccessoryIconStickers.imageset/ConversationInputFieldStickerIcon@3x.png b/Images.xcassets/Chat/Input/Text/AccessoryIconStickers.imageset/ConversationInputFieldStickerIcon@3x.png new file mode 100644 index 0000000000..1e6dfe8de2 Binary files /dev/null and b/Images.xcassets/Chat/Input/Text/AccessoryIconStickers.imageset/ConversationInputFieldStickerIcon@3x.png differ diff --git a/Images.xcassets/Chat/Input/Text/AccessoryIconStickers.imageset/ic_sticker.pdf b/Images.xcassets/Chat/Input/Text/AccessoryIconStickers.imageset/ic_sticker.pdf deleted file mode 100644 index ee4036d5e9..0000000000 Binary files a/Images.xcassets/Chat/Input/Text/AccessoryIconStickers.imageset/ic_sticker.pdf and /dev/null differ diff --git a/Images.xcassets/Chat/Input/Text/AccessoryIconTimer.imageset/ModernConversationSecretAccessoryTimer@2x.png b/Images.xcassets/Chat/Input/Text/AccessoryIconTimer.imageset/ModernConversationSecretAccessoryTimer@2x.png index e0ff0e6e63..af2c0d50b1 100644 Binary files a/Images.xcassets/Chat/Input/Text/AccessoryIconTimer.imageset/ModernConversationSecretAccessoryTimer@2x.png and b/Images.xcassets/Chat/Input/Text/AccessoryIconTimer.imageset/ModernConversationSecretAccessoryTimer@2x.png differ diff --git a/Images.xcassets/Chat/Input/Text/AccessoryIconTimer.imageset/ModernConversationSecretAccessoryTimer@3x.png b/Images.xcassets/Chat/Input/Text/AccessoryIconTimer.imageset/ModernConversationSecretAccessoryTimer@3x.png index 3e47b2b27b..7953c536bb 100644 Binary files a/Images.xcassets/Chat/Input/Text/AccessoryIconTimer.imageset/ModernConversationSecretAccessoryTimer@3x.png and b/Images.xcassets/Chat/Input/Text/AccessoryIconTimer.imageset/ModernConversationSecretAccessoryTimer@3x.png differ diff --git a/TelegramUI/CallListController.swift b/TelegramUI/CallListController.swift index 6cc40513b8..f665ab0c3f 100644 --- a/TelegramUI/CallListController.swift +++ b/TelegramUI/CallListController.swift @@ -82,7 +82,7 @@ public final class CallListController: ViewController { self.segmentedTitleView.color = self.presentationData.theme.rootController.navigationBar.accentTextColor if let isEmpty = self.isEmpty, isEmpty { - self.title = self.presentationData.strings.Calls_TabTitle + self.navigationItem.title = self.presentationData.strings.Calls_TabTitle } else { if self.editingMode { self.navigationItem.leftBarButtonItem = UIBarButtonItem(title: self.presentationData.strings.Common_Done, style: .done, target: self, action: #selector(self.donePressed)) @@ -127,9 +127,9 @@ public final class CallListController: ViewController { if empty { strongSelf.navigationItem.setLeftBarButton(nil, animated: true) - strongSelf.title = strongSelf.presentationData.strings.Calls_TabTitle + strongSelf.navigationItem.title = strongSelf.presentationData.strings.Calls_TabTitle } else { - strongSelf.title = "" + strongSelf.navigationItem.title = "" strongSelf.navigationItem.titleView = strongSelf.segmentedTitleView if strongSelf.editingMode { strongSelf.navigationItem.leftBarButtonItem = UIBarButtonItem(title: strongSelf.presentationData.strings.Common_Done, style: .done, target: strongSelf, action: #selector(strongSelf.donePressed)) diff --git a/TelegramUI/ChannelBannedMemberController.swift b/TelegramUI/ChannelBannedMemberController.swift index 630295a22f..719b40aeda 100644 --- a/TelegramUI/ChannelBannedMemberController.swift +++ b/TelegramUI/ChannelBannedMemberController.swift @@ -266,7 +266,7 @@ private func channelBannedMemberControllerEntries(presentationData: Presentation if let updatedFlags = state.updatedFlags { currentRightsFlags = updatedFlags } else if let initialParticipant = initialParticipant, case let .member(_, _, _, maybeBanInfo) = initialParticipant, let banInfo = maybeBanInfo { - currentRightsFlags = banInfo.flags + currentRightsFlags = banInfo.rights.flags } else { currentRightsFlags = [.banSendMessages, .banSendGifs, .banSendGames, .banSendInline, .banSendStickers, .banSendMedia, .banEmbedLinks] } @@ -275,7 +275,7 @@ private func channelBannedMemberControllerEntries(presentationData: Presentation if let updatedTimeout = state.updatedTimeout { currentTimeout = updatedTimeout } else if let initialParticipant = initialParticipant, case let .member(_, _, _, maybeBanInfo) = initialParticipant, let banInfo = maybeBanInfo { - currentTimeout = banInfo.untilDate + currentTimeout = banInfo.rights.untilDate } else { currentTimeout = Int32.max } diff --git a/TelegramUI/ChatController.swift b/TelegramUI/ChatController.swift index 73fb2731e2..6dd61d2f9c 100644 --- a/TelegramUI/ChatController.swift +++ b/TelegramUI/ChatController.swift @@ -1899,7 +1899,7 @@ public class ChatController: TelegramController { let controller = generator({ controller in return presentOverlayController!(controller) }) - let legacyController = LegacyController(legacyController: controller, presentation: .modal(animateIn: false)) + let legacyController = LegacyController(legacyController: controller, presentation: .modal(animateIn: true)) presentOverlayController = { [weak legacyController] controller in if let legacyController = legacyController { diff --git a/TelegramUI/ChatSecretAutoremoveTimerActionSheet.swift b/TelegramUI/ChatSecretAutoremoveTimerActionSheet.swift index 517d165b25..8013bff008 100644 --- a/TelegramUI/ChatSecretAutoremoveTimerActionSheet.swift +++ b/TelegramUI/ChatSecretAutoremoveTimerActionSheet.swift @@ -136,7 +136,11 @@ private final class AutoremoveTimeoutSelectorItemNode: ActionSheetItemNode, UIPi } func pickerView(_ pickerView: UIPickerView, attributedTitleForRow row: Int, forComponent component: Int) -> NSAttributedString? { - return NSAttributedString(string: timeIntervalString(strings: self.strings, value: timeoutValues[row]), font: Font.medium(15.0), textColor: UIColor.black) + if timeoutValues[row] == 0 { + return NSAttributedString(string: self.strings.Profile_MessageLifetimeForever, font: Font.medium(15.0), textColor: UIColor.black) + } else { + return NSAttributedString(string: timeIntervalString(strings: self.strings, value: timeoutValues[row]), font: Font.medium(15.0), textColor: UIColor.black) + } } func pickerView(_ pickerView: UIPickerView, didSelectRow row: Int, inComponent component: Int) { diff --git a/TelegramUI/ChatTextInputPanelNode.swift b/TelegramUI/ChatTextInputPanelNode.swift index 95d25a0f2a..731867f93c 100644 --- a/TelegramUI/ChatTextInputPanelNode.swift +++ b/TelegramUI/ChatTextInputPanelNode.swift @@ -105,7 +105,7 @@ struct ChatTextInputPanelState: Equatable { private final class AccessoryItemIconButton: HighlightableButton { private let item: ChatTextInputAccessoryItem - init(item: ChatTextInputAccessoryItem, theme: PresentationTheme) { + init(item: ChatTextInputAccessoryItem, theme: PresentationTheme, strings: PresentationStrings) { self.item = item super.init(frame: CGRect()) @@ -122,14 +122,15 @@ private final class AccessoryItemIconButton: HighlightableButton { self.setImage(nil, for: []) self.titleLabel?.font = Font.regular(12.0) self.setTitleColor(theme.chat.inputPanel.inputControlColor, for: []) - self.setTitle("\(timeout)s", for: []) + self.setTitle(shortTimeIntervalString(strings: strings, value: timeout), for: []) } else { self.setImage(PresentationResourcesChat.chatInputTextFieldTimerImage(theme), for: []) - } + self.imageEdgeInsets = UIEdgeInsets(top: 0.0, left: 0.0, bottom: 1.0, right: 0.0) + } } } - func updateTheme(theme: PresentationTheme) { + func updateThemeAndStrings(theme: PresentationTheme, strings: PresentationStrings) { switch self.item { case .keyboard: self.setImage(PresentationResourcesChat.chatInputTextFieldKeyboardImage(theme), for: []) @@ -142,9 +143,10 @@ private final class AccessoryItemIconButton: HighlightableButton { self.setImage(nil, for: []) self.titleLabel?.font = Font.regular(12.0) self.setTitleColor(theme.chat.inputPanel.inputControlColor, for: []) - self.setTitle("\(timeout)s", for: []) + self.setTitle(shortTimeIntervalString(strings: strings, value: timeout), for: []) } else { self.setImage(PresentationResourcesChat.chatInputTextFieldTimerImage(theme), for: []) + self.imageEdgeInsets = UIEdgeInsets(top: 0.0, left: 0.0, bottom: 1.0, right: 0.0) } } } @@ -197,6 +199,7 @@ class ChatTextInputPanelNode: ChatInputPanelNode, ASEditableTextNodeDelegate { private var extendedSearchLayout = false private var theme: PresentationTheme? + private var strings: PresentationStrings? var inputTextState: ChatTextInputState { if let textInputNode = self.textInputNode { @@ -437,7 +440,13 @@ class ChatTextInputPanelNode: ChatInputPanelNode, ASEditableTextNodeDelegate { self.audioRecordingCancelIndicator?.updateTheme(theme: interfaceState.theme) for (_, button) in self.accessoryItemButtons { - button.updateTheme(theme: interfaceState.theme) + button.updateThemeAndStrings(theme: interfaceState.theme, strings: interfaceState.strings) + } + } else if self.strings !== interfaceState.strings { + self.strings = interfaceState.strings + + for (_, button) in self.accessoryItemButtons { + button.updateThemeAndStrings(theme: interfaceState.theme, strings: interfaceState.strings) } } @@ -491,7 +500,7 @@ class ChatTextInputPanelNode: ChatInputPanelNode, ASEditableTextNodeDelegate { } } if itemAndButton == nil { - let button = AccessoryItemIconButton(item: item, theme: interfaceState.theme) + let button = AccessoryItemIconButton(item: item, theme: interfaceState.theme, strings: interfaceState.strings) button.addTarget(self, action: #selector(self.accessoryItemButtonPressed(_:)), for: [.touchUpInside]) itemAndButton = (item, button) } diff --git a/TelegramUI/MediaPlayerNode.swift b/TelegramUI/MediaPlayerNode.swift index a135484db1..4030a9fe7f 100644 --- a/TelegramUI/MediaPlayerNode.swift +++ b/TelegramUI/MediaPlayerNode.swift @@ -246,6 +246,18 @@ final class MediaPlayerNode: ASDisplayNode { deinit { assert(Queue.mainQueue().isCurrent()) + + if let (takeFrameQueue, _) = self.takeFrameAndQueue { + if let videoLayer = self.videoLayer { + takeFrameQueue.async { + videoLayer.flushAndRemoveImage() + + takeFrameQueue.after(1.0, { + videoLayer.flushAndRemoveImage() + }) + } + } + } } override var frame: CGRect { diff --git a/TelegramUI/NumericFormat.swift b/TelegramUI/NumericFormat.swift index 9098d0eb75..46aff24ef1 100644 --- a/TelegramUI/NumericFormat.swift +++ b/TelegramUI/NumericFormat.swift @@ -34,6 +34,20 @@ func timeIntervalString(strings: PresentationStrings, value: Int32) -> String { } } +func shortTimeIntervalString(strings: PresentationStrings, value: Int32) -> String { + if value < 60 { + return strings.MessageTimer_ShortSeconds(max(1, value)) + } else if value < 60 * 60 { + return strings.MessageTimer_ShortMinutes(max(1, value / 60)) + } else if value < 60 * 60 * 24 { + return strings.MessageTimer_ShortHours(max(1, value / (60 * 60))) + } else if value < 60 * 60 * 24 * 7 { + return strings.MessageTimer_ShortDays(max(1, value / (60 * 60 * 24))) + } else { + return strings.MessageTimer_ShortWeeks(max(1, value / (60 * 60 * 24 * 7))) + } +} + func muteForIntervalString(strings: PresentationStrings, value: Int32) -> String { if value < 60 * 60 { return strings.MuteFor_Minutes(max(1, value / 60))