mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2026-04-06 21:35:53 +00:00
Fixes
fix localeWithStrings globally (#30)
Fix badge on zoomed devices. closes #9
Hide channel bottom panel closes #27
Another attempt to fix badge on some Zoomed devices
Force System Share sheet tg://sg/debug
fixes for device badge
New Crowdin updates (#34)
* New translations sglocalizable.strings (Chinese Traditional)
* New translations sglocalizable.strings (Chinese Simplified)
* New translations sglocalizable.strings (Chinese Traditional)
Fix input panel hidden on selection (#31)
* added if check for selectionState != nil
* same order of subnodes
Revert "Fix input panel hidden on selection (#31)"
This reverts commit e8a8bb1496.
Fix input panel for channels Closes #37
Quickly share links with system's share menu
force tabbar when editing
increase height for correct animation
New translations sglocalizable.strings (Ukrainian) (#38)
Hide Post Story button
Fix 10.15.1
Fix archive option for long-tap
Enable in-app Safari
Disable some unsupported purchases
disableDeleteChatSwipeOption + refactor restart alert
Hide bot in suggestions list
Fix merge v11.0
Fix exceptions for safari webview controller
New Crowdin updates (#47)
* New translations sglocalizable.strings (Romanian)
* New translations sglocalizable.strings (French)
* New translations sglocalizable.strings (Spanish)
* New translations sglocalizable.strings (Afrikaans)
* New translations sglocalizable.strings (Arabic)
* New translations sglocalizable.strings (Catalan)
* New translations sglocalizable.strings (Czech)
* New translations sglocalizable.strings (Danish)
* New translations sglocalizable.strings (German)
* New translations sglocalizable.strings (Greek)
* New translations sglocalizable.strings (Finnish)
* New translations sglocalizable.strings (Hebrew)
* New translations sglocalizable.strings (Hungarian)
* New translations sglocalizable.strings (Italian)
* New translations sglocalizable.strings (Japanese)
* New translations sglocalizable.strings (Korean)
* New translations sglocalizable.strings (Dutch)
* New translations sglocalizable.strings (Norwegian)
* New translations sglocalizable.strings (Polish)
* New translations sglocalizable.strings (Portuguese)
* New translations sglocalizable.strings (Serbian (Cyrillic))
* New translations sglocalizable.strings (Swedish)
* New translations sglocalizable.strings (Turkish)
* New translations sglocalizable.strings (Vietnamese)
* New translations sglocalizable.strings (Indonesian)
* New translations sglocalizable.strings (Hindi)
* New translations sglocalizable.strings (Uzbek)
New Crowdin updates (#49)
* New translations sglocalizable.strings (Arabic)
* New translations sglocalizable.strings (Arabic)
New translations sglocalizable.strings (Russian) (#51)
Call confirmation
WIP Settings search
Settings Search
Localize placeholder
Update AccountUtils.swift
mark mutual contact
Align back context action to left
New Crowdin updates (#54)
* New translations sglocalizable.strings (Chinese Simplified)
* New translations sglocalizable.strings (Chinese Traditional)
* New translations sglocalizable.strings (Ukrainian)
Independent Playground app for simulator
New translations sglocalizable.strings (Ukrainian) (#55)
Playground UIKit base and controllers
Inject SwiftUI view with overflow to AsyncDisplayKit
Launch Playgound project on simulator
Create .swiftformat
Move Playground to example
Update .swiftformat
Init SwiftUIViewController
wip
New translations sglocalizable.strings (Chinese Traditional) (#57)
Xcode 16 fixes
Fix
New translations sglocalizable.strings (Italian) (#59)
New translations sglocalizable.strings (Chinese Simplified) (#63)
Force disable CallKit integration due to missing NSE Entitlement
Fix merge
Fix whole chat translator
Sweetpad config
Bump version
11.3.1 fixes
Mutual contact placement fix
Disable Video PIP swipe
Update versions.json
Fix PIP crash
387 lines
11 KiB
Objective-C
387 lines
11 KiB
Objective-C
#import "TGPhotoEditorInterfaceAssets.h"
|
|
|
|
#import "LegacyComponentsInternal.h"
|
|
#import "TGImageUtils.h"
|
|
#import "TGFont.h"
|
|
|
|
#import "TGMediaAssetsController.h"
|
|
|
|
@implementation TGPhotoEditorInterfaceAssets
|
|
|
|
+ (UIColor *)toolbarBackgroundColor
|
|
{
|
|
return [UIColor blackColor];
|
|
}
|
|
|
|
+ (UIColor *)toolbarTransparentBackgroundColor
|
|
{
|
|
return UIColorRGBA(0x000000, 0.9f);
|
|
}
|
|
|
|
+ (UIColor *)cropTransparentOverlayColor
|
|
{
|
|
return UIColorRGBA(0x000000, 0.7f);
|
|
}
|
|
|
|
+ (UIColor *)toolbarIconColor
|
|
{
|
|
return [UIColor whiteColor];
|
|
}
|
|
|
|
+ (UIColor *)accentColor
|
|
{
|
|
TGMediaAssetsPallete *pallete = nil;
|
|
if ([[LegacyComponentsGlobals provider] respondsToSelector:@selector(mediaAssetsPallete)])
|
|
pallete = [[LegacyComponentsGlobals provider] mediaAssetsPallete];
|
|
|
|
return pallete.maybeAccentColor ?: UIColorRGB(0x65b3ff);
|
|
}
|
|
|
|
+ (UIColor *)panelBackgroundColor
|
|
{
|
|
return UIColorRGBA(0x000000, 0.9f);
|
|
}
|
|
|
|
+ (UIColor *)selectedImagesPanelBackgroundColor
|
|
{
|
|
return UIColorRGBA(0x000000, 0.9f); //UIColorRGBA(0x191919, 0.9f);
|
|
}
|
|
|
|
+ (UIColor *)editorButtonSelectionBackgroundColor
|
|
{
|
|
return UIColorRGB(0xd1d1d1);
|
|
}
|
|
|
|
+ (UIImage *)cropIcon
|
|
{
|
|
return TGTintedImage([UIImage imageNamed:@"Editor/Crop"], [self toolbarIconColor]);
|
|
}
|
|
|
|
+ (UIImage *)toolsIcon
|
|
{
|
|
return TGTintedImage([UIImage imageNamed:@"Editor/Adjustments"], [self toolbarIconColor]);
|
|
}
|
|
|
|
+ (UIImage *)rotateIcon
|
|
{
|
|
return TGTintedImage([UIImage imageNamed:@"Editor/Rotate"], [self toolbarIconColor]);
|
|
}
|
|
|
|
+ (UIImage *)paintIcon
|
|
{
|
|
return TGTintedImage([UIImage imageNamed:@"Editor/BrushSelectedPen"], [self toolbarIconColor]);
|
|
}
|
|
|
|
+ (UIImage *)stickerIcon
|
|
{
|
|
return TGTintedImage([UIImage imageNamed:@"Editor/AddSticker"], [self toolbarIconColor]);
|
|
}
|
|
|
|
+ (UIImage *)textIcon
|
|
{
|
|
return TGTintedImage([UIImage imageNamed:@"Editor/AddText"], [self toolbarIconColor]);
|
|
}
|
|
|
|
+ (UIImage *)eraserIcon
|
|
{
|
|
return TGTintedImage([UIImage imageNamed:@"Editor/Eraser"], [self toolbarIconColor]);
|
|
}
|
|
|
|
+ (UIImage *)mirrorIcon
|
|
{
|
|
return TGTintedImage([UIImage imageNamed:@"Editor/Flip"], [self toolbarIconColor]);
|
|
}
|
|
|
|
+ (UIImage *)aspectRatioIcon
|
|
{
|
|
return TGTintedImage([UIImage imageNamed:@"Editor/AspectRatio"], [self toolbarIconColor]);
|
|
}
|
|
|
|
+ (UIImage *)aspectRatioActiveIcon
|
|
{
|
|
return TGTintedImage([UIImage imageNamed:@"Editor/AspectRatio"], [self accentColor]);
|
|
}
|
|
|
|
+ (UIImage *)tintIcon
|
|
{
|
|
return TGTintedImage([UIImage imageNamed:@"Editor/Tint"], [self toolbarIconColor]);
|
|
}
|
|
|
|
+ (UIImage *)blurIcon
|
|
{
|
|
return TGTintedImage([UIImage imageNamed:@"Editor/Blur"], [self toolbarIconColor]);
|
|
}
|
|
|
|
+ (UIImage *)curvesIcon
|
|
{
|
|
return TGTintedImage([UIImage imageNamed:@"Editor/Curves"], [self toolbarIconColor]);
|
|
}
|
|
|
|
+ (UIImage *)gifBackgroundImage
|
|
{
|
|
static dispatch_once_t onceToken;
|
|
static UIImage *muteBackground;
|
|
dispatch_once(&onceToken, ^
|
|
{
|
|
CGRect rect = CGRectMake(0, 0, 39.0f, 39.0f);
|
|
UIGraphicsBeginImageContextWithOptions(rect.size, false, 0);
|
|
CGContextRef context = UIGraphicsGetCurrentContext();
|
|
CGContextSetFillColorWithColor(context, UIColorRGBA(0x000000, 0.3f).CGColor);
|
|
CGContextFillEllipseInRect(context, CGRectInset(rect, 3, 3));
|
|
|
|
muteBackground = UIGraphicsGetImageFromCurrentImageContext();
|
|
UIGraphicsEndImageContext();
|
|
});
|
|
return muteBackground;
|
|
}
|
|
|
|
+ (UIImage *)muteIcon
|
|
{
|
|
return TGComponentsImageNamed(@"PhotoEditorMute.png");
|
|
}
|
|
|
|
+ (UIImage *)muteActiveIcon
|
|
{
|
|
return TGTintedImage([self gifIcon], [self accentColor]);
|
|
}
|
|
|
|
+ (UIImage *)telescopeIcon
|
|
{
|
|
return TGComponentsImageNamed(@"RecordVideoIconOverlay@2x.png");
|
|
}
|
|
|
|
+ (UIImage *)telescopeActiveIcon
|
|
{
|
|
return TGTintedImage(TGTintedImage([self telescopeIcon], [self toolbarIconColor]), [self accentColor]);
|
|
}
|
|
|
|
+ (UIImage *)gifIcon
|
|
{
|
|
return TGTintedImage([UIImage imageNamed:@"Editor/Gif"], [self toolbarIconColor]);
|
|
}
|
|
|
|
+ (UIImage *)gifActiveIcon
|
|
{
|
|
return TGTintedImage([UIImage imageNamed:@"Editor/Gif"], [self accentColor]);
|
|
}
|
|
|
|
+ (UIImage *)groupIcon
|
|
{
|
|
return TGTintedImage(TGComponentsImageNamed(@"PhotoEditorGroupPhotosIcon.png"), UIColorRGB(0x4cb4ff));
|
|
}
|
|
|
|
+ (UIImage *)ungroupIcon
|
|
{
|
|
return TGComponentsImageNamed(@"PhotoEditorGroupPhotosIcon.png");
|
|
}
|
|
|
|
+ (UIImage *)groupIconBackground
|
|
{
|
|
static dispatch_once_t onceToken;
|
|
static UIImage *backgroundImage;
|
|
dispatch_once(&onceToken, ^
|
|
{
|
|
UIGraphicsBeginImageContextWithOptions(CGSizeMake(38.0f, 38.0f), false, 0.0f);
|
|
CGContextRef context = UIGraphicsGetCurrentContext();
|
|
CGContextSetFillColorWithColor(context, UIColorRGBA(0x000000, 0.7f).CGColor);
|
|
|
|
CGContextFillEllipseInRect(context, CGRectMake(3.5f, 1.0f, 31.0f, 31.0f));
|
|
|
|
CGFloat lineWidth = 1.5f;
|
|
if (TGScreenScaling() == 3.0f)
|
|
lineWidth = 5.0f / 3.0f;
|
|
CGContextSetLineWidth(context, lineWidth);
|
|
CGContextSetStrokeColorWithColor(context, [UIColor whiteColor].CGColor);
|
|
CGContextStrokeEllipseInRect(context, CGRectMake(3.0f, 1.0f, 31.0f, 31.0f));
|
|
|
|
backgroundImage = [UIGraphicsGetImageFromCurrentImageContext() resizableImageWithCapInsets:UIEdgeInsetsMake(38.0f / 4.0f, 38.0f / 4.0f, 38.0f / 4.0f, 38.0f / 4.0f)];
|
|
UIGraphicsEndImageContext();
|
|
});
|
|
return backgroundImage;
|
|
}
|
|
|
|
+ (UIImage *)groupIconBackgroundActive
|
|
{
|
|
static dispatch_once_t onceToken;
|
|
static UIImage *backgroundImage;
|
|
dispatch_once(&onceToken, ^
|
|
{
|
|
UIGraphicsBeginImageContextWithOptions(CGSizeMake(38.0f, 38.0f), false, 0.0f);
|
|
CGContextRef context = UIGraphicsGetCurrentContext();
|
|
CGContextSetFillColorWithColor(context, UIColorRGBA(0x000000, 0.7f).CGColor);
|
|
|
|
CGContextFillEllipseInRect(context, CGRectMake(3.5f, 1.0f, 31.0f, 31.0f));
|
|
|
|
CGFloat lineWidth = 1.5f;
|
|
if (TGScreenScaling() == 3.0f)
|
|
lineWidth = 5.0f / 3.0f;
|
|
CGContextSetLineWidth(context, lineWidth);
|
|
CGContextSetStrokeColorWithColor(context, UIColorRGB(0x4cb4ff).CGColor);
|
|
CGContextStrokeEllipseInRect(context, CGRectMake(3.0f, 1.0f, 31.0f, 31.0f));
|
|
|
|
backgroundImage = [UIGraphicsGetImageFromCurrentImageContext() resizableImageWithCapInsets:UIEdgeInsetsMake(38.0f / 4.0f, 38.0f / 4.0f, 38.0f / 4.0f, 38.0f / 4.0f)];
|
|
UIGraphicsEndImageContext();
|
|
});
|
|
return backgroundImage;
|
|
}
|
|
|
|
+ (UIImage *)qualityIconForPreset:(TGMediaVideoConversionPreset)preset
|
|
{
|
|
CGFloat lineWidth = 2.0f - TGScreenPixel;
|
|
|
|
CGSize size = CGSizeMake(28.0f, 22.0f);
|
|
CGRect rect = CGRectInset(CGRectMake(0.0f, 0.0f, size.width, size.height), lineWidth / 2.0, lineWidth / 2.0);
|
|
UIGraphicsBeginImageContextWithOptions(size, false, 0.0f);
|
|
|
|
CGContextRef context = UIGraphicsGetCurrentContext();
|
|
|
|
UIBezierPath *path = [UIBezierPath bezierPathWithRoundedRect:rect cornerRadius:5.0f];
|
|
|
|
NSString *label = @"";
|
|
switch (preset)
|
|
{
|
|
case TGMediaVideoConversionPresetCompressedVeryLow:
|
|
label = @"240";
|
|
break;
|
|
|
|
case TGMediaVideoConversionPresetCompressedLow:
|
|
label = @"360";
|
|
break;
|
|
|
|
case TGMediaVideoConversionPresetCompressedMedium:
|
|
label = @"480";
|
|
break;
|
|
|
|
case TGMediaVideoConversionPresetCompressedHigh:
|
|
label = @"720";
|
|
break;
|
|
|
|
case TGMediaVideoConversionPresetCompressedVeryHigh:
|
|
label = @"HD";
|
|
break;
|
|
|
|
default:
|
|
label = @"480";
|
|
break;
|
|
}
|
|
|
|
CGContextAddPath(context, path.CGPath);
|
|
CGContextSetStrokeColorWithColor(context, [UIColor whiteColor].CGColor);
|
|
CGContextSetLineWidth(context, lineWidth);
|
|
CGContextStrokePath(context);
|
|
|
|
UIFont *font = [TGFont roundedFontOfSize:11];
|
|
#pragma clang diagnostic push
|
|
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
|
|
CGSize textSize = [label sizeWithFont:font];
|
|
[[UIColor whiteColor] setFill];
|
|
[label drawInRect:CGRectMake((size.width - textSize.width) / 2.0f + TGScreenPixel, 4.0f, textSize.width, textSize.height) withFont:font];
|
|
#pragma clang diagnostic pop
|
|
|
|
UIImage *result = UIGraphicsGetImageFromCurrentImageContext();
|
|
UIGraphicsEndImageContext();
|
|
|
|
return result;
|
|
}
|
|
|
|
+ (UIImage *)timerIconForValue:(NSInteger)value
|
|
{
|
|
if (value < FLT_EPSILON)
|
|
{
|
|
return TGComponentsImageNamed(@"PhotoEditorTimer0");
|
|
}
|
|
else
|
|
{
|
|
UIImage *background = TGComponentsImageNamed(@"PhotoEditorTimer");
|
|
|
|
UIGraphicsBeginImageContextWithOptions(background.size, false, 0.0f);
|
|
CGContextRef context = UIGraphicsGetCurrentContext();
|
|
[background drawAtPoint:CGPointZero];
|
|
|
|
CGContextSetBlendMode (context, kCGBlendModeSourceAtop);
|
|
CGContextSetFillColorWithColor(context, [self accentColor].CGColor);
|
|
CGContextFillRect(context, CGRectMake(0, 0, background.size.width, background.size.height));
|
|
|
|
CGContextSetBlendMode(context, kCGBlendModeNormal);
|
|
|
|
NSString *label = [NSString stringWithFormat:@"%ld", value];
|
|
|
|
UIFont *font = [TGFont roundedFontOfSize:11];
|
|
#pragma clang diagnostic push
|
|
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
|
|
CGSize size = [label sizeWithFont:font];
|
|
[label drawInRect:CGRectMake(floor(background.size.width - size.width) / 2.0f, 9.0f, size.width, size.height) withFont:font];
|
|
#pragma clang diagnostic pop
|
|
|
|
UIImage *result = UIGraphicsGetImageFromCurrentImageContext();
|
|
UIGraphicsEndImageContext();
|
|
|
|
return result;
|
|
}
|
|
}
|
|
|
|
+ (UIColor *)toolbarSelectedIconColor
|
|
{
|
|
return UIColorRGB(0x171717);
|
|
}
|
|
|
|
+ (UIColor *)toolbarAppliedIconColor
|
|
{
|
|
return [self accentColor];
|
|
}
|
|
|
|
+ (UIColor *)editorItemTitleColor
|
|
{
|
|
return UIColorRGB(0x808080);
|
|
}
|
|
|
|
+ (UIColor *)editorActiveItemTitleColor
|
|
{
|
|
return UIColorRGB(0xffffff);
|
|
}
|
|
|
|
+ (UIFont *)editorItemTitleFont
|
|
{
|
|
return [TGFont systemFontOfSize:14];
|
|
}
|
|
|
|
+ (UIColor *)filterSelectionColor
|
|
{
|
|
return [UIColor whiteColor];
|
|
}
|
|
|
|
+ (UIColor *)sliderBackColor
|
|
{
|
|
return UIColorRGBA(0x808080, 0.6f);
|
|
}
|
|
|
|
+ (UIColor *)sliderTrackColor
|
|
{
|
|
return UIColorRGB(0xcccccc);
|
|
}
|
|
|
|
+ (UIImage *)cameraIcon
|
|
{
|
|
static dispatch_once_t onceToken;
|
|
static UIImage *image;
|
|
dispatch_once(&onceToken, ^
|
|
{
|
|
UIGraphicsBeginImageContextWithOptions(CGSizeMake(30.0f, 30.0f), false, 0.0f);
|
|
CGContextRef context = UIGraphicsGetCurrentContext();
|
|
CGContextSetFillColorWithColor(context, UIColorRGBA(0x000000, 0.7f).CGColor);
|
|
|
|
UIBezierPath *path = [UIBezierPath bezierPathWithRoundedRect:CGRectMake(0.5f, 0.5f, 29.0f, 29.0f) cornerRadius:8.5f];
|
|
CGContextAddPath(context, path.CGPath);
|
|
CGContextFillPath(context);
|
|
|
|
[TGComponentsImageNamed(@"PhotoEditorCamera.png") drawAtPoint:CGPointZero];
|
|
|
|
image = UIGraphicsGetImageFromCurrentImageContext();
|
|
UIGraphicsEndImageContext();
|
|
});
|
|
|
|
return image;
|
|
}
|
|
|
|
@end
|