Skip to content

Commit 79c3d87

Browse files
author
Isaac
committed
Merge commit '40080bbe1fb0aab4a5b21d83fc0d575436176447'
2 parents 261fc96 + 40080bb commit 79c3d87

File tree

71 files changed

+2010
-826
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

71 files changed

+2010
-826
lines changed

Telegram/Telegram-iOS/en.lproj/Localizable.strings

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13221,3 +13221,24 @@ Sorry for the inconvenience.";
1322113221

1322213222
"Gift.Send.TitleTo" = "Gift to %@";
1322313223
"Gift.Send.SendShort" = "Send";
13224+
13225+
"Premium.EmojiStatus.Proceed" = "Unlock Emoji Statuses";
13226+
13227+
"Stars.Transaction.Subscription.CancelledByBot" = "Your subscription was cancelled by the bot.";
13228+
"Stars.Transaction.Subscription.CancelledByBusiness" = "Your subscription was cancelled by the business.";
13229+
13230+
"Gift.View.BotDescription" = "You can keep this gift in your Profile or hide it.";
13231+
13232+
"Notification.StarGift.Bot.Subtitle" = "Display this gift on your page.";
13233+
"Notification.StarGift.Bot.Subtitle.Displaying" = "You are displaying this gift on your page.";
13234+
13235+
"Privacy.Gifts" = "Gifts";
13236+
"Privacy.Gifts.WhoCanSeeMyBio" = "WHO CAN DISPLAY GIFTS ON MY PROFILE";
13237+
"Privacy.Gifts.CustomHelp" = "Choose whether gifts from specific senders need your approval before they’re visible to others on your profile.";
13238+
"Privacy.Gifts.AlwaysAllow.Title" = "Always Allow";
13239+
"Privacy.Gifts.NeverAllow.Title" = "Never Allow";
13240+
13241+
"PrivacySettings.ValueBots" = "Mini Apps";
13242+
"PrivacySettings.ValueBotsPlus" = "Mini Apps +%@";
13243+
13244+
"PrivacySettings.CategoryBots" = "Mini Apps";

submodules/AccountContext/Sources/PeerSelectionController.swift

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ public final class PeerSelectionControllerParams {
6363
public let hasTypeHeaders: Bool
6464
public let selectForumThreads: Bool
6565
public let hasCreation: Bool
66+
public let immediatelyActivateMultipleSelection: Bool
6667

6768
public init(
6869
context: AccountContext,
@@ -82,7 +83,8 @@ public final class PeerSelectionControllerParams {
8283
forwardedMessageIds: [EngineMessage.Id] = [],
8384
hasTypeHeaders: Bool = false,
8485
selectForumThreads: Bool = false,
85-
hasCreation: Bool = false
86+
hasCreation: Bool = false,
87+
immediatelyActivateMultipleSelection: Bool = false
8688
) {
8789
self.context = context
8890
self.updatedPresentationData = updatedPresentationData
@@ -102,6 +104,7 @@ public final class PeerSelectionControllerParams {
102104
self.hasTypeHeaders = hasTypeHeaders
103105
self.selectForumThreads = selectForumThreads
104106
self.hasCreation = hasCreation
107+
self.immediatelyActivateMultipleSelection = immediatelyActivateMultipleSelection
105108
}
106109
}
107110

@@ -162,4 +165,5 @@ public enum SelectivePrivacySettingsKind {
162165
case voiceMessages
163166
case bio
164167
case birthday
168+
case giftsAutoSave
165169
}

submodules/AttachmentUI/Sources/AttachmentContainer.swift

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -506,6 +506,8 @@ final class AttachmentContainer: ASDisplayNode, ASGestureRecognizerDelegate {
506506
let containerFrame: CGRect
507507
let clipFrame: CGRect
508508
let containerScale: CGFloat
509+
510+
let isFullscreen = controllers.last?.isFullscreen == true
509511
if case .compact = layout.metrics.widthClass {
510512
self.clipNode.clipsToBounds = true
511513

@@ -524,9 +526,12 @@ final class AttachmentContainer: ASDisplayNode, ASGestureRecognizerDelegate {
524526
}
525527

526528
var containerTopInset: CGFloat
527-
if isLandscape || controllers.last?.isFullscreen == true {
529+
if isLandscape || isFullscreen {
528530
containerTopInset = 0.0
529-
containerLayout = layout
531+
532+
var safeInsets = layout.safeInsets
533+
safeInsets.top = isFullscreen ? 0.000001 : 0.0
534+
containerLayout = layout.withUpdatedSafeInsets(safeInsets)
530535

531536
let unscaledFrame = CGRect(origin: CGPoint(), size: containerLayout.size)
532537
containerScale = 1.0
@@ -548,7 +553,7 @@ final class AttachmentContainer: ASDisplayNode, ASGestureRecognizerDelegate {
548553

549554
var additionalInsets = layout.additionalInsets
550555
additionalInsets.bottom = topInset
551-
556+
552557
containerLayout = ContainerViewLayout(size: CGSize(width: layout.size.width + overflowInset * 2.0, height: layout.size.height - containerTopInset), metrics: layout.metrics, deviceMetrics: layout.deviceMetrics, intrinsicInsets: UIEdgeInsets(top: 0.0, left: intrinsicInsets.left, bottom: intrinsicInsets.bottom, right: intrinsicInsets.right), safeInsets: UIEdgeInsets(top: 0.0, left: safeInsets.left, bottom: safeInsets.bottom, right: safeInsets.right), additionalInsets: additionalInsets, statusBarHeight: nil, inputHeight: layout.inputHeight, inputHeightIsInteractivellyChanging: layout.inputHeightIsInteractivellyChanging, inVoiceOver: layout.inVoiceOver)
553558
let unscaledFrame = CGRect(origin: CGPoint(x: 0.0, y: containerTopInset - coveredByModalTransition * 10.0), size: containerLayout.size)
554559
let maxScale: CGFloat = (containerLayout.size.width - 16.0 * 2.0) / containerLayout.size.width
@@ -560,7 +565,7 @@ final class AttachmentContainer: ASDisplayNode, ASGestureRecognizerDelegate {
560565
clipFrame = CGRect(x: containerFrame.minX + overflowInset, y: containerFrame.minY, width: containerFrame.width - overflowInset * 2.0, height: containerFrame.height)
561566
}
562567
} else {
563-
containerLayout = ContainerViewLayout(size: layout.size, metrics: layout.metrics, deviceMetrics: layout.deviceMetrics, intrinsicInsets: UIEdgeInsets(top: 0.0, left: 0.0, bottom: layout.intrinsicInsets.bottom, right: 0.0), safeInsets: UIEdgeInsets(), additionalInsets: UIEdgeInsets(), statusBarHeight: nil, inputHeight: nil, inputHeightIsInteractivellyChanging: false, inVoiceOver: layout.inVoiceOver)
568+
containerLayout = ContainerViewLayout(size: layout.size, metrics: layout.metrics, deviceMetrics: layout.deviceMetrics, intrinsicInsets: UIEdgeInsets(top: 0.0, left: 0.0, bottom: layout.intrinsicInsets.bottom, right: 0.0), safeInsets: .zero, additionalInsets: .zero, statusBarHeight: isFullscreen ? layout.statusBarHeight : nil, inputHeight: isFullscreen ? layout.inputHeight : nil, inputHeightIsInteractivellyChanging: false, inVoiceOver: layout.inVoiceOver)
564569

565570
let unscaledFrame = CGRect(origin: CGPoint(), size: containerLayout.size)
566571
containerScale = 1.0

submodules/AttachmentUI/Sources/AttachmentController.swift

Lines changed: 52 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1057,50 +1057,57 @@ public class AttachmentController: ViewController, MinimizableController {
10571057
var containerLayout = layout
10581058
let containerRect: CGRect
10591059
if case .regular = layout.metrics.widthClass {
1060-
let availableHeight = layout.size.height - (layout.inputHeight ?? 0.0) - 60.0
1061-
1062-
let size = CGSize(width: 390.0, height: min(620.0, availableHeight))
1063-
1064-
let insets = layout.insets(options: [.input])
1065-
let masterWidth = min(max(320.0, floor(layout.size.width / 3.0)), floor(layout.size.width / 2.0))
1066-
1067-
let position: CGPoint
1068-
let positionY = layout.size.height - size.height - insets.bottom - 40.0
1069-
if let sourceRect = controller.getSourceRect?() {
1070-
position = CGPoint(x: min(layout.size.width - size.width - 28.0, floor(sourceRect.midX - size.width / 2.0)), y: min(positionY, sourceRect.minY - size.height))
1060+
if controller.isFullscreen {
1061+
containerRect = CGRect(origin: .zero, size: layout.size)
1062+
self.wrapperNode.cornerRadius = 0.0
1063+
self.wrapperNode.view.mask = nil
1064+
self.shadowNode.alpha = 0.0
10711065
} else {
1072-
position = CGPoint(x: masterWidth - 174.0, y: positionY)
1073-
}
1074-
1075-
if controller.isStandalone && !controller.forceSourceRect {
1076-
var containerY = floorToScreenPixels((layout.size.height - size.height) / 2.0)
1077-
if let inputHeight = layout.inputHeight, inputHeight > 88.0 {
1078-
containerY = layout.size.height - inputHeight - size.height - 80.0
1066+
let availableHeight = layout.size.height - (layout.inputHeight ?? 0.0) - 60.0
1067+
1068+
let size = CGSize(width: 390.0, height: min(620.0, availableHeight))
1069+
1070+
let insets = layout.insets(options: [.input])
1071+
let masterWidth = min(max(320.0, floor(layout.size.width / 3.0)), floor(layout.size.width / 2.0))
1072+
1073+
let position: CGPoint
1074+
let positionY = layout.size.height - size.height - insets.bottom - 40.0
1075+
if let sourceRect = controller.getSourceRect?() {
1076+
position = CGPoint(x: min(layout.size.width - size.width - 28.0, floor(sourceRect.midX - size.width / 2.0)), y: min(positionY, sourceRect.minY - size.height))
1077+
} else {
1078+
position = CGPoint(x: masterWidth - 174.0, y: positionY)
1079+
}
1080+
1081+
if controller.isStandalone && !controller.forceSourceRect {
1082+
var containerY = floorToScreenPixels((layout.size.height - size.height) / 2.0)
1083+
if let inputHeight = layout.inputHeight, inputHeight > 88.0 {
1084+
containerY = layout.size.height - inputHeight - size.height - 80.0
1085+
}
1086+
containerRect = CGRect(origin: CGPoint(x: floorToScreenPixels((layout.size.width - size.width) / 2.0), y: containerY), size: size)
1087+
} else {
1088+
containerRect = CGRect(origin: position, size: size)
1089+
}
1090+
containerLayout.size = containerRect.size
1091+
containerLayout.intrinsicInsets.bottom = 12.0
1092+
containerLayout.inputHeight = nil
1093+
1094+
if controller.isStandalone {
1095+
self.wrapperNode.cornerRadius = 10.0
1096+
} else if self.wrapperNode.view.mask == nil {
1097+
let maskView = UIImageView()
1098+
maskView.image = generateMaskImage()
1099+
maskView.contentMode = .scaleToFill
1100+
self.wrapperNode.view.mask = maskView
1101+
}
1102+
1103+
if let maskView = self.wrapperNode.view.mask {
1104+
transition.updateFrame(view: maskView, frame: CGRect(origin: CGPoint(), size: size))
1105+
}
1106+
1107+
self.shadowNode.alpha = 1.0
1108+
if self.shadowNode.image == nil {
1109+
self.shadowNode.image = generateShadowImage()
10791110
}
1080-
containerRect = CGRect(origin: CGPoint(x: floorToScreenPixels((layout.size.width - size.width) / 2.0), y: containerY), size: size)
1081-
} else {
1082-
containerRect = CGRect(origin: position, size: size)
1083-
}
1084-
containerLayout.size = containerRect.size
1085-
containerLayout.intrinsicInsets.bottom = 12.0
1086-
containerLayout.inputHeight = nil
1087-
1088-
if controller.isStandalone {
1089-
self.wrapperNode.cornerRadius = 10.0
1090-
} else if self.wrapperNode.view.mask == nil {
1091-
let maskView = UIImageView()
1092-
maskView.image = generateMaskImage()
1093-
maskView.contentMode = .scaleToFill
1094-
self.wrapperNode.view.mask = maskView
1095-
}
1096-
1097-
if let maskView = self.wrapperNode.view.mask {
1098-
transition.updateFrame(view: maskView, frame: CGRect(origin: CGPoint(), size: size))
1099-
}
1100-
1101-
self.shadowNode.alpha = 1.0
1102-
if self.shadowNode.image == nil {
1103-
self.shadowNode.image = generateShadowImage()
11041111
}
11051112
} else {
11061113
let containerHeight: CGFloat
@@ -1410,7 +1417,9 @@ public class AttachmentController: ViewController, MinimizableController {
14101417
let snapshotView = self.view.snapshotView(afterScreenUpdates: false)
14111418
if let contentSnapshotView = self.mainController.makeContentSnapshotView() {
14121419
if !self.mainController.isFullscreen {
1413-
contentSnapshotView.frame = contentSnapshotView.frame.offsetBy(dx: 0.0, dy: 64.0 + 56.0)
1420+
if let layout = self.validLayout {
1421+
contentSnapshotView.frame = contentSnapshotView.frame.offsetBy(dx: 0.0, dy: (layout.statusBarHeight ?? 0.0) + 10.0 + 56.0)
1422+
}
14141423
}
14151424
snapshotView?.addSubview(contentSnapshotView)
14161425
}

submodules/BrowserUI/Sources/BrowserWebContent.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -809,7 +809,7 @@ final class BrowserWebContent: UIView, BrowserContent, WKNavigationDelegate, WKU
809809
}
810810

811811
func webView(_ webView: WKWebView, decidePolicyFor navigationResponse: WKNavigationResponse, decisionHandler: @escaping (WKNavigationResponsePolicy) -> Void) {
812-
if navigationResponse.canShowMIMEType {
812+
if navigationResponse.canShowMIMEType || navigationResponse.response.url?.scheme == "tonsite" {
813813
decisionHandler(.allow)
814814
} else if #available(iOS 14.5, *) {
815815
if navigationResponse.response.suggestedFilename?.lowercased().hasSuffix(".pkpass") == true {
@@ -905,7 +905,7 @@ final class BrowserWebContent: UIView, BrowserContent, WKNavigationDelegate, WKU
905905
}
906906
} else {
907907
let controller = legacyICloudFilePicker(theme: self.presentationData.theme, mode: .export, url: url, documentTypes: [], forceDarkTheme: false, dismissed: {}, completion: { _ in
908-
908+
let _ = tempFile
909909
})
910910
self.present(controller, nil)
911911
}

submodules/Camera/Sources/Camera.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,7 @@ private final class CameraContext {
257257

258258
mainDeviceContext.output.markPositionChange(position: targetPosition)
259259
} else {
260+
self.session.session.stopRunning()
260261
self.configure {
261262
let isRoundVideo = self.initialConfiguration.isRoundVideo
262263
self.mainDeviceContext?.invalidate(switchAudio: !isRoundVideo)
@@ -284,6 +285,7 @@ private final class CameraContext {
284285
self.modeChange = .none
285286
}
286287
}
288+
self.session.session.startRunning()
287289
}
288290
}
289291

@@ -320,6 +322,7 @@ private final class CameraContext {
320322
self.modeChange = .dualCamera
321323
}
322324

325+
self.session.session.stopRunning()
323326
if enabled {
324327
self.configure {
325328
self.mainDeviceContext?.invalidate()
@@ -432,6 +435,7 @@ private final class CameraContext {
432435
self?.detectedCodesPipe.putNext(codes)
433436
}
434437
}
438+
self.session.session.startRunning()
435439

436440
if change {
437441
if #available(iOS 13.0, *), let previewView = self.simplePreviewView {

submodules/ChatListUI/Sources/Node/ChatListNode.swift

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -644,13 +644,17 @@ private func mappedInsertEntries(context: AccountContext, nodeInteraction: ChatL
644644
status: status,
645645
requiresPremiumForMessaging: peerEntry.requiresPremiumForMessaging,
646646
enabled: true,
647-
selection: .none,
647+
selection: editing ? .selectable(selected: selected) : .none,
648648
editing: ContactsPeerItemEditing(editable: false, editing: false, revealed: false),
649649
index: nil,
650650
header: nil,
651651
action: { _ in
652652
if let chatPeer = chatPeer {
653-
nodeInteraction.peerSelected(chatPeer, nil, nil, nil)
653+
if editing {
654+
nodeInteraction.togglePeerSelected(chatPeer, nil)
655+
} else {
656+
nodeInteraction.peerSelected(chatPeer, nil, nil, nil)
657+
}
654658
}
655659
}, disabledAction: peerEntry.requiresPremiumForMessaging ? { _ in
656660
if let chatPeer {
@@ -984,13 +988,17 @@ private func mappedUpdateEntries(context: AccountContext, nodeInteraction: ChatL
984988
status: status,
985989
requiresPremiumForMessaging: peerEntry.requiresPremiumForMessaging,
986990
enabled: true,
987-
selection: .none,
991+
selection: editing ? .selectable(selected: selected) : .none,
988992
editing: ContactsPeerItemEditing(editable: false, editing: false, revealed: false),
989993
index: nil,
990994
header: nil,
991995
action: { _ in
992996
if let chatPeer = chatPeer {
993-
nodeInteraction.peerSelected(chatPeer, nil, nil, nil)
997+
if editing {
998+
nodeInteraction.togglePeerSelected(chatPeer, nil)
999+
} else {
1000+
nodeInteraction.peerSelected(chatPeer, nil, nil, nil)
1001+
}
9941002
}
9951003
}, disabledAction: peerEntry.requiresPremiumForMessaging ? { _ in
9961004
if let chatPeer {

submodules/ChatListUI/Sources/Node/ChatListNoticeItem.swift

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,7 @@ final class ChatListNoticeItemNode: ItemListRevealOptionsItemNode {
167167

168168
let sideInset: CGFloat = params.leftInset + 16.0
169169
let rightInset: CGFloat = sideInset + 24.0
170+
var titleRightInset = rightInset
170171
let verticalInset: CGFloat = 9.0
171172
var spacing: CGFloat = 0.0
172173

@@ -214,6 +215,7 @@ final class ChatListNoticeItemNode: ItemListRevealOptionsItemNode {
214215
titleString = titleStringValue
215216

216217
textString = NSAttributedString(string: item.strings.ChatList_PremiumAnnualDiscountText, font: textFont, textColor: item.theme.rootController.navigationBar.secondaryTextColor)
218+
titleRightInset = sideInset
217219
case let .premiumRestore(discount):
218220
let discountString = "\(discount)%"
219221
let rawTitleString = item.strings.ChatList_PremiumRestoreDiscountTitle(discountString)
@@ -291,7 +293,7 @@ final class ChatListNoticeItemNode: ItemListRevealOptionsItemNode {
291293
leftInset += avatarsWidth + 4.0
292294
}
293295

294-
let titleLayout = makeTitleLayout(TextNodeLayoutArguments(attributedString: titleString, maximumNumberOfLines: 1, truncationType: .end, constrainedSize: CGSize(width: params.width - leftInset - rightInset, height: 100.0), alignment: alignment, lineSpacing: 0.18))
296+
let titleLayout = makeTitleLayout(TextNodeLayoutArguments(attributedString: titleString, maximumNumberOfLines: 1, truncationType: .end, constrainedSize: CGSize(width: params.width - leftInset - titleRightInset, height: 100.0), alignment: alignment, lineSpacing: 0.18))
295297

296298
let textLayout = makeTextLayout(TextNodeLayoutArguments(attributedString: textString, maximumNumberOfLines: 10, truncationType: .end, constrainedSize: CGSize(width: params.width - leftInset - rightInset, height: 100.0), alignment: alignment, lineSpacing: 0.18))
297299

0 commit comments

Comments
 (0)