Skip to content

Commit ee38ee5

Browse files
committed
Various fixes
1 parent fa46338 commit ee38ee5

File tree

18 files changed

+389
-167
lines changed

18 files changed

+389
-167
lines changed

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14315,3 +14315,8 @@ Sorry for the inconvenience.";
1431514315
"Gift.Buy.Confirm.Text.Stars_any" = "**%@** Stars";
1431614316
"Gift.Buy.Confirm.BuyFor_1" = "Buy for %@ Star";
1431714317
"Gift.Buy.Confirm.BuyFor_any" = "Buy for %@ Stars";
14318+
14319+
"Calls.HideCallsTab" = "Hide Calls Tab";
14320+
14321+
"Story.Editor.TooltipSelection_1" = "Tap here to view your %@ story";
14322+
"Story.Editor.TooltipSelection_any" = "Tap here to view your %@ stories";

submodules/CallListUI/Sources/CallListController.swift

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import TelegramBaseController
1616
import InviteLinksUI
1717
import UndoUI
1818
import TelegramCallsUI
19+
import TelegramUIPreferences
1920

2021
public enum CallListControllerMode {
2122
case tab
@@ -734,10 +735,22 @@ public final class CallListController: TelegramBaseController {
734735
return generateTintedImage(image: UIImage(bundleImageName: "Chat/Context Menu/AddUser"), color: theme.contextMenu.primaryColor)
735736
}, action: { [weak self] c, f in
736737
c?.dismiss(completion: { [weak self] in
737-
guard let strongSelf = self else {
738+
guard let self else {
738739
return
739740
}
740-
strongSelf.callPressed()
741+
self.callPressed()
742+
})
743+
})))
744+
items.append(.action(ContextMenuActionItem(text: self.presentationData.strings.Calls_HideCallsTab, icon: { theme in
745+
return generateTintedImage(image: UIImage(bundleImageName: "Peer Info/HideIcon"), color: theme.contextMenu.primaryColor)
746+
}, action: { [weak self] c, f in
747+
c?.dismiss(completion: { [weak self] in
748+
guard let self else {
749+
return
750+
}
751+
let _ = updateCallListSettingsInteractively(accountManager: self.context.sharedContext.accountManager, {
752+
$0.withUpdatedShowTab(false)
753+
}).start()
741754
})
742755
})))
743756

submodules/ChatListUI/Sources/ChatListControllerNode.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1015,7 +1015,7 @@ public final class ChatListContainerNode: ASDisplayNode, ASGestureRecognizerDele
10151015
}
10161016
}
10171017

1018-
itemNode.listNode.isMainTab.set(self.availableFilters.firstIndex(where: { $0.id == id }) == 0 ? true : false)
1018+
itemNode.listNode.isMainTab.set(self.availableFilters.firstIndex(where: { $0.id == id }) == 0)
10191019
itemNode.updateLayout(size: layout.size, insets: insets, visualNavigationHeight: visualNavigationHeight, originalNavigationHeight: originalNavigationHeight, inlineNavigationLocation: inlineNavigationLocation, inlineNavigationTransitionFraction: itemInlineNavigationTransitionFraction, storiesInset: storiesInset, transition: nodeTransition)
10201020
if let scrollingOffset = self.scrollingOffset {
10211021
itemNode.updateScrollingOffset(navigationHeight: scrollingOffset.navigationHeight, offset: scrollingOffset.offset, transition: nodeTransition)

submodules/ChatListUI/Sources/Node/ChatListNode.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2092,8 +2092,6 @@ public final class ChatListNode: ListView {
20922092
return .single(.setupPhoto(accountPeer))
20932093
} else if suggestions.contains(.gracePremium) {
20942094
return .single(.premiumGrace)
2095-
} else if suggestions.contains(.setupBirthday) && birthday == nil {
2096-
return .single(.setupBirthday)
20972095
} else if suggestions.contains(.xmasPremiumGift) {
20982096
return .single(.xmasPremiumGift)
20992097
} else if suggestions.contains(.annualPremium) || suggestions.contains(.upgradePremium) || suggestions.contains(.restorePremium), let inAppPurchaseManager = context.inAppPurchaseManager {
@@ -2149,6 +2147,8 @@ public final class ChatListNode: ListView {
21492147
}
21502148
return .birthdayPremiumGift(peers: todayBirthdayPeers, birthdays: birthdays)
21512149
}
2150+
} else if suggestions.contains(.setupBirthday) && birthday == nil {
2151+
return .single(.setupBirthday)
21522152
} else if case let .link(id, url, title, subtitle) = suggestions.first(where: { if case .link = $0 { return true } else { return false} }) {
21532153
return .single(.link(id: id, url: url, title: title, subtitle: subtitle))
21542154
} else {

submodules/Components/ReactionButtonListComponent/Sources/ReactionButtonListComponent.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -501,7 +501,7 @@ public final class ReactionButtonAsyncNode: ContextControllerSourceView {
501501
animationFraction = max(0.0, min(1.0, (CACurrentMediaTime() - animationState.startTime) / animationState.duration))
502502
animationFraction = animationState.curve.solve(at: animationFraction)
503503
if animationState.fromExtracted != isExtracted {
504-
fixedTransitionDirection = isExtracted ? true : false
504+
fixedTransitionDirection = isExtracted
505505
}
506506
} else {
507507
animationFraction = 1.0

submodules/ContextUI/Sources/ContextController.swift

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -527,7 +527,12 @@ final class ContextControllerNode: ViewControllerTracingNode, ASScrollViewDelega
527527
guard let strongSelf = self, let _ = gesture else {
528528
return
529529
}
530-
let localPoint = strongSelf.view.convert(point, from: view)
530+
let localPoint: CGPoint
531+
if let layout = strongSelf.validLayout, layout.metrics.isTablet, layout.size.width > layout.size.height, let view {
532+
localPoint = view.convert(point, to: nil)
533+
} else {
534+
localPoint = strongSelf.view.convert(point, from: view)
535+
}
531536
let initialPoint: CGPoint
532537
if let current = strongSelf.initialContinueGesturePoint {
533538
initialPoint = current

submodules/DrawingUI/Sources/ColorPickerScreen.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -697,7 +697,7 @@ final class ColorGridComponent: Component {
697697
bottomRightRadius = largeCornerRadius
698698
}
699699

700-
let isLight = (selectedColor?.toUIColor().lightness ?? 1.0) < 0.5 ? true : false
700+
let isLight = (selectedColor?.toUIColor().lightness ?? 1.0) < 0.5
701701

702702
var selectionKnobImage = ColorSelectionImage(size: CGSize(width: squareSize, height: squareSize), topLeftRadius: topLeftRadius, topRightRadius: topRightRadius, bottomLeftRadius: bottomLeftRadius, bottomRightRadius: bottomRightRadius, isLight: isLight)
703703
if selectionKnobImage != self.selectionKnobImage {

submodules/TelegramNotices/Sources/Notices.swift

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,7 @@ private enum ApplicationSpecificGlobalNotice: Int32 {
203203
case channelSendGiftTooltip = 76
204204
case starGiftWearTips = 77
205205
case channelSuggestTooltip = 78
206+
case multipleStoriesTooltip = 79
206207

207208
var key: ValueBoxKey {
208209
let v = ValueBoxKey(length: 4)
@@ -564,6 +565,10 @@ private struct ApplicationSpecificNoticeKeys {
564565
static func channelSuggestTooltip() -> NoticeEntryKey {
565566
return NoticeEntryKey(namespace: noticeNamespace(namespace: globalNamespace), key: ApplicationSpecificGlobalNotice.channelSuggestTooltip.key)
566567
}
568+
569+
static func multipleStoriesTooltip() -> NoticeEntryKey {
570+
return NoticeEntryKey(namespace: noticeNamespace(namespace: globalNamespace), key: ApplicationSpecificGlobalNotice.multipleStoriesTooltip.key)
571+
}
567572
}
568573

569574
public struct ApplicationSpecificNotice {
@@ -2426,4 +2431,31 @@ public struct ApplicationSpecificNotice {
24262431
return Int(previousValue)
24272432
}
24282433
}
2434+
2435+
public static func getMultipleStoriesTooltip(accountManager: AccountManager<TelegramAccountManagerTypes>) -> Signal<Int32, NoError> {
2436+
return accountManager.transaction { transaction -> Int32 in
2437+
if let value = transaction.getNotice(ApplicationSpecificNoticeKeys.multipleStoriesTooltip())?.get(ApplicationSpecificCounterNotice.self) {
2438+
return value.value
2439+
} else {
2440+
return 0
2441+
}
2442+
}
2443+
}
2444+
2445+
public static func incrementMultipleStoriesTooltip(accountManager: AccountManager<TelegramAccountManagerTypes>, count: Int = 1) -> Signal<Int, NoError> {
2446+
return accountManager.transaction { transaction -> Int in
2447+
var currentValue: Int32 = 0
2448+
if let value = transaction.getNotice(ApplicationSpecificNoticeKeys.multipleStoriesTooltip())?.get(ApplicationSpecificCounterNotice.self) {
2449+
currentValue = value.value
2450+
}
2451+
let previousValue = currentValue
2452+
currentValue += Int32(count)
2453+
2454+
if let entry = CodableEntry(ApplicationSpecificCounterNotice(value: currentValue)) {
2455+
transaction.setNotice(ApplicationSpecificNoticeKeys.multipleStoriesTooltip(), entry)
2456+
}
2457+
2458+
return Int(previousValue)
2459+
}
2460+
}
24292461
}

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

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3630,7 +3630,13 @@ public class CameraScreenImpl: ViewController, CameraScreen {
36303630
self.node.resumeCameraCapture(fromGallery: true)
36313631
}
36323632

3633-
var dismissControllerImpl: (() -> Void)?
3633+
class DismissArgs {
3634+
var resumeOnDismiss = true
3635+
}
3636+
3637+
var dismissControllerImpl: ((Bool) -> Void)?
3638+
let dismissArgs = DismissArgs()
3639+
36343640
let controller: ViewController
36353641
if let current = self.galleryController {
36363642
controller = current
@@ -3686,7 +3692,7 @@ public class CameraScreenImpl: ViewController, CameraScreen {
36863692
}
36873693
}
36883694

3689-
dismissControllerImpl?()
3695+
dismissControllerImpl?(true)
36903696
} else {
36913697
stopCameraCapture()
36923698

@@ -3759,17 +3765,19 @@ public class CameraScreenImpl: ViewController, CameraScreen {
37593765
self.node.collage?.addResults(signals: results)
37603766
}
37613767
} else {
3768+
self.node.animateOutToEditor()
37623769
if let assets = results as? [PHAsset] {
37633770
self.completion(.single(.assets(assets)), nil, self.remainingStoryCount, {
3764-
37653771
})
37663772
}
37673773
}
37683774
self.galleryController = nil
37693775

3770-
dismissControllerImpl?()
3776+
dismissControllerImpl?(false)
37713777
}, dismissed: { [weak self] in
3772-
resumeCameraCapture()
3778+
if dismissArgs.resumeOnDismiss {
3779+
resumeCameraCapture()
3780+
}
37733781
if let self {
37743782
self.node.hasGallery = false
37753783
self.node.requestUpdateLayout(transition: .immediate)
@@ -3780,7 +3788,8 @@ public class CameraScreenImpl: ViewController, CameraScreen {
37803788
)
37813789
self.galleryController = controller
37823790

3783-
dismissControllerImpl = { [weak controller] in
3791+
dismissControllerImpl = { [weak controller] resume in
3792+
dismissArgs.resumeOnDismiss = resume
37843793
controller?.dismiss(animated: true)
37853794
}
37863795
}

submodules/TelegramUI/Components/Gifts/GiftOptionsScreen/Sources/GiftOptionsScreen.swift

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,8 @@ final class GiftOptionsScreenComponent: Component {
235235

236236
private var chevronImage: (UIImage, PresentationTheme)?
237237

238+
private var resaleConfiguration: StarsSubscriptionConfiguration?
239+
238240
override init(frame: CGRect) {
239241
self.scrollView = ScrollView()
240242
self.scrollView.showsVerticalScrollIndicator = true
@@ -408,9 +410,14 @@ final class GiftOptionsScreenComponent: Component {
408410
switch gift {
409411
case let .generic(gift):
410412
if let availability = gift.availability, availability.remains == 0, let minResaleStars = availability.minResaleStars {
411-
subject = .starGift(gift: gift, price: "⭐️ \(minResaleStars)+")
413+
let priceString = presentationStringsFormattedNumber(Int32(minResaleStars), environment.dateTimeFormat.groupingSeparator)
414+
if let resaleConfiguration = self.resaleConfiguration, minResaleStars == resaleConfiguration.starGiftResaleMaxAmount || availability.resale == 1 {
415+
subject = .starGift(gift: gift, price: "⭐️ \(priceString)")
416+
} else {
417+
subject = .starGift(gift: gift, price: "⭐️ \(priceString)+")
418+
}
412419
} else {
413-
subject = .starGift(gift: gift, price: "⭐️ \(gift.price)")
420+
subject = .starGift(gift: gift, price: "⭐️ \(presentationStringsFormattedNumber(Int32(gift.price), environment.dateTimeFormat.groupingSeparator))")
414421
}
415422
case let .unique(gift):
416423
subject = .uniqueGift(gift: gift, price: nil)
@@ -773,6 +780,8 @@ final class GiftOptionsScreenComponent: Component {
773780
self.optionsPromise.set(component.context.engine.payments.starsTopUpOptions()
774781
|> map(Optional.init))
775782
}
783+
784+
self.resaleConfiguration = StarsSubscriptionConfiguration.with(appConfiguration: component.context.currentAppConfiguration.with { $0 })
776785
}
777786
self.component = component
778787

0 commit comments

Comments
 (0)