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

Commit 18a3e93

Browse files
committed
Merge branch 'release/3.0.0'
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
2 parents 90b2bfe + 2fc5594 commit 18a3e93

File tree

114 files changed

+9912
-3205
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

114 files changed

+9912
-3205
lines changed

.gitignore

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Xcode
2-
build/*
2+
build
33
*.pbxuser
44
!default.pbxuser
55
*.mode?v3
@@ -19,4 +19,5 @@ profile
1919
*~.nib
2020
profile
2121

22-
documentation/
22+
documentation/
23+
Products/

Classes/BITAppStoreHeader.h

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
/*
2+
* Author: Andreas Linde <[email protected]>
3+
* Peter Steinberger
4+
*
5+
* Copyright (c) 2012-2013 HockeyApp, Bit Stadium GmbH.
6+
* Copyright (c) 2011-2012 Peter Steinberger.
7+
* All rights reserved.
8+
*
9+
* Permission is hereby granted, free of charge, to any person
10+
* obtaining a copy of this software and associated documentation
11+
* files (the "Software"), to deal in the Software without
12+
* restriction, including without limitation the rights to use,
13+
* copy, modify, merge, publish, distribute, sublicense, and/or sell
14+
* copies of the Software, and to permit persons to whom the
15+
* Software is furnished to do so, subject to the following
16+
* conditions:
17+
*
18+
* The above copyright notice and this permission notice shall be
19+
* included in all copies or substantial portions of the Software.
20+
*
21+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
22+
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
23+
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
24+
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
25+
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
26+
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
27+
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
28+
* OTHER DEALINGS IN THE SOFTWARE.
29+
*/
30+
31+
32+
#import <UIKit/UIKit.h>
33+
34+
@interface BITAppStoreHeader : UIView
35+
36+
@property (nonatomic, copy) NSString *headerText;
37+
@property (nonatomic, copy) NSString *subHeaderText;
38+
@property (nonatomic, strong) UIImage *iconImage;
39+
40+
@end

Classes/BITAppStoreHeader.m

Lines changed: 139 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,139 @@
1+
/*
2+
* Author: Andreas Linde <[email protected]>
3+
* Peter Steinberger
4+
*
5+
* Copyright (c) 2012-2013 HockeyApp, Bit Stadium GmbH.
6+
* Copyright (c) 2011-2012 Peter Steinberger.
7+
* All rights reserved.
8+
*
9+
* Permission is hereby granted, free of charge, to any person
10+
* obtaining a copy of this software and associated documentation
11+
* files (the "Software"), to deal in the Software without
12+
* restriction, including without limitation the rights to use,
13+
* copy, modify, merge, publish, distribute, sublicense, and/or sell
14+
* copies of the Software, and to permit persons to whom the
15+
* Software is furnished to do so, subject to the following
16+
* conditions:
17+
*
18+
* The above copyright notice and this permission notice shall be
19+
* included in all copies or substantial portions of the Software.
20+
*
21+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
22+
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
23+
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
24+
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
25+
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
26+
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
27+
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
28+
* OTHER DEALINGS IN THE SOFTWARE.
29+
*/
30+
31+
32+
#import "BITAppStoreHeader.h"
33+
#import "BITHockeyHelper.h"
34+
#import "HockeySDKPrivate.h"
35+
36+
37+
#define kLightGrayColor BIT_RGBCOLOR(235, 235, 235)
38+
#define kDarkGrayColor BIT_RGBCOLOR(186, 186, 186)
39+
#define kWhiteBackgroundColor BIT_RGBCOLOR(245, 245, 245)
40+
#define kImageHeight 72
41+
#define kImageBorderRadius 12
42+
#define kImageLeftMargin 14
43+
#define kImageTopMargin 12
44+
#define kTextRow kImageTopMargin*2 + kImageHeight
45+
46+
@implementation BITAppStoreHeader {
47+
UILabel *_headerLabelView;
48+
UILabel *_middleLabelView;
49+
}
50+
51+
52+
#pragma mark - NSObject
53+
54+
- (id)initWithFrame:(CGRect)frame {
55+
if ((self = [super initWithFrame:frame])) {
56+
self.autoresizingMask = UIViewAutoresizingFlexibleWidth;
57+
self.backgroundColor = kWhiteBackgroundColor;
58+
}
59+
return self;
60+
}
61+
62+
63+
#pragma mark - UIView
64+
65+
- (void)drawRect:(CGRect)rect {
66+
CGRect bounds = self.bounds;
67+
CGContextRef context = UIGraphicsGetCurrentContext();
68+
69+
// draw the gradient
70+
NSArray *colors = [NSArray arrayWithObjects:(id)kDarkGrayColor.CGColor, (id)kLightGrayColor.CGColor, nil];
71+
CGGradientRef gradient = CGGradientCreateWithColors(CGColorGetColorSpace((__bridge CGColorRef)[colors objectAtIndex:0]), (__bridge CFArrayRef)colors, (CGFloat[2]){0, 1});
72+
CGPoint top = CGPointMake(CGRectGetMidX(bounds), bounds.size.height - 3);
73+
CGPoint bottom = CGPointMake(CGRectGetMidX(bounds), CGRectGetMaxY(bounds));
74+
CGContextDrawLinearGradient(context, gradient, top, bottom, 0);
75+
CGGradientRelease(gradient);
76+
77+
// icon
78+
[_iconImage drawAtPoint:CGPointMake(kImageLeftMargin, kImageTopMargin)];
79+
}
80+
81+
82+
- (void)layoutSubviews {
83+
[super layoutSubviews];
84+
85+
CGFloat globalWidth = self.frame.size.width;
86+
87+
// draw header name
88+
UIColor *mainTextColor = BIT_RGBCOLOR(61, 61, 61);
89+
UIColor *secondaryTextColor = BIT_RGBCOLOR(100, 100, 100);
90+
UIFont *mainFont = [UIFont boldSystemFontOfSize:15];
91+
UIFont *secondaryFont = [UIFont systemFontOfSize:10];
92+
93+
if (!_headerLabelView) _headerLabelView = [[UILabel alloc] init];
94+
[_headerLabelView setFont:mainFont];
95+
[_headerLabelView setFrame:CGRectMake(kTextRow, kImageTopMargin, globalWidth-kTextRow, 20)];
96+
[_headerLabelView setTextColor:mainTextColor];
97+
[_headerLabelView setBackgroundColor:[UIColor clearColor]];
98+
[_headerLabelView setText:_headerText];
99+
[self addSubview:_headerLabelView];
100+
101+
// middle
102+
if (!_middleLabelView) _middleLabelView = [[UILabel alloc] init];
103+
[_middleLabelView setFont:secondaryFont];
104+
[_middleLabelView setFrame:CGRectMake(kTextRow, kImageTopMargin + 17, globalWidth-kTextRow, 20)];
105+
[_middleLabelView setTextColor:secondaryTextColor];
106+
[_middleLabelView setBackgroundColor:[UIColor clearColor]];
107+
[_middleLabelView setText:_subHeaderText];
108+
[self addSubview:_middleLabelView];
109+
}
110+
111+
112+
#pragma mark - Properties
113+
114+
- (void)setHeaderText:(NSString *)anHeaderText {
115+
if (_headerText != anHeaderText) {
116+
_headerText = [anHeaderText copy];
117+
[self setNeedsDisplay];
118+
}
119+
}
120+
121+
- (void)setSubHeaderText:(NSString *)aSubHeaderText {
122+
if (_subHeaderText != aSubHeaderText) {
123+
_subHeaderText = [aSubHeaderText copy];
124+
[self setNeedsDisplay];
125+
}
126+
}
127+
128+
- (void)setIconImage:(UIImage *)anIconImage {
129+
if (_iconImage != anIconImage) {
130+
131+
// scale, make borders and reflection
132+
_iconImage = bit_imageToFitSize(anIconImage, CGSizeMake(kImageHeight, kImageHeight), YES);
133+
_iconImage = bit_roundedCornerImage(_iconImage, kImageBorderRadius, 0.0);
134+
135+
[self setNeedsDisplay];
136+
}
137+
}
138+
139+
@end

Classes/BITAppVersionMetaInfo.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*
22
* Author: Peter Steinberger
33
*
4-
* Copyright (c) 2012 HockeyApp, Bit Stadium GmbH.
4+
* Copyright (c) 2012-2013 HockeyApp, Bit Stadium GmbH.
55
* Copyright (c) 2011 Andreas Linde, Peter Steinberger.
66
* All rights reserved.
77
*
@@ -38,6 +38,8 @@
3838
@property (nonatomic, copy) NSDate *date;
3939
@property (nonatomic, copy) NSNumber *size;
4040
@property (nonatomic, copy) NSNumber *mandatory;
41+
@property (nonatomic, copy) NSNumber *versionID;
42+
@property (nonatomic, copy) NSDictionary *uuids;
4143

4244
- (NSString *)nameAndVersionString;
4345
- (NSString *)versionString;
@@ -46,6 +48,7 @@
4648
- (NSString *)notesOrEmptyString;
4749
- (void)setDateWithTimestamp:(NSTimeInterval)timestamp;
4850
- (BOOL)isValid;
51+
- (BOOL)hasUUID:(NSString *)uuid;
4952
- (BOOL)isEqualToAppVersionMetaInfo:(BITAppVersionMetaInfo *)anAppVersionMetaInfo;
5053

5154
+ (BITAppVersionMetaInfo *)appVersionMetaInfoFromDict:(NSDictionary *)dict;

Classes/BITAppVersionMetaInfo.m

Lines changed: 26 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*
22
* Author: Peter Steinberger
33
*
4-
* Copyright (c) 2012 HockeyApp, Bit Stadium GmbH.
4+
* Copyright (c) 2012-2013 HockeyApp, Bit Stadium GmbH.
55
* Copyright (c) 2011 Andreas Linde, Peter Steinberger.
66
* All rights reserved.
77
*
@@ -33,19 +33,11 @@
3333

3434
@implementation BITAppVersionMetaInfo
3535

36-
@synthesize name = _name;
37-
@synthesize version = _version;
38-
@synthesize shortVersion = _shortVersion;
39-
@synthesize notes = _notes;
40-
@synthesize date = _date;
41-
@synthesize size = _size;
42-
@synthesize mandatory = _mandatory;
43-
4436

4537
#pragma mark - Static
4638

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

5042
if ([dict isKindOfClass:[NSDictionary class]]) {
5143
appVersionMetaInfo.name = [dict objectForKey:@"title"];
@@ -55,6 +47,8 @@ + (BITAppVersionMetaInfo *)appVersionMetaInfoFromDict:(NSDictionary *)dict {
5547
appVersionMetaInfo.size = [dict objectForKey:@"appsize"];
5648
appVersionMetaInfo.notes = [dict objectForKey:@"notes"];
5749
appVersionMetaInfo.mandatory = [dict objectForKey:@"mandatory"];
50+
appVersionMetaInfo.versionID = [dict objectForKey:@"id"];
51+
appVersionMetaInfo.uuids = [dict objectForKey:@"uuids"];
5852
}
5953

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

6458
#pragma mark - NSObject
6559

66-
- (void)dealloc {
67-
[_name release];
68-
[_version release];
69-
[_shortVersion release];
70-
[_notes release];
71-
[_date release];
72-
[_size release];
73-
[_mandatory release];
74-
75-
[super dealloc];
76-
}
7760

7861
- (BOOL)isEqual:(id)other {
7962
if (other == self)
@@ -100,6 +83,8 @@ - (BOOL)isEqualToAppVersionMetaInfo:(BITAppVersionMetaInfo *)anAppVersionMetaInf
10083
return NO;
10184
if (self.mandatory != anAppVersionMetaInfo.mandatory && ![self.mandatory isEqualToNumber:anAppVersionMetaInfo.mandatory])
10285
return NO;
86+
if (![self.uuids isEqualToDictionary:anAppVersionMetaInfo.uuids])
87+
return NO;
10388
return YES;
10489
}
10590

@@ -114,6 +99,8 @@ - (void)encodeWithCoder:(NSCoder *)encoder {
11499
[encoder encodeObject:self.date forKey:@"date"];
115100
[encoder encodeObject:self.size forKey:@"size"];
116101
[encoder encodeObject:self.mandatory forKey:@"mandatory"];
102+
[encoder encodeObject:self.versionID forKey:@"versionID"];
103+
[encoder encodeObject:self.uuids forKey:@"uuids"];
117104
}
118105

119106
- (id)initWithCoder:(NSCoder *)decoder {
@@ -125,6 +112,8 @@ - (id)initWithCoder:(NSCoder *)decoder {
125112
self.date = [decoder decodeObjectForKey:@"date"];
126113
self.size = [decoder decodeObjectForKey:@"size"];
127114
self.mandatory = [decoder decodeObjectForKey:@"mandatory"];
115+
self.versionID = [decoder decodeObjectForKey:@"versionID"];
116+
self.uuids = [decoder decodeObjectForKey:@"uuids"];
128117
}
129118
return self;
130119
}
@@ -144,7 +133,7 @@ - (NSString *)versionString {
144133
}
145134

146135
- (NSString *)dateString {
147-
NSDateFormatter *formatter = [[[NSDateFormatter alloc] init] autorelease];
136+
NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
148137
[formatter setDateStyle:NSDateFormatterMediumStyle];
149138

150139
return [formatter stringFromDate:self.date];
@@ -183,4 +172,19 @@ - (BOOL)isValid {
183172
return valid;
184173
}
185174

175+
- (BOOL)hasUUID:(NSString *)uuid {
176+
if (!uuid) return NO;
177+
if (!self.uuids) return NO;
178+
179+
__block BOOL hasUUID = NO;
180+
181+
[self.uuids enumerateKeysAndObjectsUsingBlock:^(id key, id obj, BOOL *stop){
182+
if (obj && [uuid compare:obj] == NSOrderedSame) {
183+
hasUUID = YES;
184+
*stop = YES;
185+
}
186+
}];
187+
188+
return hasUUID;
189+
}
186190
@end

0 commit comments

Comments
 (0)