mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-10-09 03:20:48 +00:00
Video avatar fixes
This commit is contained in:
parent
74e67660cb
commit
715e10fb7f
@ -297,8 +297,7 @@
|
||||
break;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
TGPhotoEditorBackButton backButton = TGPhotoEditorBackButtonCancel;
|
||||
TGPhotoEditorDoneButton doneButton = TGPhotoEditorDoneButtonCheck;
|
||||
_portraitToolbarView = [[TGPhotoToolbarView alloc] initWithBackButton:backButton doneButton:doneButton solidBackground:true];
|
||||
@ -481,6 +480,8 @@
|
||||
if ([adjustments isKindOfClass:[TGMediaVideoEditAdjustments class]])
|
||||
position = adjustments.trimStartValue;
|
||||
|
||||
PGPhotoEditor *photoEditor = _photoEditor;
|
||||
|
||||
CGSize screenSize = TGNativeScreenSize();
|
||||
SSignal *signal = nil;
|
||||
if ([_photoEditor hasDefaultCropping] && (NSInteger)screenSize.width == 320)
|
||||
@ -504,20 +505,18 @@
|
||||
if (avatar) {
|
||||
return image;
|
||||
} else {
|
||||
return TGPhotoEditorCrop(image, nil, _photoEditor.cropOrientation, _photoEditor.cropRotation, _photoEditor.cropRect, _photoEditor.cropMirrored, TGPhotoEditorScreenImageMaxSize(), _photoEditor.originalSize, true);
|
||||
return TGPhotoEditorCrop(image, nil, photoEditor.cropOrientation, photoEditor.cropRotation, photoEditor.cropRect, photoEditor.cropMirrored, TGPhotoEditorScreenImageMaxSize(), photoEditor.originalSize, true);
|
||||
}
|
||||
}];
|
||||
}
|
||||
}
|
||||
|
||||
__weak TGPhotoEditorController *weakSelf = self;
|
||||
PGPhotoEditor *photoEditor = _photoEditor;
|
||||
|
||||
[signal startWithNext:^(id next)
|
||||
{
|
||||
__strong TGPhotoEditorController *strongSelf = weakSelf;
|
||||
if (strongSelf == nil)
|
||||
return;
|
||||
if (strongSelf == nil)
|
||||
return;
|
||||
|
||||
if (strongSelf->_dismissed)
|
||||
return;
|
||||
@ -566,7 +565,6 @@
|
||||
|
||||
if (strongSelf->_hadProgress && !progressVisible) {
|
||||
[strongSelf->_progressView setPlay];
|
||||
|
||||
[strongSelf->_scrubberView reloadThumbnails];
|
||||
}
|
||||
});
|
||||
@ -968,6 +966,7 @@
|
||||
}];
|
||||
};
|
||||
|
||||
SQueue *queue = _queue;
|
||||
SSignal *(^imageRenderSignal)(UIImage *) = ^(UIImage *image)
|
||||
{
|
||||
return [[SSignal alloc] initWithGenerator:^id<SDisposable>(SSubscriber *subscriber)
|
||||
@ -975,7 +974,7 @@
|
||||
[photoEditor setImage:image forCropRect:photoEditor.cropRect cropRotation:photoEditor.cropRotation cropOrientation:photoEditor.cropOrientation cropMirrored:photoEditor.cropMirrored fullSize:true];
|
||||
[photoEditor createResultImageWithCompletion:^(UIImage *result)
|
||||
{
|
||||
[_queue dispatch:^{
|
||||
[queue dispatch:^{
|
||||
UIImage *final = result;
|
||||
if (hasPainting)
|
||||
{
|
||||
@ -998,7 +997,7 @@
|
||||
}] mapToSignal:^SSignal *(UIImage *image)
|
||||
{
|
||||
if (hasImageAdjustments)
|
||||
return [[[SSignal complete] delay:0.3 onQueue:_queue] then:imageRenderSignal(image)];
|
||||
return [[[SSignal complete] delay:0.3 onQueue:queue] then:imageRenderSignal(image)];
|
||||
else
|
||||
return [SSignal single:image];
|
||||
}];
|
||||
|
@ -647,7 +647,7 @@ private func settingsItems(data: PeerInfoScreenData?, context: AccountContext, p
|
||||
interaction.openSettings(.avatar)
|
||||
}))
|
||||
}
|
||||
if let peer = data.peer, peer.addressName == nil {
|
||||
if let peer = data.peer, (peer.addressName ?? "").isEmpty {
|
||||
items[.edit]!.append(PeerInfoScreenActionItem(id: 1, text: presentationData.strings.Settings_SetUsername, icon: UIImage(bundleImageName: "Settings/SetUsername"), action: {
|
||||
interaction.openSettings(.username)
|
||||
}))
|
||||
@ -2118,7 +2118,7 @@ private final class PeerInfoScreenNode: ViewControllerTracingNode, UIScrollViewD
|
||||
let galleryController = AvatarGalleryController(context: strongSelf.context, peer: peer, sourceCorners: .round(!strongSelf.headerNode.isAvatarExpanded), remoteEntries: entriesPromise, skipInitial: true, centralEntryIndex: centralEntry.flatMap { entries.firstIndex(of: $0) }, replaceRootController: { controller, ready in
|
||||
})
|
||||
galleryController.openAvatarSetup = { [weak self] completion in
|
||||
self?.openAvatarForEditing(hasRemove: false, completion: completion)
|
||||
self?.openAvatarForEditing(fromGallery: true, completion: completion)
|
||||
}
|
||||
galleryController.avatarPhotoEditCompletion = { [weak self] image in
|
||||
self?.updateProfilePhoto(image)
|
||||
@ -4053,7 +4053,7 @@ private final class PeerInfoScreenNode: ViewControllerTracingNode, UIScrollViewD
|
||||
}))
|
||||
}
|
||||
|
||||
private func openAvatarForEditing(hasRemove: Bool = true, completion: @escaping () -> Void = {}) {
|
||||
private func openAvatarForEditing(fromGallery: Bool = false, completion: @escaping () -> Void = {}) {
|
||||
guard let peer = self.data?.peer, canEditPeerInfo(context: self.context, peer: peer) else {
|
||||
return
|
||||
}
|
||||
@ -4105,7 +4105,7 @@ private final class PeerInfoScreenNode: ViewControllerTracingNode, UIScrollViewD
|
||||
return controller
|
||||
}
|
||||
|
||||
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 mixin = TGMediaAvatarMenuMixin(context: legacyController.context, parentController: emptyController, hasSearchButton: true, hasDeleteButton: hasPhotos && !fromGallery, hasViewButton: false, personalPhoto: strongSelf.isSettings, isVideo: currentIsVideo, saveEditedPhotos: false, saveCapturedMedia: false, signup: false)!
|
||||
mixin.stickersContext = paintStickersContext
|
||||
let _ = strongSelf.currentAvatarMixin.swap(mixin)
|
||||
mixin.requestSearchController = { [weak self] assetsController in
|
||||
@ -4118,6 +4118,10 @@ private final class PeerInfoScreenNode: ViewControllerTracingNode, UIScrollViewD
|
||||
}))
|
||||
controller.navigationPresentation = .modal
|
||||
strongSelf.controller?.push(controller)
|
||||
|
||||
if fromGallery {
|
||||
completion()
|
||||
}
|
||||
}
|
||||
mixin.didFinishWithImage = { [weak self] image in
|
||||
if let image = image {
|
||||
|
@ -190,20 +190,6 @@ public final class PeerSelectionControllerImpl: ViewController, PeerSelectionCon
|
||||
self._ready.set(self.peerSelectionNode.ready)
|
||||
}
|
||||
|
||||
override public func viewWillAppear(_ animated: Bool) {
|
||||
super.viewWillAppear(animated)
|
||||
}
|
||||
|
||||
override public func viewDidAppear(_ animated: Bool) {
|
||||
super.viewDidAppear(animated)
|
||||
|
||||
//self.peerSelectionNode.animateIn()
|
||||
}
|
||||
|
||||
override public func viewDidDisappear(_ animated: Bool) {
|
||||
super.viewDidDisappear(animated)
|
||||
}
|
||||
|
||||
override public func containerLayoutUpdated(_ layout: ContainerViewLayout, transition: ContainedViewLayoutTransition) {
|
||||
super.containerLayoutUpdated(layout, transition: transition)
|
||||
|
||||
|
@ -296,20 +296,6 @@ final class PeerSelectionControllerNode: ASDisplayNode {
|
||||
}
|
||||
}
|
||||
|
||||
func animateIn() {
|
||||
self.layer.animatePosition(from: CGPoint(x: self.layer.position.x, y: self.layer.position.y + self.layer.bounds.size.height), to: self.layer.position, duration: 0.5, timingFunction: kCAMediaTimingFunctionSpring)
|
||||
}
|
||||
|
||||
func animateOut(completion: (() -> Void)? = nil) {
|
||||
self.clipsToBounds = true
|
||||
self.layer.animatePosition(from: CGPoint(), to: CGPoint(x: 0.0, y: self.layer.bounds.size.height), duration: 0.2, timingFunction: CAMediaTimingFunctionName.easeInEaseOut.rawValue, removeOnCompletion: false, additive: true, completion: { [weak self] _ in
|
||||
if let strongSelf = self {
|
||||
strongSelf.dismiss()
|
||||
}
|
||||
completion?()
|
||||
})
|
||||
}
|
||||
|
||||
private func indexChanged(_ index: Int) {
|
||||
guard let (layout, navigationHeight, actualNavigationHeight) = self.containerLayout else {
|
||||
return
|
||||
|
Loading…
x
Reference in New Issue
Block a user