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
4fadec2ff3
commit
bb91e637dc
@ -1766,6 +1766,28 @@ static CGPoint TGCameraControllerClampPointToScreenSize(__unused id self, __unus
|
||||
});
|
||||
};
|
||||
|
||||
controller.didFinishEditingVideo = ^(NSURL *url, id<TGMediaEditAdjustments> adjustments, UIImage *resultImage, UIImage *thumbnailImage, bool hasChanges) {
|
||||
if (!hasChanges)
|
||||
return;
|
||||
|
||||
__strong TGCameraController *strongSelf = weakSelf;
|
||||
if (strongSelf == nil)
|
||||
return;
|
||||
|
||||
TGDispatchOnMainThread(^
|
||||
{
|
||||
if (strongSelf.finishedWithVideo != nil)
|
||||
strongSelf.finishedWithVideo(nil, url, resultImage, 0, CGSizeZero, adjustments, nil, nil, nil, nil);
|
||||
|
||||
__strong TGPhotoEditorController *strongController = weakController;
|
||||
if (strongController != nil)
|
||||
{
|
||||
[strongController updateStatusBarAppearanceForDismiss];
|
||||
[strongSelf _dismissTransitionForResultController:(TGOverlayController *)strongController];
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
controller.requestThumbnailImage = ^(id<TGMediaEditableItem> editableItem)
|
||||
{
|
||||
return [editableItem thumbnailImageSignal];
|
||||
|
@ -361,6 +361,17 @@
|
||||
|
||||
[menuController dismissAnimated:false];
|
||||
};
|
||||
|
||||
controller.finishedWithVideo = ^(__unused TGOverlayController *controller, NSURL *videoURL, UIImage *previewImage, __unused NSTimeInterval duration, __unused CGSize dimensions, TGVideoEditAdjustments *adjustments, __unused NSString *caption, __unused NSArray *entities, __unused NSArray *stickers, __unused NSNumber *timer){
|
||||
__strong TGMediaAvatarMenuMixin *strongSelf = weakSelf;
|
||||
if (strongSelf == nil)
|
||||
return;
|
||||
|
||||
if (strongSelf.didFinishWithVideo != nil)
|
||||
strongSelf.didFinishWithVideo(previewImage, videoURL, adjustments);
|
||||
|
||||
[menuController dismissAnimated:false];
|
||||
};
|
||||
}
|
||||
|
||||
- (void)_displayLegacyCamera
|
||||
|
@ -307,7 +307,7 @@
|
||||
[_photoEditor setPreviewOutput:_previewView];
|
||||
[self updatePreviewView];
|
||||
|
||||
if (_intent == TGPhotoEditorControllerAvatarIntent && _item.isVideo) {
|
||||
if ([self presentedForAvatarCreation] && _item.isVideo) {
|
||||
_scrubberView = [[TGMediaPickerGalleryVideoScrubber alloc] initWithFrame:CGRectMake(0.0f, 0.0, _portraitToolbarView.frame.size.width, 68.0f)];
|
||||
_scrubberView.dataSource = self;
|
||||
_scrubberView.delegate = self;
|
||||
@ -380,16 +380,18 @@
|
||||
if ([_currentTabController isKindOfClass:[TGPhotoCropController class]])
|
||||
return;
|
||||
|
||||
_scrubberView.allowsTrimming = self.item.originalDuration >= TGVideoEditMinimumTrimmableDuration;
|
||||
_scrubberView.hasDotPicker = true;
|
||||
_scrubberView.disableZoom = true;
|
||||
_scrubberView.disableTimeDisplay = true;
|
||||
_scrubberView.trimStartValue = 0.0;
|
||||
_scrubberView.trimEndValue = MIN(9.9, self.item.originalDuration);
|
||||
[_scrubberView setTrimApplied:self.item.originalDuration > 9.9];
|
||||
_scrubberView.maximumLength = 9.9;
|
||||
|
||||
[self setVideoEndTime:_scrubberView.trimEndValue];
|
||||
if (self.item.isVideo) {
|
||||
_scrubberView.allowsTrimming = self.item.originalDuration >= TGVideoEditMinimumTrimmableDuration;
|
||||
_scrubberView.hasDotPicker = true;
|
||||
_scrubberView.disableZoom = true;
|
||||
_scrubberView.disableTimeDisplay = true;
|
||||
_scrubberView.trimStartValue = 0.0;
|
||||
_scrubberView.trimEndValue = MIN(9.9, self.item.originalDuration);
|
||||
[_scrubberView setTrimApplied:self.item.originalDuration > 9.9];
|
||||
_scrubberView.maximumLength = 9.9;
|
||||
|
||||
[self setVideoEndTime:_scrubberView.trimEndValue];
|
||||
}
|
||||
|
||||
NSTimeInterval position = 0;
|
||||
TGMediaVideoEditAdjustments *adjustments = [_photoEditor exportAdjustments];
|
||||
@ -1385,7 +1387,7 @@
|
||||
break;
|
||||
}
|
||||
|
||||
if (_intent == TGPhotoEditorControllerAvatarIntent && !isInitialAppearance && tab != TGPhotoEditorPreviewTab) {
|
||||
if ([self presentedForAvatarCreation] && !isInitialAppearance && tab != TGPhotoEditorPreviewTab) {
|
||||
backButtonType = TGPhotoEditorBackButtonBack;
|
||||
}
|
||||
|
||||
@ -1504,7 +1506,7 @@
|
||||
|
||||
- (void)dismissEditor
|
||||
{
|
||||
if ((![_currentTabController isKindOfClass:[TGPhotoAvatarPreviewController class]] && ![_currentTabController isKindOfClass:[TGPhotoAvatarCropController class]]) && _intent == TGPhotoEditorControllerAvatarIntent) {
|
||||
if ((![_currentTabController isKindOfClass:[TGPhotoAvatarPreviewController class]] && ![_currentTabController isKindOfClass:[TGPhotoAvatarCropController class]]) && [self presentedForAvatarCreation]) {
|
||||
[self presentEditorTab:TGPhotoEditorPreviewTab];
|
||||
return;
|
||||
}
|
||||
@ -1597,7 +1599,7 @@
|
||||
|
||||
- (void)doneButtonPressed
|
||||
{
|
||||
if (_intent == TGPhotoEditorControllerAvatarIntent && ![_currentTabController isKindOfClass:[TGPhotoAvatarPreviewController class]]) {
|
||||
if ([self presentedForAvatarCreation] && ![_currentTabController isKindOfClass:[TGPhotoAvatarPreviewController class]]) {
|
||||
[self presentEditorTab:TGPhotoEditorPreviewTab];
|
||||
} else {
|
||||
[self applyEditor];
|
||||
@ -1643,7 +1645,7 @@
|
||||
}
|
||||
|
||||
TGVideoEditAdjustments *adjustments = [_photoEditor exportAdjustmentsWithPaintingData:paintingData];
|
||||
if (_intent == TGPhotoEditorControllerAvatarIntent && _item.isVideo) {
|
||||
if ([self presentedForAvatarCreation] && _item.isVideo) {
|
||||
[[SQueue concurrentDefaultQueue] dispatch:^
|
||||
{
|
||||
id<TGMediaEditableItem> item = _item;
|
||||
|
Loading…
x
Reference in New Issue
Block a user