Skip to content

Commit 1ed853e

Browse files
committed
Various fixes
1 parent c4731d8 commit 1ed853e

File tree

8 files changed

+34
-27
lines changed

8 files changed

+34
-27
lines changed

submodules/Display/Source/Navigation/NavigationModalContainer.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,7 @@ final class NavigationModalContainer: ASDisplayNode, ASScrollViewDelegate, ASGes
283283
let transition: ContainedViewLayoutTransition
284284
let dismissProgress: CGFloat
285285
if (velocity.y < -0.5 || progress >= 0.5) && self.checkInteractiveDismissWithControllers() {
286-
if let controller = self.container.controllers.last as? MinimizableController {
286+
if let controller = self.container.controllers.last as? MinimizableController, controller.isMinimizable {
287287
dismissProgress = 0.0
288288
targetOffset = 0.0
289289
transition = .immediate

submodules/ItemListStickerPackItem/Sources/ItemListStickerPackItem.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -370,7 +370,7 @@ class ItemListStickerPackItemNode: ItemListRevealOptionsItemNode {
370370
}
371371

372372
let packRevealOptions: [ItemListRevealOption]
373-
if item.editing.editable && item.enabled {
373+
if item.editing.editable && item.enabled && !item.editing.editing {
374374
packRevealOptions = [ItemListRevealOption(key: 0, title: item.presentationData.strings.Common_Delete, icon: .none, color: item.presentationData.theme.list.itemDisclosureActions.destructive.fillColor, textColor: item.presentationData.theme.list.itemDisclosureActions.destructive.foregroundColor)]
375375
} else {
376376
packRevealOptions = []
@@ -564,7 +564,7 @@ class ItemListStickerPackItemNode: ItemListRevealOptionsItemNode {
564564
strongSelf.highlightedBackgroundNode.backgroundColor = item.presentationData.theme.list.itemHighlightedBackgroundColor
565565
}
566566

567-
let revealOffset = strongSelf.revealOffset
567+
let revealOffset = !packRevealOptions.isEmpty ? strongSelf.revealOffset : 0.0
568568

569569
let transition: ContainedViewLayoutTransition
570570
if animated {

submodules/SettingsUI/Sources/Stickers/InstalledStickerPacksController.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1062,7 +1062,7 @@ public func installedStickerPacksController(context: AccountContext, mode: Insta
10621062
} else {
10631063
rightNavigationButton = ItemListNavigationButton(content: .text(presentationData.strings.Common_Edit), style: .regular, enabled: true, action: {
10641064
updateState {
1065-
$0.withUpdatedEditing(true).withUpdatedSelectedPackIds(Set())
1065+
$0.withUpdatedEditing(true).withUpdatedPackIdWithRevealedOptions(nil).withUpdatedSelectedPackIds(Set())
10661066
}
10671067
})
10681068
}

submodules/TelegramCore/Sources/TelegramEngine/Payments/Stars.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -653,6 +653,9 @@ private extension StarsContext.State.Transaction {
653653
if (apiFlags & (1 << 21)) != 0 {
654654
flags.insert(.isBusinessTransfer)
655655
}
656+
if (apiFlags & (1 << 22)) != 0 {
657+
flags.insert(.isStarGiftResale)
658+
}
656659

657660
let media = extendedMedia.flatMap({ $0.compactMap { textMediaAndExpirationTimerFromApiMedia($0, PeerId(0)).media } }) ?? []
658661
let _ = subscriptionPeriod
@@ -706,6 +709,7 @@ public final class StarsContext {
706709
public static let isStarGiftUpgrade = Flags(rawValue: 1 << 6)
707710
public static let isPaidMessage = Flags(rawValue: 1 << 7)
708711
public static let isBusinessTransfer = Flags(rawValue: 1 << 8)
712+
public static let isStarGiftResale = Flags(rawValue: 1 << 9)
709713
}
710714

711715
public enum Peer: Equatable {

submodules/TelegramUI/Components/Chat/QuickShareScreen/Sources/QuickShareToastScreen.swift

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ private final class QuickShareToastScreenComponent: Component {
101101
}
102102

103103
func animateIn() {
104-
guard let component = self.component else {
104+
guard let component = self.component, let environment = self.environment else {
105105
return
106106
}
107107
func generateAvatarParabollicMotionKeyframes(from sourcePoint: CGPoint, to targetPosition: CGPoint, elevation: CGFloat) -> [CGPoint] {
@@ -153,7 +153,7 @@ private final class QuickShareToastScreenComponent: Component {
153153
playIconAnimation(0.2)
154154
}
155155

156-
let offset = self.bounds.height - self.backgroundView.frame.minY
156+
let offset = self.bounds.height - environment.inputHeight - self.backgroundView.frame.minY
157157
self.backgroundView.layer.animatePosition(from: CGPoint(x: 0.0, y: offset), to: CGPoint(), duration: 0.35, delay: 0.0, timingFunction: kCAMediaTimingFunctionSpring, removeOnCompletion: false, additive: true, completion: { _ in
158158
if component.peer.id != component.context.account.peerId {
159159
playIconAnimation(0.1)
@@ -203,12 +203,8 @@ private final class QuickShareToastScreenComponent: Component {
203203

204204
let contentInsets = UIEdgeInsets(top: 10.0, left: 12.0, bottom: 10.0, right: 10.0)
205205

206-
let tabBarHeight: CGFloat
207-
if !environment.safeInsets.left.isZero {
208-
tabBarHeight = 34.0 + environment.safeInsets.bottom
209-
} else {
210-
tabBarHeight = 49.0 + environment.safeInsets.bottom
211-
}
206+
let tabBarHeight = 49.0 + max(environment.safeInsets.bottom, environment.inputHeight)
207+
212208
let containerInsets = UIEdgeInsets(
213209
top: environment.safeInsets.top,
214210
left: environment.safeInsets.left + 12.0,
@@ -394,8 +390,12 @@ public final class QuickShareToastScreen: ViewControllerComponentContainer {
394390
super.dismiss()
395391
}
396392

393+
private var didCommit = false
397394
public func dismissWithCommitAction() {
398-
self.action(.commit)
395+
if !self.didCommit {
396+
self.didCommit = true
397+
self.action(.commit)
398+
}
399399
self.dismiss()
400400
}
401401

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

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -470,10 +470,8 @@ private final class GiftViewSheetContent: CombinedComponent {
470470
}
471471

472472
if let navigationController = controller.navigationController as? NavigationController {
473-
if recipientPeerId == self.context.account.peerId {
474-
var controllers = navigationController.viewControllers
475-
controllers = controllers.filter({ !($0 is GiftViewScreen) })
476-
navigationController.setViewControllers(controllers, animated: true)
473+
if recipientPeerId == self.context.account.peerId {
474+
controller.dismissAnimated()
477475

478476
navigationController.view.addSubview(ConfettiView(frame: navigationController.view.bounds))
479477

@@ -516,7 +514,6 @@ private final class GiftViewSheetContent: CombinedComponent {
516514
}
517515
}
518516

519-
controller.animateSuccess()
520517
self.updated(transition: .spring(duration: 0.4))
521518

522519
Queue.mainQueue().after(0.5) {

submodules/TelegramUI/Components/MediaEditorScreen/Sources/MediaEditorScreen.swift

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7386,7 +7386,7 @@ public final class MediaEditorScreenImpl: ViewController, MediaEditorScreen, UID
73867386
return true
73877387
}
73887388

7389-
private func processMultipleItems(items: [EditingItem]) {
7389+
private func processMultipleItems(items: [EditingItem], isLongVideo: Bool) {
73907390
guard !items.isEmpty else {
73917391
return
73927392
}
@@ -7428,7 +7428,7 @@ public final class MediaEditorScreenImpl: ViewController, MediaEditorScreen, UID
74287428
order.append(randomId)
74297429

74307430
if item.asset.mediaType == .video {
7431-
processVideoItem(item: item, index: index, randomId: randomId) { result in
7431+
processVideoItem(item: item, index: index, randomId: randomId, isLongVideo: isLongVideo) { result in
74327432
let _ = multipleResults.modify { results in
74337433
var updatedResults = results
74347434
updatedResults.append(result)
@@ -7473,7 +7473,7 @@ public final class MediaEditorScreenImpl: ViewController, MediaEditorScreen, UID
74737473
}
74747474
}
74757475

7476-
private func processVideoItem(item: EditingItem, index: Int, randomId: Int64, completion: @escaping (MediaEditorScreenImpl.Result) -> Void) {
7476+
private func processVideoItem(item: EditingItem, index: Int, randomId: Int64, isLongVideo: Bool, completion: @escaping (MediaEditorScreenImpl.Result) -> Void) {
74777477
let asset = item.asset
74787478

74797479
let itemMediaEditor = setupMediaEditorForItem(item: item)
@@ -7494,10 +7494,10 @@ public final class MediaEditorScreenImpl: ViewController, MediaEditorScreen, UID
74947494
}
74957495

74967496
let firstFrameTime: CMTime
7497-
if let coverImageTimestamp = item.values?.coverImageTimestamp {
7497+
if let coverImageTimestamp = item.values?.coverImageTimestamp, !isLongVideo || index == 0 {
74987498
firstFrameTime = CMTime(seconds: coverImageTimestamp, preferredTimescale: CMTimeScale(60))
74997499
} else {
7500-
firstFrameTime = .zero
7500+
firstFrameTime = CMTime(seconds: item.values?.videoTrimRange?.lowerBound ?? 0.0, preferredTimescale: CMTimeScale(60))
75017501
}
75027502

75037503
PHImageManager.default().requestAVAsset(forVideo: asset, options: nil) { [weak self] avAsset, _, _ in
@@ -7641,11 +7641,15 @@ public final class MediaEditorScreenImpl: ViewController, MediaEditorScreen, UID
76417641
}
76427642

76437643
private func setupMediaEditorForItem(item: EditingItem) -> MediaEditor {
7644+
var values = item.values
7645+
if values?.videoTrimRange == nil {
7646+
values = values?.withUpdatedVideoTrimRange(0 ..< storyMaxVideoDuration)
7647+
}
76447648
return MediaEditor(
76457649
context: self.context,
76467650
mode: .default,
76477651
subject: .asset(item.asset),
7648-
values: item.values,
7652+
values: values,
76497653
hasHistogram: false,
76507654
isStandalone: true
76517655
)
@@ -8160,6 +8164,7 @@ public final class MediaEditorScreenImpl: ViewController, MediaEditorScreen, UID
81608164
}
81618165

81628166
var multipleItems: [EditingItem] = []
8167+
var isLongVideo = false
81638168
if self.node.items.count > 1 {
81648169
multipleItems = self.node.items.filter({ $0.isEnabled })
81658170
} else if case let .asset(asset) = self.node.subject {
@@ -8187,11 +8192,12 @@ public final class MediaEditorScreenImpl: ViewController, MediaEditorScreen, UID
81878192

81888193
start += storyMaxVideoDuration
81898194
}
8195+
isLongVideo = true
81908196
}
81918197
}
81928198

81938199
if multipleItems.count > 1 {
8194-
self.processMultipleItems(items: multipleItems)
8200+
self.processMultipleItems(items: multipleItems, isLongVideo: isLongVideo)
81958201
} else {
81968202
self.processSingleItem()
81978203
}

submodules/TelegramUI/Sources/SharedAccountContext.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2991,8 +2991,8 @@ public final class SharedAccountContextImpl: SharedAccountContext {
29912991
let _ = (combineLatest(
29922992
queue: Queue.mainQueue(),
29932993
controller.result,
2994-
options.get())
2995-
|> take(1)).startStandalone(next: { [weak controller] result, options in
2994+
options.get() |> distinctUntilChanged
2995+
)).startStandalone(next: { [weak controller] result, options in
29962996
if let (peers, _, _, _, _, _) = result, let contactPeer = peers.first, case let .peer(peer, _, _) = contactPeer, let starsContext = context.starsContext {
29972997
if case .starGiftTransfer = source {
29982998
presentTransferAlertImpl?(EnginePeer(peer))

0 commit comments

Comments
 (0)