mirror of
https://github.com/danog/Telegram.git
synced 2024-12-12 09:29:55 +01:00
89 lines
2.8 KiB
Objective-C
89 lines
2.8 KiB
Objective-C
/*
|
|
* This is the source code of Telegram for iOS v. 1.1
|
|
* It is licensed under GNU GPL v. 2 or later.
|
|
* You should have received a copy of the license in this archive (see LICENSE).
|
|
*
|
|
* Copyright Peter Iakovlev, 2013.
|
|
*/
|
|
|
|
#import <UIKit/UIKit.h>
|
|
|
|
#import "ActionStage.h"
|
|
#import "TGCache.h"
|
|
|
|
#define TGRemoteImageUseContents false
|
|
|
|
#define TG_CACHE_INPLACE false
|
|
|
|
typedef enum {
|
|
TGRemoteImageContentHintLargeFile = 1,
|
|
TGRemoteImageContentHintSaveToGallery = 2,
|
|
TGRemoteImageContentHintLoadFromDiskSynchronously = 4,
|
|
TGRemoteImageContentHintBlurRemote = 8
|
|
} TGRemoteImageContentHints;
|
|
|
|
@class TGRemoteImageView;
|
|
|
|
typedef UIImage *(^TGImageProcessor)(UIImage *);
|
|
typedef UIImage *(^TGImageUniversalProcessor)(NSString *, UIImage *);
|
|
|
|
typedef void (^TGImageProgressHandler)(TGRemoteImageView *imageView, float progress);
|
|
|
|
@interface TGRemoteImageView :
|
|
#if TGRemoteImageUseContents
|
|
UIView
|
|
#else
|
|
UIImageView
|
|
#endif
|
|
<ASWatcher>
|
|
@property (nonatomic, strong) ASHandle *actionHandle;
|
|
@property (nonatomic, strong) NSString *reuseIdentifier;
|
|
|
|
@property (nonatomic, strong) TGCache *cache;
|
|
@property (nonatomic) bool useCache;
|
|
@property (nonatomic) int contentHints;
|
|
@property (nonatomic) id userProperties;
|
|
|
|
@property (nonatomic) bool fadeTransition;
|
|
@property (nonatomic) NSTimeInterval fadeTransitionDuration;
|
|
@property (nonatomic) bool allowThumbnailCache;
|
|
|
|
#if TGRemoteImageUseContents
|
|
@property (nonatomic, strong) UIImage *image;
|
|
#endif
|
|
@property (nonatomic, strong) UIView *placeholderOverlay;
|
|
|
|
@property (nonatomic, strong) NSString *currentUrl;
|
|
@property (nonatomic, strong) NSString *currentFilter;
|
|
|
|
@property (nonatomic, copy) TGImageProgressHandler progressHandler;
|
|
|
|
@property (nonatomic) int cancelTimeout;
|
|
|
|
+ (void)throttleDownProcessing;
|
|
+ (void)registerImageUniversalProcessor:(TGImageUniversalProcessor)universalProcessor withBaseName:(NSString *)baseName;
|
|
+ (void)registerImageProcessor:(TGImageProcessor)imageProcessor withName:(NSString *)name;
|
|
+ (TGImageProcessor)imageProcessorForName:(NSString *)name;
|
|
|
|
+ (void)setSharedCache:(TGCache *)cache;
|
|
+ (TGCache *)sharedCache;
|
|
|
|
- (UIImage *)currentImage;
|
|
- (UIImage *)currentPlaceholderImage;
|
|
|
|
- (void)tryFillCache:(NSMutableDictionary *)dict;
|
|
|
|
- (void)loadImage:(UIImage *)image;
|
|
- (void)loadImage:(NSString *)url filter:(NSString *)filter placeholder:(UIImage *)placeholder;
|
|
- (void)loadImage:(NSString *)url filter:(NSString *)filter placeholder:(UIImage *)placeholder forceFade:(bool)forceFade;
|
|
- (void)loadPlaceholder:(UIImage *)placeholder;
|
|
- (void)cancelLoading;
|
|
|
|
+ (UIImage *)imageFromCache:(NSString *)url filter:(NSString *)filter cache:(TGCache *)cache;
|
|
+ (NSString *)preloadImage:(NSString *)url filter:(NSString *)filter blurIfRemote:(bool)blurIfRemote cache:(TGCache *)cache allowThumbnailCache:(bool)allowThumbnailCache watcher:(id<ASWatcher>)watcher;
|
|
|
|
- (void)prepareForRecycle;
|
|
- (void)prepareForReuse;
|
|
|
|
@end
|