mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-16 11:20:18 +00:00
LegacyComponents: removed passcode UI and wallpaper related code
This commit is contained in:
parent
70fe1c00b1
commit
e036dbbef2
@ -310,10 +310,8 @@ apple_library(
|
||||
'LegacyComponents/TGPassportScanController.h',
|
||||
'LegacyComponents/TGPassportOCR.h',
|
||||
'LegacyComponents/TGPassportMRZ.h',
|
||||
'LegacyComponents/TGPasscodeEntryController.h',
|
||||
'LegacyComponents/TGPassportICloud.h',
|
||||
'LegacyComponents/TGEmbedPlayerView.h',
|
||||
'LegacyComponents/TGWallpaperInfo.h',
|
||||
'LegacyComponents/LegacyHTTPRequestOperation.h',
|
||||
|
||||
'LegacyComponents/TGAttachmentCarouselItemView.h',
|
||||
@ -342,14 +340,9 @@ apple_library(
|
||||
'LegacyComponents/TGTooltipView.h',
|
||||
|
||||
'LegacyComponents/TGCheckButtonView.h',
|
||||
'LegacyComponents/TGBuiltinWallpaperInfo.h',
|
||||
'LegacyComponents/TGRemoteWallpaperInfo.h',
|
||||
'LegacyComponents/TGColorWallpaperInfo.h',
|
||||
'LegacyComponents/TGCustomImageWallpaperInfo.h',
|
||||
'LegacyComponents/TGClipboardMenu.h',
|
||||
'LegacyComponents/TGImagePickerController.h',
|
||||
'LegacyComponents/TGLegacyCameraController.h',
|
||||
'LegacyComponents/TGWallpaperController.h',
|
||||
'LegacyComponents/TGProxyWindow.h',
|
||||
'LegacyComponents/TGIconSwitchView.h',
|
||||
|
||||
|
||||
@ -295,10 +295,8 @@ FOUNDATION_EXPORT const unsigned char LegacyComponentsVersionString[];
|
||||
#import <LegacyComponents/TGPassportScanController.h>
|
||||
#import <LegacyComponents/TGPassportOCR.h>
|
||||
#import <LegacyComponents/TGPassportMRZ.h>
|
||||
#import <LegacyComponents/TGPasscodeEntryController.h>
|
||||
#import <LegacyComponents/TGPassportICloud.h>
|
||||
#import <LegacyComponents/TGEmbedPlayerView.h>
|
||||
#import <LegacyComponents/TGWallpaperInfo.h>
|
||||
#import <LegacyComponents/TGMemoryImageCache.h>
|
||||
#import <LegacyComponents/LegacyHTTPRequestOperation.h>
|
||||
#import <LegacyComponents/LegacyComponentsAccessChecker.h>
|
||||
@ -329,13 +327,8 @@ FOUNDATION_EXPORT const unsigned char LegacyComponentsVersionString[];
|
||||
#import <LegacyComponents/TGTooltipView.h>
|
||||
|
||||
#import <LegacyComponents/TGCheckButtonView.h>
|
||||
#import <LegacyComponents/TGBuiltinWallpaperInfo.h>
|
||||
#import <LegacyComponents/TGRemoteWallpaperInfo.h>
|
||||
#import <LegacyComponents/TGColorWallpaperInfo.h>
|
||||
#import <LegacyComponents/TGCustomImageWallpaperInfo.h>
|
||||
#import <LegacyComponents/TGClipboardMenu.h>
|
||||
#import <LegacyComponents/TGImagePickerController.h>
|
||||
#import <LegacyComponents/TGLegacyCameraController.h>
|
||||
#import <LegacyComponents/TGWallpaperController.h>
|
||||
#import <LegacyComponents/TGProxyWindow.h>
|
||||
#import <LegacyComponents/TGIconSwitchView.h>
|
||||
|
||||
@ -9,7 +9,6 @@
|
||||
@protocol SDisposable;
|
||||
@class TGLocalization;
|
||||
@class UIViewController;
|
||||
@class TGWallpaperInfo;
|
||||
@class TGMemoryImageCache;
|
||||
@class TGImageMediaAttachment;
|
||||
@class TGNavigationBarPallete;
|
||||
@ -65,9 +64,6 @@ typedef enum {
|
||||
|
||||
- (id<SDisposable>)requestAudioSession:(TGAudioSessionType)type interrupted:(void (^)())interrupted;
|
||||
|
||||
- (TGWallpaperInfo *)currentWallpaperInfo;
|
||||
- (UIImage *)currentWallpaperImage;
|
||||
|
||||
- (SThreadPool *)sharedMediaImageProcessingThreadPool;
|
||||
- (TGMemoryImageCache *)sharedMediaMemoryImageCache;
|
||||
- (SSignal *)squarePhotoThumbnail:(TGImageMediaAttachment *)imageAttachment ofSize:(CGSize)size threadPool:(SThreadPool *)threadPool memoryCache:(TGMemoryImageCache *)memoryCache pixelProcessingBlock:(void (^)(void *, int, int, int))pixelProcessingBlock downloadLargeImage:(bool)downloadLargeImage placeholder:(SSignal *)placeholder;
|
||||
|
||||
@ -1,13 +0,0 @@
|
||||
#import <LegacyComponents/TGWallpaperInfo.h>
|
||||
|
||||
@interface TGBuiltinWallpaperInfo : TGWallpaperInfo
|
||||
|
||||
- (instancetype)initWithBuiltinId:(int)builtinId;
|
||||
- (instancetype)initWithBuiltinId:(int)builtinId tintColor:(int)tintColor systemAlpha:(CGFloat)systemAlpha buttonsAlpha:(CGFloat)buttonsAlpha highlightedButtonAlpha:(CGFloat)highlightedButtonAlpha progressAlpha:(CGFloat)progressAlpha version:(int32_t)version;
|
||||
|
||||
- (BOOL)isDefault;
|
||||
- (int32_t)version;
|
||||
|
||||
@end
|
||||
|
||||
extern const int32_t TGBuilitinWallpaperCurrentVersion;
|
||||
@ -1,140 +0,0 @@
|
||||
#import "TGBuiltinWallpaperInfo.h"
|
||||
|
||||
const int32_t TGBuilitinWallpaperCurrentVersion = 1;
|
||||
|
||||
@interface TGBuiltinWallpaperInfo ()
|
||||
{
|
||||
int _builtinId;
|
||||
int _tintColor;
|
||||
int32_t _version;
|
||||
|
||||
CGFloat _systemAlpha;
|
||||
CGFloat _buttonsAlpha;
|
||||
CGFloat _highlightedButtonAlpha;
|
||||
CGFloat _progressAlpha;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@implementation TGBuiltinWallpaperInfo
|
||||
|
||||
- (instancetype)initWithBuiltinId:(int)builtinId
|
||||
{
|
||||
return [self initWithBuiltinId:builtinId tintColor:0x000000 systemAlpha:0.25f buttonsAlpha:0.35f highlightedButtonAlpha:0.50f progressAlpha:0.35f version:1];
|
||||
}
|
||||
|
||||
- (instancetype)initWithBuiltinId:(int)builtinId tintColor:(int)tintColor systemAlpha:(CGFloat)systemAlpha buttonsAlpha:(CGFloat)buttonsAlpha highlightedButtonAlpha:(CGFloat)highlightedButtonAlpha progressAlpha:(CGFloat)progressAlpha version:(int32_t)version
|
||||
{
|
||||
self = [super init];
|
||||
if (self != nil)
|
||||
{
|
||||
_builtinId = builtinId;
|
||||
_tintColor = tintColor;
|
||||
_systemAlpha = systemAlpha;
|
||||
_buttonsAlpha = buttonsAlpha;
|
||||
_highlightedButtonAlpha = highlightedButtonAlpha;
|
||||
_progressAlpha = progressAlpha;
|
||||
_version = version;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (BOOL)isDefault
|
||||
{
|
||||
return _builtinId == 0;
|
||||
}
|
||||
|
||||
- (int32_t)version
|
||||
{
|
||||
return _version;
|
||||
}
|
||||
|
||||
- (NSString *)thumbnailUrl
|
||||
{
|
||||
return [[NSString alloc] initWithFormat:@"builtin-wallpaper://?id=%d&size=thumbnail", _builtinId];
|
||||
}
|
||||
|
||||
- (NSString *)fullscreenUrl
|
||||
{
|
||||
return [[NSString alloc] initWithFormat:@"builtin-wallpaper://?id=%d", _builtinId];
|
||||
}
|
||||
|
||||
- (int)tintColor
|
||||
{
|
||||
return _tintColor;
|
||||
}
|
||||
|
||||
- (CGFloat)systemAlpha
|
||||
{
|
||||
return _systemAlpha;
|
||||
}
|
||||
|
||||
- (CGFloat)buttonsAlpha
|
||||
{
|
||||
return _buttonsAlpha;
|
||||
}
|
||||
|
||||
- (CGFloat)highlightedButtonAlpha
|
||||
{
|
||||
return _highlightedButtonAlpha;
|
||||
}
|
||||
|
||||
- (CGFloat)progressAlpha
|
||||
{
|
||||
return _progressAlpha;
|
||||
}
|
||||
|
||||
- (UIImage *)image
|
||||
{
|
||||
NSString *filePath = [[NSBundle mainBundle] pathForResource:[[NSString alloc] initWithFormat:@"%@builtin-wallpaper-%d", [[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPad ? @"pad-" : @"", _builtinId] ofType:@"jpg"];
|
||||
|
||||
return [[UIImage alloc] initWithContentsOfFile:filePath];
|
||||
}
|
||||
|
||||
- (NSData *)imageData
|
||||
{
|
||||
NSString *filePath = [[NSBundle mainBundle] pathForResource:[[NSString alloc] initWithFormat:@"%@builtin-wallpaper-%d", [[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPad ? @"pad-" : @"", _builtinId] ofType:@"jpg"];
|
||||
|
||||
return [[NSData alloc] initWithContentsOfFile:filePath];
|
||||
}
|
||||
|
||||
- (bool)hasData
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
- (BOOL)isEqual:(id)object
|
||||
{
|
||||
if ([object isKindOfClass:[TGBuiltinWallpaperInfo class]])
|
||||
{
|
||||
if (((TGBuiltinWallpaperInfo *)object)->_builtinId == _builtinId &&
|
||||
((TGBuiltinWallpaperInfo *)object)->_tintColor == _tintColor &&
|
||||
((TGBuiltinWallpaperInfo *)object)->_version == _version)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
- (NSDictionary *)infoDictionary
|
||||
{
|
||||
return @{
|
||||
@"_className": NSStringFromClass([self class]),
|
||||
@"builtinId": @(_builtinId),
|
||||
@"tintColor": @(_tintColor),
|
||||
@"systemAlpha": @(_systemAlpha),
|
||||
@"buttonsAlpha": @(_buttonsAlpha),
|
||||
@"highlightedButtonAlpha": @(_highlightedButtonAlpha),
|
||||
@"progressAlpha": @(_progressAlpha),
|
||||
@"version": @(_version)
|
||||
};
|
||||
}
|
||||
|
||||
+ (TGWallpaperInfo *)infoWithDictionary:(NSDictionary *)dict
|
||||
{
|
||||
return [[TGBuiltinWallpaperInfo alloc] initWithBuiltinId:[dict[@"builtinId"] intValue] tintColor:[dict[@"tintColor"] intValue] systemAlpha:[dict[@"systemAlpha"] floatValue] buttonsAlpha:[dict[@"buttonsAlpha"] floatValue] highlightedButtonAlpha:[dict[@"highlightedButtonAlpha"] floatValue] progressAlpha:[dict[@"progressAlpha"] floatValue] version:[dict[@"version"] intValue]];
|
||||
}
|
||||
|
||||
@end
|
||||
@ -1,10 +0,0 @@
|
||||
#import <LegacyComponents/TGWallpaperInfo.h>
|
||||
|
||||
@interface TGColorWallpaperInfo : TGWallpaperInfo
|
||||
|
||||
@property (nonatomic, readonly) uint32_t color;
|
||||
|
||||
- (instancetype)initWithColor:(uint32_t)color;
|
||||
- (instancetype)initWithColor:(uint32_t)color tintColor:(int)tintColor systemAlpha:(CGFloat)systemAlpha buttonsAlpha:(CGFloat)buttonsAlpha highlightedButtonAlpha:(CGFloat)highlightedButtonAlpha progressAlpha:(CGFloat)progressAlpha;
|
||||
|
||||
@end
|
||||
@ -1,131 +0,0 @@
|
||||
#import "TGColorWallpaperInfo.h"
|
||||
|
||||
#import "LegacyComponentsInternal.h"
|
||||
|
||||
@interface TGColorWallpaperInfo ()
|
||||
{
|
||||
int _tintColor;
|
||||
|
||||
CGFloat _systemAlpha;
|
||||
CGFloat _buttonsAlpha;
|
||||
CGFloat _highlightedButtonAlpha;
|
||||
CGFloat _progressAlpha;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@implementation TGColorWallpaperInfo
|
||||
|
||||
- (instancetype)initWithColor:(uint32_t)color
|
||||
{
|
||||
return [self initWithColor:color tintColor:0x000000 systemAlpha:0.25f buttonsAlpha:0.35f highlightedButtonAlpha:0.50f progressAlpha:0.35f];
|
||||
}
|
||||
|
||||
- (instancetype)initWithColor:(uint32_t)color tintColor:(int)tintColor systemAlpha:(CGFloat)systemAlpha buttonsAlpha:(CGFloat)buttonsAlpha highlightedButtonAlpha:(CGFloat)highlightedButtonAlpha progressAlpha:(CGFloat)progressAlpha
|
||||
{
|
||||
self = [super init];
|
||||
if (self != nil)
|
||||
{
|
||||
_color = color;
|
||||
|
||||
_tintColor = tintColor;
|
||||
_systemAlpha = systemAlpha;
|
||||
_buttonsAlpha = buttonsAlpha;
|
||||
_highlightedButtonAlpha = highlightedButtonAlpha;
|
||||
_progressAlpha = progressAlpha;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (NSString *)thumbnailUrl
|
||||
{
|
||||
return [[NSString alloc] initWithFormat:@"color://?color=%d", (int)_color];
|
||||
}
|
||||
|
||||
- (NSString *)fullscreenUrl
|
||||
{
|
||||
return [self thumbnailUrl];
|
||||
}
|
||||
|
||||
- (int)tintColor
|
||||
{
|
||||
return _tintColor;
|
||||
}
|
||||
|
||||
- (CGFloat)systemAlpha
|
||||
{
|
||||
return _systemAlpha;
|
||||
}
|
||||
|
||||
- (CGFloat)buttonsAlpha
|
||||
{
|
||||
return _buttonsAlpha;
|
||||
}
|
||||
|
||||
- (CGFloat)highlightedButtonAlpha
|
||||
{
|
||||
return _highlightedButtonAlpha;
|
||||
}
|
||||
|
||||
- (CGFloat)progressAlpha
|
||||
{
|
||||
return _progressAlpha;
|
||||
}
|
||||
|
||||
- (UIImage *)image
|
||||
{
|
||||
UIGraphicsBeginImageContextWithOptions(CGSizeMake(1, 1), true, 0.0f);
|
||||
|
||||
CGContextRef context = UIGraphicsGetCurrentContext();
|
||||
CGContextSetFillColorWithColor(context, UIColorRGB(_color).CGColor);
|
||||
CGContextFillRect(context, CGRectMake(0.0f, 0.0f, 1.0f, 1.0f));
|
||||
|
||||
UIImage *image = UIGraphicsGetImageFromCurrentImageContext();
|
||||
UIGraphicsEndImageContext();
|
||||
|
||||
return image;
|
||||
}
|
||||
|
||||
- (NSData *)imageData
|
||||
{
|
||||
return nil;
|
||||
}
|
||||
|
||||
- (bool)hasData
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
- (BOOL)isEqual:(id)object
|
||||
{
|
||||
if ([object isKindOfClass:[TGColorWallpaperInfo class]])
|
||||
{
|
||||
if (((TGColorWallpaperInfo *)object)->_color == _color &&
|
||||
((TGColorWallpaperInfo *)object)->_tintColor == _tintColor)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
- (NSDictionary *)infoDictionary
|
||||
{
|
||||
return @{
|
||||
@"_className": NSStringFromClass([self class]),
|
||||
@"color": @(_color),
|
||||
@"tintColor": @(_tintColor),
|
||||
@"systemAlpha": @(_systemAlpha),
|
||||
@"buttonsAlpha": @(_buttonsAlpha),
|
||||
@"highlightedButtonAlpha": @(_highlightedButtonAlpha),
|
||||
@"progressAlpha": @(_progressAlpha)
|
||||
};
|
||||
}
|
||||
|
||||
+ (TGWallpaperInfo *)infoWithDictionary:(NSDictionary *)dict
|
||||
{
|
||||
return [[TGColorWallpaperInfo alloc] initWithColor:[dict[@"color"] intValue] tintColor:[dict[@"tintColor"] intValue] systemAlpha:[dict[@"systemAlpha"] floatValue] buttonsAlpha:[dict[@"buttonsAlpha"] floatValue] highlightedButtonAlpha:[dict[@"highlightedButtonAlpha"] floatValue] progressAlpha:[dict[@"progressAlpha"] floatValue]];
|
||||
}
|
||||
|
||||
@end
|
||||
@ -1,7 +0,0 @@
|
||||
#import <LegacyComponents/TGWallpaperInfo.h>
|
||||
|
||||
@interface TGCustomImageWallpaperInfo : TGWallpaperInfo
|
||||
|
||||
- (instancetype)initWithImage:(UIImage *)image;
|
||||
|
||||
@end
|
||||
@ -1,77 +0,0 @@
|
||||
|
||||
|
||||
#import "TGCustomImageWallpaperInfo.h"
|
||||
|
||||
@interface TGCustomImageWallpaperInfo ()
|
||||
{
|
||||
NSData *_imageData;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@implementation TGCustomImageWallpaperInfo
|
||||
|
||||
- (instancetype)initWithImage:(UIImage *)image
|
||||
{
|
||||
self = [super init];
|
||||
if (self != nil)
|
||||
{
|
||||
if (image != nil)
|
||||
_imageData = UIImageJPEGRepresentation(image, 0.98f);
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (NSString *)thumbnailUrl
|
||||
{
|
||||
return nil;
|
||||
}
|
||||
|
||||
- (NSString *)fullscreenUrl
|
||||
{
|
||||
return nil;
|
||||
}
|
||||
|
||||
- (int)tintColor
|
||||
{
|
||||
return 0x000000;
|
||||
}
|
||||
|
||||
- (UIImage *)image
|
||||
{
|
||||
return [[UIImage alloc] initWithData:_imageData];
|
||||
}
|
||||
|
||||
- (NSData *)imageData
|
||||
{
|
||||
return _imageData;
|
||||
}
|
||||
|
||||
- (bool)hasData
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
- (BOOL)isEqual:(id)object
|
||||
{
|
||||
if ([object isKindOfClass:[TGCustomImageWallpaperInfo class]])
|
||||
{
|
||||
return self == object;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
- (NSDictionary *)infoDictionary
|
||||
{
|
||||
return @{
|
||||
@"_className": NSStringFromClass([self class])
|
||||
};
|
||||
}
|
||||
|
||||
+ (TGWallpaperInfo *)infoWithDictionary:(NSDictionary *)__unused dict
|
||||
{
|
||||
return [[TGCustomImageWallpaperInfo alloc] initWithImage:nil];
|
||||
}
|
||||
|
||||
@end
|
||||
@ -1,5 +0,0 @@
|
||||
#import <LegacyComponents/TGPasscodeBackground.h>
|
||||
|
||||
@interface TGDefaultPasscodeBackground : NSObject <TGPasscodeBackground>
|
||||
|
||||
@end
|
||||
@ -1,79 +0,0 @@
|
||||
#import "TGDefaultPasscodeBackground.h"
|
||||
|
||||
#import "LegacyComponentsInternal.h"
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
@interface TGDefaultPasscodeBackground ()
|
||||
{
|
||||
CGSize _size;
|
||||
UIImage *_backgroundImage;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@implementation TGDefaultPasscodeBackground
|
||||
|
||||
- (instancetype)initWithSize:(CGSize)size
|
||||
{
|
||||
self = [super init];
|
||||
if (self != nil)
|
||||
{
|
||||
_size = size;
|
||||
|
||||
UIGraphicsBeginImageContextWithOptions(CGSizeMake(8.0f, _size.height), true, 0.0f);
|
||||
CGContextRef context = UIGraphicsGetCurrentContext();
|
||||
|
||||
CGColorRef colors[2] = {
|
||||
CGColorRetain(UIColorRGB(0x466f92).CGColor),
|
||||
CGColorRetain(UIColorRGB(0x244f74).CGColor)
|
||||
};
|
||||
|
||||
CFArrayRef colorsArray = CFArrayCreate(kCFAllocatorDefault, (const void **)&colors, 2, NULL);
|
||||
CGFloat locations[2] = {0.0f, 1.0f};
|
||||
|
||||
CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB();
|
||||
CGGradientRef gradient = CGGradientCreateWithColors(colorSpace, colorsArray, (CGFloat const *)&locations);
|
||||
|
||||
CFRelease(colorsArray);
|
||||
CFRelease(colors[0]);
|
||||
CFRelease(colors[1]);
|
||||
|
||||
CGColorSpaceRelease(colorSpace);
|
||||
|
||||
CGContextDrawLinearGradient(context, gradient, CGPointMake(0.0f, 0.0f), CGPointMake(0.0f, _size.height), 0);
|
||||
CGGradientRelease(gradient);
|
||||
|
||||
_backgroundImage = [UIGraphicsGetImageFromCurrentImageContext() resizableImageWithCapInsets:UIEdgeInsetsMake(0.0f, 0.0f, 0.0f, 0.0f) resizingMode:UIImageResizingModeTile];
|
||||
UIGraphicsEndImageContext();
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (CGSize)size
|
||||
{
|
||||
return _size;
|
||||
}
|
||||
|
||||
- (UIImage *)backgroundImage
|
||||
{
|
||||
return _backgroundImage;
|
||||
}
|
||||
|
||||
- (UIImage *)foregroundImage
|
||||
{
|
||||
static UIImage *image = nil;
|
||||
static dispatch_once_t onceToken;
|
||||
dispatch_once(&onceToken, ^
|
||||
{
|
||||
UIGraphicsBeginImageContextWithOptions(CGSizeMake(1.0f, 1.0f), false, 0.0f);
|
||||
CGContextRef context = UIGraphicsGetCurrentContext();
|
||||
CGContextSetFillColorWithColor(context, UIColorRGBA(0xffffff, 0.5f).CGColor);
|
||||
CGContextFillRect(context, CGRectMake(0.0f, 0.0f, 1.0f, 1.0f));
|
||||
image = UIGraphicsGetImageFromCurrentImageContext();
|
||||
UIGraphicsEndImageContext();
|
||||
});
|
||||
return image;
|
||||
}
|
||||
|
||||
@end
|
||||
@ -1,7 +0,0 @@
|
||||
#import "TGPasscodeBackground.h"
|
||||
|
||||
@interface TGImageBasedPasscodeBackground : NSObject <TGPasscodeBackground>
|
||||
|
||||
- (instancetype)initWithImage:(UIImage *)image size:(CGSize)size;
|
||||
|
||||
@end
|
||||
@ -1,53 +0,0 @@
|
||||
#import "TGImageBasedPasscodeBackground.h"
|
||||
|
||||
#import <LegacyComponents/TGImageBlur.h>
|
||||
|
||||
@interface TGImageBasedPasscodeBackground ()
|
||||
{
|
||||
CGSize _size;
|
||||
UIImage *_backgroundImage;
|
||||
UIImage *_foregroundImage;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@implementation TGImageBasedPasscodeBackground
|
||||
|
||||
- (instancetype)initWithSize:(CGSize)size
|
||||
{
|
||||
return [self initWithImage:nil size:size];
|
||||
}
|
||||
|
||||
- (instancetype)initWithImage:(UIImage *)image size:(CGSize)size
|
||||
{
|
||||
self = [super init];
|
||||
if (self != nil)
|
||||
{
|
||||
_size = size;
|
||||
|
||||
if (image != nil)
|
||||
{
|
||||
NSArray *images = TGBlurredBackgroundImages(image, size);
|
||||
_backgroundImage = images[0];
|
||||
_foregroundImage = images[1];
|
||||
}
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (CGSize)size
|
||||
{
|
||||
return _size;
|
||||
}
|
||||
|
||||
- (UIImage *)backgroundImage
|
||||
{
|
||||
return _backgroundImage;
|
||||
}
|
||||
|
||||
- (UIImage *)foregroundImage
|
||||
{
|
||||
return _foregroundImage;
|
||||
}
|
||||
|
||||
@end
|
||||
@ -1,12 +0,0 @@
|
||||
#import <Foundation/Foundation.h>
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
@protocol TGPasscodeBackground <NSObject>
|
||||
|
||||
- (instancetype)initWithSize:(CGSize)size;
|
||||
|
||||
- (CGSize)size;
|
||||
- (UIImage *)backgroundImage;
|
||||
- (UIImage *)foregroundImage;
|
||||
|
||||
@end
|
||||
@ -1,12 +0,0 @@
|
||||
#import <LegacyComponents/TGModernButton.h>
|
||||
|
||||
#import "TGPasscodeBackground.h"
|
||||
|
||||
@interface TGPasscodeButtonView : TGModernButton
|
||||
|
||||
- (void)setAbsoluteOffset:(CGPoint)absoluteOffset;
|
||||
|
||||
- (void)setTitle:(NSString *)title subtitle:(NSString *)subtitle;
|
||||
- (void)setBackground:(id<TGPasscodeBackground>)background;
|
||||
|
||||
@end
|
||||
@ -1,206 +0,0 @@
|
||||
#import "TGPasscodeButtonView.h"
|
||||
|
||||
#import "LegacyComponentsInternal.h"
|
||||
#import "TGFont.h"
|
||||
#import "POPAnimation.h"
|
||||
#import "POPBasicAnimation.h"
|
||||
#import "TGImageUtils.h"
|
||||
|
||||
@interface TGPasscodeButtonView ()
|
||||
{
|
||||
id<TGPasscodeBackground> _background;
|
||||
CGFloat _highlightAmount;
|
||||
|
||||
UIFont *_titleFont;
|
||||
NSString *_title;
|
||||
UIFont *_subtitleFont;
|
||||
NSString *_subtitle;
|
||||
|
||||
CGPoint _absoluteOffset;
|
||||
bool _highligted;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@implementation TGPasscodeButtonView
|
||||
|
||||
- (instancetype)initWithFrame:(CGRect)frame
|
||||
{
|
||||
self = [super initWithFrame:frame];
|
||||
if (self != nil)
|
||||
{
|
||||
self.opaque = false;
|
||||
self.backgroundColor = nil;
|
||||
self.modernHighlight = false;
|
||||
|
||||
CGFloat titleFontSize = 0.0f;
|
||||
CGFloat subtitleFontSize = 0.0f;
|
||||
|
||||
CGSize screenSize = [UIScreen mainScreen].bounds.size;
|
||||
if (screenSize.width > screenSize.height)
|
||||
{
|
||||
CGFloat tmp = screenSize.width;
|
||||
screenSize.width = screenSize.height;
|
||||
screenSize.height = tmp;
|
||||
}
|
||||
|
||||
if ((int)screenSize.height == 1024 || (int)screenSize.height == 1366)
|
||||
{
|
||||
titleFontSize = 38.0f;
|
||||
subtitleFontSize = 10.0f;
|
||||
}
|
||||
else
|
||||
{
|
||||
titleFontSize = 36.0f;
|
||||
subtitleFontSize = 9.0f;
|
||||
}
|
||||
|
||||
_titleFont = TGUltralightSystemFontOfSize(titleFontSize);
|
||||
_subtitleFont = TGMediumSystemFontOfSize(subtitleFontSize);
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)setTitle:(NSString *)title subtitle:(NSString *)subtitle
|
||||
{
|
||||
_title = title;
|
||||
_subtitle = subtitle;
|
||||
[self setNeedsDisplay];
|
||||
}
|
||||
|
||||
- (void)setBackground:(id<TGPasscodeBackground>)background
|
||||
{
|
||||
_background = background;
|
||||
[self setNeedsDisplay];
|
||||
}
|
||||
|
||||
- (void)setFrame:(CGRect)frame
|
||||
{
|
||||
bool needsDisplay = !CGSizeEqualToSize(frame.size, self.frame.size);
|
||||
[super setFrame:frame];
|
||||
if (needsDisplay)
|
||||
[self setNeedsDisplay];
|
||||
}
|
||||
|
||||
- (void)setAbsoluteOffset:(CGPoint)absoluteOffset
|
||||
{
|
||||
if (!CGPointEqualToPoint(_absoluteOffset, absoluteOffset))
|
||||
{
|
||||
_absoluteOffset = absoluteOffset;
|
||||
[self setNeedsDisplay];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)_setHighligtedAnimated:(bool)highlighted animated:(bool)animated
|
||||
{
|
||||
if (_highligted != highlighted)
|
||||
{
|
||||
_highligted = highlighted;
|
||||
|
||||
[self pop_removeAllAnimations];
|
||||
|
||||
if (animated && !highlighted)
|
||||
{
|
||||
POPBasicAnimation *animation = [POPBasicAnimation animation];
|
||||
animation.property = [POPMutableAnimatableProperty propertyWithName:@"highlightAmount" initializer:^(POPMutableAnimatableProperty *prop)
|
||||
{
|
||||
prop.readBlock = ^(TGPasscodeButtonView *view, CGFloat *values)
|
||||
{
|
||||
if (view != nil)
|
||||
values[0] = view->_highlightAmount;
|
||||
};
|
||||
|
||||
prop.writeBlock = ^(TGPasscodeButtonView *view, CGFloat const *values)
|
||||
{
|
||||
if (view != nil)
|
||||
{
|
||||
view->_highlightAmount = values[0];
|
||||
[view setNeedsDisplay];
|
||||
}
|
||||
};
|
||||
}];
|
||||
animation.duration = 0.5;
|
||||
animation.fromValue = @(_highlightAmount);
|
||||
animation.toValue = @((CGFloat)0.0f);
|
||||
[self pop_addAnimation:animation forKey:@"highlightAmount"];
|
||||
}
|
||||
else
|
||||
{
|
||||
_highlightAmount = highlighted ? 1.0f : 0.0f;
|
||||
[self setNeedsDisplay];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
- (void)drawRect:(CGRect)__unused rect
|
||||
{
|
||||
static CGFloat topOffset = 0.0f;
|
||||
static CGFloat subtitleOffset = 0.0f;
|
||||
static dispatch_once_t onceToken;
|
||||
dispatch_once(&onceToken, ^
|
||||
{
|
||||
CGSize screenSize = [UIScreen mainScreen].bounds.size;
|
||||
if (screenSize.width > screenSize.height)
|
||||
{
|
||||
CGFloat tmp = screenSize.width;
|
||||
screenSize.width = screenSize.height;
|
||||
screenSize.height = tmp;
|
||||
}
|
||||
|
||||
if ((int)screenSize.height == 1024 || (int)screenSize.height == 1366)
|
||||
{
|
||||
topOffset = 1.0f;
|
||||
subtitleOffset = 2.0f;
|
||||
}
|
||||
});
|
||||
|
||||
CGContextRef context = UIGraphicsGetCurrentContext();
|
||||
|
||||
CGSize size = self.bounds.size;
|
||||
|
||||
[[_background backgroundImage] drawInRect:CGRectMake(-_absoluteOffset.x, -_absoluteOffset.y, [_background size].width, [_background size].height) blendMode:kCGBlendModeCopy alpha:1.0f];
|
||||
|
||||
CGContextBeginPath(context);
|
||||
CGContextAddEllipseInRect(context, CGRectMake(0.0f, 0.0f, size.width, size.height));
|
||||
CGContextClip(context);
|
||||
|
||||
[[_background foregroundImage] drawInRect:CGRectMake(-_absoluteOffset.x, -_absoluteOffset.y, [_background size].width, [_background size].height) blendMode:kCGBlendModeNormal alpha:1.0f];
|
||||
|
||||
if (_highlightAmount < FLT_EPSILON)
|
||||
{
|
||||
CGContextSetBlendMode(context, kCGBlendModeCopy);
|
||||
CGContextSetFillColorWithColor(context, [UIColor clearColor].CGColor);
|
||||
CGContextFillEllipseInRect(context, CGRectMake(1.5f, 1.5f, size.width - 3.0f, size.height - 3.0f));
|
||||
}
|
||||
else if (_highlightAmount < 1.0f - FLT_EPSILON)
|
||||
{
|
||||
CGContextSetBlendMode(context, kCGBlendModeDestinationIn);
|
||||
CGContextSetFillColorWithColor(context, [UIColor colorWithWhite:0.0f alpha:_highlightAmount].CGColor);
|
||||
CGContextFillEllipseInRect(context, CGRectMake(1.5f, 1.5f, size.width - 3.0f, size.height - 3.0f));
|
||||
}
|
||||
|
||||
CGSize titleSize = [_title sizeWithFont:_titleFont];
|
||||
titleSize.width = CGCeil(titleSize.width);
|
||||
titleSize.height = CGCeil(titleSize.height);
|
||||
CGContextSetBlendMode(context, kCGBlendModeNormal);
|
||||
CGContextSetFillColorWithColor(context, [UIColor whiteColor].CGColor);
|
||||
CGContextSetStrokeColorWithColor(context, [UIColor whiteColor].CGColor);
|
||||
[_title drawAtPoint:CGPointMake(CGFloor((size.width - titleSize.width) / 2.0f), 8.0f + TGRetinaPixel + ([_title isEqualToString:@"0"] ? (7.0f - TGRetinaPixel) : 0.0f) + topOffset) withFont:_titleFont];
|
||||
|
||||
if (iosMajorVersion() >= 7)
|
||||
{
|
||||
NSDictionary *subtitleAttributes = @{NSFontAttributeName: _subtitleFont, NSForegroundColorAttributeName: [UIColor whiteColor], NSKernAttributeName: @(2.0f)};
|
||||
CGSize subtitleSize = [_subtitle sizeWithAttributes:subtitleAttributes];
|
||||
[_subtitle drawAtPoint:CGPointMake(CGFloor((size.width - subtitleSize.width) / 2.0f) + 1.0f, 48.0f - TGRetinaPixel + topOffset + subtitleOffset) withAttributes:subtitleAttributes];
|
||||
}
|
||||
else
|
||||
{
|
||||
CGSize subtitleSize = [_subtitle sizeWithFont:_subtitleFont];
|
||||
subtitleSize.width = CGCeil(subtitleSize.width);
|
||||
subtitleSize.height = CGCeil(subtitleSize.height);
|
||||
[_subtitle drawAtPoint:CGPointMake(CGFloor((size.width - subtitleSize.width) / 2.0f) + 1.0f, 48.0f - TGRetinaPixel + topOffset + subtitleOffset) withFont:_subtitleFont];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@end
|
||||
@ -1,48 +0,0 @@
|
||||
#import <LegacyComponents/TGViewController.h>
|
||||
#import <LegacyComponents/LegacyComponentsGlobals.h>
|
||||
|
||||
typedef enum {
|
||||
TGPasscodeEntryControllerModeVerifySimple,
|
||||
TGPasscodeEntryControllerModeVerifyComplex,
|
||||
TGPasscodeEntryControllerModeSetupSimple,
|
||||
TGPasscodeEntryControllerModeSetupComplex,
|
||||
TGPasscodeEntryControllerModeChangeSimpleToComplex,
|
||||
TGPasscodeEntryControllerModeChangeSimpleToSimple,
|
||||
TGPasscodeEntryControllerModeChangeComplexToSimple,
|
||||
TGPasscodeEntryControllerModeChangeComplexToComplex
|
||||
} TGPasscodeEntryControllerMode;
|
||||
|
||||
typedef enum {
|
||||
TGPasscodeEntryControllerStyleDefault,
|
||||
TGPasscodeEntryControllerStyleTranslucent
|
||||
} TGPasscodeEntryControllerStyle;
|
||||
|
||||
@interface TGPasscodeEntryAttemptData : NSObject
|
||||
|
||||
@property (nonatomic, readonly) NSInteger numberOfInvalidAttempts;
|
||||
@property (nonatomic, readonly) double dateOfLastInvalidAttempt;
|
||||
|
||||
- (instancetype)initWithNumberOfInvalidAttempts:(NSInteger)numberOfInvalidAttempts dateOfLastInvalidAttempt:(double)dateOfLastInvalidAttempt;
|
||||
|
||||
@end
|
||||
|
||||
@interface TGPasscodeEntryController : TGViewController
|
||||
|
||||
@property (nonatomic, copy) void (^completion)(NSString *);
|
||||
@property (nonatomic, copy) void (^touchIdCompletion)();
|
||||
@property (nonatomic, copy) bool (^checkCurrentPasscode)(NSString *);
|
||||
@property (nonatomic, copy) void (^updateAttemptData)(TGPasscodeEntryAttemptData *);
|
||||
@property (nonatomic) bool allowTouchId;
|
||||
|
||||
+ (void)setGlobalsProvider:(id<LegacyComponentsGlobalsProvider>)provider;
|
||||
|
||||
- (instancetype)initWithContext:(id<LegacyComponentsContext>)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;
|
||||
|
||||
- (NSInteger)invalidPasscodeAttempts;
|
||||
|
||||
- (void)prepareForAppear;
|
||||
- (void)prepareForDisappear;
|
||||
|
||||
@end
|
||||
@ -1,602 +0,0 @@
|
||||
#import "TGPasscodeEntryController.h"
|
||||
|
||||
#import "TGPasswordEntryView.h"
|
||||
|
||||
#import "TGStringUtils.h"
|
||||
|
||||
#import "TGTimerTarget.h"
|
||||
#import "TGObserverProxy.h"
|
||||
|
||||
#import <AudioToolbox/AudioToolbox.h>
|
||||
#import <LocalAuthentication/LocalAuthentication.h>
|
||||
|
||||
#import "LegacyComponentsInternal.h"
|
||||
|
||||
typedef enum {
|
||||
TGPasscodeEntryControllerSubmodeEnteringCurrent,
|
||||
TGPasscodeEntryControllerSubmodeEnteringNew,
|
||||
TGPasscodeEntryControllerSubmodeReenteringNew
|
||||
} TGPasscodeEntryControllerSubmode;
|
||||
|
||||
@implementation TGPasscodeEntryAttemptData
|
||||
|
||||
- (instancetype)initWithNumberOfInvalidAttempts:(NSInteger)numberOfInvalidAttempts dateOfLastInvalidAttempt:(double)dateOfLastInvalidAttempt {
|
||||
self = [super init];
|
||||
if (self != nil) {
|
||||
_numberOfInvalidAttempts = numberOfInvalidAttempts;
|
||||
_dateOfLastInvalidAttempt = dateOfLastInvalidAttempt;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@interface TGPasscodeEntryController ()
|
||||
{
|
||||
TGPasscodeEntryControllerStyle _style;
|
||||
TGPasscodeEntryControllerMode _mode;
|
||||
TGPasscodeEntryControllerSubmode _submode;
|
||||
bool _cancelEnabled;
|
||||
|
||||
NSString *_candidatePasscode;
|
||||
|
||||
TGPasswordEntryView *_view;
|
||||
|
||||
UIBarButtonItem *_nextItem;
|
||||
bool _usingTouchId;
|
||||
bool _alternativeMethodSelected;
|
||||
|
||||
NSTimer *_shouldWaitTimer;
|
||||
bool _keepStatusBarStyle;
|
||||
|
||||
TGPasscodeEntryAttemptData *_attemptData;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@implementation TGPasscodeEntryController
|
||||
|
||||
+ (void)setGlobalsProvider:(id<LegacyComponentsGlobalsProvider>)provider {
|
||||
[LegacyComponentsGlobals setProvider:provider];
|
||||
}
|
||||
|
||||
- (instancetype)initWithContext:(id<LegacyComponentsContext>)context style:(TGPasscodeEntryControllerStyle)style mode:(TGPasscodeEntryControllerMode)mode cancelEnabled:(bool)cancelEnabled allowTouchId:(bool)allowTouchId attemptData:(TGPasscodeEntryAttemptData *)attemptData completion:(void (^)(NSString *))completion
|
||||
{
|
||||
self = [super initWithContext:context];
|
||||
if (self != nil)
|
||||
{
|
||||
_style = style;
|
||||
_mode = mode;
|
||||
_completion = [completion copy];
|
||||
_allowTouchId = allowTouchId;
|
||||
_cancelEnabled = cancelEnabled;
|
||||
_keepStatusBarStyle = true;
|
||||
_attemptData = attemptData;
|
||||
|
||||
switch (_mode)
|
||||
{
|
||||
case TGPasscodeEntryControllerModeVerifySimple:
|
||||
case TGPasscodeEntryControllerModeVerifyComplex:
|
||||
{
|
||||
break;
|
||||
}
|
||||
case TGPasscodeEntryControllerModeSetupSimple:
|
||||
case TGPasscodeEntryControllerModeSetupComplex:
|
||||
{
|
||||
_submode = TGPasscodeEntryControllerSubmodeEnteringNew;
|
||||
|
||||
break;
|
||||
}
|
||||
case TGPasscodeEntryControllerModeChangeSimpleToSimple:
|
||||
case TGPasscodeEntryControllerModeChangeSimpleToComplex:
|
||||
case TGPasscodeEntryControllerModeChangeComplexToSimple:
|
||||
case TGPasscodeEntryControllerModeChangeComplexToComplex:
|
||||
{
|
||||
_submode = TGPasscodeEntryControllerSubmodeEnteringCurrent;
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
self.navigationBarShouldBeHidden = true;
|
||||
|
||||
if ([self invalidPasscodeAttempts] >= 6 && ![self shouldWaitBeforeAttempting])
|
||||
{
|
||||
[self resetInvalidPasscodeAttempts];
|
||||
}
|
||||
|
||||
[self resetMode:_mode];
|
||||
|
||||
_shouldWaitTimer = [TGTimerTarget scheduledMainThreadTimerWithTarget:self action:@selector(checkShouldWait) interval:1.0 repeat:true];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)dealloc
|
||||
{
|
||||
[_shouldWaitTimer invalidate];
|
||||
_shouldWaitTimer = nil;
|
||||
}
|
||||
|
||||
- (void)cancelPressed
|
||||
{
|
||||
if (_completion)
|
||||
_completion(nil);
|
||||
|
||||
[_view resignFirstResponder];
|
||||
}
|
||||
|
||||
- (void)nextPressed
|
||||
{
|
||||
[self passcodeEntered:[_view passcode]];
|
||||
}
|
||||
|
||||
- (UIStatusBarStyle)preferredStatusBarStyle
|
||||
{
|
||||
return _keepStatusBarStyle ? UIStatusBarStyleLightContent : UIStatusBarStyleDefault;
|
||||
}
|
||||
|
||||
- (TGPasswordEntryViewStyle)_passwordEntryViewStyleForStyle:(TGPasscodeEntryControllerStyle)style
|
||||
{
|
||||
switch (style)
|
||||
{
|
||||
case TGPasscodeEntryControllerStyleDefault:
|
||||
return TGPasswordEntryViewStyleDefault;
|
||||
case TGPasscodeEntryControllerStyleTranslucent:
|
||||
return TGPasswordEntryViewStyleTranslucent;
|
||||
}
|
||||
}
|
||||
|
||||
- (void)loadView
|
||||
{
|
||||
[super loadView];
|
||||
|
||||
self.view.backgroundColor = [UIColor whiteColor];
|
||||
|
||||
CGSize screenSize = self.view.frame.size;
|
||||
if ([UIDevice currentDevice].userInterfaceIdiom == UIUserInterfaceIdiomPhone)
|
||||
{
|
||||
screenSize = [UIScreen mainScreen].bounds.size;
|
||||
if (screenSize.width > screenSize.height)
|
||||
{
|
||||
CGFloat tmp = screenSize.width;
|
||||
screenSize.width = screenSize.height;
|
||||
screenSize.height = tmp;
|
||||
}
|
||||
}
|
||||
|
||||
_view = [[TGPasswordEntryView alloc] initWithFrame:CGRectMake(0.0f, 0.0f, screenSize.width, screenSize.height) style:[self _passwordEntryViewStyleForStyle:_style]];
|
||||
if ([UIDevice currentDevice].userInterfaceIdiom == UIUserInterfaceIdiomPad)
|
||||
_view.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
|
||||
__weak TGPasscodeEntryController *weakSelf = self;
|
||||
if (_cancelEnabled)
|
||||
{
|
||||
_view.cancel = ^
|
||||
{
|
||||
__strong TGPasscodeEntryController *strongSelf = weakSelf;
|
||||
if (strongSelf != nil)
|
||||
[strongSelf cancelPressed];
|
||||
};
|
||||
}
|
||||
_view.simplePasscodeEntered = ^
|
||||
{
|
||||
__strong TGPasscodeEntryController *strongSelf = weakSelf;
|
||||
if (strongSelf != nil)
|
||||
[strongSelf passcodeEntered:[strongSelf->_view passcode]];
|
||||
};
|
||||
_view.complexPasscodeEntered = ^
|
||||
{
|
||||
__strong TGPasscodeEntryController *strongSelf = weakSelf;
|
||||
if (strongSelf != nil)
|
||||
[strongSelf passcodeEntered:[strongSelf->_view passcode]];
|
||||
};
|
||||
_view.passcodeChanged = ^(NSString *passcode)
|
||||
{
|
||||
__strong TGPasscodeEntryController *strongSelf = weakSelf;
|
||||
if (strongSelf != nil)
|
||||
strongSelf->_nextItem.enabled = passcode.length != 0;
|
||||
};
|
||||
[self.view addSubview:_view];
|
||||
|
||||
[self resetMode:_mode];
|
||||
|
||||
[_view becomeFirstResponder];
|
||||
}
|
||||
|
||||
- (bool)supportsTouchId
|
||||
{
|
||||
if (iosMajorVersion() >= 8)
|
||||
{
|
||||
if ([[[LAContext alloc] init] canEvaluatePolicy:LAPolicyDeviceOwnerAuthenticationWithBiometrics error:nil])
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
- (void)willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration
|
||||
{
|
||||
[super willAnimateRotationToInterfaceOrientation:toInterfaceOrientation duration:duration];
|
||||
|
||||
/*if ([UIDevice currentDevice].userInterfaceIdiom == UIUserInterfaceIdiomPad)
|
||||
{
|
||||
UIView *snapshotView = [_view snapshotViewAfterScreenUpdates:false];
|
||||
snapshotView.frame = _view.frame;
|
||||
[self.view addSubview:snapshotView];
|
||||
[UIView animateWithDuration:duration animations:^
|
||||
{
|
||||
snapshotView.alpha = 0.0f;
|
||||
snapshotView.frame = (CGRect){CGPointZero, [self referenceViewSizeForOrientation:toInterfaceOrientation]};
|
||||
} completion:^(__unused BOOL finished)
|
||||
{
|
||||
[snapshotView removeFromSuperview];
|
||||
}];
|
||||
}*/
|
||||
}
|
||||
|
||||
- (void)viewWillAppear:(BOOL)animated
|
||||
{
|
||||
[super viewWillAppear:animated];
|
||||
}
|
||||
|
||||
- (void)viewWillDisappear:(BOOL)animated
|
||||
{
|
||||
[super viewWillDisappear:animated];
|
||||
}
|
||||
|
||||
- (void)prepareForAppear
|
||||
{
|
||||
[_view updateBackgroundIfNeeded];
|
||||
|
||||
_keepStatusBarStyle = true;
|
||||
if (iosMajorVersion() >= 7)
|
||||
[self setNeedsStatusBarAppearanceUpdate];
|
||||
|
||||
[_view becomeFirstResponder];
|
||||
}
|
||||
|
||||
- (void)prepareForDisappear
|
||||
{
|
||||
_keepStatusBarStyle = false;
|
||||
if (iosMajorVersion() >= 7)
|
||||
[self setNeedsStatusBarAppearanceUpdate];
|
||||
}
|
||||
|
||||
- (void)refreshTouchId
|
||||
{
|
||||
[_view resignFirstResponder];
|
||||
[_view becomeFirstResponder];
|
||||
|
||||
if (!_usingTouchId && !_alternativeMethodSelected && _allowTouchId && [self supportsTouchId] && _touchIdCompletion)
|
||||
{
|
||||
LAContext *context = [[LAContext alloc] init];
|
||||
|
||||
NSError *error = nil;
|
||||
if ([context canEvaluatePolicy:LAPolicyDeviceOwnerAuthenticationWithBiometrics error:&error])
|
||||
{
|
||||
_usingTouchId = true;
|
||||
[context evaluatePolicy:LAPolicyDeviceOwnerAuthenticationWithBiometrics localizedReason:TGLocalized(@"EnterPasscode.TouchId") reply:^(BOOL success, NSError *error)
|
||||
{
|
||||
if (error != nil)
|
||||
{
|
||||
TGDispatchOnMainThread(^
|
||||
{
|
||||
_usingTouchId = false;
|
||||
_alternativeMethodSelected = true;
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
if (success)
|
||||
{
|
||||
TGDispatchOnMainThread(^
|
||||
{
|
||||
_usingTouchId = false;
|
||||
if (_touchIdCompletion)
|
||||
_touchIdCompletion();
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
TGDispatchOnMainThread(^
|
||||
{
|
||||
_usingTouchId = false;
|
||||
});
|
||||
}
|
||||
}
|
||||
}];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
- (NSInteger)invalidPasscodeAttempts {
|
||||
return _attemptData.numberOfInvalidAttempts;
|
||||
}
|
||||
|
||||
- (void)addInvalidPasscodeAttempt {
|
||||
if (_attemptData == nil) {
|
||||
_attemptData = [[TGPasscodeEntryAttemptData alloc] initWithNumberOfInvalidAttempts:1 dateOfLastInvalidAttempt:CFAbsoluteTimeGetCurrent()];
|
||||
} else {
|
||||
_attemptData = [[TGPasscodeEntryAttemptData alloc] initWithNumberOfInvalidAttempts:_attemptData.numberOfInvalidAttempts + 1 dateOfLastInvalidAttempt:CFAbsoluteTimeGetCurrent()];
|
||||
}
|
||||
if (_updateAttemptData) {
|
||||
_updateAttemptData(_attemptData);
|
||||
}
|
||||
}
|
||||
|
||||
- (void)resetInvalidPasscodeAttempts {
|
||||
_attemptData = nil;
|
||||
if (_updateAttemptData) {
|
||||
_updateAttemptData(_attemptData);
|
||||
}
|
||||
}
|
||||
|
||||
- (bool)shouldWaitBeforeAttempting
|
||||
{
|
||||
if (_attemptData == nil || [self invalidPasscodeAttempts] < 6)
|
||||
return false;
|
||||
|
||||
NSTimeInterval invalidAttemptDate = _attemptData.dateOfLastInvalidAttempt;
|
||||
NSTimeInterval waitInterval = 60.0;
|
||||
|
||||
#ifdef DEBUG
|
||||
waitInterval = 5.0;
|
||||
#endif
|
||||
|
||||
return CFAbsoluteTimeGetCurrent() - invalidAttemptDate < waitInterval;
|
||||
}
|
||||
|
||||
- (NSTimeInterval)intervalSinceLastInvalidPasscodeAttempt
|
||||
{
|
||||
if (_attemptData == nil) {
|
||||
return 9999999.0;
|
||||
} else {
|
||||
return CFAbsoluteTimeGetCurrent() - _attemptData.dateOfLastInvalidAttempt;
|
||||
}
|
||||
}
|
||||
|
||||
- (void)checkShouldWait
|
||||
{
|
||||
if ([self invalidPasscodeAttempts] >= 6 && ![self shouldWaitBeforeAttempting])
|
||||
{
|
||||
[self resetInvalidPasscodeAttempts];
|
||||
}
|
||||
[_view setErrorTitle:[self currentErrorText]];
|
||||
}
|
||||
|
||||
- (NSString *)currentErrorText
|
||||
{
|
||||
NSInteger attemptCount = [self invalidPasscodeAttempts];
|
||||
if (attemptCount == 0)
|
||||
return @"";
|
||||
else if (attemptCount < 6)
|
||||
{
|
||||
NSString *format = [TGStringUtils integerValueFormat:@"PasscodeSettings.FailedAttempts_" value:attemptCount];
|
||||
return [[NSString alloc] initWithFormat:TGLocalized(format), [[NSString alloc] initWithFormat:@"%d",(int)attemptCount]];
|
||||
}
|
||||
else
|
||||
return TGLocalized(@"PasscodeSettings.TryAgainIn1Minute");
|
||||
}
|
||||
|
||||
- (void)resetMode:(TGPasscodeEntryControllerMode)mode
|
||||
{
|
||||
_candidatePasscode = nil;
|
||||
_mode = mode;
|
||||
|
||||
switch (_mode)
|
||||
{
|
||||
case TGPasscodeEntryControllerModeVerifySimple:
|
||||
case TGPasscodeEntryControllerModeVerifyComplex:
|
||||
{
|
||||
[_view setTitle:TGLocalized(@"EnterPasscode.EnterPasscode") errorTitle:[self currentErrorText] isComplex:_mode == TGPasscodeEntryControllerModeVerifyComplex animated:false];
|
||||
|
||||
if (_mode == TGPasscodeEntryControllerModeVerifySimple)
|
||||
{
|
||||
if (_cancelEnabled)
|
||||
{
|
||||
[self setRightBarButtonItem:[[UIBarButtonItem alloc] initWithTitle:TGLocalized(@"Common.Cancel") style:UIBarButtonItemStylePlain target:self action:@selector(cancelPressed)]];
|
||||
}
|
||||
}
|
||||
else if (_mode == TGPasscodeEntryControllerModeVerifyComplex)
|
||||
{
|
||||
if (_cancelEnabled)
|
||||
{
|
||||
[self setLeftBarButtonItem:[[UIBarButtonItem alloc] initWithTitle:TGLocalized(@"Common.Cancel") style:UIBarButtonItemStylePlain target:self action:@selector(cancelPressed)]];
|
||||
}
|
||||
_nextItem = [[UIBarButtonItem alloc] initWithTitle:TGLocalized(@"Common.Next") style:UIBarButtonItemStyleDone target:self action:@selector(nextPressed)];
|
||||
[self setRightBarButtonItem:_nextItem];
|
||||
_nextItem.enabled = false;
|
||||
}
|
||||
[_view setReturnKeyType:UIReturnKeyDone];
|
||||
break;
|
||||
}
|
||||
case TGPasscodeEntryControllerModeSetupSimple:
|
||||
case TGPasscodeEntryControllerModeSetupComplex:
|
||||
{
|
||||
[_view setTitle:TGLocalized(@"EnterPasscode.EnterNewPasscodeNew") errorTitle:[self currentErrorText] isComplex:_mode == TGPasscodeEntryControllerModeSetupComplex animated:false];
|
||||
|
||||
[self setLeftBarButtonItem:nil];
|
||||
[self setRightBarButtonItem:[[UIBarButtonItem alloc] initWithTitle:TGLocalized(@"Common.Cancel") style:UIBarButtonItemStylePlain target:self action:@selector(cancelPressed)]];
|
||||
[_view setReturnKeyType:UIReturnKeyNext];
|
||||
break;
|
||||
}
|
||||
case TGPasscodeEntryControllerModeChangeComplexToSimple:
|
||||
case TGPasscodeEntryControllerModeChangeComplexToComplex:
|
||||
case TGPasscodeEntryControllerModeChangeSimpleToSimple:
|
||||
case TGPasscodeEntryControllerModeChangeSimpleToComplex:
|
||||
{
|
||||
bool isComplex = _mode == TGPasscodeEntryControllerModeChangeComplexToSimple || _mode == TGPasscodeEntryControllerModeChangeComplexToComplex;
|
||||
[_view setTitle:TGLocalized(@"EnterPasscode.EnterCurrentPasscode") errorTitle:[self currentErrorText] isComplex:isComplex animated:false];
|
||||
|
||||
if (_mode == TGPasscodeEntryControllerModeChangeSimpleToSimple)
|
||||
{
|
||||
[self setRightBarButtonItem:[[UIBarButtonItem alloc] initWithTitle:TGLocalized(@"Common.Cancel") style:UIBarButtonItemStylePlain target:self action:@selector(cancelPressed)]];
|
||||
}
|
||||
else
|
||||
{
|
||||
[self setLeftBarButtonItem:[[UIBarButtonItem alloc] initWithTitle:TGLocalized(@"Common.Cancel") style:UIBarButtonItemStylePlain target:self action:@selector(cancelPressed)]];
|
||||
}
|
||||
|
||||
_nextItem = [[UIBarButtonItem alloc] initWithTitle:TGLocalized(@"Common.Next") style:UIBarButtonItemStyleDone target:self action:@selector(nextPressed)];
|
||||
if (_mode == TGPasscodeEntryControllerModeChangeComplexToSimple || _mode == TGPasscodeEntryControllerModeChangeComplexToComplex)
|
||||
{
|
||||
[self setRightBarButtonItem:_nextItem];
|
||||
}
|
||||
_nextItem.enabled = false;
|
||||
[_view setReturnKeyType:UIReturnKeyNext];
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
[_view becomeFirstResponder];
|
||||
}
|
||||
|
||||
- (void)passcodeEntered:(NSString *)passcode
|
||||
{
|
||||
if ([self shouldWaitBeforeAttempting])
|
||||
{
|
||||
AudioServicesPlaySystemSound(kSystemSoundID_Vibrate);
|
||||
[_view resetPasscode];
|
||||
return;
|
||||
}
|
||||
else if ([self invalidPasscodeAttempts] >= 6)
|
||||
{
|
||||
[self resetInvalidPasscodeAttempts];
|
||||
}
|
||||
|
||||
switch (_mode)
|
||||
{
|
||||
case TGPasscodeEntryControllerModeVerifySimple:
|
||||
case TGPasscodeEntryControllerModeVerifyComplex:
|
||||
{
|
||||
_alternativeMethodSelected = false;
|
||||
|
||||
if (_checkCurrentPasscode)
|
||||
{
|
||||
if (_checkCurrentPasscode(passcode))
|
||||
{
|
||||
[self resetInvalidPasscodeAttempts];
|
||||
|
||||
if (_completion)
|
||||
_completion(passcode);
|
||||
}
|
||||
else
|
||||
{
|
||||
[self addInvalidPasscodeAttempt];
|
||||
|
||||
[_view setTitle:TGLocalized(@"EnterPasscode.EnterPasscode") errorTitle:[self currentErrorText] isComplex:_mode == TGPasscodeEntryControllerModeVerifyComplex animated:false];
|
||||
|
||||
AudioServicesPlaySystemSound(kSystemSoundID_Vibrate);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (_completion)
|
||||
_completion(passcode);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
case TGPasscodeEntryControllerModeSetupSimple:
|
||||
case TGPasscodeEntryControllerModeSetupComplex:
|
||||
{
|
||||
switch (_submode)
|
||||
{
|
||||
case TGPasscodeEntryControllerSubmodeEnteringNew:
|
||||
{
|
||||
_candidatePasscode = passcode;
|
||||
_submode = TGPasscodeEntryControllerSubmodeReenteringNew;
|
||||
[_view setTitle:TGLocalized(@"EnterPasscode.RepeatNewPasscode") errorTitle:[self currentErrorText] isComplex:_mode == TGPasscodeEntryControllerModeSetupComplex animated:true];
|
||||
[_view setReturnKeyType:UIReturnKeyDone];
|
||||
break;
|
||||
}
|
||||
case TGPasscodeEntryControllerSubmodeReenteringNew:
|
||||
{
|
||||
if ([passcode isEqualToString:_candidatePasscode])
|
||||
{
|
||||
if (_completion)
|
||||
_completion(passcode);
|
||||
}
|
||||
else
|
||||
{
|
||||
AudioServicesPlaySystemSound(kSystemSoundID_Vibrate);
|
||||
_candidatePasscode = nil;
|
||||
_submode = TGPasscodeEntryControllerSubmodeEnteringNew;
|
||||
[_view setTitle:TGLocalized(@"EnterPasscode.EnterNewPasscodeNew") errorTitle:[self currentErrorText] isComplex:_mode == TGPasscodeEntryControllerModeSetupComplex animated:true];
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case TGPasscodeEntryControllerModeChangeSimpleToSimple:
|
||||
case TGPasscodeEntryControllerModeChangeSimpleToComplex:
|
||||
case TGPasscodeEntryControllerModeChangeComplexToSimple:
|
||||
case TGPasscodeEntryControllerModeChangeComplexToComplex:
|
||||
{
|
||||
switch (_submode)
|
||||
{
|
||||
case TGPasscodeEntryControllerSubmodeEnteringCurrent:
|
||||
{
|
||||
if (_checkCurrentPasscode && _checkCurrentPasscode(passcode))
|
||||
{
|
||||
[self resetInvalidPasscodeAttempts];
|
||||
|
||||
_candidatePasscode = nil;
|
||||
_submode = TGPasscodeEntryControllerSubmodeEnteringNew;
|
||||
[_view setTitle:TGLocalized(@"EnterPasscode.EnterNewPasscodeChange") errorTitle:[self currentErrorText] isComplex:_mode == TGPasscodeEntryControllerModeChangeSimpleToComplex || _mode == TGPasscodeEntryControllerModeChangeComplexToComplex animated:true];
|
||||
[_view setReturnKeyType:UIReturnKeyNext];
|
||||
|
||||
if (_mode == TGPasscodeEntryControllerModeChangeSimpleToComplex || _mode == TGPasscodeEntryControllerModeChangeComplexToComplex)
|
||||
[self setRightBarButtonItem:_nextItem];
|
||||
else
|
||||
[self setRightBarButtonItem:[[UIBarButtonItem alloc] initWithTitle:TGLocalized(@"Common.Cancel") style:UIBarButtonItemStylePlain target:self action:@selector(cancelPressed)]];
|
||||
}
|
||||
else
|
||||
{
|
||||
[self addInvalidPasscodeAttempt];
|
||||
|
||||
AudioServicesPlaySystemSound(kSystemSoundID_Vibrate);
|
||||
_candidatePasscode = nil;
|
||||
_submode = TGPasscodeEntryControllerSubmodeEnteringCurrent;
|
||||
[_view setTitle:TGLocalized(@"EnterPasscode.EnterCurrentPasscode") errorTitle:[self currentErrorText] isComplex:_mode == TGPasscodeEntryControllerModeChangeComplexToSimple || _mode == TGPasscodeEntryControllerModeChangeComplexToComplex animated:true];
|
||||
[_view setReturnKeyType:UIReturnKeyNext];
|
||||
}
|
||||
break;
|
||||
}
|
||||
case TGPasscodeEntryControllerSubmodeEnteringNew:
|
||||
{
|
||||
_candidatePasscode = passcode;
|
||||
_submode = TGPasscodeEntryControllerSubmodeReenteringNew;
|
||||
[_view setTitle:TGLocalized(@"EnterPasscode.RepeatNewPasscode") errorTitle:[self currentErrorText] isComplex:_mode == TGPasscodeEntryControllerModeChangeSimpleToComplex || _mode == TGPasscodeEntryControllerModeChangeComplexToComplex animated:true];
|
||||
[_view setReturnKeyType:UIReturnKeyDone];
|
||||
break;
|
||||
}
|
||||
case TGPasscodeEntryControllerSubmodeReenteringNew:
|
||||
{
|
||||
if ([_candidatePasscode isEqualToString:passcode])
|
||||
{
|
||||
if (_completion)
|
||||
_completion(passcode);
|
||||
}
|
||||
else
|
||||
{
|
||||
AudioServicesPlaySystemSound(kSystemSoundID_Vibrate);
|
||||
_candidatePasscode = nil;
|
||||
_submode = TGPasscodeEntryControllerSubmodeEnteringNew;
|
||||
[_view setTitle:TGLocalized(@"EnterPasscode.EnterNewPasscodeChange") errorTitle:[self currentErrorText] isComplex:_mode == TGPasscodeEntryControllerModeChangeSimpleToComplex || _mode == TGPasscodeEntryControllerModeChangeComplexToComplex animated:true];
|
||||
[_view setReturnKeyType:UIReturnKeyNext];
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@end
|
||||
@ -1,11 +0,0 @@
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
#import "TGPasscodeBackground.h"
|
||||
|
||||
@interface TGPasscodeEntryKeyboardView : UIView
|
||||
|
||||
@property (nonatomic, copy) void (^characterEntered)(NSString *);
|
||||
|
||||
- (void)setBackground:(id<TGPasscodeBackground>)background;
|
||||
|
||||
@end
|
||||
@ -1,216 +0,0 @@
|
||||
#import "TGPasscodeEntryKeyboardView.h"
|
||||
|
||||
#import <LegacyComponents/LegacyComponents.h>
|
||||
|
||||
#import "TGPasscodeButtonView.h"
|
||||
|
||||
@interface TGPasscodeEntryKeyboardView ()
|
||||
{
|
||||
id<TGPasscodeBackground> _background;
|
||||
|
||||
NSArray *_buttonViews;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@implementation TGPasscodeEntryKeyboardView
|
||||
|
||||
- (instancetype)initWithFrame:(CGRect)frame
|
||||
{
|
||||
self = [super initWithFrame:frame];
|
||||
if (self != nil)
|
||||
{
|
||||
[self _generateButtonViews];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (NSArray *)_buttonViewInfos
|
||||
{
|
||||
NSArray *infos = @[
|
||||
@[@"1", @""],
|
||||
@[@"2", @"ABC"],
|
||||
@[@"3", @"DEF"],
|
||||
@[@"4", @"GHI"],
|
||||
@[@"5", @"JKL"],
|
||||
@[@"6", @"MNO"],
|
||||
@[@"7", @"PQRS"],
|
||||
@[@"8", @"TUV"],
|
||||
@[@"9", @"WXYZ"],
|
||||
@[@"0", @""],
|
||||
];
|
||||
return infos;
|
||||
}
|
||||
|
||||
- (void)_generateButtonViews
|
||||
{
|
||||
NSArray *infos = [self _buttonViewInfos];
|
||||
|
||||
NSMutableArray *buttonViews = [[NSMutableArray alloc] init];
|
||||
for (NSArray *desc in infos)
|
||||
{
|
||||
TGPasscodeButtonView *buttonView = [[TGPasscodeButtonView alloc] init];
|
||||
[buttonView addTarget:self action:@selector(buttonTouchDown:) forControlEvents:UIControlEventTouchDown];
|
||||
[buttonView setTitle:desc[0] subtitle:desc[1]];
|
||||
[self addSubview:buttonView];
|
||||
[buttonViews addObject:buttonView];
|
||||
}
|
||||
|
||||
_buttonViews = buttonViews;
|
||||
[self _layoutButtons];
|
||||
}
|
||||
|
||||
- (void)buttonTouchDown:(TGPasscodeButtonView *)buttonView
|
||||
{
|
||||
NSArray *infos = [self _buttonViewInfos];
|
||||
NSUInteger buttonIndex = NSNotFound;
|
||||
for (NSUInteger index = 0; index < _buttonViews.count; index++)
|
||||
{
|
||||
if (buttonView == _buttonViews[index])
|
||||
{
|
||||
buttonIndex = index;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (buttonIndex != NSNotFound && buttonIndex < infos.count)
|
||||
{
|
||||
if (_characterEntered)
|
||||
_characterEntered(((NSArray *)infos[buttonIndex])[0]);
|
||||
}
|
||||
}
|
||||
|
||||
- (void)sizeToFit
|
||||
{
|
||||
CGSize size = CGSizeZero;
|
||||
|
||||
CGSize screenSize = [UIScreen mainScreen].bounds.size;
|
||||
if (screenSize.width > screenSize.height)
|
||||
{
|
||||
CGFloat tmp = screenSize.width;
|
||||
screenSize.width = screenSize.height;
|
||||
screenSize.height = tmp;
|
||||
}
|
||||
|
||||
if ((int)screenSize.height == 1024 || (int)screenSize.height == 1194 || (int)screenSize.height == 1366)
|
||||
size = CGSizeMake(293.0f, 384.0f);
|
||||
else if ((int)screenSize.height == 736)
|
||||
size = CGSizeMake(281.0f, 345.0f);
|
||||
else if ((int)screenSize.height == 667)
|
||||
size = CGSizeMake(281.0f, 345.0f);
|
||||
else if ((int)screenSize.height == 568)
|
||||
size = CGSizeMake(265.0f, 339.0f);
|
||||
else
|
||||
size = CGSizeMake(265.0f, 339.0f);
|
||||
|
||||
self.frame = (CGRect){self.frame.origin, size};
|
||||
}
|
||||
|
||||
- (void)setBackground:(id<TGPasscodeBackground>)background
|
||||
{
|
||||
_background = background;
|
||||
for (TGPasscodeButtonView *buttonView in _buttonViews)
|
||||
{
|
||||
[buttonView setBackground:background];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)setFrame:(CGRect)frame
|
||||
{
|
||||
[super setFrame:frame];
|
||||
|
||||
for (TGPasscodeButtonView *buttonView in _buttonViews)
|
||||
{
|
||||
[buttonView setAbsoluteOffset:CGPointMake(frame.origin.x + buttonView.frame.origin.x, frame.origin.y + buttonView.frame.origin.y)];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)_layoutButtons
|
||||
{
|
||||
CGFloat buttonSize = 0.0f;
|
||||
CGFloat horizontalSecond = 0.0f;
|
||||
CGFloat horizontalThird = 0.0f;
|
||||
CGFloat verticalSecond = 0.0f;
|
||||
CGFloat verticalThird = 0.0f;
|
||||
CGFloat verticalFourth = 0.0f;
|
||||
|
||||
CGSize screenSize = [UIScreen mainScreen].bounds.size;
|
||||
if (screenSize.width > screenSize.height)
|
||||
{
|
||||
CGFloat tmp = screenSize.width;
|
||||
screenSize.width = screenSize.height;
|
||||
screenSize.height = tmp;
|
||||
}
|
||||
|
||||
if ((int)screenSize.height == 1024 || (int)screenSize.height == 1194 || (int)screenSize.height == 1366)
|
||||
{
|
||||
buttonSize = 81.0f;
|
||||
horizontalSecond = 106.0f;
|
||||
horizontalThird = 212.0f;
|
||||
verticalSecond = 100.0f + TGRetinaPixel;
|
||||
verticalThird = 202.0f;
|
||||
verticalFourth = 303.0f;
|
||||
}
|
||||
else if ((int)screenSize.height == 736)
|
||||
{
|
||||
buttonSize = 75.0f;
|
||||
horizontalSecond = 103.5f;
|
||||
horizontalThird = 206.0f;
|
||||
verticalSecond = 90.0f;
|
||||
verticalThird = 180.0f;
|
||||
verticalFourth = 270.0f;
|
||||
}
|
||||
else if ((int)screenSize.height == 667)
|
||||
{
|
||||
buttonSize = 75.0f;
|
||||
horizontalSecond = 103.5f;
|
||||
horizontalThird = 206.0f;
|
||||
verticalSecond = 90.0f;
|
||||
verticalThird = 180.0f;
|
||||
verticalFourth = 270.0f;
|
||||
}
|
||||
else if ((int)screenSize.height == 568)
|
||||
{
|
||||
buttonSize = 75.0f;
|
||||
horizontalSecond = 95.0f;
|
||||
horizontalThird = 190.0f;
|
||||
verticalSecond = 88.0f;
|
||||
verticalThird = 176.0f;
|
||||
verticalFourth = 264.0f;
|
||||
}
|
||||
else
|
||||
{
|
||||
buttonSize = 75.0f;
|
||||
horizontalSecond = 95.0f;
|
||||
horizontalThird = 190.0f;
|
||||
verticalSecond = 88.0f;
|
||||
verticalThird = 176.0f;
|
||||
verticalFourth = 264.0f;
|
||||
}
|
||||
|
||||
for (NSUInteger i = 0; i < _buttonViews.count; i++)
|
||||
{
|
||||
CGPoint position = CGPointZero;
|
||||
if (i % 3 == 0)
|
||||
position.x = 0.0f;
|
||||
else if (i % 3 == 1)
|
||||
position.x = horizontalSecond;
|
||||
else
|
||||
position.x = horizontalThird;
|
||||
|
||||
if (i / 3 == 0)
|
||||
position.y = 0.0f;
|
||||
else if (i / 3 == 1)
|
||||
position.y = verticalSecond;
|
||||
else if (i / 3 == 2)
|
||||
position.y = verticalThird;
|
||||
else if (i / 3 == 3)
|
||||
{
|
||||
position.x = horizontalSecond;
|
||||
position.y = verticalFourth;
|
||||
}
|
||||
|
||||
[(TGPasscodeButtonView *)_buttonViews[i] setFrame:CGRectMake(position.x, position.y, buttonSize, buttonSize)];
|
||||
}
|
||||
}
|
||||
|
||||
@end
|
||||
@ -1,14 +0,0 @@
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
#import "TGPasscodeBackground.h"
|
||||
|
||||
@interface TGPasscodePinDotView : UIView
|
||||
|
||||
@property (nonatomic) bool filled;
|
||||
|
||||
- (void)setFilled:(bool)filled animated:(bool)animated;
|
||||
|
||||
- (void)setBackground:(id<TGPasscodeBackground>)background;
|
||||
- (void)setAbsoluteOffset:(CGPoint)absoluteOffset;
|
||||
|
||||
@end
|
||||
@ -1,89 +0,0 @@
|
||||
#import "TGPasscodePinDotView.h"
|
||||
|
||||
@interface TGPasscodePinDotView ()
|
||||
{
|
||||
id<TGPasscodeBackground> _background;
|
||||
CGPoint _absoluteOffset;
|
||||
bool _filled;
|
||||
CGFloat _fillAmount;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@implementation TGPasscodePinDotView
|
||||
|
||||
- (instancetype)initWithFrame:(CGRect)frame
|
||||
{
|
||||
self = [super initWithFrame:frame];
|
||||
if (self != nil)
|
||||
{
|
||||
self.opaque = false;
|
||||
self.backgroundColor = nil;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (bool)filled
|
||||
{
|
||||
return _filled;
|
||||
}
|
||||
|
||||
- (void)setFilled:(bool)filled
|
||||
{
|
||||
[self setFilled:filled animated:false];
|
||||
}
|
||||
|
||||
- (void)setFilled:(bool)filled animated:(bool)__unused animated
|
||||
{
|
||||
if (_filled != filled)
|
||||
{
|
||||
_filled = filled;
|
||||
_fillAmount = _filled ? 1.0f : 0.0f;
|
||||
[self setNeedsDisplay];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)setBackground:(id<TGPasscodeBackground>)background
|
||||
{
|
||||
_background = background;
|
||||
[self setNeedsDisplay];
|
||||
}
|
||||
|
||||
- (void)setAbsoluteOffset:(CGPoint)absoluteOffset
|
||||
{
|
||||
if (!CGPointEqualToPoint(_absoluteOffset, absoluteOffset))
|
||||
{
|
||||
_absoluteOffset = absoluteOffset;
|
||||
[self setNeedsDisplay];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)drawRect:(CGRect)__unused rect
|
||||
{
|
||||
CGSize size = self.bounds.size;
|
||||
|
||||
CGContextRef context = UIGraphicsGetCurrentContext();
|
||||
|
||||
[[_background backgroundImage] drawInRect:CGRectMake(-_absoluteOffset.x, -_absoluteOffset.y, [_background size].width, [_background size].height) blendMode:kCGBlendModeCopy alpha:1.0f];
|
||||
|
||||
CGContextBeginPath(context);
|
||||
CGContextAddEllipseInRect(context, CGRectMake(0.0f, 0.0f, size.width, size.height));
|
||||
CGContextClip(context);
|
||||
|
||||
[[_background foregroundImage] drawInRect:CGRectMake(-_absoluteOffset.x, -_absoluteOffset.y, [_background size].width, [_background size].height) blendMode:kCGBlendModeNormal alpha:1.0f];
|
||||
|
||||
if (_fillAmount < FLT_EPSILON)
|
||||
{
|
||||
CGContextSetBlendMode(context, kCGBlendModeCopy);
|
||||
CGContextSetFillColorWithColor(context, [UIColor clearColor].CGColor);
|
||||
CGContextFillEllipseInRect(context, CGRectMake(1.0f, 1.0f, size.width - 2.0f, size.height - 2.0f));
|
||||
}
|
||||
else if (_fillAmount < 1.0f - FLT_EPSILON)
|
||||
{
|
||||
CGContextSetBlendMode(context, kCGBlendModeDestinationIn);
|
||||
CGContextSetFillColorWithColor(context, [UIColor colorWithWhite:0.0f alpha:_fillAmount].CGColor);
|
||||
CGContextFillEllipseInRect(context, CGRectMake(1.0f, 1.0f, size.width - 2.0f, size.height - 2.0f));
|
||||
}
|
||||
}
|
||||
|
||||
@end
|
||||
@ -1,11 +0,0 @@
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
#import "TGPasscodeBackground.h"
|
||||
|
||||
@interface TGPasscodePinView : UIView
|
||||
|
||||
- (void)setBackground:(id<TGPasscodeBackground>)background;
|
||||
|
||||
- (void)setCharacterCount:(NSUInteger)characterCount maxCharacterCount:(NSUInteger)maxCharacterCount;
|
||||
|
||||
@end
|
||||
@ -1,224 +0,0 @@
|
||||
#import "TGPasscodePinView.h"
|
||||
|
||||
#import "LegacyComponentsInternal.h"
|
||||
|
||||
#import "TGPasscodePinDotView.h"
|
||||
|
||||
@interface TGPasscodePinView ()
|
||||
{
|
||||
id<TGPasscodeBackground> _background;
|
||||
NSArray *_dotViews;
|
||||
NSUInteger _maxCharacterCount;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@implementation TGPasscodePinView
|
||||
|
||||
- (instancetype)initWithFrame:(CGRect)frame
|
||||
{
|
||||
self = [super initWithFrame:frame];
|
||||
if (self != nil)
|
||||
{
|
||||
self.opaque = false;
|
||||
self.backgroundColor = nil;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)setBackground:(id<TGPasscodeBackground>)background
|
||||
{
|
||||
_background = background;
|
||||
for (TGPasscodePinDotView *dotView in _dotViews)
|
||||
{
|
||||
[dotView setBackground:_background];
|
||||
}
|
||||
[self setNeedsDisplay];
|
||||
}
|
||||
|
||||
- (void)setCharacterCount:(NSUInteger)characterCount maxCharacterCount:(NSUInteger)maxCharacterCount
|
||||
{
|
||||
if (_maxCharacterCount != maxCharacterCount)
|
||||
[self setNeedsDisplay];
|
||||
|
||||
NSUInteger displayLimit = 0;
|
||||
|
||||
CGSize screenSize = [UIScreen mainScreen].bounds.size;
|
||||
if (screenSize.width > screenSize.height)
|
||||
{
|
||||
CGFloat tmp = screenSize.width;
|
||||
screenSize.width = screenSize.height;
|
||||
screenSize.height = tmp;
|
||||
}
|
||||
|
||||
if ((int)screenSize.height == 1024 || (int)screenSize.height == 1366)
|
||||
displayLimit = 22;
|
||||
else if ((int)screenSize.height == 736)
|
||||
displayLimit = 26;
|
||||
else if ((int)screenSize.height == 667)
|
||||
displayLimit = 23;
|
||||
else if ((int)screenSize.height == 568)
|
||||
displayLimit = 19;
|
||||
else
|
||||
displayLimit = 19;
|
||||
|
||||
_maxCharacterCount = maxCharacterCount;
|
||||
NSUInteger dotCount = MIN(displayLimit, MAX(characterCount, maxCharacterCount));
|
||||
|
||||
NSMutableArray *dotViews = [[NSMutableArray alloc] initWithArray:_dotViews];
|
||||
|
||||
while (dotViews.count > dotCount)
|
||||
{
|
||||
TGPasscodePinDotView *dotView = dotViews.lastObject;
|
||||
[dotView removeFromSuperview];
|
||||
[dotViews removeLastObject];
|
||||
}
|
||||
|
||||
for (NSUInteger i = dotViews.count; i < dotCount; i++)
|
||||
{
|
||||
TGPasscodePinDotView *dotView = [[TGPasscodePinDotView alloc] init];
|
||||
[dotView setBackground:_background];
|
||||
[self addSubview:dotView];
|
||||
[dotViews addObject:dotView];
|
||||
}
|
||||
|
||||
for (NSUInteger i = 0; i < dotViews.count; i++)
|
||||
{
|
||||
TGPasscodePinDotView *dotView = dotViews[i];
|
||||
[dotView setFilled:maxCharacterCount == 0 || i < characterCount];
|
||||
}
|
||||
|
||||
_dotViews = dotViews;
|
||||
|
||||
[self _layoutDots];
|
||||
}
|
||||
|
||||
- (void)setFrame:(CGRect)frame
|
||||
{
|
||||
bool needsDotsLayout = !CGPointEqualToPoint(self.frame.origin, frame.origin);
|
||||
[super setFrame:frame];
|
||||
if (needsDotsLayout)
|
||||
{
|
||||
[self _layoutDots];
|
||||
[self setNeedsDisplay];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)_layoutDots
|
||||
{
|
||||
CGFloat dotSimpleSize = 0.0f;
|
||||
CGFloat dotComplexSize = 0.0f;
|
||||
CGFloat dotSimpleSpacing = 0.0f;
|
||||
CGFloat dotComplexSpacing = 0.0f;
|
||||
|
||||
CGSize screenSize = [UIScreen mainScreen].bounds.size;
|
||||
if (screenSize.width > screenSize.height)
|
||||
{
|
||||
CGFloat tmp = screenSize.width;
|
||||
screenSize.width = screenSize.height;
|
||||
screenSize.height = tmp;
|
||||
}
|
||||
|
||||
if ((int)screenSize.height == 1024 || (int)screenSize.height == 1366)
|
||||
{
|
||||
dotSimpleSize = 16.0f;
|
||||
dotComplexSize = 7.0f;
|
||||
dotSimpleSpacing = 27.0f;
|
||||
dotComplexSpacing = 7.0f;
|
||||
}
|
||||
else if ((int)screenSize.height == 736)
|
||||
{
|
||||
dotSimpleSize = 13.0f;
|
||||
dotComplexSize = 7.0f;
|
||||
dotSimpleSpacing = 24.0f;
|
||||
dotComplexSpacing = 7.0f;
|
||||
}
|
||||
else if ((int)screenSize.height == 667)
|
||||
{
|
||||
dotSimpleSize = 13.0f;
|
||||
dotComplexSize = 7.0f;
|
||||
dotSimpleSpacing = 24.0f;
|
||||
dotComplexSpacing = 7.0f;
|
||||
}
|
||||
else if ((int)screenSize.height == 568)
|
||||
{
|
||||
dotSimpleSize = 13.0f;
|
||||
dotComplexSize = 7.0f;
|
||||
dotSimpleSpacing = 24.0f;
|
||||
dotComplexSpacing = 7.0f;
|
||||
}
|
||||
else
|
||||
{
|
||||
dotSimpleSize = 13.0f;
|
||||
dotComplexSize = 7.0f;
|
||||
dotSimpleSpacing = 24.0f;
|
||||
dotComplexSpacing = 7.0f;
|
||||
}
|
||||
|
||||
CGFloat dotSize = _maxCharacterCount == 0 ? dotComplexSize : dotSimpleSize;
|
||||
CGFloat spacing = _maxCharacterCount == 0 ? dotComplexSpacing : dotSimpleSpacing;
|
||||
CGFloat dotsWidth = _dotViews.count * dotSize + (_dotViews.count == 0 ? 0.0f : ((_dotViews.count - 1) * spacing));
|
||||
CGPoint dotsPosition = CGPointMake(CGFloor((self.frame.size.width - dotsWidth) / 2.0f), CGFloor((self.frame.size.height - dotSize) / 2.0f));
|
||||
NSUInteger index = 0;
|
||||
for (TGPasscodePinDotView *dotView in _dotViews)
|
||||
{
|
||||
dotView.frame = CGRectMake(dotsPosition.x + index * (dotSize + spacing), dotsPosition.y, dotSize, dotSize);
|
||||
[dotView setAbsoluteOffset:CGPointMake(self.frame.origin.x + dotView.frame.origin.x, self.frame.origin.y + dotView.frame.origin.y)];
|
||||
index++;
|
||||
}
|
||||
}
|
||||
|
||||
- (void)layoutSubviews
|
||||
{
|
||||
[super layoutSubviews];
|
||||
|
||||
[self _layoutDots];
|
||||
}
|
||||
|
||||
- (void)drawRect:(CGRect)__unused rect
|
||||
{
|
||||
CGContextRef context = UIGraphicsGetCurrentContext();
|
||||
CGSize size = self.bounds.size;
|
||||
|
||||
[[_background backgroundImage] drawInRect:CGRectMake(-self.frame.origin.x, -self.frame.origin.y, [_background size].width, [_background size].height) blendMode:kCGBlendModeCopy alpha:1.0f];
|
||||
|
||||
if (_maxCharacterCount == 0)
|
||||
{
|
||||
CGFloat padding = 0.0f;
|
||||
CGFloat lineWidth = 1.0f;
|
||||
CGFloat radius = 5.0f;
|
||||
|
||||
CGContextBeginPath(context);
|
||||
CGContextMoveToPoint(context, padding, radius);
|
||||
CGContextAddArcToPoint(context, padding, 0.0f, padding + radius, 0.0f, radius);
|
||||
CGContextAddLineToPoint(context, size.width - padding - radius, 0.0f);
|
||||
CGContextAddArcToPoint(context, size.width - padding, 0.0f, size.width - padding, radius, radius);
|
||||
CGContextAddLineToPoint(context, size.width - padding, size.height - radius);
|
||||
CGContextAddArcToPoint(context, size.width - padding, size.height, size.width - padding - radius, size.height, radius);
|
||||
CGContextAddLineToPoint(context, padding + radius, size.height);
|
||||
CGContextAddArcToPoint(context, padding, size.height, padding, size.height - radius, radius);
|
||||
CGContextClosePath(context);
|
||||
CGContextClip(context);
|
||||
|
||||
[[_background foregroundImage] drawInRect:CGRectMake(-self.frame.origin.x, -self.frame.origin.y, [_background size].width, [_background size].height) blendMode:kCGBlendModeNormal alpha:1.0f];
|
||||
|
||||
radius = 4.0f;
|
||||
|
||||
CGContextBeginPath(context);
|
||||
CGContextMoveToPoint(context, padding + lineWidth, radius + lineWidth);
|
||||
CGContextAddArcToPoint(context, padding + lineWidth, lineWidth, padding + radius + lineWidth, lineWidth, radius);
|
||||
CGContextAddLineToPoint(context, size.width - padding - radius - lineWidth, lineWidth);
|
||||
CGContextAddArcToPoint(context, size.width - padding - lineWidth, lineWidth, size.width - padding - lineWidth, radius + lineWidth, radius);
|
||||
CGContextAddLineToPoint(context, size.width - padding - lineWidth, size.height - radius - lineWidth);
|
||||
CGContextAddArcToPoint(context, size.width - padding - lineWidth, size.height - lineWidth, size.width - padding - radius - lineWidth, size.height - lineWidth, radius);
|
||||
CGContextAddLineToPoint(context, padding + radius + lineWidth, size.height - lineWidth);
|
||||
CGContextAddArcToPoint(context, padding + lineWidth, size.height - lineWidth, padding + lineWidth, size.height - radius - lineWidth, radius);
|
||||
CGContextClosePath(context);
|
||||
|
||||
CGContextSetBlendMode(context, kCGBlendModeCopy);
|
||||
CGContextSetFillColorWithColor(context, [UIColor clearColor].CGColor);
|
||||
CGContextFillPath(context);
|
||||
}
|
||||
}
|
||||
|
||||
@end
|
||||
@ -1,26 +0,0 @@
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
typedef enum {
|
||||
TGPasswordEntryViewStyleDefault,
|
||||
TGPasswordEntryViewStyleTranslucent
|
||||
} TGPasswordEntryViewStyle;
|
||||
|
||||
@interface TGPasswordEntryView : UIView
|
||||
|
||||
@property (nonatomic, copy) void (^cancel)();
|
||||
@property (nonatomic, copy) void (^simplePasscodeEntered)();
|
||||
@property (nonatomic, copy) void (^complexPasscodeEntered)();
|
||||
@property (nonatomic, copy) void (^passcodeChanged)(NSString *);
|
||||
|
||||
- (instancetype)initWithFrame:(CGRect)frame style:(TGPasswordEntryViewStyle)style;
|
||||
|
||||
- (void)setTitle:(NSString *)title errorTitle:(NSString *)errorTitle isComplex:(bool)isComplex animated:(bool)animated;
|
||||
- (void)setErrorTitle:(NSString *)errorTitle;
|
||||
- (NSString *)passcode;
|
||||
- (void)resetPasscode;
|
||||
- (void)becomeFirstResponder;
|
||||
- (void)updateBackgroundIfNeeded;
|
||||
|
||||
- (void)setReturnKeyType:(UIReturnKeyType)keyType;
|
||||
|
||||
@end
|
||||
@ -1,696 +0,0 @@
|
||||
#import "TGPasswordEntryView.h"
|
||||
|
||||
#import "LegacyComponentsInternal.h"
|
||||
#import "TGFont.h"
|
||||
#import "TGImageUtils.h"
|
||||
|
||||
#import "TGTextField.h"
|
||||
|
||||
#import "TGPasscodePinView.h"
|
||||
#import "TGPasscodeEntryKeyboardView.h"
|
||||
|
||||
#import "TGDefaultPasscodeBackground.h"
|
||||
#import "TGImageBasedPasscodeBackground.h"
|
||||
#import <LegacyComponents/TGModernButton.h>
|
||||
|
||||
#import <AudioToolbox/AudioToolbox.h>
|
||||
|
||||
#import "TGBuiltinWallpaperInfo.h"
|
||||
|
||||
@interface TGPasswordEntryInputView : UIView <UIInputViewAudioFeedback>
|
||||
|
||||
@end
|
||||
|
||||
@implementation TGPasswordEntryInputView
|
||||
|
||||
- (BOOL)enableInputClicksWhenVisible
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@interface TGPasswordEntryView () <UITextFieldDelegate>
|
||||
{
|
||||
TGPasswordEntryViewStyle _style;
|
||||
TGTextField *_textField;
|
||||
UILabel *_titleLabel;
|
||||
UILabel *_infoLabel;
|
||||
NSString *_title;
|
||||
NSString *_errorTitle;
|
||||
bool _isComplex;
|
||||
TGPasscodePinView *_pinView;
|
||||
NSString *_passcode;
|
||||
|
||||
UIImageView *_backgroundView;
|
||||
TGPasscodeEntryKeyboardView *_simpleKeyboardView;
|
||||
TGModernButton *_simpleKeyboardCancelButton;
|
||||
TGModernButton *_simpleKeyboardDeleteButton;
|
||||
UIView *_inputView;
|
||||
TGModernButton *_complexCancelButton;
|
||||
TGModernButton *_complexNextButton;
|
||||
|
||||
TGWallpaperInfo *_currentWallpaperInfo;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@implementation TGPasswordEntryView
|
||||
|
||||
- (instancetype)initWithFrame:(CGRect)frame style:(TGPasswordEntryViewStyle)style
|
||||
{
|
||||
self = [super initWithFrame:frame];
|
||||
if (self != nil)
|
||||
{
|
||||
_style = style;
|
||||
|
||||
_backgroundView = [[UIImageView alloc] init];
|
||||
[self addSubview:_backgroundView];
|
||||
|
||||
_inputView = [[TGPasswordEntryInputView alloc] init];
|
||||
|
||||
_textField = [[TGTextField alloc] initWithFrame:CGRectMake(0.0f, 0.0f, 1.0f, 1.0f)];
|
||||
_textField.clipsToBounds = true;
|
||||
_textField.delegate = self;
|
||||
_textField.secureTextEntry = true;
|
||||
_textField.font = TGSystemFontOfSize(16.0f);
|
||||
_textField.leftInset = 8.0f;
|
||||
_textField.rightInset = 8.0f;
|
||||
_textField.keyboardType = UIKeyboardTypeDefault;
|
||||
_textField.returnKeyType = UIReturnKeyNext;
|
||||
_textField.contentVerticalAlignment = UIControlContentVerticalAlignmentCenter;
|
||||
if (iosMajorVersion() >= 7)
|
||||
_textField.keyboardAppearance = UIKeyboardAppearanceDark;
|
||||
else
|
||||
_textField.keyboardAppearance = UIKeyboardAppearanceAlert;
|
||||
|
||||
[self addSubview:_textField];
|
||||
|
||||
_pinView = [[TGPasscodePinView alloc] init];
|
||||
[_pinView addGestureRecognizer:[[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(pinViewTapped:)]];
|
||||
[self addSubview:_pinView];
|
||||
|
||||
_titleLabel = [[UILabel alloc] init];
|
||||
_titleLabel.backgroundColor = [UIColor clearColor];
|
||||
_titleLabel.textColor = [UIColor whiteColor];
|
||||
_titleLabel.font = TGSystemFontOfSize([self titleFontSize]);
|
||||
[self addSubview:_titleLabel];
|
||||
|
||||
_infoLabel = [[UILabel alloc] init];
|
||||
_infoLabel.backgroundColor = [UIColor clearColor];
|
||||
_infoLabel.textColor = [UIColor whiteColor];
|
||||
_infoLabel.font = TGSystemFontOfSize(13.0f);
|
||||
[self addSubview:_infoLabel];
|
||||
|
||||
_simpleKeyboardView = [[TGPasscodeEntryKeyboardView alloc] init];
|
||||
[_simpleKeyboardView sizeToFit];
|
||||
|
||||
__weak TGPasswordEntryView *weakSelf = self;
|
||||
_simpleKeyboardView.characterEntered = ^(NSString *text)
|
||||
{
|
||||
//AudioServicesPlaySystemSound(0x450);
|
||||
|
||||
__strong TGPasswordEntryView *strongSelf = weakSelf;
|
||||
if (strongSelf != nil)
|
||||
{
|
||||
strongSelf->_textField.text = [strongSelf->_textField.text stringByAppendingString:text];
|
||||
[strongSelf setPasscode:strongSelf->_textField.text];
|
||||
if (!strongSelf->_isComplex)
|
||||
{
|
||||
if (strongSelf->_passcode.length == 4)
|
||||
{
|
||||
strongSelf.userInteractionEnabled = false;
|
||||
TGDispatchAfter(0.2, dispatch_get_main_queue(), ^
|
||||
{
|
||||
strongSelf.userInteractionEnabled = true;
|
||||
|
||||
if (strongSelf->_simplePasscodeEntered)
|
||||
strongSelf->_simplePasscodeEntered();
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
[self addSubview:_simpleKeyboardView];
|
||||
|
||||
CGFloat simpleButtonInsetHorizontal = 0.0f;
|
||||
CGFloat simpleButtonInsetVertical = 0.0f;
|
||||
|
||||
CGSize screenSize = [UIScreen mainScreen].bounds.size;
|
||||
if (screenSize.width > screenSize.height)
|
||||
{
|
||||
CGFloat tmp = screenSize.width;
|
||||
screenSize.width = screenSize.height;
|
||||
screenSize.height = tmp;
|
||||
}
|
||||
|
||||
if ((int)screenSize.height == 1024 || (int)screenSize.height == 1194 || (int)screenSize.height == 1366)
|
||||
{
|
||||
simpleButtonInsetHorizontal = 26.0f;
|
||||
simpleButtonInsetVertical = 21.0f;
|
||||
}
|
||||
else if ((int)screenSize.height == 896)
|
||||
{
|
||||
simpleButtonInsetHorizontal = 54.0f;
|
||||
simpleButtonInsetVertical = 67.0f;
|
||||
}
|
||||
else if ((int)screenSize.height == 812)
|
||||
{
|
||||
simpleButtonInsetHorizontal = 54.0f;
|
||||
simpleButtonInsetVertical = 67.0f;
|
||||
}
|
||||
else if ((int)screenSize.height == 736)
|
||||
{
|
||||
simpleButtonInsetHorizontal = 26.0f;
|
||||
simpleButtonInsetVertical = 21.0f;
|
||||
}
|
||||
else if ((int)screenSize.height == 667)
|
||||
{
|
||||
simpleButtonInsetHorizontal = 54.0f;
|
||||
simpleButtonInsetVertical = 33.0f;
|
||||
}
|
||||
else if ((int)screenSize.height == 568)
|
||||
{
|
||||
simpleButtonInsetHorizontal = 26.0f;
|
||||
simpleButtonInsetVertical = 21.0f;
|
||||
}
|
||||
else
|
||||
{
|
||||
simpleButtonInsetHorizontal = 26.0f;
|
||||
simpleButtonInsetVertical = 13.0f;
|
||||
}
|
||||
|
||||
_complexCancelButton = [[TGModernButton alloc] init];
|
||||
[_complexCancelButton setTitle:TGLocalized(@"Common.Cancel") forState:UIControlStateNormal];
|
||||
[_complexCancelButton setTitleColor:[UIColor whiteColor]];
|
||||
_complexCancelButton.contentEdgeInsets = UIEdgeInsetsMake(14.0f, 10.0f, 14.0f, 10.0f);
|
||||
_complexCancelButton.titleLabel.font = TGSystemFontOfSize(18.0f);
|
||||
[_complexCancelButton sizeToFit];
|
||||
[_complexCancelButton addTarget:self action:@selector(simpleKeyboardCancel) forControlEvents:UIControlEventTouchUpInside];
|
||||
[self addSubview:_complexCancelButton];
|
||||
|
||||
_complexNextButton = [[TGModernButton alloc] init];
|
||||
[_complexNextButton setTitle:TGLocalized(@"Common.Next") forState:UIControlStateNormal];
|
||||
[_complexNextButton setTitleColor:[UIColor whiteColor]];
|
||||
_complexNextButton.contentEdgeInsets = UIEdgeInsetsMake(14.0f, 10.0f, 14.0f, 10.0f);
|
||||
_complexNextButton.titleLabel.font = TGMediumSystemFontOfSize(18.0f);
|
||||
[_complexNextButton sizeToFit];
|
||||
[_complexNextButton addTarget:self action:@selector(simpleKeyboardNext) forControlEvents:UIControlEventTouchUpInside];
|
||||
[self addSubview:_complexNextButton];
|
||||
|
||||
_simpleKeyboardCancelButton = [[TGModernButton alloc] init];
|
||||
[_simpleKeyboardCancelButton setTitle:TGLocalized(@"Common.Cancel") forState:UIControlStateNormal];
|
||||
[_simpleKeyboardCancelButton setTitleColor:[UIColor whiteColor]];
|
||||
_simpleKeyboardCancelButton.contentEdgeInsets = UIEdgeInsetsMake(simpleButtonInsetVertical, simpleButtonInsetHorizontal, simpleButtonInsetVertical, simpleButtonInsetHorizontal);
|
||||
_simpleKeyboardCancelButton.titleLabel.font = TGSystemFontOfSize(16.0f);
|
||||
[_simpleKeyboardCancelButton sizeToFit];
|
||||
[_simpleKeyboardCancelButton addTarget:self action:@selector(simpleKeyboardCancel) forControlEvents:UIControlEventTouchUpInside];
|
||||
[self addSubview:_simpleKeyboardCancelButton];
|
||||
|
||||
_simpleKeyboardDeleteButton = [[TGModernButton alloc] init];
|
||||
[_simpleKeyboardDeleteButton setTitle:TGLocalized(@"Common.Delete") forState:UIControlStateNormal];
|
||||
[_simpleKeyboardDeleteButton setTitleColor:[UIColor whiteColor]];
|
||||
_simpleKeyboardDeleteButton.contentEdgeInsets = UIEdgeInsetsMake(simpleButtonInsetVertical, simpleButtonInsetHorizontal, simpleButtonInsetVertical, simpleButtonInsetHorizontal);
|
||||
_simpleKeyboardDeleteButton.titleLabel.font = TGSystemFontOfSize(16.0f);
|
||||
[_simpleKeyboardDeleteButton sizeToFit];
|
||||
[_simpleKeyboardDeleteButton addTarget:self action:@selector(simpleKeyboardDelete) forControlEvents:UIControlEventTouchUpInside];
|
||||
[self addSubview:_simpleKeyboardDeleteButton];
|
||||
|
||||
[self _updateBackground:frame.size];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)setReturnKeyType:(UIReturnKeyType)keyType {
|
||||
_textField.returnKeyType = keyType;
|
||||
}
|
||||
|
||||
- (CGFloat)titleFontSize
|
||||
{
|
||||
if (_isComplex)
|
||||
return 20.0f;
|
||||
|
||||
CGSize screenSize = [UIScreen mainScreen].bounds.size;
|
||||
if (screenSize.width > screenSize.height)
|
||||
{
|
||||
CGFloat tmp = screenSize.width;
|
||||
screenSize.width = screenSize.height;
|
||||
screenSize.height = tmp;
|
||||
}
|
||||
|
||||
if ((int)screenSize.height == 1024 || (int)screenSize.height == 1194 || (int)screenSize.height == 1366)
|
||||
return 21.0f;
|
||||
else if ((int)screenSize.height == 736 || (int)screenSize.height == 667 || (int)screenSize.height == 812 || (int)screenSize.height == 896)
|
||||
return 19.0f;
|
||||
else
|
||||
return 18.0f;
|
||||
}
|
||||
|
||||
- (CGFloat)infoFontSize
|
||||
{
|
||||
if (_isComplex)
|
||||
return 14.0f;
|
||||
|
||||
CGSize screenSize = [UIScreen mainScreen].bounds.size;
|
||||
if (screenSize.width > screenSize.height)
|
||||
{
|
||||
CGFloat tmp = screenSize.width;
|
||||
screenSize.width = screenSize.height;
|
||||
screenSize.height = tmp;
|
||||
}
|
||||
|
||||
if ((int)screenSize.height == 1024 || (int)screenSize.height == 1194 || (int)screenSize.height == 1366)
|
||||
return 15.0f;
|
||||
|
||||
return 13.0f;
|
||||
}
|
||||
|
||||
- (void)updateBackgroundIfNeeded
|
||||
{
|
||||
TGWallpaperInfo *wallpaperInfo = [[LegacyComponentsGlobals provider] currentWallpaperInfo];
|
||||
if (!TGObjectCompare(_currentWallpaperInfo, wallpaperInfo))
|
||||
[self _updateBackground:self.frame.size];
|
||||
}
|
||||
|
||||
- (void)_updateBackground:(CGSize)size
|
||||
{
|
||||
TGWallpaperInfo *wallpaperInfo = [[LegacyComponentsGlobals provider] currentWallpaperInfo];
|
||||
id<TGPasscodeBackground> background = nil;
|
||||
|
||||
if (wallpaperInfo == nil || [wallpaperInfo isKindOfClass:[TGBuiltinWallpaperInfo class]])
|
||||
{
|
||||
if (wallpaperInfo == nil || [((TGBuiltinWallpaperInfo *)wallpaperInfo) isDefault])
|
||||
background = [[TGDefaultPasscodeBackground alloc] initWithSize:size];
|
||||
}
|
||||
|
||||
if (background == nil)
|
||||
{
|
||||
background = [[TGImageBasedPasscodeBackground alloc] initWithImage:[[LegacyComponentsGlobals provider] currentWallpaperImage] size:size];
|
||||
}
|
||||
|
||||
_currentWallpaperInfo = wallpaperInfo;
|
||||
|
||||
_backgroundView.image = [background backgroundImage];
|
||||
[_pinView setBackground:background];
|
||||
[_simpleKeyboardView setBackground:background];
|
||||
}
|
||||
|
||||
- (void)setFrame:(CGRect)frame
|
||||
{
|
||||
bool updateBackground = false;
|
||||
if ((self.frame.size.width < self.frame.size.height) != (frame.size.width < frame.size.height))
|
||||
updateBackground = true;
|
||||
|
||||
[super setFrame:frame];
|
||||
|
||||
if (updateBackground)
|
||||
[self _updateBackground:frame.size];
|
||||
}
|
||||
|
||||
- (void)setCancel:(void (^)())cancel
|
||||
{
|
||||
_cancel = [cancel copy];
|
||||
_simpleKeyboardCancelButton.hidden = _simpleKeyboardDeleteButton.hidden || cancel == nil;
|
||||
_complexCancelButton.hidden = !_simpleKeyboardDeleteButton.hidden || cancel == nil;
|
||||
_complexNextButton.hidden = !_isComplex;
|
||||
}
|
||||
|
||||
- (void)simpleKeyboardCancel
|
||||
{
|
||||
if (_cancel)
|
||||
_cancel();
|
||||
}
|
||||
|
||||
- (void)simpleKeyboardNext
|
||||
{
|
||||
if (_passcode.length != 0 && _complexPasscodeEntered)
|
||||
_complexPasscodeEntered();
|
||||
}
|
||||
|
||||
- (void)simpleKeyboardDelete
|
||||
{
|
||||
NSString *text = _textField.text;
|
||||
if (text.length != 0)
|
||||
{
|
||||
text = [text substringToIndex:text.length - 1];
|
||||
_textField.text = text;
|
||||
[self setPasscode:text];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)setPasscode:(NSString *)passcode
|
||||
{
|
||||
_passcode = passcode;
|
||||
[_pinView setCharacterCount:passcode.length maxCharacterCount:_isComplex ? 0 : 4];
|
||||
}
|
||||
|
||||
- (void)pinViewTapped:(UITapGestureRecognizer *)recognizer
|
||||
{
|
||||
if (recognizer.state == UIGestureRecognizerStateEnded && ![_textField isFirstResponder] && _isComplex)
|
||||
{
|
||||
[_textField becomeFirstResponder];
|
||||
}
|
||||
}
|
||||
|
||||
- (bool)errorTitleReplacesTitle
|
||||
{
|
||||
if (_isComplex)
|
||||
return false;
|
||||
|
||||
CGSize screenSize = [UIScreen mainScreen].bounds.size;
|
||||
if (screenSize.width > screenSize.height)
|
||||
{
|
||||
CGFloat tmp = screenSize.width;
|
||||
screenSize.width = screenSize.height;
|
||||
screenSize.height = tmp;
|
||||
}
|
||||
|
||||
if ((int)screenSize.height == 480)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
- (void)setTitle:(NSString *)title errorTitle:(NSString *)errorTitle isComplex:(bool)isComplex animated:(bool)animated
|
||||
{
|
||||
animated = false;
|
||||
|
||||
_title = title;
|
||||
_errorTitle = errorTitle;
|
||||
_isComplex = isComplex;
|
||||
|
||||
_titleLabel.font = TGSystemFontOfSize([self titleFontSize]);
|
||||
_infoLabel.font = TGSystemFontOfSize([self infoFontSize]);
|
||||
|
||||
if (!animated)
|
||||
{
|
||||
if (errorTitle.length != 0)
|
||||
{
|
||||
if ([self errorTitleReplacesTitle])
|
||||
_titleLabel.text = errorTitle;
|
||||
else
|
||||
{
|
||||
_titleLabel.text = title;
|
||||
_infoLabel.text = errorTitle;
|
||||
}
|
||||
|
||||
[_titleLabel sizeToFit];
|
||||
[_infoLabel sizeToFit];
|
||||
}
|
||||
else
|
||||
{
|
||||
_titleLabel.text = title;
|
||||
[_titleLabel sizeToFit];
|
||||
|
||||
_infoLabel.text = errorTitle;
|
||||
[_infoLabel sizeToFit];
|
||||
}
|
||||
|
||||
_textField.text = @"";
|
||||
|
||||
if (_isComplex)
|
||||
{
|
||||
if (_textField.inputView != nil)
|
||||
{
|
||||
_textField.inputView = nil;
|
||||
[_textField resignFirstResponder];
|
||||
}
|
||||
[_textField becomeFirstResponder];
|
||||
_simpleKeyboardView.hidden = true;
|
||||
_simpleKeyboardCancelButton.hidden = true;
|
||||
_simpleKeyboardDeleteButton.hidden = true;
|
||||
_complexCancelButton.hidden = _cancel == nil;
|
||||
_complexNextButton.hidden = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (_textField.inputView == nil)
|
||||
{
|
||||
_textField.inputView = _inputView;
|
||||
[_textField resignFirstResponder];
|
||||
}
|
||||
[_textField becomeFirstResponder];
|
||||
_simpleKeyboardView.hidden = false;
|
||||
_simpleKeyboardCancelButton.hidden = _cancel == nil;
|
||||
_simpleKeyboardDeleteButton.hidden = false;
|
||||
_complexCancelButton.hidden = true;
|
||||
_complexNextButton.hidden = true;
|
||||
}
|
||||
|
||||
[_pinView setCharacterCount:0 maxCharacterCount:_isComplex ? 0 : 4];
|
||||
|
||||
[self setPasscode:@""];
|
||||
|
||||
[self setNeedsLayout];
|
||||
|
||||
if (_passcodeChanged)
|
||||
_passcodeChanged(_passcode);
|
||||
}
|
||||
}
|
||||
|
||||
- (void)setErrorTitle:(NSString *)errorTitle
|
||||
{
|
||||
if (!TGStringCompare(_errorTitle, errorTitle))
|
||||
{
|
||||
_errorTitle = errorTitle;
|
||||
if (_errorTitle.length != 0)
|
||||
{
|
||||
if ([self errorTitleReplacesTitle])
|
||||
{
|
||||
_titleLabel.text = _errorTitle;
|
||||
[_titleLabel sizeToFit];
|
||||
[self setNeedsLayout];
|
||||
}
|
||||
else
|
||||
{
|
||||
_infoLabel.text = _errorTitle;
|
||||
[_infoLabel sizeToFit];
|
||||
[self setNeedsLayout];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
_titleLabel.text = _title;
|
||||
[_titleLabel sizeToFit];
|
||||
|
||||
_infoLabel.text = _errorTitle;
|
||||
[_infoLabel sizeToFit];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
- (NSString *)passcode
|
||||
{
|
||||
return _passcode;
|
||||
}
|
||||
|
||||
- (void)resetPasscode
|
||||
{
|
||||
_textField.text = @"";
|
||||
[self setPasscode:@""];
|
||||
}
|
||||
|
||||
- (void)becomeFirstResponder
|
||||
{
|
||||
[_textField becomeFirstResponder];
|
||||
}
|
||||
|
||||
- (void)willMoveToWindow:(UIWindow *)window {
|
||||
[super willMoveToWindow:window];
|
||||
[_textField becomeFirstResponder];
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
[_textField becomeFirstResponder];
|
||||
});
|
||||
}
|
||||
|
||||
- (BOOL)resignFirstResponder
|
||||
{
|
||||
return [_textField resignFirstResponder];
|
||||
}
|
||||
|
||||
- (void)layoutSubviews
|
||||
{
|
||||
[super layoutSubviews];
|
||||
|
||||
_backgroundView.frame = self.bounds;
|
||||
|
||||
CGFloat keyboardOffset = 0.0f;
|
||||
|
||||
CGFloat titleOffset = 0.0f;
|
||||
CGFloat pinOffset = 0.0f;
|
||||
CGFloat infoOffset = 0.0f;
|
||||
CGFloat topOffset = 20.0f;
|
||||
CGFloat bottomOffset = 0.0f;
|
||||
|
||||
CGSize screenSize = [UIScreen mainScreen].bounds.size;
|
||||
if (screenSize.width > screenSize.height)
|
||||
{
|
||||
CGFloat tmp = screenSize.width;
|
||||
screenSize.width = screenSize.height;
|
||||
screenSize.height = tmp;
|
||||
}
|
||||
|
||||
if ((int)screenSize.height == 1024 || (int)screenSize.height == 1194 || (int)screenSize.height == 1366)
|
||||
{
|
||||
keyboardOffset = CGFloor((self.frame.size.height - 500.0f) / 2.0f + 119.0f);
|
||||
titleOffset = 122.0f;
|
||||
pinOffset = 89.0f;
|
||||
infoOffset = 7.0f;
|
||||
}
|
||||
else if ((int)screenSize.height == 896)
|
||||
{
|
||||
keyboardOffset = 330.0f;
|
||||
titleOffset = 116.0f;
|
||||
pinOffset = 79.0f + TGScreenPixel;
|
||||
infoOffset = 6.0f - TGScreenPixel;
|
||||
topOffset = 44.0f;
|
||||
bottomOffset = 34.0f;
|
||||
}
|
||||
else if ((int)screenSize.height == 812)
|
||||
{
|
||||
keyboardOffset = 300.0f;
|
||||
titleOffset = 116.0f;
|
||||
pinOffset = 79.0f + TGScreenPixel;
|
||||
infoOffset = 6.0f - TGScreenPixel;
|
||||
topOffset = 44.0f;
|
||||
bottomOffset = 34.0f;
|
||||
}
|
||||
else if ((int)screenSize.height == 736)
|
||||
{
|
||||
keyboardOffset = 246.0f;
|
||||
titleOffset = 112.0f;
|
||||
pinOffset = 79.0f + TGScreenPixel;
|
||||
infoOffset = 6.0f - TGScreenPixel;
|
||||
}
|
||||
else if ((int)screenSize.height == 667)
|
||||
{
|
||||
keyboardOffset = 206.0f;
|
||||
titleOffset = 112.0f;
|
||||
pinOffset = 79.0f + TGScreenPixel;
|
||||
infoOffset = 6.0f - TGScreenPixel;
|
||||
}
|
||||
else if ((int)screenSize.height == 568)
|
||||
{
|
||||
keyboardOffset = 163.0f;
|
||||
titleOffset = 98.0f - TGScreenPixel;
|
||||
pinOffset = 72.0f;
|
||||
infoOffset = 0.0f;
|
||||
}
|
||||
else
|
||||
{
|
||||
keyboardOffset = 109.0f;
|
||||
titleOffset = 68.0f;
|
||||
pinOffset = 45.0f;
|
||||
infoOffset = 0.0f;
|
||||
}
|
||||
|
||||
if (_complexNextButton.hidden)
|
||||
{
|
||||
_complexCancelButton.frame = CGRectMake(self.frame.size.width - _complexCancelButton.frame.size.width, topOffset, _complexCancelButton.frame.size.width, _complexCancelButton.frame.size.height);
|
||||
}
|
||||
else
|
||||
{
|
||||
_complexNextButton.frame = CGRectMake(self.frame.size.width - _complexNextButton.frame.size.width, topOffset, _complexNextButton.frame.size.width, _complexNextButton.frame.size.height);
|
||||
_complexCancelButton.frame = CGRectMake(0.0f, topOffset, _complexCancelButton.frame.size.width, _complexCancelButton.frame.size.height);
|
||||
}
|
||||
|
||||
_simpleKeyboardView.frame = CGRectMake(CGFloor((self.frame.size.width - _simpleKeyboardView.frame.size.width) / 2.0f), keyboardOffset, _simpleKeyboardView.frame.size.width, _simpleKeyboardView.frame.size.height);
|
||||
|
||||
CGFloat textFieldWidth = 0.0f;
|
||||
|
||||
if ((int)screenSize.height == 1024 || (int)screenSize.height == 1194 || (int)screenSize.height == 1366)
|
||||
{
|
||||
textFieldWidth = 320.0f;
|
||||
|
||||
_simpleKeyboardCancelButton.frame = CGRectMake(CGRectGetMinX(_simpleKeyboardView.frame) - 23.0f, CGRectGetMaxY(_simpleKeyboardView.frame) - _simpleKeyboardCancelButton.frame.size.height - 10.0f, _simpleKeyboardCancelButton.frame.size.width, _simpleKeyboardCancelButton.frame.size.height);
|
||||
|
||||
_simpleKeyboardDeleteButton.frame = CGRectMake(CGRectGetMaxX(_simpleKeyboardView.frame) - _simpleKeyboardDeleteButton.frame.size.width + 23.0f, CGRectGetMaxY(_simpleKeyboardView.frame) - _simpleKeyboardDeleteButton.frame.size.height - 10.0f, _simpleKeyboardDeleteButton.frame.size.width, _simpleKeyboardDeleteButton.frame.size.height);
|
||||
}
|
||||
else
|
||||
{
|
||||
textFieldWidth = MAX(16.0f, self.frame.size.width - 17.0f * 2.0f);
|
||||
|
||||
_simpleKeyboardCancelButton.frame = CGRectMake(0.0f, self.frame.size.height - _simpleKeyboardCancelButton.frame.size.height, _simpleKeyboardCancelButton.frame.size.width, _simpleKeyboardCancelButton.frame.size.height);
|
||||
_simpleKeyboardDeleteButton.frame = CGRectMake(self.frame.size.width - _simpleKeyboardDeleteButton.frame.size.width, self.frame.size.height - _simpleKeyboardDeleteButton.frame.size.height, _simpleKeyboardDeleteButton.frame.size.width, _simpleKeyboardDeleteButton.frame.size.height);
|
||||
}
|
||||
|
||||
CGFloat topInset = topOffset + 44.0f;
|
||||
CGFloat bottomInset = self.frame.size.width > self.frame.size.height ? 162.0f : 216.0f + bottomOffset;
|
||||
CGFloat areaHeight = self.bounds.size.height - topInset - bottomInset;
|
||||
|
||||
CGSize titleSize = _titleLabel.frame.size;
|
||||
CGSize infoSize = _infoLabel.frame.size;
|
||||
|
||||
CGFloat textFieldHeight = 41.0f;
|
||||
|
||||
if (_isComplex)
|
||||
{
|
||||
_titleLabel.frame = CGRectMake(CGFloor((self.bounds.size.width - titleSize.width) / 2.0f), CGFloor(areaHeight / 2.0f) - titleSize.height - 1.0f, titleSize.width, titleSize.height);
|
||||
_pinView.frame = CGRectMake(CGFloor((self.frame.size.width - textFieldWidth) / 2.0f), CGRectGetMaxY(_titleLabel.frame) + 23.0f, textFieldWidth, textFieldHeight);
|
||||
_infoLabel.frame = CGRectMake(CGFloor((self.bounds.size.width - infoSize.width) / 2.0f), CGRectGetMaxY(_pinView.frame) + 25.0f + TGRetinaPixel, infoSize.width, infoSize.height);
|
||||
}
|
||||
else
|
||||
{
|
||||
_titleLabel.frame = CGRectMake(CGFloor((self.bounds.size.width - titleSize.width) / 2.0f), _simpleKeyboardView.frame.origin.y - titleOffset, titleSize.width, titleSize.height);
|
||||
_pinView.frame = CGRectMake(0.0f, _simpleKeyboardView.frame.origin.y - pinOffset, self.frame.size.width, textFieldHeight);
|
||||
_infoLabel.frame = CGRectMake(CGFloor((self.bounds.size.width - infoSize.width) / 2.0f), CGRectGetMaxY(_pinView.frame) + infoOffset, infoSize.width, infoSize.height);
|
||||
}
|
||||
}
|
||||
|
||||
- (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string
|
||||
{
|
||||
if (textField == _textField)
|
||||
{
|
||||
NSString *text = [textField.text stringByReplacingCharactersInRange:range withString:string];
|
||||
|
||||
if (!_isComplex)
|
||||
{
|
||||
for (NSUInteger i = 0; i < text.length; i++)
|
||||
{
|
||||
unichar c = [text characterAtIndex:i];
|
||||
if (!(c >= '0' && c <= '9'))
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (!_isComplex && text.length > 4)
|
||||
return false;
|
||||
|
||||
if (!_isComplex)
|
||||
[_pinView setCharacterCount:text.length maxCharacterCount:4];
|
||||
|
||||
[self setPasscode:text];
|
||||
|
||||
if (_passcodeChanged)
|
||||
_passcodeChanged(_passcode);
|
||||
|
||||
if (!_isComplex && text.length == 4)
|
||||
{
|
||||
dispatch_async(dispatch_get_main_queue(), ^
|
||||
{
|
||||
if (_simplePasscodeEntered)
|
||||
_simplePasscodeEntered();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
- (BOOL)textFieldShouldReturn:(UITextField *)__unused textField
|
||||
{
|
||||
if (!_isComplex)
|
||||
{
|
||||
if (_passcode.length == 4 && _simplePasscodeEntered)
|
||||
_simplePasscodeEntered();
|
||||
}
|
||||
else
|
||||
{
|
||||
if (_passcode.length != 0 && _complexPasscodeEntered)
|
||||
_complexPasscodeEntered();
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@end
|
||||
@ -1,7 +0,0 @@
|
||||
#import <LegacyComponents/TGWallpaperInfo.h>
|
||||
|
||||
@interface TGRemoteWallpaperInfo : TGWallpaperInfo
|
||||
|
||||
- (instancetype)initWithRemoteId:(int)remoteId thumbnailUri:(NSString *)thumbnailUri fullscreenUri:(NSString *)fullscreenUri tintColor:(int)tintColor;
|
||||
|
||||
@end
|
||||
@ -1,103 +0,0 @@
|
||||
#import "TGRemoteWallpaperInfo.h"
|
||||
|
||||
#import "LegacyComponentsInternal.h"
|
||||
|
||||
#import <LegacyComponents/TGRemoteImageView.h>
|
||||
|
||||
@interface TGRemoteWallpaperInfo ()
|
||||
{
|
||||
int _remoteId;
|
||||
NSString *_thumbnailUri;
|
||||
NSString *_fullscreenUri;
|
||||
int _tintColor;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@implementation TGRemoteWallpaperInfo
|
||||
|
||||
- (instancetype)initWithRemoteId:(int)remoteId thumbnailUri:(NSString *)thumbnailUri fullscreenUri:(NSString *)fullscreenUri tintColor:(int)tintColor
|
||||
{
|
||||
self = [super init];
|
||||
if (self != nil)
|
||||
{
|
||||
_remoteId = remoteId;
|
||||
_thumbnailUri = thumbnailUri;
|
||||
_fullscreenUri = fullscreenUri;
|
||||
_tintColor = tintColor;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (BOOL)isEqual:(id)object
|
||||
{
|
||||
if ([object isKindOfClass:[TGRemoteWallpaperInfo class]])
|
||||
{
|
||||
if (((TGRemoteWallpaperInfo *)object)->_remoteId == _remoteId &&
|
||||
TGStringCompare(((TGRemoteWallpaperInfo *)object)->_thumbnailUri, _thumbnailUri) &&
|
||||
TGStringCompare(((TGRemoteWallpaperInfo *)object)->_fullscreenUri, _fullscreenUri) &&
|
||||
((TGRemoteWallpaperInfo *)object)->_tintColor == _tintColor)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
- (NSString *)thumbnailUrl
|
||||
{
|
||||
return _thumbnailUri;
|
||||
}
|
||||
|
||||
- (NSString *)fullscreenUrl
|
||||
{
|
||||
return _fullscreenUri;
|
||||
}
|
||||
|
||||
- (int)tintColor
|
||||
{
|
||||
return _tintColor;
|
||||
}
|
||||
|
||||
- (NSData *)imageData
|
||||
{
|
||||
NSString *trimmedUrl = [self fullscreenUrl];
|
||||
NSArray *components = [trimmedUrl componentsSeparatedByString:@"_"];
|
||||
if (components.count >= 5)
|
||||
trimmedUrl = [NSString stringWithFormat:@"%@_%@_%@_%@", components[0], components[1], components[2], components[3]];
|
||||
|
||||
return [[NSData alloc] initWithContentsOfFile:[[TGRemoteImageView sharedCache] pathForCachedData:trimmedUrl]];
|
||||
}
|
||||
|
||||
- (UIImage *)image
|
||||
{
|
||||
NSData *data = [self imageData];
|
||||
if (data != nil)
|
||||
return [[UIImage alloc] initWithData:data];
|
||||
|
||||
return nil;
|
||||
}
|
||||
|
||||
- (bool)hasData
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
- (NSDictionary *)infoDictionary
|
||||
{
|
||||
return @{
|
||||
@"_className": NSStringFromClass([self class]),
|
||||
@"remoteId": @(_remoteId),
|
||||
@"thumbnailUri": _thumbnailUri == nil ? @"" : _thumbnailUri,
|
||||
@"fullscreenUri": _fullscreenUri == nil ? @"" : _fullscreenUri,
|
||||
@"tintColor": @(_tintColor),
|
||||
};
|
||||
}
|
||||
|
||||
+ (TGWallpaperInfo *)infoWithDictionary:(NSDictionary *)dict
|
||||
{
|
||||
return [[TGRemoteWallpaperInfo alloc] initWithRemoteId:[dict[@"remoteId"] intValue] thumbnailUri:dict[@"thumbnailUri"] fullscreenUri:dict[@"fullscreenUri"] tintColor:[dict[@"tintColor"] intValue]];
|
||||
}
|
||||
|
||||
@end
|
||||
@ -1,29 +0,0 @@
|
||||
#import <LegacyComponents/TGViewController.h>
|
||||
#import <LegacyComponents/LegacyComponentsContext.h>
|
||||
#import <LegacyComponents/ASWatcher.h>
|
||||
|
||||
@class TGWallpaperInfo;
|
||||
@class TGWallpaperController;
|
||||
@class TGPresentation;
|
||||
|
||||
@protocol TGWallpaperControllerDelegate <NSObject>
|
||||
|
||||
@optional
|
||||
|
||||
- (void)wallpaperController:(TGWallpaperController *)wallpaperController didSelectWallpaperWithInfo:(TGWallpaperInfo *)wallpaperInfo;
|
||||
|
||||
@end
|
||||
|
||||
@interface TGWallpaperController : TGViewController <ASWatcher>
|
||||
|
||||
@property (nonatomic, strong) ASHandle *actionHandle;
|
||||
|
||||
@property (nonatomic, weak) id<TGWallpaperControllerDelegate> delegate;
|
||||
@property (nonatomic) bool enableWallpaperAdjustment;
|
||||
@property (nonatomic, strong) TGPresentation *presentation;
|
||||
|
||||
@property (nonatomic, copy) void (^customDismiss)();
|
||||
|
||||
- (instancetype)initWithContext:(id<LegacyComponentsContext>)context wallpaperInfo:(TGWallpaperInfo *)wallpaperInfo thumbnailImage:(UIImage *)thumbnailImage;
|
||||
|
||||
@end
|
||||
@ -1,378 +0,0 @@
|
||||
#import "TGWallpaperController.h"
|
||||
|
||||
#import <LegacyComponents/LegacyComponents.h>
|
||||
#import "LegacyComponentsInternal.h"
|
||||
|
||||
#import "TGModernButton.h"
|
||||
#import <LegacyComponents/TGRemoteImageView.h>
|
||||
|
||||
#import <LegacyComponents/TGWallpaperInfo.h>
|
||||
#import <LegacyComponents/TGCustomImageWallpaperInfo.h>
|
||||
|
||||
//#import "TGDefaultPresentationPallete.h"
|
||||
|
||||
#import "TGRemoteImageView.h"
|
||||
|
||||
@interface TGWallpaperController () <UIScrollViewDelegate>
|
||||
{
|
||||
TGWallpaperInfo *_wallpaperInfo;
|
||||
UIImage *_thumbnailImage;
|
||||
TGRemoteImageView *_imageView;
|
||||
|
||||
CGSize _adjustingImageSize;
|
||||
CGFloat _adjustingImageScale;
|
||||
UIScrollView *_scrollView;
|
||||
|
||||
TGModernButton *_setButton;
|
||||
|
||||
UIView *_panelView;
|
||||
|
||||
TGModernButton *_cancelButton;
|
||||
|
||||
UIView *_separatorView;
|
||||
UIView *_bottomView;
|
||||
|
||||
id<LegacyComponentsContext> _context;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@implementation TGWallpaperController
|
||||
|
||||
- (instancetype)initWithContext:(id<LegacyComponentsContext>)context wallpaperInfo:(TGWallpaperInfo *)wallpaperInfo thumbnailImage:(UIImage *)thumbnailImage
|
||||
{
|
||||
self = [super initWithContext:context];
|
||||
if (self != nil)
|
||||
{
|
||||
_actionHandle = [[ASHandle alloc] initWithDelegate:self releaseOnMainThread:true];
|
||||
|
||||
_wallpaperInfo = wallpaperInfo;
|
||||
_thumbnailImage = thumbnailImage;
|
||||
|
||||
[self setTitleText:TGLocalized(@"BackgroundPreview.Title")];
|
||||
|
||||
self.automaticallyManageScrollViewInsets = false;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)dealloc
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
#pragma mark -
|
||||
|
||||
- (void)viewWillAppear:(BOOL)animated
|
||||
{
|
||||
[super viewWillAppear:animated];
|
||||
|
||||
if (self.navigationController == nil && [[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone)
|
||||
{
|
||||
[_context animateApplicationStatusBarAppearance:TGStatusBarAppearanceAnimationSlideUp delay:0.0 duration:0.5 completion:^
|
||||
{
|
||||
[_context setApplicationStatusBarAlpha:0.0f];
|
||||
}];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)viewWillDisappear:(BOOL)animated
|
||||
{
|
||||
[super viewWillDisappear:animated];
|
||||
|
||||
if (self.navigationController == nil && [[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone)
|
||||
{
|
||||
[_context setApplicationStatusBarAlpha:1.0f];
|
||||
[_context animateApplicationStatusBarAppearance:TGStatusBarAppearanceAnimationSlideDown duration:iosMajorVersion() >= 7 ? 0.23 : 0.3 completion:nil];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)loadView
|
||||
{
|
||||
[super loadView];
|
||||
|
||||
self.view.clipsToBounds = true;
|
||||
self.view.backgroundColor = [UIColor blackColor];
|
||||
|
||||
CGSize screenSize = self.view.bounds.size;
|
||||
|
||||
_imageView = [[TGRemoteImageView alloc] initWithFrame:CGRectMake(0.0f, 0.0f, screenSize.width, screenSize.height)];
|
||||
|
||||
bool imageLoading = false;
|
||||
|
||||
UIImage *immediateImage = [_wallpaperInfo image];
|
||||
if (immediateImage != nil)
|
||||
[_imageView loadImage:immediateImage];
|
||||
else
|
||||
{
|
||||
_imageView.useCache = false;
|
||||
_imageView.contentHints = TGRemoteImageContentHintLoadFromDiskSynchronously;
|
||||
_imageView.fadeTransition = true;
|
||||
_imageView.fadeTransitionDuration = 0.3;
|
||||
|
||||
imageLoading = true;
|
||||
|
||||
ASHandle *actionHandle = _actionHandle;
|
||||
[_imageView setProgressHandler:^(TGRemoteImageView *imageView, float progress)
|
||||
{
|
||||
if (ABS(progress - 1.0f) < FLT_EPSILON && [imageView currentImage] != nil)
|
||||
{
|
||||
[actionHandle requestAction:@"imageLoaded" options:nil];
|
||||
}
|
||||
}];
|
||||
[_imageView loadImage:[_wallpaperInfo fullscreenUrl] filter:nil placeholder:_thumbnailImage];
|
||||
}
|
||||
|
||||
if (_enableWallpaperAdjustment && immediateImage != nil)
|
||||
{
|
||||
_scrollView = [[UIScrollView alloc] initWithFrame:CGRectMake(0.0f, 0.0f, screenSize.width, screenSize.height)];
|
||||
[self.view addSubview:_scrollView];
|
||||
|
||||
_scrollView.showsHorizontalScrollIndicator = false;
|
||||
_scrollView.showsVerticalScrollIndicator = false;
|
||||
_scrollView.delegate = self;
|
||||
|
||||
_adjustingImageScale = immediateImage.scale;
|
||||
_adjustingImageSize = CGSizeMake(immediateImage.size.width / _adjustingImageScale, immediateImage.size.height / _adjustingImageScale);
|
||||
|
||||
_imageView.frame = CGRectMake(0, 0, _adjustingImageSize.width, _adjustingImageSize.height);
|
||||
_imageView.contentMode = UIViewContentModeScaleToFill;
|
||||
[_scrollView addSubview:_imageView];
|
||||
|
||||
[self _adjustScrollView];
|
||||
_scrollView.zoomScale = _scrollView.minimumZoomScale;
|
||||
|
||||
CGSize contentSize = _scrollView.contentSize;
|
||||
CGSize viewSize = _scrollView.frame.size;
|
||||
_scrollView.contentOffset = CGPointMake(MAX(0, CGFloor((contentSize.width - viewSize.width) / 2)), MAX(0, CGFloor((contentSize.height - viewSize.height) / 2)));
|
||||
}
|
||||
else
|
||||
{
|
||||
_imageView.contentMode = UIViewContentModeScaleAspectFill;
|
||||
[self.view addSubview:_imageView];
|
||||
}
|
||||
|
||||
_panelView = [[UIView alloc] initWithFrame:CGRectMake(0, screenSize.height - 49, screenSize.width, 49)];
|
||||
|
||||
TGNavigationBarPallete *pallete = [[LegacyComponentsGlobals provider] navigationBarPallete];
|
||||
if (iosMajorVersion() >= 7 && [TGViewController isWidescreen])
|
||||
{
|
||||
UIToolbar *toolbar = [[UIToolbar alloc] initWithFrame:_panelView.bounds];
|
||||
toolbar.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
|
||||
[_panelView addSubview:toolbar];
|
||||
toolbar.barTintColor = pallete.backgroundColor;
|
||||
}
|
||||
else
|
||||
{
|
||||
_panelView.backgroundColor = pallete.backgroundColor;
|
||||
_panelView.backgroundColor = [UIColor grayColor];
|
||||
}
|
||||
|
||||
[self.view addSubview:_panelView];
|
||||
|
||||
CGFloat separatorWidth = TGScreenPixel;
|
||||
|
||||
_cancelButton = [[TGModernButton alloc] initWithFrame:CGRectMake(0, 0, CGFloor(_panelView.frame.size.width / 2) - separatorWidth, _panelView.frame.size.height)];
|
||||
_cancelButton.backgroundColor = [UIColor clearColor];
|
||||
//_cancelButton.highlightBackgroundColor = self.presentation.pallete.selectionColor;
|
||||
[_cancelButton addTarget:self action:@selector(cancelButtonPressed) forControlEvents:UIControlEventTouchUpInside];
|
||||
[_cancelButton setTitle:TGLocalized(@"Common.Cancel") forState:UIControlStateNormal];
|
||||
_cancelButton.titleLabel.font = TGSystemFontOfSize(17);
|
||||
[_cancelButton setTitleColor:pallete.titleColor];
|
||||
[_cancelButton setTitleShadowColor:[UIColor clearColor] forState:UIControlStateNormal];
|
||||
[_panelView addSubview:_cancelButton];
|
||||
|
||||
_setButton = [[TGModernButton alloc] initWithFrame:CGRectMake(_cancelButton.frame.origin.x + _cancelButton.frame.size.width + separatorWidth, 0, CGFloor(_panelView.frame.size.width / 2), _panelView.frame.size.height)];
|
||||
_setButton.backgroundColor = [UIColor clearColor];
|
||||
//_setButton.highlightBackgroundColor = self.presentation.pallete.selectionColor;
|
||||
_setButton.enabled = !imageLoading;
|
||||
[_setButton addTarget:self action:@selector(doneButtonPressed) forControlEvents:UIControlEventTouchUpInside];
|
||||
[_setButton setTitle:TGLocalized(@"Wallpaper.Set") forState:UIControlStateNormal];
|
||||
_setButton.titleLabel.font = TGSystemFontOfSize(17);
|
||||
[_setButton setTitleColor:pallete.titleColor];
|
||||
//[_setButton setTitleColor:[self.presentation.pallete.textColor colorWithAlphaComponent:0.4f] forState:UIControlStateDisabled];
|
||||
[_setButton setTitleShadowColor:[UIColor clearColor] forState:UIControlStateNormal];
|
||||
[_panelView addSubview:_setButton];
|
||||
|
||||
_separatorView = [[UIView alloc] initWithFrame:CGRectMake(CGFloor(_panelView.frame.size.width / 2) - separatorWidth, 0, separatorWidth, 49.0f)];
|
||||
_separatorView.backgroundColor = pallete.separatorColor;
|
||||
[_panelView addSubview:_separatorView];
|
||||
|
||||
_bottomView = [[UIView alloc] initWithFrame:CGRectMake(0.0f, 49.0f, _panelView.frame.size.width, separatorWidth)];
|
||||
_bottomView.autoresizingMask = UIViewAutoresizingFlexibleWidth;
|
||||
_bottomView.backgroundColor = pallete.separatorColor;
|
||||
//[_panelView addSubview:_bottomView];
|
||||
}
|
||||
|
||||
- (void)layoutControllerForSize:(CGSize)size duration:(NSTimeInterval)duration {
|
||||
[super layoutControllerForSize:size duration:duration];
|
||||
|
||||
CGSize screenSize = self.view.bounds.size;
|
||||
|
||||
_imageView.frame = CGRectMake(0.0f, 0.0f, screenSize.width, screenSize.height);
|
||||
|
||||
UIImage *immediateImage = [_wallpaperInfo image];
|
||||
if (_enableWallpaperAdjustment && immediateImage != nil)
|
||||
{
|
||||
_scrollView.frame = CGRectMake(0.0f, 0.0f, screenSize.width, screenSize.height);
|
||||
|
||||
_scrollView.showsHorizontalScrollIndicator = false;
|
||||
_scrollView.showsVerticalScrollIndicator = false;
|
||||
_scrollView.delegate = self;
|
||||
|
||||
_adjustingImageScale = immediateImage.scale;
|
||||
_adjustingImageSize = CGSizeMake(immediateImage.size.width / _adjustingImageScale, immediateImage.size.height / _adjustingImageScale);
|
||||
|
||||
_imageView.frame = CGRectMake(0, 0, _adjustingImageSize.width, _adjustingImageSize.height);
|
||||
_imageView.contentMode = UIViewContentModeScaleToFill;
|
||||
|
||||
[self _adjustScrollView];
|
||||
_scrollView.zoomScale = _scrollView.minimumZoomScale;
|
||||
|
||||
CGSize contentSize = _scrollView.contentSize;
|
||||
CGSize viewSize = _scrollView.frame.size;
|
||||
_scrollView.contentOffset = CGPointMake(MAX(0, CGFloor((contentSize.width - viewSize.width) / 2)), MAX(0, CGFloor((contentSize.height - viewSize.height) / 2)));
|
||||
}
|
||||
else
|
||||
{
|
||||
_imageView.contentMode = UIViewContentModeScaleAspectFill;
|
||||
}
|
||||
|
||||
_panelView.frame = CGRectMake(0, screenSize.height - 49.0f - self.controllerSafeAreaInset.bottom, screenSize.width, 49.0f + self.controllerSafeAreaInset.bottom);
|
||||
|
||||
CGFloat separatorWidth = TGScreenPixel;
|
||||
|
||||
_cancelButton.frame = CGRectMake(0, 0, CGFloor(_panelView.frame.size.width / 2) - separatorWidth, 49.0f);
|
||||
|
||||
_setButton.frame = CGRectMake(_cancelButton.frame.origin.x + _cancelButton.frame.size.width + separatorWidth, 0, CGFloor(_panelView.frame.size.width / 2), 49.0f);
|
||||
|
||||
_separatorView.frame = CGRectMake(CGFloor(_panelView.frame.size.width / 2) - separatorWidth, 0, separatorWidth, 49.0f + self.controllerSafeAreaInset.bottom);
|
||||
}
|
||||
|
||||
- (void)controllerInsetUpdated:(UIEdgeInsets)previousInset
|
||||
{
|
||||
[super controllerInsetUpdated:previousInset];
|
||||
|
||||
_panelView.frame = CGRectMake(0, self.view.bounds.size.height - 49.0f - self.controllerSafeAreaInset.bottom, self.view.bounds.size.width, 49.0f + self.controllerSafeAreaInset.bottom);
|
||||
|
||||
CGFloat separatorWidth = TGScreenPixel;
|
||||
_separatorView.frame = CGRectMake(CGFloor(_panelView.frame.size.width / 2) - separatorWidth, 0, separatorWidth, 49.0f + self.controllerSafeAreaInset.bottom);
|
||||
}
|
||||
|
||||
- (BOOL)shouldAutorotate
|
||||
{
|
||||
return [[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPad;
|
||||
}
|
||||
|
||||
- (UIInterfaceOrientationMask)supportedInterfaceOrientations
|
||||
{
|
||||
return UIInterfaceOrientationMaskPortrait;
|
||||
}
|
||||
|
||||
#pragma mark -
|
||||
|
||||
- (void)scrollViewDidZoom:(UIScrollView *)__unused scrollView
|
||||
{
|
||||
[self _adjustScrollView];
|
||||
}
|
||||
|
||||
- (void)scrollViewDidEndZooming:(UIScrollView *)__unused scrollView withView:(UIView *)__unused view atScale:(CGFloat)__unused scale
|
||||
{
|
||||
[self _adjustScrollView];
|
||||
}
|
||||
|
||||
- (UIView *)viewForZoomingInScrollView:(UIScrollView *)__unused scrollView
|
||||
{
|
||||
return _imageView;
|
||||
}
|
||||
|
||||
- (void)_adjustScrollView
|
||||
{
|
||||
CGSize imageSize = _adjustingImageSize;
|
||||
CGFloat imageScale = _adjustingImageScale;
|
||||
imageSize.width /= imageScale;
|
||||
imageSize.height /= imageScale;
|
||||
|
||||
CGFloat scaleWidth = _scrollView.frame.size.width / imageSize.width;
|
||||
CGFloat scaleHeight = _scrollView.frame.size.height / imageSize.height;
|
||||
CGFloat minScale = MAX(scaleWidth, scaleHeight);
|
||||
|
||||
if (_scrollView.minimumZoomScale != minScale)
|
||||
_scrollView.minimumZoomScale = minScale;
|
||||
if (_scrollView.maximumZoomScale != minScale * 3.0f)
|
||||
_scrollView.maximumZoomScale = minScale * 3.0f;
|
||||
|
||||
CGSize boundsSize = _scrollView.bounds.size;
|
||||
CGRect contentsFrame = _imageView.frame;
|
||||
|
||||
if (boundsSize.width > contentsFrame.size.width)
|
||||
contentsFrame.origin.x = (boundsSize.width - contentsFrame.size.width) / 2.0f;
|
||||
else
|
||||
contentsFrame.origin.x = 0;
|
||||
|
||||
if (boundsSize.height > contentsFrame.size.height)
|
||||
contentsFrame.origin.y = (boundsSize.height - contentsFrame.size.height) / 2.0f;
|
||||
else
|
||||
contentsFrame.origin.y = 0;
|
||||
|
||||
_imageView.frame = contentsFrame;
|
||||
}
|
||||
|
||||
#pragma mark
|
||||
|
||||
- (void)cancelButtonPressed
|
||||
{
|
||||
if (_customDismiss) {
|
||||
_customDismiss();
|
||||
} else {
|
||||
if (self.navigationController != nil)
|
||||
[self.navigationController popViewControllerAnimated:true];
|
||||
else
|
||||
[self.presentingViewController dismissViewControllerAnimated:true completion:nil];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)doneButtonPressed
|
||||
{
|
||||
UIImage *currentImage = [_imageView currentImage];
|
||||
if (currentImage != nil)
|
||||
{
|
||||
TGWallpaperInfo *selectedWallpaperInfo = _wallpaperInfo;
|
||||
|
||||
if (_enableWallpaperAdjustment)
|
||||
{
|
||||
CGSize screenSize = self.view.bounds.size;
|
||||
CGFloat screenScale = [UIScreen mainScreen].scale;
|
||||
screenSize.width *= screenScale;
|
||||
screenSize.height *= screenScale;
|
||||
|
||||
CGFloat screenSide = MAX(screenSize.width, screenSize.height);
|
||||
|
||||
CGFloat scale = 1.0f / _scrollView.zoomScale;
|
||||
|
||||
CGRect visibleRect;
|
||||
visibleRect.origin.x = _scrollView.contentOffset.x * scale;
|
||||
visibleRect.origin.y = _scrollView.contentOffset.y * scale;
|
||||
visibleRect.size.width = _scrollView.bounds.size.width * scale;
|
||||
visibleRect.size.height = _scrollView.bounds.size.height * scale;
|
||||
|
||||
UIImage *croppedImage = TGFixOrientationAndCrop(currentImage, visibleRect, TGFitSize(visibleRect.size, CGSizeMake(screenSide, screenSide)));
|
||||
if (croppedImage != nil)
|
||||
selectedWallpaperInfo = [[TGCustomImageWallpaperInfo alloc] initWithImage:croppedImage];
|
||||
}
|
||||
|
||||
id<TGWallpaperControllerDelegate> delegate = _delegate;
|
||||
if ([delegate respondsToSelector:@selector(wallpaperController:didSelectWallpaperWithInfo:)])
|
||||
[delegate wallpaperController:self didSelectWallpaperWithInfo:selectedWallpaperInfo];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)actionStageActionRequested:(NSString *)action options:(id)__unused options
|
||||
{
|
||||
if ([action isEqualToString:@"imageLoaded"])
|
||||
{
|
||||
_setButton.enabled = true;
|
||||
}
|
||||
}
|
||||
|
||||
@end
|
||||
@ -1,21 +0,0 @@
|
||||
#import <Foundation/Foundation.h>
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
@interface TGWallpaperInfo : NSObject
|
||||
|
||||
- (NSString *)thumbnailUrl;
|
||||
- (NSString *)fullscreenUrl;
|
||||
- (int)tintColor;
|
||||
- (CGFloat)systemAlpha;
|
||||
- (CGFloat)buttonsAlpha;
|
||||
- (CGFloat)highlightedButtonAlpha;
|
||||
- (CGFloat)progressAlpha;
|
||||
|
||||
- (UIImage *)image;
|
||||
- (NSData *)imageData;
|
||||
- (bool)hasData;
|
||||
|
||||
- (NSDictionary *)infoDictionary;
|
||||
+ (TGWallpaperInfo *)infoWithDictionary:(NSDictionary *)dict;
|
||||
|
||||
@end
|
||||
@ -1,68 +0,0 @@
|
||||
|
||||
|
||||
#import "TGWallpaperInfo.h"
|
||||
|
||||
@implementation TGWallpaperInfo
|
||||
|
||||
- (NSString *)thumbnailUrl
|
||||
{
|
||||
return nil;
|
||||
}
|
||||
|
||||
- (NSString *)fullscreenUrl
|
||||
{
|
||||
return nil;
|
||||
}
|
||||
|
||||
- (int)tintColor
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
- (CGFloat)systemAlpha
|
||||
{
|
||||
return 0.25f;
|
||||
}
|
||||
|
||||
- (CGFloat)buttonsAlpha
|
||||
{
|
||||
return 0.35f;
|
||||
}
|
||||
|
||||
- (CGFloat)highlightedButtonAlpha
|
||||
{
|
||||
return 0.50f;
|
||||
}
|
||||
|
||||
- (CGFloat)progressAlpha
|
||||
{
|
||||
return 0.35f;
|
||||
}
|
||||
|
||||
- (UIImage *)image
|
||||
{
|
||||
return nil;
|
||||
}
|
||||
|
||||
- (NSData *)imageData
|
||||
{
|
||||
return nil;
|
||||
}
|
||||
|
||||
- (bool)hasData
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
- (NSDictionary *)infoDictionary
|
||||
{
|
||||
return @{};
|
||||
}
|
||||
|
||||
+ (TGWallpaperInfo *)infoWithDictionary:(NSDictionary *)dict
|
||||
{
|
||||
Class className = NSClassFromString(dict[@"_className"]);
|
||||
return [className infoWithDictionary:dict];
|
||||
}
|
||||
|
||||
@end
|
||||
@ -546,8 +546,6 @@
|
||||
D04269121F586E430037ECE8 /* TGVideoCameraPipeline.m in Sources */ = {isa = PBXBuildFile; fileRef = D04269101F586E430037ECE8 /* TGVideoCameraPipeline.m */; };
|
||||
D04269151F586EC80037ECE8 /* TGVideoMessageCaptureController.h in Headers */ = {isa = PBXBuildFile; fileRef = D04269131F586EC80037ECE8 /* TGVideoMessageCaptureController.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
D04269161F586EC80037ECE8 /* TGVideoMessageCaptureController.m in Sources */ = {isa = PBXBuildFile; fileRef = D04269141F586EC80037ECE8 /* TGVideoMessageCaptureController.m */; };
|
||||
D07ABBA8202A193A003671DE /* TGWallpaperController.m in Sources */ = {isa = PBXBuildFile; fileRef = D07ABBA6202A1939003671DE /* TGWallpaperController.m */; };
|
||||
D07ABBA9202A193A003671DE /* TGWallpaperController.h in Headers */ = {isa = PBXBuildFile; fileRef = D07ABBA7202A1939003671DE /* TGWallpaperController.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
D07BC6CF1F2A18B700ED97AA /* TGCameraMainPhoneView.h in Headers */ = {isa = PBXBuildFile; fileRef = D07BC6C91F2A18B700ED97AA /* TGCameraMainPhoneView.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
D07BC6D01F2A18B700ED97AA /* TGCameraMainPhoneView.m in Sources */ = {isa = PBXBuildFile; fileRef = D07BC6CA1F2A18B700ED97AA /* TGCameraMainPhoneView.m */; };
|
||||
D07BC6D11F2A18B700ED97AA /* TGCameraMainTabletView.h in Headers */ = {isa = PBXBuildFile; fileRef = D07BC6CB1F2A18B700ED97AA /* TGCameraMainTabletView.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
@ -1061,35 +1059,8 @@
|
||||
D07BCAFB1F2B517900ED97AA /* TGLegacyMediaPickerTipView.h in Headers */ = {isa = PBXBuildFile; fileRef = D07BCAF91F2B517900ED97AA /* TGLegacyMediaPickerTipView.h */; };
|
||||
D07BCAFC1F2B517900ED97AA /* TGLegacyMediaPickerTipView.m in Sources */ = {isa = PBXBuildFile; fileRef = D07BCAFA1F2B517900ED97AA /* TGLegacyMediaPickerTipView.m */; };
|
||||
D07BCB021F2B546400ED97AA /* LegacyComponentsContext.m in Sources */ = {isa = PBXBuildFile; fileRef = D07BCB011F2B546400ED97AA /* LegacyComponentsContext.m */; };
|
||||
D07BCB151F2B646A00ED97AA /* TGPasswordEntryView.h in Headers */ = {isa = PBXBuildFile; fileRef = D07BCB041F2B646A00ED97AA /* TGPasswordEntryView.h */; };
|
||||
D07BCB161F2B646A00ED97AA /* TGPasswordEntryView.m in Sources */ = {isa = PBXBuildFile; fileRef = D07BCB051F2B646A00ED97AA /* TGPasswordEntryView.m */; };
|
||||
D07BCB171F2B646A00ED97AA /* TGPasscodeEntryController.h in Headers */ = {isa = PBXBuildFile; fileRef = D07BCB061F2B646A00ED97AA /* TGPasscodeEntryController.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
D07BCB181F2B646A00ED97AA /* TGPasscodeEntryController.m in Sources */ = {isa = PBXBuildFile; fileRef = D07BCB071F2B646A00ED97AA /* TGPasscodeEntryController.m */; };
|
||||
D07BCB191F2B646A00ED97AA /* TGPasscodeEntryKeyboardView.h in Headers */ = {isa = PBXBuildFile; fileRef = D07BCB081F2B646A00ED97AA /* TGPasscodeEntryKeyboardView.h */; };
|
||||
D07BCB1A1F2B646A00ED97AA /* TGPasscodeEntryKeyboardView.m in Sources */ = {isa = PBXBuildFile; fileRef = D07BCB091F2B646A00ED97AA /* TGPasscodeEntryKeyboardView.m */; };
|
||||
D07BCB1B1F2B646A00ED97AA /* TGPasscodePinDotView.h in Headers */ = {isa = PBXBuildFile; fileRef = D07BCB0A1F2B646A00ED97AA /* TGPasscodePinDotView.h */; };
|
||||
D07BCB1C1F2B646A00ED97AA /* TGPasscodePinDotView.m in Sources */ = {isa = PBXBuildFile; fileRef = D07BCB0B1F2B646A00ED97AA /* TGPasscodePinDotView.m */; };
|
||||
D07BCB1D1F2B646A00ED97AA /* TGPasscodePinView.h in Headers */ = {isa = PBXBuildFile; fileRef = D07BCB0C1F2B646A00ED97AA /* TGPasscodePinView.h */; };
|
||||
D07BCB1E1F2B646A00ED97AA /* TGPasscodePinView.m in Sources */ = {isa = PBXBuildFile; fileRef = D07BCB0D1F2B646A00ED97AA /* TGPasscodePinView.m */; };
|
||||
D07BCB1F1F2B646A00ED97AA /* TGPasscodeButtonView.h in Headers */ = {isa = PBXBuildFile; fileRef = D07BCB0E1F2B646A00ED97AA /* TGPasscodeButtonView.h */; };
|
||||
D07BCB201F2B646A00ED97AA /* TGPasscodeButtonView.m in Sources */ = {isa = PBXBuildFile; fileRef = D07BCB0F1F2B646A00ED97AA /* TGPasscodeButtonView.m */; };
|
||||
D07BCB211F2B646A00ED97AA /* TGPasscodeBackground.h in Headers */ = {isa = PBXBuildFile; fileRef = D07BCB101F2B646A00ED97AA /* TGPasscodeBackground.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
D07BCB221F2B646A00ED97AA /* TGTextField.h in Headers */ = {isa = PBXBuildFile; fileRef = D07BCB111F2B646A00ED97AA /* TGTextField.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
D07BCB231F2B646A00ED97AA /* TGTextField.m in Sources */ = {isa = PBXBuildFile; fileRef = D07BCB121F2B646A00ED97AA /* TGTextField.m */; };
|
||||
D07BCB241F2B646A00ED97AA /* TGDefaultPasscodeBackground.h in Headers */ = {isa = PBXBuildFile; fileRef = D07BCB131F2B646A00ED97AA /* TGDefaultPasscodeBackground.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
D07BCB251F2B646A00ED97AA /* TGDefaultPasscodeBackground.m in Sources */ = {isa = PBXBuildFile; fileRef = D07BCB141F2B646A00ED97AA /* TGDefaultPasscodeBackground.m */; };
|
||||
D07BCB281F2B652C00ED97AA /* TGImageBasedPasscodeBackground.h in Headers */ = {isa = PBXBuildFile; fileRef = D07BCB261F2B652C00ED97AA /* TGImageBasedPasscodeBackground.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
D07BCB291F2B652C00ED97AA /* TGImageBasedPasscodeBackground.m in Sources */ = {isa = PBXBuildFile; fileRef = D07BCB271F2B652C00ED97AA /* TGImageBasedPasscodeBackground.m */; };
|
||||
D07BCB351F2B65F100ED97AA /* TGBuiltinWallpaperInfo.h in Headers */ = {isa = PBXBuildFile; fileRef = D07BCB2B1F2B65F100ED97AA /* TGBuiltinWallpaperInfo.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
D07BCB361F2B65F100ED97AA /* TGBuiltinWallpaperInfo.m in Sources */ = {isa = PBXBuildFile; fileRef = D07BCB2C1F2B65F100ED97AA /* TGBuiltinWallpaperInfo.m */; };
|
||||
D07BCB371F2B65F100ED97AA /* TGColorWallpaperInfo.h in Headers */ = {isa = PBXBuildFile; fileRef = D07BCB2D1F2B65F100ED97AA /* TGColorWallpaperInfo.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
D07BCB381F2B65F100ED97AA /* TGColorWallpaperInfo.m in Sources */ = {isa = PBXBuildFile; fileRef = D07BCB2E1F2B65F100ED97AA /* TGColorWallpaperInfo.m */; };
|
||||
D07BCB391F2B65F100ED97AA /* TGCustomImageWallpaperInfo.h in Headers */ = {isa = PBXBuildFile; fileRef = D07BCB2F1F2B65F100ED97AA /* TGCustomImageWallpaperInfo.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
D07BCB3A1F2B65F100ED97AA /* TGCustomImageWallpaperInfo.m in Sources */ = {isa = PBXBuildFile; fileRef = D07BCB301F2B65F100ED97AA /* TGCustomImageWallpaperInfo.m */; };
|
||||
D07BCB3B1F2B65F100ED97AA /* TGRemoteWallpaperInfo.h in Headers */ = {isa = PBXBuildFile; fileRef = D07BCB311F2B65F100ED97AA /* TGRemoteWallpaperInfo.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
D07BCB3C1F2B65F100ED97AA /* TGRemoteWallpaperInfo.m in Sources */ = {isa = PBXBuildFile; fileRef = D07BCB321F2B65F100ED97AA /* TGRemoteWallpaperInfo.m */; };
|
||||
D07BCB3D1F2B65F100ED97AA /* TGWallpaperInfo.h in Headers */ = {isa = PBXBuildFile; fileRef = D07BCB331F2B65F100ED97AA /* TGWallpaperInfo.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
D07BCB3E1F2B65F100ED97AA /* TGWallpaperInfo.m in Sources */ = {isa = PBXBuildFile; fileRef = D07BCB341F2B65F100ED97AA /* TGWallpaperInfo.m */; };
|
||||
D07BCB5B1F2B6A5600ED97AA /* TGPIPAblePlayerView.h in Headers */ = {isa = PBXBuildFile; fileRef = D07BCB401F2B6A5600ED97AA /* TGPIPAblePlayerView.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
D07BCB5C1F2B6A5600ED97AA /* TGEmbedInstagramPlayerView.h in Headers */ = {isa = PBXBuildFile; fileRef = D07BCB411F2B6A5600ED97AA /* TGEmbedInstagramPlayerView.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
D07BCB5D1F2B6A5600ED97AA /* TGEmbedInstagramPlayerView.m in Sources */ = {isa = PBXBuildFile; fileRef = D07BCB421F2B6A5600ED97AA /* TGEmbedInstagramPlayerView.m */; };
|
||||
@ -1746,8 +1717,6 @@
|
||||
D04269101F586E430037ECE8 /* TGVideoCameraPipeline.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TGVideoCameraPipeline.m; sourceTree = "<group>"; };
|
||||
D04269131F586EC80037ECE8 /* TGVideoMessageCaptureController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TGVideoMessageCaptureController.h; sourceTree = "<group>"; };
|
||||
D04269141F586EC80037ECE8 /* TGVideoMessageCaptureController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TGVideoMessageCaptureController.m; sourceTree = "<group>"; };
|
||||
D07ABBA6202A1939003671DE /* TGWallpaperController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TGWallpaperController.m; sourceTree = "<group>"; };
|
||||
D07ABBA7202A1939003671DE /* TGWallpaperController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TGWallpaperController.h; sourceTree = "<group>"; };
|
||||
D07BC6C91F2A18B700ED97AA /* TGCameraMainPhoneView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TGCameraMainPhoneView.h; sourceTree = "<group>"; };
|
||||
D07BC6CA1F2A18B700ED97AA /* TGCameraMainPhoneView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TGCameraMainPhoneView.m; sourceTree = "<group>"; };
|
||||
D07BC6CB1F2A18B700ED97AA /* TGCameraMainTabletView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TGCameraMainTabletView.h; sourceTree = "<group>"; };
|
||||
@ -2261,35 +2230,8 @@
|
||||
D07BCAF91F2B517900ED97AA /* TGLegacyMediaPickerTipView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TGLegacyMediaPickerTipView.h; sourceTree = "<group>"; };
|
||||
D07BCAFA1F2B517900ED97AA /* TGLegacyMediaPickerTipView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TGLegacyMediaPickerTipView.m; sourceTree = "<group>"; };
|
||||
D07BCB011F2B546400ED97AA /* LegacyComponentsContext.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LegacyComponentsContext.m; sourceTree = "<group>"; };
|
||||
D07BCB041F2B646A00ED97AA /* TGPasswordEntryView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TGPasswordEntryView.h; sourceTree = "<group>"; };
|
||||
D07BCB051F2B646A00ED97AA /* TGPasswordEntryView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TGPasswordEntryView.m; sourceTree = "<group>"; };
|
||||
D07BCB061F2B646A00ED97AA /* TGPasscodeEntryController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TGPasscodeEntryController.h; sourceTree = "<group>"; };
|
||||
D07BCB071F2B646A00ED97AA /* TGPasscodeEntryController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TGPasscodeEntryController.m; sourceTree = "<group>"; };
|
||||
D07BCB081F2B646A00ED97AA /* TGPasscodeEntryKeyboardView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TGPasscodeEntryKeyboardView.h; sourceTree = "<group>"; };
|
||||
D07BCB091F2B646A00ED97AA /* TGPasscodeEntryKeyboardView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TGPasscodeEntryKeyboardView.m; sourceTree = "<group>"; };
|
||||
D07BCB0A1F2B646A00ED97AA /* TGPasscodePinDotView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TGPasscodePinDotView.h; sourceTree = "<group>"; };
|
||||
D07BCB0B1F2B646A00ED97AA /* TGPasscodePinDotView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TGPasscodePinDotView.m; sourceTree = "<group>"; };
|
||||
D07BCB0C1F2B646A00ED97AA /* TGPasscodePinView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TGPasscodePinView.h; sourceTree = "<group>"; };
|
||||
D07BCB0D1F2B646A00ED97AA /* TGPasscodePinView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TGPasscodePinView.m; sourceTree = "<group>"; };
|
||||
D07BCB0E1F2B646A00ED97AA /* TGPasscodeButtonView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TGPasscodeButtonView.h; sourceTree = "<group>"; };
|
||||
D07BCB0F1F2B646A00ED97AA /* TGPasscodeButtonView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TGPasscodeButtonView.m; sourceTree = "<group>"; };
|
||||
D07BCB101F2B646A00ED97AA /* TGPasscodeBackground.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TGPasscodeBackground.h; sourceTree = "<group>"; };
|
||||
D07BCB111F2B646A00ED97AA /* TGTextField.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TGTextField.h; sourceTree = "<group>"; };
|
||||
D07BCB121F2B646A00ED97AA /* TGTextField.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TGTextField.m; sourceTree = "<group>"; };
|
||||
D07BCB131F2B646A00ED97AA /* TGDefaultPasscodeBackground.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TGDefaultPasscodeBackground.h; sourceTree = "<group>"; };
|
||||
D07BCB141F2B646A00ED97AA /* TGDefaultPasscodeBackground.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TGDefaultPasscodeBackground.m; sourceTree = "<group>"; };
|
||||
D07BCB261F2B652C00ED97AA /* TGImageBasedPasscodeBackground.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TGImageBasedPasscodeBackground.h; sourceTree = "<group>"; };
|
||||
D07BCB271F2B652C00ED97AA /* TGImageBasedPasscodeBackground.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TGImageBasedPasscodeBackground.m; sourceTree = "<group>"; };
|
||||
D07BCB2B1F2B65F100ED97AA /* TGBuiltinWallpaperInfo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TGBuiltinWallpaperInfo.h; sourceTree = "<group>"; };
|
||||
D07BCB2C1F2B65F100ED97AA /* TGBuiltinWallpaperInfo.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TGBuiltinWallpaperInfo.m; sourceTree = "<group>"; };
|
||||
D07BCB2D1F2B65F100ED97AA /* TGColorWallpaperInfo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TGColorWallpaperInfo.h; sourceTree = "<group>"; };
|
||||
D07BCB2E1F2B65F100ED97AA /* TGColorWallpaperInfo.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TGColorWallpaperInfo.m; sourceTree = "<group>"; };
|
||||
D07BCB2F1F2B65F100ED97AA /* TGCustomImageWallpaperInfo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TGCustomImageWallpaperInfo.h; sourceTree = "<group>"; };
|
||||
D07BCB301F2B65F100ED97AA /* TGCustomImageWallpaperInfo.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TGCustomImageWallpaperInfo.m; sourceTree = "<group>"; };
|
||||
D07BCB311F2B65F100ED97AA /* TGRemoteWallpaperInfo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TGRemoteWallpaperInfo.h; sourceTree = "<group>"; };
|
||||
D07BCB321F2B65F100ED97AA /* TGRemoteWallpaperInfo.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TGRemoteWallpaperInfo.m; sourceTree = "<group>"; };
|
||||
D07BCB331F2B65F100ED97AA /* TGWallpaperInfo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TGWallpaperInfo.h; sourceTree = "<group>"; };
|
||||
D07BCB341F2B65F100ED97AA /* TGWallpaperInfo.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TGWallpaperInfo.m; sourceTree = "<group>"; };
|
||||
D07BCB401F2B6A5600ED97AA /* TGPIPAblePlayerView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TGPIPAblePlayerView.h; sourceTree = "<group>"; };
|
||||
D07BCB411F2B6A5600ED97AA /* TGEmbedInstagramPlayerView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TGEmbedInstagramPlayerView.h; sourceTree = "<group>"; };
|
||||
D07BCB421F2B6A5600ED97AA /* TGEmbedInstagramPlayerView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TGEmbedInstagramPlayerView.m; sourceTree = "<group>"; };
|
||||
@ -2510,8 +2452,6 @@
|
||||
D07BCA6F1F2B441F00ED97AA /* Media Assets Picker */,
|
||||
D07BCAB41F2B4DD600ED97AA /* Attachment Menu */,
|
||||
D07BC82C1F2A2CFE00ED97AA /* Secret Timer */,
|
||||
D07BCB031F2B63D700ED97AA /* Passcode */,
|
||||
D07BCB2A1F2B65C400ED97AA /* Wallpapers */,
|
||||
D07BCB3F1F2B69D400ED97AA /* Embed Video */,
|
||||
D02660331F34A7DA000E2DC5 /* Location */,
|
||||
09750FAE1F30DAE1001B9886 /* Clipboard Menu */,
|
||||
@ -2815,6 +2755,8 @@
|
||||
D07BCC041F2B82D100ED97AA /* TGModernConversationTitleActivityIndicator.m */,
|
||||
D02660801F34B986000E2DC5 /* TGListsTableView.h */,
|
||||
D02660811F34B986000E2DC5 /* TGListsTableView.m */,
|
||||
D07BCB111F2B646A00ED97AA /* TGTextField.h */,
|
||||
D07BCB121F2B646A00ED97AA /* TGTextField.m */,
|
||||
D02660841F34B9B1000E2DC5 /* TGSearchBar.h */,
|
||||
D02660851F34B9B1000E2DC5 /* TGSearchBar.m */,
|
||||
D02660881F34B9F9000E2DC5 /* TGSearchDisplayMixin.h */,
|
||||
@ -3742,51 +3684,6 @@
|
||||
name = "Attachment Menu";
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
D07BCB031F2B63D700ED97AA /* Passcode */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
D07BCB041F2B646A00ED97AA /* TGPasswordEntryView.h */,
|
||||
D07BCB051F2B646A00ED97AA /* TGPasswordEntryView.m */,
|
||||
D07BCB061F2B646A00ED97AA /* TGPasscodeEntryController.h */,
|
||||
D07BCB071F2B646A00ED97AA /* TGPasscodeEntryController.m */,
|
||||
D07BCB081F2B646A00ED97AA /* TGPasscodeEntryKeyboardView.h */,
|
||||
D07BCB091F2B646A00ED97AA /* TGPasscodeEntryKeyboardView.m */,
|
||||
D07BCB0A1F2B646A00ED97AA /* TGPasscodePinDotView.h */,
|
||||
D07BCB0B1F2B646A00ED97AA /* TGPasscodePinDotView.m */,
|
||||
D07BCB0C1F2B646A00ED97AA /* TGPasscodePinView.h */,
|
||||
D07BCB0D1F2B646A00ED97AA /* TGPasscodePinView.m */,
|
||||
D07BCB0E1F2B646A00ED97AA /* TGPasscodeButtonView.h */,
|
||||
D07BCB0F1F2B646A00ED97AA /* TGPasscodeButtonView.m */,
|
||||
D07BCB101F2B646A00ED97AA /* TGPasscodeBackground.h */,
|
||||
D07BCB111F2B646A00ED97AA /* TGTextField.h */,
|
||||
D07BCB121F2B646A00ED97AA /* TGTextField.m */,
|
||||
D07BCB131F2B646A00ED97AA /* TGDefaultPasscodeBackground.h */,
|
||||
D07BCB141F2B646A00ED97AA /* TGDefaultPasscodeBackground.m */,
|
||||
D07BCB261F2B652C00ED97AA /* TGImageBasedPasscodeBackground.h */,
|
||||
D07BCB271F2B652C00ED97AA /* TGImageBasedPasscodeBackground.m */,
|
||||
);
|
||||
name = Passcode;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
D07BCB2A1F2B65C400ED97AA /* Wallpapers */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
D07ABBA7202A1939003671DE /* TGWallpaperController.h */,
|
||||
D07ABBA6202A1939003671DE /* TGWallpaperController.m */,
|
||||
D07BCB2B1F2B65F100ED97AA /* TGBuiltinWallpaperInfo.h */,
|
||||
D07BCB2C1F2B65F100ED97AA /* TGBuiltinWallpaperInfo.m */,
|
||||
D07BCB2D1F2B65F100ED97AA /* TGColorWallpaperInfo.h */,
|
||||
D07BCB2E1F2B65F100ED97AA /* TGColorWallpaperInfo.m */,
|
||||
D07BCB2F1F2B65F100ED97AA /* TGCustomImageWallpaperInfo.h */,
|
||||
D07BCB301F2B65F100ED97AA /* TGCustomImageWallpaperInfo.m */,
|
||||
D07BCB311F2B65F100ED97AA /* TGRemoteWallpaperInfo.h */,
|
||||
D07BCB321F2B65F100ED97AA /* TGRemoteWallpaperInfo.m */,
|
||||
D07BCB331F2B65F100ED97AA /* TGWallpaperInfo.h */,
|
||||
D07BCB341F2B65F100ED97AA /* TGWallpaperInfo.m */,
|
||||
);
|
||||
name = Wallpapers;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
D07BCB3F1F2B69D400ED97AA /* Embed Video */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
@ -3962,7 +3859,6 @@
|
||||
D01778F71F20CDAC0044446D /* TGHacks.h in Headers */,
|
||||
D01779161F20F4500044446D /* TGStaticBackdropImageData.h in Headers */,
|
||||
D01779031F20D16B0044446D /* FreedomUIKit.h in Headers */,
|
||||
D07BCB241F2B646A00ED97AA /* TGDefaultPasscodeBackground.h in Headers */,
|
||||
D07BCA2D1F2A9A9600ED97AA /* TGModernGalleryImageItemView.h in Headers */,
|
||||
D07BCBBD1F2B6F6300ED97AA /* CBCoubVideoSource.h in Headers */,
|
||||
D07BC6D11F2A18B700ED97AA /* TGCameraMainTabletView.h in Headers */,
|
||||
@ -4024,7 +3920,6 @@
|
||||
D01778BE1F200A9A0044446D /* UIScrollView+TGHacks.h in Headers */,
|
||||
D07BCBD31F2B6FFE00ED97AA /* LegacyHTTPRequestOperation.h in Headers */,
|
||||
D0177A6F1F2201F00044446D /* TGModernGalleryDefaultFooterView.h in Headers */,
|
||||
D07BCB371F2B65F100ED97AA /* TGColorWallpaperInfo.h in Headers */,
|
||||
D01777F61F1F961D0044446D /* TGPeerIdAdapter.h in Headers */,
|
||||
D07BC82A1F2A2C0B00ED97AA /* PGWarmthTool.h in Headers */,
|
||||
D07BC7FC1F2A2C0B00ED97AA /* PGExposureTool.h in Headers */,
|
||||
@ -4038,7 +3933,6 @@
|
||||
D07BCADF1F2B4F5E00ED97AA /* TGLegacyCameraController.h in Headers */,
|
||||
D017782F1F1F961D0044446D /* TGReplyMarkupAttachment.h in Headers */,
|
||||
0916FEA720A1EA7B0084A755 /* TGPassportScanView.h in Headers */,
|
||||
D07BCB211F2B646A00ED97AA /* TGPasscodeBackground.h in Headers */,
|
||||
D01778371F1F961D0044446D /* TGAudioMediaAttachment.h in Headers */,
|
||||
D07BC6F51F2A19A700ED97AA /* TGCameraSegmentsView.h in Headers */,
|
||||
D04269051F586A070037ECE8 /* TGVideoMessageScrubber.h in Headers */,
|
||||
@ -4061,7 +3955,6 @@
|
||||
D07BC81A1F2A2C0B00ED97AA /* PGPhotoHistogramGenerator.h in Headers */,
|
||||
D0177B181F2641B10044446D /* PGCameraDeviceAngleSampler.h in Headers */,
|
||||
D0177A0A1F2139980044446D /* POPSpringSolver.h in Headers */,
|
||||
D07BCB3D1F2B65F100ED97AA /* TGWallpaperInfo.h in Headers */,
|
||||
D04268F91F58687D0037ECE8 /* TGVideoCameraGLView.h in Headers */,
|
||||
D017794F1F2100280044446D /* TGMediaSelectionContext.h in Headers */,
|
||||
D01778111F1F961D0044446D /* TGMessageEntityBold.h in Headers */,
|
||||
@ -4155,9 +4048,7 @@
|
||||
D017781F1F1F961D0044446D /* TGMessageEntityMentionName.h in Headers */,
|
||||
D0177AD91F23D9B80044446D /* SGraphListNode.h in Headers */,
|
||||
D07BCA571F2A9E1600ED97AA /* TGDraggableCollectionViewFlowLayout.h in Headers */,
|
||||
D07BCB151F2B646A00ED97AA /* TGPasswordEntryView.h in Headers */,
|
||||
D0177A041F2139980044446D /* POPPropertyAnimation.h in Headers */,
|
||||
D07BCB281F2B652C00ED97AA /* TGImageBasedPasscodeBackground.h in Headers */,
|
||||
D07BC8CB1F2A37EC00ED97AA /* TGPhotoPaintSelectionContainerView.h in Headers */,
|
||||
D07BCB621F2B6A5600ED97AA /* TGEmbedPlayerControls.h in Headers */,
|
||||
D07BC7371F2A2A7D00ED97AA /* PGPhotoEditorPicture.h in Headers */,
|
||||
@ -4197,7 +4088,6 @@
|
||||
D07BC85C1F2A2DBD00ED97AA /* TGMenuSheetItemView.h in Headers */,
|
||||
D07BC8721F2A2F6500ED97AA /* TGInputTextTag.h in Headers */,
|
||||
D07BCB721F2B6A5600ED97AA /* TGEmbedVKPlayerView.h in Headers */,
|
||||
D07ABBA9202A193A003671DE /* TGWallpaperController.h in Headers */,
|
||||
D07BC81C1F2A2C0B00ED97AA /* PGPhotoLookupFilterPass.h in Headers */,
|
||||
D07BCACC1F2B4E7300ED97AA /* TGMediaAvatarMenuMixin.h in Headers */,
|
||||
D01778CB1F200BAC0044446D /* TGRTLScreenEdgePanGestureRecognizer.h in Headers */,
|
||||
@ -4233,7 +4123,6 @@
|
||||
D07BC9FF1F2A9A2B00ED97AA /* TGMediaPickerGalleryPhotoItem.h in Headers */,
|
||||
D07BC77E1F2A2B3700ED97AA /* TGPhotoEditorLinearBlurView.h in Headers */,
|
||||
D01779711F2103FD0044446D /* TGPaintUndoManager.h in Headers */,
|
||||
D07BCB1B1F2B646A00ED97AA /* TGPasscodePinDotView.h in Headers */,
|
||||
D07BCAEF1F2B507600ED97AA /* TGAttachmentPhotoCell.h in Headers */,
|
||||
D07BC7B61F2A2BBE00ED97AA /* PGBlurTool.h in Headers */,
|
||||
D07BCA921F2B443700ED97AA /* TGMediaAssetsMomentsSectionHeader.h in Headers */,
|
||||
@ -4242,7 +4131,6 @@
|
||||
D01778311F1F961D0044446D /* TGInstantPage.h in Headers */,
|
||||
D07BC96C1F2A43E300ED97AA /* TGPhotoStickersView.h in Headers */,
|
||||
D07BC7A41F2A2B8900ED97AA /* GPUImageContext.h in Headers */,
|
||||
D07BCB171F2B646A00ED97AA /* TGPasscodeEntryController.h in Headers */,
|
||||
D07BC9FD1F2A9A2B00ED97AA /* TGMediaPickerGalleryModel.h in Headers */,
|
||||
D017792F1F20FFAC0044446D /* TGMediaAssetsLegacyLibrary.h in Headers */,
|
||||
D07BC87D1F2A365000ED97AA /* TGProgressSpinnerView.h in Headers */,
|
||||
@ -4409,7 +4297,6 @@
|
||||
D017782D1F1F961D0044446D /* TGBotReplyMarkupRow.h in Headers */,
|
||||
D017775E1F1F8FE60044446D /* TGBotComandInfo.h in Headers */,
|
||||
D07BC9071F2A380D00ED97AA /* TGPaintEllipticalBrush.h in Headers */,
|
||||
D07BCB191F2B646A00ED97AA /* TGPasscodeEntryKeyboardView.h in Headers */,
|
||||
D07BC7701F2A2B3700ED97AA /* TGPhotoEditorCollectionView.h in Headers */,
|
||||
D07BCA901F2B443700ED97AA /* TGMediaAssetsMomentsController.h in Headers */,
|
||||
D07BC86B1F2A2F3800ED97AA /* HPGrowingTextView.h in Headers */,
|
||||
@ -4421,11 +4308,9 @@
|
||||
D0177A3C1F21F2E50044446D /* TGTimerTarget.h in Headers */,
|
||||
D017798E1F2108130044446D /* PSLMDBKeyValueStore.h in Headers */,
|
||||
D017784B1F1F961D0044446D /* TGUnsupportedMediaAttachment.h in Headers */,
|
||||
D07BCB391F2B65F100ED97AA /* TGCustomImageWallpaperInfo.h in Headers */,
|
||||
D01778461F1F961D0044446D /* TGDocumentAttributeAudio.h in Headers */,
|
||||
D07BCBEB1F2B72DC00ED97AA /* STKAutoRecoveringHTTPDataSource.h in Headers */,
|
||||
D01778AD1F1FFDB80044446D /* TGDateUtils.h in Headers */,
|
||||
D07BCB351F2B65F100ED97AA /* TGBuiltinWallpaperInfo.h in Headers */,
|
||||
D07BC9601F2A3F0A00ED97AA /* TGGradientLabel.h in Headers */,
|
||||
D07BC80A1F2A2C0B00ED97AA /* PGPhotoEnhanceInterpolationFilter.h in Headers */,
|
||||
D07BC8241F2A2C0B00ED97AA /* PGSharpenTool.h in Headers */,
|
||||
@ -4480,7 +4365,6 @@
|
||||
D07BCA9E1F2B443700ED97AA /* TGMediaAssetsVideoCell.h in Headers */,
|
||||
D07BC70F1F2A25AE00ED97AA /* TGCameraPhotoPreviewController.h in Headers */,
|
||||
D07BCA421F2A9C6600ED97AA /* TGModernMediaListItem.h in Headers */,
|
||||
D07BCB1D1F2B646A00ED97AA /* TGPasscodePinView.h in Headers */,
|
||||
D01778E91F20CAE60044446D /* TGViewController.h in Headers */,
|
||||
D017781B1F1F961D0044446D /* TGMessageEntityItalic.h in Headers */,
|
||||
D07BCBF11F2B72DC00ED97AA /* STKDataSourceWrapper.h in Headers */,
|
||||
@ -4491,7 +4375,6 @@
|
||||
D07BCB781F2B6DB900ED97AA /* TGEmbedCoubPlayerView.h in Headers */,
|
||||
D07BC7271F2A2A5300ED97AA /* UICollectionView+Utils.h in Headers */,
|
||||
D01777661F1F8FE60044446D /* TGStringUtils.h in Headers */,
|
||||
D07BCB3B1F2B65F100ED97AA /* TGRemoteWallpaperInfo.h in Headers */,
|
||||
D07BCBC01F2B6F6300ED97AA /* CBDownloadOperationDelegate.h in Headers */,
|
||||
D07BC9B21F2A4B6600ED97AA /* TGStickerAssociation.h in Headers */,
|
||||
D01778B21F1FFF810044446D /* TGLabel.h in Headers */,
|
||||
@ -4540,7 +4423,6 @@
|
||||
D07BC91F1F2A380D00ED97AA /* TGPaintShaderSet.h in Headers */,
|
||||
D02660701F34A7F8000E2DC5 /* TGLocationUtils.h in Headers */,
|
||||
D07BC6FF1F2A1A7700ED97AA /* TGMenuView.h in Headers */,
|
||||
D07BCB1F1F2B646A00ED97AA /* TGPasscodeButtonView.h in Headers */,
|
||||
D07BCA961F2B443700ED97AA /* TGMediaAssetsPhotoCell.h in Headers */,
|
||||
D01778441F1F961D0044446D /* TGDocumentAttributeAnimated.h in Headers */,
|
||||
D07BCABB1F2B4E2600ED97AA /* TGTransitionLayout.h in Headers */,
|
||||
@ -4604,6 +4486,7 @@
|
||||
developmentRegion = English;
|
||||
hasScannedForEncodings = 0;
|
||||
knownRegions = (
|
||||
English,
|
||||
en,
|
||||
);
|
||||
mainGroup = D017771D1F1F8F100044446D;
|
||||
@ -4656,15 +4539,12 @@
|
||||
D07BC90C1F2A380D00ED97AA /* TGPaintFaceDetector.m in Sources */,
|
||||
D07BC9F21F2A9A2B00ED97AA /* TGMediaPickerCell.m in Sources */,
|
||||
D07BC8051F2A2C0B00ED97AA /* PGPhotoBlurPass.m in Sources */,
|
||||
D07BCB3C1F2B65F100ED97AA /* TGRemoteWallpaperInfo.m in Sources */,
|
||||
D07BC7691F2A2B3700ED97AA /* TGPhotoEditorBlurAreaView.m in Sources */,
|
||||
D07BC99E1F2A494000ED97AA /* TGStickerCollectionViewCell.m in Sources */,
|
||||
D01779851F2107D70044446D /* mdb.c in Sources */,
|
||||
D0177B171F2641B10044446D /* PGCameraCaptureSession.m in Sources */,
|
||||
098C0E5B20245179007B4539 /* TGMessageEntityPhone.m in Sources */,
|
||||
D07BCA8B1F2B443700ED97AA /* TGMediaAssetsGifCell.m in Sources */,
|
||||
D07BCB1E1F2B646A00ED97AA /* TGPasscodePinView.m in Sources */,
|
||||
D07BCB1A1F2B646A00ED97AA /* TGPasscodeEntryKeyboardView.m in Sources */,
|
||||
D017784A1F1F961D0044446D /* TGDocumentMediaAttachment.m in Sources */,
|
||||
D0177A0C1F2139980044446D /* POPVector.mm in Sources */,
|
||||
D0177ADA1F23D9B80044446D /* SGraphListNode.m in Sources */,
|
||||
@ -4699,7 +4579,6 @@
|
||||
D07BC6F41F2A19A700ED97AA /* TGCameraModeControl.m in Sources */,
|
||||
D017782C1F1F961D0044446D /* TGBotReplyMarkupButton.m in Sources */,
|
||||
D07BCAB81F2B4DE200ED97AA /* TGAttachmentCarouselItemView.m in Sources */,
|
||||
D07ABBA8202A193A003671DE /* TGWallpaperController.m in Sources */,
|
||||
D026605B1F34A7F8000E2DC5 /* TGLocationMapModeControl.m in Sources */,
|
||||
D01777771F1F92570044446D /* RMPhoneFormat.m in Sources */,
|
||||
D07BCA221F2A9A5300ED97AA /* TGCheckButtonView.m in Sources */,
|
||||
@ -4755,7 +4634,6 @@
|
||||
D07BC76B1F2A2B3700ED97AA /* TGPhotoEditorBlurToolView.m in Sources */,
|
||||
D0177AA41F2222990044446D /* TGKeyCommandController.m in Sources */,
|
||||
D07BCA061F2A9A2B00ED97AA /* TGMediaPickerGalleryVideoItem.m in Sources */,
|
||||
D07BCB1C1F2B646A00ED97AA /* TGPasscodePinDotView.m in Sources */,
|
||||
D01778411F1F961D0044446D /* TGDocumentAttributeSticker.m in Sources */,
|
||||
09750FCE1F30E53A001B9886 /* TGClipboardGalleryMixin.m in Sources */,
|
||||
D07BC6F81F2A19A700ED97AA /* TGCameraShutterButton.m in Sources */,
|
||||
@ -4886,7 +4764,6 @@
|
||||
D017786A1F1F99180044446D /* NSInputStream+TL.m in Sources */,
|
||||
D07BC7351F2A2A7D00ED97AA /* PGPhotoEditor.m in Sources */,
|
||||
D02660671F34A7F8000E2DC5 /* TGLocationSectionHeaderCell.m in Sources */,
|
||||
D07BCB3A1F2B65F100ED97AA /* TGCustomImageWallpaperInfo.m in Sources */,
|
||||
D07BC9731F2A467D00ED97AA /* TGPhotoTextSettingsView.m in Sources */,
|
||||
D0177B191F2641B10044446D /* PGCameraDeviceAngleSampler.m in Sources */,
|
||||
D07BC6D01F2A18B700ED97AA /* TGCameraMainPhoneView.m in Sources */,
|
||||
@ -4903,7 +4780,6 @@
|
||||
D07BC9BF1F2A722400ED97AA /* TGHistogramView.m in Sources */,
|
||||
D07BCBDA1F2B72BD00ED97AA /* NSMutableArray+STKAudioPlayer.m in Sources */,
|
||||
D07BCBBC1F2B6F6300ED97AA /* CBCoubPlayerContance.m in Sources */,
|
||||
D07BCB291F2B652C00ED97AA /* TGImageBasedPasscodeBackground.m in Sources */,
|
||||
D07BC92C1F2A3A3F00ED97AA /* matrix.m in Sources */,
|
||||
D07BCA6E1F2B3CE700ED97AA /* TGCameraFocusCrosshairsControl.m in Sources */,
|
||||
D07BC7AD1F2A2B8900ED97AA /* GPUImageOutput.m in Sources */,
|
||||
@ -4971,7 +4847,6 @@
|
||||
D07BC9001F2A380D00ED97AA /* TGPaintBrush.m in Sources */,
|
||||
D0177A051F2139980044446D /* POPPropertyAnimation.mm in Sources */,
|
||||
D07BCBCE1F2B6F6300ED97AA /* CBVideoPlayer.m in Sources */,
|
||||
D07BCB381F2B65F100ED97AA /* TGColorWallpaperInfo.m in Sources */,
|
||||
D0177A011F2139980044446D /* POPLayerExtras.mm in Sources */,
|
||||
D01777671F1F8FE60044446D /* TGStringUtils.mm in Sources */,
|
||||
D0177B151F2641B10044446D /* PGCamera.m in Sources */,
|
||||
@ -4986,7 +4861,6 @@
|
||||
D07BCBA71F2B6F6300ED97AA /* AVAsset+CBExtension.m in Sources */,
|
||||
D017783C1F1F961D0044446D /* TGStickerPackReference.m in Sources */,
|
||||
D026607B1F34A961000E2DC5 /* TGLocationVenue.m in Sources */,
|
||||
D07BCB201F2B646A00ED97AA /* TGPasscodeButtonView.m in Sources */,
|
||||
D07BC9261F2A380D00ED97AA /* TGPaintSwatch.m in Sources */,
|
||||
D017799D1F2108670044446D /* TGMemoryImageCache.m in Sources */,
|
||||
D07BCA461F2A9C6600ED97AA /* TGModernMediaListItemView.m in Sources */,
|
||||
@ -4994,7 +4868,6 @@
|
||||
D07BC6F21F2A19A700ED97AA /* TGCameraInterfaceAssets.m in Sources */,
|
||||
D07BC8441F2A2D7A00ED97AA /* TGPhotoCaptionInputMixin.m in Sources */,
|
||||
D01779911F2108130044446D /* PSLMDBKeyValueReaderWriter.m in Sources */,
|
||||
D07BCB181F2B646A00ED97AA /* TGPasscodeEntryController.m in Sources */,
|
||||
D0177A851F2218AB0044446D /* TGModernGalleryImageItemContainerView.m in Sources */,
|
||||
D017775A1F1F8FE60044446D /* PSKeyValueEncoder.m in Sources */,
|
||||
D07BC8661F2A2F1300ED97AA /* TGMediaPickerCaptionInputPanel.m in Sources */,
|
||||
@ -5026,7 +4899,6 @@
|
||||
D01779971F21082E0044446D /* PSLMDBTable.m in Sources */,
|
||||
D07BCC061F2B82D100ED97AA /* TGModernConversationTitleActivityIndicator.m in Sources */,
|
||||
D04269081F586A070037ECE8 /* TGVideoMessageScrubberThumbnailView.m in Sources */,
|
||||
D07BCB361F2B65F100ED97AA /* TGBuiltinWallpaperInfo.m in Sources */,
|
||||
D07BC90A1F2A380D00ED97AA /* TGPaintFaceDebugView.m in Sources */,
|
||||
D017785A1F1F961D0044446D /* TGImageMediaAttachment.m in Sources */,
|
||||
09053D7D20A5CCF10029652D /* TGPassportOCR.mm in Sources */,
|
||||
@ -5034,7 +4906,6 @@
|
||||
D01779151F20F4500044446D /* TGStaticBackdropAreaData.m in Sources */,
|
||||
D07BC91C1F2A380D00ED97AA /* TGPaintRender.m in Sources */,
|
||||
D07BCA101F2A9A2B00ED97AA /* TGMediaPickerLayoutMetrics.m in Sources */,
|
||||
D07BCB251F2B646A00ED97AA /* TGDefaultPasscodeBackground.m in Sources */,
|
||||
D0177A761F2202260044446D /* TGModernBackToolbarButton.m in Sources */,
|
||||
D01777611F1F8FE60044446D /* TGBotInfo.m in Sources */,
|
||||
D07BC8591F2A2DBD00ED97AA /* TGMenuSheetCollectionView.m in Sources */,
|
||||
@ -5071,7 +4942,6 @@
|
||||
09BD14EC20BD928100D95932 /* TGPhotoVideoEditor.m in Sources */,
|
||||
D07BC7891F2A2B3700ED97AA /* TGPhotoEditorTintSwatchView.m in Sources */,
|
||||
D07BC8C01F2A37EC00ED97AA /* TGPhotoPaintActionsView.m in Sources */,
|
||||
D07BCB161F2B646A00ED97AA /* TGPasswordEntryView.m in Sources */,
|
||||
D07BC9FC1F2A9A2B00ED97AA /* TGMediaPickerGalleryItem.m in Sources */,
|
||||
D07BC8C81F2A37EC00ED97AA /* TGPhotoPaintFont.m in Sources */,
|
||||
D07BC9FE1F2A9A2B00ED97AA /* TGMediaPickerGalleryModel.m in Sources */,
|
||||
@ -5187,7 +5057,6 @@
|
||||
D017784E1F1F961D0044446D /* TGForwardedMessageMediaAttachment.m in Sources */,
|
||||
D07BCBD01F2B6F6300ED97AA /* NSDictionary+CBExtensions.m in Sources */,
|
||||
D07BC7731F2A2B3700ED97AA /* TGPhotoEditorCurvesHistogramView.m in Sources */,
|
||||
D07BCB3E1F2B65F100ED97AA /* TGWallpaperInfo.m in Sources */,
|
||||
09053D7A20A5CCF10029652D /* fast-edge.cpp in Sources */,
|
||||
D07BCA1C1F2A9A2B00ED97AA /* TGMediaPickerSelectionGestureRecognizer.m in Sources */,
|
||||
D07BC9141F2A380D00ED97AA /* TGPaintNeonBrush.m in Sources */,
|
||||
|
||||
@ -77,11 +77,6 @@ func importLegacyPreferences(accountManager: AccountManager, account: TemporaryA
|
||||
autoNightPreferences = value
|
||||
}
|
||||
|
||||
var wallpaperInfo: TGWallpaperInfo?
|
||||
if let data = UserDefaults.standard.object(forKey: "_currentWallpaperInfo") as? [AnyHashable: Any], let value = TGWallpaperInfo(dictionary: data) {
|
||||
wallpaperInfo = value
|
||||
}
|
||||
|
||||
let autoDownloadPreferences: TGAutoDownloadPreferences? = NSKeyedUnarchiver.unarchiveObject(withFile: documentsPath + "/autoDownload.pref") as? TGAutoDownloadPreferences
|
||||
|
||||
let preferencesProvider: PreferencesProvider
|
||||
@ -234,22 +229,6 @@ func importLegacyPreferences(accountManager: AccountManager, account: TemporaryA
|
||||
}
|
||||
}
|
||||
|
||||
if let wallpaperInfo = wallpaperInfo as? TGBuiltinWallpaperInfo, wallpaperInfo.isDefault() {
|
||||
settings.chatWallpaper = .builtin(WallpaperSettings())
|
||||
} else if let wallpaperInfo = wallpaperInfo as? TGRemoteWallpaperInfo, let data = try? Data(contentsOf: URL(fileURLWithPath: documentsPath + "/wallpaper-data/_currentWallpaper.jpg")), let image = UIImage(data: data) {
|
||||
let url = wallpaperInfo.fullscreenUrl()!
|
||||
if let resource = resourceFromLegacyImageUrl(url) {
|
||||
settings.chatWallpaper = .image([TelegramMediaImageRepresentation(dimensions: image.size, resource: resource)], WallpaperSettings())
|
||||
account.postbox.mediaBox.storeResourceData(resource.id, data: data)
|
||||
}
|
||||
} else if let wallpaperInfo = wallpaperInfo as? TGColorWallpaperInfo {
|
||||
settings.chatWallpaper = .color(Int32(bitPattern: wallpaperInfo.color))
|
||||
} else if let data = try? Data(contentsOf: URL(fileURLWithPath: documentsPath + "/wallpaper-data/_currentWallpaper.jpg")), let image = UIImage(data: data) {
|
||||
let resource = LocalFileMediaResource(fileId: arc4random64())
|
||||
settings.chatWallpaper = .image([TelegramMediaImageRepresentation(dimensions: image.size, resource: resource)], WallpaperSettings())
|
||||
account.postbox.mediaBox.storeResourceData(resource.id, data: data)
|
||||
}
|
||||
|
||||
return settings
|
||||
})
|
||||
|
||||
|
||||
@ -6,51 +6,6 @@ import LegacyComponents
|
||||
import TelegramPresentationData
|
||||
import DeviceAccess
|
||||
|
||||
private final class LegacyWallpaperEditorController: LegacyController, TGWallpaperControllerDelegate {
|
||||
private let completion: (UIImage?) -> Void
|
||||
|
||||
init(presentation: LegacyControllerPresentation, theme: PresentationTheme?, completion: @escaping (UIImage?) -> Void) {
|
||||
self.completion = completion
|
||||
|
||||
super.init(presentation: presentation, theme: theme)
|
||||
}
|
||||
|
||||
required public init(coder aDecoder: NSCoder) {
|
||||
fatalError("init(coder:) has not been implemented")
|
||||
}
|
||||
|
||||
func wallpaperController(_ wallpaperController: TGWallpaperController!, didSelectWallpaperWith wallpaperInfo: TGWallpaperInfo!) {
|
||||
self.completion(wallpaperInfo.image())
|
||||
}
|
||||
}
|
||||
|
||||
func legacyWallpaperEditor(theme: PresentationTheme, image: UIImage, completion: @escaping (UIImage?) -> Void) -> ViewController {
|
||||
var dismissImpl: (() -> Void)?
|
||||
let legacyController = LegacyWallpaperEditorController(presentation: .modal(animateIn: true), theme: theme, completion: { image in
|
||||
dismissImpl?()
|
||||
completion(image)
|
||||
})
|
||||
|
||||
let wallpaperController = TGWallpaperController(context: legacyController.context, wallpaperInfo: TGCustomImageWallpaperInfo(image: image), thumbnailImage: nil)!
|
||||
//wallpaperController.presentation = self.presentation;
|
||||
wallpaperController.customDismiss = {
|
||||
dismissImpl?()
|
||||
}
|
||||
wallpaperController.delegate = legacyController
|
||||
wallpaperController.enableWallpaperAdjustment = true
|
||||
wallpaperController.doNotFlipIfRTL = true
|
||||
|
||||
let navigationController = TGNavigationController(controllers: [wallpaperController])!
|
||||
wallpaperController.navigation_setDismiss({ [weak legacyController] in
|
||||
legacyController?.dismiss()
|
||||
}, rootController: nil)
|
||||
dismissImpl = { [weak legacyController] in
|
||||
legacyController?.dismiss()
|
||||
}
|
||||
legacyController.bind(controller: navigationController)
|
||||
return legacyController
|
||||
}
|
||||
|
||||
func legacyWallpaperPicker(context: AccountContext, presentationData: PresentationData) -> Signal<(LegacyComponentsContext) -> TGMediaAssetsController, Void> {
|
||||
return Signal { subscriber in
|
||||
let intent = TGMediaAssetsControllerSetCustomWallpaperIntent
|
||||
Loading…
x
Reference in New Issue
Block a user