mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-01 04:08:07 +00:00
Merge commit '58cc60eaa1fcfa4a489ab345ac84a4b6a146c6b9'
This commit is contained in:
commit
69f662b17f
@ -29,6 +29,7 @@
|
|||||||
|
|
||||||
@property (nonatomic, copy) void (^tabsChanged)(void);
|
@property (nonatomic, copy) void (^tabsChanged)(void);
|
||||||
|
|
||||||
|
@property (nonatomic, copy) bool (^isVideoPlaying)();
|
||||||
@property (nonatomic, copy) void (^controlVideoPlayback)(bool);
|
@property (nonatomic, copy) void (^controlVideoPlayback)(bool);
|
||||||
@property (nonatomic, copy) void (^controlVideoSeek)(NSTimeInterval);
|
@property (nonatomic, copy) void (^controlVideoSeek)(NSTimeInterval);
|
||||||
@property (nonatomic, copy) void (^controlVideoEndTime)(NSTimeInterval);
|
@property (nonatomic, copy) void (^controlVideoEndTime)(NSTimeInterval);
|
||||||
|
|||||||
@ -43,6 +43,8 @@ const CGFloat TGPhotoAvatarPreviewLandscapePanelSize = TGPhotoAvatarPreviewPanel
|
|||||||
UIView *_landscapeToolControlView;
|
UIView *_landscapeToolControlView;
|
||||||
UILabel *_coverLabel;
|
UILabel *_coverLabel;
|
||||||
|
|
||||||
|
bool _wasPlayingBeforeCropping;
|
||||||
|
|
||||||
bool _scheduledTransitionIn;
|
bool _scheduledTransitionIn;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -80,6 +82,10 @@ const CGFloat TGPhotoAvatarPreviewLandscapePanelSize = TGPhotoAvatarPreviewPanel
|
|||||||
if (strongSelf == nil)
|
if (strongSelf == nil)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if (strongSelf.isVideoPlaying != nil) {
|
||||||
|
strongSelf->_wasPlayingBeforeCropping = strongSelf.isVideoPlaying();
|
||||||
|
}
|
||||||
|
|
||||||
strongSelf.controlVideoPlayback(false);
|
strongSelf.controlVideoPlayback(false);
|
||||||
};
|
};
|
||||||
void(^interactionEnded)(void) = ^
|
void(^interactionEnded)(void) = ^
|
||||||
@ -91,7 +97,9 @@ const CGFloat TGPhotoAvatarPreviewLandscapePanelSize = TGPhotoAvatarPreviewPanel
|
|||||||
if ([strongSelf shouldAutorotate])
|
if ([strongSelf shouldAutorotate])
|
||||||
[TGViewController attemptAutorotation];
|
[TGViewController attemptAutorotation];
|
||||||
|
|
||||||
|
if (strongSelf->_wasPlayingBeforeCropping) {
|
||||||
strongSelf.controlVideoPlayback(true);
|
strongSelf.controlVideoPlayback(true);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
PGPhotoEditor *photoEditor = self.photoEditor;
|
PGPhotoEditor *photoEditor = self.photoEditor;
|
||||||
|
|||||||
@ -1274,6 +1274,12 @@
|
|||||||
[strongSelf stopVideoPlayback:false];
|
[strongSelf stopVideoPlayback:false];
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
cropController.isVideoPlaying = ^bool{
|
||||||
|
__strong TGPhotoEditorController *strongSelf = weakSelf;
|
||||||
|
if (strongSelf == nil)
|
||||||
|
return false;
|
||||||
|
return strongSelf->_isPlaying;
|
||||||
|
};
|
||||||
cropController.togglePlayback = ^{
|
cropController.togglePlayback = ^{
|
||||||
__strong TGPhotoEditorController *strongSelf = weakSelf;
|
__strong TGPhotoEditorController *strongSelf = weakSelf;
|
||||||
if (strongSelf == nil || !strongSelf->_item.isVideo)
|
if (strongSelf == nil || !strongSelf->_item.isVideo)
|
||||||
@ -2902,5 +2908,4 @@
|
|||||||
return self.item.originalSize;
|
return self.item.originalSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|||||||
@ -368,7 +368,7 @@ public func createChannelController(context: AccountContext) -> ViewController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if let timestamp = videoStartTimestamp {
|
if let timestamp = videoStartTimestamp {
|
||||||
videoStartTimestamp = max(0.0, min(timestamp, result.duration))
|
videoStartTimestamp = max(0.0, min(timestamp, result.duration - 0.05))
|
||||||
}
|
}
|
||||||
|
|
||||||
var value = stat()
|
var value = stat()
|
||||||
|
|||||||
@ -626,7 +626,7 @@ public func createGroupControllerImpl(context: AccountContext, peerIds: [PeerId]
|
|||||||
}
|
}
|
||||||
|
|
||||||
if let timestamp = videoStartTimestamp {
|
if let timestamp = videoStartTimestamp {
|
||||||
videoStartTimestamp = max(0.0, min(timestamp, result.duration))
|
videoStartTimestamp = max(0.0, min(timestamp, result.duration - 0.05))
|
||||||
}
|
}
|
||||||
|
|
||||||
var value = stat()
|
var value = stat()
|
||||||
|
|||||||
@ -445,7 +445,7 @@ final class PeerInfoAvatarListContainerNode: ASDisplayNode {
|
|||||||
playerPosition = playerStatus.timestamp
|
playerPosition = playerStatus.timestamp
|
||||||
}
|
}
|
||||||
|
|
||||||
if let videoStartTimestamp = videoStartTimestamp {
|
if let videoStartTimestamp = videoStartTimestamp, false {
|
||||||
playerPosition -= videoStartTimestamp
|
playerPosition -= videoStartTimestamp
|
||||||
if playerPosition < 0.0 {
|
if playerPosition < 0.0 {
|
||||||
playerPosition = playerStatus.duration + playerPosition
|
playerPosition = playerStatus.duration + playerPosition
|
||||||
@ -1070,21 +1070,6 @@ final class PeerInfoAvatarTransformContainerNode: ASDisplayNode {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func reattachVideoNode() {
|
|
||||||
if let videoNode = self.videoNode {
|
|
||||||
let maskPath = UIBezierPath(ovalIn: CGRect(origin: CGPoint(), size: self.avatarNode.frame.size))
|
|
||||||
let shape = CAShapeLayer()
|
|
||||||
shape.path = maskPath.cgPath
|
|
||||||
videoNode.layer.mask = shape
|
|
||||||
|
|
||||||
videoNode.transform = CATransform3DIdentity
|
|
||||||
videoNode.updateLayout(size: self.avatarNode.frame.size, transition: .immediate)
|
|
||||||
videoNode.frame = self.avatarNode.frame
|
|
||||||
|
|
||||||
self.addSubnode(videoNode)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func updateTransitionFraction(_ fraction: CGFloat, transition: ContainedViewLayoutTransition) {
|
func updateTransitionFraction(_ fraction: CGFloat, transition: ContainedViewLayoutTransition) {
|
||||||
if let videoNode = self.videoNode {
|
if let videoNode = self.videoNode {
|
||||||
if case .immediate = transition, fraction == 1.0 {
|
if case .immediate = transition, fraction == 1.0 {
|
||||||
@ -1212,11 +1197,6 @@ final class PeerInfoAvatarTransformContainerNode: ASDisplayNode {
|
|||||||
let update = {
|
let update = {
|
||||||
videoNode.canAttachContent = !self.isExpanded && self.canAttachVideo
|
videoNode.canAttachContent = !self.isExpanded && self.canAttachVideo
|
||||||
if videoNode.canAttachContent {
|
if videoNode.canAttachContent {
|
||||||
// if let videoStartTimestamp = self.videoStartTimestamp {
|
|
||||||
// videoNode.seek(videoStartTimestamp)
|
|
||||||
// } else {
|
|
||||||
// videoNode.seek(0.0)
|
|
||||||
// }
|
|
||||||
videoNode.play()
|
videoNode.play()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2292,6 +2272,7 @@ final class PeerInfoHeaderNode: ASDisplayNode {
|
|||||||
private(set) var isAvatarExpanded: Bool
|
private(set) var isAvatarExpanded: Bool
|
||||||
private(set) var twoLineInfo = false
|
private(set) var twoLineInfo = false
|
||||||
var skipCollapseCompletion = false
|
var skipCollapseCompletion = false
|
||||||
|
var ignoreCollapse = false
|
||||||
|
|
||||||
let avatarListNode: PeerInfoAvatarListNode
|
let avatarListNode: PeerInfoAvatarListNode
|
||||||
|
|
||||||
@ -2842,7 +2823,7 @@ final class PeerInfoHeaderNode: ASDisplayNode {
|
|||||||
}
|
}
|
||||||
|
|
||||||
self.avatarListNode.listContainerNode.update(size: expandedAvatarListSize, peer: peer, isExpanded: self.isAvatarExpanded, transition: transition)
|
self.avatarListNode.listContainerNode.update(size: expandedAvatarListSize, peer: peer, isExpanded: self.isAvatarExpanded, transition: transition)
|
||||||
if self.avatarListNode.listContainerNode.isCollapsing {
|
if self.avatarListNode.listContainerNode.isCollapsing && !self.ignoreCollapse {
|
||||||
self.avatarListNode.avatarContainerNode.canAttachVideo = false
|
self.avatarListNode.avatarContainerNode.canAttachVideo = false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -3990,13 +3990,11 @@ private final class PeerInfoScreenNode: ViewControllerTracingNode, UIScrollViewD
|
|||||||
}
|
}
|
||||||
|
|
||||||
if self.headerNode.isAvatarExpanded {
|
if self.headerNode.isAvatarExpanded {
|
||||||
|
self.headerNode.ignoreCollapse = true
|
||||||
self.headerNode.updateIsAvatarExpanded(false, transition: .immediate)
|
self.headerNode.updateIsAvatarExpanded(false, transition: .immediate)
|
||||||
self.updateNavigationExpansionPresentation(isExpanded: false, animated: true)
|
self.updateNavigationExpansionPresentation(isExpanded: false, animated: true)
|
||||||
}
|
}
|
||||||
if let (layout, navigationHeight) = self.validLayout {
|
|
||||||
self.scrollNode.view.setContentOffset(CGPoint(), animated: false)
|
self.scrollNode.view.setContentOffset(CGPoint(), animated: false)
|
||||||
self.containerLayoutUpdated(layout: layout, navigationHeight: navigationHeight, transition: .immediate, additive: false)
|
|
||||||
}
|
|
||||||
|
|
||||||
let resource = LocalFileMediaResource(fileId: arc4random64())
|
let resource = LocalFileMediaResource(fileId: arc4random64())
|
||||||
self.context.account.postbox.mediaBox.storeResourceData(resource.id, data: data)
|
self.context.account.postbox.mediaBox.storeResourceData(resource.id, data: data)
|
||||||
@ -4006,6 +4004,7 @@ private final class PeerInfoScreenNode: ViewControllerTracingNode, UIScrollViewD
|
|||||||
if let (layout, navigationHeight) = self.validLayout {
|
if let (layout, navigationHeight) = self.validLayout {
|
||||||
self.containerLayoutUpdated(layout: layout, navigationHeight: navigationHeight, transition: .immediate, additive: false)
|
self.containerLayoutUpdated(layout: layout, navigationHeight: navigationHeight, transition: .immediate, additive: false)
|
||||||
}
|
}
|
||||||
|
self.headerNode.ignoreCollapse = false
|
||||||
|
|
||||||
let postbox = self.context.account.postbox
|
let postbox = self.context.account.postbox
|
||||||
let signal = self.isSettings ? updateAccountPhoto(account: self.context.account, resource: resource, videoResource: nil, videoStartTimestamp: nil, mapResourceToAvatarSizes: { resource, representations in
|
let signal = self.isSettings ? updateAccountPhoto(account: self.context.account, resource: resource, videoResource: nil, videoStartTimestamp: nil, mapResourceToAvatarSizes: { resource, representations in
|
||||||
@ -4036,13 +4035,11 @@ private final class PeerInfoScreenNode: ViewControllerTracingNode, UIScrollViewD
|
|||||||
}
|
}
|
||||||
|
|
||||||
if self.headerNode.isAvatarExpanded {
|
if self.headerNode.isAvatarExpanded {
|
||||||
|
self.headerNode.ignoreCollapse = true
|
||||||
self.headerNode.updateIsAvatarExpanded(false, transition: .immediate)
|
self.headerNode.updateIsAvatarExpanded(false, transition: .immediate)
|
||||||
self.updateNavigationExpansionPresentation(isExpanded: false, animated: true)
|
self.updateNavigationExpansionPresentation(isExpanded: false, animated: true)
|
||||||
}
|
}
|
||||||
if let (layout, navigationHeight) = self.validLayout {
|
|
||||||
self.scrollNode.view.setContentOffset(CGPoint(), animated: false)
|
self.scrollNode.view.setContentOffset(CGPoint(), animated: false)
|
||||||
self.containerLayoutUpdated(layout: layout, navigationHeight: navigationHeight, transition: .immediate, additive: false)
|
|
||||||
}
|
|
||||||
|
|
||||||
let photoResource = LocalFileMediaResource(fileId: arc4random64())
|
let photoResource = LocalFileMediaResource(fileId: arc4random64())
|
||||||
self.context.account.postbox.mediaBox.storeResourceData(photoResource.id, data: data)
|
self.context.account.postbox.mediaBox.storeResourceData(photoResource.id, data: data)
|
||||||
@ -4052,6 +4049,7 @@ private final class PeerInfoScreenNode: ViewControllerTracingNode, UIScrollViewD
|
|||||||
if let (layout, navigationHeight) = self.validLayout {
|
if let (layout, navigationHeight) = self.validLayout {
|
||||||
self.containerLayoutUpdated(layout: layout, navigationHeight: navigationHeight, transition: .immediate, additive: false)
|
self.containerLayoutUpdated(layout: layout, navigationHeight: navigationHeight, transition: .immediate, additive: false)
|
||||||
}
|
}
|
||||||
|
self.headerNode.ignoreCollapse = false
|
||||||
|
|
||||||
var videoStartTimestamp: Double? = nil
|
var videoStartTimestamp: Double? = nil
|
||||||
if let adjustments = adjustments, adjustments.videoStartValue > 0.0 {
|
if let adjustments = adjustments, adjustments.videoStartValue > 0.0 {
|
||||||
@ -4083,7 +4081,7 @@ private final class PeerInfoScreenNode: ViewControllerTracingNode, UIScrollViewD
|
|||||||
}
|
}
|
||||||
|
|
||||||
if let timestamp = videoStartTimestamp {
|
if let timestamp = videoStartTimestamp {
|
||||||
videoStartTimestamp = max(0.0, min(timestamp, result.duration))
|
videoStartTimestamp = max(0.0, min(timestamp, result.duration - 0.05))
|
||||||
}
|
}
|
||||||
|
|
||||||
var value = stat()
|
var value = stat()
|
||||||
@ -4155,6 +4153,12 @@ private final class PeerInfoScreenNode: ViewControllerTracingNode, UIScrollViewD
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var currentIsVideo = false
|
||||||
|
let item = self.headerNode.avatarListNode.listContainerNode.currentItemNode?.item
|
||||||
|
if let item = item, case let .image(image) = item {
|
||||||
|
currentIsVideo = !image.2.isEmpty
|
||||||
|
}
|
||||||
|
|
||||||
let peerId = self.peerId
|
let peerId = self.peerId
|
||||||
let _ = (self.context.account.postbox.transaction { transaction -> (Peer?, SearchBotsConfiguration) in
|
let _ = (self.context.account.postbox.transaction { transaction -> (Peer?, SearchBotsConfiguration) in
|
||||||
return (transaction.getPeer(peerId), currentSearchBotsConfiguration(transaction: transaction))
|
return (transaction.getPeer(peerId), currentSearchBotsConfiguration(transaction: transaction))
|
||||||
@ -4184,7 +4188,7 @@ private final class PeerInfoScreenNode: ViewControllerTracingNode, UIScrollViewD
|
|||||||
hasPhotos = true
|
hasPhotos = true
|
||||||
}
|
}
|
||||||
|
|
||||||
let mixin = TGMediaAvatarMenuMixin(context: legacyController.context, parentController: emptyController, hasSearchButton: true, hasDeleteButton: hasPhotos && hasRemove, hasViewButton: false, personalPhoto: strongSelf.isSettings, isVideo: false, saveEditedPhotos: false, saveCapturedMedia: false, signup: false)!
|
let mixin = TGMediaAvatarMenuMixin(context: legacyController.context, parentController: emptyController, hasSearchButton: true, hasDeleteButton: hasPhotos && hasRemove, hasViewButton: false, personalPhoto: strongSelf.isSettings, isVideo: currentIsVideo, saveEditedPhotos: false, saveCapturedMedia: false, signup: false)!
|
||||||
let _ = strongSelf.currentAvatarMixin.swap(mixin)
|
let _ = strongSelf.currentAvatarMixin.swap(mixin)
|
||||||
mixin.requestSearchController = { [weak self] assetsController in
|
mixin.requestSearchController = { [weak self] assetsController in
|
||||||
guard let strongSelf = self else {
|
guard let strongSelf = self else {
|
||||||
@ -5804,22 +5808,6 @@ public final class PeerInfoScreen: ViewController {
|
|||||||
super.displayNodeDidLoad()
|
super.displayNodeDidLoad()
|
||||||
}
|
}
|
||||||
|
|
||||||
public override func viewWillAppear(_ animated: Bool) {
|
|
||||||
super.viewWillAppear(animated)
|
|
||||||
|
|
||||||
self.controllerNode.canAttachVideo = false
|
|
||||||
}
|
|
||||||
|
|
||||||
override public func viewDidAppear(_ animated: Bool) {
|
|
||||||
super.viewDidAppear(animated)
|
|
||||||
|
|
||||||
self.controllerNode.canAttachVideo = true
|
|
||||||
|
|
||||||
if let (layout, navigationHeight) = self.validLayout {
|
|
||||||
self.controllerNode.containerLayoutUpdated(layout: layout, navigationHeight: navigationHeight, transition: .immediate)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
override public func containerLayoutUpdated(_ layout: ContainerViewLayout, transition: ContainedViewLayoutTransition) {
|
override public func containerLayoutUpdated(_ layout: ContainerViewLayout, transition: ContainedViewLayoutTransition) {
|
||||||
super.containerLayoutUpdated(layout, transition: transition)
|
super.containerLayoutUpdated(layout, transition: transition)
|
||||||
|
|
||||||
|
|||||||
@ -448,7 +448,7 @@ public func resolveUrlImpl(account: Account, url: String) -> Signal<ResolvedUrl,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
let baseTelegraPhPaths = ["telegra.ph/", "t.me/iv?"]
|
let baseTelegraPhPaths = ["telegra.ph/", "te.legra.ph/", "graph.org/", "t.me/iv?"]
|
||||||
for basePath in baseTelegraPhPaths {
|
for basePath in baseTelegraPhPaths {
|
||||||
for scheme in schemes {
|
for scheme in schemes {
|
||||||
let basePrefix = scheme + basePath
|
let basePrefix = scheme + basePath
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user