mirror of
https://github.com/samuelclay/NewsBlur.git
synced 2025-08-31 21:41:33 +00:00

- Adjusted the timeout and caching of images. - Cleans up cached image URLs if needed. - When offline, now replaces an uncached image with a blank image, to avoid the broken image. - When online, now loads the remote image if no cached image. - Experimented with using cleaner cache filenames, but that wasn’t needed (it initially looked like the MD5 was changing between invocations). - Now uses “jpeg” for the cache extension, since the image URL can have parameter junk that messes with caching.
35 lines
1.2 KiB
Objective-C
35 lines
1.2 KiB
Objective-C
//
|
|
// Utilities.h
|
|
// NewsBlur
|
|
//
|
|
// Created by Samuel Clay on 10/17/11.
|
|
// Copyright (c) 2011 NewsBlur. All rights reserved.
|
|
//
|
|
|
|
#import <Foundation/Foundation.h>
|
|
|
|
void drawLinearGradient(CGContextRef context, CGRect rect, CGColorRef startColor,
|
|
CGColorRef endColor);
|
|
|
|
@interface Utilities : NSObject <NSCacheDelegate> {
|
|
NSCache *imageCache;
|
|
}
|
|
|
|
+ (void)drawLinearGradientWithRect:(CGRect)rect startColor:(CGColorRef)startColor endColor:(CGColorRef)endColor;
|
|
+ (UIImage *)roundCorneredImage:(UIImage *)orig radius:(CGFloat)r;
|
|
+ (UIImage *)roundCorneredImage: (UIImage*)orig radius:(CGFloat)r convertToSize:(CGSize)size;
|
|
+ (UIImage *)templateImageNamed:(NSString *)imageName sized:(CGFloat)size;
|
|
+ (UIImage *)imageNamed:(NSString *)imageName sized:(CGFloat)size;
|
|
+ (UIImage *)imageWithImage:(UIImage *)image convertToSize:(CGSize)size;
|
|
//+ (NSString *)md5:(NSString *)string storyHash:(NSString *)storyHash;
|
|
+ (NSString *)md5:(NSString *)string;
|
|
+ (NSString *)formatLongDateFromTimestamp:(NSInteger)timestamp;
|
|
+ (NSString *)formatShortDateFromTimestamp:(NSInteger)timestamp;
|
|
|
|
@end
|
|
|
|
@interface UIResponder (FirstResponder)
|
|
|
|
+(id)currentFirstResponder;
|
|
|
|
@end
|