Skip to content

Commit 384d295

Browse files
author
Isaac
committed
Merge commit '3778357baa5dab114c14f7dfe5fc9aaeb835cff5'
# Conflicts: # Telegram/Telegram-iOS/en.lproj/Localizable.strings
2 parents 7aaf95e + 3778357 commit 384d295

File tree

11 files changed

+230
-117
lines changed

11 files changed

+230
-117
lines changed

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

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13300,6 +13300,19 @@ Sorry for the inconvenience.";
1330013300

1330113301
"Notification.Gift" = "Gift";
1330213302

13303+
"WebBrowser.PassExistsError" = "This pass is already added to Wallet.";
13304+
13305+
"Chat.VideoProcessingInfo" = "The video will be published once converted and optimized.";
13306+
13307+
"Camera.CollageManagementTooltip" = "Tap a tile to delete or reorder it.";
13308+
"Camera.CollageReorderingInfo" = "Hold and drag tiles to reorder them.";
13309+
13310+
"MediaPicker.InvertCaptionTooltip" = "Tap here to move caption up.";
13311+
"MediaPicker.InvertCaption.Updated.Up.Title" = "Caption moved up";
13312+
"MediaPicker.InvertCaption.Updated.Up.Text" = "Text will be shown above the media.";
13313+
"MediaPicker.InvertCaption.Updated.Down.Title" = "Caption moved down";
13314+
"MediaPicker.InvertCaption.Updated.Down.Text" = "Text will be shown below the media.";
13315+
1330313316
"AffiliateSetup.AlertTerminate.Title" = "Warning";
1330413317
"AffiliateSetup.AlertTerminate.Text" = "If you end your affiliate program:\n\n• Any referral links already shared will be disabled in 24 hours.\n\n• All participating affiliates will be notified.\n\n• You will be able to start a new affiliate program only in 24 hours.";
1330513318
"AffiliateSetup.AlertTerminate.Action" = "End Anyway";

submodules/BrowserUI/Sources/BrowserWebContent.swift

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -896,8 +896,7 @@ final class BrowserWebContent: UIView, BrowserContent, WKNavigationDelegate, WKU
896896
if let data = try? Data(contentsOf: url), let pass = try? PKPass(data: data) {
897897
let passLibrary = PKPassLibrary()
898898
if passLibrary.containsPass(pass) {
899-
//TODO:localize
900-
let alertController = textAlertController(context: self.context, updatedPresentationData: nil, title: nil, text: "This pass is already added to Wallet.", actions: [TextAlertAction(type: .genericAction, title: self.presentationData.strings.Common_OK, action: {})])
899+
let alertController = textAlertController(context: self.context, updatedPresentationData: nil, title: nil, text: self.presentationData.strings.WebBrowser_PassExistsError, actions: [TextAlertAction(type: .genericAction, title: self.presentationData.strings.Common_OK, action: {})])
901900
self.present(alertController, nil)
902901
} else if let controller = PKAddPassesViewController(pass: pass) {
903902
self.getNavigationController()?.view.window?.rootViewController?.present(controller, animated: true)

submodules/ContextUI/Sources/ContextActionsContainerNode.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -438,21 +438,21 @@ final class InnerTextSelectionTipContainerNode: ASDisplayNode {
438438
icon = nil
439439
isUserInteractionEnabled = action != nil
440440
case let .starsReactions(topCount):
441+
//TODO:localize
441442
self.action = nil
442443
self.text = "Send \(topCount) or more to highlight your profile"
443444
self.targetSelectionIndex = nil
444445
icon = nil
445446
isUserInteractionEnabled = action != nil
446447
case .videoProcessing:
447448
self.action = nil
448-
self.text = "The video will be published once converted and optimized."
449+
self.text = self.presentationData.strings.Chat_VideoProcessingInfo
449450
self.targetSelectionIndex = nil
450451
icon = nil
451452
isUserInteractionEnabled = action != nil
452453
case .collageReordering:
453-
//TODO:localize
454454
self.action = nil
455-
self.text = "Hold and drag tiles to reorder them."
455+
self.text = self.presentationData.strings.Camera_CollageReorderingInfo
456456
self.targetSelectionIndex = nil
457457
icon = UIImage(bundleImageName: "Chat/Context Menu/Tip")
458458
}

submodules/TelegramNotices/Sources/Notices.swift

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,7 @@ private enum ApplicationSpecificGlobalNotice: Int32 {
199199
case dismissedBusinessIntroBadge = 72
200200
case dismissedBusinessLinksBadge = 73
201201
case dismissedBusinessChatbotsBadge = 74
202+
case captionAboveMediaTooltip = 75
202203

203204
var key: ValueBoxKey {
204205
let v = ValueBoxKey(length: 4)
@@ -534,6 +535,10 @@ private struct ApplicationSpecificNoticeKeys {
534535
static func dismissedBusinessChatbotsBadge() -> NoticeEntryKey {
535536
return NoticeEntryKey(namespace: noticeNamespace(namespace: globalNamespace), key: ApplicationSpecificGlobalNotice.dismissedBusinessChatbotsBadge.key)
536537
}
538+
539+
static func captionAboveMediaTooltip() -> NoticeEntryKey {
540+
return NoticeEntryKey(namespace: noticeNamespace(namespace: globalNamespace), key: ApplicationSpecificGlobalNotice.captionAboveMediaTooltip.key)
541+
}
537542
}
538543

539544
public struct ApplicationSpecificNotice {
@@ -2246,4 +2251,31 @@ public struct ApplicationSpecificNotice {
22462251
}
22472252
|> take(1)
22482253
}
2254+
2255+
public static func getCaptionAboveMediaTooltip(accountManager: AccountManager<TelegramAccountManagerTypes>) -> Signal<Int32, NoError> {
2256+
return accountManager.transaction { transaction -> Int32 in
2257+
if let value = transaction.getNotice(ApplicationSpecificNoticeKeys.captionAboveMediaTooltip())?.get(ApplicationSpecificCounterNotice.self) {
2258+
return value.value
2259+
} else {
2260+
return 0
2261+
}
2262+
}
2263+
}
2264+
2265+
public static func incrementCaptionAboveMediaTooltip(accountManager: AccountManager<TelegramAccountManagerTypes>, count: Int = 1) -> Signal<Int, NoError> {
2266+
return accountManager.transaction { transaction -> Int in
2267+
var currentValue: Int32 = 0
2268+
if let value = transaction.getNotice(ApplicationSpecificNoticeKeys.captionAboveMediaTooltip())?.get(ApplicationSpecificCounterNotice.self) {
2269+
currentValue = value.value
2270+
}
2271+
let previousValue = currentValue
2272+
currentValue += Int32(count)
2273+
2274+
if let entry = CodableEntry(ApplicationSpecificCounterNotice(value: currentValue)) {
2275+
transaction.setNotice(ApplicationSpecificNoticeKeys.captionAboveMediaTooltip(), entry)
2276+
}
2277+
2278+
return Int(previousValue)
2279+
}
2280+
}
22492281
}

submodules/TelegramUI/Components/CameraScreen/Sources/CameraScreen.swift

Lines changed: 72 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -568,19 +568,33 @@ private final class CameraScreenComponent: CombinedComponent {
568568
}
569569

570570
func toggleCollageCamera() {
571-
guard let controller = self.getController(), let _ = controller.camera else {
571+
guard let controller = self.getController(), let camera = controller.camera else {
572+
return
573+
}
574+
let currentTimestamp = CACurrentMediaTime()
575+
if let lastDualCameraTimestamp = self.lastDualCameraTimestamp, currentTimestamp - lastDualCameraTimestamp < 1.5 {
572576
return
573577
}
578+
if let lastFlipTimestamp = self.lastFlipTimestamp, currentTimestamp - lastFlipTimestamp < 1.0 {
579+
return
580+
}
581+
self.lastDualCameraTimestamp = currentTimestamp
574582

575583
controller.node.dismissAllTooltips()
576584

585+
if controller.cameraState.isDualCameraEnabled {
586+
camera.setDualCameraEnabled(false)
587+
}
588+
577589
if controller.cameraState.isCollageEnabled {
578590
self.displayingCollageSelection = !self.displayingCollageSelection
579591
self.updated(transition: .spring(duration: 0.3))
580592
} else {
581593
let isEnabled = !controller.cameraState.isCollageEnabled
582594
self.displayingCollageSelection = isEnabled
583-
controller.updateCameraState({ $0.updatedIsCollageEnabled(isEnabled).updatedCollageProgress(0.0) }, transition: .spring(duration: 0.3))
595+
controller.updateCameraState({
596+
$0.updatedIsCollageEnabled(isEnabled).updatedCollageProgress(0.0).updatedIsDualCameraEnabled(false)
597+
}, transition: .spring(duration: 0.3))
584598
}
585599
self.hapticFeedback.impact(.light)
586600
}
@@ -635,9 +649,8 @@ private final class CameraScreenComponent: CombinedComponent {
635649
self.displayingCollageSelection = false
636650
self.updated(transition: .spring(duration: 0.3))
637651

638-
//TODO:localize
639652
let presentationData = self.context.sharedContext.currentPresentationData.with { $0 }
640-
let tooltipController = UndoOverlayController(presentationData: presentationData, content: .info(title: nil, text: "Tap a tile to delete or reorder it.", timeout: 3.0, customUndoText: nil), elevatedLayout: false, action: { _ in
653+
let tooltipController = UndoOverlayController(presentationData: presentationData, content: .info(title: nil, text: presentationData.strings.Camera_CollageManagementTooltip, timeout: 2.0, customUndoText: nil), elevatedLayout: false, action: { _ in
641654
return true
642655
})
643656
controller.present(tooltipController, in: .current)
@@ -1279,68 +1292,66 @@ private final class CameraScreenComponent: CombinedComponent {
12791292
nextButtonX -= dualButton.size.width + 16.0
12801293
}
12811294

1282-
if !component.cameraState.isDualCameraEnabled {
1283-
let collageButton = collageButton.update(
1284-
component: CameraButton(
1285-
content: AnyComponentWithIdentity(
1286-
id: "collage",
1287-
component: AnyComponent(
1288-
CollageIconComponent(
1289-
grid: component.cameraState.collageGrid,
1290-
crossed: false,
1291-
isSelected: component.cameraState.isCollageEnabled,
1292-
tintColor: controlsTintColor
1293-
)
1295+
let collageButton = collageButton.update(
1296+
component: CameraButton(
1297+
content: AnyComponentWithIdentity(
1298+
id: "collage",
1299+
component: AnyComponent(
1300+
CollageIconComponent(
1301+
grid: component.cameraState.collageGrid,
1302+
crossed: false,
1303+
isSelected: component.cameraState.isCollageEnabled,
1304+
tintColor: controlsTintColor
12941305
)
1295-
),
1296-
action: { [weak state] in
1297-
if let state {
1298-
state.toggleCollageCamera()
1299-
}
1306+
)
1307+
),
1308+
action: { [weak state] in
1309+
if let state {
1310+
state.toggleCollageCamera()
13001311
}
1301-
).tagged(collageButtonTag),
1302-
availableSize: CGSize(width: 40.0, height: 40.0),
1312+
}
1313+
).tagged(collageButtonTag),
1314+
availableSize: CGSize(width: 40.0, height: 40.0),
1315+
transition: .immediate
1316+
)
1317+
var collageButtonX = nextButtonX
1318+
if rightMostButtonWidth.isZero {
1319+
collageButtonX = availableSize.width - topControlInset - collageButton.size.width / 2.0 - 5.0
1320+
}
1321+
context.add(collageButton
1322+
.position(CGPoint(x: collageButtonX, y: max(environment.statusBarHeight + 5.0, environment.safeInsets.top + topControlInset) + collageButton.size.height / 2.0 + 2.0))
1323+
.appear(.default(scale: true))
1324+
.disappear(.default(scale: true))
1325+
.shadow(Shadow(color: UIColor(white: 0.0, alpha: 0.25), radius: 3.0, offset: .zero))
1326+
)
1327+
nextButtonX -= collageButton.size.width
1328+
1329+
if state.displayingCollageSelection {
1330+
let collageCarousel = collageCarousel.update(
1331+
component: CollageIconCarouselComponent(
1332+
grids: collageGrids.filter { $0 != component.cameraState.collageGrid },
1333+
selected: { [weak state] grid in
1334+
state?.updateCollageGrid(grid)
1335+
}
1336+
),
1337+
availableSize: CGSize(width: nextButtonX + 4.0, height: 40.0),
13031338
transition: .immediate
13041339
)
1305-
var collageButtonX = nextButtonX
1306-
if rightMostButtonWidth.isZero {
1307-
collageButtonX = availableSize.width - topControlInset - collageButton.size.width / 2.0 - 5.0
1308-
}
1309-
context.add(collageButton
1310-
.position(CGPoint(x: collageButtonX, y: max(environment.statusBarHeight + 5.0, environment.safeInsets.top + topControlInset) + collageButton.size.height / 2.0 + 2.0))
1311-
.appear(.default(scale: true))
1312-
.disappear(.default(scale: true))
1313-
.shadow(Shadow(color: UIColor(white: 0.0, alpha: 0.25), radius: 3.0, offset: .zero))
1340+
context.add(collageCarousel
1341+
.position(CGPoint(x: collageCarousel.size.width / 2.0, y: max(environment.statusBarHeight + 5.0, environment.safeInsets.top + topControlInset) + collageCarousel.size.height / 2.0 + 2.0))
1342+
.appear(ComponentTransition.Appear({ _, view, transition in
1343+
if let view = view as? CollageIconCarouselComponent.View, !transition.animation.isImmediate {
1344+
view.animateIn()
1345+
}
1346+
}))
1347+
.disappear(ComponentTransition.Disappear({ view, transition, completion in
1348+
if let view = view as? CollageIconCarouselComponent.View, !transition.animation.isImmediate {
1349+
view.animateOut(completion: completion)
1350+
} else {
1351+
completion()
1352+
}
1353+
}))
13141354
)
1315-
nextButtonX -= collageButton.size.width
1316-
1317-
if state.displayingCollageSelection {
1318-
let collageCarousel = collageCarousel.update(
1319-
component: CollageIconCarouselComponent(
1320-
grids: collageGrids.filter { $0 != component.cameraState.collageGrid },
1321-
selected: { [weak state] grid in
1322-
state?.updateCollageGrid(grid)
1323-
}
1324-
),
1325-
availableSize: CGSize(width: nextButtonX + 4.0, height: 40.0),
1326-
transition: .immediate
1327-
)
1328-
context.add(collageCarousel
1329-
.position(CGPoint(x: collageCarousel.size.width / 2.0, y: max(environment.statusBarHeight + 5.0, environment.safeInsets.top + topControlInset) + collageCarousel.size.height / 2.0 + 2.0))
1330-
.appear(ComponentTransition.Appear({ _, view, transition in
1331-
if let view = view as? CollageIconCarouselComponent.View, !transition.animation.isImmediate {
1332-
view.animateIn()
1333-
}
1334-
}))
1335-
.disappear(ComponentTransition.Disappear({ view, transition, completion in
1336-
if let view = view as? CollageIconCarouselComponent.View, !transition.animation.isImmediate {
1337-
view.animateOut(completion: completion)
1338-
} else {
1339-
completion()
1340-
}
1341-
}))
1342-
)
1343-
}
13441355
}
13451356
}
13461357
}

submodules/TelegramUI/Components/CameraScreen/Sources/CameraVideoLayer.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -299,7 +299,7 @@ final class CameraVideoLayer: MetalEngineSubjectLayer, MetalEngineSubject {
299299

300300
encoder.setFragmentTexture(blurredTexture, index: 0)
301301

302-
var brightness: Float = 0.85
302+
var brightness: Float = 0.95
303303
var saturation: Float = 1.3
304304
var overlay: SIMD4<Float> = SIMD4<Float>()
305305
encoder.setFragmentBytes(&brightness, length: 4, index: 0)

submodules/TelegramUI/Components/LegacyMessageInputPanel/BUILD

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ swift_library(
2424
"//submodules/UndoUI",
2525
"//submodules/TelegramUI/Components/MessageInputPanelComponent",
2626
"//submodules/TelegramUI/Components/LegacyMessageInputPanelInputView",
27+
"//submodules/TelegramNotices",
2728
],
2829
visibility = [
2930
"//visibility:public",

0 commit comments

Comments
 (0)