mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-06-16 05:55:20 +00:00
Disable drawing in sign up screen
This commit is contained in:
parent
18934cf6e9
commit
6de1267a1d
@ -86,7 +86,7 @@ typedef enum {
|
|||||||
|
|
||||||
- (void)setToolbarHidden:(bool)hidden animated:(bool)animated;
|
- (void)setToolbarHidden:(bool)hidden animated:(bool)animated;
|
||||||
|
|
||||||
+ (TGPhotoEditorTab)defaultTabsForAvatarIntent;
|
+ (TGPhotoEditorTab)defaultTabsForAvatarIntent:(bool)hasStickers;
|
||||||
|
|
||||||
- (NSTimeInterval)currentTime;
|
- (NSTimeInterval)currentTime;
|
||||||
- (void)setMinimalVideoDuration:(NSTimeInterval)duration;
|
- (void)setMinimalVideoDuration:(NSTimeInterval)duration;
|
||||||
|
@ -919,7 +919,7 @@ const NSUInteger TGAttachmentDisplayedAssetLimit = 500;
|
|||||||
intent |= TGPhotoEditorControllerSuggestingAvatarIntent;
|
intent |= TGPhotoEditorControllerSuggestingAvatarIntent;
|
||||||
}
|
}
|
||||||
|
|
||||||
TGPhotoEditorController *controller = [[TGPhotoEditorController alloc] initWithContext:[windowManager context] item:editableItem intent:intent adjustments:nil caption:nil screenImage:thumbnailImage availableTabs:[TGPhotoEditorController defaultTabsForAvatarIntent] selectedTab:TGPhotoEditorCropTab];
|
TGPhotoEditorController *controller = [[TGPhotoEditorController alloc] initWithContext:[windowManager context] item:editableItem intent:intent adjustments:nil caption:nil screenImage:thumbnailImage availableTabs:[TGPhotoEditorController defaultTabsForAvatarIntent:!_disableStickers] selectedTab:TGPhotoEditorCropTab];
|
||||||
controller.editingContext = _editingContext;
|
controller.editingContext = _editingContext;
|
||||||
controller.stickersContext = _stickersContext;
|
controller.stickersContext = _stickersContext;
|
||||||
controller.dontHideStatusBar = true;
|
controller.dontHideStatusBar = true;
|
||||||
|
@ -1986,7 +1986,7 @@ static CGPoint TGCameraControllerClampPointToScreenSize(__unused id self, __unus
|
|||||||
if (_intent == TGCameraControllerSignupAvatarIntent) {
|
if (_intent == TGCameraControllerSignupAvatarIntent) {
|
||||||
intent = TGPhotoEditorControllerSignupAvatarIntent;
|
intent = TGPhotoEditorControllerSignupAvatarIntent;
|
||||||
}
|
}
|
||||||
TGPhotoEditorController *controller = [[TGPhotoEditorController alloc] initWithContext:windowContext item:input intent:(TGPhotoEditorControllerFromCameraIntent | intent) adjustments:nil caption:nil screenImage:image availableTabs:[TGPhotoEditorController defaultTabsForAvatarIntent] selectedTab:TGPhotoEditorCropTab];
|
TGPhotoEditorController *controller = [[TGPhotoEditorController alloc] initWithContext:windowContext item:input intent:(TGPhotoEditorControllerFromCameraIntent | intent) adjustments:nil caption:nil screenImage:image availableTabs:[TGPhotoEditorController defaultTabsForAvatarIntent:_intent != TGCameraControllerSignupAvatarIntent] selectedTab:TGPhotoEditorCropTab];
|
||||||
controller.stickersContext = _stickersContext;
|
controller.stickersContext = _stickersContext;
|
||||||
__weak TGPhotoEditorController *weakController = controller;
|
__weak TGPhotoEditorController *weakController = controller;
|
||||||
controller.beginTransitionIn = ^UIView *(CGRect *referenceFrame, __unused UIView **parentView)
|
controller.beginTransitionIn = ^UIView *(CGRect *referenceFrame, __unused UIView **parentView)
|
||||||
|
@ -448,7 +448,7 @@
|
|||||||
editableItem = [[TGCameraCapturedVideo alloc] initWithAsset:asset livePhoto:false];
|
editableItem = [[TGCameraCapturedVideo alloc] initWithAsset:asset livePhoto:false];
|
||||||
}
|
}
|
||||||
|
|
||||||
TGPhotoEditorController *controller = [[TGPhotoEditorController alloc] initWithContext:_context item:editableItem intent:intent adjustments:nil caption:nil screenImage:thumbnailImage availableTabs:[TGPhotoEditorController defaultTabsForAvatarIntent] selectedTab:TGPhotoEditorCropTab];
|
TGPhotoEditorController *controller = [[TGPhotoEditorController alloc] initWithContext:_context item:editableItem intent:intent adjustments:nil caption:nil screenImage:thumbnailImage availableTabs:[TGPhotoEditorController defaultTabsForAvatarIntent:_intent != TGMediaAssetsControllerSetSignupProfilePhotoIntent] selectedTab:TGPhotoEditorCropTab];
|
||||||
controller.stickersContext = self.stickersContext;
|
controller.stickersContext = self.stickersContext;
|
||||||
controller.editingContext = self.editingContext;
|
controller.editingContext = self.editingContext;
|
||||||
controller.didFinishRenderingFullSizeImage = ^(UIImage *resultImage)
|
controller.didFinishRenderingFullSizeImage = ^(UIImage *resultImage)
|
||||||
|
@ -93,10 +93,13 @@ const CGFloat TGPhotoAvatarCropViewCurtainMargin = 200;
|
|||||||
[_wrapperView addSubview:_fullPaintingView];
|
[_wrapperView addSubview:_fullPaintingView];
|
||||||
|
|
||||||
_entitiesWrapperView = [[UIView alloc] init];
|
_entitiesWrapperView = [[UIView alloc] init];
|
||||||
_fullEntitiesView = fullEntitiesView;
|
if (fullEntitiesView != nil) {
|
||||||
_fullEntitiesView.frame = CGRectMake(0.0, 0.0, _fullEntitiesView.frame.size.width, _fullEntitiesView.frame.size.height);
|
_fullEntitiesView = fullEntitiesView;
|
||||||
_entitiesWrapperView.frame = _fullEntitiesView.frame;
|
_fullEntitiesView.frame = CGRectMake(0.0, 0.0, _fullEntitiesView.frame.size.width, _fullEntitiesView.frame.size.height);
|
||||||
|
_entitiesWrapperView.frame = _fullEntitiesView.frame;
|
||||||
|
} else {
|
||||||
|
_entitiesWrapperView.frame = CGRectMake(0.0, 0.0, _fullPreviewView.frame.size.width, _fullPreviewView.frame.size.height);
|
||||||
|
}
|
||||||
CGFloat entitiesScale = _fullPreviewView.frame.size.width / _entitiesWrapperView.frame.size.width;
|
CGFloat entitiesScale = _fullPreviewView.frame.size.width / _entitiesWrapperView.frame.size.width;
|
||||||
_entitiesWrapperView.transform = CGAffineTransformMakeScale(entitiesScale, entitiesScale);
|
_entitiesWrapperView.transform = CGAffineTransformMakeScale(entitiesScale, entitiesScale);
|
||||||
_entitiesWrapperView.frame = _fullPreviewView.frame;
|
_entitiesWrapperView.frame = _fullPreviewView.frame;
|
||||||
|
@ -951,7 +951,11 @@ const CGFloat TGPhotoAvatarPreviewLandscapePanelSize = TGPhotoAvatarPreviewPanel
|
|||||||
|
|
||||||
- (TGPhotoEditorTab)availableTabs
|
- (TGPhotoEditorTab)availableTabs
|
||||||
{
|
{
|
||||||
return TGPhotoEditorRotateTab | TGPhotoEditorMirrorTab | TGPhotoEditorPaintTab | TGPhotoEditorToolsTab;
|
TGPhotoEditorTab tabs = TGPhotoEditorRotateTab | TGPhotoEditorMirrorTab | TGPhotoEditorToolsTab;
|
||||||
|
if (self.intent != TGPhotoEditorControllerSignupAvatarIntent) {
|
||||||
|
tabs |= TGPhotoEditorPaintTab;
|
||||||
|
}
|
||||||
|
return tabs;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (TGPhotoEditorTab)activeTab
|
- (TGPhotoEditorTab)activeTab
|
||||||
|
@ -2604,15 +2604,12 @@
|
|||||||
}]];
|
}]];
|
||||||
}
|
}
|
||||||
|
|
||||||
+ (TGPhotoEditorTab)defaultTabsForAvatarIntent
|
+ (TGPhotoEditorTab)defaultTabsForAvatarIntent:(bool)hasStickers
|
||||||
{
|
{
|
||||||
static dispatch_once_t onceToken;
|
TGPhotoEditorTab avatarTabs = TGPhotoEditorCropTab | TGPhotoEditorToolsTab;
|
||||||
static TGPhotoEditorTab avatarTabs = TGPhotoEditorNoneTab;
|
if (hasStickers) {
|
||||||
dispatch_once(&onceToken, ^
|
avatarTabs |= TGPhotoEditorPaintTab;
|
||||||
{
|
}
|
||||||
if (iosMajorVersion() >= 7)
|
|
||||||
avatarTabs = TGPhotoEditorCropTab | TGPhotoEditorPaintTab | TGPhotoEditorToolsTab;
|
|
||||||
});
|
|
||||||
return avatarTabs;
|
return avatarTabs;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -34,7 +34,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
void (^present)(UIImage *) = ^(UIImage *screenImage) {
|
void (^present)(UIImage *) = ^(UIImage *screenImage) {
|
||||||
TGPhotoEditorController *controller = [[TGPhotoEditorController alloc] initWithContext:[windowManager context] item:editableItem intent:TGPhotoEditorControllerAvatarIntent | TGPhotoEditorControllerSuggestedAvatarIntent adjustments:nil caption:nil screenImage:screenImage availableTabs:[TGPhotoEditorController defaultTabsForAvatarIntent] selectedTab:TGPhotoEditorCropTab];
|
TGPhotoEditorController *controller = [[TGPhotoEditorController alloc] initWithContext:[windowManager context] item:editableItem intent:TGPhotoEditorControllerAvatarIntent | TGPhotoEditorControllerSuggestedAvatarIntent adjustments:nil caption:nil screenImage:screenImage availableTabs:[TGPhotoEditorController defaultTabsForAvatarIntent:true] selectedTab:TGPhotoEditorCropTab];
|
||||||
controller.senderName = senderName;
|
controller.senderName = senderName;
|
||||||
controller.stickersContext = stickersContext;
|
controller.stickersContext = stickersContext;
|
||||||
|
|
||||||
|
@ -423,14 +423,14 @@ public final class LegacyPaintEntityRenderer: NSObject, TGPhotoPaintEntityRender
|
|||||||
self.isAvatar = ((adjustments as? TGVideoEditAdjustments)?.documentId ?? 0) != 0
|
self.isAvatar = ((adjustments as? TGVideoEditAdjustments)?.documentId ?? 0) != 0
|
||||||
|
|
||||||
var renderEntities: [LegacyPaintEntity] = []
|
var renderEntities: [LegacyPaintEntity] = []
|
||||||
if let account = account, let paintingData = adjustments.paintingData, let entitiesData = paintingData.entitiesData {
|
if let paintingData = adjustments.paintingData, let entitiesData = paintingData.entitiesData {
|
||||||
let entities = decodeDrawingEntities(data: entitiesData)
|
let entities = decodeDrawingEntities(data: entitiesData)
|
||||||
for entity in entities {
|
for entity in entities {
|
||||||
if let sticker = entity as? DrawingStickerEntity {
|
if let sticker = entity as? DrawingStickerEntity, let account {
|
||||||
renderEntities.append(LegacyPaintStickerEntity(account: account, entity: sticker))
|
renderEntities.append(LegacyPaintStickerEntity(account: account, entity: sticker))
|
||||||
} else if let text = entity as? DrawingTextEntity {
|
} else if let text = entity as? DrawingTextEntity {
|
||||||
renderEntities.append(LegacyPaintTextEntity(entity: text))
|
renderEntities.append(LegacyPaintTextEntity(entity: text))
|
||||||
if let renderSubEntities = text.renderSubEntities {
|
if let renderSubEntities = text.renderSubEntities, let account {
|
||||||
for entity in renderSubEntities {
|
for entity in renderSubEntities {
|
||||||
renderEntities.append(LegacyPaintStickerEntity(account: account, entity: entity))
|
renderEntities.append(LegacyPaintStickerEntity(account: account, entity: entity))
|
||||||
}
|
}
|
||||||
|
@ -36,7 +36,7 @@ func presentLegacyWebSearchEditor(context: AccountContext, theme: PresentationTh
|
|||||||
|
|
||||||
let paintStickersContext = LegacyPaintStickersContext(context: context)
|
let paintStickersContext = LegacyPaintStickersContext(context: context)
|
||||||
|
|
||||||
let controller = TGPhotoEditorController(context: legacyController.context, item: item, intent: TGPhotoEditorControllerAvatarIntent, adjustments: nil, caption: nil, screenImage: screenImage ?? UIImage(), availableTabs: TGPhotoEditorController.defaultTabsForAvatarIntent(), selectedTab: .cropTab)!
|
let controller = TGPhotoEditorController(context: legacyController.context, item: item, intent: TGPhotoEditorControllerAvatarIntent, adjustments: nil, caption: nil, screenImage: screenImage ?? UIImage(), availableTabs: TGPhotoEditorController.defaultTabs(forAvatarIntent: true), selectedTab: .cropTab)!
|
||||||
controller.stickersContext = paintStickersContext
|
controller.stickersContext = paintStickersContext
|
||||||
legacyController.bind(controller: controller)
|
legacyController.bind(controller: controller)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user