mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-06-15 13:35:19 +00:00
Various fixes
This commit is contained in:
parent
c4731d8b8d
commit
1ed853e255
@ -283,7 +283,7 @@ final class NavigationModalContainer: ASDisplayNode, ASScrollViewDelegate, ASGes
|
||||
let transition: ContainedViewLayoutTransition
|
||||
let dismissProgress: CGFloat
|
||||
if (velocity.y < -0.5 || progress >= 0.5) && self.checkInteractiveDismissWithControllers() {
|
||||
if let controller = self.container.controllers.last as? MinimizableController {
|
||||
if let controller = self.container.controllers.last as? MinimizableController, controller.isMinimizable {
|
||||
dismissProgress = 0.0
|
||||
targetOffset = 0.0
|
||||
transition = .immediate
|
||||
|
@ -370,7 +370,7 @@ class ItemListStickerPackItemNode: ItemListRevealOptionsItemNode {
|
||||
}
|
||||
|
||||
let packRevealOptions: [ItemListRevealOption]
|
||||
if item.editing.editable && item.enabled {
|
||||
if item.editing.editable && item.enabled && !item.editing.editing {
|
||||
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)]
|
||||
} else {
|
||||
packRevealOptions = []
|
||||
@ -564,7 +564,7 @@ class ItemListStickerPackItemNode: ItemListRevealOptionsItemNode {
|
||||
strongSelf.highlightedBackgroundNode.backgroundColor = item.presentationData.theme.list.itemHighlightedBackgroundColor
|
||||
}
|
||||
|
||||
let revealOffset = strongSelf.revealOffset
|
||||
let revealOffset = !packRevealOptions.isEmpty ? strongSelf.revealOffset : 0.0
|
||||
|
||||
let transition: ContainedViewLayoutTransition
|
||||
if animated {
|
||||
|
@ -1062,7 +1062,7 @@ public func installedStickerPacksController(context: AccountContext, mode: Insta
|
||||
} else {
|
||||
rightNavigationButton = ItemListNavigationButton(content: .text(presentationData.strings.Common_Edit), style: .regular, enabled: true, action: {
|
||||
updateState {
|
||||
$0.withUpdatedEditing(true).withUpdatedSelectedPackIds(Set())
|
||||
$0.withUpdatedEditing(true).withUpdatedPackIdWithRevealedOptions(nil).withUpdatedSelectedPackIds(Set())
|
||||
}
|
||||
})
|
||||
}
|
||||
|
@ -653,6 +653,9 @@ private extension StarsContext.State.Transaction {
|
||||
if (apiFlags & (1 << 21)) != 0 {
|
||||
flags.insert(.isBusinessTransfer)
|
||||
}
|
||||
if (apiFlags & (1 << 22)) != 0 {
|
||||
flags.insert(.isStarGiftResale)
|
||||
}
|
||||
|
||||
let media = extendedMedia.flatMap({ $0.compactMap { textMediaAndExpirationTimerFromApiMedia($0, PeerId(0)).media } }) ?? []
|
||||
let _ = subscriptionPeriod
|
||||
@ -706,6 +709,7 @@ public final class StarsContext {
|
||||
public static let isStarGiftUpgrade = Flags(rawValue: 1 << 6)
|
||||
public static let isPaidMessage = Flags(rawValue: 1 << 7)
|
||||
public static let isBusinessTransfer = Flags(rawValue: 1 << 8)
|
||||
public static let isStarGiftResale = Flags(rawValue: 1 << 9)
|
||||
}
|
||||
|
||||
public enum Peer: Equatable {
|
||||
|
@ -101,7 +101,7 @@ private final class QuickShareToastScreenComponent: Component {
|
||||
}
|
||||
|
||||
func animateIn() {
|
||||
guard let component = self.component else {
|
||||
guard let component = self.component, let environment = self.environment else {
|
||||
return
|
||||
}
|
||||
func generateAvatarParabollicMotionKeyframes(from sourcePoint: CGPoint, to targetPosition: CGPoint, elevation: CGFloat) -> [CGPoint] {
|
||||
@ -153,7 +153,7 @@ private final class QuickShareToastScreenComponent: Component {
|
||||
playIconAnimation(0.2)
|
||||
}
|
||||
|
||||
let offset = self.bounds.height - self.backgroundView.frame.minY
|
||||
let offset = self.bounds.height - environment.inputHeight - self.backgroundView.frame.minY
|
||||
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
|
||||
if component.peer.id != component.context.account.peerId {
|
||||
playIconAnimation(0.1)
|
||||
@ -203,12 +203,8 @@ private final class QuickShareToastScreenComponent: Component {
|
||||
|
||||
let contentInsets = UIEdgeInsets(top: 10.0, left: 12.0, bottom: 10.0, right: 10.0)
|
||||
|
||||
let tabBarHeight: CGFloat
|
||||
if !environment.safeInsets.left.isZero {
|
||||
tabBarHeight = 34.0 + environment.safeInsets.bottom
|
||||
} else {
|
||||
tabBarHeight = 49.0 + environment.safeInsets.bottom
|
||||
}
|
||||
let tabBarHeight = 49.0 + max(environment.safeInsets.bottom, environment.inputHeight)
|
||||
|
||||
let containerInsets = UIEdgeInsets(
|
||||
top: environment.safeInsets.top,
|
||||
left: environment.safeInsets.left + 12.0,
|
||||
@ -394,8 +390,12 @@ public final class QuickShareToastScreen: ViewControllerComponentContainer {
|
||||
super.dismiss()
|
||||
}
|
||||
|
||||
private var didCommit = false
|
||||
public func dismissWithCommitAction() {
|
||||
self.action(.commit)
|
||||
if !self.didCommit {
|
||||
self.didCommit = true
|
||||
self.action(.commit)
|
||||
}
|
||||
self.dismiss()
|
||||
}
|
||||
|
||||
|
@ -470,10 +470,8 @@ private final class GiftViewSheetContent: CombinedComponent {
|
||||
}
|
||||
|
||||
if let navigationController = controller.navigationController as? NavigationController {
|
||||
if recipientPeerId == self.context.account.peerId {
|
||||
var controllers = navigationController.viewControllers
|
||||
controllers = controllers.filter({ !($0 is GiftViewScreen) })
|
||||
navigationController.setViewControllers(controllers, animated: true)
|
||||
if recipientPeerId == self.context.account.peerId {
|
||||
controller.dismissAnimated()
|
||||
|
||||
navigationController.view.addSubview(ConfettiView(frame: navigationController.view.bounds))
|
||||
|
||||
@ -516,7 +514,6 @@ private final class GiftViewSheetContent: CombinedComponent {
|
||||
}
|
||||
}
|
||||
|
||||
controller.animateSuccess()
|
||||
self.updated(transition: .spring(duration: 0.4))
|
||||
|
||||
Queue.mainQueue().after(0.5) {
|
||||
|
@ -7386,7 +7386,7 @@ public final class MediaEditorScreenImpl: ViewController, MediaEditorScreen, UID
|
||||
return true
|
||||
}
|
||||
|
||||
private func processMultipleItems(items: [EditingItem]) {
|
||||
private func processMultipleItems(items: [EditingItem], isLongVideo: Bool) {
|
||||
guard !items.isEmpty else {
|
||||
return
|
||||
}
|
||||
@ -7428,7 +7428,7 @@ public final class MediaEditorScreenImpl: ViewController, MediaEditorScreen, UID
|
||||
order.append(randomId)
|
||||
|
||||
if item.asset.mediaType == .video {
|
||||
processVideoItem(item: item, index: index, randomId: randomId) { result in
|
||||
processVideoItem(item: item, index: index, randomId: randomId, isLongVideo: isLongVideo) { result in
|
||||
let _ = multipleResults.modify { results in
|
||||
var updatedResults = results
|
||||
updatedResults.append(result)
|
||||
@ -7473,7 +7473,7 @@ public final class MediaEditorScreenImpl: ViewController, MediaEditorScreen, UID
|
||||
}
|
||||
}
|
||||
|
||||
private func processVideoItem(item: EditingItem, index: Int, randomId: Int64, completion: @escaping (MediaEditorScreenImpl.Result) -> Void) {
|
||||
private func processVideoItem(item: EditingItem, index: Int, randomId: Int64, isLongVideo: Bool, completion: @escaping (MediaEditorScreenImpl.Result) -> Void) {
|
||||
let asset = item.asset
|
||||
|
||||
let itemMediaEditor = setupMediaEditorForItem(item: item)
|
||||
@ -7494,10 +7494,10 @@ public final class MediaEditorScreenImpl: ViewController, MediaEditorScreen, UID
|
||||
}
|
||||
|
||||
let firstFrameTime: CMTime
|
||||
if let coverImageTimestamp = item.values?.coverImageTimestamp {
|
||||
if let coverImageTimestamp = item.values?.coverImageTimestamp, !isLongVideo || index == 0 {
|
||||
firstFrameTime = CMTime(seconds: coverImageTimestamp, preferredTimescale: CMTimeScale(60))
|
||||
} else {
|
||||
firstFrameTime = .zero
|
||||
firstFrameTime = CMTime(seconds: item.values?.videoTrimRange?.lowerBound ?? 0.0, preferredTimescale: CMTimeScale(60))
|
||||
}
|
||||
|
||||
PHImageManager.default().requestAVAsset(forVideo: asset, options: nil) { [weak self] avAsset, _, _ in
|
||||
@ -7641,11 +7641,15 @@ public final class MediaEditorScreenImpl: ViewController, MediaEditorScreen, UID
|
||||
}
|
||||
|
||||
private func setupMediaEditorForItem(item: EditingItem) -> MediaEditor {
|
||||
var values = item.values
|
||||
if values?.videoTrimRange == nil {
|
||||
values = values?.withUpdatedVideoTrimRange(0 ..< storyMaxVideoDuration)
|
||||
}
|
||||
return MediaEditor(
|
||||
context: self.context,
|
||||
mode: .default,
|
||||
subject: .asset(item.asset),
|
||||
values: item.values,
|
||||
values: values,
|
||||
hasHistogram: false,
|
||||
isStandalone: true
|
||||
)
|
||||
@ -8160,6 +8164,7 @@ public final class MediaEditorScreenImpl: ViewController, MediaEditorScreen, UID
|
||||
}
|
||||
|
||||
var multipleItems: [EditingItem] = []
|
||||
var isLongVideo = false
|
||||
if self.node.items.count > 1 {
|
||||
multipleItems = self.node.items.filter({ $0.isEnabled })
|
||||
} else if case let .asset(asset) = self.node.subject {
|
||||
@ -8187,11 +8192,12 @@ public final class MediaEditorScreenImpl: ViewController, MediaEditorScreen, UID
|
||||
|
||||
start += storyMaxVideoDuration
|
||||
}
|
||||
isLongVideo = true
|
||||
}
|
||||
}
|
||||
|
||||
if multipleItems.count > 1 {
|
||||
self.processMultipleItems(items: multipleItems)
|
||||
self.processMultipleItems(items: multipleItems, isLongVideo: isLongVideo)
|
||||
} else {
|
||||
self.processSingleItem()
|
||||
}
|
||||
|
@ -2991,8 +2991,8 @@ public final class SharedAccountContextImpl: SharedAccountContext {
|
||||
let _ = (combineLatest(
|
||||
queue: Queue.mainQueue(),
|
||||
controller.result,
|
||||
options.get())
|
||||
|> take(1)).startStandalone(next: { [weak controller] result, options in
|
||||
options.get() |> distinctUntilChanged
|
||||
)).startStandalone(next: { [weak controller] result, options in
|
||||
if let (peers, _, _, _, _, _) = result, let contactPeer = peers.first, case let .peer(peer, _, _) = contactPeer, let starsContext = context.starsContext {
|
||||
if case .starGiftTransfer = source {
|
||||
presentTransferAlertImpl?(EnginePeer(peer))
|
||||
|
Loading…
x
Reference in New Issue
Block a user