Skip to content
This repository has been archived by the owner on Feb 19, 2020. It is now read-only.

Commit

Permalink
Merge branch 'release/3.0.0'
Browse files Browse the repository at this point in the history
Conflicts:
	Classes/BITCrashManager.m
	Classes/BITCrashReportTextFormatter.m
	Classes/BITHockeyHelper.m
	Classes/BITUpdateManager.m
	Classes/HockeySDK.h
	Classes/HockeySDKPrivate.m
	HockeySDK.podspec
	README.md
	Support/buildnumber.xcconfig
	docs/Changelog-template.md
  • Loading branch information
DerAndereAndi committed Feb 12, 2013
2 parents 90b2bfe + 2fc5594 commit 18a3e93
Show file tree
Hide file tree
Showing 114 changed files with 9,912 additions and 3,205 deletions.
5 changes: 3 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Xcode
build/*
build
*.pbxuser
!default.pbxuser
*.mode?v3
Expand All @@ -19,4 +19,5 @@ profile
*~.nib
profile

documentation/
documentation/
Products/
40 changes: 40 additions & 0 deletions Classes/BITAppStoreHeader.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
/*
* Author: Andreas Linde <[email protected]>
* Peter Steinberger
*
* Copyright (c) 2012-2013 HockeyApp, Bit Stadium GmbH.
* Copyright (c) 2011-2012 Peter Steinberger.
* All rights reserved.
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
* files (the "Software"), to deal in the Software without
* restriction, including without limitation the rights to use,
* copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following
* conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*/


#import <UIKit/UIKit.h>

@interface BITAppStoreHeader : UIView

@property (nonatomic, copy) NSString *headerText;
@property (nonatomic, copy) NSString *subHeaderText;
@property (nonatomic, strong) UIImage *iconImage;

@end
139 changes: 139 additions & 0 deletions Classes/BITAppStoreHeader.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,139 @@
/*
* Author: Andreas Linde <[email protected]>
* Peter Steinberger
*
* Copyright (c) 2012-2013 HockeyApp, Bit Stadium GmbH.
* Copyright (c) 2011-2012 Peter Steinberger.
* All rights reserved.
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
* files (the "Software"), to deal in the Software without
* restriction, including without limitation the rights to use,
* copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following
* conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*/


#import "BITAppStoreHeader.h"
#import "BITHockeyHelper.h"
#import "HockeySDKPrivate.h"


#define kLightGrayColor BIT_RGBCOLOR(235, 235, 235)
#define kDarkGrayColor BIT_RGBCOLOR(186, 186, 186)
#define kWhiteBackgroundColor BIT_RGBCOLOR(245, 245, 245)
#define kImageHeight 72
#define kImageBorderRadius 12
#define kImageLeftMargin 14
#define kImageTopMargin 12
#define kTextRow kImageTopMargin*2 + kImageHeight

@implementation BITAppStoreHeader {
UILabel *_headerLabelView;
UILabel *_middleLabelView;
}


#pragma mark - NSObject

- (id)initWithFrame:(CGRect)frame {
if ((self = [super initWithFrame:frame])) {
self.autoresizingMask = UIViewAutoresizingFlexibleWidth;
self.backgroundColor = kWhiteBackgroundColor;
}
return self;
}


#pragma mark - UIView

- (void)drawRect:(CGRect)rect {
CGRect bounds = self.bounds;
CGContextRef context = UIGraphicsGetCurrentContext();

// draw the gradient
NSArray *colors = [NSArray arrayWithObjects:(id)kDarkGrayColor.CGColor, (id)kLightGrayColor.CGColor, nil];
CGGradientRef gradient = CGGradientCreateWithColors(CGColorGetColorSpace((__bridge CGColorRef)[colors objectAtIndex:0]), (__bridge CFArrayRef)colors, (CGFloat[2]){0, 1});
CGPoint top = CGPointMake(CGRectGetMidX(bounds), bounds.size.height - 3);
CGPoint bottom = CGPointMake(CGRectGetMidX(bounds), CGRectGetMaxY(bounds));
CGContextDrawLinearGradient(context, gradient, top, bottom, 0);
CGGradientRelease(gradient);

// icon
[_iconImage drawAtPoint:CGPointMake(kImageLeftMargin, kImageTopMargin)];
}


- (void)layoutSubviews {
[super layoutSubviews];

CGFloat globalWidth = self.frame.size.width;

// draw header name
UIColor *mainTextColor = BIT_RGBCOLOR(61, 61, 61);
UIColor *secondaryTextColor = BIT_RGBCOLOR(100, 100, 100);
UIFont *mainFont = [UIFont boldSystemFontOfSize:15];
UIFont *secondaryFont = [UIFont systemFontOfSize:10];

if (!_headerLabelView) _headerLabelView = [[UILabel alloc] init];
[_headerLabelView setFont:mainFont];
[_headerLabelView setFrame:CGRectMake(kTextRow, kImageTopMargin, globalWidth-kTextRow, 20)];
[_headerLabelView setTextColor:mainTextColor];
[_headerLabelView setBackgroundColor:[UIColor clearColor]];
[_headerLabelView setText:_headerText];
[self addSubview:_headerLabelView];

// middle
if (!_middleLabelView) _middleLabelView = [[UILabel alloc] init];
[_middleLabelView setFont:secondaryFont];
[_middleLabelView setFrame:CGRectMake(kTextRow, kImageTopMargin + 17, globalWidth-kTextRow, 20)];
[_middleLabelView setTextColor:secondaryTextColor];
[_middleLabelView setBackgroundColor:[UIColor clearColor]];
[_middleLabelView setText:_subHeaderText];
[self addSubview:_middleLabelView];
}


#pragma mark - Properties

- (void)setHeaderText:(NSString *)anHeaderText {
if (_headerText != anHeaderText) {
_headerText = [anHeaderText copy];
[self setNeedsDisplay];
}
}

- (void)setSubHeaderText:(NSString *)aSubHeaderText {
if (_subHeaderText != aSubHeaderText) {
_subHeaderText = [aSubHeaderText copy];
[self setNeedsDisplay];
}
}

- (void)setIconImage:(UIImage *)anIconImage {
if (_iconImage != anIconImage) {

// scale, make borders and reflection
_iconImage = bit_imageToFitSize(anIconImage, CGSizeMake(kImageHeight, kImageHeight), YES);
_iconImage = bit_roundedCornerImage(_iconImage, kImageBorderRadius, 0.0);

[self setNeedsDisplay];
}
}

@end
5 changes: 4 additions & 1 deletion Classes/BITAppVersionMetaInfo.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* Author: Peter Steinberger
*
* Copyright (c) 2012 HockeyApp, Bit Stadium GmbH.
* Copyright (c) 2012-2013 HockeyApp, Bit Stadium GmbH.
* Copyright (c) 2011 Andreas Linde, Peter Steinberger.
* All rights reserved.
*
Expand Down Expand Up @@ -38,6 +38,8 @@
@property (nonatomic, copy) NSDate *date;
@property (nonatomic, copy) NSNumber *size;
@property (nonatomic, copy) NSNumber *mandatory;
@property (nonatomic, copy) NSNumber *versionID;
@property (nonatomic, copy) NSDictionary *uuids;

- (NSString *)nameAndVersionString;
- (NSString *)versionString;
Expand All @@ -46,6 +48,7 @@
- (NSString *)notesOrEmptyString;
- (void)setDateWithTimestamp:(NSTimeInterval)timestamp;
- (BOOL)isValid;
- (BOOL)hasUUID:(NSString *)uuid;
- (BOOL)isEqualToAppVersionMetaInfo:(BITAppVersionMetaInfo *)anAppVersionMetaInfo;

+ (BITAppVersionMetaInfo *)appVersionMetaInfoFromDict:(NSDictionary *)dict;
Expand Down
48 changes: 26 additions & 22 deletions Classes/BITAppVersionMetaInfo.m
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* Author: Peter Steinberger
*
* Copyright (c) 2012 HockeyApp, Bit Stadium GmbH.
* Copyright (c) 2012-2013 HockeyApp, Bit Stadium GmbH.
* Copyright (c) 2011 Andreas Linde, Peter Steinberger.
* All rights reserved.
*
Expand Down Expand Up @@ -33,19 +33,11 @@

@implementation BITAppVersionMetaInfo

@synthesize name = _name;
@synthesize version = _version;
@synthesize shortVersion = _shortVersion;
@synthesize notes = _notes;
@synthesize date = _date;
@synthesize size = _size;
@synthesize mandatory = _mandatory;


#pragma mark - Static

+ (BITAppVersionMetaInfo *)appVersionMetaInfoFromDict:(NSDictionary *)dict {
BITAppVersionMetaInfo *appVersionMetaInfo = [[[[self class] alloc] init] autorelease];
BITAppVersionMetaInfo *appVersionMetaInfo = [[[self class] alloc] init];

if ([dict isKindOfClass:[NSDictionary class]]) {
appVersionMetaInfo.name = [dict objectForKey:@"title"];
Expand All @@ -55,6 +47,8 @@ + (BITAppVersionMetaInfo *)appVersionMetaInfoFromDict:(NSDictionary *)dict {
appVersionMetaInfo.size = [dict objectForKey:@"appsize"];
appVersionMetaInfo.notes = [dict objectForKey:@"notes"];
appVersionMetaInfo.mandatory = [dict objectForKey:@"mandatory"];
appVersionMetaInfo.versionID = [dict objectForKey:@"id"];
appVersionMetaInfo.uuids = [dict objectForKey:@"uuids"];
}

return appVersionMetaInfo;
Expand All @@ -63,17 +57,6 @@ + (BITAppVersionMetaInfo *)appVersionMetaInfoFromDict:(NSDictionary *)dict {

#pragma mark - NSObject

- (void)dealloc {
[_name release];
[_version release];
[_shortVersion release];
[_notes release];
[_date release];
[_size release];
[_mandatory release];

[super dealloc];
}

- (BOOL)isEqual:(id)other {
if (other == self)
Expand All @@ -100,6 +83,8 @@ - (BOOL)isEqualToAppVersionMetaInfo:(BITAppVersionMetaInfo *)anAppVersionMetaInf
return NO;
if (self.mandatory != anAppVersionMetaInfo.mandatory && ![self.mandatory isEqualToNumber:anAppVersionMetaInfo.mandatory])
return NO;
if (![self.uuids isEqualToDictionary:anAppVersionMetaInfo.uuids])
return NO;
return YES;
}

Expand All @@ -114,6 +99,8 @@ - (void)encodeWithCoder:(NSCoder *)encoder {
[encoder encodeObject:self.date forKey:@"date"];
[encoder encodeObject:self.size forKey:@"size"];
[encoder encodeObject:self.mandatory forKey:@"mandatory"];
[encoder encodeObject:self.versionID forKey:@"versionID"];
[encoder encodeObject:self.uuids forKey:@"uuids"];
}

- (id)initWithCoder:(NSCoder *)decoder {
Expand All @@ -125,6 +112,8 @@ - (id)initWithCoder:(NSCoder *)decoder {
self.date = [decoder decodeObjectForKey:@"date"];
self.size = [decoder decodeObjectForKey:@"size"];
self.mandatory = [decoder decodeObjectForKey:@"mandatory"];
self.versionID = [decoder decodeObjectForKey:@"versionID"];
self.uuids = [decoder decodeObjectForKey:@"uuids"];
}
return self;
}
Expand All @@ -144,7 +133,7 @@ - (NSString *)versionString {
}

- (NSString *)dateString {
NSDateFormatter *formatter = [[[NSDateFormatter alloc] init] autorelease];
NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
[formatter setDateStyle:NSDateFormatterMediumStyle];

return [formatter stringFromDate:self.date];
Expand Down Expand Up @@ -183,4 +172,19 @@ - (BOOL)isValid {
return valid;
}

- (BOOL)hasUUID:(NSString *)uuid {
if (!uuid) return NO;
if (!self.uuids) return NO;

__block BOOL hasUUID = NO;

[self.uuids enumerateKeysAndObjectsUsingBlock:^(id key, id obj, BOOL *stop){
if (obj && [uuid compare:obj] == NSOrderedSame) {
hasUUID = YES;
*stop = YES;
}
}];

return hasUUID;
}
@end
Loading

0 comments on commit 18a3e93

Please sign in to comment.