diff --git a/LegacyComponents.xcodeproj/project.pbxproj b/LegacyComponents.xcodeproj/project.pbxproj index de6fa474bb..f917c32734 100644 --- a/LegacyComponents.xcodeproj/project.pbxproj +++ b/LegacyComponents.xcodeproj/project.pbxproj @@ -188,7 +188,6 @@ D01778EE1F20CAE60044446D /* TGOverlayController.m in Sources */ = {isa = PBXBuildFile; fileRef = D01778E21F20CAE60044446D /* TGOverlayController.m */; }; D01778EF1F20CAE60044446D /* TGOverlayControllerWindow.h in Headers */ = {isa = PBXBuildFile; fileRef = D01778E31F20CAE60044446D /* TGOverlayControllerWindow.h */; settings = {ATTRIBUTES = (Public, ); }; }; D01778F01F20CAE60044446D /* TGOverlayControllerWindow.m in Sources */ = {isa = PBXBuildFile; fileRef = D01778E41F20CAE60044446D /* TGOverlayControllerWindow.m */; }; - D01778F31F20CC7A0044446D /* TGRootControllerProtocol.h in Headers */ = {isa = PBXBuildFile; fileRef = D01778F11F20CC7A0044446D /* TGRootControllerProtocol.h */; settings = {ATTRIBUTES = (Public, ); }; }; D01778F71F20CDAC0044446D /* TGHacks.h in Headers */ = {isa = PBXBuildFile; fileRef = D01778F51F20CDAC0044446D /* TGHacks.h */; settings = {ATTRIBUTES = (Public, ); }; }; D01778F81F20CDAC0044446D /* TGHacks.m in Sources */ = {isa = PBXBuildFile; fileRef = D01778F61F20CDAC0044446D /* TGHacks.m */; }; D01778FB1F20CF6B0044446D /* TGBackdropView.h in Headers */ = {isa = PBXBuildFile; fileRef = D01778F91F20CF6B0044446D /* TGBackdropView.h */; settings = {ATTRIBUTES = (Public, ); }; }; @@ -638,8 +637,6 @@ D07BC87E1F2A365000ED97AA /* TGProgressSpinnerView.m in Sources */ = {isa = PBXBuildFile; fileRef = D07BC87A1F2A365000ED97AA /* TGProgressSpinnerView.m */; }; D07BC87F1F2A365000ED97AA /* TGProgressWindow.h in Headers */ = {isa = PBXBuildFile; fileRef = D07BC87B1F2A365000ED97AA /* TGProgressWindow.h */; settings = {ATTRIBUTES = (Public, ); }; }; D07BC8801F2A365000ED97AA /* TGProgressWindow.m in Sources */ = {isa = PBXBuildFile; fileRef = D07BC87C1F2A365000ED97AA /* TGProgressWindow.m */; }; - D07BC8831F2A367500ED97AA /* TGActivityIndicatorView.h in Headers */ = {isa = PBXBuildFile; fileRef = D07BC8811F2A367500ED97AA /* TGActivityIndicatorView.h */; settings = {ATTRIBUTES = (Public, ); }; }; - D07BC8841F2A367500ED97AA /* TGActivityIndicatorView.m in Sources */ = {isa = PBXBuildFile; fileRef = D07BC8821F2A367500ED97AA /* TGActivityIndicatorView.m */; }; D07BC8931F2A375800ED97AA /* TGPhotoCropAreaView.h in Headers */ = {isa = PBXBuildFile; fileRef = D07BC8851F2A375800ED97AA /* TGPhotoCropAreaView.h */; }; D07BC8941F2A375800ED97AA /* TGPhotoCropAreaView.m in Sources */ = {isa = PBXBuildFile; fileRef = D07BC8861F2A375800ED97AA /* TGPhotoCropAreaView.m */; }; D07BC8951F2A375800ED97AA /* TGPhotoCropControl.h in Headers */ = {isa = PBXBuildFile; fileRef = D07BC8871F2A375800ED97AA /* TGPhotoCropControl.h */; }; @@ -1252,7 +1249,6 @@ D01778E21F20CAE60044446D /* TGOverlayController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TGOverlayController.m; path = LegacyComponents/TGOverlayController.m; sourceTree = ""; }; D01778E31F20CAE60044446D /* TGOverlayControllerWindow.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TGOverlayControllerWindow.h; path = LegacyComponents/TGOverlayControllerWindow.h; sourceTree = ""; }; D01778E41F20CAE60044446D /* TGOverlayControllerWindow.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TGOverlayControllerWindow.m; path = LegacyComponents/TGOverlayControllerWindow.m; sourceTree = ""; }; - D01778F11F20CC7A0044446D /* TGRootControllerProtocol.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TGRootControllerProtocol.h; sourceTree = ""; }; D01778F51F20CDAC0044446D /* TGHacks.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TGHacks.h; sourceTree = ""; }; D01778F61F20CDAC0044446D /* TGHacks.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TGHacks.m; sourceTree = ""; }; D01778F91F20CF6B0044446D /* TGBackdropView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TGBackdropView.h; sourceTree = ""; }; @@ -2130,6 +2126,7 @@ D07BCBFA1F2B757700ED97AA /* TGEmbedPIPScrubber.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TGEmbedPIPScrubber.m; sourceTree = ""; }; D07BCC031F2B82D100ED97AA /* TGModernConversationTitleActivityIndicator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TGModernConversationTitleActivityIndicator.h; sourceTree = ""; }; D07BCC041F2B82D100ED97AA /* TGModernConversationTitleActivityIndicator.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TGModernConversationTitleActivityIndicator.m; sourceTree = ""; }; + D0EB42021F3142F400838FE6 /* LegacyComponentsResources.bundle */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.plug-in"; name = LegacyComponentsResources.bundle; path = Resources/LegacyComponentsResources.bundle; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -2164,6 +2161,7 @@ D01777291F1F8F100044446D /* LegacyComponents */ = { isa = PBXGroup; children = ( + D0EB409E1F2FC0AA00838FE6 /* Resources */, D017776F1F1F91B00044446D /* Utils */, D01779B01F2139720044446D /* POP */, D017797F1F2107B80044446D /* LMDB */, @@ -2505,7 +2503,6 @@ D01778E21F20CAE60044446D /* TGOverlayController.m */, D01778E31F20CAE60044446D /* TGOverlayControllerWindow.h */, D01778E41F20CAE60044446D /* TGOverlayControllerWindow.m */, - D01778F11F20CC7A0044446D /* TGRootControllerProtocol.h */, D07BCAD51F2B4F2800ED97AA /* TGOverlayFormsheetController.h */, D07BCAD61F2B4F2800ED97AA /* TGOverlayFormsheetController.m */, D07BCAD71F2B4F2800ED97AA /* TGOverlayFormsheetWindow.h */, @@ -3484,6 +3481,14 @@ name = Coub; sourceTree = ""; }; + D0EB409E1F2FC0AA00838FE6 /* Resources */ = { + isa = PBXGroup; + children = ( + D0EB42021F3142F400838FE6 /* LegacyComponentsResources.bundle */, + ); + name = Resources; + sourceTree = ""; + }; /* End PBXGroup section */ /* Begin PBXHeadersBuildPhase section */ @@ -3845,7 +3850,6 @@ D07BC90B1F2A380D00ED97AA /* TGPaintFaceDetector.h in Headers */, D07BCA481F2A9CE300ED97AA /* TGModernMediaListSelectableItem.h in Headers */, D07BC9F31F2A9A2B00ED97AA /* TGMediaPickerController.h in Headers */, - D01778F31F20CC7A0044446D /* TGRootControllerProtocol.h in Headers */, D07BC8161F2A2C0B00ED97AA /* PGPhotoGaussianBlurFilter.h in Headers */, D017783B1F1F961D0044446D /* TGStickerPackReference.h in Headers */, D01779DF1F2139980044446D /* POPAction.h in Headers */, @@ -3998,7 +4002,6 @@ D07BC8CF1F2A37EC00ED97AA /* TGPhotoPaintSettingsWrapperView.h in Headers */, D01778491F1F961D0044446D /* TGDocumentMediaAttachment.h in Headers */, D0177AD21F23D9810044446D /* ASWatcher.h in Headers */, - D07BC8831F2A367500ED97AA /* TGActivityIndicatorView.h in Headers */, D07BC80E1F2A2C0B00ED97AA /* PGPhotoEnhancePass.h in Headers */, D07BC9051F2A380D00ED97AA /* TGPaintCanvas.h in Headers */, D07BC7411F2A2AC500ED97AA /* TGPhotoEditorButton.h in Headers */, @@ -4146,7 +4149,6 @@ D0177ADA1F23D9B80044446D /* SGraphListNode.m in Sources */, D01778B31F1FFF810044446D /* TGLabel.m in Sources */, D07BCA6C1F2B3CE700ED97AA /* TGCameraController.m in Sources */, - D07BC8841F2A367500ED97AA /* TGActivityIndicatorView.m in Sources */, D07BC94F1F2A3EA900ED97AA /* TGHashtagPanelCell.m in Sources */, D017782E1F1F961D0044446D /* TGBotReplyMarkupRow.m in Sources */, D01779271F20FE480044446D /* TGObserverProxy.m in Sources */, diff --git a/LegacyComponents/CBCoubLoopCompositionMaker.m b/LegacyComponents/CBCoubLoopCompositionMaker.m index 73a30dd9d0..6d552e1839 100755 --- a/LegacyComponents/CBCoubLoopCompositionMaker.m +++ b/LegacyComponents/CBCoubLoopCompositionMaker.m @@ -149,13 +149,6 @@ static AVURLAsset *gDigitalSilenceAsset = nil; AVAssetTrack *silence = nil; CMTimeRange silenceTimeRange = kCMTimeRangeZero; - // if(originalAudioTrack && CMTIME_COMPARE_INLINE(audioTrackTimeRange.duration, <, videoTrackTimeRange.duration)) - // { - // if(!gDigitalSilenceAsset) - // gDigitalSilenceAsset = [[AVURLAsset alloc] initWithURL:[[NSBundle mainBundle] URLForResource:@"silence2" withExtension:@"caf"] options:@{AVURLAssetPreferPreciseDurationAndTimingKey : @YES}]; - // silence = gDigitalSilenceAsset.anyAudioTrack; - // silenceTimeRange.duration = CMTimeSubtract(videoTrackTimeRange.duration, audioTrackTimeRange.duration); - // } if([self isCancelled]) return nil; @@ -326,4 +319,4 @@ static NSOperationQueue *gOperationQueue = nil; return instance; } -@end \ No newline at end of file +@end diff --git a/LegacyComponents/GLProgram.m b/LegacyComponents/GLProgram.m index ab6320e85b..26173d05c6 100755 --- a/LegacyComponents/GLProgram.m +++ b/LegacyComponents/GLProgram.m @@ -2,6 +2,7 @@ // A description of this can be found at his page on the topic: // http://iphonedevelopment.blogspot.com/2010/11/opengl-es-20-for-ios-chapter-4.html +#import "LegacyComponentsInternal.h" #import "GLProgram.h" // START:typedefs @@ -66,7 +67,7 @@ typedef void (*GLLogFunction) (GLuint program, - (id)initWithVertexShaderString:(NSString *)vShaderString fragmentShaderFilename:(NSString *)fShaderFilename { - NSString *fragShaderPathname = [[NSBundle mainBundle] pathForResource:fShaderFilename ofType:@"fsh"]; + NSString *fragShaderPathname = TGComponentsPathForResource(fShaderFilename, @"fsh"); NSString *fragmentShaderString = [NSString stringWithContentsOfFile:fragShaderPathname encoding:NSUTF8StringEncoding error:nil]; if ((self = [self initWithVertexShaderString:vShaderString fragmentShaderString:fragmentShaderString])) @@ -79,10 +80,10 @@ typedef void (*GLLogFunction) (GLuint program, - (id)initWithVertexShaderFilename:(NSString *)vShaderFilename fragmentShaderFilename:(NSString *)fShaderFilename { - NSString *vertShaderPathname = [[NSBundle mainBundle] pathForResource:vShaderFilename ofType:@"vsh"]; + NSString *vertShaderPathname = TGComponentsPathForResource(vShaderFilename, @"vsh"); NSString *vertexShaderString = [NSString stringWithContentsOfFile:vertShaderPathname encoding:NSUTF8StringEncoding error:nil]; - NSString *fragShaderPathname = [[NSBundle mainBundle] pathForResource:fShaderFilename ofType:@"fsh"]; + NSString *fragShaderPathname = TGComponentsPathForResource(fShaderFilename, @"fsh"); NSString *fragmentShaderString = [NSString stringWithContentsOfFile:fragShaderPathname encoding:NSUTF8StringEncoding error:nil]; if ((self = [self initWithVertexShaderString:vertexShaderString fragmentShaderString:fragmentShaderString])) diff --git a/LegacyComponents/GPUImageFilter.m b/LegacyComponents/GPUImageFilter.m index 68b713fb1f..1f54c6eb63 100755 --- a/LegacyComponents/GPUImageFilter.m +++ b/LegacyComponents/GPUImageFilter.m @@ -1,6 +1,8 @@ #import "GPUImageFilter.h" #import +#import "LegacyComponentsInternal.h" + // Hardcode the vertex shader for standard filters, but this can be overridden NSString *const kGPUImageVertexShaderString = SHADER_STRING ( @@ -119,7 +121,7 @@ NSString *const kGPUImagePassthroughFragmentShaderString = SHADER_STRING - (id)initWithFragmentShaderFromFile:(NSString *)fragmentShaderFilename { - NSString *fragmentShaderPathname = [[NSBundle mainBundle] pathForResource:fragmentShaderFilename ofType:@"fsh"]; + NSString *fragmentShaderPathname = TGComponentsPathForResource(fragmentShaderFilename, @"fsh"); NSString *fragmentShaderString = [NSString stringWithContentsOfFile:fragmentShaderPathname encoding:NSUTF8StringEncoding error:nil]; if (!(self = [self initWithFragmentShaderFromString:fragmentShaderString])) diff --git a/LegacyComponents/LegacyComponents.h b/LegacyComponents/LegacyComponents.h index d1d030a2d0..70ff6a714c 100644 --- a/LegacyComponents/LegacyComponents.h +++ b/LegacyComponents/LegacyComponents.h @@ -154,7 +154,6 @@ FOUNDATION_EXPORT const unsigned char LegacyComponentsVersionString[]; #import #import #import -#import #import #import #import @@ -193,7 +192,6 @@ FOUNDATION_EXPORT const unsigned char LegacyComponentsVersionString[]; #import #import #import -#import #import #import @@ -266,6 +264,7 @@ FOUNDATION_EXPORT const unsigned char LegacyComponentsVersionString[]; #import #import #import +#import #import #import @@ -275,3 +274,10 @@ FOUNDATION_EXPORT const unsigned char LegacyComponentsVersionString[]; #import #import #import +#import +#import +#import +#import + +#import +#import diff --git a/LegacyComponents/LegacyComponentsContext.h b/LegacyComponents/LegacyComponentsContext.h index 82ab6f1f06..c59e964f2b 100644 --- a/LegacyComponents/LegacyComponentsContext.h +++ b/LegacyComponents/LegacyComponentsContext.h @@ -3,6 +3,7 @@ @class TGKeyCommandController; @class SSignal; +@class TGOverlayControllerWindow; typedef enum { LegacyComponentsActionSheetActionTypeGeneric, @@ -21,6 +22,18 @@ typedef enum { @end + +@protocol LegacyComponentsContext; + +@protocol LegacyComponentsOverlayWindowManager + +- (id)context; +- (void)bindController:(UIViewController *)controller; +- (bool)managesWindow; +- (void)setHidden:(bool)hidden window:(UIWindow *)window; + +@end + @protocol LegacyComponentsContext - (CGRect)fullscreenBounds; @@ -33,6 +46,16 @@ typedef enum { - (void)setStatusBarStyle:(UIStatusBarStyle)statusBarStyle animated:(BOOL)animated; - (void)forceStatusBarAppearanceUpdate; +- (CGFloat)applicationStatusBarAlpha; +- (void)setApplicationStatusBarAlpha:(CGFloat)alpha; + +- (void)animateApplicationStatusBarAppearance:(int)statusBarAnimation delay:(NSTimeInterval)delay duration:(NSTimeInterval)duration completion:(void (^)())completion; +- (void)animateApplicationStatusBarAppearance:(int)statusBarAnimation duration:(NSTimeInterval)duration completion:(void (^)())completion; + +- (void)animateApplicationStatusBarStyleTransitionWithDuration:(NSTimeInterval)duration; + +- (bool)rootCallStatusBarHidden; + - (bool)currentlyInSplitView; - (UIUserInterfaceSizeClass)currentSizeClass; @@ -47,4 +70,6 @@ typedef enum { - (void)presentActionSheet:(NSArray *)actions view:(UIView *)view completion:(void (^)(LegacyComponentsActionSheetAction *))completion; +- (id)makeOverlayWindowManager; + @end diff --git a/LegacyComponents/LegacyComponentsGlobals.h b/LegacyComponents/LegacyComponentsGlobals.h index d937f4eecf..6143acd30a 100644 --- a/LegacyComponents/LegacyComponentsGlobals.h +++ b/LegacyComponents/LegacyComponentsGlobals.h @@ -1,11 +1,12 @@ #import +#import -#import #import #import -#import - +@class SSignal; +@class SThreadPool; +@protocol SDisposable; @class TGLocalization; @class UIViewController; @class TGWallpaperInfo; @@ -25,8 +26,7 @@ typedef enum { @protocol LegacyComponentsGlobalsProvider - (TGLocalization *)effectiveLocalization; -- (void)log:(NSString *)format :(va_list)args; -- (UIViewController *)rootController; +- (void)log:(NSString *)string; - (NSArray *)applicationWindows; - (UIWindow *)applicationStatusBarWindow; - (UIWindow *)applicationKeyboardWindow; diff --git a/LegacyComponents/LegacyComponentsInternal.h b/LegacyComponents/LegacyComponentsInternal.h index 3bc70293da..b69a834ef7 100644 --- a/LegacyComponents/LegacyComponentsInternal.h +++ b/LegacyComponents/LegacyComponentsInternal.h @@ -22,6 +22,9 @@ void TGDispatchAfter(double delay, dispatch_queue_t queue, dispatch_block_t bloc int deviceMemorySize(); int cpuCoreCount(); +UIImage *TGComponentsImageNamed(NSString *name); +NSString *TGComponentsPathForResource(NSString *name, NSString *type); + #define UIColorRGB(rgb) ([[UIColor alloc] initWithRed:(((rgb >> 16) & 0xff) / 255.0f) green:(((rgb >> 8) & 0xff) / 255.0f) blue:(((rgb) & 0xff) / 255.0f) alpha:1.0f]) #define UIColorRGBA(rgb,a) ([[UIColor alloc] initWithRed:(((rgb >> 16) & 0xff) / 255.0f) green:(((rgb >> 8) & 0xff) / 255.0f) blue:(((rgb) & 0xff) / 255.0f) alpha:a]) @@ -58,4 +61,3 @@ int cpuCoreCount(); #ifdef __cplusplus } #endif - diff --git a/LegacyComponents/LegacyComponentsInternal.m b/LegacyComponents/LegacyComponentsInternal.m index 8ca86a9a76..58c12b85e2 100644 --- a/LegacyComponents/LegacyComponentsInternal.m +++ b/LegacyComponents/LegacyComponentsInternal.m @@ -35,8 +35,9 @@ void TGLog(NSString *format, ...) { va_list L; va_start(L, format); - [[LegacyComponentsGlobals provider] log:format :L]; + NSString *string = [[NSString alloc] initWithFormat:format arguments:L]; va_end(L); + [[LegacyComponentsGlobals provider] log:string]; } int iosMajorVersion() @@ -155,3 +156,26 @@ void TGDispatchAfter(double delay, dispatch_queue_t queue, dispatch_block_t bloc { dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)((delay) * NSEC_PER_SEC)), queue, block); } + +static NSBundle *frameworkBundle() { + static NSBundle *currentBundle = nil; + static dispatch_once_t onceToken; + dispatch_once(&onceToken, ^{ + currentBundle = [NSBundle bundleForClass:[LegacyComponentsGlobals class]]; + NSString *updatedPath = [[currentBundle bundlePath] stringByAppendingPathComponent:@"LegacyComponentsResources.bundle"]; + currentBundle = [NSBundle bundleWithPath:updatedPath]; + }); + return currentBundle; +} + +UIImage *TGComponentsImageNamed(NSString *name) { + UIImage *image = [UIImage imageNamed:name inBundle:frameworkBundle() compatibleWithTraitCollection:nil]; + if (image == nil) { + assert(true); + } + return image; +} + +NSString *TGComponentsPathForResource(NSString *name, NSString *type) { + return [frameworkBundle() pathForResource:name ofType:type]; +} diff --git a/LegacyComponents/PGBlurTool.m b/LegacyComponents/PGBlurTool.m index cd9233928c..897ebffb96 100644 --- a/LegacyComponents/PGBlurTool.m +++ b/LegacyComponents/PGBlurTool.m @@ -95,11 +95,6 @@ return TGLocalized(@"PhotoEditor.BlurToolRadius"); } -- (UIImage *)image -{ - return [UIImage imageNamed:@"PhotoEditorBlurTool"]; -} - - (UIView *)itemControlViewWithChangeBlock:(void (^)(id newValue, bool animated))changeBlock { return [self itemControlViewWithChangeBlock:changeBlock explicit:false nameWidth:0.0f]; diff --git a/LegacyComponents/PGContrastTool.m b/LegacyComponents/PGContrastTool.m index c0343866bc..f72969da23 100644 --- a/LegacyComponents/PGContrastTool.m +++ b/LegacyComponents/PGContrastTool.m @@ -33,11 +33,6 @@ return TGLocalized(@"PhotoEditor.ContrastTool"); } -- (UIImage *)image -{ - return [UIImage imageNamed:@"PhotoEditorContrastTool"]; -} - - (bool)shouldBeSkipped { return (ABS(((NSNumber *)self.displayValue).floatValue - (float)self.defaultValue) < FLT_EPSILON); diff --git a/LegacyComponents/PGCurvesTool.m b/LegacyComponents/PGCurvesTool.m index 92258ea117..26cd42c9e8 100644 --- a/LegacyComponents/PGCurvesTool.m +++ b/LegacyComponents/PGCurvesTool.m @@ -195,11 +195,6 @@ const NSUInteger PGCurveDataStep = 2; return TGLocalized(@"PhotoEditor.CurvesTool"); } -- (UIImage *)image -{ - return [UIImage imageNamed:@"PhotoEditorCurvesTool"]; -} - - (UIView *)itemAreaViewWithChangeBlock:(void (^)(id))changeBlock explicit:(bool)explicit { __weak PGCurvesTool *weakSelf = self; diff --git a/LegacyComponents/PGEnhanceTool.m b/LegacyComponents/PGEnhanceTool.m index a7d8691c85..4bb20d3755 100644 --- a/LegacyComponents/PGEnhanceTool.m +++ b/LegacyComponents/PGEnhanceTool.m @@ -31,11 +31,6 @@ return TGLocalized(@"PhotoEditor.EnhanceTool"); } -- (UIImage *)image -{ - return [UIImage imageNamed:@"PhotoEditorEnhanceTool"]; -} - - (PGPhotoProcessPass *)pass { [self updatePassParameters]; diff --git a/LegacyComponents/PGExposureTool.m b/LegacyComponents/PGExposureTool.m index 8fd8800e7d..638d38c75e 100644 --- a/LegacyComponents/PGExposureTool.m +++ b/LegacyComponents/PGExposureTool.m @@ -33,11 +33,6 @@ return TGLocalized(@"PhotoEditor.ExposureTool"); } -- (UIImage *)image -{ - return [UIImage imageNamed:@"PhotoEditorExposureTool"]; -} - - (bool)shouldBeSkipped { return (ABS(((NSNumber *)self.displayValue).floatValue - (float)self.defaultValue) < FLT_EPSILON); diff --git a/LegacyComponents/PGFadeTool.m b/LegacyComponents/PGFadeTool.m index 5121f0695f..ad07744ea5 100644 --- a/LegacyComponents/PGFadeTool.m +++ b/LegacyComponents/PGFadeTool.m @@ -33,11 +33,6 @@ return TGLocalized(@"PhotoEditor.FadeTool"); } -- (UIImage *)image -{ - return [UIImage imageNamed:@"PhotoEditorFadeTool"]; -} - - (bool)shouldBeSkipped { return (ABS(((NSNumber *)self.displayValue).floatValue - self.defaultValue) < FLT_EPSILON); diff --git a/LegacyComponents/PGGrainTool.m b/LegacyComponents/PGGrainTool.m index 30b48fcdc5..4ea1ada749 100644 --- a/LegacyComponents/PGGrainTool.m +++ b/LegacyComponents/PGGrainTool.m @@ -33,11 +33,6 @@ return TGLocalized(@"PhotoEditor.GrainTool"); } -- (UIImage *)image -{ - return [UIImage imageNamed:@"PhotoEditorGrainTool"]; -} - - (bool)shouldBeSkipped { return (ABS(((NSNumber *)self.displayValue).floatValue - (float)self.defaultValue) < FLT_EPSILON); diff --git a/LegacyComponents/PGHighlightsTool.m b/LegacyComponents/PGHighlightsTool.m index 6bdce97069..488f827c85 100644 --- a/LegacyComponents/PGHighlightsTool.m +++ b/LegacyComponents/PGHighlightsTool.m @@ -33,11 +33,6 @@ return TGLocalized(@"PhotoEditor.HighlightsTool"); } -- (UIImage *)image -{ - return [UIImage imageNamed:@"PhotoEditorHighlightsTool"]; -} - - (bool)shouldBeSkipped { return (ABS(((NSNumber *)self.displayValue).floatValue - self.defaultValue) < FLT_EPSILON); diff --git a/LegacyComponents/PGPhotoCustomFilterPass.m b/LegacyComponents/PGPhotoCustomFilterPass.m index b06b970779..bd47f4a682 100644 --- a/LegacyComponents/PGPhotoCustomFilterPass.m +++ b/LegacyComponents/PGPhotoCustomFilterPass.m @@ -2,6 +2,8 @@ #import "PGPhotoEditorPicture.h" +#import "LegacyComponentsInternal.h" + NSString *const PGPhotoFilterDefinitionsShaderString = PGShaderString ( precision highp float; @@ -367,7 +369,7 @@ NSString *const PGPhotoFilterMainShaderString = PGShaderString - (instancetype)initWithShaderFile:(NSString *)shaderFile textureFiles:(NSArray *)textureFiles optimized:(bool)optimized { - NSString *fragmentShaderPathname = [[NSBundle mainBundle] pathForResource:shaderFile ofType:@"fsh"]; + NSString *fragmentShaderPathname = TGComponentsPathForResource(shaderFile, @"fsh"); NSString *fragmentShaderString = [NSString stringWithContentsOfFile:fragmentShaderPathname encoding:NSUTF8StringEncoding error:nil]; NSMutableArray *textureImages = [[NSMutableArray alloc] init]; @@ -387,7 +389,7 @@ NSString *const PGPhotoFilterMainShaderString = PGShaderString NSString *name = [[textureFile lastPathComponent] stringByDeletingPathExtension]; NSString *extension = [textureFile pathExtension]; - NSString *texturePathname = [[NSBundle mainBundle] pathForResource:name ofType:extension]; + NSString *texturePathname = TGComponentsPathForResource(name, extension); UIImage *textureImage = [UIImage imageWithContentsOfFile:texturePathname]; [textureImages addObject:textureImage]; diff --git a/LegacyComponents/PGPhotoTool.h b/LegacyComponents/PGPhotoTool.h index 55a7e8c9e8..c0fc9b9b6e 100644 --- a/LegacyComponents/PGPhotoTool.h +++ b/LegacyComponents/PGPhotoTool.h @@ -33,7 +33,6 @@ typedef enum @property (nonatomic, readonly) PGPhotoToolType type; @property (nonatomic, readonly) NSInteger order; -@property (nonatomic, readonly) UIImage *image; @property (nonatomic, readonly) bool isHidden; diff --git a/LegacyComponents/PGSaturationTool.m b/LegacyComponents/PGSaturationTool.m index 87fc1c8490..ec5193a0cc 100644 --- a/LegacyComponents/PGSaturationTool.m +++ b/LegacyComponents/PGSaturationTool.m @@ -33,11 +33,6 @@ return TGLocalized(@"PhotoEditor.SaturationTool"); } -- (UIImage *)image -{ - return [UIImage imageNamed:@"PhotoEditorSaturationTool"]; -} - - (bool)shouldBeSkipped { return (ABS(((NSNumber *)self.displayValue).floatValue - (float)self.defaultValue) < FLT_EPSILON); diff --git a/LegacyComponents/PGShadowsTool.m b/LegacyComponents/PGShadowsTool.m index aea61ee457..0fbf5ca6c2 100644 --- a/LegacyComponents/PGShadowsTool.m +++ b/LegacyComponents/PGShadowsTool.m @@ -33,11 +33,6 @@ return TGLocalized(@"PhotoEditor.ShadowsTool"); } -- (UIImage *)image -{ - return [UIImage imageNamed:@"PhotoEditorShadowsTool"]; -} - - (bool)shouldBeSkipped { return (ABS(((NSNumber *)self.displayValue).floatValue - (float)self.defaultValue) < FLT_EPSILON); diff --git a/LegacyComponents/PGSharpenTool.m b/LegacyComponents/PGSharpenTool.m index 641f8b089d..cfeb696d6d 100644 --- a/LegacyComponents/PGSharpenTool.m +++ b/LegacyComponents/PGSharpenTool.m @@ -31,11 +31,6 @@ return TGLocalized(@"PhotoEditor.SharpenTool"); } -- (UIImage *)image -{ - return [UIImage imageNamed:@"PhotoEditorSharpenTool"]; -} - - (PGPhotoProcessPass *)pass { [self updatePassParameters]; diff --git a/LegacyComponents/PGTintTool.m b/LegacyComponents/PGTintTool.m index 5c4ab532bf..57d5ae28e8 100644 --- a/LegacyComponents/PGTintTool.m +++ b/LegacyComponents/PGTintTool.m @@ -96,11 +96,6 @@ return TGLocalized(@"PhotoEditor.TintTool"); } -- (UIImage *)image -{ - return [UIImage imageNamed:@"PhotoEditorTintTool"]; -} - - (UIView *)itemControlViewWithChangeBlock:(void (^)(id, bool))changeBlock explicit:(bool)explicit nameWidth:(CGFloat)__unused nameWidth { __weak PGTintTool *weakSelf = self; diff --git a/LegacyComponents/PGVignetteTool.m b/LegacyComponents/PGVignetteTool.m index a13709dae3..3e64b56e5b 100644 --- a/LegacyComponents/PGVignetteTool.m +++ b/LegacyComponents/PGVignetteTool.m @@ -33,11 +33,6 @@ return TGLocalized(@"PhotoEditor.VignetteTool"); } -- (UIImage *)image -{ - return [UIImage imageNamed:@"PhotoEditorVignetteTool"]; -} - - (bool)shouldBeSkipped { return (ABS(((NSNumber *)self.displayValue).floatValue - (float)self.defaultValue) < FLT_EPSILON); diff --git a/LegacyComponents/PGWarmthTool.m b/LegacyComponents/PGWarmthTool.m index 33e0ada382..05fdce3c61 100644 --- a/LegacyComponents/PGWarmthTool.m +++ b/LegacyComponents/PGWarmthTool.m @@ -33,11 +33,6 @@ return TGLocalized(@"PhotoEditor.WarmthTool"); } -- (UIImage *)image -{ - return [UIImage imageNamed:@"PhotoEditorWarmthTool"]; -} - - (bool)shouldBeSkipped { return (ABS(((NSNumber *)self.displayValue).floatValue - self.defaultValue) < FLT_EPSILON); diff --git a/LegacyComponents/Resources/LegacyComponentsResources.bundle/AttachmentMenuInteractiveCameraIcon.png b/LegacyComponents/Resources/LegacyComponentsResources.bundle/AttachmentMenuInteractiveCameraIcon.png new file mode 100644 index 0000000000..4edffbcd9e Binary files /dev/null and b/LegacyComponents/Resources/LegacyComponentsResources.bundle/AttachmentMenuInteractiveCameraIcon.png differ diff --git a/LegacyComponents/Resources/LegacyComponentsResources.bundle/AttachmentMenuInteractiveCameraIcon@2x.png b/LegacyComponents/Resources/LegacyComponentsResources.bundle/AttachmentMenuInteractiveCameraIcon@2x.png new file mode 100644 index 0000000000..daadae95df Binary files /dev/null and b/LegacyComponents/Resources/LegacyComponentsResources.bundle/AttachmentMenuInteractiveCameraIcon@2x.png differ diff --git a/LegacyComponents/Resources/LegacyComponentsResources.bundle/AttachmentMenuInteractiveCameraIcon@3x.png b/LegacyComponents/Resources/LegacyComponentsResources.bundle/AttachmentMenuInteractiveCameraIcon@3x.png new file mode 100644 index 0000000000..aca9c574b7 Binary files /dev/null and b/LegacyComponents/Resources/LegacyComponentsResources.bundle/AttachmentMenuInteractiveCameraIcon@3x.png differ diff --git a/LegacyComponents/Resources/LegacyComponentsResources.bundle/AttachmentTipIcons@2x.png b/LegacyComponents/Resources/LegacyComponentsResources.bundle/AttachmentTipIcons@2x.png new file mode 100644 index 0000000000..eb05b2f187 Binary files /dev/null and b/LegacyComponents/Resources/LegacyComponentsResources.bundle/AttachmentTipIcons@2x.png differ diff --git a/LegacyComponents/Resources/LegacyComponentsResources.bundle/CameraAutoFocusCrosshairs.png b/LegacyComponents/Resources/LegacyComponentsResources.bundle/CameraAutoFocusCrosshairs.png new file mode 100644 index 0000000000..448abbcfc9 Binary files /dev/null and b/LegacyComponents/Resources/LegacyComponentsResources.bundle/CameraAutoFocusCrosshairs.png differ diff --git a/LegacyComponents/Resources/LegacyComponentsResources.bundle/CameraAutoFocusCrosshairs@2x.png b/LegacyComponents/Resources/LegacyComponentsResources.bundle/CameraAutoFocusCrosshairs@2x.png new file mode 100644 index 0000000000..cea8bb3d3f Binary files /dev/null and b/LegacyComponents/Resources/LegacyComponentsResources.bundle/CameraAutoFocusCrosshairs@2x.png differ diff --git a/LegacyComponents/Resources/LegacyComponentsResources.bundle/CameraAutoFocusCrosshairs@3x.png b/LegacyComponents/Resources/LegacyComponentsResources.bundle/CameraAutoFocusCrosshairs@3x.png new file mode 100644 index 0000000000..4c03577c12 Binary files /dev/null and b/LegacyComponents/Resources/LegacyComponentsResources.bundle/CameraAutoFocusCrosshairs@3x.png differ diff --git a/LegacyComponents/Resources/LegacyComponentsResources.bundle/CameraDeleteIcon@2x.png b/LegacyComponents/Resources/LegacyComponentsResources.bundle/CameraDeleteIcon@2x.png new file mode 100644 index 0000000000..7560d4d7ad Binary files /dev/null and b/LegacyComponents/Resources/LegacyComponentsResources.bundle/CameraDeleteIcon@2x.png differ diff --git a/LegacyComponents/Resources/LegacyComponentsResources.bundle/CameraExposureIcon@2x.png b/LegacyComponents/Resources/LegacyComponentsResources.bundle/CameraExposureIcon@2x.png new file mode 100644 index 0000000000..763171ed09 Binary files /dev/null and b/LegacyComponents/Resources/LegacyComponentsResources.bundle/CameraExposureIcon@2x.png differ diff --git a/LegacyComponents/Resources/LegacyComponentsResources.bundle/CameraFlashActive@2x.png b/LegacyComponents/Resources/LegacyComponentsResources.bundle/CameraFlashActive@2x.png new file mode 100644 index 0000000000..122e1ea097 Binary files /dev/null and b/LegacyComponents/Resources/LegacyComponentsResources.bundle/CameraFlashActive@2x.png differ diff --git a/LegacyComponents/Resources/LegacyComponentsResources.bundle/CameraFlashButton@2x.png b/LegacyComponents/Resources/LegacyComponentsResources.bundle/CameraFlashButton@2x.png new file mode 100644 index 0000000000..abc8a3dc0c Binary files /dev/null and b/LegacyComponents/Resources/LegacyComponentsResources.bundle/CameraFlashButton@2x.png differ diff --git a/LegacyComponents/Resources/LegacyComponentsResources.bundle/CameraFlashButton@3x.png b/LegacyComponents/Resources/LegacyComponentsResources.bundle/CameraFlashButton@3x.png new file mode 100644 index 0000000000..923087042b Binary files /dev/null and b/LegacyComponents/Resources/LegacyComponentsResources.bundle/CameraFlashButton@3x.png differ diff --git a/LegacyComponents/Resources/LegacyComponentsResources.bundle/CameraFocusCrosshairs.png b/LegacyComponents/Resources/LegacyComponentsResources.bundle/CameraFocusCrosshairs.png new file mode 100644 index 0000000000..54a116fa5c Binary files /dev/null and b/LegacyComponents/Resources/LegacyComponentsResources.bundle/CameraFocusCrosshairs.png differ diff --git a/LegacyComponents/Resources/LegacyComponentsResources.bundle/CameraFocusCrosshairs@2x.png b/LegacyComponents/Resources/LegacyComponentsResources.bundle/CameraFocusCrosshairs@2x.png new file mode 100644 index 0000000000..72b27f345b Binary files /dev/null and b/LegacyComponents/Resources/LegacyComponentsResources.bundle/CameraFocusCrosshairs@2x.png differ diff --git a/LegacyComponents/Resources/LegacyComponentsResources.bundle/CameraFocusCrosshairs@3x.png b/LegacyComponents/Resources/LegacyComponentsResources.bundle/CameraFocusCrosshairs@3x.png new file mode 100644 index 0000000000..cc2d5a0271 Binary files /dev/null and b/LegacyComponents/Resources/LegacyComponentsResources.bundle/CameraFocusCrosshairs@3x.png differ diff --git a/LegacyComponents/Resources/LegacyComponentsResources.bundle/CameraLargeFlipButton@2x.png b/LegacyComponents/Resources/LegacyComponentsResources.bundle/CameraLargeFlipButton@2x.png new file mode 100644 index 0000000000..fafcd5613a Binary files /dev/null and b/LegacyComponents/Resources/LegacyComponentsResources.bundle/CameraLargeFlipButton@2x.png differ diff --git a/LegacyComponents/Resources/LegacyComponentsResources.bundle/CameraLargeFlipButton@3x.png b/LegacyComponents/Resources/LegacyComponentsResources.bundle/CameraLargeFlipButton@3x.png new file mode 100644 index 0000000000..5c1f542577 Binary files /dev/null and b/LegacyComponents/Resources/LegacyComponentsResources.bundle/CameraLargeFlipButton@3x.png differ diff --git a/LegacyComponents/Resources/LegacyComponentsResources.bundle/CameraSegmentsBack@2x.png b/LegacyComponents/Resources/LegacyComponentsResources.bundle/CameraSegmentsBack@2x.png new file mode 100644 index 0000000000..1a6878b2a4 Binary files /dev/null and b/LegacyComponents/Resources/LegacyComponentsResources.bundle/CameraSegmentsBack@2x.png differ diff --git a/LegacyComponents/Resources/LegacyComponentsResources.bundle/CoubWatermark@2x.png b/LegacyComponents/Resources/LegacyComponentsResources.bundle/CoubWatermark@2x.png new file mode 100644 index 0000000000..1a1078b4d8 Binary files /dev/null and b/LegacyComponents/Resources/LegacyComponentsResources.bundle/CoubWatermark@2x.png differ diff --git a/LegacyComponents/Resources/LegacyComponentsResources.bundle/DefaultPlayer.html b/LegacyComponents/Resources/LegacyComponentsResources.bundle/DefaultPlayer.html new file mode 100755 index 0000000000..0a5b5befaf --- /dev/null +++ b/LegacyComponents/Resources/LegacyComponentsResources.bundle/DefaultPlayer.html @@ -0,0 +1,42 @@ + + + + + + +
+ +
+ + + diff --git a/LegacyComponents/Resources/LegacyComponentsResources.bundle/DefaultPlayerInject.js b/LegacyComponents/Resources/LegacyComponentsResources.bundle/DefaultPlayerInject.js new file mode 100644 index 0000000000..4e3bbaa0b0 --- /dev/null +++ b/LegacyComponents/Resources/LegacyComponentsResources.bundle/DefaultPlayerInject.js @@ -0,0 +1,18 @@ +function fixInline() { + var video = document.getElementsByTagName('video')[0]; + video.setAttribute('webkit-playsinline', ''); + video.setAttribute('playsinline', ''); + video.webkitExitFullscreen = undefined; + + video.play(); +} + +function receiveMessage(evt) { + try { + var obj = JSON.parse(evt.data); + if (obj.cmd == 'fixInline') + fixInline(); + } catch (ex) { } +} + +window.addEventListener('message', receiveMessage, false); diff --git a/LegacyComponents/Resources/LegacyComponentsResources.bundle/EmbedVideoFullScreenIcon@2x.png b/LegacyComponents/Resources/LegacyComponentsResources.bundle/EmbedVideoFullScreenIcon@2x.png new file mode 100644 index 0000000000..0ad54e3680 Binary files /dev/null and b/LegacyComponents/Resources/LegacyComponentsResources.bundle/EmbedVideoFullScreenIcon@2x.png differ diff --git a/LegacyComponents/Resources/LegacyComponentsResources.bundle/EmbedVideoPIPIcon@2x.png b/LegacyComponents/Resources/LegacyComponentsResources.bundle/EmbedVideoPIPIcon@2x.png new file mode 100644 index 0000000000..9c6de4b160 Binary files /dev/null and b/LegacyComponents/Resources/LegacyComponentsResources.bundle/EmbedVideoPIPIcon@2x.png differ diff --git a/LegacyComponents/Resources/LegacyComponentsResources.bundle/EmbedVideoPauseIcon@2x.png b/LegacyComponents/Resources/LegacyComponentsResources.bundle/EmbedVideoPauseIcon@2x.png new file mode 100644 index 0000000000..54402daf4b Binary files /dev/null and b/LegacyComponents/Resources/LegacyComponentsResources.bundle/EmbedVideoPauseIcon@2x.png differ diff --git a/LegacyComponents/Resources/LegacyComponentsResources.bundle/EmbedVideoPlayIcon@2x.png b/LegacyComponents/Resources/LegacyComponentsResources.bundle/EmbedVideoPlayIcon@2x.png new file mode 100644 index 0000000000..f2a2e4422e Binary files /dev/null and b/LegacyComponents/Resources/LegacyComponentsResources.bundle/EmbedVideoPlayIcon@2x.png differ diff --git a/LegacyComponents/Resources/LegacyComponentsResources.bundle/EmbedVideoTrackHollow@2x.png b/LegacyComponents/Resources/LegacyComponentsResources.bundle/EmbedVideoTrackHollow@2x.png new file mode 100644 index 0000000000..7b0f4e5a00 Binary files /dev/null and b/LegacyComponents/Resources/LegacyComponentsResources.bundle/EmbedVideoTrackHollow@2x.png differ diff --git a/LegacyComponents/Resources/LegacyComponentsResources.bundle/ImagePickerPhotoCounter_Close@2x.png b/LegacyComponents/Resources/LegacyComponentsResources.bundle/ImagePickerPhotoCounter_Close@2x.png new file mode 100644 index 0000000000..eec9efa573 Binary files /dev/null and b/LegacyComponents/Resources/LegacyComponentsResources.bundle/ImagePickerPhotoCounter_Close@2x.png differ diff --git a/LegacyComponents/Resources/LegacyComponentsResources.bundle/ImagePickerPhotoCounter_Close@3x.png b/LegacyComponents/Resources/LegacyComponentsResources.bundle/ImagePickerPhotoCounter_Close@3x.png new file mode 100644 index 0000000000..fb0a4bd6e3 Binary files /dev/null and b/LegacyComponents/Resources/LegacyComponentsResources.bundle/ImagePickerPhotoCounter_Close@3x.png differ diff --git a/LegacyComponents/Resources/LegacyComponentsResources.bundle/InstagramPlayer.html b/LegacyComponents/Resources/LegacyComponentsResources.bundle/InstagramPlayer.html new file mode 100755 index 0000000000..b21889acac --- /dev/null +++ b/LegacyComponents/Resources/LegacyComponentsResources.bundle/InstagramPlayer.html @@ -0,0 +1,52 @@ + + + + + + +
+ +
+ + + diff --git a/LegacyComponents/Resources/LegacyComponentsResources.bundle/MediaGroupAll@2x.png b/LegacyComponents/Resources/LegacyComponentsResources.bundle/MediaGroupAll@2x.png new file mode 100644 index 0000000000..9abbef6249 Binary files /dev/null and b/LegacyComponents/Resources/LegacyComponentsResources.bundle/MediaGroupAll@2x.png differ diff --git a/LegacyComponents/Resources/LegacyComponentsResources.bundle/MediaGroupBurst@2x.png b/LegacyComponents/Resources/LegacyComponentsResources.bundle/MediaGroupBurst@2x.png new file mode 100644 index 0000000000..0556204ada Binary files /dev/null and b/LegacyComponents/Resources/LegacyComponentsResources.bundle/MediaGroupBurst@2x.png differ diff --git a/LegacyComponents/Resources/LegacyComponentsResources.bundle/MediaGroupFavorites@2x.png b/LegacyComponents/Resources/LegacyComponentsResources.bundle/MediaGroupFavorites@2x.png new file mode 100644 index 0000000000..1d79276cab Binary files /dev/null and b/LegacyComponents/Resources/LegacyComponentsResources.bundle/MediaGroupFavorites@2x.png differ diff --git a/LegacyComponents/Resources/LegacyComponentsResources.bundle/MediaGroupPanoramas@2x.png b/LegacyComponents/Resources/LegacyComponentsResources.bundle/MediaGroupPanoramas@2x.png new file mode 100644 index 0000000000..77d4038d02 Binary files /dev/null and b/LegacyComponents/Resources/LegacyComponentsResources.bundle/MediaGroupPanoramas@2x.png differ diff --git a/LegacyComponents/Resources/LegacyComponentsResources.bundle/MediaGroupScreenshots@2x.png b/LegacyComponents/Resources/LegacyComponentsResources.bundle/MediaGroupScreenshots@2x.png new file mode 100644 index 0000000000..86f314fb73 Binary files /dev/null and b/LegacyComponents/Resources/LegacyComponentsResources.bundle/MediaGroupScreenshots@2x.png differ diff --git a/LegacyComponents/Resources/LegacyComponentsResources.bundle/MediaGroupSelfPortraits@2x.png b/LegacyComponents/Resources/LegacyComponentsResources.bundle/MediaGroupSelfPortraits@2x.png new file mode 100644 index 0000000000..ae188a3546 Binary files /dev/null and b/LegacyComponents/Resources/LegacyComponentsResources.bundle/MediaGroupSelfPortraits@2x.png differ diff --git a/LegacyComponents/Resources/LegacyComponentsResources.bundle/MediaGroupSlomo@2x.png b/LegacyComponents/Resources/LegacyComponentsResources.bundle/MediaGroupSlomo@2x.png new file mode 100644 index 0000000000..dd9d235263 Binary files /dev/null and b/LegacyComponents/Resources/LegacyComponentsResources.bundle/MediaGroupSlomo@2x.png differ diff --git a/LegacyComponents/Resources/LegacyComponentsResources.bundle/MediaGroupTimelapse@2x.png b/LegacyComponents/Resources/LegacyComponentsResources.bundle/MediaGroupTimelapse@2x.png new file mode 100644 index 0000000000..e45011a63e Binary files /dev/null and b/LegacyComponents/Resources/LegacyComponentsResources.bundle/MediaGroupTimelapse@2x.png differ diff --git a/LegacyComponents/Resources/LegacyComponentsResources.bundle/MediaGroupVideo@2x.png b/LegacyComponents/Resources/LegacyComponentsResources.bundle/MediaGroupVideo@2x.png new file mode 100644 index 0000000000..b765b548bc Binary files /dev/null and b/LegacyComponents/Resources/LegacyComponentsResources.bundle/MediaGroupVideo@2x.png differ diff --git a/LegacyComponents/Resources/LegacyComponentsResources.bundle/ModernListsDisclosureIndicator@2x.png b/LegacyComponents/Resources/LegacyComponentsResources.bundle/ModernListsDisclosureIndicator@2x.png new file mode 100644 index 0000000000..13f35bc881 Binary files /dev/null and b/LegacyComponents/Resources/LegacyComponentsResources.bundle/ModernListsDisclosureIndicator@2x.png differ diff --git a/LegacyComponents/Resources/LegacyComponentsResources.bundle/ModernListsDisclosureIndicator@3x.png b/LegacyComponents/Resources/LegacyComponentsResources.bundle/ModernListsDisclosureIndicator@3x.png new file mode 100644 index 0000000000..f4d32cedec Binary files /dev/null and b/LegacyComponents/Resources/LegacyComponentsResources.bundle/ModernListsDisclosureIndicator@3x.png differ diff --git a/LegacyComponents/Resources/LegacyComponentsResources.bundle/ModernMediaEmptyAlbumIcon@2x.png b/LegacyComponents/Resources/LegacyComponentsResources.bundle/ModernMediaEmptyAlbumIcon@2x.png new file mode 100644 index 0000000000..a87bc1ba60 Binary files /dev/null and b/LegacyComponents/Resources/LegacyComponentsResources.bundle/ModernMediaEmptyAlbumIcon@2x.png differ diff --git a/LegacyComponents/Resources/LegacyComponentsResources.bundle/ModernMediaItemSloMoIcon@2x.png b/LegacyComponents/Resources/LegacyComponentsResources.bundle/ModernMediaItemSloMoIcon@2x.png new file mode 100644 index 0000000000..1a9f9ef93a Binary files /dev/null and b/LegacyComponents/Resources/LegacyComponentsResources.bundle/ModernMediaItemSloMoIcon@2x.png differ diff --git a/LegacyComponents/Resources/LegacyComponentsResources.bundle/ModernMediaItemTimelapseIcon@2x.png b/LegacyComponents/Resources/LegacyComponentsResources.bundle/ModernMediaItemTimelapseIcon@2x.png new file mode 100644 index 0000000000..b3bd9f85eb Binary files /dev/null and b/LegacyComponents/Resources/LegacyComponentsResources.bundle/ModernMediaItemTimelapseIcon@2x.png differ diff --git a/LegacyComponents/Resources/LegacyComponentsResources.bundle/ModernMediaItemVideoIcon@2x.png b/LegacyComponents/Resources/LegacyComponentsResources.bundle/ModernMediaItemVideoIcon@2x.png new file mode 100644 index 0000000000..bbfceac421 Binary files /dev/null and b/LegacyComponents/Resources/LegacyComponentsResources.bundle/ModernMediaItemVideoIcon@2x.png differ diff --git a/LegacyComponents/Resources/LegacyComponentsResources.bundle/ModernSegmentedControlBackground@2x.png b/LegacyComponents/Resources/LegacyComponentsResources.bundle/ModernSegmentedControlBackground@2x.png new file mode 100644 index 0000000000..159b99f7c7 Binary files /dev/null and b/LegacyComponents/Resources/LegacyComponentsResources.bundle/ModernSegmentedControlBackground@2x.png differ diff --git a/LegacyComponents/Resources/LegacyComponentsResources.bundle/ModernSegmentedControlBackground@3x.png b/LegacyComponents/Resources/LegacyComponentsResources.bundle/ModernSegmentedControlBackground@3x.png new file mode 100644 index 0000000000..90b1d048b2 Binary files /dev/null and b/LegacyComponents/Resources/LegacyComponentsResources.bundle/ModernSegmentedControlBackground@3x.png differ diff --git a/LegacyComponents/Resources/LegacyComponentsResources.bundle/ModernSegmentedControlDivider@2x.png b/LegacyComponents/Resources/LegacyComponentsResources.bundle/ModernSegmentedControlDivider@2x.png new file mode 100644 index 0000000000..fedfad1d89 Binary files /dev/null and b/LegacyComponents/Resources/LegacyComponentsResources.bundle/ModernSegmentedControlDivider@2x.png differ diff --git a/LegacyComponents/Resources/LegacyComponentsResources.bundle/ModernSegmentedControlDivider@3x.png b/LegacyComponents/Resources/LegacyComponentsResources.bundle/ModernSegmentedControlDivider@3x.png new file mode 100644 index 0000000000..c165592d51 Binary files /dev/null and b/LegacyComponents/Resources/LegacyComponentsResources.bundle/ModernSegmentedControlDivider@3x.png differ diff --git a/LegacyComponents/Resources/LegacyComponentsResources.bundle/ModernSegmentedControlHighlighted@2x.png b/LegacyComponents/Resources/LegacyComponentsResources.bundle/ModernSegmentedControlHighlighted@2x.png new file mode 100644 index 0000000000..84fc7c3f7c Binary files /dev/null and b/LegacyComponents/Resources/LegacyComponentsResources.bundle/ModernSegmentedControlHighlighted@2x.png differ diff --git a/LegacyComponents/Resources/LegacyComponentsResources.bundle/ModernSegmentedControlHighlighted@3x.png b/LegacyComponents/Resources/LegacyComponentsResources.bundle/ModernSegmentedControlHighlighted@3x.png new file mode 100644 index 0000000000..5ea1fc964f Binary files /dev/null and b/LegacyComponents/Resources/LegacyComponentsResources.bundle/ModernSegmentedControlHighlighted@3x.png differ diff --git a/LegacyComponents/Resources/LegacyComponentsResources.bundle/ModernSegmentedControlSelected@2x.png b/LegacyComponents/Resources/LegacyComponentsResources.bundle/ModernSegmentedControlSelected@2x.png new file mode 100644 index 0000000000..4cd1da2062 Binary files /dev/null and b/LegacyComponents/Resources/LegacyComponentsResources.bundle/ModernSegmentedControlSelected@2x.png differ diff --git a/LegacyComponents/Resources/LegacyComponentsResources.bundle/ModernSegmentedControlSelected@3x.png b/LegacyComponents/Resources/LegacyComponentsResources.bundle/ModernSegmentedControlSelected@3x.png new file mode 100644 index 0000000000..d3165fced5 Binary files /dev/null and b/LegacyComponents/Resources/LegacyComponentsResources.bundle/ModernSegmentedControlSelected@3x.png differ diff --git a/LegacyComponents/Resources/LegacyComponentsResources.bundle/NavigationSearchIcon@2x.png b/LegacyComponents/Resources/LegacyComponentsResources.bundle/NavigationSearchIcon@2x.png new file mode 100644 index 0000000000..0aab63871f Binary files /dev/null and b/LegacyComponents/Resources/LegacyComponentsResources.bundle/NavigationSearchIcon@2x.png differ diff --git a/LegacyComponents/Resources/LegacyComponentsResources.bundle/PaintBrushIcon@2x.png b/LegacyComponents/Resources/LegacyComponentsResources.bundle/PaintBrushIcon@2x.png new file mode 100644 index 0000000000..f7f8720e25 Binary files /dev/null and b/LegacyComponents/Resources/LegacyComponentsResources.bundle/PaintBrushIcon@2x.png differ diff --git a/LegacyComponents/Resources/LegacyComponentsResources.bundle/PaintBrushIcon@3x.png b/LegacyComponents/Resources/LegacyComponentsResources.bundle/PaintBrushIcon@3x.png new file mode 100644 index 0000000000..50e0696185 Binary files /dev/null and b/LegacyComponents/Resources/LegacyComponentsResources.bundle/PaintBrushIcon@3x.png differ diff --git a/LegacyComponents/Resources/LegacyComponentsResources.bundle/PaintCheck@2x.png b/LegacyComponents/Resources/LegacyComponentsResources.bundle/PaintCheck@2x.png new file mode 100644 index 0000000000..69d47f8abf Binary files /dev/null and b/LegacyComponents/Resources/LegacyComponentsResources.bundle/PaintCheck@2x.png differ diff --git a/LegacyComponents/Resources/LegacyComponentsResources.bundle/PaintEraserIcon@2x.png b/LegacyComponents/Resources/LegacyComponentsResources.bundle/PaintEraserIcon@2x.png new file mode 100644 index 0000000000..20d8c4f293 Binary files /dev/null and b/LegacyComponents/Resources/LegacyComponentsResources.bundle/PaintEraserIcon@2x.png differ diff --git a/LegacyComponents/Resources/LegacyComponentsResources.bundle/PaintEraserIcon@3x.png b/LegacyComponents/Resources/LegacyComponentsResources.bundle/PaintEraserIcon@3x.png new file mode 100644 index 0000000000..5b7b7e5bda Binary files /dev/null and b/LegacyComponents/Resources/LegacyComponentsResources.bundle/PaintEraserIcon@3x.png differ diff --git a/LegacyComponents/Resources/LegacyComponentsResources.bundle/PaintMirrorIcon@2x.png b/LegacyComponents/Resources/LegacyComponentsResources.bundle/PaintMirrorIcon@2x.png new file mode 100644 index 0000000000..e39a1d1dca Binary files /dev/null and b/LegacyComponents/Resources/LegacyComponentsResources.bundle/PaintMirrorIcon@2x.png differ diff --git a/LegacyComponents/Resources/LegacyComponentsResources.bundle/PaintMirrorIcon@3x.png b/LegacyComponents/Resources/LegacyComponentsResources.bundle/PaintMirrorIcon@3x.png new file mode 100644 index 0000000000..2c13f50e35 Binary files /dev/null and b/LegacyComponents/Resources/LegacyComponentsResources.bundle/PaintMirrorIcon@3x.png differ diff --git a/LegacyComponents/Resources/LegacyComponentsResources.bundle/PaintPopupCenterBackground@2x.png b/LegacyComponents/Resources/LegacyComponentsResources.bundle/PaintPopupCenterBackground@2x.png new file mode 100644 index 0000000000..54f036c022 Binary files /dev/null and b/LegacyComponents/Resources/LegacyComponentsResources.bundle/PaintPopupCenterBackground@2x.png differ diff --git a/LegacyComponents/Resources/LegacyComponentsResources.bundle/PaintPopupLandscapeLeftBackground@2x.png b/LegacyComponents/Resources/LegacyComponentsResources.bundle/PaintPopupLandscapeLeftBackground@2x.png new file mode 100644 index 0000000000..1efe4aaf28 Binary files /dev/null and b/LegacyComponents/Resources/LegacyComponentsResources.bundle/PaintPopupLandscapeLeftBackground@2x.png differ diff --git a/LegacyComponents/Resources/LegacyComponentsResources.bundle/PaintPopupLandscapeRightBackground@2x.png b/LegacyComponents/Resources/LegacyComponentsResources.bundle/PaintPopupLandscapeRightBackground@2x.png new file mode 100644 index 0000000000..bf878ccb5f Binary files /dev/null and b/LegacyComponents/Resources/LegacyComponentsResources.bundle/PaintPopupLandscapeRightBackground@2x.png differ diff --git a/LegacyComponents/Resources/LegacyComponentsResources.bundle/PaintPopupPortraitBackground@2x.png b/LegacyComponents/Resources/LegacyComponentsResources.bundle/PaintPopupPortraitBackground@2x.png new file mode 100644 index 0000000000..41cca8ef2f Binary files /dev/null and b/LegacyComponents/Resources/LegacyComponentsResources.bundle/PaintPopupPortraitBackground@2x.png differ diff --git a/LegacyComponents/Resources/LegacyComponentsResources.bundle/PaintRedoIcon@2x.png b/LegacyComponents/Resources/LegacyComponentsResources.bundle/PaintRedoIcon@2x.png new file mode 100644 index 0000000000..10be9f4ea8 Binary files /dev/null and b/LegacyComponents/Resources/LegacyComponentsResources.bundle/PaintRedoIcon@2x.png differ diff --git a/LegacyComponents/Resources/LegacyComponentsResources.bundle/PaintSegmentedControlHighlighted@2x.png b/LegacyComponents/Resources/LegacyComponentsResources.bundle/PaintSegmentedControlHighlighted@2x.png new file mode 100644 index 0000000000..c975d225ae Binary files /dev/null and b/LegacyComponents/Resources/LegacyComponentsResources.bundle/PaintSegmentedControlHighlighted@2x.png differ diff --git a/LegacyComponents/Resources/LegacyComponentsResources.bundle/PaintStickersIcon@2x.png b/LegacyComponents/Resources/LegacyComponentsResources.bundle/PaintStickersIcon@2x.png new file mode 100644 index 0000000000..d06e5f6b3c Binary files /dev/null and b/LegacyComponents/Resources/LegacyComponentsResources.bundle/PaintStickersIcon@2x.png differ diff --git a/LegacyComponents/Resources/LegacyComponentsResources.bundle/PaintStickersIcon@3x.png b/LegacyComponents/Resources/LegacyComponentsResources.bundle/PaintStickersIcon@3x.png new file mode 100644 index 0000000000..3d757b2e06 Binary files /dev/null and b/LegacyComponents/Resources/LegacyComponentsResources.bundle/PaintStickersIcon@3x.png differ diff --git a/LegacyComponents/Resources/LegacyComponentsResources.bundle/PaintTextIcon@2x.png b/LegacyComponents/Resources/LegacyComponentsResources.bundle/PaintTextIcon@2x.png new file mode 100644 index 0000000000..839068d0dc Binary files /dev/null and b/LegacyComponents/Resources/LegacyComponentsResources.bundle/PaintTextIcon@2x.png differ diff --git a/LegacyComponents/Resources/LegacyComponentsResources.bundle/PaintTextIcon@3x.png b/LegacyComponents/Resources/LegacyComponentsResources.bundle/PaintTextIcon@3x.png new file mode 100644 index 0000000000..3aceb45c60 Binary files /dev/null and b/LegacyComponents/Resources/LegacyComponentsResources.bundle/PaintTextIcon@3x.png differ diff --git a/LegacyComponents/Resources/LegacyComponentsResources.bundle/PaintTextSettingsIcon@2x.png b/LegacyComponents/Resources/LegacyComponentsResources.bundle/PaintTextSettingsIcon@2x.png new file mode 100644 index 0000000000..b890b20bca Binary files /dev/null and b/LegacyComponents/Resources/LegacyComponentsResources.bundle/PaintTextSettingsIcon@2x.png differ diff --git a/LegacyComponents/Resources/LegacyComponentsResources.bundle/PaintTextSettingsIcon@3x.png b/LegacyComponents/Resources/LegacyComponentsResources.bundle/PaintTextSettingsIcon@3x.png new file mode 100644 index 0000000000..364eb3d186 Binary files /dev/null and b/LegacyComponents/Resources/LegacyComponentsResources.bundle/PaintTextSettingsIcon@3x.png differ diff --git a/LegacyComponents/Resources/LegacyComponentsResources.bundle/PaintUndoIcon@2x.png b/LegacyComponents/Resources/LegacyComponentsResources.bundle/PaintUndoIcon@2x.png new file mode 100644 index 0000000000..b371bf5377 Binary files /dev/null and b/LegacyComponents/Resources/LegacyComponentsResources.bundle/PaintUndoIcon@2x.png differ diff --git a/LegacyComponents/Resources/LegacyComponentsResources.bundle/PaintUndoIcon@3x.png b/LegacyComponents/Resources/LegacyComponentsResources.bundle/PaintUndoIcon@3x.png new file mode 100644 index 0000000000..b6269a0892 Binary files /dev/null and b/LegacyComponents/Resources/LegacyComponentsResources.bundle/PaintUndoIcon@3x.png differ diff --git a/LegacyComponents/Resources/LegacyComponentsResources.bundle/Paint_Blit.fsh b/LegacyComponents/Resources/LegacyComponentsResources.bundle/Paint_Blit.fsh new file mode 100755 index 0000000000..a3b4c6d24c --- /dev/null +++ b/LegacyComponents/Resources/LegacyComponentsResources.bundle/Paint_Blit.fsh @@ -0,0 +1,11 @@ +precision highp float; + +varying vec2 varTexcoord; + +uniform sampler2D texture; + +void main (void) +{ + gl_FragColor = texture2D(texture, varTexcoord.st, 0.0); + gl_FragColor.rgb *= gl_FragColor.a; +} diff --git a/LegacyComponents/Resources/LegacyComponentsResources.bundle/Paint_Blit.vsh b/LegacyComponents/Resources/LegacyComponentsResources.bundle/Paint_Blit.vsh new file mode 100755 index 0000000000..bb6535aa6a --- /dev/null +++ b/LegacyComponents/Resources/LegacyComponentsResources.bundle/Paint_Blit.vsh @@ -0,0 +1,13 @@ +precision highp float; + +uniform mat4 mvpMatrix; + +attribute vec4 inPosition; +attribute vec2 inTexcoord; +varying vec2 varTexcoord; + +void main (void) +{ + gl_Position = mvpMatrix * inPosition; + varTexcoord = inTexcoord; +} diff --git a/LegacyComponents/Resources/LegacyComponentsResources.bundle/Paint_BlitWithEraseMask.fsh b/LegacyComponents/Resources/LegacyComponentsResources.bundle/Paint_BlitWithEraseMask.fsh new file mode 100755 index 0000000000..8af5d2bcb9 --- /dev/null +++ b/LegacyComponents/Resources/LegacyComponentsResources.bundle/Paint_BlitWithEraseMask.fsh @@ -0,0 +1,17 @@ +precision highp float; + +varying vec2 varTexcoord; + +uniform sampler2D texture; +uniform sampler2D mask; + +void main (void) +{ + vec4 dst = texture2D(texture, varTexcoord.st, 0.0); + float srcAlpha = 1.0 - texture2D(mask, varTexcoord.st, 0.0).a; + + float outAlpha = dst.a * srcAlpha; + + gl_FragColor.rgb = dst.rgb * outAlpha; + gl_FragColor.a = outAlpha; +} diff --git a/LegacyComponents/Resources/LegacyComponentsResources.bundle/Paint_BlitWithMask.fsh b/LegacyComponents/Resources/LegacyComponentsResources.bundle/Paint_BlitWithMask.fsh new file mode 100755 index 0000000000..2db02d9a85 --- /dev/null +++ b/LegacyComponents/Resources/LegacyComponentsResources.bundle/Paint_BlitWithMask.fsh @@ -0,0 +1,20 @@ +precision highp float; + +varying vec2 varTexcoord; + +uniform sampler2D texture; +uniform sampler2D mask; +uniform vec4 color; + +void main (void) +{ + vec4 dst = texture2D(texture, varTexcoord.st, 0.0); + float srcAlpha = color.a * texture2D(mask, varTexcoord.st, 0.0).a; + + float outAlpha = srcAlpha + dst.a * (1.0 - srcAlpha); + + gl_FragColor.rgb = (color.rgb * srcAlpha + dst.rgb * dst.a * (1.0 - srcAlpha)) / outAlpha; + gl_FragColor.a = outAlpha; + + gl_FragColor.rgb *= gl_FragColor.a; +} \ No newline at end of file diff --git a/LegacyComponents/Resources/LegacyComponentsResources.bundle/Paint_BlitWithMaskLight.fsh b/LegacyComponents/Resources/LegacyComponentsResources.bundle/Paint_BlitWithMaskLight.fsh new file mode 100644 index 0000000000..d44696d48b --- /dev/null +++ b/LegacyComponents/Resources/LegacyComponentsResources.bundle/Paint_BlitWithMaskLight.fsh @@ -0,0 +1,26 @@ +precision highp float; + +varying vec2 varTexcoord; + +uniform sampler2D texture; +uniform sampler2D mask; +uniform vec4 color; + +void main (void) +{ + vec4 dst = texture2D(texture, varTexcoord.st, 0.0); + vec3 maskColor = texture2D(mask, varTexcoord.st, 0.0).rgb; + + float srcAlpha = clamp(0.78 * maskColor.r + maskColor.b + maskColor.g, 0.0, 1.0); + + vec3 borderColor = mix(color.rgb, vec3(1.0, 1.0, 1.0), 0.86); + vec3 finalColor = mix(color.rgb, borderColor, maskColor.g); + finalColor = mix(finalColor.rgb, vec3(1.0, 1.0, 1.0), maskColor.b); + + float outAlpha = srcAlpha + dst.a * (1.0 - srcAlpha); + + gl_FragColor.rgb = (finalColor * srcAlpha + dst.rgb * dst.a * (1.0 - srcAlpha)) / outAlpha; + gl_FragColor.a = outAlpha; + + gl_FragColor.rgb *= gl_FragColor.a; +} diff --git a/LegacyComponents/Resources/LegacyComponentsResources.bundle/Paint_Brush.fsh b/LegacyComponents/Resources/LegacyComponentsResources.bundle/Paint_Brush.fsh new file mode 100755 index 0000000000..d6effd7b91 --- /dev/null +++ b/LegacyComponents/Resources/LegacyComponentsResources.bundle/Paint_Brush.fsh @@ -0,0 +1,14 @@ +precision highp float; + +varying vec2 varTexcoord; +varying float varIntensity; + +uniform sampler2D texture; + +void main (void) +{ + float f = texture2D(texture, varTexcoord.st, 0.0).a; + float v = varIntensity * f; + + gl_FragColor = vec4(0, 0, 0, v); +} diff --git a/LegacyComponents/Resources/LegacyComponentsResources.bundle/Paint_Brush.vsh b/LegacyComponents/Resources/LegacyComponentsResources.bundle/Paint_Brush.vsh new file mode 100755 index 0000000000..b9b6fe4fb1 --- /dev/null +++ b/LegacyComponents/Resources/LegacyComponentsResources.bundle/Paint_Brush.vsh @@ -0,0 +1,16 @@ +precision highp float; + +uniform mat4 mvpMatrix; + +attribute vec4 inPosition; +attribute vec2 inTexcoord; +attribute float alpha; +varying vec2 varTexcoord; +varying float varIntensity; + +void main (void) +{ + gl_Position = mvpMatrix * inPosition; + varTexcoord = inTexcoord; + varIntensity = alpha; +} diff --git a/LegacyComponents/Resources/LegacyComponentsResources.bundle/Paint_BrushLight.fsh b/LegacyComponents/Resources/LegacyComponentsResources.bundle/Paint_BrushLight.fsh new file mode 100644 index 0000000000..9a94a278d0 --- /dev/null +++ b/LegacyComponents/Resources/LegacyComponentsResources.bundle/Paint_BrushLight.fsh @@ -0,0 +1,12 @@ +precision highp float; + +varying vec2 varTexcoord; +varying float varIntensity; + +uniform sampler2D texture; + +void main (void) +{ + vec4 f = texture2D(texture, varTexcoord.st, 0.0); + gl_FragColor = vec4(f.r * varIntensity, f.g, f.b, 0.0); +} diff --git a/LegacyComponents/Resources/LegacyComponentsResources.bundle/Paint_BrushLightPreview.fsh b/LegacyComponents/Resources/LegacyComponentsResources.bundle/Paint_BrushLightPreview.fsh new file mode 100644 index 0000000000..506a4f975b --- /dev/null +++ b/LegacyComponents/Resources/LegacyComponentsResources.bundle/Paint_BrushLightPreview.fsh @@ -0,0 +1,21 @@ +precision highp float; + +varying vec2 varTexcoord; + +uniform sampler2D mask; +uniform vec4 color; + +void main (void) +{ + vec3 maskColor = texture2D(mask, varTexcoord.st, 0.0).rgb; + float srcAlpha = color.a * clamp(maskColor.r + maskColor.b, 0.0, 1.0); + + vec3 borderColor = vec3(1.0, 1.0, 1.0); + //vec3 finalColor = mix(color.rgb, borderColor, maskColor.g); + vec3 finalColor = mix(color.rgb, vec3(1.0, 1.0, 1.0), maskColor.b); + + gl_FragColor.rgb = (finalColor * srcAlpha) / srcAlpha; + gl_FragColor.a = srcAlpha; + + gl_FragColor.rgb *= gl_FragColor.a; +} diff --git a/LegacyComponents/Resources/LegacyComponentsResources.bundle/Paint_CompositeWithEraseMask.fsh b/LegacyComponents/Resources/LegacyComponentsResources.bundle/Paint_CompositeWithEraseMask.fsh new file mode 100755 index 0000000000..1d2e7f189b --- /dev/null +++ b/LegacyComponents/Resources/LegacyComponentsResources.bundle/Paint_CompositeWithEraseMask.fsh @@ -0,0 +1,13 @@ +precision highp float; + +varying vec2 varTexcoord; + +uniform sampler2D texture; +uniform sampler2D mask; + +void main (void) +{ + gl_FragColor = texture2D(texture, varTexcoord.st, 0.0); + float srcAlpha = 1.0 - texture2D(mask, varTexcoord.st, 0.0).a; + gl_FragColor.a *= srcAlpha; +} diff --git a/LegacyComponents/Resources/LegacyComponentsResources.bundle/Paint_CompositeWithMask.fsh b/LegacyComponents/Resources/LegacyComponentsResources.bundle/Paint_CompositeWithMask.fsh new file mode 100755 index 0000000000..3f0b4d26ea --- /dev/null +++ b/LegacyComponents/Resources/LegacyComponentsResources.bundle/Paint_CompositeWithMask.fsh @@ -0,0 +1,18 @@ +precision highp float; + +varying vec2 varTexcoord; + +uniform sampler2D texture; +uniform sampler2D mask; +uniform vec4 color; + +void main (void) +{ + vec4 dst = texture2D(texture, varTexcoord.st, 0.0); + float srcAlpha = color.a * texture2D(mask, varTexcoord.st, 0.0).a; + + float outAlpha = srcAlpha + dst.a * (1.0 - srcAlpha); + + gl_FragColor.rgb = (color.rgb * srcAlpha + dst.rgb * dst.a * (1.0 - srcAlpha)) / outAlpha; + gl_FragColor.a = outAlpha; +} diff --git a/LegacyComponents/Resources/LegacyComponentsResources.bundle/Paint_CompositeWithMaskLight.fsh b/LegacyComponents/Resources/LegacyComponentsResources.bundle/Paint_CompositeWithMaskLight.fsh new file mode 100644 index 0000000000..aeee1dcf09 --- /dev/null +++ b/LegacyComponents/Resources/LegacyComponentsResources.bundle/Paint_CompositeWithMaskLight.fsh @@ -0,0 +1,24 @@ +precision highp float; + +varying vec2 varTexcoord; + +uniform sampler2D texture; +uniform sampler2D mask; +uniform vec4 color; + +void main (void) +{ + vec4 dst = texture2D(texture, varTexcoord.st, 0.0); + vec3 maskColor = texture2D(mask, varTexcoord.st, 0.0).rgb; + + float srcAlpha = clamp(0.78 * maskColor.r + maskColor.b + maskColor.g, 0.0, 1.0); + + vec3 borderColor = mix(color.rgb, vec3(1.0, 1.0, 1.0), 0.86); + vec3 finalColor = mix(color.rgb, borderColor, maskColor.g); + finalColor = mix(finalColor.rgb, vec3(1.0, 1.0, 1.0), maskColor.b); + + float outAlpha = srcAlpha + dst.a * (1.0 - srcAlpha); + + gl_FragColor.rgb = (finalColor * srcAlpha + dst.rgb * dst.a * (1.0 - srcAlpha)) / outAlpha; + gl_FragColor.a = outAlpha; +} diff --git a/LegacyComponents/Resources/LegacyComponentsResources.bundle/Paint_NonPremultipliedBlit.fsh b/LegacyComponents/Resources/LegacyComponentsResources.bundle/Paint_NonPremultipliedBlit.fsh new file mode 100755 index 0000000000..fe2a39f049 --- /dev/null +++ b/LegacyComponents/Resources/LegacyComponentsResources.bundle/Paint_NonPremultipliedBlit.fsh @@ -0,0 +1,10 @@ +precision highp float; + +varying vec2 varTexcoord; + +uniform sampler2D texture; + +void main (void) +{ + gl_FragColor = texture2D(texture, varTexcoord.st, 0.0); +} \ No newline at end of file diff --git a/LegacyComponents/Resources/LegacyComponentsResources.bundle/Passthrough.fsh b/LegacyComponents/Resources/LegacyComponentsResources.bundle/Passthrough.fsh new file mode 100644 index 0000000000..acbf3fdbef --- /dev/null +++ b/LegacyComponents/Resources/LegacyComponentsResources.bundle/Passthrough.fsh @@ -0,0 +1,9 @@ +precision mediump float; + +varying mediump vec2 varTexcoord; +uniform sampler2D texture; + +void main() +{ + gl_FragColor = texture2D(texture, varTexcoord); +} diff --git a/LegacyComponents/Resources/LegacyComponentsResources.bundle/Passthrough.vsh b/LegacyComponents/Resources/LegacyComponentsResources.bundle/Passthrough.vsh new file mode 100644 index 0000000000..78e3bb95f6 --- /dev/null +++ b/LegacyComponents/Resources/LegacyComponentsResources.bundle/Passthrough.vsh @@ -0,0 +1,10 @@ +attribute vec4 inPosition; +attribute mediump vec4 inTexcoord; +varying mediump vec2 varTexcoord; + +void main() +{ + gl_Position = inPosition; + varTexcoord = inTexcoord.xy; +} + diff --git a/LegacyComponents/Resources/LegacyComponentsResources.bundle/PhotoEditorAspectRatioIcon@2x.png b/LegacyComponents/Resources/LegacyComponentsResources.bundle/PhotoEditorAspectRatioIcon@2x.png new file mode 100644 index 0000000000..c1944b5f66 Binary files /dev/null and b/LegacyComponents/Resources/LegacyComponentsResources.bundle/PhotoEditorAspectRatioIcon@2x.png differ diff --git a/LegacyComponents/Resources/LegacyComponentsResources.bundle/PhotoEditorAspectRatioIcon@3x.png b/LegacyComponents/Resources/LegacyComponentsResources.bundle/PhotoEditorAspectRatioIcon@3x.png new file mode 100644 index 0000000000..e4c5bd9b29 Binary files /dev/null and b/LegacyComponents/Resources/LegacyComponentsResources.bundle/PhotoEditorAspectRatioIcon@3x.png differ diff --git a/LegacyComponents/Resources/LegacyComponentsResources.bundle/PhotoEditorBlurIcon@2x.png b/LegacyComponents/Resources/LegacyComponentsResources.bundle/PhotoEditorBlurIcon@2x.png new file mode 100644 index 0000000000..17b1e58928 Binary files /dev/null and b/LegacyComponents/Resources/LegacyComponentsResources.bundle/PhotoEditorBlurIcon@2x.png differ diff --git a/LegacyComponents/Resources/LegacyComponentsResources.bundle/PhotoEditorBlurIcon@3x.png b/LegacyComponents/Resources/LegacyComponentsResources.bundle/PhotoEditorBlurIcon@3x.png new file mode 100644 index 0000000000..0ff98548c3 Binary files /dev/null and b/LegacyComponents/Resources/LegacyComponentsResources.bundle/PhotoEditorBlurIcon@3x.png differ diff --git a/LegacyComponents/Resources/LegacyComponentsResources.bundle/PhotoEditorBlurLinear.png b/LegacyComponents/Resources/LegacyComponentsResources.bundle/PhotoEditorBlurLinear.png new file mode 100644 index 0000000000..1223538117 Binary files /dev/null and b/LegacyComponents/Resources/LegacyComponentsResources.bundle/PhotoEditorBlurLinear.png differ diff --git a/LegacyComponents/Resources/LegacyComponentsResources.bundle/PhotoEditorBlurLinear@2x.png b/LegacyComponents/Resources/LegacyComponentsResources.bundle/PhotoEditorBlurLinear@2x.png new file mode 100644 index 0000000000..e3f67c4449 Binary files /dev/null and b/LegacyComponents/Resources/LegacyComponentsResources.bundle/PhotoEditorBlurLinear@2x.png differ diff --git a/LegacyComponents/Resources/LegacyComponentsResources.bundle/PhotoEditorBlurLinear@3x.png b/LegacyComponents/Resources/LegacyComponentsResources.bundle/PhotoEditorBlurLinear@3x.png new file mode 100644 index 0000000000..eb6279040c Binary files /dev/null and b/LegacyComponents/Resources/LegacyComponentsResources.bundle/PhotoEditorBlurLinear@3x.png differ diff --git a/LegacyComponents/Resources/LegacyComponentsResources.bundle/PhotoEditorBlurOff.png b/LegacyComponents/Resources/LegacyComponentsResources.bundle/PhotoEditorBlurOff.png new file mode 100644 index 0000000000..037d980c35 Binary files /dev/null and b/LegacyComponents/Resources/LegacyComponentsResources.bundle/PhotoEditorBlurOff.png differ diff --git a/LegacyComponents/Resources/LegacyComponentsResources.bundle/PhotoEditorBlurOff@2x.png b/LegacyComponents/Resources/LegacyComponentsResources.bundle/PhotoEditorBlurOff@2x.png new file mode 100644 index 0000000000..0dc203196e Binary files /dev/null and b/LegacyComponents/Resources/LegacyComponentsResources.bundle/PhotoEditorBlurOff@2x.png differ diff --git a/LegacyComponents/Resources/LegacyComponentsResources.bundle/PhotoEditorBlurOff@3x.png b/LegacyComponents/Resources/LegacyComponentsResources.bundle/PhotoEditorBlurOff@3x.png new file mode 100644 index 0000000000..1de339b991 Binary files /dev/null and b/LegacyComponents/Resources/LegacyComponentsResources.bundle/PhotoEditorBlurOff@3x.png differ diff --git a/LegacyComponents/Resources/LegacyComponentsResources.bundle/PhotoEditorBlurRadial.png b/LegacyComponents/Resources/LegacyComponentsResources.bundle/PhotoEditorBlurRadial.png new file mode 100644 index 0000000000..f5903ed9ad Binary files /dev/null and b/LegacyComponents/Resources/LegacyComponentsResources.bundle/PhotoEditorBlurRadial.png differ diff --git a/LegacyComponents/Resources/LegacyComponentsResources.bundle/PhotoEditorBlurRadial@2x.png b/LegacyComponents/Resources/LegacyComponentsResources.bundle/PhotoEditorBlurRadial@2x.png new file mode 100644 index 0000000000..e689c5f6fd Binary files /dev/null and b/LegacyComponents/Resources/LegacyComponentsResources.bundle/PhotoEditorBlurRadial@2x.png differ diff --git a/LegacyComponents/Resources/LegacyComponentsResources.bundle/PhotoEditorBlurRadial@3x.png b/LegacyComponents/Resources/LegacyComponentsResources.bundle/PhotoEditorBlurRadial@3x.png new file mode 100644 index 0000000000..a6601bfdb3 Binary files /dev/null and b/LegacyComponents/Resources/LegacyComponentsResources.bundle/PhotoEditorBlurRadial@3x.png differ diff --git a/LegacyComponents/Resources/LegacyComponentsResources.bundle/PhotoEditorCaption.png b/LegacyComponents/Resources/LegacyComponentsResources.bundle/PhotoEditorCaption.png new file mode 100644 index 0000000000..1124711660 Binary files /dev/null and b/LegacyComponents/Resources/LegacyComponentsResources.bundle/PhotoEditorCaption.png differ diff --git a/LegacyComponents/Resources/LegacyComponentsResources.bundle/PhotoEditorCaption@2x.png b/LegacyComponents/Resources/LegacyComponentsResources.bundle/PhotoEditorCaption@2x.png new file mode 100644 index 0000000000..6ed8cb0d45 Binary files /dev/null and b/LegacyComponents/Resources/LegacyComponentsResources.bundle/PhotoEditorCaption@2x.png differ diff --git a/LegacyComponents/Resources/LegacyComponentsResources.bundle/PhotoEditorCaption@3x.png b/LegacyComponents/Resources/LegacyComponentsResources.bundle/PhotoEditorCaption@3x.png new file mode 100644 index 0000000000..3c785a48c1 Binary files /dev/null and b/LegacyComponents/Resources/LegacyComponentsResources.bundle/PhotoEditorCaption@3x.png differ diff --git a/LegacyComponents/Resources/LegacyComponentsResources.bundle/PhotoEditorCrop@2x.png b/LegacyComponents/Resources/LegacyComponentsResources.bundle/PhotoEditorCrop@2x.png new file mode 100644 index 0000000000..a6ed7807f2 Binary files /dev/null and b/LegacyComponents/Resources/LegacyComponentsResources.bundle/PhotoEditorCrop@2x.png differ diff --git a/LegacyComponents/Resources/LegacyComponentsResources.bundle/PhotoEditorCrop@3x.png b/LegacyComponents/Resources/LegacyComponentsResources.bundle/PhotoEditorCrop@3x.png new file mode 100644 index 0000000000..1490c67dca Binary files /dev/null and b/LegacyComponents/Resources/LegacyComponentsResources.bundle/PhotoEditorCrop@3x.png differ diff --git a/LegacyComponents/Resources/LegacyComponentsResources.bundle/PhotoEditorCropCorners@2x.png b/LegacyComponents/Resources/LegacyComponentsResources.bundle/PhotoEditorCropCorners@2x.png new file mode 100644 index 0000000000..b9a0ac370f Binary files /dev/null and b/LegacyComponents/Resources/LegacyComponentsResources.bundle/PhotoEditorCropCorners@2x.png differ diff --git a/LegacyComponents/Resources/LegacyComponentsResources.bundle/PhotoEditorCurvesIcon@2x.png b/LegacyComponents/Resources/LegacyComponentsResources.bundle/PhotoEditorCurvesIcon@2x.png new file mode 100644 index 0000000000..568807854e Binary files /dev/null and b/LegacyComponents/Resources/LegacyComponentsResources.bundle/PhotoEditorCurvesIcon@2x.png differ diff --git a/LegacyComponents/Resources/LegacyComponentsResources.bundle/PhotoEditorCurvesIcon@3x.png b/LegacyComponents/Resources/LegacyComponentsResources.bundle/PhotoEditorCurvesIcon@3x.png new file mode 100644 index 0000000000..48ce0ee86f Binary files /dev/null and b/LegacyComponents/Resources/LegacyComponentsResources.bundle/PhotoEditorCurvesIcon@3x.png differ diff --git a/LegacyComponents/Resources/LegacyComponentsResources.bundle/PhotoEditorMirrorIcon@2x.png b/LegacyComponents/Resources/LegacyComponentsResources.bundle/PhotoEditorMirrorIcon@2x.png new file mode 100644 index 0000000000..ec7a1401a2 Binary files /dev/null and b/LegacyComponents/Resources/LegacyComponentsResources.bundle/PhotoEditorMirrorIcon@2x.png differ diff --git a/LegacyComponents/Resources/LegacyComponentsResources.bundle/PhotoEditorMirrorIcon@3x.png b/LegacyComponents/Resources/LegacyComponentsResources.bundle/PhotoEditorMirrorIcon@3x.png new file mode 100644 index 0000000000..06abfe2818 Binary files /dev/null and b/LegacyComponents/Resources/LegacyComponentsResources.bundle/PhotoEditorMirrorIcon@3x.png differ diff --git a/LegacyComponents/Resources/LegacyComponentsResources.bundle/PhotoEditorMute@2x.png b/LegacyComponents/Resources/LegacyComponentsResources.bundle/PhotoEditorMute@2x.png new file mode 100644 index 0000000000..3012a49a60 Binary files /dev/null and b/LegacyComponents/Resources/LegacyComponentsResources.bundle/PhotoEditorMute@2x.png differ diff --git a/LegacyComponents/Resources/LegacyComponentsResources.bundle/PhotoEditorMuteActive@2x.png b/LegacyComponents/Resources/LegacyComponentsResources.bundle/PhotoEditorMuteActive@2x.png new file mode 100644 index 0000000000..61175da4aa Binary files /dev/null and b/LegacyComponents/Resources/LegacyComponentsResources.bundle/PhotoEditorMuteActive@2x.png differ diff --git a/LegacyComponents/Resources/LegacyComponentsResources.bundle/PhotoEditorPaint@2x.png b/LegacyComponents/Resources/LegacyComponentsResources.bundle/PhotoEditorPaint@2x.png new file mode 100644 index 0000000000..41f3d9765d Binary files /dev/null and b/LegacyComponents/Resources/LegacyComponentsResources.bundle/PhotoEditorPaint@2x.png differ diff --git a/LegacyComponents/Resources/LegacyComponentsResources.bundle/PhotoEditorPaint@3x.png b/LegacyComponents/Resources/LegacyComponentsResources.bundle/PhotoEditorPaint@3x.png new file mode 100644 index 0000000000..fb8c602ad1 Binary files /dev/null and b/LegacyComponents/Resources/LegacyComponentsResources.bundle/PhotoEditorPaint@3x.png differ diff --git a/LegacyComponents/Resources/LegacyComponentsResources.bundle/PhotoEditorQuality@2x.png b/LegacyComponents/Resources/LegacyComponentsResources.bundle/PhotoEditorQuality@2x.png new file mode 100644 index 0000000000..fff3a37e75 Binary files /dev/null and b/LegacyComponents/Resources/LegacyComponentsResources.bundle/PhotoEditorQuality@2x.png differ diff --git a/LegacyComponents/Resources/LegacyComponentsResources.bundle/PhotoEditorQuality@3x.png b/LegacyComponents/Resources/LegacyComponentsResources.bundle/PhotoEditorQuality@3x.png new file mode 100644 index 0000000000..9e6e570152 Binary files /dev/null and b/LegacyComponents/Resources/LegacyComponentsResources.bundle/PhotoEditorQuality@3x.png differ diff --git a/LegacyComponents/Resources/LegacyComponentsResources.bundle/PhotoEditorRotateIcon@2x.png b/LegacyComponents/Resources/LegacyComponentsResources.bundle/PhotoEditorRotateIcon@2x.png new file mode 100644 index 0000000000..4cf8c66ef8 Binary files /dev/null and b/LegacyComponents/Resources/LegacyComponentsResources.bundle/PhotoEditorRotateIcon@2x.png differ diff --git a/LegacyComponents/Resources/LegacyComponentsResources.bundle/PhotoEditorRotateIcon@3x.png b/LegacyComponents/Resources/LegacyComponentsResources.bundle/PhotoEditorRotateIcon@3x.png new file mode 100644 index 0000000000..937885fcaa Binary files /dev/null and b/LegacyComponents/Resources/LegacyComponentsResources.bundle/PhotoEditorRotateIcon@3x.png differ diff --git a/LegacyComponents/Resources/LegacyComponentsResources.bundle/PhotoEditorRotationNeedle@2x.png b/LegacyComponents/Resources/LegacyComponentsResources.bundle/PhotoEditorRotationNeedle@2x.png new file mode 100644 index 0000000000..c59b218a2c Binary files /dev/null and b/LegacyComponents/Resources/LegacyComponentsResources.bundle/PhotoEditorRotationNeedle@2x.png differ diff --git a/LegacyComponents/Resources/LegacyComponentsResources.bundle/PhotoEditorRotationWheel@2x.png b/LegacyComponents/Resources/LegacyComponentsResources.bundle/PhotoEditorRotationWheel@2x.png new file mode 100644 index 0000000000..218551f7f4 Binary files /dev/null and b/LegacyComponents/Resources/LegacyComponentsResources.bundle/PhotoEditorRotationWheel@2x.png differ diff --git a/LegacyComponents/Resources/LegacyComponentsResources.bundle/PhotoEditorRotationWheelLeft@2x.png b/LegacyComponents/Resources/LegacyComponentsResources.bundle/PhotoEditorRotationWheelLeft@2x.png new file mode 100644 index 0000000000..fb4b81797e Binary files /dev/null and b/LegacyComponents/Resources/LegacyComponentsResources.bundle/PhotoEditorRotationWheelLeft@2x.png differ diff --git a/LegacyComponents/Resources/LegacyComponentsResources.bundle/PhotoEditorRotationWheelRight@2x.png b/LegacyComponents/Resources/LegacyComponentsResources.bundle/PhotoEditorRotationWheelRight@2x.png new file mode 100644 index 0000000000..9853411408 Binary files /dev/null and b/LegacyComponents/Resources/LegacyComponentsResources.bundle/PhotoEditorRotationWheelRight@2x.png differ diff --git a/LegacyComponents/Resources/LegacyComponentsResources.bundle/PhotoEditorTimer0@2x.png b/LegacyComponents/Resources/LegacyComponentsResources.bundle/PhotoEditorTimer0@2x.png new file mode 100644 index 0000000000..064c43d18a Binary files /dev/null and b/LegacyComponents/Resources/LegacyComponentsResources.bundle/PhotoEditorTimer0@2x.png differ diff --git a/LegacyComponents/Resources/LegacyComponentsResources.bundle/PhotoEditorTimer0@3x.png b/LegacyComponents/Resources/LegacyComponentsResources.bundle/PhotoEditorTimer0@3x.png new file mode 100644 index 0000000000..9010b48edd Binary files /dev/null and b/LegacyComponents/Resources/LegacyComponentsResources.bundle/PhotoEditorTimer0@3x.png differ diff --git a/LegacyComponents/Resources/LegacyComponentsResources.bundle/PhotoEditorTimer@2x.png b/LegacyComponents/Resources/LegacyComponentsResources.bundle/PhotoEditorTimer@2x.png new file mode 100644 index 0000000000..304b362929 Binary files /dev/null and b/LegacyComponents/Resources/LegacyComponentsResources.bundle/PhotoEditorTimer@2x.png differ diff --git a/LegacyComponents/Resources/LegacyComponentsResources.bundle/PhotoEditorTimer@3x.png b/LegacyComponents/Resources/LegacyComponentsResources.bundle/PhotoEditorTimer@3x.png new file mode 100644 index 0000000000..996683b0a2 Binary files /dev/null and b/LegacyComponents/Resources/LegacyComponentsResources.bundle/PhotoEditorTimer@3x.png differ diff --git a/LegacyComponents/Resources/LegacyComponentsResources.bundle/PhotoEditorTintIcon@2x.png b/LegacyComponents/Resources/LegacyComponentsResources.bundle/PhotoEditorTintIcon@2x.png new file mode 100644 index 0000000000..87138622f8 Binary files /dev/null and b/LegacyComponents/Resources/LegacyComponentsResources.bundle/PhotoEditorTintIcon@2x.png differ diff --git a/LegacyComponents/Resources/LegacyComponentsResources.bundle/PhotoEditorTintIcon@3x.png b/LegacyComponents/Resources/LegacyComponentsResources.bundle/PhotoEditorTintIcon@3x.png new file mode 100644 index 0000000000..133880fe7c Binary files /dev/null and b/LegacyComponents/Resources/LegacyComponentsResources.bundle/PhotoEditorTintIcon@3x.png differ diff --git a/LegacyComponents/Resources/LegacyComponentsResources.bundle/PhotoEditorTintTool@2x.png b/LegacyComponents/Resources/LegacyComponentsResources.bundle/PhotoEditorTintTool@2x.png new file mode 100644 index 0000000000..fb64ec8327 Binary files /dev/null and b/LegacyComponents/Resources/LegacyComponentsResources.bundle/PhotoEditorTintTool@2x.png differ diff --git a/LegacyComponents/Resources/LegacyComponentsResources.bundle/PhotoEditorTools@2x.png b/LegacyComponents/Resources/LegacyComponentsResources.bundle/PhotoEditorTools@2x.png new file mode 100644 index 0000000000..c814f6114a Binary files /dev/null and b/LegacyComponents/Resources/LegacyComponentsResources.bundle/PhotoEditorTools@2x.png differ diff --git a/LegacyComponents/Resources/LegacyComponentsResources.bundle/PhotoEditorTools@3x.png b/LegacyComponents/Resources/LegacyComponentsResources.bundle/PhotoEditorTools@3x.png new file mode 100644 index 0000000000..df1bb1879f Binary files /dev/null and b/LegacyComponents/Resources/LegacyComponentsResources.bundle/PhotoEditorTools@3x.png differ diff --git a/LegacyComponents/Resources/LegacyComponentsResources.bundle/PhotoPickerArrow@2x.png b/LegacyComponents/Resources/LegacyComponentsResources.bundle/PhotoPickerArrow@2x.png new file mode 100644 index 0000000000..11824c738a Binary files /dev/null and b/LegacyComponents/Resources/LegacyComponentsResources.bundle/PhotoPickerArrow@2x.png differ diff --git a/LegacyComponents/Resources/LegacyComponentsResources.bundle/PhotoPickerArrow@3x.png b/LegacyComponents/Resources/LegacyComponentsResources.bundle/PhotoPickerArrow@3x.png new file mode 100644 index 0000000000..c792cbadc2 Binary files /dev/null and b/LegacyComponents/Resources/LegacyComponentsResources.bundle/PhotoPickerArrow@3x.png differ diff --git a/LegacyComponents/Resources/LegacyComponentsResources.bundle/PhotoPickerBackIcon@2x.png b/LegacyComponents/Resources/LegacyComponentsResources.bundle/PhotoPickerBackIcon@2x.png new file mode 100644 index 0000000000..483a034b64 Binary files /dev/null and b/LegacyComponents/Resources/LegacyComponentsResources.bundle/PhotoPickerBackIcon@2x.png differ diff --git a/LegacyComponents/Resources/LegacyComponentsResources.bundle/PhotoPickerBackIcon@3x.png b/LegacyComponents/Resources/LegacyComponentsResources.bundle/PhotoPickerBackIcon@3x.png new file mode 100644 index 0000000000..3fb90131b3 Binary files /dev/null and b/LegacyComponents/Resources/LegacyComponentsResources.bundle/PhotoPickerBackIcon@3x.png differ diff --git a/LegacyComponents/Resources/LegacyComponentsResources.bundle/PhotoPickerCancelIcon@2x.png b/LegacyComponents/Resources/LegacyComponentsResources.bundle/PhotoPickerCancelIcon@2x.png new file mode 100644 index 0000000000..dec7b64a1a Binary files /dev/null and b/LegacyComponents/Resources/LegacyComponentsResources.bundle/PhotoPickerCancelIcon@2x.png differ diff --git a/LegacyComponents/Resources/LegacyComponentsResources.bundle/PhotoPickerCancelIcon@3x.png b/LegacyComponents/Resources/LegacyComponentsResources.bundle/PhotoPickerCancelIcon@3x.png new file mode 100644 index 0000000000..512bcad695 Binary files /dev/null and b/LegacyComponents/Resources/LegacyComponentsResources.bundle/PhotoPickerCancelIcon@3x.png differ diff --git a/LegacyComponents/Resources/LegacyComponentsResources.bundle/PhotoPickerDoneIcon@2x.png b/LegacyComponents/Resources/LegacyComponentsResources.bundle/PhotoPickerDoneIcon@2x.png new file mode 100644 index 0000000000..cf3cd7d76e Binary files /dev/null and b/LegacyComponents/Resources/LegacyComponentsResources.bundle/PhotoPickerDoneIcon@2x.png differ diff --git a/LegacyComponents/Resources/LegacyComponentsResources.bundle/PhotoPickerDoneIcon@3x.png b/LegacyComponents/Resources/LegacyComponentsResources.bundle/PhotoPickerDoneIcon@3x.png new file mode 100644 index 0000000000..f356577224 Binary files /dev/null and b/LegacyComponents/Resources/LegacyComponentsResources.bundle/PhotoPickerDoneIcon@3x.png differ diff --git a/LegacyComponents/Resources/LegacyComponentsResources.bundle/PhotoPickerSendIcon@2x.png b/LegacyComponents/Resources/LegacyComponentsResources.bundle/PhotoPickerSendIcon@2x.png new file mode 100644 index 0000000000..719bcbd280 Binary files /dev/null and b/LegacyComponents/Resources/LegacyComponentsResources.bundle/PhotoPickerSendIcon@2x.png differ diff --git a/LegacyComponents/Resources/LegacyComponentsResources.bundle/PhotoPickerSendIcon@3x.png b/LegacyComponents/Resources/LegacyComponentsResources.bundle/PhotoPickerSendIcon@3x.png new file mode 100644 index 0000000000..bd23c60ed9 Binary files /dev/null and b/LegacyComponents/Resources/LegacyComponentsResources.bundle/PhotoPickerSendIcon@3x.png differ diff --git a/LegacyComponents/Resources/LegacyComponentsResources.bundle/PreviewSheetShadow@2x.png b/LegacyComponents/Resources/LegacyComponentsResources.bundle/PreviewSheetShadow@2x.png new file mode 100644 index 0000000000..41b973711e Binary files /dev/null and b/LegacyComponents/Resources/LegacyComponentsResources.bundle/PreviewSheetShadow@2x.png differ diff --git a/LegacyComponents/Resources/LegacyComponentsResources.bundle/PreviewUpArrow@2x.png b/LegacyComponents/Resources/LegacyComponentsResources.bundle/PreviewUpArrow@2x.png new file mode 100644 index 0000000000..eb133303b0 Binary files /dev/null and b/LegacyComponents/Resources/LegacyComponentsResources.bundle/PreviewUpArrow@2x.png differ diff --git a/LegacyComponents/Resources/LegacyComponentsResources.bundle/StickerKeyboardGifIcon@2x.png b/LegacyComponents/Resources/LegacyComponentsResources.bundle/StickerKeyboardGifIcon@2x.png new file mode 100644 index 0000000000..382c35e033 Binary files /dev/null and b/LegacyComponents/Resources/LegacyComponentsResources.bundle/StickerKeyboardGifIcon@2x.png differ diff --git a/LegacyComponents/Resources/LegacyComponentsResources.bundle/StickerKeyboardGifIcon@3x.png b/LegacyComponents/Resources/LegacyComponentsResources.bundle/StickerKeyboardGifIcon@3x.png new file mode 100644 index 0000000000..d760fa4947 Binary files /dev/null and b/LegacyComponents/Resources/LegacyComponentsResources.bundle/StickerKeyboardGifIcon@3x.png differ diff --git a/LegacyComponents/Resources/LegacyComponentsResources.bundle/StickerKeyboardRecentTab@1x.png b/LegacyComponents/Resources/LegacyComponentsResources.bundle/StickerKeyboardRecentTab@1x.png new file mode 100644 index 0000000000..b48545a8d7 Binary files /dev/null and b/LegacyComponents/Resources/LegacyComponentsResources.bundle/StickerKeyboardRecentTab@1x.png differ diff --git a/LegacyComponents/Resources/LegacyComponentsResources.bundle/StickerKeyboardRecentTab@2x.png b/LegacyComponents/Resources/LegacyComponentsResources.bundle/StickerKeyboardRecentTab@2x.png new file mode 100644 index 0000000000..95cc50e35f Binary files /dev/null and b/LegacyComponents/Resources/LegacyComponentsResources.bundle/StickerKeyboardRecentTab@2x.png differ diff --git a/LegacyComponents/Resources/LegacyComponentsResources.bundle/StickerKeyboardRecentTab@3x.png b/LegacyComponents/Resources/LegacyComponentsResources.bundle/StickerKeyboardRecentTab@3x.png new file mode 100644 index 0000000000..045a394615 Binary files /dev/null and b/LegacyComponents/Resources/LegacyComponentsResources.bundle/StickerKeyboardRecentTab@3x.png differ diff --git a/LegacyComponents/Resources/LegacyComponentsResources.bundle/StickerKeyboardSettingsIcon@2x.png b/LegacyComponents/Resources/LegacyComponentsResources.bundle/StickerKeyboardSettingsIcon@2x.png new file mode 100644 index 0000000000..d0dc89b9ff Binary files /dev/null and b/LegacyComponents/Resources/LegacyComponentsResources.bundle/StickerKeyboardSettingsIcon@2x.png differ diff --git a/LegacyComponents/Resources/LegacyComponentsResources.bundle/StickerKeyboardSettingsIcon@3x.png b/LegacyComponents/Resources/LegacyComponentsResources.bundle/StickerKeyboardSettingsIcon@3x.png new file mode 100644 index 0000000000..54b04299e5 Binary files /dev/null and b/LegacyComponents/Resources/LegacyComponentsResources.bundle/StickerKeyboardSettingsIcon@3x.png differ diff --git a/LegacyComponents/Resources/LegacyComponentsResources.bundle/StickerKeyboardTrendingIcon@2x.png b/LegacyComponents/Resources/LegacyComponentsResources.bundle/StickerKeyboardTrendingIcon@2x.png new file mode 100644 index 0000000000..67de340019 Binary files /dev/null and b/LegacyComponents/Resources/LegacyComponentsResources.bundle/StickerKeyboardTrendingIcon@2x.png differ diff --git a/LegacyComponents/Resources/LegacyComponentsResources.bundle/StickerKeyboardTrendingIcon@3x.png b/LegacyComponents/Resources/LegacyComponentsResources.bundle/StickerKeyboardTrendingIcon@3x.png new file mode 100644 index 0000000000..ed14979353 Binary files /dev/null and b/LegacyComponents/Resources/LegacyComponentsResources.bundle/StickerKeyboardTrendingIcon@3x.png differ diff --git a/LegacyComponents/Resources/LegacyComponentsResources.bundle/VideoMessage.fsh b/LegacyComponents/Resources/LegacyComponentsResources.bundle/VideoMessage.fsh new file mode 100644 index 0000000000..6fc0dbdf41 --- /dev/null +++ b/LegacyComponents/Resources/LegacyComponentsResources.bundle/VideoMessage.fsh @@ -0,0 +1,32 @@ +precision mediump float; + +varying mediump vec2 varTexcoord; +uniform sampler2D texture; +uniform sampler2D previousTexture; +uniform mediump float opacity; +uniform mediump float aspectRatio; +uniform mediump float noMirror; + +void main() +{ + vec2 texcoord = vec2(1.0 - varTexcoord.x * noMirror + clamp(noMirror, -1.0, 0.0), varTexcoord.y); + vec2 prevTexcoord = vec2(texcoord.x, 1.0 - texcoord.y); + + vec4 white = vec4(1.0, 1.0, 1.0, 1.0); + vec4 color = texture2D(texture, texcoord); + vec4 previousColor = texture2D(previousTexture, prevTexcoord); + + color.rgb = mix(color.rgb, previousColor.rgb, opacity); + + vec2 c = vec2((varTexcoord.x * 2.0 - 1.0) * aspectRatio, varTexcoord.y * 2.0 - 1.0) * 0.996; + vec2 c1 = c - 0.005; + vec2 c2 = c + 0.005; + vec2 c3 = vec2(c1.x, c2.y); + vec2 c4 = vec2(c2.x, c1.y); + float s1 = floor(dot(c1, c1)); + float s2 = floor(dot(c2, c2)); + float s3 = floor(dot(c3, c3)); + float s4 = floor(dot(c4, c4)); + + gl_FragColor = mix(color, white, (s1 + s2 + s3 + s4) * 0.25); +} diff --git a/LegacyComponents/Resources/LegacyComponentsResources.bundle/VideoMessage.vsh b/LegacyComponents/Resources/LegacyComponentsResources.bundle/VideoMessage.vsh new file mode 100644 index 0000000000..78e3bb95f6 --- /dev/null +++ b/LegacyComponents/Resources/LegacyComponentsResources.bundle/VideoMessage.vsh @@ -0,0 +1,10 @@ +attribute vec4 inPosition; +attribute mediump vec4 inTexcoord; +varying mediump vec2 varTexcoord; + +void main() +{ + gl_Position = inPosition; + varTexcoord = inTexcoord.xy; +} + diff --git a/LegacyComponents/Resources/LegacyComponentsResources.bundle/VideoScrubberLeftArrow@2x.png b/LegacyComponents/Resources/LegacyComponentsResources.bundle/VideoScrubberLeftArrow@2x.png new file mode 100644 index 0000000000..c5299dce46 Binary files /dev/null and b/LegacyComponents/Resources/LegacyComponentsResources.bundle/VideoScrubberLeftArrow@2x.png differ diff --git a/LegacyComponents/Resources/LegacyComponentsResources.bundle/VideoScrubberRightArrow@2x.png b/LegacyComponents/Resources/LegacyComponentsResources.bundle/VideoScrubberRightArrow@2x.png new file mode 100644 index 0000000000..86d32b4f80 Binary files /dev/null and b/LegacyComponents/Resources/LegacyComponentsResources.bundle/VideoScrubberRightArrow@2x.png differ diff --git a/LegacyComponents/Resources/LegacyComponentsResources.bundle/VimeoPlayer.html b/LegacyComponents/Resources/LegacyComponentsResources.bundle/VimeoPlayer.html new file mode 100755 index 0000000000..5175d13427 --- /dev/null +++ b/LegacyComponents/Resources/LegacyComponentsResources.bundle/VimeoPlayer.html @@ -0,0 +1,95 @@ + + + + + + +
+ +
+ + + diff --git a/LegacyComponents/Resources/LegacyComponentsResources.bundle/VimeoPlayerInject.js b/LegacyComponents/Resources/LegacyComponentsResources.bundle/VimeoPlayerInject.js new file mode 100644 index 0000000000..8b1cd8bc28 --- /dev/null +++ b/LegacyComponents/Resources/LegacyComponentsResources.bundle/VimeoPlayerInject.js @@ -0,0 +1,52 @@ +function fixPlayer() { + var controls = document.getElementsByClassName('controls')[0]; + controls.style.display = 'none'; + + var sidedock = document.getElementsByClassName('sidedock')[0]; + sidedock.style.display = 'none'; + + var video = document.getElementsByTagName('video')[0]; + video.setAttribute('webkit-playsinline', ''); + video.setAttribute('playsinline', ''); + video.webkitEnterFullscreen = undefined; +} + +function switchToPIP() { + var video = document.getElementsByTagName('video')[0]; + video.webkitSetPresentationMode('picture-in-picture'); +} + +function eventFire(el, etype){ + if (el.fireEvent) { + el.fireEvent('on' + etype); + } else { + var evObj = document.createEvent('Events'); + evObj.initEvent(etype, true, false); + el.dispatchEvent(evObj); + } +} + +function initialPlay() { + var playButton = document.getElementsByClassName('play')[0]; + eventFire(playButton, 'click'); +} + +function receiveMessage(evt) { + if ((typeof evt.data) != 'string') + return; + + try { + var obj = JSON.parse(evt.data); + if (!obj.event || obj.event != 'inject') + return; + + if (obj.cmd == 'fixPlayer') + fixPlayer(); + else if (obj.cmd == 'initialPlay') + initialPlay(); + else if (obj.cmd == 'switchToPIP') + switchToPIP(); + } catch (ex) { } +} + +window.addEventListener('message', receiveMessage, false); diff --git a/LegacyComponents/Resources/LegacyComponentsResources.bundle/VinePlayer.html b/LegacyComponents/Resources/LegacyComponentsResources.bundle/VinePlayer.html new file mode 100755 index 0000000000..2fba84115c --- /dev/null +++ b/LegacyComponents/Resources/LegacyComponentsResources.bundle/VinePlayer.html @@ -0,0 +1,51 @@ + + + + + + +
+ +
+ + + diff --git a/LegacyComponents/Resources/LegacyComponentsResources.bundle/VinePlayerInject.js b/LegacyComponents/Resources/LegacyComponentsResources.bundle/VinePlayerInject.js new file mode 100644 index 0000000000..cc57644e2a --- /dev/null +++ b/LegacyComponents/Resources/LegacyComponentsResources.bundle/VinePlayerInject.js @@ -0,0 +1,80 @@ +function hidePlayButton() { + var css = 'video::-webkit-media-controls { display: none !important }', + head = document.head || document.getElementsByTagName('head')[0], + style = document.createElement('style'); + + style.type = 'text/css'; + if (style.styleSheet){ + style.styleSheet.cssText = css; + } else { + style.appendChild(document.createTextNode(css)); + } + + head.appendChild(style); +} + +var video; + +function fixPlayer() { + var controls = document.getElementsByClassName('VolumeControl')[0]; + controls.style.display = 'none'; + + video.setAttribute('webkit-playsinline', ''); + video.setAttribute('playsinline', ''); + video.webkitEnterFullscreen = undefined; + + hidePlayButton(); +} + +function play() { + video.play(); +} + +function pause() { + video.pause(); +} + +function showWatermark() { + var logo = document.getElementsByClassName('vine-logo')[0]; + logo.style.display = 'block'; +} + +function hideWatermark() { + var logo = document.getElementsByClassName('vine-logo')[0]; + logo.style.display = 'none'; +} + +function receiveMessage(evt) { + if ((typeof evt.data) != 'string') + return; + + try { + var obj = JSON.parse(evt.data); + if (!obj.event || obj.event != 'inject') + return; + + if (obj.cmd == 'play') + play(); + else if (obj.cmd == 'pause') + pause(); + else if (obj.cmd == 'showWatermark') + showWatermark(); + else if (obj.cmd == 'hideWatermark') + hideWatermark(); + } catch (ex) { } +} + +window.addEventListener('message', receiveMessage, false); + +var video = document.getElementsByTagName('video')[0]; + +fixPlayer(); +hidePlayButton(); + +video.addEventListener("playing", onPlaybackStart, false); + +window.parent.postMessage(JSON.stringify({ "event": "src", "data": video.src }), '*'); + +function onPlaybackStart() { + window.parent.postMessage('playbackStarted', '*'); +} diff --git a/LegacyComponents/Resources/LegacyComponentsResources.bundle/VineWatermark@2x.png b/LegacyComponents/Resources/LegacyComponentsResources.bundle/VineWatermark@2x.png new file mode 100644 index 0000000000..3457c7df07 Binary files /dev/null and b/LegacyComponents/Resources/LegacyComponentsResources.bundle/VineWatermark@2x.png differ diff --git a/LegacyComponents/Resources/LegacyComponentsResources.bundle/YoutubePlayer.html b/LegacyComponents/Resources/LegacyComponentsResources.bundle/YoutubePlayer.html new file mode 100755 index 0000000000..9c39a7d782 --- /dev/null +++ b/LegacyComponents/Resources/LegacyComponentsResources.bundle/YoutubePlayer.html @@ -0,0 +1,100 @@ + + + + + + +
+
+
+ + + + diff --git a/LegacyComponents/Resources/LegacyComponentsResources.bundle/YoutubePlayerInject.js b/LegacyComponents/Resources/LegacyComponentsResources.bundle/YoutubePlayerInject.js new file mode 100644 index 0000000000..2985148f4a --- /dev/null +++ b/LegacyComponents/Resources/LegacyComponentsResources.bundle/YoutubePlayerInject.js @@ -0,0 +1,47 @@ +function fixChrome() { + var watermark = document.getElementsByClassName('ytp-watermark')[0]; + watermark.style.display = 'none'; + + var button = document.getElementsByClassName('ytp-large-play-button')[0]; + button.style.display = 'none'; + button.style.opacity = '0'; + + var video = document.getElementsByTagName('video')[0]; + video.setAttribute('webkit-playsinline', ''); + video.setAttribute('playsinline', ''); + video.webkitEnterFullscreen = undefined; +} + +function initial() { + var css = 'video::-webkit-media-controls { display:none !important; }', + head = document.head || document.getElementsByTagName('head')[0], + style = document.createElement('style'); + + style.type = 'text/css'; + if (style.styleSheet){ + style.styleSheet.cssText = css; + } else { + style.appendChild(document.createTextNode(css)); + } + + head.appendChild(style); +} + +function switchToPIP() { + var video = document.getElementsByTagName('video')[0]; + video.webkitSetPresentationMode('picture-in-picture'); +} + +function receiveMessage(evt) { + try { + var obj = JSON.parse(evt.data); + if (obj.cmd == 'fixChrome') + fixChrome(); + else if (obj.cmd == 'initial') + initial(); + else if (obj.cmd == 'switchToPIP') + switchToPIP(); + } catch (ex) { } +} + +window.addEventListener('message', receiveMessage, false); diff --git a/LegacyComponents/Resources/LegacyComponentsResources.bundle/YoutubeWatermark@2x.png b/LegacyComponents/Resources/LegacyComponentsResources.bundle/YoutubeWatermark@2x.png new file mode 100644 index 0000000000..63ac731795 Binary files /dev/null and b/LegacyComponents/Resources/LegacyComponentsResources.bundle/YoutubeWatermark@2x.png differ diff --git a/LegacyComponents/TGActivityIndicatorView.h b/LegacyComponents/TGActivityIndicatorView.h deleted file mode 100644 index c66f8b2072..0000000000 --- a/LegacyComponents/TGActivityIndicatorView.h +++ /dev/null @@ -1,14 +0,0 @@ -#import - -typedef enum { - TGActivityIndicatorViewStyleSmall = 0, - TGActivityIndicatorViewStyleLarge = 1, - TGActivityIndicatorViewStyleSmallWhite = 2 -} TGActivityIndicatorViewStyle; - -@interface TGActivityIndicatorView : UIImageView - -- (id)init; -- (id)initWithStyle:(TGActivityIndicatorViewStyle)style; - -@end diff --git a/LegacyComponents/TGActivityIndicatorView.m b/LegacyComponents/TGActivityIndicatorView.m deleted file mode 100644 index caf564c72b..0000000000 --- a/LegacyComponents/TGActivityIndicatorView.m +++ /dev/null @@ -1,90 +0,0 @@ -#import "TGActivityIndicatorView.h" - -@implementation TGActivityIndicatorView - -+ (NSArray *)animationFrames -{ - static NSArray *array = nil; - if (array == nil) - { - NSMutableArray *mutableArray = [[NSMutableArray alloc] init]; - for (int i = 1; i <= 24; i++) - { - UIImage *image = [UIImage imageNamed:[NSString stringWithFormat:@"grayProgress%d.png", i]]; - if (image != nil) - [mutableArray addObject:image]; - } - array = [[NSArray alloc] initWithArray:mutableArray]; - } - return array; -} - -+ (NSArray *)largeAnimationFrames -{ - static NSArray *array = nil; - if (array == nil) - { - NSMutableArray *mutableArray = [[NSMutableArray alloc] init]; - for (int i = 0; i <= 24; i++) - { - UIImage *image = [UIImage imageNamed:[NSString stringWithFormat:@"navbar_big_progress_%d.png", i]]; - if (image != nil) - [mutableArray addObject:image]; - } - array = [[NSArray alloc] initWithArray:mutableArray]; - } - return array; -} - -+ (NSArray *)smallWhiteAnimationFrames -{ - static NSArray *array = nil; - if (array == nil) - { - NSMutableArray *mutableArray = [[NSMutableArray alloc] init]; - - for (int i = 1; i <= 24; i++) - { - UIImage *image = [UIImage imageNamed:[[NSString alloc] initWithFormat:@"RProgress%d.png", i]]; - if (image != nil) - [mutableArray addObject:image]; - } - array = [[NSArray alloc] initWithArray:mutableArray]; - } - return array; -} - -- (id)initWithStyle:(TGActivityIndicatorViewStyle)style -{ - NSArray *frames = style == TGActivityIndicatorViewStyleSmall ? [TGActivityIndicatorView animationFrames] : (style == TGActivityIndicatorViewStyleLarge ?[TGActivityIndicatorView largeAnimationFrames] : [TGActivityIndicatorView smallWhiteAnimationFrames]); - self = [super initWithImage:[frames objectAtIndex:0]]; - if (self) - { - [self setAnimationImages:frames]; - } - return self; -} - -- (id)init -{ - NSArray *frames = [TGActivityIndicatorView animationFrames]; - self = [super initWithImage:[frames objectAtIndex:0]]; - if (self) - { - [self setAnimationImages:frames]; - } - return self; -} - -- (id)initWithFrame:(CGRect)__unused frame -{ - NSArray *frames = [TGActivityIndicatorView animationFrames]; - self = [super initWithImage:[frames objectAtIndex:0]]; - if (self) - { - [self setAnimationImages:frames]; - } - return self; -} - -@end diff --git a/LegacyComponents/TGAttachmentCameraView.m b/LegacyComponents/TGAttachmentCameraView.m index 705df21317..e83a613253 100644 --- a/LegacyComponents/TGAttachmentCameraView.m +++ b/LegacyComponents/TGAttachmentCameraView.m @@ -47,7 +47,7 @@ [_wrapperView addSubview:_previewView]; [camera attachPreviewView:_previewView]; - _iconView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"AttachmentMenuInteractiveCameraIcon"]]; + _iconView = [[UIImageView alloc] initWithImage:TGComponentsImageNamed(@"AttachmentMenuInteractiveCameraIcon")]; [self addSubview:_iconView]; [self addGestureRecognizer:[[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapGesture:)]]; diff --git a/LegacyComponents/TGAttachmentCarouselItemView.h b/LegacyComponents/TGAttachmentCarouselItemView.h index 3dab09bd3d..af2c79d01c 100644 --- a/LegacyComponents/TGAttachmentCarouselItemView.h +++ b/LegacyComponents/TGAttachmentCarouselItemView.h @@ -1,13 +1,13 @@ +#import #import #import -#import - @class TGMediaSelectionContext; @class TGMediaEditingContext; @class TGSuggestionContext; @class TGViewController; @class TGAttachmentCameraView; +@protocol TGModernGalleryTransitionHostScrollView; @interface TGAttachmentCarouselCollectionView : UICollectionView diff --git a/LegacyComponents/TGAttachmentCarouselItemView.m b/LegacyComponents/TGAttachmentCarouselItemView.m index 3183685d8f..26fe3f1357 100644 --- a/LegacyComponents/TGAttachmentCarouselItemView.m +++ b/LegacyComponents/TGAttachmentCarouselItemView.m @@ -48,8 +48,16 @@ const CGFloat TGAttachmentZoomedPhotoAspectRatio = 1.2626f; const NSUInteger TGAttachmentDisplayedAssetLimit = 500; +@interface TGAttachmentCarouselCollectionView () + +@end + @implementation TGAttachmentCarouselCollectionView +- (bool)disableGalleryTransitionOffsetFix { + return true; +} + @end @interface TGAttachmentCarouselItemView () @@ -193,12 +201,12 @@ const NSUInteger TGAttachmentDisplayedAssetLimit = 500; { __strong TGAttachmentCarouselItemView *strongSelf = weakSelf; if (strongSelf == nil) - return; + return; [strongSelf.superview bringSubviewToFront:strongSelf]; if (strongSelf.cameraPressed != nil) - strongSelf.cameraPressed(strongSelf->_cameraView); + strongSelf.cameraPressed(strongSelf->_cameraView); }; } @@ -778,7 +786,9 @@ const NSUInteger TGAttachmentDisplayedAssetLimit = 500; if (self.openEditor) { - TGPhotoEditorController *controller = [[TGPhotoEditorController alloc] initWithContext:_context item:asset intent:TGPhotoEditorControllerAvatarIntent adjustments:nil caption:nil screenImage:thumbnailImage availableTabs:[TGPhotoEditorController defaultTabsForAvatarIntent] selectedTab:TGPhotoEditorCropTab]; + id windowManager = [_context makeOverlayWindowManager]; + + TGPhotoEditorController *controller = [[TGPhotoEditorController alloc] initWithContext:[windowManager context] item:asset intent:TGPhotoEditorControllerAvatarIntent adjustments:nil caption:nil screenImage:thumbnailImage availableTabs:[TGPhotoEditorController defaultTabsForAvatarIntent] selectedTab:TGPhotoEditorCropTab]; controller.editingContext = _editingContext; controller.dontHideStatusBar = true; @@ -828,7 +838,7 @@ const NSUInteger TGAttachmentDisplayedAssetLimit = 500; return [editableItem originalImageSignal:position]; }; - TGOverlayControllerWindow *controllerWindow = [[TGOverlayControllerWindow alloc] initWithParentController:_parentController contentController:controller]; + TGOverlayControllerWindow *controllerWindow = [[TGOverlayControllerWindow alloc] initWithManager:windowManager parentController:_parentController contentController:controller]; controllerWindow.hidden = false; controller.view.clipsToBounds = true; diff --git a/LegacyComponents/TGAttachmentVideoCell.m b/LegacyComponents/TGAttachmentVideoCell.m index 8dafd4dd08..02dda155a7 100644 --- a/LegacyComponents/TGAttachmentVideoCell.m +++ b/LegacyComponents/TGAttachmentVideoCell.m @@ -1,6 +1,7 @@ #import "TGAttachmentVideoCell.h" -#import +#import "LegacyComponentsInternal.h" +#import "TGFont.h" #import @@ -61,11 +62,11 @@ NSString *const TGAttachmentVideoCellIdentifier = @"AttachmentVideoCell"; _durationLabel.frame = durationFrame; if (asset.subtypes & TGMediaAssetSubtypeVideoTimelapse) - _iconView.image = [UIImage imageNamed:@"ModernMediaItemTimelapseIcon"]; + _iconView.image = TGComponentsImageNamed(@"ModernMediaItemTimelapseIcon"); else if (asset.subtypes & TGMediaAssetSubtypeVideoHighFrameRate) - _iconView.image = [UIImage imageNamed:@"ModernMediaItemSloMoIcon"]; + _iconView.image = TGComponentsImageNamed(@"ModernMediaItemSloMoIcon"); else - _iconView.image = [UIImage imageNamed:@"ModernMediaItemVideoIcon"]; + _iconView.image = TGComponentsImageNamed(@"ModernMediaItemVideoIcon"); SSignal *adjustmentsSignal = [self.editingContext adjustmentsSignalForItem:self.asset]; diff --git a/LegacyComponents/TGCameraController.m b/LegacyComponents/TGCameraController.m index 24c6c66633..19ff6a0526 100644 --- a/LegacyComponents/TGCameraController.m +++ b/LegacyComponents/TGCameraController.m @@ -140,7 +140,7 @@ static CGPoint TGCameraControllerClampPointToScreenSize(__unused id self, __unus - (instancetype)initWithContext:(id)context saveEditedPhotos:(bool)saveEditedPhotos saveCapturedMedia:(bool)saveCapturedMedia camera:(PGCamera *)camera previewView:(TGCameraPreviewView *)previewView intent:(TGCameraControllerIntent)intent { - self = [super init]; + self = [super initWithContext:context]; if (self != nil) { _context = context; @@ -701,7 +701,7 @@ static CGPoint TGCameraControllerClampPointToScreenSize(__unused id self, __unus [UIView animateWithDuration:0.3f animations:^ { - [TGHacks setApplicationStatusBarAlpha:0.0f]; + [_context setApplicationStatusBarAlpha:0.0f]; }]; [[[LegacyComponentsGlobals provider] applicationInstance] setIdleTimerDisabled:true]; @@ -716,7 +716,7 @@ static CGPoint TGCameraControllerClampPointToScreenSize(__unused id self, __unus [UIView animateWithDuration:0.3f animations:^ { - [TGHacks setApplicationStatusBarAlpha:1.0f]; + [_context setApplicationStatusBarAlpha:1.0f]; }]; } @@ -986,6 +986,15 @@ static CGPoint TGCameraControllerClampPointToScreenSize(__unused id self, __unus return; } + id windowManager = nil; + id windowContext = nil; + if ([UIDevice currentDevice].userInterfaceIdiom == UIUserInterfaceIdiomPhone) { + windowManager = [_context makeOverlayWindowManager]; + windowContext = [windowManager context]; + } else { + windowContext = _context; + } + __weak TGCameraController *weakSelf = self; TGOverlayController *overlayController = nil; @@ -995,7 +1004,7 @@ static CGPoint TGCameraControllerClampPointToScreenSize(__unused id self, __unus { case TGCameraControllerAvatarIntent: { - TGPhotoEditorController *controller = [[TGPhotoEditorController alloc] initWithContext:_context item:image intent:(TGPhotoEditorControllerFromCameraIntent | TGPhotoEditorControllerAvatarIntent) adjustments:nil caption:nil screenImage:image availableTabs:[TGPhotoEditorController defaultTabsForAvatarIntent] selectedTab:TGPhotoEditorCropTab]; + TGPhotoEditorController *controller = [[TGPhotoEditorController alloc] initWithContext:windowContext item:image intent:(TGPhotoEditorControllerFromCameraIntent | TGPhotoEditorControllerAvatarIntent) adjustments:nil caption:nil screenImage:image availableTabs:[TGPhotoEditorController defaultTabsForAvatarIntent] selectedTab:TGPhotoEditorCropTab]; __weak TGPhotoEditorController *weakController = controller; controller.beginTransitionIn = ^UIView *(CGRect *referenceFrame, __unused UIView **parentView) { @@ -1079,7 +1088,7 @@ static CGPoint TGCameraControllerClampPointToScreenSize(__unused id self, __unus default: { - TGCameraPhotoPreviewController *controller = _shortcut ? [[TGCameraPhotoPreviewController alloc] initWithContext:_context image:image metadata:metadata recipientName:self.recipientName backButtonTitle:TGLocalized(@"Camera.Retake") doneButtonTitle:TGLocalized(@"Common.Next") saveCapturedMedia:_saveCapturedMedia saveEditedPhotos:_saveEditedPhotos] : [[TGCameraPhotoPreviewController alloc] initWithContext:_context image:image metadata:metadata recipientName:self.recipientName saveCapturedMedia:_saveCapturedMedia saveEditedPhotos:_saveEditedPhotos]; + TGCameraPhotoPreviewController *controller = _shortcut ? [[TGCameraPhotoPreviewController alloc] initWithContext:windowContext image:image metadata:metadata recipientName:self.recipientName backButtonTitle:TGLocalized(@"Camera.Retake") doneButtonTitle:TGLocalized(@"Common.Next") saveCapturedMedia:_saveCapturedMedia saveEditedPhotos:_saveEditedPhotos] : [[TGCameraPhotoPreviewController alloc] initWithContext:windowContext image:image metadata:metadata recipientName:self.recipientName saveCapturedMedia:_saveCapturedMedia saveEditedPhotos:_saveEditedPhotos]; controller.allowCaptions = self.allowCaptions; controller.shouldStoreAssets = self.shouldStoreCapturedAssets; controller.suggestionContext = self.suggestionContext; @@ -1146,7 +1155,7 @@ static CGPoint TGCameraControllerClampPointToScreenSize(__unused id self, __unus break; } - if ([UIDevice currentDevice].userInterfaceIdiom == UIUserInterfaceIdiomPhone) + if (windowManager != nil) { TGOverlayController *contentController = overlayController; if (_shortcut) @@ -1159,7 +1168,7 @@ static CGPoint TGCameraControllerClampPointToScreenSize(__unused id self, __unus [contentController.view addSubview:navigationController.view]; } - TGOverlayControllerWindow *controllerWindow = [[TGOverlayControllerWindow alloc] initWithParentController:self contentController:contentController]; + TGOverlayControllerWindow *controllerWindow = [[TGOverlayControllerWindow alloc] initWithManager:windowManager parentController:self contentController:contentController]; controllerWindow.windowLevel = self.view.window.windowLevel + 0.0001f; controllerWindow.hidden = false; } @@ -1240,6 +1249,11 @@ static CGPoint TGCameraControllerClampPointToScreenSize(__unused id self, __unus [[[LegacyComponentsGlobals provider] applicationInstance] setIdleTimerDisabled:false]; + id windowManager = nil; + id windowContext = nil; + windowManager = [_context makeOverlayWindowManager]; + windowContext = [windowManager context]; + AVURLAsset *asset = [AVURLAsset assetWithURL:url]; AVAssetImageGenerator *generator = [[AVAssetImageGenerator alloc] initWithAsset:asset]; generator.appliesPreferredTrackTransform = true; @@ -1254,11 +1268,11 @@ static CGPoint TGCameraControllerClampPointToScreenSize(__unused id self, __unus videoItem.editingContext = _editingContext; videoItem.immediateThumbnailImage = thumbnailImage; - TGModernGalleryController *galleryController = [[TGModernGalleryController alloc] initWithContext:_context]; + TGModernGalleryController *galleryController = [[TGModernGalleryController alloc] initWithContext:windowContext]; galleryController.adjustsStatusBarVisibility = false; galleryController.hasFadeOutTransition = true; - TGMediaPickerGalleryModel *model = [[TGMediaPickerGalleryModel alloc] initWithContext:_context items:@[ videoItem ] focusItem:videoItem selectionContext:nil editingContext:_editingContext hasCaptions:self.allowCaptions hasTimer:self.hasTimer inhibitDocumentCaptions:self.inhibitDocumentCaptions hasSelectionPanel:false recipientName:self.recipientName]; + TGMediaPickerGalleryModel *model = [[TGMediaPickerGalleryModel alloc] initWithContext:windowContext items:@[ videoItem ] focusItem:videoItem selectionContext:nil editingContext:_editingContext hasCaptions:self.allowCaptions hasTimer:self.hasTimer inhibitDocumentCaptions:self.inhibitDocumentCaptions hasSelectionPanel:false recipientName:self.recipientName]; model.controller = galleryController; model.suggestionContext = self.suggestionContext; @@ -1439,7 +1453,7 @@ static CGPoint TGCameraControllerClampPointToScreenSize(__unused id self, __unus [contentController.view addSubview:navigationController.view]; } - TGOverlayControllerWindow *controllerWindow = [[TGOverlayControllerWindow alloc] initWithParentController:self contentController:contentController]; + TGOverlayControllerWindow *controllerWindow = [[TGOverlayControllerWindow alloc] initWithManager:windowManager parentController:self contentController:contentController]; controllerWindow.hidden = false; controllerWindow.windowLevel = self.view.window.windowLevel + 0.0001f; galleryController.view.clipsToBounds = true; @@ -1492,7 +1506,7 @@ static CGPoint TGCameraControllerClampPointToScreenSize(__unused id self, __unus [UIView animateWithDuration:0.3f animations:^ { - [TGHacks setApplicationStatusBarAlpha:1.0f]; + [_context setApplicationStatusBarAlpha:1.0f]; }]; [self setInterfaceHidden:true animated:true]; @@ -1568,7 +1582,7 @@ static CGPoint TGCameraControllerClampPointToScreenSize(__unused id self, __unus { _finishedWithResult = true; - [TGHacks setApplicationStatusBarAlpha:1.0f]; + [_context setApplicationStatusBarAlpha:1.0f]; self.view.hidden = true; diff --git a/LegacyComponents/TGCameraFlashActiveView.m b/LegacyComponents/TGCameraFlashActiveView.m index 4b3bb2035e..71502ab3fd 100644 --- a/LegacyComponents/TGCameraFlashActiveView.m +++ b/LegacyComponents/TGCameraFlashActiveView.m @@ -1,5 +1,7 @@ #import "TGCameraFlashActiveView.h" +#import "LegacyComponentsInternal.h" + #import "TGCameraInterfaceAssets.h" @interface TGCameraFlashActiveView () @@ -25,7 +27,7 @@ _iconView = [[UIImageView alloc] initWithFrame:CGRectMake((frame.size.width - 8) / 2, (frame.size.height - 13) / 2, 8, 13)]; _iconView.autoresizingMask = UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleTopMargin | UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleBottomMargin; - _iconView.image = [UIImage imageNamed:@"CameraFlashActive"]; + _iconView.image = TGComponentsImageNamed(@"CameraFlashActive"); [_backgroundView addSubview:_iconView]; [self setActive:false animated:false]; diff --git a/LegacyComponents/TGCameraFlashControl.m b/LegacyComponents/TGCameraFlashControl.m index 6c960046a1..4962d217f6 100644 --- a/LegacyComponents/TGCameraFlashControl.m +++ b/LegacyComponents/TGCameraFlashControl.m @@ -35,7 +35,7 @@ const CGFloat TGCameraFlashControlHeight = 44.0f; _flashIconView.exclusiveTouch = true; _flashIconView.hitTestEdgeInsets = UIEdgeInsetsMake(0, -10, 0, -10); _flashIconView.tag = -1; - [_flashIconView setImage:[UIImage imageNamed:@"CameraFlashButton"] forState:UIControlStateNormal]; + [_flashIconView setImage:TGComponentsImageNamed(@"CameraFlashButton") forState:UIControlStateNormal]; [_flashIconView addTarget:self action:@selector(buttonPressed:) forControlEvents:UIControlEventTouchUpInside]; [self addSubview:_flashIconView]; @@ -43,7 +43,7 @@ const CGFloat TGCameraFlashControlHeight = 44.0f; static dispatch_once_t onceToken; dispatch_once(&onceToken, ^ { - UIImage *image = [UIImage imageNamed:@"CameraFlashButton"]; + UIImage *image = TGComponentsImageNamed(@"CameraFlashButton"); UIGraphicsBeginImageContextWithOptions(image.size, false, 0.0f); CGContextRef context = UIGraphicsGetCurrentContext(); [image drawInRect:CGRectMake(0, 0, image.size.width, image.size.height)]; diff --git a/LegacyComponents/TGCameraFlipButton.m b/LegacyComponents/TGCameraFlipButton.m index a50975840b..55fbdb5136 100644 --- a/LegacyComponents/TGCameraFlipButton.m +++ b/LegacyComponents/TGCameraFlipButton.m @@ -1,5 +1,7 @@ #import "TGCameraFlipButton.h" +#import "LegacyComponentsInternal.h" + @implementation TGCameraFlipButton - (instancetype)initWithFrame:(CGRect)frame @@ -8,7 +10,7 @@ if (self != nil) { self.exclusiveTouch = true; - [self setImage:[UIImage imageNamed:@"CameraLargeFlipButton"] forState:UIControlStateNormal]; + [self setImage:TGComponentsImageNamed(@"CameraLargeFlipButton") forState:UIControlStateNormal]; } return self; } diff --git a/LegacyComponents/TGCameraFocusCrosshairsControl.m b/LegacyComponents/TGCameraFocusCrosshairsControl.m index 27f52528c4..6b8407fcc8 100644 --- a/LegacyComponents/TGCameraFocusCrosshairsControl.m +++ b/LegacyComponents/TGCameraFocusCrosshairsControl.m @@ -61,14 +61,14 @@ [_wrapperView addSubview:_focusIndicatorView]; _focusIndicatorImageView = [[UIImageView alloc] initWithFrame:CGRectMake(45, 45, 75, 75)]; - _focusIndicatorImageView.image = [UIImage imageNamed:@"CameraFocusCrosshairs"]; + _focusIndicatorImageView.image = TGComponentsImageNamed(@"CameraFocusCrosshairs"); _focusIndicatorImageView.alpha = 0.0; [_focusIndicatorView addSubview:_focusIndicatorImageView]; _autoFocusIndicator = [[UIImageView alloc] initWithFrame:CGRectMake(CGFloor((self.bounds.size.width - 125) / 2), CGFloor((self.bounds.size.height - 125) / 2), 125, 125)]; _autoFocusIndicator.autoresizingMask = UIViewAutoresizingFlexibleTopMargin | UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleBottomMargin; _autoFocusIndicator.backgroundColor = [UIColor clearColor]; - _autoFocusIndicator.image = [UIImage imageNamed:@"CameraAutoFocusCrosshairs"]; + _autoFocusIndicator.image = TGComponentsImageNamed(@"CameraAutoFocusCrosshairs"); _autoFocusIndicator.alpha = 0.0f; [_wrapperView addSubview:_autoFocusIndicator]; @@ -85,7 +85,7 @@ [_exposureClipView addSubview:_exposureIndicatorView]; _exposureIconView = [[UIImageView alloc] initWithFrame:CGRectMake(-1, 59.5f, 25, 25)]; - _exposureIconView.image = [UIImage imageNamed:@"CameraExposureIcon"]; + _exposureIconView.image = TGComponentsImageNamed(@"CameraExposureIcon"); [_exposureIndicatorView addSubview:_exposureIconView]; _exposureTopLine = [[UIView alloc] initWithFrame:CGRectMake(11, _exposureIconView.frame.origin.y - 3 - _exposureIndicatorView.frame.size.height, 1, _exposureIndicatorView.frame.size.height)]; diff --git a/LegacyComponents/TGCameraPhotoPreviewController.m b/LegacyComponents/TGCameraPhotoPreviewController.m index 75e121111d..0f2ae5d19c 100644 --- a/LegacyComponents/TGCameraPhotoPreviewController.m +++ b/LegacyComponents/TGCameraPhotoPreviewController.m @@ -94,7 +94,7 @@ - (instancetype)initWithContext:(id)context image:(UIImage *)image metadata:(PGCameraShotMetadata *)metadata recipientName:(NSString *)recipientName backButtonTitle:(NSString *)backButtonTitle doneButtonTitle:(NSString *)doneButtonTitle saveCapturedMedia:(bool)saveCapturedMedia saveEditedPhotos:(bool)saveEditedPhotos { - self = [super init]; + self = [super initWithContext:context]; if (self != nil) { _context = context; @@ -381,7 +381,7 @@ if (_recipientName.length > 0) { - _arrowView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"PhotoPickerArrow"]]; + _arrowView = [[UIImageView alloc] initWithImage:TGComponentsImageNamed(@"PhotoPickerArrow")]; _arrowView.alpha = 0.45f; [_wrapperView addSubview:_arrowView]; @@ -565,7 +565,7 @@ - (void)transitionIn { - [TGHacks setApplicationStatusBarAlpha:0.0f]; + [_context setApplicationStatusBarAlpha:0.0f]; if (_appeared) return; diff --git a/LegacyComponents/TGCameraSegmentsView.m b/LegacyComponents/TGCameraSegmentsView.m index abfe5ad623..6f5ed063cf 100644 --- a/LegacyComponents/TGCameraSegmentsView.m +++ b/LegacyComponents/TGCameraSegmentsView.m @@ -1,6 +1,7 @@ #import "TGCameraSegmentsView.h" -#import +#import "LegacyComponentsInternal.h" +#import "TGImageUtils.h" #import "TGCameraInterfaceAssets.h" @@ -51,7 +52,7 @@ const CGFloat TGCameraSegmentsMinimumWidth = 4.0f; UIGraphicsEndImageContext(); }); - _backgroundView = [[UIImageView alloc] initWithImage:[[UIImage imageNamed:@"CameraSegmentsBack"] resizableImageWithCapInsets:UIEdgeInsetsMake(4, 4, 4, 4)]]; + _backgroundView = [[UIImageView alloc] initWithImage:[TGComponentsImageNamed(@"CameraSegmentsBack") resizableImageWithCapInsets:UIEdgeInsetsMake(4, 4, 4, 4)]]; [self addSubview:_backgroundView]; _segmentWrapper = [[UIView alloc] init]; @@ -62,7 +63,7 @@ const CGFloat TGCameraSegmentsMinimumWidth = 4.0f; _deleteButton = [[TGModernButton alloc] initWithFrame:CGRectMake(0, 0, 32, 32)]; _deleteButton.exclusiveTouch = true; - [_deleteButton setImage:[UIImage imageNamed:@"CameraDeleteIcon"] forState:UIControlStateNormal]; + [_deleteButton setImage:TGComponentsImageNamed(@"CameraDeleteIcon") forState:UIControlStateNormal]; [_deleteButton addTarget:self action:@selector(deleteButtonPressed) forControlEvents:UIControlEventTouchUpInside]; [self addSubview:_deleteButton]; diff --git a/LegacyComponents/TGEmbedCoubPlayerView.m b/LegacyComponents/TGEmbedCoubPlayerView.m index 5b651ca1c2..1f56bd2e8d 100644 --- a/LegacyComponents/TGEmbedCoubPlayerView.m +++ b/LegacyComponents/TGEmbedCoubPlayerView.m @@ -68,7 +68,7 @@ } } - self.controlsView.watermarkImage = [UIImage imageNamed:@"CoubWatermark"]; + self.controlsView.watermarkImage = TGComponentsImageNamed(@"CoubWatermark"); self.controlsView.watermarkOffset = CGPointMake(12.0f, 12.0f); } return self; @@ -156,7 +156,7 @@ - (NSString *)_embedHTML { NSError *error = nil; - NSString *path = [[NSBundle mainBundle] pathForResource:@"DefaultPlayer" ofType:@"html"]; + NSString *path = TGComponentsPathForResource(@"DefaultPlayer", @"html"); NSString *embedHTMLTemplate = [NSString stringWithContentsOfFile:path encoding:NSUTF8StringEncoding error:&error]; if (error != nil) diff --git a/LegacyComponents/TGEmbedInstagramPlayerView.m b/LegacyComponents/TGEmbedInstagramPlayerView.m index 7dc8028675..22bc77a484 100644 --- a/LegacyComponents/TGEmbedInstagramPlayerView.m +++ b/LegacyComponents/TGEmbedInstagramPlayerView.m @@ -86,7 +86,7 @@ NSString *const TGInstagramPlayerCallbackOnPlayback = @"onPlayback"; - (NSString *)_embedHTML { NSError *error = nil; - NSString *path = [[NSBundle mainBundle] pathForResource:@"InstagramPlayer" ofType:@"html"]; + NSString *path = TGComponentsPathForResource(@"InstagramPlayer", @"html"); NSString *embedHTMLTemplate = [NSString stringWithContentsOfFile:path encoding:NSUTF8StringEncoding error:&error]; if (error != nil) diff --git a/LegacyComponents/TGEmbedPlayerControls.m b/LegacyComponents/TGEmbedPlayerControls.m index 6082243b5b..338de1552c 100644 --- a/LegacyComponents/TGEmbedPlayerControls.m +++ b/LegacyComponents/TGEmbedPlayerControls.m @@ -91,13 +91,13 @@ const CGFloat TGEmbedPlayerControlsPanelHeight = 32.0f; _pauseButton = [[TGModernButton alloc] initWithFrame:CGRectMake(0, 0, 38, TGEmbedPlayerControlsPanelHeight)]; _pauseButton.exclusiveTouch = true; - [_pauseButton setImage:[UIImage imageNamed:@"EmbedVideoPauseIcon"] forState:UIControlStateNormal]; + [_pauseButton setImage:TGComponentsImageNamed(@"EmbedVideoPauseIcon") forState:UIControlStateNormal]; [_pauseButton addTarget:self action:@selector(pauseButtonPressed) forControlEvents:UIControlEventTouchUpInside]; [_backgroundView addSubview:_pauseButton]; _playButton = [[TGModernButton alloc] initWithFrame:CGRectMake(0, 0, 38, TGEmbedPlayerControlsPanelHeight)]; _playButton.exclusiveTouch = true; - [_playButton setImage:[UIImage imageNamed:@"EmbedVideoPlayIcon"] forState:UIControlStateNormal]; + [_playButton setImage:TGComponentsImageNamed(@"EmbedVideoPlayIcon") forState:UIControlStateNormal]; [_playButton addTarget:self action:@selector(playButtonPressed) forControlEvents:UIControlEventTouchUpInside]; [_backgroundView addSubview:_playButton]; @@ -121,7 +121,7 @@ const CGFloat TGEmbedPlayerControlsPanelHeight = 32.0f; _pictureInPictureButton = [[TGModernButton alloc] initWithFrame:CGRectMake(frame.size.width - 45.0f, 0, 45.0f, TGEmbedPlayerControlsPanelHeight)]; _pictureInPictureButton.exclusiveTouch = true; - [_pictureInPictureButton setImage:[UIImage imageNamed:@"EmbedVideoPIPIcon"] forState:UIControlStateNormal]; + [_pictureInPictureButton setImage:TGComponentsImageNamed(@"EmbedVideoPIPIcon") forState:UIControlStateNormal]; [_pictureInPictureButton addTarget:self action:@selector(pictureInPictureButtonPressed) forControlEvents:UIControlEventTouchUpInside]; [_backgroundView addSubview:_pictureInPictureButton]; @@ -193,7 +193,7 @@ const CGFloat TGEmbedPlayerControlsPanelHeight = 32.0f; _fullscreenButton = [[TGModernButton alloc] initWithFrame:_fullscreenButtonWrapper.bounds]; _fullscreenButton.exclusiveTouch = true; - [_fullscreenButton setImage:[UIImage imageNamed:@"EmbedVideoFullScreenIcon"] forState:UIControlStateNormal]; + [_fullscreenButton setImage:TGComponentsImageNamed(@"EmbedVideoFullScreenIcon") forState:UIControlStateNormal]; [_fullscreenButton addTarget:self action:@selector(fullscreenButtonPressed) forControlEvents:UIControlEventTouchUpInside]; [_fullscreenButtonWrapper addSubview:_fullscreenButton]; } diff --git a/LegacyComponents/TGEmbedPlayerScrubber.m b/LegacyComponents/TGEmbedPlayerScrubber.m index 70839b6147..3837876bb9 100644 --- a/LegacyComponents/TGEmbedPlayerScrubber.m +++ b/LegacyComponents/TGEmbedPlayerScrubber.m @@ -1,6 +1,7 @@ #import "TGEmbedPlayerScrubber.h" -#import +#import "LegacyComponentsInternal.h" +#import "TGImageUtils.h" #import @@ -33,7 +34,7 @@ const CGFloat TGEmbedPlayerKnobMargin = 8.0f; { self.hitTestEdgeInsets = UIEdgeInsetsMake(-20, -20, -20, -20); - UIImage *hollowTrackImage = [[UIImage imageNamed:@"EmbedVideoTrackHollow"] resizableImageWithCapInsets:UIEdgeInsetsMake(0, 2, 0, 2)]; + UIImage *hollowTrackImage = [TGComponentsImageNamed(@"EmbedVideoTrackHollow") resizableImageWithCapInsets:UIEdgeInsetsMake(0, 2, 0, 2)]; _backgroundView = [[UIImageView alloc] initWithImage:hollowTrackImage]; [self addSubview:_backgroundView]; @@ -142,7 +143,7 @@ const CGFloat TGEmbedPlayerKnobMargin = 8.0f; - (void)setTintColor:(UIColor *)tintColor { - UIImage *tintedImage = [TGTintedImage([UIImage imageNamed:@"EmbedVideoTrackHollow"], tintColor) resizableImageWithCapInsets:UIEdgeInsetsMake(0, 2, 0, 2)]; + UIImage *tintedImage = [TGTintedImage(TGComponentsImageNamed(@"EmbedVideoTrackHollow"), tintColor) resizableImageWithCapInsets:UIEdgeInsetsMake(0, 2, 0, 2)]; _backgroundView.image = tintedImage; _downloadProgressView.backgroundColor = tintColor; } diff --git a/LegacyComponents/TGEmbedPlayerView.m b/LegacyComponents/TGEmbedPlayerView.m index 6dc32e6bce..a270f9d342 100644 --- a/LegacyComponents/TGEmbedPlayerView.m +++ b/LegacyComponents/TGEmbedPlayerView.m @@ -752,7 +752,7 @@ - (NSString *)_embedHTML { - NSString *path = [[NSBundle mainBundle] pathForResource:@"DefaultPlayer" ofType:@"html"]; + NSString *path = TGComponentsPathForResource(@"DefaultPlayer", @"html"); NSError *error = nil; NSString *embedHTMLTemplate = [NSString stringWithContentsOfFile:path encoding:NSUTF8StringEncoding error:&error]; if (error != nil) @@ -778,7 +778,7 @@ - (void)_setupUserScripts:(WKUserContentController *)__unused contentController { NSError *error = nil; - NSString *path = [[NSBundle mainBundle] pathForResource:@"DefaultPlayerInject" ofType:@"js"]; + NSString *path = TGComponentsPathForResource(@"DefaultPlayerInject", @"js"); NSString *scriptText = [NSString stringWithContentsOfFile:path encoding:NSUTF8StringEncoding error:&error]; if (error != nil) TGLog(@"[DefaultEmbedPlayer]: Received error loading inject script: %@", error); diff --git a/LegacyComponents/TGEmbedVimeoPlayerView.m b/LegacyComponents/TGEmbedVimeoPlayerView.m index c9da22ff50..8d0ea459c3 100644 --- a/LegacyComponents/TGEmbedVimeoPlayerView.m +++ b/LegacyComponents/TGEmbedVimeoPlayerView.m @@ -148,7 +148,7 @@ NSString *const TGVimeoPlayerCallbackOnState = @"onState"; - (NSString *)_embedHTML { NSError *error = nil; - NSString *path = [[NSBundle mainBundle] pathForResource:@"VimeoPlayer" ofType:@"html"]; + NSString *path = TGComponentsPathForResource(@"VimeoPlayer", @"html"); NSString *embedHTMLTemplate = [NSString stringWithContentsOfFile:path encoding:NSUTF8StringEncoding error:&error]; if (error != nil) @@ -170,7 +170,7 @@ NSString *const TGVimeoPlayerCallbackOnState = @"onState"; - (void)_setupUserScripts:(WKUserContentController *)contentController { NSError *error = nil; - NSString *path = [[NSBundle mainBundle] pathForResource:@"VimeoPlayerInject" ofType:@"js"]; + NSString *path = TGComponentsPathForResource(@"VimeoPlayerInject", @"js"); NSString *scriptText = [NSString stringWithContentsOfFile:path encoding:NSUTF8StringEncoding error:&error]; if (error != nil) TGLog(@"[VimeoEmbedPlayer]: Received error loading inject script: %@", error); diff --git a/LegacyComponents/TGEmbedVinePlayerView.m b/LegacyComponents/TGEmbedVinePlayerView.m index 2ebcc8dbe6..7581fed87b 100644 --- a/LegacyComponents/TGEmbedVinePlayerView.m +++ b/LegacyComponents/TGEmbedVinePlayerView.m @@ -34,7 +34,7 @@ NSString *const TGVinePlayerCallbackOnPlayback = @"onPlayback"; { _videoId = [TGEmbedVinePlayerView _vineVideoIdFromText:webPage.embedUrl]; - self.controlsView.watermarkImage = [UIImage imageNamed:@"VineWatermark"]; + self.controlsView.watermarkImage = TGComponentsImageNamed(@"VineWatermark"); self.controlsView.watermarkPrerenderedOpacity = true; self.controlsView.watermarkOffset = CGPointMake(12.0f, 12.0f); } @@ -175,7 +175,7 @@ NSString *const TGVinePlayerCallbackOnPlayback = @"onPlayback"; - (NSString *)_embedHTML { NSError *error = nil; - NSString *path = [[NSBundle mainBundle] pathForResource:@"VinePlayer" ofType:@"html"]; + NSString *path = TGComponentsPathForResource(@"VinePlayer", @"html"); NSString *embedHTMLTemplate = [NSString stringWithContentsOfFile:path encoding:NSUTF8StringEncoding error:&error]; if (error != nil) @@ -196,7 +196,7 @@ NSString *const TGVinePlayerCallbackOnPlayback = @"onPlayback"; - (void)_setupUserScripts:(WKUserContentController *)contentController { NSError *error = nil; - NSString *path = [[NSBundle mainBundle] pathForResource:@"VinePlayerInject" ofType:@"js"]; + NSString *path = TGComponentsPathForResource(@"VinePlayerInject", @"js"); NSString *scriptText = [NSString stringWithContentsOfFile:path encoding:NSUTF8StringEncoding error:&error]; if (error != nil) TGLog(@"[VineEmbedPlayer]: Received error loading inject script: %@", error); diff --git a/LegacyComponents/TGEmbedYoutubePlayerView.m b/LegacyComponents/TGEmbedYoutubePlayerView.m index b9a41ad302..3bdfc5ae86 100644 --- a/LegacyComponents/TGEmbedYoutubePlayerView.m +++ b/LegacyComponents/TGEmbedYoutubePlayerView.m @@ -54,7 +54,7 @@ const NSInteger TGYTPlayerStateBufferingCode = 3; } }; - self.controlsView.watermarkImage = [UIImage imageNamed:@"YoutubeWatermark"]; + self.controlsView.watermarkImage = TGComponentsImageNamed(@"YoutubeWatermark"); self.controlsView.watermarkPosition = TGEmbedPlayerWatermarkPositionBottomRight; self.controlsView.watermarkOffset = CGPointMake(-12.0f, -12.0f); } @@ -251,7 +251,7 @@ const NSInteger TGYTPlayerStateBufferingCode = 3; } NSError *error = nil; - NSString *path = [[NSBundle mainBundle] pathForResource:@"YoutubePlayer" ofType:@"html"]; + NSString *path = TGComponentsPathForResource(@"YoutubePlayer", @"html"); NSString *embedHTMLTemplate = [NSString stringWithContentsOfFile:path encoding:NSUTF8StringEncoding error:&error]; if (error != nil) @@ -283,7 +283,7 @@ const NSInteger TGYTPlayerStateBufferingCode = 3; - (void)_setupUserScripts:(WKUserContentController *)contentController { NSError *error = nil; - NSString *path = [[NSBundle mainBundle] pathForResource:@"YoutubePlayerInject" ofType:@"js"]; + NSString *path = TGComponentsPathForResource(@"YoutubePlayerInject", @"js"); NSString *scriptText = [NSString stringWithContentsOfFile:path encoding:NSUTF8StringEncoding error:&error]; if (error != nil) TGLog(@"[YTEmbedPlayer]: Received error loading inject script: %@", error); diff --git a/LegacyComponents/TGHacks.h b/LegacyComponents/TGHacks.h index 63b2be7efe..51a0a7cfb4 100644 --- a/LegacyComponents/TGHacks.h +++ b/LegacyComponents/TGHacks.h @@ -30,13 +30,8 @@ typedef enum { + (void)setSecondaryAnimationDurationFactor:(float)factor; + (void)setForceSystemCurve:(bool)forceSystemCurve; -+ (CGFloat)applicationStatusBarAlpha; -+ (void)setApplicationStatusBarAlpha:(CGFloat)alpha; - + (CGFloat)applicationStatusBarOffset; + (void)setApplicationStatusBarOffset:(CGFloat)offset; -+ (void)animateApplicationStatusBarAppearance:(int)statusBarAnimation delay:(NSTimeInterval)delay duration:(NSTimeInterval)duration completion:(void (^)())completion; -+ (void)animateApplicationStatusBarAppearance:(int)statusBarAnimation duration:(NSTimeInterval)duration completion:(void (^)())completion; + (void)animateApplicationStatusBarStyleTransitionWithDuration:(NSTimeInterval)duration; + (CGFloat)statusBarHeightForOrientation:(UIInterfaceOrientation)orientation; diff --git a/LegacyComponents/TGItemMenuSheetPreviewView.m b/LegacyComponents/TGItemMenuSheetPreviewView.m index f1aadf30e8..1085aa2954 100644 --- a/LegacyComponents/TGItemMenuSheetPreviewView.m +++ b/LegacyComponents/TGItemMenuSheetPreviewView.m @@ -118,7 +118,7 @@ typedef enum if (requiresShadow && _shadowView == nil) { _shadowView = [[UIImageView alloc] init]; - _shadowView.image = [[UIImage imageNamed:@"PreviewSheetShadow"] resizableImageWithCapInsets:UIEdgeInsetsMake(42.0f, 42.0f, 42.0f, 42.0f)]; + _shadowView.image = [TGComponentsImageNamed(@"PreviewSheetShadow") resizableImageWithCapInsets:UIEdgeInsetsMake(42.0f, 42.0f, 42.0f, 42.0f)]; [_containerView addSubview:_shadowView]; } @@ -144,7 +144,7 @@ typedef enum [_arrowView removeFromSuperview]; - _arrowView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"PreviewUpArrow"]]; + _arrowView = [[UIImageView alloc] initWithImage:TGComponentsImageNamed(@"PreviewUpArrow")]; _arrowView.alpha = 0.0f; [_mainSheetView addSubview:_arrowView]; @@ -238,7 +238,7 @@ typedef enum if (!self.dontBlurOnPresentation || self.presentActionsImmediately) { - [TGHacks setApplicationStatusBarAlpha:0.0f]; + [_context setApplicationStatusBarAlpha:0.0f]; [self performAppearBackgroundTransition:completionBlock]; } @@ -287,7 +287,7 @@ typedef enum { [UIView animateWithDuration:0.22 delay:0.0 options:UIViewAnimationOptionCurveEaseOut animations:^ { - [TGHacks setApplicationStatusBarAlpha:1.0f]; + [_context setApplicationStatusBarAlpha:1.0f]; _blurView.alpha = 0.0f; } completion:^(__unused BOOL finished) @@ -297,7 +297,7 @@ typedef enum } else { - [TGHacks setApplicationStatusBarAlpha:1.0f]; + [_context setApplicationStatusBarAlpha:1.0f]; completionBlock(); } } diff --git a/LegacyComponents/TGItemPreviewController.m b/LegacyComponents/TGItemPreviewController.m index 32afd48a07..11545de2d7 100644 --- a/LegacyComponents/TGItemPreviewController.m +++ b/LegacyComponents/TGItemPreviewController.m @@ -18,13 +18,13 @@ - (instancetype)initWithContext:(id)context parentController:(TGViewController *)parentController previewView:(TGItemPreviewView *)previewView { - self = [self init]; + self = [self initWithContext:context]; if (self != nil) { _context = context; _previewView = previewView; - TGOverlayControllerWindow *window = [[TGOverlayControllerWindow alloc] initWithParentController:parentController contentController:self keepKeyboard:true]; + TGOverlayControllerWindow *window = [[TGOverlayControllerWindow alloc] initWithManager:[context makeOverlayWindowManager] parentController:parentController contentController:self keepKeyboard:true]; window.windowLevel = 100000000.0f; window.tag = 0xbeef; window.userInteractionEnabled = previewView.userInteractionEnabled; diff --git a/LegacyComponents/TGLegacyCameraController.m b/LegacyComponents/TGLegacyCameraController.m index f6aff5c086..c74e6ff087 100644 --- a/LegacyComponents/TGLegacyCameraController.m +++ b/LegacyComponents/TGLegacyCameraController.m @@ -87,11 +87,11 @@ { [UIView animateWithDuration:0.3 animations:^ { - [TGHacks setApplicationStatusBarAlpha:0.0f]; + [_context setApplicationStatusBarAlpha:0.0f]; }]; } else - [TGHacks setApplicationStatusBarAlpha:0.0f]; + [_context setApplicationStatusBarAlpha:0.0f]; } [super viewWillAppear:animated]; @@ -105,11 +105,11 @@ { [UIView animateWithDuration:0.3 animations:^ { - [TGHacks setApplicationStatusBarAlpha:1.0f]; + [_context setApplicationStatusBarAlpha:1.0f]; }]; } else - [TGHacks setApplicationStatusBarAlpha:1.0f]; + [_context setApplicationStatusBarAlpha:1.0f]; } [super viewWillDisappear:animated]; diff --git a/LegacyComponents/TGLegacyMediaPickerTipView.m b/LegacyComponents/TGLegacyMediaPickerTipView.m index bc23a1134a..5612b63710 100644 --- a/LegacyComponents/TGLegacyMediaPickerTipView.m +++ b/LegacyComponents/TGLegacyMediaPickerTipView.m @@ -31,7 +31,7 @@ _wrapperView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 0, 0)]; [self addSubview:_wrapperView]; - _imageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"AttachmentTipIcons"]]; + _imageView = [[UIImageView alloc] initWithImage:TGComponentsImageNamed(@"AttachmentTipIcons")]; [self addSubview:_imageView]; _titleLabel = [[UILabel alloc] init]; diff --git a/LegacyComponents/TGMediaAssetsController.m b/LegacyComponents/TGMediaAssetsController.m index 4624fb2de9..c719d2e366 100644 --- a/LegacyComponents/TGMediaAssetsController.m +++ b/LegacyComponents/TGMediaAssetsController.m @@ -78,7 +78,7 @@ } }; - TGMediaGroupsController *groupsController = [[TGMediaGroupsController alloc] initWithAssetsLibrary:assetsController.assetsLibrary intent:intent]; + TGMediaGroupsController *groupsController = [[TGMediaGroupsController alloc] initWithContext:context assetsLibrary:assetsController.assetsLibrary intent:intent]; groupsController.openAssetGroup = ^(id group) { __strong TGMediaAssetsController *strongController = weakController; @@ -683,7 +683,7 @@ if (iosMajorVersion() < 7) { - TGModernBarButton *searchButton = [[TGModernBarButton alloc] initWithImage:[UIImage imageNamed:@"NavigationSearchIcon.png"]]; + TGModernBarButton *searchButton = [[TGModernBarButton alloc] initWithImage:TGComponentsImageNamed(@"NavigationSearchIcon.png")]; searchButton.portraitAdjustment = CGPointMake(-7, -5); [searchButton addTarget:self action:@selector(searchButtonPressed) forControlEvents:UIControlEventTouchUpInside]; return [[UIBarButtonItem alloc] initWithCustomView:searchButton]; diff --git a/LegacyComponents/TGMediaAssetsPickerController.m b/LegacyComponents/TGMediaAssetsPickerController.m index 79dc5e84b1..58f61695d3 100644 --- a/LegacyComponents/TGMediaAssetsPickerController.m +++ b/LegacyComponents/TGMediaAssetsPickerController.m @@ -72,7 +72,7 @@ break; } - self = [super initWithSelectionContext:hasSelection ? selectionContext : nil editingContext:hasEditing ? editingContext : nil]; + self = [super initWithContext:context selectionContext:hasSelection ? selectionContext : nil editingContext:hasEditing ? editingContext : nil]; if (self != nil) { _context = context; diff --git a/LegacyComponents/TGMediaAssetsTipView.m b/LegacyComponents/TGMediaAssetsTipView.m index 71efa7240f..fa1ed784a7 100644 --- a/LegacyComponents/TGMediaAssetsTipView.m +++ b/LegacyComponents/TGMediaAssetsTipView.m @@ -30,7 +30,7 @@ _wrapperView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 0, 0)]; [self addSubview:_wrapperView]; - _imageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"AttachmentTipIcons"]]; + _imageView = [[UIImageView alloc] initWithImage:TGComponentsImageNamed(@"AttachmentTipIcons")]; [self addSubview:_imageView]; _titleLabel = [[UILabel alloc] init]; diff --git a/LegacyComponents/TGMediaAssetsVideoCell.m b/LegacyComponents/TGMediaAssetsVideoCell.m index 4562b28d07..e6b8c063fc 100644 --- a/LegacyComponents/TGMediaAssetsVideoCell.m +++ b/LegacyComponents/TGMediaAssetsVideoCell.m @@ -106,11 +106,11 @@ NSString *const TGMediaAssetsVideoCellKind = @"TGMediaAssetsVideoCellKind"; _durationLabel.text = durationString; if (asset.subtypes & TGMediaAssetSubtypeVideoTimelapse) - _iconView.image = [UIImage imageNamed:@"ModernMediaItemTimelapseIcon"]; + _iconView.image = TGComponentsImageNamed(@"ModernMediaItemTimelapseIcon"); else if (asset.subtypes & TGMediaAssetSubtypeVideoHighFrameRate) - _iconView.image = [UIImage imageNamed:@"ModernMediaItemSloMoIcon"]; + _iconView.image = TGComponentsImageNamed(@"ModernMediaItemSloMoIcon"); else - _iconView.image = [UIImage imageNamed:@"ModernMediaItemVideoIcon"]; + _iconView.image = TGComponentsImageNamed(@"ModernMediaItemVideoIcon"); SSignal *adjustmentsSignal = [self.editingContext adjustmentsSignalForItem:(id)self.item]; diff --git a/LegacyComponents/TGMediaAvatarMenuMixin.h b/LegacyComponents/TGMediaAvatarMenuMixin.h index b1b9f24426..ea2394e0b7 100644 --- a/LegacyComponents/TGMediaAvatarMenuMixin.h +++ b/LegacyComponents/TGMediaAvatarMenuMixin.h @@ -2,6 +2,7 @@ #import @class TGViewController; +@class TGMenuSheetController; @interface TGMediaAvatarMenuMixin : NSObject @@ -11,6 +12,6 @@ - (instancetype)initWithContext:(id)context parentController:(TGViewController *)parentController hasDeleteButton:(bool)hasDeleteButton saveEditedPhotos:(bool)saveEditedPhotos saveCapturedMedia:(bool)saveCapturedMedia; - (instancetype)initWithContext:(id)context parentController:(TGViewController *)parentController hasDeleteButton:(bool)hasDeleteButton personalPhoto:(bool)personalPhoto saveEditedPhotos:(bool)saveEditedPhotos saveCapturedMedia:(bool)saveCapturedMedia; -- (void)present; +- (TGMenuSheetController *)present; @end diff --git a/LegacyComponents/TGMediaAvatarMenuMixin.m b/LegacyComponents/TGMediaAvatarMenuMixin.m index 9727a3a4ba..64dc9bd20f 100644 --- a/LegacyComponents/TGMediaAvatarMenuMixin.m +++ b/LegacyComponents/TGMediaAvatarMenuMixin.m @@ -49,17 +49,17 @@ return self; } -- (void)present +- (TGMenuSheetController *)present { [_parentController.view endEditing:true]; if (iosMajorVersion() >= 7 && [UIDevice currentDevice].userInterfaceIdiom == UIUserInterfaceIdiomPhone) - [self _presentAvatarMenu]; + return [self _presentAvatarMenu]; else - [self _presentLegacyAvatarMenu]; + return [self _presentLegacyAvatarMenu]; } -- (void)_presentAvatarMenu +- (TGMenuSheetController *)_presentAvatarMenu { __weak TGMediaAvatarMenuMixin *weakSelf = self; TGMenuSheetController *controller = [[TGMenuSheetController alloc] initWithContext:_context dark:false]; @@ -164,9 +164,10 @@ [controller setItemViews:itemViews]; [controller presentInViewController:_parentController sourceView:nil animated:true]; + return controller; } -- (void)_presentLegacyAvatarMenu +- (TGMenuSheetController *)_presentLegacyAvatarMenu { NSMutableArray *actions = [[NSMutableArray alloc] init]; @@ -200,6 +201,7 @@ controller.didDismiss(); } }]; + return nil; } - (void)_displayCameraWithView:(TGAttachmentCameraView *)cameraView menuController:(TGMenuSheetController *)menuController @@ -220,14 +222,16 @@ TGCameraController *controller = nil; CGSize screenSize = TGScreenSize(); + id windowManager = [_context makeOverlayWindowManager]; + if (cameraView.previewView != nil) - controller = [[TGCameraController alloc] initWithContext:_context saveEditedPhotos:_saveEditedPhotos saveCapturedMedia:_saveCapturedMedia camera:cameraView.previewView.camera previewView:cameraView.previewView intent:TGCameraControllerAvatarIntent]; + controller = [[TGCameraController alloc] initWithContext:[windowManager context] saveEditedPhotos:_saveEditedPhotos saveCapturedMedia:_saveCapturedMedia camera:cameraView.previewView.camera previewView:cameraView.previewView intent:TGCameraControllerAvatarIntent]; else - controller = [[TGCameraController alloc] initWithContext:_context saveEditedPhotos:_saveEditedPhotos saveCapturedMedia:_saveCapturedMedia intent:TGCameraControllerAvatarIntent]; + controller = [[TGCameraController alloc] initWithContext:[windowManager context] saveEditedPhotos:_saveEditedPhotos saveCapturedMedia:_saveCapturedMedia intent:TGCameraControllerAvatarIntent]; controller.shouldStoreCapturedAssets = true; - TGCameraControllerWindow *controllerWindow = [[TGCameraControllerWindow alloc] initWithParentController:_parentController contentController:controller]; + TGCameraControllerWindow *controllerWindow = [[TGCameraControllerWindow alloc] initWithManager:windowManager parentController:_parentController contentController:controller]; controllerWindow.hidden = false; controllerWindow.clipsToBounds = true; diff --git a/LegacyComponents/TGMediaEditingContext.m b/LegacyComponents/TGMediaEditingContext.m index 18e84b5a15..fadd700037 100644 --- a/LegacyComponents/TGMediaEditingContext.m +++ b/LegacyComponents/TGMediaEditingContext.m @@ -358,9 +358,10 @@ - (SSignal *)captionSignalForItem:(NSObject *)item { + NSString *uniqueIdentifier = item.uniqueIdentifier; SSignal *updateSignal = [[_captionPipe.signalProducer() filter:^bool(TGMediaCaptionUpdate *update) { - return [update.item.uniqueIdentifier isEqualToString:item.uniqueIdentifier]; + return [update.item.uniqueIdentifier isEqualToString:uniqueIdentifier]; }] map:^NSString *(TGMediaCaptionUpdate *update) { return update.caption; diff --git a/LegacyComponents/TGMediaGroupCell.m b/LegacyComponents/TGMediaGroupCell.m index 31590363d2..0937b70fd2 100644 --- a/LegacyComponents/TGMediaGroupCell.m +++ b/LegacyComponents/TGMediaGroupCell.m @@ -147,7 +147,7 @@ const CGFloat TGMediaGroupCellHeight = 86.0f; _countLabel.textColor = [UIColor blackColor]; [self.contentView addSubview:_countLabel]; - UIImageView *disclosureIndicator = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"ModernListsDisclosureIndicator"]]; + UIImageView *disclosureIndicator = [[UIImageView alloc] initWithImage:TGComponentsImageNamed(@"ModernListsDisclosureIndicator")]; disclosureIndicator.autoresizingMask = UIViewAutoresizingFlexibleLeftMargin; disclosureIndicator.frame = CGRectOffset(disclosureIndicator.frame, self.contentView.frame.size.width - disclosureIndicator.frame.size.width - 15, 37); [self addSubview:disclosureIndicator]; @@ -228,7 +228,7 @@ const CGFloat TGMediaGroupCellHeight = 86.0f; [imageView reset]; } - [(TGImageView *)_imageViews.firstObject setImage:[UIImage imageNamed:@"ModernMediaEmptyAlbumIcon"]]; + [(TGImageView *)_imageViews.firstObject setImage:TGComponentsImageNamed(@"ModernMediaEmptyAlbumIcon")]; } } @@ -249,35 +249,35 @@ const CGFloat TGMediaGroupCellHeight = 86.0f; switch (assetGroup.subtype) { case TGMediaAssetGroupSubtypeFavorites: - iconImage = [UIImage imageNamed:@"MediaGroupFavorites"]; + iconImage = TGComponentsImageNamed(@"MediaGroupFavorites"); break; case TGMediaAssetGroupSubtypePanoramas: - iconImage = [UIImage imageNamed:@"MediaGroupPanoramas"]; + iconImage = TGComponentsImageNamed(@"MediaGroupPanoramas"); break; case TGMediaAssetGroupSubtypeVideos: - iconImage = [UIImage imageNamed:@"MediaGroupVideo"]; + iconImage = TGComponentsImageNamed(@"MediaGroupVideo"); break; case TGMediaAssetGroupSubtypeBursts: - iconImage = [UIImage imageNamed:@"MediaGroupBurst"]; + iconImage = TGComponentsImageNamed(@"MediaGroupBurst"); break; case TGMediaAssetGroupSubtypeSlomo: - iconImage = [UIImage imageNamed:@"MediaGroupSlomo"]; + iconImage = TGComponentsImageNamed(@"MediaGroupSlomo"); break; case TGMediaAssetGroupSubtypeTimelapses: - iconImage = [UIImage imageNamed:@"MediaGroupTimelapse"]; + iconImage = TGComponentsImageNamed(@"MediaGroupTimelapse"); break; case TGMediaAssetGroupSubtypeScreenshots: - iconImage = [UIImage imageNamed:@"MediaGroupScreenshots"]; + iconImage = TGComponentsImageNamed(@"MediaGroupScreenshots"); break; case TGMediaAssetGroupSubtypeSelfPortraits: - iconImage = [UIImage imageNamed:@"MediaGroupSelfPortraits"]; + iconImage = TGComponentsImageNamed(@"MediaGroupSelfPortraits"); break; default: diff --git a/LegacyComponents/TGMediaGroupsController.h b/LegacyComponents/TGMediaGroupsController.h index f8f8b9023a..6d90a2cd6b 100644 --- a/LegacyComponents/TGMediaGroupsController.h +++ b/LegacyComponents/TGMediaGroupsController.h @@ -1,4 +1,4 @@ -#import +#import #import @@ -11,6 +11,6 @@ @property (nonatomic, copy) void (^openAssetGroup)(TGMediaAssetGroup *); -- (instancetype)initWithAssetsLibrary:(TGMediaAssetsLibrary *)assetsLibrary intent:(TGMediaAssetsControllerIntent)intent; +- (instancetype)initWithContext:(id)context assetsLibrary:(TGMediaAssetsLibrary *)assetsLibrary intent:(TGMediaAssetsControllerIntent)intent; @end diff --git a/LegacyComponents/TGMediaGroupsController.m b/LegacyComponents/TGMediaGroupsController.m index 7c9d22b31b..ecb4b3dbc2 100644 --- a/LegacyComponents/TGMediaGroupsController.m +++ b/LegacyComponents/TGMediaGroupsController.m @@ -24,9 +24,9 @@ @implementation TGMediaGroupsController -- (instancetype)initWithAssetsLibrary:(TGMediaAssetsLibrary *)assetsLibrary intent:(TGMediaAssetsControllerIntent)intent +- (instancetype)initWithContext:(id)context assetsLibrary:(TGMediaAssetsLibrary *)assetsLibrary intent:(TGMediaAssetsControllerIntent)intent { - self = [super init]; + self = [super initWithContext:context]; if (self != nil) { _assetsLibrary = assetsLibrary; diff --git a/LegacyComponents/TGMediaPickerController.h b/LegacyComponents/TGMediaPickerController.h index 880cded801..ea3cbccbd7 100644 --- a/LegacyComponents/TGMediaPickerController.h +++ b/LegacyComponents/TGMediaPickerController.h @@ -29,7 +29,7 @@ @property (nonatomic, copy) void (^catchToolbarView)(bool enabled); -- (instancetype)initWithSelectionContext:(TGMediaSelectionContext *)selectionContext editingContext:(TGMediaEditingContext *)editingContext; +- (instancetype)initWithContext:(id)context selectionContext:(TGMediaSelectionContext *)selectionContext editingContext:(TGMediaEditingContext *)editingContext; - (NSArray *)resultSignals:(id (^)(id, NSString *, NSString *))descriptionGenerator; - (NSUInteger)_numberOfItems; diff --git a/LegacyComponents/TGMediaPickerController.m b/LegacyComponents/TGMediaPickerController.m index 404647e03a..c6a11c7784 100644 --- a/LegacyComponents/TGMediaPickerController.m +++ b/LegacyComponents/TGMediaPickerController.m @@ -26,9 +26,9 @@ @implementation TGMediaPickerController -- (instancetype)initWithSelectionContext:(TGMediaSelectionContext *)selectionContext editingContext:(TGMediaEditingContext *)editingContext +- (instancetype)initWithContext:(id)context selectionContext:(TGMediaSelectionContext *)selectionContext editingContext:(TGMediaEditingContext *)editingContext { - self = [super init]; + self = [super initWithContext:context]; if (self != nil) { _selectionContext = selectionContext; diff --git a/LegacyComponents/TGMediaPickerGalleryInterfaceView.m b/LegacyComponents/TGMediaPickerGalleryInterfaceView.m index 18f470959d..65c5056c3e 100644 --- a/LegacyComponents/TGMediaPickerGalleryInterfaceView.m +++ b/LegacyComponents/TGMediaPickerGalleryInterfaceView.m @@ -142,7 +142,7 @@ if (recipientName.length > 0) { - _arrowView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"PhotoPickerArrow"]]; + _arrowView = [[UIImageView alloc] initWithImage:TGComponentsImageNamed(@"PhotoPickerArrow")]; _arrowView.alpha = 0.45f; [_wrapperView addSubview:_arrowView]; @@ -504,15 +504,21 @@ id editableMediaItem = [galleryEditableItem editableMediaItem]; __weak TGMediaPickerGalleryInterfaceView *weakSelf = self; + __weak id weakGalleryEditableItem = galleryEditableItem; [_adjustmentsDisposable setDisposable:[[[[galleryEditableItem.editingContext adjustmentsSignalForItem:editableMediaItem] mapToSignal:^SSignal *(id adjustments) { - return [[galleryEditableItem.editingContext timerSignalForItem:editableMediaItem] map:^id(id timer) { - NSMutableDictionary *dict = [[NSMutableDictionary alloc] init]; - if (adjustments != nil) - dict[@"adjustments"] = adjustments; - if (timer != nil) - dict[@"timer"] = timer; - return dict; - }]; + __strong id strongGalleryEditableItem = weakGalleryEditableItem; + if (strongGalleryEditableItem != nil) { + return [[strongGalleryEditableItem.editingContext timerSignalForItem:editableMediaItem] map:^id(id timer) { + NSMutableDictionary *dict = [[NSMutableDictionary alloc] init]; + if (adjustments != nil) + dict[@"adjustments"] = adjustments; + if (timer != nil) + dict[@"timer"] = timer; + return dict; + }]; + } else { + return [SSignal never]; + } }] deliverOn:[SQueue mainQueue]] startWithNext:^(NSDictionary *dict) { __strong TGMediaPickerGalleryInterfaceView *strongSelf = weakSelf; diff --git a/LegacyComponents/TGMediaPickerGalleryVideoScrubber.m b/LegacyComponents/TGMediaPickerGalleryVideoScrubber.m index 2a251f8f66..7c9ab9be07 100644 --- a/LegacyComponents/TGMediaPickerGalleryVideoScrubber.m +++ b/LegacyComponents/TGMediaPickerGalleryVideoScrubber.m @@ -368,7 +368,7 @@ typedef enum _panGestureRecognizer.delegate = self; [_scrubberHandle addGestureRecognizer:_panGestureRecognizer]; - _arrowView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"PhotoPickerArrow"]]; + _arrowView = [[UIImageView alloc] initWithImage:TGComponentsImageNamed(@"PhotoPickerArrow")]; _arrowView.alpha = 0.45f; _arrowView.hidden = true; [self addSubview:_arrowView]; diff --git a/LegacyComponents/TGMediaPickerGalleryVideoTrimView.m b/LegacyComponents/TGMediaPickerGalleryVideoTrimView.m index 07263b708e..3b62754051 100644 --- a/LegacyComponents/TGMediaPickerGalleryVideoTrimView.m +++ b/LegacyComponents/TGMediaPickerGalleryVideoTrimView.m @@ -64,12 +64,12 @@ _leftHandleView = [[UIImageView alloc] initWithFrame:_leftSegmentView.bounds]; _leftHandleView.contentMode = UIViewContentModeCenter; - _leftHandleView.image = [UIImage imageNamed:@"VideoScrubberLeftArrow"]; + _leftHandleView.image = TGComponentsImageNamed(@"VideoScrubberLeftArrow"); [_leftSegmentView addSubview:_leftHandleView]; _rightHandleView = [[UIImageView alloc] initWithFrame:_rightSegmentView.bounds]; _rightHandleView.contentMode = UIViewContentModeCenter; - _rightHandleView.image = [UIImage imageNamed:@"VideoScrubberRightArrow"]; + _rightHandleView.image = TGComponentsImageNamed(@"VideoScrubberRightArrow"); [_rightSegmentView addSubview:_rightHandleView]; _startHandlePressGestureRecognizer = [[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(handleHandlePress:)]; diff --git a/LegacyComponents/TGMediaPickerModernGalleryMixin.m b/LegacyComponents/TGMediaPickerModernGalleryMixin.m index 4b03b1158a..6e10edc6fc 100644 --- a/LegacyComponents/TGMediaPickerModernGalleryMixin.m +++ b/LegacyComponents/TGMediaPickerModernGalleryMixin.m @@ -30,6 +30,8 @@ NSUInteger _itemsLimit; id _context; + + id _windowManager; } @end @@ -58,7 +60,9 @@ __weak TGMediaPickerModernGalleryMixin *weakSelf = self; - TGModernGalleryController *modernGallery = [[TGModernGalleryController alloc] initWithContext:_context]; + _windowManager = [_context makeOverlayWindowManager]; + + TGModernGalleryController *modernGallery = [[TGModernGalleryController alloc] initWithContext:[_windowManager context]]; _galleryController = modernGallery; _strongGalleryController = modernGallery; modernGallery.isImportant = true; @@ -75,7 +79,7 @@ NSArray *galleryItems = fetchResult != nil ? [self prepareGalleryItemsForFetchResult:fetchResult selectionContext:selectionContext editingContext:editingContext asFile:asFile enumerationBlock:enumerationBlock] : [self prepareGalleryItemsForMomentList:momentList selectionContext:selectionContext editingContext:editingContext asFile:asFile enumerationBlock:enumerationBlock]; - TGMediaPickerGalleryModel *model = [[TGMediaPickerGalleryModel alloc] initWithContext:_context items:galleryItems focusItem:focusItem selectionContext:selectionContext editingContext:editingContext hasCaptions:hasCaptions hasTimer:hasTimer inhibitDocumentCaptions:inhibitDocumentCaptions hasSelectionPanel:true recipientName:recipientName]; + TGMediaPickerGalleryModel *model = [[TGMediaPickerGalleryModel alloc] initWithContext:[_windowManager context] items:galleryItems focusItem:focusItem selectionContext:selectionContext editingContext:editingContext hasCaptions:hasCaptions hasTimer:hasTimer inhibitDocumentCaptions:inhibitDocumentCaptions hasSelectionPanel:true recipientName:recipientName]; _galleryModel = model; model.controller = modernGallery; model.suggestionContext = suggestionContext; @@ -207,7 +211,7 @@ [_galleryController setPreviewMode:false]; - TGOverlayControllerWindow *controllerWindow = [[TGOverlayControllerWindow alloc] initWithParentController:_parentController contentController:_galleryController]; + TGOverlayControllerWindow *controllerWindow = [[TGOverlayControllerWindow alloc] initWithManager:_windowManager parentController:_parentController contentController:_galleryController]; controllerWindow.hidden = false; _galleryController.view.clipsToBounds = true; diff --git a/LegacyComponents/TGMediaPickerPhotoCounterButton.m b/LegacyComponents/TGMediaPickerPhotoCounterButton.m index f24304f22c..a62c6d6a3f 100644 --- a/LegacyComponents/TGMediaPickerPhotoCounterButton.m +++ b/LegacyComponents/TGMediaPickerPhotoCounterButton.m @@ -76,7 +76,7 @@ const CGFloat TGPhotoCounterButtonMaskFade = 18; _crossIconView.alpha = 0.0f; _crossIconView.contentMode = UIViewContentModeCenter; _crossIconView.hidden = true; - _crossIconView.image = [UIImage imageNamed:@"ImagePickerPhotoCounter_Close"]; + _crossIconView.image = TGComponentsImageNamed(@"ImagePickerPhotoCounter_Close"); [_wrapperView addSubview:_crossIconView]; CGFloat maskWidth = 50.0f; diff --git a/LegacyComponents/TGMediaPickerPhotoStripCell.m b/LegacyComponents/TGMediaPickerPhotoStripCell.m index b7eb385f29..28f0517637 100644 --- a/LegacyComponents/TGMediaPickerPhotoStripCell.m +++ b/LegacyComponents/TGMediaPickerPhotoStripCell.m @@ -162,11 +162,11 @@ NSString *const TGMediaPickerPhotoStripCellKind = @"PhotoStripCell"; _label.text = [NSString stringWithFormat:@"%d:%02d", (int)ceil(asset.videoDuration) / 60, (int)ceil(asset.videoDuration) % 60]; if (asset.subtypes & TGMediaAssetSubtypeVideoTimelapse) - _iconView.image = [UIImage imageNamed:@"ModernMediaItemTimelapseIcon"]; + _iconView.image = TGComponentsImageNamed(@"ModernMediaItemTimelapseIcon"); else if (asset.subtypes & TGMediaAssetSubtypeVideoHighFrameRate) - _iconView.image = [UIImage imageNamed:@"ModernMediaItemSloMoIcon"]; + _iconView.image = TGComponentsImageNamed(@"ModernMediaItemSloMoIcon"); else - _iconView.image = [UIImage imageNamed:@"ModernMediaItemVideoIcon"]; + _iconView.image = TGComponentsImageNamed(@"ModernMediaItemVideoIcon"); if (self.editingContext != nil) { diff --git a/LegacyComponents/TGMenuSheetController.h b/LegacyComponents/TGMenuSheetController.h index 26683d4055..ecd8229a47 100644 --- a/LegacyComponents/TGMenuSheetController.h +++ b/LegacyComponents/TGMenuSheetController.h @@ -23,6 +23,7 @@ @property (nonatomic, copy) void (^willPresent)(CGFloat offset); @property (nonatomic, copy) void (^willDismiss)(bool manual); @property (nonatomic, copy) void (^didDismiss)(bool manual); +@property (nonatomic, copy) void (^customRemoveFromParentViewController)(); @property (nonatomic, assign) UIPopoverArrowDirection permittedArrowDirections; @property (nonatomic, copy) CGRect (^sourceRect)(void); diff --git a/LegacyComponents/TGMenuSheetController.m b/LegacyComponents/TGMenuSheetController.m index 068873b6b6..ec2a67b13c 100644 --- a/LegacyComponents/TGMenuSheetController.m +++ b/LegacyComponents/TGMenuSheetController.m @@ -170,7 +170,7 @@ typedef enum if (strongSelf == nil) return; - [strongSelf repositionMenuWithReferenceSize:[_context fullscreenBounds].size]; + [strongSelf repositionMenuWithReferenceSize:[strongSelf->_context fullscreenBounds].size]; }; if (animated && compact) @@ -939,6 +939,9 @@ typedef enum [window dismiss]; } } + if (_customRemoveFromParentViewController) { + _customRemoveFromParentViewController(); + } [super removeFromParentViewController]; } diff --git a/LegacyComponents/TGMenuView.m b/LegacyComponents/TGMenuView.m index 73b8ed0f14..5e22e2dde8 100644 --- a/LegacyComponents/TGMenuView.m +++ b/LegacyComponents/TGMenuView.m @@ -226,12 +226,10 @@ static UIImage *pagerLeftButtonHighlightedImage() { _maxWidth = 310.0f; - //_arrowTopView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"MenuArrowTop.png"] highlightedImage:[UIImage imageNamed:@"MenuArrowTop_Highlighted.png"]]; _arrowTopView = [[UIImageView alloc] init]; _arrowTopView.frame = CGRectMake(0.0f, 0.0f, 20.0f, 12.0f); [self addSubview:_arrowTopView]; - //_arrowBottomView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"MenuArrowBottom.png"] highlightedImage:[UIImage imageNamed:@"MenuArrowBottom_Highlighted.png"]]; _arrowBottomView = [[UIImageView alloc] init]; _arrowBottomView.frame = CGRectMake(0.0f, 0.0f, 20.0f, 14.5f); [self addSubview:_arrowBottomView]; diff --git a/LegacyComponents/TGModernGalleryController.m b/LegacyComponents/TGModernGalleryController.m index 762f510ef4..ab98edfeab 100644 --- a/LegacyComponents/TGModernGalleryController.m +++ b/LegacyComponents/TGModernGalleryController.m @@ -55,7 +55,7 @@ - (instancetype)initWithContext:(id)context { - self = [super init]; + self = [super initWithContext:context]; if (self != nil) { _context = context; @@ -244,7 +244,7 @@ { [UIView animateWithDuration:0.2 animations:^ { - [TGHacks setApplicationStatusBarAlpha:1.0f]; + [strongSelf->_context setApplicationStatusBarAlpha:1.0f]; }]; } @@ -421,7 +421,7 @@ previewSize = self.preferredContentSize; __weak TGModernGalleryController *weakSelf = self; - _view = [[TGModernGalleryView alloc] initWithFrame:self.view.bounds itemPadding:TGModernGalleryItemPadding interfaceView:interfaceView previewMode:_previewMode previewSize:previewSize]; + _view = [[TGModernGalleryView alloc] initWithFrame:self.view.bounds context:_context itemPadding:TGModernGalleryItemPadding interfaceView:interfaceView previewMode:_previewMode previewSize:previewSize]; _view.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight; [self.view addSubview:_view]; @@ -502,7 +502,7 @@ { [UIView animateWithDuration:0.2 animations:^ { - [TGHacks setApplicationStatusBarAlpha:1.0f]; + [strongSelf->_context setApplicationStatusBarAlpha:1.0f]; }]; } @@ -944,23 +944,15 @@ static CGFloat transformRotation(CGAffineTransform transform) - (void)animateTransitionOutFromView:(UIView *)fromView fromViewContentRect:(CGRect)fromViewContentRect toView:(UIView *)toView velocity:(CGPoint)velocity { - TGLog(@"begin calc"); - - TG_TIMESTAMP_DEFINE(out) - UIView *toScrollView = [self findScrollView:toView]; UIView *toContainerView = toScrollView.superview; - TG_TIMESTAMP_MEASURE(out) - CGRect toContainerFrame = [toContainerView convertRect:toView.bounds fromView:toView]; CGRect toContainerFromFrame = [toContainerView convertRect:[fromView convertRect:fromViewContentRect toView:nil] fromView:nil]; UIView *toViewCopy = nil; TGModernGalleryComplexTransitionDescription *transitionDesc = nil; - TG_TIMESTAMP_MEASURE(out) - if ([toView conformsToProtocol:@protocol(TGModernGalleryTransitionView)]) { if ([toView respondsToSelector:@selector(hasComplexTransition)]) @@ -1024,8 +1016,6 @@ static CGFloat transformRotation(CGAffineTransform transform) CGRect toFrame = [fromView.superview convertRect:[toView convertRect:CGRectInset(toView.bounds, toFrameInsets.left, toFrameInsets.top) toView:nil] fromView:nil]; toFrame = adjustFrameForOriginalSubframe(fromView.frame, fromViewContentRect, toFrame); - TG_TIMESTAMP_MEASURE(out) - if (transitionDesc == nil && toViewCopy == nil) { CGFloat toViewAlpha = toView.alpha; @@ -1044,8 +1034,6 @@ static CGFloat transformRotation(CGAffineTransform transform) if (toViewCopy != nil) [toContainerView insertSubview:toViewCopy aboveSubview:toScrollView]; - TG_TIMESTAMP_MEASURE(out) - __weak TGModernGalleryController *weakSelf = self; self.view.userInteractionEnabled = false; [self animateView:fromView frameFrom:fromView.frame to:toFrame velocity:velocity rotationFrom:0.0f to:0.0f animatingIn:false completion:^(__unused bool finished) @@ -1060,8 +1048,6 @@ static CGFloat transformRotation(CGAffineTransform transform) } }]; - TG_TIMESTAMP_MEASURE(out) - if (toViewCopy != nil) { __weak UIView *weakToViewCopy = toViewCopy; @@ -1072,8 +1058,6 @@ static CGFloat transformRotation(CGAffineTransform transform) }]; } - TG_TIMESTAMP_MEASURE(out) - if (iosMajorVersion() >= 7 && self.shouldAnimateStatusBarStyleTransition) { [self animateStatusBarTransition:0.2]; @@ -1081,17 +1065,13 @@ static CGFloat transformRotation(CGAffineTransform transform) [self setNeedsStatusBarAppearanceUpdate]; } - TG_TIMESTAMP_MEASURE(out) - if (self.adjustsStatusBarVisibility) { [UIView animateWithDuration:0.2 animations:^ { - [TGHacks setApplicationStatusBarAlpha:1.0f]; + [_context setApplicationStatusBarAlpha:1.0f]; }]; } - - TGLog(@"started animation"); } - (void)viewDidAppear:(BOOL)animated @@ -1137,12 +1117,12 @@ static CGFloat transformRotation(CGAffineTransform transform) _view.interfaceView.alpha = 0.0f; if (self.adjustsStatusBarVisibility) - [TGHacks setApplicationStatusBarAlpha:0.0f]; + [_context setApplicationStatusBarAlpha:0.0f]; } else if ([_view.interfaceView prefersStatusBarHidden]) { if (self.adjustsStatusBarVisibility) - [TGHacks setApplicationStatusBarAlpha:0.0f]; + [_context setApplicationStatusBarAlpha:0.0f]; } } @@ -1162,12 +1142,7 @@ static CGFloat transformRotation(CGAffineTransform transform) if (self.adjustsStatusBarVisibility) { - [TGHacks setApplicationStatusBarAlpha:1.0f]; - -// dispatch_async(dispatch_get_main_queue(), ^ -// { -// [TGHacks setApplicationStatusBarAlpha:1.0f]; -// }); + [_context setApplicationStatusBarAlpha:1.0f]; } } @@ -1631,7 +1606,7 @@ static CGFloat transformRotation(CGAffineTransform transform) { if (iosMajorVersion() >= 7 && self.shouldAnimateStatusBarStyleTransition) { - [TGHacks animateApplicationStatusBarStyleTransitionWithDuration:duration]; + [_context animateApplicationStatusBarStyleTransitionWithDuration:duration]; } } diff --git a/LegacyComponents/TGModernGalleryView.h b/LegacyComponents/TGModernGalleryView.h index ec5c1011f1..d810fa0f5c 100644 --- a/LegacyComponents/TGModernGalleryView.h +++ b/LegacyComponents/TGModernGalleryView.h @@ -1,5 +1,6 @@ #import +#import #import @class TGModernGalleryScrollView; @@ -14,7 +15,7 @@ @property (nonatomic, strong, readonly) UIView *interfaceView; @property (nonatomic, strong, readonly) TGModernGalleryScrollView *scrollView; -- (instancetype)initWithFrame:(CGRect)frame itemPadding:(CGFloat)itemPadding interfaceView:(UIView *)interfaceView previewMode:(bool)previewMode previewSize:(CGSize)previewSize; +- (instancetype)initWithFrame:(CGRect)frame context:(id)context itemPadding:(CGFloat)itemPadding interfaceView:(UIView *)interfaceView previewMode:(bool)previewMode previewSize:(CGSize)previewSize; - (bool)shouldAutorotate; diff --git a/LegacyComponents/TGModernGalleryView.m b/LegacyComponents/TGModernGalleryView.m index 5d4f147369..165066157c 100644 --- a/LegacyComponents/TGModernGalleryView.m +++ b/LegacyComponents/TGModernGalleryView.m @@ -27,6 +27,7 @@ static const CGFloat swipeDistanceThreshold = 128.0f; CGFloat _scrollViewVerticalOffset; UIView *_instantDismissView; + id _context; } @end @@ -38,7 +39,7 @@ static const CGFloat swipeDistanceThreshold = 128.0f; return nil; } -- (instancetype)initWithFrame:(CGRect)frame itemPadding:(CGFloat)itemPadding interfaceView:(UIView *)interfaceView previewMode:(bool)previewMode previewSize:(CGSize)previewSize +- (instancetype)initWithFrame:(CGRect)frame context:(id)context itemPadding:(CGFloat)itemPadding interfaceView:(UIView *)interfaceView previewMode:(bool)previewMode previewSize:(CGSize)previewSize { _previewMode = previewMode; _previewSize = previewSize; @@ -46,6 +47,7 @@ static const CGFloat swipeDistanceThreshold = 128.0f; self = [super initWithFrame:frame]; if (self != nil) { + _context = context; _itemPadding = itemPadding; self.opaque = false; @@ -149,7 +151,7 @@ static const CGFloat swipeDistanceThreshold = 128.0f; [UIView animateWithDuration:0.2 delay:0 options:UIViewAnimationOptionBeginFromCurrentState animations:^ { _interfaceView.alpha = 0.0f; - [TGHacks setApplicationStatusBarAlpha:0.0f]; + [_context setApplicationStatusBarAlpha:0.0f]; } completion:nil]; } else @@ -158,7 +160,7 @@ static const CGFloat swipeDistanceThreshold = 128.0f; { _interfaceView.alpha = 1.0f; if (![_interfaceView prefersStatusBarHidden]) - [TGHacks setApplicationStatusBarAlpha:1.0f]; + [_context setApplicationStatusBarAlpha:1.0f]; } completion:nil]; } } @@ -172,7 +174,7 @@ static const CGFloat swipeDistanceThreshold = 128.0f; { _interfaceView.alpha = 1.0f; if (![_interfaceView prefersStatusBarHidden]) - [TGHacks setApplicationStatusBarAlpha:1.0f]; + [_context setApplicationStatusBarAlpha:1.0f]; } completion:nil]; } } @@ -186,7 +188,7 @@ static const CGFloat swipeDistanceThreshold = 128.0f; [UIView animateWithDuration:0.2 delay:0.0 options:UIViewAnimationOptionBeginFromCurrentState animations:^ { _interfaceView.alpha = 0.0f; - [TGHacks setApplicationStatusBarAlpha:0.0f]; + [_context setApplicationStatusBarAlpha:0.0f]; } completion:nil]; } } diff --git a/LegacyComponents/TGOverlayController.h b/LegacyComponents/TGOverlayController.h index 24b14265fe..32dbc5df1b 100644 --- a/LegacyComponents/TGOverlayController.h +++ b/LegacyComponents/TGOverlayController.h @@ -6,6 +6,7 @@ @property (nonatomic, weak) TGOverlayControllerWindow *overlayWindow; @property (nonatomic, assign) bool isImportant; +@property (nonatomic, copy) void (^customDismissBlock)(); - (void)dismiss; diff --git a/LegacyComponents/TGOverlayController.m b/LegacyComponents/TGOverlayController.m index 61e84914d5..fc7cdfb7ab 100644 --- a/LegacyComponents/TGOverlayController.m +++ b/LegacyComponents/TGOverlayController.m @@ -21,6 +21,10 @@ { TGOverlayControllerWindow *overlayWindow = _overlayWindow; [overlayWindow dismiss]; + + if (_customDismissBlock) { + _customDismissBlock(); + } } @end diff --git a/LegacyComponents/TGOverlayControllerWindow.h b/LegacyComponents/TGOverlayControllerWindow.h index fb61330339..7627217653 100644 --- a/LegacyComponents/TGOverlayControllerWindow.h +++ b/LegacyComponents/TGOverlayControllerWindow.h @@ -1,4 +1,5 @@ #import +#import @class TGViewController; @class TGOverlayController; @@ -16,8 +17,8 @@ @property (nonatomic) bool dismissByMenuSheet; -- (instancetype)initWithParentController:(TGViewController *)parentController contentController:(TGOverlayController *)contentController; -- (instancetype)initWithParentController:(TGViewController *)parentController contentController:(TGOverlayController *)contentController keepKeyboard:(bool)keepKeyboard; +- (instancetype)initWithManager:(id)manager parentController:(TGViewController *)parentController contentController:(TGOverlayController *)contentController; +- (instancetype)initWithManager:(id)manager parentController:(TGViewController *)parentController contentController:(TGOverlayController *)contentController keepKeyboard:(bool)keepKeyboard; - (void)dismiss; diff --git a/LegacyComponents/TGOverlayControllerWindow.m b/LegacyComponents/TGOverlayControllerWindow.m index a254369ccf..6605d2381b 100644 --- a/LegacyComponents/TGOverlayControllerWindow.m +++ b/LegacyComponents/TGOverlayControllerWindow.m @@ -10,7 +10,7 @@ - (UIViewController *)statusBarAppearanceSourceController { - UIViewController *rootController = [[LegacyComponentsGlobals provider] rootController]; + UIViewController *rootController = [[LegacyComponentsGlobals provider] applicationWindows].firstObject.rootViewController; UIViewController *topViewController = nil; if ([rootController respondsToSelector:@selector(viewControllers)]) { topViewController = [(UINavigationController *)rootController viewControllers].lastObject; @@ -43,7 +43,7 @@ - (UIViewController *)autorotationSourceController { - UIViewController *rootController = [[LegacyComponentsGlobals provider] rootController]; + UIViewController *rootController = [[LegacyComponentsGlobals provider] applicationWindows].firstObject.rootViewController; UIViewController *topViewController = nil; if ([rootController respondsToSelector:@selector(viewControllers)]) { topViewController = [(UINavigationController *)rootController viewControllers].lastObject; @@ -90,7 +90,7 @@ } } - UIViewController *rootController = [[LegacyComponentsGlobals provider] rootController]; + UIViewController *rootController = [[LegacyComponentsGlobals provider] applicationWindows].firstObject.rootViewController; if (rootController.presentedViewController != nil) return [rootController.presentedViewController shouldAutorotate]; @@ -136,23 +136,30 @@ @interface TGOverlayControllerWindow () { __weak TGViewController *_parentController; + id _manager; + bool _managedIsHidden; + TGOverlayController *_contentController; } @end @implementation TGOverlayControllerWindow -- (instancetype)initWithParentController:(TGViewController *)parentController contentController:(TGOverlayController *)contentController +- (instancetype)initWithManager:(id)manager parentController:(TGViewController *)parentController contentController:(TGOverlayController *)contentController { - return [self initWithParentController:parentController contentController:contentController keepKeyboard:false]; + return [self initWithManager:manager parentController:parentController contentController:contentController keepKeyboard:false]; } -- (instancetype)initWithParentController:(TGViewController *)parentController contentController:(TGOverlayController *)contentController keepKeyboard:(bool)keepKeyboard +- (instancetype)initWithManager:(id)manager parentController:(TGViewController *)parentController contentController:(TGOverlayController *)contentController keepKeyboard:(bool)keepKeyboard { - _keepKeyboard = keepKeyboard; + assert(manager != nil); - UIViewController *rootController = [[LegacyComponentsGlobals provider] rootController]; - self = [super initWithFrame:[rootController applicationBounds]]; + if (self != nil) { + _keepKeyboard = keepKeyboard; + _manager = manager; + } + + self = [super initWithFrame:[[_manager context] fullscreenBounds]]; if (self != nil) { self.windowLevel = UIWindowLevelStatusBar - 0.001f; @@ -160,8 +167,18 @@ _parentController = parentController; [parentController.associatedWindowStack addObject:self]; - contentController.overlayWindow = self; - self.rootViewController = contentController; + if ([_manager managesWindow]) { + _contentController = contentController; + __weak TGOverlayControllerWindow *weakSelf = self; + contentController.customDismissBlock = ^{ + __strong TGOverlayControllerWindow *strongSelf = weakSelf; + [manager setHidden:true window:strongSelf]; + }; + [_manager bindController:contentController]; + } else { + contentController.overlayWindow = self; + self.rootViewController = contentController; + } } return self; } @@ -194,12 +211,28 @@ self.rootViewController = nil; } +- (BOOL)isHidden { + if ([_manager managesWindow]) { + return _managedIsHidden; + } else { + return [super isHidden]; + } +} + - (void)setHidden:(BOOL)hidden { - [super setHidden:hidden]; - - if (!hidden && !_keepKeyboard) { - UIViewController *rootController = [[LegacyComponentsGlobals provider] rootController]; - [rootController.view.window endEditing:true]; + if ([_manager managesWindow]) { + if (![super isHidden]) { + [super setHidden:true]; + } + + _managedIsHidden = hidden; + [_manager setHidden:hidden window:self]; + } else { + [super setHidden:hidden]; + + if (!hidden && !_keepKeyboard) { + [[[LegacyComponentsGlobals provider] applicationWindows].firstObject endEditing:true]; + } } } diff --git a/LegacyComponents/TGPaintShader.m b/LegacyComponents/TGPaintShader.m index 259c322371..cff09ecf54 100644 --- a/LegacyComponents/TGPaintShader.m +++ b/LegacyComponents/TGPaintShader.m @@ -18,14 +18,14 @@ _program = glCreateProgram(); - NSString *vShaderFilename = [[NSBundle mainBundle] pathForResource:vertexShader ofType:@"vsh"]; + NSString *vShaderFilename = TGComponentsPathForResource(vertexShader, @"vsh"); if (![self _compileShader:&vShader type:GL_VERTEX_SHADER fileName:vShaderFilename]) { [self _destroyVertexShader:vShader fragmentShader:fShader program:_program]; return nil; } - NSString *fShaderFilename = [[NSBundle mainBundle] pathForResource:fragmentShader ofType:@"fsh"]; + NSString *fShaderFilename = TGComponentsPathForResource(fragmentShader, @"fsh"); if (![self _compileShader:&fShader type:GL_FRAGMENT_SHADER fileName:fShaderFilename]) { [self _destroyVertexShader:vShader fragmentShader:fShader program:_program]; diff --git a/LegacyComponents/TGPasscodeEntryController.h b/LegacyComponents/TGPasscodeEntryController.h index 3362ef884f..2a5da3c1a5 100644 --- a/LegacyComponents/TGPasscodeEntryController.h +++ b/LegacyComponents/TGPasscodeEntryController.h @@ -33,7 +33,7 @@ typedef enum { @property (nonatomic, copy) void (^updateAttemptData)(TGPasscodeEntryAttemptData *); @property (nonatomic) bool allowTouchId; -- (instancetype)initWithStyle:(TGPasscodeEntryControllerStyle)style mode:(TGPasscodeEntryControllerMode)mode cancelEnabled:(bool)cancelEnabled allowTouchId:(bool)allowTouchId attemptData:(TGPasscodeEntryAttemptData *)attemptData completion:(void (^)(NSString *))completion; +- (instancetype)initWithContext:(id)context style:(TGPasscodeEntryControllerStyle)style mode:(TGPasscodeEntryControllerMode)mode cancelEnabled:(bool)cancelEnabled allowTouchId:(bool)allowTouchId attemptData:(TGPasscodeEntryAttemptData *)attemptData completion:(void (^)(NSString *))completion; - (void)resetMode:(TGPasscodeEntryControllerMode)mode; - (void)refreshTouchId; diff --git a/LegacyComponents/TGPasscodeEntryController.m b/LegacyComponents/TGPasscodeEntryController.m index e7ea4d2e57..93e88e0198 100644 --- a/LegacyComponents/TGPasscodeEntryController.m +++ b/LegacyComponents/TGPasscodeEntryController.m @@ -55,9 +55,9 @@ typedef enum { @implementation TGPasscodeEntryController -- (instancetype)initWithStyle:(TGPasscodeEntryControllerStyle)style mode:(TGPasscodeEntryControllerMode)mode cancelEnabled:(bool)cancelEnabled allowTouchId:(bool)allowTouchId attemptData:(TGPasscodeEntryAttemptData *)attemptData completion:(void (^)(NSString *))completion +- (instancetype)initWithContext:(id)context style:(TGPasscodeEntryControllerStyle)style mode:(TGPasscodeEntryControllerMode)mode cancelEnabled:(bool)cancelEnabled allowTouchId:(bool)allowTouchId attemptData:(TGPasscodeEntryAttemptData *)attemptData completion:(void (^)(NSString *))completion { - self = [super init]; + self = [super initWithContext:context]; if (self != nil) { _style = style; diff --git a/LegacyComponents/TGPhotoAvatarCropController.h b/LegacyComponents/TGPhotoAvatarCropController.h index 26a78b9271..0078bbbce7 100644 --- a/LegacyComponents/TGPhotoAvatarCropController.h +++ b/LegacyComponents/TGPhotoAvatarCropController.h @@ -13,7 +13,7 @@ @property (nonatomic, copy) void (^finishedPhotoProcessing)(void); -- (instancetype)initWithPhotoEditor:(PGPhotoEditor *)photoEditor previewView:(TGPhotoEditorPreviewView *)previewView; +- (instancetype)initWithContext:(id)context photoEditor:(PGPhotoEditor *)photoEditor previewView:(TGPhotoEditorPreviewView *)previewView; - (void)setImage:(UIImage *)image; - (void)setSnapshotImage:(UIImage *)snapshotImage; diff --git a/LegacyComponents/TGPhotoAvatarCropController.m b/LegacyComponents/TGPhotoAvatarCropController.m index 55fb33abca..5880e68cdb 100644 --- a/LegacyComponents/TGPhotoAvatarCropController.m +++ b/LegacyComponents/TGPhotoAvatarCropController.m @@ -44,9 +44,9 @@ const CGFloat TGPhotoAvatarCropButtonsWrapperSize = 61.0f; @implementation TGPhotoAvatarCropController -- (instancetype)initWithPhotoEditor:(PGPhotoEditor *)photoEditor previewView:(TGPhotoEditorPreviewView *)previewView +- (instancetype)initWithContext:(id)context photoEditor:(PGPhotoEditor *)photoEditor previewView:(TGPhotoEditorPreviewView *)previewView { - self = [super init]; + self = [super initWithContext:context]; if (self != nil) { self.photoEditor = photoEditor; @@ -112,7 +112,7 @@ const CGFloat TGPhotoAvatarCropButtonsWrapperSize = 61.0f; _rotateButton.exclusiveTouch = true; _rotateButton.hitTestEdgeInsets = UIEdgeInsetsMake(-10, -10, -10, -10); [_rotateButton addTarget:self action:@selector(rotate) forControlEvents:UIControlEventTouchUpInside]; - [_rotateButton setImage:[UIImage imageNamed:@"PhotoEditorRotateIcon"] forState:UIControlStateNormal]; + [_rotateButton setImage:TGComponentsImageNamed(@"PhotoEditorRotateIcon") forState:UIControlStateNormal]; [_buttonsWrapperView addSubview:_rotateButton]; _mirrorButton = [[TGModernButton alloc] initWithFrame:CGRectMake(0, 0, 36, 36)]; @@ -120,7 +120,7 @@ const CGFloat TGPhotoAvatarCropButtonsWrapperSize = 61.0f; _mirrorButton.imageEdgeInsets = UIEdgeInsetsMake(4.0f, 0.0f, 0.0f, 0.0f); _mirrorButton.hitTestEdgeInsets = UIEdgeInsetsMake(-10, -10, -10, -10); [_mirrorButton addTarget:self action:@selector(mirror) forControlEvents:UIControlEventTouchUpInside]; - [_mirrorButton setImage:[UIImage imageNamed:@"PhotoEditorMirrorIcon"] forState:UIControlStateNormal]; + [_mirrorButton setImage:TGComponentsImageNamed(@"PhotoEditorMirrorIcon") forState:UIControlStateNormal]; [_buttonsWrapperView addSubview:_mirrorButton]; _resetButton = [[TGModernButton alloc] init]; diff --git a/LegacyComponents/TGPhotoBrushSettingsView.m b/LegacyComponents/TGPhotoBrushSettingsView.m index 846003d68f..f97ca65ace 100644 --- a/LegacyComponents/TGPhotoBrushSettingsView.m +++ b/LegacyComponents/TGPhotoBrushSettingsView.m @@ -74,7 +74,7 @@ const CGFloat TGPhotoBrushSettingsItemHeight = 44.0f; _brushViews = brushViews; _brushSeparatorViews = separatorViews; - _selectedCheckView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"PaintCheck"]]; + _selectedCheckView = [[UIImageView alloc] initWithImage:TGComponentsImageNamed(@"PaintCheck")]; _selectedCheckView.frame = CGRectMake(15.0f, 16.0f, _selectedCheckView.frame.size.width, _selectedCheckView.frame.size.height); } return self; diff --git a/LegacyComponents/TGPhotoCropAreaView.m b/LegacyComponents/TGPhotoCropAreaView.m index 055ac4266c..b1203b43ea 100644 --- a/LegacyComponents/TGPhotoCropAreaView.m +++ b/LegacyComponents/TGPhotoCropAreaView.m @@ -1,5 +1,7 @@ #import "TGPhotoCropAreaView.h" +#import "LegacyComponentsInternal.h" + #import "TGPhotoCropGridView.h" #import @@ -126,7 +128,7 @@ const CGFloat TGPhotoCropEdgeControlSize = 44; _cornersView = [[UIImageView alloc] initWithFrame:CGRectInset(self.bounds, -2, -2)]; _cornersView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight; - _cornersView.image = [[UIImage imageNamed:@"PhotoEditorCropCorners"] resizableImageWithCapInsets:UIEdgeInsetsMake(20, 20, 20, 20)]; + _cornersView.image = [TGComponentsImageNamed(@"PhotoEditorCropCorners") resizableImageWithCapInsets:UIEdgeInsetsMake(20, 20, 20, 20)]; [self addSubview:_cornersView]; _topEdgeHighlight = [[UIView alloc] initWithFrame:CGRectMake(0, -1, frame.size.width, 2)]; diff --git a/LegacyComponents/TGPhotoCropController.m b/LegacyComponents/TGPhotoCropController.m index 4be204bfb0..9dbb9ff216 100644 --- a/LegacyComponents/TGPhotoCropController.m +++ b/LegacyComponents/TGPhotoCropController.m @@ -71,7 +71,7 @@ NSString * const TGPhotoCropOriginalAspectRatio = @"original"; - (instancetype)initWithContext:(id)context photoEditor:(PGPhotoEditor *)photoEditor previewView:(TGPhotoEditorPreviewView *)previewView metadata:(PGCameraShotMetadata *)metadata forVideo:(bool)forVideo { - self = [super init]; + self = [super initWithContext:context]; if (self != nil) { _context = context; @@ -157,7 +157,7 @@ NSString * const TGPhotoCropOriginalAspectRatio = @"original"; _rotateButton.exclusiveTouch = true; _rotateButton.hitTestEdgeInsets = UIEdgeInsetsMake(-10, -10, -10, -10); [_rotateButton addTarget:self action:@selector(rotate) forControlEvents:UIControlEventTouchUpInside]; - [_rotateButton setImage:[UIImage imageNamed:@"PhotoEditorRotateIcon"] forState:UIControlStateNormal]; + [_rotateButton setImage:TGComponentsImageNamed(@"PhotoEditorRotateIcon") forState:UIControlStateNormal]; //[_buttonsWrapperView addSubview:_rotateButton]; _mirrorButton = [[TGModernButton alloc] initWithFrame:CGRectMake(0, 0, 36, 36)]; @@ -165,15 +165,15 @@ NSString * const TGPhotoCropOriginalAspectRatio = @"original"; _mirrorButton.imageEdgeInsets = UIEdgeInsetsMake(4.0f, 0.0f, 0.0f, 0.0f); _mirrorButton.hitTestEdgeInsets = UIEdgeInsetsMake(-10, -10, -10, -10); [_mirrorButton addTarget:self action:@selector(mirror) forControlEvents:UIControlEventTouchUpInside]; - [_mirrorButton setImage:[UIImage imageNamed:@"PhotoEditorMirrorIcon"] forState:UIControlStateNormal]; + [_mirrorButton setImage:TGComponentsImageNamed(@"PhotoEditorMirrorIcon") forState:UIControlStateNormal]; //[_buttonsWrapperView addSubview:_mirrorButton]; _aspectRatioButton = [[TGModernButton alloc] initWithFrame:CGRectMake(0, 0, 36, 36)]; _aspectRatioButton.exclusiveTouch = true; _aspectRatioButton.hitTestEdgeInsets = UIEdgeInsetsMake(-10, -10, -10, -10); [_aspectRatioButton addTarget:self action:@selector(aspectRatioButtonPressed) forControlEvents:UIControlEventTouchUpInside]; - UIImage *aspectRatioHighlightedImage = TGTintedImage([UIImage imageNamed:@"PhotoEditorAspectRatioIcon"], [TGPhotoEditorInterfaceAssets accentColor]); - [_aspectRatioButton setImage:[UIImage imageNamed:@"PhotoEditorAspectRatioIcon"] forState:UIControlStateNormal]; + UIImage *aspectRatioHighlightedImage = TGTintedImage(TGComponentsImageNamed(@"PhotoEditorAspectRatioIcon"), [TGPhotoEditorInterfaceAssets accentColor]); + [_aspectRatioButton setImage:TGComponentsImageNamed(@"PhotoEditorAspectRatioIcon") forState:UIControlStateNormal]; [_aspectRatioButton setImage:aspectRatioHighlightedImage forState:UIControlStateSelected]; [_aspectRatioButton setImage:aspectRatioHighlightedImage forState:UIControlStateSelected | UIControlStateHighlighted]; //[_buttonsWrapperView addSubview:_aspectRatioButton]; diff --git a/LegacyComponents/TGPhotoCropRotationView.m b/LegacyComponents/TGPhotoCropRotationView.m index fd177da1e0..481be6d11d 100644 --- a/LegacyComponents/TGPhotoCropRotationView.m +++ b/LegacyComponents/TGPhotoCropRotationView.m @@ -1,6 +1,7 @@ #import "TGPhotoCropRotationView.h" -#import +#import "LegacyComponentsInternal.h" +#import "POPSpringAnimation.h" #import @@ -33,13 +34,13 @@ const CGFloat TGPhotoCropRotationViewMaximumAngle = 45; _wheelView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 400, 400)]; _wheelView.alpha = 0.9f; - _wheelView.image = [UIImage imageNamed:@"PhotoEditorRotationWheel"]; + _wheelView.image = TGComponentsImageNamed(@"PhotoEditorRotationWheel"); [self addSubview:_wheelView]; _needleView = [[UIImageView alloc] initWithFrame:CGRectZero]; _needleView.alpha = 0.9f; _needleView.contentMode = UIViewContentModeCenter; - _needleView.image = [UIImage imageNamed:@"PhotoEditorRotationNeedle"]; + _needleView.image = TGComponentsImageNamed(@"PhotoEditorRotationNeedle"); [self addSubview:_needleView]; _pressGestureRecognizer = [[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(handlePress:)]; @@ -287,7 +288,7 @@ const CGFloat TGPhotoCropRotationViewMaximumAngle = 45; { case UIInterfaceOrientationLandscapeLeft: { - _wheelView.image = [UIImage imageNamed:@"PhotoEditorRotationWheelLeft"]; + _wheelView.image = TGComponentsImageNamed(@"PhotoEditorRotationWheelLeft"); _wheelView.center = CGPointMake(52 + 200, self.frame.size.height / 2); _needleView.frame = CGRectMake(43, (self.frame.size.height - 10) / 2, 10, 10); @@ -297,7 +298,7 @@ const CGFloat TGPhotoCropRotationViewMaximumAngle = 45; case UIInterfaceOrientationLandscapeRight: { - _wheelView.image = [UIImage imageNamed:@"PhotoEditorRotationWheelRight"]; + _wheelView.image = TGComponentsImageNamed(@"PhotoEditorRotationWheelRight"); _wheelView.center = CGPointMake(-152, self.frame.size.height / 2); _needleView.frame = CGRectMake(self.frame.size.width - 53, (self.frame.size.height - 10) / 2, 10, 10); @@ -307,7 +308,7 @@ const CGFloat TGPhotoCropRotationViewMaximumAngle = 45; default: { - _wheelView.image = [UIImage imageNamed:@"PhotoEditorRotationWheel"]; + _wheelView.image = TGComponentsImageNamed(@"PhotoEditorRotationWheel"); _wheelView.center = CGPointMake(self.frame.size.width / 2, -152); _needleView.frame = CGRectMake((self.frame.size.width - 10) / 2, 47, 10, 10); diff --git a/LegacyComponents/TGPhotoEditorBlurToolView.m b/LegacyComponents/TGPhotoEditorBlurToolView.m index 43af91eaa9..5d02fb84e7 100644 --- a/LegacyComponents/TGPhotoEditorBlurToolView.m +++ b/LegacyComponents/TGPhotoEditorBlurToolView.m @@ -63,21 +63,21 @@ _offButton = [[TGPhotoEditorBlurTypeButton alloc] initWithFrame:CGRectZero]; _offButton.tag = PGBlurToolTypeNone; [_offButton addTarget:self action:@selector(blurButtonPressed:) forControlEvents:UIControlEventTouchUpInside]; - [_offButton setImage:[UIImage imageNamed:@"PhotoEditorBlurOff"]]; + [_offButton setImage:TGComponentsImageNamed(@"PhotoEditorBlurOff")]; [_offButton setTitle:TGLocalized(@"PhotoEditor.BlurToolOff")]; [_buttonsWrapper addSubview:_offButton]; _radialButton = [[TGPhotoEditorBlurTypeButton alloc] initWithFrame:CGRectZero]; _radialButton.tag = PGBlurToolTypeRadial; [_radialButton addTarget:self action:@selector(blurButtonPressed:) forControlEvents:UIControlEventTouchUpInside]; - [_radialButton setImage:[UIImage imageNamed:@"PhotoEditorBlurRadial"]]; + [_radialButton setImage:TGComponentsImageNamed(@"PhotoEditorBlurRadial")]; [_radialButton setTitle:TGLocalized(@"PhotoEditor.BlurToolRadial")]; [_buttonsWrapper addSubview:_radialButton]; _linearButton = [[TGPhotoEditorBlurTypeButton alloc] initWithFrame:CGRectZero]; _linearButton.tag = PGBlurToolTypeLinear; [_linearButton addTarget:self action:@selector(blurButtonPressed:) forControlEvents:UIControlEventTouchUpInside]; - [_linearButton setImage:[UIImage imageNamed:@"PhotoEditorBlurLinear"]]; + [_linearButton setImage:TGComponentsImageNamed(@"PhotoEditorBlurLinear")]; [_linearButton setTitle:TGLocalized(@"PhotoEditor.BlurToolLinear")]; [_buttonsWrapper addSubview:_linearButton]; diff --git a/LegacyComponents/TGPhotoEditorController.m b/LegacyComponents/TGPhotoEditorController.m index 5e82f9ebc8..8e9ee230fc 100644 --- a/LegacyComponents/TGPhotoEditorController.m +++ b/LegacyComponents/TGPhotoEditorController.m @@ -99,7 +99,7 @@ - (instancetype)initWithContext:(id)context item:(id)item intent:(TGPhotoEditorControllerIntent)intent adjustments:(id)adjustments caption:(NSString *)caption screenImage:(UIImage *)screenImage availableTabs:(TGPhotoEditorTab)availableTabs selectedTab:(TGPhotoEditorTab)selectedTab { - self = [super init]; + self = [super initWithContext:context]; if (self != nil) { _context = context; @@ -133,6 +133,8 @@ _photoEditor.trimStartValue = videoAdjustments.trimStartValue; _photoEditor.trimEndValue = videoAdjustments.trimEndValue; } + + self.customAppearanceMethodsForwarding = true; } return self; } @@ -410,12 +412,12 @@ { [UIView animateWithDuration:0.3 animations:^ { - [TGHacks setApplicationStatusBarAlpha:0.0f]; + [_context setApplicationStatusBarAlpha:0.0f]; }]; } else { - [TGHacks setApplicationStatusBarAlpha:0.0f]; + [_context setApplicationStatusBarAlpha:0.0f]; } } else if (!self.dontHideStatusBar) @@ -460,12 +462,12 @@ { [UIView animateWithDuration:0.3 animations:^ { - [TGHacks setApplicationStatusBarAlpha:1.0f]; + [_context setApplicationStatusBarAlpha:1.0f]; }]; } else { - [TGHacks setApplicationStatusBarAlpha:1.0f]; + [_context setApplicationStatusBarAlpha:1.0f]; } } @@ -849,7 +851,7 @@ if ([self presentedForAvatarCreation]) { - TGPhotoAvatarCropController *cropController = [[TGPhotoAvatarCropController alloc] initWithPhotoEditor:_photoEditor previewView:_previewView]; + TGPhotoAvatarCropController *cropController = [[TGPhotoAvatarCropController alloc] initWithContext:_context photoEditor:_photoEditor previewView:_previewView]; bool skipInitialTransition = (![self presentedFromCamera] && self.navigationController != nil) || self.skipInitialTransition; cropController.fromCamera = [self presentedFromCamera]; @@ -1066,7 +1068,7 @@ case TGPhotoEditorToolsTab: { - TGPhotoToolsController *toolsController = [[TGPhotoToolsController alloc] initWithPhotoEditor:_photoEditor previewView:_previewView]; + TGPhotoToolsController *toolsController = [[TGPhotoToolsController alloc] initWithContext:_context photoEditor:_photoEditor previewView:_previewView]; toolsController.toolbarLandscapeSize = TGPhotoEditorToolbarSize; toolsController.beginTransitionIn = ^UIView *(CGRect *referenceFrame, UIView **parentView, bool *noTransitionView) { @@ -1096,7 +1098,7 @@ { _ignoreDefaultPreviewViewTransitionIn = true; - TGPhotoQualityController *qualityController = [[TGPhotoQualityController alloc] initWithPhotoEditor:_photoEditor previewView:_previewView]; + TGPhotoQualityController *qualityController = [[TGPhotoQualityController alloc] initWithContext:_context photoEditor:_photoEditor previewView:_previewView]; qualityController.item = _item; qualityController.toolbarLandscapeSize = TGPhotoEditorToolbarSize; qualityController.beginTransitionIn = ^UIView *(CGRect *referenceFrame, UIView **parentView, bool *noTransitionView) diff --git a/LegacyComponents/TGPhotoEditorInterfaceAssets.m b/LegacyComponents/TGPhotoEditorInterfaceAssets.m index b1b4cc5691..33ef9ca4ba 100644 --- a/LegacyComponents/TGPhotoEditorInterfaceAssets.m +++ b/LegacyComponents/TGPhotoEditorInterfaceAssets.m @@ -43,87 +43,87 @@ + (UIImage *)captionIcon { - return [UIImage imageNamed:@"PhotoEditorCaption.png"]; + return TGComponentsImageNamed(@"PhotoEditorCaption.png"); } + (UIImage *)cropIcon { - return [UIImage imageNamed:@"PhotoEditorCrop.png"]; + return TGComponentsImageNamed(@"PhotoEditorCrop.png"); } + (UIImage *)toolsIcon { - return [UIImage imageNamed:@"PhotoEditorTools.png"]; + return TGComponentsImageNamed(@"PhotoEditorTools.png"); } + (UIImage *)rotateIcon { - return [UIImage imageNamed:@"PhotoEditorRotateIcon.png"]; + return TGComponentsImageNamed(@"PhotoEditorRotateIcon.png"); } + (UIImage *)paintIcon { - return [UIImage imageNamed:@"PhotoEditorPaint.png"]; + return TGComponentsImageNamed(@"PhotoEditorPaint.png"); } + (UIImage *)stickerIcon { - return [UIImage imageNamed:@"PaintStickersIcon.png"]; + return TGComponentsImageNamed(@"PaintStickersIcon.png"); } + (UIImage *)textIcon { - return [UIImage imageNamed:@"PaintTextIcon.png"]; + return TGComponentsImageNamed(@"PaintTextIcon.png"); } + (UIImage *)eraserIcon { - return [UIImage imageNamed:@"PaintEraserIcon.png"]; + return TGComponentsImageNamed(@"PaintEraserIcon.png"); } + (UIImage *)mirrorIcon { - return [UIImage imageNamed:@"PhotoEditorMirrorIcon.png"]; + return TGComponentsImageNamed(@"PhotoEditorMirrorIcon.png"); } + (UIImage *)aspectRatioIcon { - return [UIImage imageNamed:@"PhotoEditorAspectRatioIcon.png"]; + return TGComponentsImageNamed(@"PhotoEditorAspectRatioIcon.png"); } + (UIImage *)aspectRatioActiveIcon { - return TGTintedImage([UIImage imageNamed:@"PhotoEditorAspectRatioIcon.png"], [self accentColor]); + return TGTintedImage(TGComponentsImageNamed(@"PhotoEditorAspectRatioIcon.png"), [self accentColor]); } + (UIImage *)tintIcon { - return [UIImage imageNamed:@"PhotoEditorTintIcon.png"]; + return TGComponentsImageNamed(@"PhotoEditorTintIcon.png"); } + (UIImage *)blurIcon { - return [UIImage imageNamed:@"PhotoEditorBlurIcon.png"]; + return TGComponentsImageNamed(@"PhotoEditorBlurIcon.png"); } + (UIImage *)curvesIcon { - return [UIImage imageNamed:@"PhotoEditorCurvesIcon.png"]; + return TGComponentsImageNamed(@"PhotoEditorCurvesIcon.png"); } + (UIImage *)gifIcon { - return [UIImage imageNamed:@"PhotoEditorMute.png"]; + return TGComponentsImageNamed(@"PhotoEditorMute.png"); } + (UIImage *)gifActiveIcon { - return [UIImage imageNamed:@"PhotoEditorMuteActive.png"]; + return TGComponentsImageNamed(@"PhotoEditorMuteActive.png"); } + (UIImage *)qualityIconForPreset:(TGMediaVideoConversionPreset)preset { - UIImage *background = [UIImage imageNamed:@"PhotoEditorQuality"]; + UIImage *background = TGComponentsImageNamed(@"PhotoEditorQuality"); UIGraphicsBeginImageContextWithOptions(background.size, false, 0.0f); @@ -172,11 +172,11 @@ { if (value < FLT_EPSILON) { - return [UIImage imageNamed:@"PhotoEditorTimer0"]; + return TGComponentsImageNamed(@"PhotoEditorTimer0"); } else { - UIImage *background = [UIImage imageNamed:@"PhotoEditorTimer"]; + UIImage *background = TGComponentsImageNamed(@"PhotoEditorTimer"); UIGraphicsBeginImageContextWithOptions(background.size, false, 0.0f); CGContextRef context = UIGraphicsGetCurrentContext(); diff --git a/LegacyComponents/TGPhotoEditorItemController.h b/LegacyComponents/TGPhotoEditorItemController.h index ac3a9c4124..008fd2eb10 100644 --- a/LegacyComponents/TGPhotoEditorItemController.h +++ b/LegacyComponents/TGPhotoEditorItemController.h @@ -1,4 +1,4 @@ -#import +#import #import "PGPhotoEditorItem.h" @@ -16,7 +16,7 @@ @property (nonatomic, assign) bool initialAppearance; @property (nonatomic, assign) bool skipProcessingOnCompletion; -- (instancetype)initWithEditorItem:(id)editorItem photoEditor:(PGPhotoEditor *)photoEditor previewView:(TGPhotoEditorPreviewView *)previewView; +- (instancetype)initWithContext:(id)context editorItem:(id)editorItem photoEditor:(PGPhotoEditor *)photoEditor previewView:(TGPhotoEditorPreviewView *)previewView; - (void)attachPreviewView:(TGPhotoEditorPreviewView *)previewView; diff --git a/LegacyComponents/TGPhotoEditorItemController.m b/LegacyComponents/TGPhotoEditorItemController.m index 78814d7053..858919f0d4 100644 --- a/LegacyComponents/TGPhotoEditorItemController.m +++ b/LegacyComponents/TGPhotoEditorItemController.m @@ -47,9 +47,9 @@ @implementation TGPhotoEditorItemController -- (instancetype)initWithEditorItem:(id)editorItem photoEditor:(PGPhotoEditor *)photoEditor previewView:(TGPhotoEditorPreviewView *)previewView +- (instancetype)initWithContext:(id)context editorItem:(id)editorItem photoEditor:(PGPhotoEditor *)photoEditor previewView:(TGPhotoEditorPreviewView *)previewView { - self = [super init]; + self = [super initWithContext:context]; if (self != nil) { _editorItem = editorItem; diff --git a/LegacyComponents/TGPhotoPaintActionsView.m b/LegacyComponents/TGPhotoPaintActionsView.m index c3b7d69155..1ea991476d 100644 --- a/LegacyComponents/TGPhotoPaintActionsView.m +++ b/LegacyComponents/TGPhotoPaintActionsView.m @@ -24,7 +24,7 @@ _undoButton.adjustsImageWhenDisabled = false; _undoButton.enabled = false; _undoButton.exclusiveTouch = true; - [_undoButton setImage:[UIImage imageNamed:@"PaintUndoIcon"] forState:UIControlStateNormal]; + [_undoButton setImage:TGComponentsImageNamed(@"PaintUndoIcon") forState:UIControlStateNormal]; [_undoButton addTarget:self action:@selector(undoButtonPressed) forControlEvents:UIControlEventTouchUpInside]; [self addSubview:_undoButton]; @@ -32,7 +32,7 @@ _redoButton.adjustsImageWhenDisabled = false; _redoButton.enabled = false; _redoButton.exclusiveTouch = true; - [_redoButton setImage:[UIImage imageNamed:@"PaintRedoIcon"] forState:UIControlStateNormal]; + [_redoButton setImage:TGComponentsImageNamed(@"PaintRedoIcon") forState:UIControlStateNormal]; [_redoButton addTarget:self action:@selector(redoButtonPressed) forControlEvents:UIControlEventTouchUpInside]; //[self addSubview:_redoButton]; diff --git a/LegacyComponents/TGPhotoPaintController.m b/LegacyComponents/TGPhotoPaintController.m index bf9b9dcbfe..49d6fe0879 100644 --- a/LegacyComponents/TGPhotoPaintController.m +++ b/LegacyComponents/TGPhotoPaintController.m @@ -136,7 +136,7 @@ const CGFloat TGPhotoPaintStickerKeyboardSize = 260.0f; - (instancetype)initWithContext:(id)context photoEditor:(PGPhotoEditor *)photoEditor previewView:(TGPhotoEditorPreviewView *)previewView { - self = [super init]; + self = [super initWithContext:context]; if (self != nil) { _context = context; diff --git a/LegacyComponents/TGPhotoPaintSettingsView.m b/LegacyComponents/TGPhotoPaintSettingsView.m index 11c99f2be4..f8380bb730 100644 --- a/LegacyComponents/TGPhotoPaintSettingsView.m +++ b/LegacyComponents/TGPhotoPaintSettingsView.m @@ -147,15 +147,15 @@ const CGFloat TGPhotoPaintSettingsPadPickerWidth = 360.0f; switch (icon) { case TGPhotoPaintSettingsViewIconBrush: - iconImage = [UIImage imageNamed:@"PaintBrushIcon"]; + iconImage = TGComponentsImageNamed(@"PaintBrushIcon"); break; case TGPhotoPaintSettingsViewIconText: - iconImage = [UIImage imageNamed:@"PaintTextSettingsIcon"]; + iconImage = TGComponentsImageNamed(@"PaintTextSettingsIcon"); break; case TGPhotoPaintSettingsViewIconMirror: - iconImage = [UIImage imageNamed:@"PaintMirrorIcon"]; + iconImage = TGComponentsImageNamed(@"PaintMirrorIcon"); break; } @@ -214,7 +214,7 @@ const CGFloat TGPhotoPaintSettingsPadPickerWidth = 360.0f; static UIImage *image; dispatch_once(&onceToken, ^ { - image = [TGTintedImage([UIImage imageNamed:@"PaintPopupLandscapeLeftBackground"], UIColorRGB(0xf7f7f7)) resizableImageWithCapInsets:UIEdgeInsetsMake(32.0f, 32.0f, 32.0f, 32.0f)]; + image = [TGTintedImage(TGComponentsImageNamed(@"PaintPopupLandscapeLeftBackground"), UIColorRGB(0xf7f7f7)) resizableImageWithCapInsets:UIEdgeInsetsMake(32.0f, 32.0f, 32.0f, 32.0f)]; }); return image; } @@ -225,7 +225,7 @@ const CGFloat TGPhotoPaintSettingsPadPickerWidth = 360.0f; static UIImage *image; dispatch_once(&onceToken, ^ { - image = [TGTintedImage([UIImage imageNamed:@"PaintPopupLandscapeRightBackground"], UIColorRGB(0xf7f7f7)) resizableImageWithCapInsets:UIEdgeInsetsMake(32.0f, 32.0f, 32.0f, 32.0f)]; + image = [TGTintedImage(TGComponentsImageNamed(@"PaintPopupLandscapeRightBackground"), UIColorRGB(0xf7f7f7)) resizableImageWithCapInsets:UIEdgeInsetsMake(32.0f, 32.0f, 32.0f, 32.0f)]; }); return image; } @@ -236,7 +236,7 @@ const CGFloat TGPhotoPaintSettingsPadPickerWidth = 360.0f; static UIImage *image; dispatch_once(&onceToken, ^ { - image = [TGTintedImage([UIImage imageNamed:@"PaintPopupPortraitBackground"], UIColorRGB(0xf7f7f7)) resizableImageWithCapInsets:UIEdgeInsetsMake(32.0f, 32.0f, 32.0f, 32.0f)]; + image = [TGTintedImage(TGComponentsImageNamed(@"PaintPopupPortraitBackground"), UIColorRGB(0xf7f7f7)) resizableImageWithCapInsets:UIEdgeInsetsMake(32.0f, 32.0f, 32.0f, 32.0f)]; }); return image; } diff --git a/LegacyComponents/TGPhotoQualityController.h b/LegacyComponents/TGPhotoQualityController.h index 57145d9ae9..0a33e72154 100644 --- a/LegacyComponents/TGPhotoQualityController.h +++ b/LegacyComponents/TGPhotoQualityController.h @@ -10,6 +10,6 @@ @property (nonatomic, readonly) TGMediaVideoConversionPreset preset; -- (instancetype)initWithPhotoEditor:(PGPhotoEditor *)photoEditor previewView:(TGPhotoEditorPreviewView *)previewView; +- (instancetype)initWithContext:(id)context photoEditor:(PGPhotoEditor *)photoEditor previewView:(TGPhotoEditorPreviewView *)previewView; @end diff --git a/LegacyComponents/TGPhotoQualityController.m b/LegacyComponents/TGPhotoQualityController.m index 0c4e71ab3f..c31d5acf1e 100644 --- a/LegacyComponents/TGPhotoQualityController.m +++ b/LegacyComponents/TGPhotoQualityController.m @@ -68,9 +68,9 @@ const NSTimeInterval TGPhotoQualityPreviewDuration = 15.0f; @implementation TGPhotoQualityController -- (instancetype)initWithPhotoEditor:(PGPhotoEditor *)photoEditor previewView:(TGPhotoEditorPreviewView *)previewView +- (instancetype)initWithContext:(id)context photoEditor:(PGPhotoEditor *)photoEditor previewView:(TGPhotoEditorPreviewView *)previewView { - self = [super init]; + self = [super initWithContext:context]; if (self != nil) { self.photoEditor = photoEditor; diff --git a/LegacyComponents/TGPhotoStickersView.m b/LegacyComponents/TGPhotoStickersView.m index b9b8f5c8f8..34bcbf7322 100644 --- a/LegacyComponents/TGPhotoStickersView.m +++ b/LegacyComponents/TGPhotoStickersView.m @@ -108,7 +108,7 @@ typedef enum { _backgroundView = [[UIImageView alloc] init]; _backgroundView.alpha = 0.98f; - _backgroundView.image = [TGTintedImage([UIImage imageNamed:@"PaintPopupCenterBackground"], UIColorRGB(0xf7f7f7)) resizableImageWithCapInsets:UIEdgeInsetsMake(32.0f, 32.0f, 32.0f, 32.0f)]; + _backgroundView.image = [TGTintedImage(TGComponentsImageNamed(@"PaintPopupCenterBackground"), UIColorRGB(0xf7f7f7)) resizableImageWithCapInsets:UIEdgeInsetsMake(32.0f, 32.0f, 32.0f, 32.0f)]; [self addSubview:_backgroundView]; } @@ -135,21 +135,21 @@ typedef enum { [_cancelButton sizeToFit]; [_wrapperView addSubview:_cancelButton]; - [_segmentedControl setBackgroundImage:TGTintedImage([UIImage imageNamed:@"ModernSegmentedControlBackground.png"], UIColorRGB(0xafb2b1)) forState:UIControlStateNormal barMetrics:UIBarMetricsDefault]; - [_segmentedControl setBackgroundImage:TGTintedImage([UIImage imageNamed:@"ModernSegmentedControlSelected.png"], UIColorRGB(0xafb2b1)) forState:UIControlStateSelected barMetrics:UIBarMetricsDefault]; - [_segmentedControl setBackgroundImage:TGTintedImage([UIImage imageNamed:@"ModernSegmentedControlSelected.png"], UIColorRGB(0xafb2b1)) forState:UIControlStateSelected | UIControlStateHighlighted barMetrics:UIBarMetricsDefault]; - [_segmentedControl setBackgroundImage:[UIImage imageNamed:@"PaintSegmentedControlHighlighted.png"] forState:UIControlStateHighlighted barMetrics:UIBarMetricsDefault]; - [_segmentedControl setDividerImage:TGTintedImage([UIImage imageNamed:@"ModernSegmentedControlDivider.png"], UIColorRGB(0xafb2b1)) forLeftSegmentState:UIControlStateNormal rightSegmentState:UIControlStateNormal barMetrics:UIBarMetricsDefault]; + [_segmentedControl setBackgroundImage:TGTintedImage(TGComponentsImageNamed(@"ModernSegmentedControlBackground.png"), UIColorRGB(0xafb2b1)) forState:UIControlStateNormal barMetrics:UIBarMetricsDefault]; + [_segmentedControl setBackgroundImage:TGTintedImage(TGComponentsImageNamed(@"ModernSegmentedControlSelected.png"), UIColorRGB(0xafb2b1)) forState:UIControlStateSelected barMetrics:UIBarMetricsDefault]; + [_segmentedControl setBackgroundImage:TGTintedImage(TGComponentsImageNamed(@"ModernSegmentedControlSelected.png"), UIColorRGB(0xafb2b1)) forState:UIControlStateSelected | UIControlStateHighlighted barMetrics:UIBarMetricsDefault]; + [_segmentedControl setBackgroundImage:TGComponentsImageNamed(@"PaintSegmentedControlHighlighted.png") forState:UIControlStateHighlighted barMetrics:UIBarMetricsDefault]; + [_segmentedControl setDividerImage:TGTintedImage(TGComponentsImageNamed(@"ModernSegmentedControlDivider.png"), UIColorRGB(0xafb2b1)) forLeftSegmentState:UIControlStateNormal rightSegmentState:UIControlStateNormal barMetrics:UIBarMetricsDefault]; [_segmentedControl setTitleTextAttributes:@{UITextAttributeTextColor: UIColorRGB(0xafb2b1), UITextAttributeTextShadowColor: [UIColor clearColor], UITextAttributeFont: TGSystemFontOfSize(13)} forState:UIControlStateNormal]; [_segmentedControl setTitleTextAttributes:@{UITextAttributeTextColor: [UIColor blackColor], UITextAttributeTextShadowColor: [UIColor clearColor], UITextAttributeFont: TGSystemFontOfSize(13)} forState:UIControlStateSelected]; } else { - [_segmentedControl setBackgroundImage:[UIImage imageNamed:@"ModernSegmentedControlBackground.png"] forState:UIControlStateNormal barMetrics:UIBarMetricsDefault]; - [_segmentedControl setBackgroundImage:[UIImage imageNamed:@"ModernSegmentedControlSelected.png"] forState:UIControlStateSelected barMetrics:UIBarMetricsDefault]; - [_segmentedControl setBackgroundImage:[UIImage imageNamed:@"ModernSegmentedControlSelected.png"] forState:UIControlStateSelected | UIControlStateHighlighted barMetrics:UIBarMetricsDefault]; - [_segmentedControl setBackgroundImage:[UIImage imageNamed:@"ModernSegmentedControlHighlighted.png"] forState:UIControlStateHighlighted barMetrics:UIBarMetricsDefault]; - [_segmentedControl setDividerImage:[UIImage imageNamed:@"ModernSegmentedControlDivider.png"] forLeftSegmentState:UIControlStateNormal rightSegmentState:UIControlStateNormal barMetrics:UIBarMetricsDefault]; + [_segmentedControl setBackgroundImage:TGComponentsImageNamed(@"ModernSegmentedControlBackground.png") forState:UIControlStateNormal barMetrics:UIBarMetricsDefault]; + [_segmentedControl setBackgroundImage:TGComponentsImageNamed(@"ModernSegmentedControlSelected.png") forState:UIControlStateSelected barMetrics:UIBarMetricsDefault]; + [_segmentedControl setBackgroundImage:TGComponentsImageNamed(@"ModernSegmentedControlSelected.png") forState:UIControlStateSelected | UIControlStateHighlighted barMetrics:UIBarMetricsDefault]; + [_segmentedControl setBackgroundImage:TGComponentsImageNamed(@"ModernSegmentedControlHighlighted.png") forState:UIControlStateHighlighted barMetrics:UIBarMetricsDefault]; + [_segmentedControl setDividerImage:TGComponentsImageNamed(@"ModernSegmentedControlDivider.png") forLeftSegmentState:UIControlStateNormal rightSegmentState:UIControlStateNormal barMetrics:UIBarMetricsDefault]; [_segmentedControl setTitleTextAttributes:@{UITextAttributeTextColor: TGAccentColor(), UITextAttributeTextShadowColor: [UIColor clearColor], UITextAttributeFont: TGSystemFontOfSize(13)} forState:UIControlStateNormal]; [_segmentedControl setTitleTextAttributes:@{UITextAttributeTextColor: [UIColor whiteColor], UITextAttributeTextShadowColor: [UIColor clearColor], UITextAttributeFont: TGSystemFontOfSize(13)} forState:UIControlStateSelected]; } @@ -250,13 +250,17 @@ typedef enum { [strongSelf setStickerPacks:reversed maskStickerPacks:reversedMasks recentDocuments:recentStickers]; } - [self updateCurrentSection]; + [strongSelf updateCurrentSection]; } }]; } return self; } +- (void)dealloc { + [_stickerPacksDisposable dispose]; +} + - (CGSize)sizeThatFits:(CGSize)__unused size { return CGSizeMake(375.0f + TGPhotoStickersViewMargin * 2.0f, 568.0f + TGPhotoStickersViewMargin * 2.0f); diff --git a/LegacyComponents/TGPhotoTextSettingsView.m b/LegacyComponents/TGPhotoTextSettingsView.m index 3efd85b3ef..031f18da77 100644 --- a/LegacyComponents/TGPhotoTextSettingsView.m +++ b/LegacyComponents/TGPhotoTextSettingsView.m @@ -92,7 +92,7 @@ const CGFloat TGPhotoTextSettingsItemHeight = 44.0f; _fontViews = fontViews; _fontSeparatorViews = separatorViews; - _selectedCheckView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"PaintCheck"]]; + _selectedCheckView = [[UIImageView alloc] initWithImage:TGComponentsImageNamed(@"PaintCheck")]; _selectedCheckView.frame = CGRectMake(15.0f, 16.0f, _selectedCheckView.frame.size.width, _selectedCheckView.frame.size.height); [self setStroke:selectedStroke]; @@ -204,21 +204,21 @@ const CGFloat TGPhotoTextSettingsItemHeight = 44.0f; { case UIInterfaceOrientationLandscapeLeft: { - _backgroundView.image = [TGTintedImage([UIImage imageNamed:@"PaintPopupLandscapeLeftBackground"], UIColorRGB(0xf7f7f7)) resizableImageWithCapInsets:UIEdgeInsetsMake(32.0f, 32.0f, 32.0f, 32.0f)]; + _backgroundView.image = [TGTintedImage(TGComponentsImageNamed(@"PaintPopupLandscapeLeftBackground"), UIColorRGB(0xf7f7f7)) resizableImageWithCapInsets:UIEdgeInsetsMake(32.0f, 32.0f, 32.0f, 32.0f)]; _backgroundView.frame = CGRectMake(TGPhotoTextSettingsViewMargin - 13.0f, TGPhotoTextSettingsViewMargin, self.frame.size.width - TGPhotoTextSettingsViewMargin * 2 + 13.0f, self.frame.size.height - TGPhotoTextSettingsViewMargin * 2); } break; case UIInterfaceOrientationLandscapeRight: { - _backgroundView.image = [TGTintedImage([UIImage imageNamed:@"PaintPopupLandscapeRightBackground"], UIColorRGB(0xf7f7f7)) resizableImageWithCapInsets:UIEdgeInsetsMake(32.0f, 32.0f, 32.0f, 32.0f)]; + _backgroundView.image = [TGTintedImage(TGComponentsImageNamed(@"PaintPopupLandscapeRightBackground"), UIColorRGB(0xf7f7f7)) resizableImageWithCapInsets:UIEdgeInsetsMake(32.0f, 32.0f, 32.0f, 32.0f)]; _backgroundView.frame = CGRectMake(TGPhotoTextSettingsViewMargin, TGPhotoTextSettingsViewMargin, self.frame.size.width - TGPhotoTextSettingsViewMargin * 2 + 13.0f, self.frame.size.height - TGPhotoTextSettingsViewMargin * 2); } break; default: { - _backgroundView.image = [TGTintedImage([UIImage imageNamed:@"PaintPopupPortraitBackground"], UIColorRGB(0xf7f7f7)) resizableImageWithCapInsets:UIEdgeInsetsMake(32.0f, 32.0f, 32.0f, 32.0f)]; + _backgroundView.image = [TGTintedImage(TGComponentsImageNamed(@"PaintPopupPortraitBackground"), UIColorRGB(0xf7f7f7)) resizableImageWithCapInsets:UIEdgeInsetsMake(32.0f, 32.0f, 32.0f, 32.0f)]; _backgroundView.frame = CGRectMake(TGPhotoTextSettingsViewMargin, TGPhotoTextSettingsViewMargin, self.frame.size.width - TGPhotoTextSettingsViewMargin * 2, self.frame.size.height - TGPhotoTextSettingsViewMargin * 2 + 13.0f); } break; diff --git a/LegacyComponents/TGPhotoToolbarView.m b/LegacyComponents/TGPhotoToolbarView.m index 40208545d6..e73ef9b462 100644 --- a/LegacyComponents/TGPhotoToolbarView.m +++ b/LegacyComponents/TGPhotoToolbarView.m @@ -44,11 +44,11 @@ switch (backButton) { case TGPhotoEditorBackButtonCancel: - cancelImage = [UIImage imageNamed:@"PhotoPickerCancelIcon"]; + cancelImage = TGComponentsImageNamed(@"PhotoPickerCancelIcon"); break; default: - cancelImage = [UIImage imageNamed:@"PhotoPickerBackIcon"]; + cancelImage = TGComponentsImageNamed(@"PhotoPickerBackIcon"); break; } [_cancelButton setImage:cancelImage forState:UIControlStateNormal]; @@ -60,11 +60,11 @@ switch (doneButton) { case TGPhotoEditorDoneButtonCheck: - doneImage = [UIImage imageNamed:@"PhotoPickerDoneIcon"]; + doneImage = TGComponentsImageNamed(@"PhotoPickerDoneIcon"); break; default: - doneImage = [UIImage imageNamed:@"PhotoPickerSendIcon"]; + doneImage = TGComponentsImageNamed(@"PhotoPickerSendIcon"); //buttonSize = CGSizeMake(52.0f, 52.0f); break; } diff --git a/LegacyComponents/TGPhotoToolsController.h b/LegacyComponents/TGPhotoToolsController.h index 3aa750a740..559c6a27db 100644 --- a/LegacyComponents/TGPhotoToolsController.h +++ b/LegacyComponents/TGPhotoToolsController.h @@ -6,7 +6,7 @@ @interface TGPhotoToolsController : TGPhotoEditorTabController -- (instancetype)initWithPhotoEditor:(PGPhotoEditor *)photoEditor previewView:(TGPhotoEditorPreviewView *)previewView; +- (instancetype)initWithContext:(id)context photoEditor:(PGPhotoEditor *)photoEditor previewView:(TGPhotoEditorPreviewView *)previewView; - (void)updateValues; diff --git a/LegacyComponents/TGPhotoToolsController.m b/LegacyComponents/TGPhotoToolsController.m index e40bfcf3fd..5955492262 100644 --- a/LegacyComponents/TGPhotoToolsController.m +++ b/LegacyComponents/TGPhotoToolsController.m @@ -68,9 +68,9 @@ const CGFloat TGPhotoEditorToolsLandscapePanelSize = TGPhotoEditorToolsPanelSize @implementation TGPhotoToolsController -- (instancetype)initWithPhotoEditor:(PGPhotoEditor *)photoEditor previewView:(TGPhotoEditorPreviewView *)previewView +- (instancetype)initWithContext:(id)context photoEditor:(PGPhotoEditor *)photoEditor previewView:(TGPhotoEditorPreviewView *)previewView { - self = [super init]; + self = [super initWithContext:context]; if (self != nil) { self.photoEditor = photoEditor; diff --git a/LegacyComponents/TGProgressWindow.m b/LegacyComponents/TGProgressWindow.m index 4efdcb8d05..a3166466de 100644 --- a/LegacyComponents/TGProgressWindow.m +++ b/LegacyComponents/TGProgressWindow.m @@ -2,7 +2,6 @@ #import "LegacyComponentsInternal.h" -#import "TGActivityIndicatorView.h" #import "TGProgressSpinnerView.h" @interface TGProgressWindowController () diff --git a/LegacyComponents/TGStickerCollectionViewCell.m b/LegacyComponents/TGStickerCollectionViewCell.m index bb2c73b857..3d08182b89 100644 --- a/LegacyComponents/TGStickerCollectionViewCell.m +++ b/LegacyComponents/TGStickerCollectionViewCell.m @@ -58,6 +58,7 @@ [uri appendFormat:@"&legacyThumbnailUri=%@", [TGStringUtils stringByEscapingForURL:legacyThumbnailUri]]; [uri appendFormat:@"&width=124&height=124"]; + [uri appendFormat:@"&dimwidth=%d&dimheight=%d", (int)[documentMedia pictureSize].width, (int)[documentMedia pictureSize].height]; [uri appendFormat:@"&highQuality=1"]; [_imageView loadUri:uri withOptions:nil]; diff --git a/LegacyComponents/TGStickerKeyboardTabCell.m b/LegacyComponents/TGStickerKeyboardTabCell.m index 2870dc2c0b..1d46eed6fb 100644 --- a/LegacyComponents/TGStickerKeyboardTabCell.m +++ b/LegacyComponents/TGStickerKeyboardTabCell.m @@ -54,7 +54,7 @@ static void setViewFrame(UIView *view, CGRect frame) - (void)_updateRecentIcon { - UIImage *recentTabImage = [UIImage imageNamed:@"StickerKeyboardRecentTab.png"]; + UIImage *recentTabImage = TGComponentsImageNamed(@"StickerKeyboardRecentTab.png"); if (_style == TGStickerKeyboardViewPaintDarkStyle) { UIColor *color = self.selected ? [UIColor blackColor] : UIColorRGB(0xb4b5b5); diff --git a/LegacyComponents/TGStickerKeyboardTabSettingsCell.m b/LegacyComponents/TGStickerKeyboardTabSettingsCell.m index e964431e28..58e9dc4cb5 100644 --- a/LegacyComponents/TGStickerKeyboardTabSettingsCell.m +++ b/LegacyComponents/TGStickerKeyboardTabSettingsCell.m @@ -45,7 +45,7 @@ static void setViewFrame(UIView *view, CGRect frame) [self.contentView addSubview:_wrapperView]; _imageView = [[UIImageView alloc] init]; - _imageView.image = [UIImage imageNamed:@"StickerKeyboardSettingsIcon.png"]; + _imageView.image = TGComponentsImageNamed(@"StickerKeyboardSettingsIcon.png"); _imageView.userInteractionEnabled = false; _imageView.contentMode = UIViewContentModeCenter; [_wrapperView addSubview:_imageView]; @@ -60,11 +60,11 @@ static void setViewFrame(UIView *view, CGRect frame) _mode = mode; if (mode == TGStickerKeyboardTabSettingsCellSettings) { - _imageView.image = [UIImage imageNamed:@"StickerKeyboardSettingsIcon.png"]; + _imageView.image = TGComponentsImageNamed(@"StickerKeyboardSettingsIcon.png"); } else if (mode == TGStickerKeyboardTabSettingsCellGifs) { - _imageView.image = [UIImage imageNamed:@"StickerKeyboardGifIcon.png"]; + _imageView.image = TGComponentsImageNamed(@"StickerKeyboardGifIcon.png"); } else { - _imageView.image = [UIImage imageNamed:@"StickerKeyboardTrendingIcon.png"]; + _imageView.image = TGComponentsImageNamed(@"StickerKeyboardTrendingIcon.png"); } _button.hidden = mode != TGStickerKeyboardTabSettingsCellSettings; } diff --git a/LegacyComponents/TGViewController.h b/LegacyComponents/TGViewController.h index cfcedd73eb..2c01b6b422 100644 --- a/LegacyComponents/TGViewController.h +++ b/LegacyComponents/TGViewController.h @@ -1,6 +1,8 @@ #import #import +#import + typedef enum { TGViewControllerStyleDefault = 0, TGViewControllerStyleBlack = 1 @@ -37,6 +39,8 @@ typedef enum { @interface TGViewController : UIViewController ++ (void)setDefaultContext:(id)defaultContext; + + (UIFont *)titleFontForStyle:(TGViewControllerStyle)style landscape:(bool)landscape; + (UIFont *)titleTitleFontForStyle:(TGViewControllerStyle)style landscape:(bool)landscape; + (UIFont *)titleSubtitleFontForStyle:(TGViewControllerStyle)style landscape:(bool)landscape; @@ -88,6 +92,8 @@ typedef enum { @property (nonatomic) bool automaticallyManageScrollViewInsets; @property (nonatomic) bool ignoreKeyboardWhenAdjustingScrollViewInsets; +@property (nonatomic) bool customAppearanceMethodsForwarding; + @property (nonatomic, strong) NSArray *scrollViewsForAutomaticInsetsAdjustment; @property (nonatomic, weak) UIViewController *customParentViewController; @@ -99,6 +105,9 @@ typedef enum { @property (nonatomic, readonly) UIUserInterfaceSizeClass currentSizeClass; @property (nonatomic, copy) NSArray> *(^externalPreviewActionItems)(void); +@property (nonatomic, copy) void (^customRemoveFromParentViewController)(); + +- (id)initWithContext:(id)context NS_DESIGNATED_INITIALIZER; - (void)setExplicitTableInset:(UIEdgeInsets)explicitTableInset scrollIndicatorInset:(UIEdgeInsets)scrollIndicatorInset; diff --git a/LegacyComponents/TGViewController.mm b/LegacyComponents/TGViewController.mm index b3b9e6979d..491d28d623 100644 --- a/LegacyComponents/TGViewController.mm +++ b/LegacyComponents/TGViewController.mm @@ -116,6 +116,8 @@ static std::set autorotationLockIds; @interface TGViewController () { + id _context; + bool _hatTargetNavigationItem; id _sizeClassDisposable; @@ -139,6 +141,12 @@ static std::set autorotationLockIds; @implementation TGViewController +static id _defaultContext = nil; + ++ (void)setDefaultContext:(id)defaultContext { + _defaultContext = defaultContext; +} + + (UIFont *)titleFontForStyle:(TGViewControllerStyle)__unused style landscape:(bool)landscape { if (!landscape) @@ -338,28 +346,27 @@ static std::set autorotationLockIds; autorotationEnableTimer = nil; } -- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil -{ - self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]; - if (self) - { - [self _commonViewControllerInit]; +- (id)initWithNibName:(NSString *)__unused nibNameOrNil bundle:(NSBundle *)__unused nibBundleOrNil { + return [self initWithContext:_defaultContext]; +} + +- (id)init { + return [self initWithContext:_defaultContext]; +} + +- (id)initWithContext:(id)context { + self = [super initWithNibName:nil bundle:nil]; + if (self != nil) { + [self _commonViewControllerInit:context]; } return self; } -- (id)init -{ - self = [super init]; - if (self != nil) - { - [self _commonViewControllerInit]; - } - return self; -} - -- (void)_commonViewControllerInit +- (void)_commonViewControllerInit:(id)context { + assert(context != nil); + _context = context; + self.wantsFullScreenLayout = true; self.automaticallyManageScrollViewInsets = true; self.autoManageStatusBarBackground = true; @@ -367,8 +374,7 @@ static std::set autorotationLockIds; _currentSizeClass = UIUserInterfaceSizeClassCompact; __weak TGViewController *weakSelf = self; - UIViewController *rootController = [[LegacyComponentsGlobals provider] rootController]; - _sizeClassDisposable = [[rootController sizeClass] startWithNext:^(NSNumber *next) { + _sizeClassDisposable = [[_context sizeClassSignal] startWithNext:^(NSNumber *next) { __strong TGViewController *strongSelf = weakSelf; if (strongSelf != nil) { if (strongSelf->_currentSizeClass != [next integerValue]) { @@ -626,6 +632,12 @@ static std::set autorotationLockIds; [self adjustToInterfaceOrientation:self.interfaceOrientation]; [super viewWillAppear:animated]; + + if (self.customAppearanceMethodsForwarding) { + for (UIViewController *controller in self.childViewControllers) { + [controller viewWillAppear:animated]; + } + } } - (void)viewDidAppear:(BOOL)animated @@ -635,6 +647,12 @@ static std::set autorotationLockIds; _viewControllerHasEverAppeared = true; [super viewDidAppear:animated]; + + if (self.customAppearanceMethodsForwarding) { + for (UIViewController *controller in self.childViewControllers) { + [controller viewDidAppear:animated]; + } + } } - (void)viewWillDisappear:(BOOL)animated @@ -643,6 +661,12 @@ static std::set autorotationLockIds; _viewControllerIsAnimatingAppearanceTransition = true; [super viewWillDisappear:animated]; + + if (self.customAppearanceMethodsForwarding) { + for (UIViewController *controller in self.childViewControllers) { + [controller viewWillDisappear:animated]; + } + } } - (void)viewDidDisappear:(BOOL)animated @@ -651,6 +675,12 @@ static std::set autorotationLockIds; _viewControllerIsAnimatingAppearanceTransition = false; [super viewDidDisappear:animated]; + + if (self.customAppearanceMethodsForwarding) { + for (UIViewController *controller in self.childViewControllers) { + [controller viewDidDisappear:animated]; + } + } } - (void)_adjustControllerInsetForRotationToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation @@ -883,8 +913,7 @@ static std::set autorotationLockIds; - (UIStatusBarStyle)preferredStatusBarStyle { - UIViewController *rootController = [[LegacyComponentsGlobals provider] rootController]; - if (![rootController callStatusBarHidden]) + if (![_context rootCallStatusBarHidden]) return UIStatusBarStyleLightContent; else return UIStatusBarStyleDefault; @@ -1342,6 +1371,17 @@ static std::set autorotationLockIds; return [super previewActionItems]; } +- (BOOL)shouldAutomaticallyForwardAppearanceMethods { + return !self.customAppearanceMethodsForwarding; +} + +- (void)removeFromParentViewController { + if (_customRemoveFromParentViewController) { + _customRemoveFromParentViewController(); + } + [super removeFromParentViewController]; +} + @end @interface UINavigationController (DelegateAutomaticDismissKeyboard) diff --git a/TGRootControllerProtocol.h b/TGRootControllerProtocol.h deleted file mode 100644 index 37d15de205..0000000000 --- a/TGRootControllerProtocol.h +++ /dev/null @@ -1,12 +0,0 @@ -#import -#import - -@class SSignal; - -@protocol TGRootControllerProtocol - -- (CGRect)applicationBounds; -- (bool)callStatusBarHidden; -- (SSignal *)sizeClass; - -@end