Various fixes

This commit is contained in:
Ilya Laktyushin 2023-01-27 00:57:19 +04:00
parent edc737dce1
commit 72fce11e2d
8 changed files with 18 additions and 35 deletions

View File

@ -8700,9 +8700,11 @@ Sorry for the inconvenience.";
"Conversation.HoldForAudioOnly" = "Hold to record audio.";
"Conversation.HoldForVideoOnly" = "Hold to record video.";
"Conversation.Translation.TranslateTo" = "Translate to %@";
"Conversation.Translation.TranslateToOther" = "Translate to %@";
"Conversation.Translation.ShowOriginal" = "Show Original";
"Conversation.Translation.ChooseLanguage" = "Choose Another Language";
"Conversation.Translation.DoNotTranslate" = "Do Not Translate %@";
"Conversation.Translation.DoNotTranslateOther" = "Do Not Translate %@";
"Conversation.Translation.Hide" = "Hide";
"Conversation.Translation.AddedToDoNotTranslateText" = "**%@** is added to the Do Not Translate list.";
"Conversation.Translation.TranslationBarHiddenChatText" = "Translation bar is now hidden for this chat.";
@ -8720,7 +8722,7 @@ Sorry for the inconvenience.";
"AvatarEditor.SetProfilePhoto" = "Set as Profile Photo";
"AvatarEditor.SuggestProfilePhoto" = "Suggest as Profile Photo";
"AvatarEditor.SetGroupPhoto" = "Set as Group Photo";
"AvatarEditor.SetChannelPhoto" = "Set as Group Photo";
"AvatarEditor.SetChannelPhoto" = "Set as Channel Photo";
"AvatarEditor.Set" = "Set";
"Premium.UpgradeDescription" = "Your current **Telegram Premium** plan can be upgraded at a **discount**.";

View File

@ -96,7 +96,9 @@ public func generateRectsImage(color: UIColor, rects: [CGRect], inset: CGFloat,
var currentRects: [CGRect] = []
for rect in rects {
if rect.width.isZero {
combinedRects.append(currentRects)
if !currentRects.isEmpty {
combinedRects.append(currentRects)
}
currentRects.removeAll()
} else {
currentRects.append(rect)

View File

@ -182,7 +182,11 @@ private final class LegacyComponentsGlobalsProviderImpl: NSObject, LegacyCompone
let convertedType: ManagedAudioSessionType
switch type {
case TGAudioSessionTypePlayAndRecord, TGAudioSessionTypePlayAndRecordHeadphones:
convertedType = .recordWithOthers
if legacyContext.sharedContext.currentMediaInputSettings.with({ $0 }).pauseMusicOnRecording {
convertedType = .record(speaker: false)
} else {
convertedType = .recordWithOthers
}
default:
convertedType = .play
}

View File

@ -635,8 +635,7 @@ class ChatMessageTextBubbleContentNode: ChatMessageBubbleContentNode {
guard let item = self.item else {
return
}
let rects = self.textNode.textNode.rangeRects(in: NSRange(location: 0, length: self.textNode.textNode.cachedLayout?.attributedString?.length ?? 0))?.rects ?? []
let rects = self.textNode.textNode.rangeRects(in: NSRange(location: 0, length: self.textNode.textNode.cachedLayout?.attributedString?.length ?? 0))?.rects ?? []
if isTranslating, !rects.isEmpty {
let shimmeringNode: ShimmeringLinkNode
if let current = self.shimmeringNode {

View File

@ -641,19 +641,7 @@ public func createChannelController(context: AccountContext, mode: CreateChannel
guard let imageCompletion, let videoCompletion else {
return
}
let peerType: AvatarEditorScreen.PeerType
if case .legacyGroup = peer {
peerType = .group
} else if case let .channel(channel) = peer {
if case .group = channel.info {
peerType = channel.flags.contains(.isForum) ? .forum : .group
} else {
peerType = .channel
}
} else {
peerType = .user
}
let controller = AvatarEditorScreen(context: context, inputData: keyboardInputData.get(), peerType: peerType, markup: nil)
let controller = AvatarEditorScreen(context: context, inputData: keyboardInputData.get(), peerType: .channel, markup: nil)
controller.imageCompletion = imageCompletion
controller.videoCompletion = videoCompletion
pushControllerImpl?(controller)

View File

@ -965,19 +965,7 @@ public func createGroupControllerImpl(context: AccountContext, peerIds: [PeerId]
guard let imageCompletion, let videoCompletion else {
return
}
let peerType: AvatarEditorScreen.PeerType
if case .legacyGroup = peer {
peerType = .group
} else if case let .channel(channel) = peer {
if case .group = channel.info {
peerType = channel.flags.contains(.isForum) ? .forum : .group
} else {
peerType = .channel
}
} else {
peerType = .user
}
let controller = AvatarEditorScreen(context: context, inputData: keyboardInputData.get(), peerType: peerType, markup: nil)
let controller = AvatarEditorScreen(context: context, inputData: keyboardInputData.get(), peerType: .group, markup: nil)
controller.imageCompletion = imageCompletion
controller.videoCompletion = videoCompletion
pushImpl?(controller)

View File

@ -311,7 +311,7 @@ final class EditableTokenListNode: ASDisplayNode, UITextFieldDelegate {
self.clipsToBounds = true
self.textFieldNode.textField.delegate = self
self.textFieldNode.textField.addTarget(self, action: #selector(textFieldChanged(_:)), for: .editingChanged)
self.textFieldNode.textField.addTarget(self, action: #selector(self.textFieldChanged(_:)), for: .editingChanged)
self.textFieldNode.textField.didDeleteBackwardWhileEmpty = { [weak self] in
if let strongSelf = self {
if let selectedTokenId = strongSelf.selectedTokenId {
@ -518,7 +518,7 @@ final class EditableTokenListNode: ASDisplayNode, UITextFieldDelegate {
for tokenNode in self.tokenNodes {
let convertedPoint = self.view.convert(point, to: tokenNode.view)
if tokenNode.bounds.contains(convertedPoint) {
if tokenNode.isSelected && convertedPoint.x < 24.0 {
if tokenNode.isSelected {
self.deleteToken?(tokenNode.token.id)
} else {
self.updateSelectedTokenId(tokenNode.token.id, animated: true)

View File

@ -8,7 +8,7 @@ public struct MediaInputSettings: Codable, Equatable {
public let pauseMusicOnRecording: Bool
public static var defaultSettings: MediaInputSettings {
return MediaInputSettings(enableRaiseToSpeak: true, pauseMusicOnRecording: true)
return MediaInputSettings(enableRaiseToSpeak: true, pauseMusicOnRecording: false)
}
public init(enableRaiseToSpeak: Bool, pauseMusicOnRecording: Bool) {
@ -20,7 +20,7 @@ public struct MediaInputSettings: Codable, Equatable {
let container = try decoder.container(keyedBy: StringCodingKey.self)
self.enableRaiseToSpeak = (try container.decode(Int32.self, forKey: "enableRaiseToSpeak")) != 0
self.pauseMusicOnRecording = (try container.decode(Int32.self, forKey: "pauseMusicOnRecording")) != 0
self.pauseMusicOnRecording = (try container.decodeIfPresent(Int32.self, forKey: "pauseMusicOnRecording") ?? 0) != 0
}
public func encode(to encoder: Encoder) throws {