mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-07-28 14:10:44 +00:00
Update update view to be more iOS 6 like
Not completely finished yet
This commit is contained in:
parent
1eb68fece6
commit
aee5c4adda
@ -34,8 +34,6 @@
|
|||||||
#import "HockeySDKPrivate.h"
|
#import "HockeySDKPrivate.h"
|
||||||
|
|
||||||
|
|
||||||
#define BIT_RGBCOLOR(r,g,b) [UIColor colorWithRed:(r)/255.0 green:(g)/255.0 blue:(b)/255.0 alpha:1]
|
|
||||||
|
|
||||||
#define kLightGrayColor BIT_RGBCOLOR(235, 235, 235)
|
#define kLightGrayColor BIT_RGBCOLOR(235, 235, 235)
|
||||||
#define kDarkGrayColor BIT_RGBCOLOR(186, 186, 186)
|
#define kDarkGrayColor BIT_RGBCOLOR(186, 186, 186)
|
||||||
#define kWhiteBackgroundColor BIT_RGBCOLOR(245, 245, 245)
|
#define kWhiteBackgroundColor BIT_RGBCOLOR(245, 245, 245)
|
||||||
|
@ -33,9 +33,23 @@
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
The UIBarStyle of the update user interface navigation bar.
|
The UIBarStyle of the update user interface navigation bar.
|
||||||
|
|
||||||
|
Default is UIBarStyleBlackOpaque
|
||||||
|
@see tintColor
|
||||||
*/
|
*/
|
||||||
@property (nonatomic, assign) UIBarStyle barStyle;
|
@property (nonatomic, assign) UIBarStyle barStyle;
|
||||||
|
|
||||||
|
/**
|
||||||
|
The tint color of the update user interface navigation bar.
|
||||||
|
|
||||||
|
The tintColor is used by default, you can either overwrite it `tintColor`
|
||||||
|
or define another `barStyle` instead.
|
||||||
|
|
||||||
|
Default is RGB(25, 25, 25)
|
||||||
|
@see barStyle
|
||||||
|
*/
|
||||||
|
@property (nonatomic, retain) UIColor *tintColor;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
The UIModalPresentationStyle for showing the update user interface when invoked
|
The UIModalPresentationStyle for showing the update user interface when invoked
|
||||||
with the update alert.
|
with the update alert.
|
||||||
|
@ -38,7 +38,8 @@
|
|||||||
_serverURL = BITHOCKEYSDK_URL;
|
_serverURL = BITHOCKEYSDK_URL;
|
||||||
|
|
||||||
_navController = nil;
|
_navController = nil;
|
||||||
_barStyle = UIBarStyleDefault;
|
_barStyle = UIBarStyleBlackOpaque;
|
||||||
|
self.tintColor = BIT_RGBCOLOR(25, 25, 25);
|
||||||
_modalPresentationStyle = UIModalPresentationFormSheet;
|
_modalPresentationStyle = UIModalPresentationFormSheet;
|
||||||
|
|
||||||
NSLocale *enUSPOSIXLocale = [[[NSLocale alloc] initWithLocaleIdentifier:@"en_US_POSIX"] autorelease];
|
NSLocale *enUSPOSIXLocale = [[[NSLocale alloc] initWithLocaleIdentifier:@"en_US_POSIX"] autorelease];
|
||||||
@ -67,6 +68,8 @@
|
|||||||
[_navController release], _navController = nil;
|
[_navController release], _navController = nil;
|
||||||
|
|
||||||
[_rfc3339Formatter release], _rfc3339Formatter = nil;
|
[_rfc3339Formatter release], _rfc3339Formatter = nil;
|
||||||
|
|
||||||
|
[_tintColor release], _tintColor = nil;
|
||||||
|
|
||||||
[super dealloc];
|
[super dealloc];
|
||||||
}
|
}
|
||||||
@ -167,6 +170,7 @@
|
|||||||
|
|
||||||
_navController = [[UINavigationController alloc] initWithRootViewController:viewController];
|
_navController = [[UINavigationController alloc] initWithRootViewController:viewController];
|
||||||
_navController.navigationBar.barStyle = _barStyle;
|
_navController.navigationBar.barStyle = _barStyle;
|
||||||
|
_navController.navigationBar.tintColor = _tintColor;
|
||||||
_navController.modalPresentationStyle = _modalPresentationStyle;
|
_navController.modalPresentationStyle = _modalPresentationStyle;
|
||||||
|
|
||||||
if (parentViewController) {
|
if (parentViewController) {
|
||||||
@ -191,6 +195,7 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#pragma mark - Manager Control
|
#pragma mark - Manager Control
|
||||||
|
|
||||||
- (void)startManager {
|
- (void)startManager {
|
||||||
|
@ -29,18 +29,14 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#import <QuartzCore/QuartzCore.h>
|
|
||||||
#import <UIKit/UIKit.h>
|
#import <UIKit/UIKit.h>
|
||||||
|
|
||||||
// defines a button action set (data container)
|
// defines a button action set (data container)
|
||||||
@interface BITStoreButtonData : NSObject {
|
@interface BITStoreButtonData : NSObject
|
||||||
CGPoint _customPadding;
|
|
||||||
}
|
|
||||||
|
|
||||||
+ (id)dataWithLabel:(NSString*)aLabel colors:(NSArray*)aColors enabled:(BOOL)flag;
|
+ (id)dataWithLabel:(NSString*)aLabel enabled:(BOOL)flag;
|
||||||
|
|
||||||
@property (nonatomic, copy) NSString *label;
|
@property (nonatomic, copy) NSString *label;
|
||||||
@property (nonatomic, retain) NSArray *colors;
|
|
||||||
@property (nonatomic, assign, getter=isEnabled) BOOL enabled;
|
@property (nonatomic, assign, getter=isEnabled) BOOL enabled;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
@ -54,10 +50,7 @@
|
|||||||
|
|
||||||
// Simulate the Paymeny-Button from the AppStore
|
// Simulate the Paymeny-Button from the AppStore
|
||||||
// The interface is flexible, so there is now fixed order
|
// The interface is flexible, so there is now fixed order
|
||||||
@interface BITStoreButton : UIButton {
|
@interface BITStoreButton : UIButton
|
||||||
CAGradientLayer *_gradient;
|
|
||||||
CGPoint _customPadding;
|
|
||||||
}
|
|
||||||
|
|
||||||
- (id)initWithFrame:(CGRect)frame;
|
- (id)initWithFrame:(CGRect)frame;
|
||||||
- (id)initWithPadding:(CGPoint)padding;
|
- (id)initWithPadding:(CGPoint)padding;
|
||||||
@ -73,9 +66,4 @@
|
|||||||
@property (nonatomic, assign) CGPoint customPadding;
|
@property (nonatomic, assign) CGPoint customPadding;
|
||||||
- (void)alignToSuperview;
|
- (void)alignToSuperview;
|
||||||
|
|
||||||
// helpers to mimic an AppStore button
|
|
||||||
+ (NSArray *)appStoreGreenColor;
|
|
||||||
+ (NSArray *)appStoreBlueColor;
|
|
||||||
+ (NSArray *)appStoreGrayColor;
|
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
@ -30,11 +30,12 @@
|
|||||||
|
|
||||||
|
|
||||||
#import "BITStoreButton.h"
|
#import "BITStoreButton.h"
|
||||||
|
#import "HockeySDKPrivate.h"
|
||||||
|
#import <QuartzCore/QuartzCore.h>
|
||||||
|
|
||||||
#define PS_RGBCOLOR(r,g,b) [UIColor colorWithRed:(r)/255.0 green:(g)/255.0 blue:(b)/255.0 alpha:1]
|
#define BIT_MIN_HEIGHT 25.0f
|
||||||
#define PS_MIN_HEIGHT 25.0f
|
#define BIT_MAX_WIDTH 120.0f
|
||||||
#define PS_MAX_WIDTH 120.0f
|
#define BIT_PADDING 12.0f
|
||||||
#define PS_PADDING 12.0f
|
|
||||||
#define kDefaultButtonAnimationTime 0.25f
|
#define kDefaultButtonAnimationTime 0.25f
|
||||||
|
|
||||||
|
|
||||||
@ -42,34 +43,26 @@
|
|||||||
|
|
||||||
#pragma mark - NSObject
|
#pragma mark - NSObject
|
||||||
|
|
||||||
- (id)initWithLabel:(NSString*)aLabel colors:(NSArray*)aColors enabled:(BOOL)flag {
|
- (id)initWithLabel:(NSString*)aLabel enabled:(BOOL)flag {
|
||||||
if ((self = [super init])) {
|
if ((self = [super init])) {
|
||||||
self.label = aLabel;
|
self.label = aLabel;
|
||||||
self.colors = aColors;
|
|
||||||
self.enabled = flag;
|
self.enabled = flag;
|
||||||
}
|
}
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
+ (id)dataWithLabel:(NSString*)aLabel colors:(NSArray*)aColors enabled:(BOOL)flag {
|
+ (id)dataWithLabel:(NSString*)aLabel enabled:(BOOL)flag {
|
||||||
return [[[[self class] alloc] initWithLabel:aLabel colors:aColors enabled:flag] autorelease];
|
return [[[[self class] alloc] initWithLabel:aLabel enabled:flag] autorelease];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)dealloc {
|
- (void)dealloc {
|
||||||
[_label release], _label = nil;
|
[_label release], _label = nil;
|
||||||
[_colors release];
|
|
||||||
|
|
||||||
[super dealloc];
|
[super dealloc];
|
||||||
}
|
}
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
|
||||||
@interface BITStoreButton ()
|
|
||||||
// call when buttonData was updated
|
|
||||||
- (void)updateButtonAnimated:(BOOL)animated;
|
|
||||||
@end
|
|
||||||
|
|
||||||
|
|
||||||
@implementation BITStoreButton
|
@implementation BITStoreButton
|
||||||
|
|
||||||
#pragma mark - private
|
#pragma mark - private
|
||||||
@ -94,21 +87,17 @@
|
|||||||
[UIView setAnimationDuration:kDefaultButtonAnimationTime];
|
[UIView setAnimationDuration:kDefaultButtonAnimationTime];
|
||||||
[UIView setAnimationDelegate:self];
|
[UIView setAnimationDelegate:self];
|
||||||
[UIView setAnimationDidStopSelector:@selector(animationDidStop:finished:context:)];
|
[UIView setAnimationDidStopSelector:@selector(animationDidStop:finished:context:)];
|
||||||
}else {
|
} else {
|
||||||
[self setTitle:self.buttonData.label forState:UIControlStateNormal];
|
[self setTitle:self.buttonData.label forState:UIControlStateNormal];
|
||||||
}
|
}
|
||||||
|
|
||||||
self.enabled = self.buttonData.isEnabled;
|
self.enabled = self.buttonData.isEnabled;
|
||||||
_gradient.colors = self.buttonData.colors;
|
|
||||||
|
|
||||||
// show white or gray text, depending on the state
|
// show white or gray text, depending on the state
|
||||||
if (self.buttonData.isEnabled) {
|
if (self.buttonData.isEnabled) {
|
||||||
[self setTitleShadowColor:[UIColor colorWithWhite:0.200 alpha:1.000] forState:UIControlStateNormal];
|
[self setTitleColor:BIT_RGBCOLOR(106, 106, 106) forState:UIControlStateNormal];
|
||||||
[self.titleLabel setShadowOffset:CGSizeMake(0.0, -0.6)];
|
} else {
|
||||||
[self setTitleColor:[UIColor colorWithWhite:1.0 alpha:1.000] forState:UIControlStateNormal];
|
[self setTitleColor:BIT_RGBCOLOR(148, 150, 151) forState:UIControlStateNormal];
|
||||||
}else {
|
|
||||||
[self.titleLabel setShadowOffset:CGSizeMake(0.0, 0.0)];
|
|
||||||
[self setTitleColor:PS_RGBCOLOR(148,150,151) forState:UIControlStateNormal];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// calculate optimal new size
|
// calculate optimal new size
|
||||||
@ -121,7 +110,7 @@
|
|||||||
if (animated) {
|
if (animated) {
|
||||||
[CATransaction setAnimationDuration:kDefaultButtonAnimationTime];
|
[CATransaction setAnimationDuration:kDefaultButtonAnimationTime];
|
||||||
[CATransaction setAnimationTimingFunction:[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]];
|
[CATransaction setAnimationTimingFunction:[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]];
|
||||||
}else {
|
} else {
|
||||||
// frame is calculated and explicitely animated. so we absolutely need kCATransactionDisableActions
|
// frame is calculated and explicitely animated. so we absolutely need kCATransactionDisableActions
|
||||||
[CATransaction setValue:[NSNumber numberWithBool:YES] forKey:kCATransactionDisableActions];
|
[CATransaction setValue:[NSNumber numberWithBool:YES] forKey:kCATransactionDisableActions];
|
||||||
}
|
}
|
||||||
@ -165,35 +154,31 @@
|
|||||||
// register for touch events
|
// register for touch events
|
||||||
[self addTarget:self action:@selector(buttonPressed:) forControlEvents:UIControlEventTouchUpInside];
|
[self addTarget:self action:@selector(buttonPressed:) forControlEvents:UIControlEventTouchUpInside];
|
||||||
|
|
||||||
// border layers for more sex!
|
|
||||||
CAGradientLayer *bevelLayer = [CAGradientLayer layer];
|
|
||||||
bevelLayer.colors = [NSArray arrayWithObjects:(id)[[UIColor colorWithWhite:0.4 alpha:1.0] CGColor], [[UIColor whiteColor] CGColor], nil];
|
|
||||||
bevelLayer.frame = CGRectMake(0.0, 0.0, CGRectGetWidth(frame), CGRectGetHeight(frame));
|
|
||||||
bevelLayer.cornerRadius = 2.5;
|
|
||||||
bevelLayer.needsDisplayOnBoundsChange = YES;
|
|
||||||
[self.layer addSublayer:bevelLayer];
|
|
||||||
|
|
||||||
CAGradientLayer *topBorderLayer = [CAGradientLayer layer];
|
|
||||||
topBorderLayer.colors = [NSArray arrayWithObjects:(id)[[UIColor darkGrayColor] CGColor], [[UIColor lightGrayColor] CGColor], nil];
|
|
||||||
topBorderLayer.frame = CGRectMake(0.5, 0.5, CGRectGetWidth(frame) - 1.0, CGRectGetHeight(frame) - 1.0);
|
|
||||||
topBorderLayer.cornerRadius = 2.6;
|
|
||||||
topBorderLayer.needsDisplayOnBoundsChange = YES;
|
|
||||||
[self.layer addSublayer:topBorderLayer];
|
|
||||||
|
|
||||||
// main gradient layer
|
// main gradient layer
|
||||||
_gradient = [[CAGradientLayer layer] retain];
|
CAGradientLayer *gradient = [CAGradientLayer layer];
|
||||||
_gradient.locations = [NSArray arrayWithObjects:[NSNumber numberWithFloat:0.0], [NSNumber numberWithFloat:1.0], nil];//[NSNumber numberWithFloat:0.500], [NSNumber numberWithFloat:0.5001],
|
gradient.colors = @[(id)BIT_RGBCOLOR(243, 243, 243).CGColor, (id)BIT_RGBCOLOR(222, 222, 222).CGColor];
|
||||||
_gradient.frame = CGRectMake(0.75, 0.75, CGRectGetWidth(frame) - 1.5, CGRectGetHeight(frame) - 1.5);
|
gradient.locations = @[[NSNumber numberWithFloat:0.0], [NSNumber numberWithFloat:1.0]];
|
||||||
_gradient.cornerRadius = 2.5;
|
gradient.frame = CGRectMake(0.0, 0.0, CGRectGetWidth(frame), CGRectGetHeight(frame));
|
||||||
_gradient.needsDisplayOnBoundsChange = YES;
|
gradient.cornerRadius = 2.5;
|
||||||
[self.layer addSublayer:_gradient];
|
gradient.needsDisplayOnBoundsChange = YES;
|
||||||
|
[self.layer addSublayer:gradient];
|
||||||
|
|
||||||
|
// border layers for more sex!
|
||||||
|
CALayer *borderLayer = [CALayer layer];
|
||||||
|
borderLayer.borderColor = [BIT_RGBCOLOR(191, 191, 191) CGColor];
|
||||||
|
borderLayer.borderWidth = 1.0;
|
||||||
|
borderLayer.frame = CGRectMake(0.0, 0.0, CGRectGetWidth(frame), CGRectGetHeight(frame));
|
||||||
|
borderLayer.cornerRadius = 2.5;
|
||||||
|
borderLayer.needsDisplayOnBoundsChange = YES;
|
||||||
|
[self.layer addSublayer:borderLayer];
|
||||||
|
|
||||||
[self bringSubviewToFront:self.titleLabel];
|
[self bringSubviewToFront:self.titleLabel];
|
||||||
}
|
}
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (id)initWithPadding:(CGPoint)padding {
|
- (id)initWithPadding:(CGPoint)padding {
|
||||||
if ((self = [self initWithFrame:CGRectMake(0, 0, 40, PS_MIN_HEIGHT)])) {
|
if ((self = [self initWithFrame:CGRectMake(0, 0, 40, BIT_MIN_HEIGHT)])) {
|
||||||
_customPadding = padding;
|
_customPadding = padding;
|
||||||
}
|
}
|
||||||
return self;
|
return self;
|
||||||
@ -201,7 +186,6 @@
|
|||||||
|
|
||||||
- (void)dealloc {
|
- (void)dealloc {
|
||||||
[_buttonData release];
|
[_buttonData release];
|
||||||
[_gradient release];
|
|
||||||
|
|
||||||
[super dealloc];
|
[super dealloc];
|
||||||
}
|
}
|
||||||
@ -210,10 +194,10 @@
|
|||||||
#pragma mark - UIView
|
#pragma mark - UIView
|
||||||
|
|
||||||
- (CGSize)sizeThatFits:(CGSize)size {
|
- (CGSize)sizeThatFits:(CGSize)size {
|
||||||
CGSize constr = (CGSize){.height = self.frame.size.height, .width = PS_MAX_WIDTH};
|
CGSize constr = (CGSize){.height = self.frame.size.height, .width = BIT_MAX_WIDTH};
|
||||||
CGSize newSize = [self.buttonData.label sizeWithFont:self.titleLabel.font constrainedToSize:constr lineBreakMode:UILineBreakModeMiddleTruncation];
|
CGSize newSize = [self.buttonData.label sizeWithFont:self.titleLabel.font constrainedToSize:constr lineBreakMode:UILineBreakModeMiddleTruncation];
|
||||||
CGFloat newWidth = newSize.width + (PS_PADDING * 2);
|
CGFloat newWidth = newSize.width + (BIT_PADDING * 2);
|
||||||
CGFloat newHeight = PS_MIN_HEIGHT > newSize.height ? PS_MIN_HEIGHT : newSize.height;
|
CGFloat newHeight = BIT_MIN_HEIGHT > newSize.height ? BIT_MIN_HEIGHT : newSize.height;
|
||||||
|
|
||||||
CGSize sizeThatFits = CGSizeMake(newWidth, newHeight);
|
CGSize sizeThatFits = CGSizeMake(newWidth, newHeight);
|
||||||
return sizeThatFits;
|
return sizeThatFits;
|
||||||
@ -248,25 +232,4 @@
|
|||||||
[self updateButtonAnimated:animated];
|
[self updateButtonAnimated:animated];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#pragma mark - Static
|
|
||||||
|
|
||||||
+ (NSArray *)appStoreGreenColor {
|
|
||||||
return [NSArray arrayWithObjects:(id)
|
|
||||||
[UIColor colorWithRed:0.482 green:0.674 blue:0.406 alpha:1.000].CGColor,
|
|
||||||
[UIColor colorWithRed:0.299 green:0.606 blue:0.163 alpha:1.000].CGColor, nil];
|
|
||||||
}
|
|
||||||
|
|
||||||
+ (NSArray *)appStoreBlueColor {
|
|
||||||
return [NSArray arrayWithObjects:(id)
|
|
||||||
[UIColor colorWithRed:0.306 green:0.380 blue:0.547 alpha:1.000].CGColor,
|
|
||||||
[UIColor colorWithRed:0.129 green:0.220 blue:0.452 alpha:1.000].CGColor, nil];
|
|
||||||
}
|
|
||||||
|
|
||||||
+ (NSArray *)appStoreGrayColor {
|
|
||||||
return [NSArray arrayWithObjects:(id)
|
|
||||||
PS_RGBCOLOR(187,189,191).CGColor,
|
|
||||||
PS_RGBCOLOR(210,210,210).CGColor, nil];
|
|
||||||
}
|
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
@ -408,6 +408,7 @@
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
self.barStyle = UIBarStyleBlack;
|
||||||
[self showView:[self hockeyViewController:YES]];
|
[self showView:[self hockeyViewController:YES]];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -76,20 +76,20 @@
|
|||||||
- (void)updateAppStoreHeader {
|
- (void)updateAppStoreHeader {
|
||||||
BITAppVersionMetaInfo *appVersion = _updateManager.newestAppVersion;
|
BITAppVersionMetaInfo *appVersion = _updateManager.newestAppVersion;
|
||||||
_appStoreHeader.headerLabel = appVersion.name;
|
_appStoreHeader.headerLabel = appVersion.name;
|
||||||
_appStoreHeader.middleHeaderLabel = [appVersion versionString];
|
_appStoreHeader.middleHeaderLabel = [_updateManager currentAppVersion];// [appVersion versionString];
|
||||||
NSDateFormatter *formatter = [[[NSDateFormatter alloc] init] autorelease];
|
// NSDateFormatter *formatter = [[[NSDateFormatter alloc] init] autorelease];
|
||||||
[formatter setDateStyle:NSDateFormatterMediumStyle];
|
// [formatter setDateStyle:NSDateFormatterMediumStyle];
|
||||||
NSMutableString *subHeaderString = [NSMutableString string];
|
// NSMutableString *subHeaderString = [NSMutableString string];
|
||||||
if (appVersion.date) {
|
// if (appVersion.date) {
|
||||||
[subHeaderString appendString:[formatter stringFromDate:appVersion.date]];
|
// [subHeaderString appendString:[formatter stringFromDate:appVersion.date]];
|
||||||
}
|
// }
|
||||||
if (appVersion.size) {
|
// if (appVersion.size) {
|
||||||
if ([subHeaderString length]) {
|
// if ([subHeaderString length]) {
|
||||||
[subHeaderString appendString:@" - "];
|
// [subHeaderString appendString:@" - "];
|
||||||
}
|
// }
|
||||||
[subHeaderString appendString:appVersion.sizeInMB];
|
// [subHeaderString appendString:appVersion.sizeInMB];
|
||||||
}
|
// }
|
||||||
_appStoreHeader.subHeaderLabel = subHeaderString;
|
// _appStoreHeader.subHeaderLabel = subHeaderString;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)appDidBecomeActive {
|
- (void)appDidBecomeActive {
|
||||||
@ -190,20 +190,30 @@
|
|||||||
|
|
||||||
- (void)configureWebCell:(BITWebTableViewCell *)cell forAppVersion:(BITAppVersionMetaInfo *)appVersion {
|
- (void)configureWebCell:(BITWebTableViewCell *)cell forAppVersion:(BITAppVersionMetaInfo *)appVersion {
|
||||||
// create web view for a version
|
// create web view for a version
|
||||||
|
NSMutableString *dateAndSizeString = [NSMutableString string];
|
||||||
|
if (appVersion.date) {
|
||||||
|
[dateAndSizeString appendString:[appVersion dateString]];
|
||||||
|
}
|
||||||
|
if (appVersion.size) {
|
||||||
|
if ([dateAndSizeString length]) {
|
||||||
|
[dateAndSizeString appendString:@" - "];
|
||||||
|
}
|
||||||
|
[dateAndSizeString appendString:appVersion.sizeInMB];
|
||||||
|
}
|
||||||
|
|
||||||
NSString *installed = @"";
|
NSString *installed = @"";
|
||||||
if ([appVersion.version isEqualToString:[_updateManager currentAppVersion]]) {
|
if ([appVersion.version isEqualToString:[_updateManager currentAppVersion]]) {
|
||||||
installed = [NSString stringWithFormat:@"<span style=\"float:%@;\"><b>%@</b></span>", [appVersion isEqual:_updateManager.newestAppVersion] ? @"left" : @"right", BITHockeyLocalizedString(@"UpdateInstalled")];
|
installed = [NSString stringWithFormat:@"<span style=\"float:right;\"><b>%@</b></span>", BITHockeyLocalizedString(@"UpdateInstalled")];
|
||||||
}
|
}
|
||||||
|
|
||||||
if ([appVersion isEqual:_updateManager.newestAppVersion]) {
|
if ([appVersion isEqual:_updateManager.newestAppVersion]) {
|
||||||
if ([appVersion.notes length] > 0) {
|
if ([appVersion.notes length] > 0) {
|
||||||
installed = [NSString stringWithFormat:@"<p> %@</p>", installed];
|
cell.webViewContent = [NSString stringWithFormat:@"<p><b>%@</b>%@<br/><small>%@</small></p><p>%@</p>", [appVersion versionString], installed, dateAndSizeString, appVersion.notes];
|
||||||
cell.webViewContent = [NSString stringWithFormat:@"%@%@", installed, appVersion.notes];
|
|
||||||
} else {
|
} else {
|
||||||
cell.webViewContent = [NSString stringWithFormat:@"<div style=\"min-height:200px;vertical-align:middle;text-align:center;\">%@</div>", BITHockeyLocalizedString(@"UpdateNoReleaseNotesAvailable")];
|
cell.webViewContent = [NSString stringWithFormat:@"<div style=\"min-height:200px;vertical-align:middle;text-align:center;\">%@</div>", BITHockeyLocalizedString(@"UpdateNoReleaseNotesAvailable")];
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
cell.webViewContent = [NSString stringWithFormat:@"<p><b>%@</b>%@<br/><small>%@</small></p><p>%@</p>", [appVersion versionString], installed, [appVersion dateString], [appVersion notesOrEmptyString]];
|
cell.webViewContent = [NSString stringWithFormat:@"<p><b>%@</b>%@<br/><small>%@</small></p><p>%@</p>", [appVersion versionString], installed, dateAndSizeString, [appVersion notesOrEmptyString]];
|
||||||
}
|
}
|
||||||
cell.cellBackgroundColor = BIT_RGBCOLOR(235, 235, 235);
|
cell.cellBackgroundColor = BIT_RGBCOLOR(235, 235, 235);
|
||||||
|
|
||||||
@ -255,29 +265,6 @@
|
|||||||
|
|
||||||
#pragma mark - View lifecycle
|
#pragma mark - View lifecycle
|
||||||
|
|
||||||
//- (CAGradientLayer *)backgroundLayer {
|
|
||||||
// UIColor *colorOne = [UIColor colorWithWhite:0.9 alpha:1.0];
|
|
||||||
// UIColor *colorTwo = [UIColor colorWithHue:0.625 saturation:0.0 brightness:0.85 alpha:1.0];
|
|
||||||
// UIColor *colorThree = [UIColor colorWithHue:0.625 saturation:0.0 brightness:0.7 alpha:1.0];
|
|
||||||
// UIColor *colorFour = [UIColor colorWithHue:0.625 saturation:0.0 brightness:0.4 alpha:1.0];
|
|
||||||
//
|
|
||||||
// NSArray *colors = [NSArray arrayWithObjects:(id)colorOne.CGColor, colorTwo.CGColor, colorThree.CGColor, colorFour.CGColor, nil];
|
|
||||||
//
|
|
||||||
// NSNumber *stopOne = [NSNumber numberWithFloat:0.0];
|
|
||||||
// NSNumber *stopTwo = [NSNumber numberWithFloat:0.02];
|
|
||||||
// NSNumber *stopThree = [NSNumber numberWithFloat:0.99];
|
|
||||||
// NSNumber *stopFour = [NSNumber numberWithFloat:1.0];
|
|
||||||
//
|
|
||||||
// NSArray *locations = [NSArray arrayWithObjects:stopOne, stopTwo, stopThree, stopFour, nil];
|
|
||||||
//
|
|
||||||
// CAGradientLayer *headerLayer = [CAGradientLayer layer];
|
|
||||||
// //headerLayer.frame = CGRectMake(0.0, 0.0, 320.0, 77.0);
|
|
||||||
// headerLayer.colors = colors;
|
|
||||||
// headerLayer.locations = locations;
|
|
||||||
//
|
|
||||||
// return headerLayer;
|
|
||||||
//}
|
|
||||||
|
|
||||||
- (void)viewDidLoad {
|
- (void)viewDidLoad {
|
||||||
[super viewDidLoad];
|
[super viewDidLoad];
|
||||||
|
|
||||||
@ -292,12 +279,12 @@
|
|||||||
[_updateManager addObserver:self forKeyPath:@"apps" options:0 context:nil];
|
[_updateManager addObserver:self forKeyPath:@"apps" options:0 context:nil];
|
||||||
_kvoRegistered = YES;
|
_kvoRegistered = YES;
|
||||||
|
|
||||||
self.tableView.backgroundColor = BIT_RGBCOLOR(235, 235, 235);
|
self.tableView.backgroundColor = BIT_RGBCOLOR(245, 245, 245);
|
||||||
self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
|
self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
|
||||||
|
|
||||||
UIView *topView = [[[UIView alloc] initWithFrame:CGRectMake(0, -(600-kAppStoreViewHeight), self.view.frame.size.width, 600)] autorelease];
|
UIView *topView = [[[UIView alloc] initWithFrame:CGRectMake(0, -(600-kAppStoreViewHeight), self.view.frame.size.width, 600)] autorelease];
|
||||||
topView.autoresizingMask = UIViewAutoresizingFlexibleWidth;
|
topView.autoresizingMask = UIViewAutoresizingFlexibleWidth;
|
||||||
topView.backgroundColor = BIT_RGBCOLOR(140, 141, 142);
|
topView.backgroundColor = BIT_RGBCOLOR(245, 245, 245);
|
||||||
[self.tableView addSubview:topView];
|
[self.tableView addSubview:topView];
|
||||||
|
|
||||||
_appStoreHeader = [[BITAppStoreHeader alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, kAppStoreViewHeight)];
|
_appStoreHeader = [[BITAppStoreHeader alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, kAppStoreViewHeight)];
|
||||||
@ -359,7 +346,7 @@
|
|||||||
storeButton.autoresizingMask = UIViewAutoresizingFlexibleLeftMargin;
|
storeButton.autoresizingMask = UIViewAutoresizingFlexibleLeftMargin;
|
||||||
storeButton.buttonDelegate = self;
|
storeButton.buttonDelegate = self;
|
||||||
[self.tableView.tableHeaderView addSubview:storeButton];
|
[self.tableView.tableHeaderView addSubview:storeButton];
|
||||||
storeButton.buttonData = [BITStoreButtonData dataWithLabel:@"" colors:[BITStoreButton appStoreGrayColor] enabled:NO];
|
storeButton.buttonData = [BITStoreButtonData dataWithLabel:@"" enabled:NO];
|
||||||
[storeButton alignToSuperview];
|
[storeButton alignToSuperview];
|
||||||
_appStoreButton = [storeButton retain];
|
_appStoreButton = [storeButton retain];
|
||||||
self.appStoreButtonState = AppStoreButtonStateCheck;
|
self.appStoreButtonState = AppStoreButtonStateCheck;
|
||||||
@ -531,19 +518,19 @@
|
|||||||
|
|
||||||
switch (anAppStoreButtonState) {
|
switch (anAppStoreButtonState) {
|
||||||
case AppStoreButtonStateOffline:
|
case AppStoreButtonStateOffline:
|
||||||
[_appStoreButton setButtonData:[BITStoreButtonData dataWithLabel:BITHockeyLocalizedString(@"UpdateButtonOffline") colors:[BITStoreButton appStoreGrayColor] enabled:NO] animated:animated];
|
[_appStoreButton setButtonData:[BITStoreButtonData dataWithLabel:BITHockeyLocalizedString(@"UpdateButtonOffline") enabled:NO] animated:animated];
|
||||||
break;
|
break;
|
||||||
case AppStoreButtonStateCheck:
|
case AppStoreButtonStateCheck:
|
||||||
[_appStoreButton setButtonData:[BITStoreButtonData dataWithLabel:BITHockeyLocalizedString(@"UpdateButtonCheck") colors:[BITStoreButton appStoreGreenColor] enabled:YES] animated:animated];
|
[_appStoreButton setButtonData:[BITStoreButtonData dataWithLabel:BITHockeyLocalizedString(@"UpdateButtonCheck") enabled:YES] animated:animated];
|
||||||
break;
|
break;
|
||||||
case AppStoreButtonStateSearching:
|
case AppStoreButtonStateSearching:
|
||||||
[_appStoreButton setButtonData:[BITStoreButtonData dataWithLabel:BITHockeyLocalizedString(@"UpdateButtonSearching") colors:[BITStoreButton appStoreGrayColor] enabled:NO] animated:animated];
|
[_appStoreButton setButtonData:[BITStoreButtonData dataWithLabel:BITHockeyLocalizedString(@"UpdateButtonSearching") enabled:NO] animated:animated];
|
||||||
break;
|
break;
|
||||||
case AppStoreButtonStateUpdate:
|
case AppStoreButtonStateUpdate:
|
||||||
[_appStoreButton setButtonData:[BITStoreButtonData dataWithLabel:BITHockeyLocalizedString(@"UpdateButtonUpdate") colors:[BITStoreButton appStoreBlueColor] enabled:YES] animated:animated];
|
[_appStoreButton setButtonData:[BITStoreButtonData dataWithLabel:BITHockeyLocalizedString(@"UpdateButtonUpdate") enabled:YES] animated:animated];
|
||||||
break;
|
break;
|
||||||
case AppStoreButtonStateInstalling:
|
case AppStoreButtonStateInstalling:
|
||||||
[_appStoreButton setButtonData:[BITStoreButtonData dataWithLabel:BITHockeyLocalizedString(@"UpdateButtonInstalling") colors:[BITStoreButton appStoreGrayColor] enabled:NO] animated:animated];
|
[_appStoreButton setButtonData:[BITStoreButtonData dataWithLabel:BITHockeyLocalizedString(@"UpdateButtonInstalling") enabled:NO] animated:animated];
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user