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

Commit

Permalink
Merge pull request #528 from bitstadium/release/5.1.3
Browse files Browse the repository at this point in the history
Bump version and write changelog
  • Loading branch information
dhei authored Sep 27, 2018
2 parents f778ae7 + 9c33573 commit 4fb5b47
Show file tree
Hide file tree
Showing 39 changed files with 479 additions and 728 deletions.
4 changes: 2 additions & 2 deletions Classes/BITAppVersionMetaInfo.m
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ + (BITAppVersionMetaInfo *)appVersionMetaInfoFromDict:(NSDictionary *)dict {
appVersionMetaInfo.version = [dict objectForKey:@"version"];
appVersionMetaInfo.shortVersion = [dict objectForKey:@"shortversion"];
appVersionMetaInfo.minOSVersion = [dict objectForKey:@"minimum_os_version"];
[appVersionMetaInfo setDateWithTimestamp:[[dict objectForKey:@"timestamp"] doubleValue]];
[appVersionMetaInfo setDateWithTimestamp:[(NSNumber *)[dict objectForKey:@"timestamp"] doubleValue]];
appVersionMetaInfo.size = [dict objectForKey:@"appsize"];
appVersionMetaInfo.notes = [dict objectForKey:@"notes"];
appVersionMetaInfo.mandatory = [dict objectForKey:@"mandatory"];
Expand All @@ -62,7 +62,7 @@ + (BITAppVersionMetaInfo *)appVersionMetaInfoFromDict:(NSDictionary *)dict {
- (BOOL)isEqual:(id)other {
if (other == self)
return YES;
if (!other || ![other isKindOfClass:[self class]])
if (!other || ![(NSObject *)other isKindOfClass:[self class]])
return NO;
return [self isEqualToAppVersionMetaInfo:other];
}
Expand Down
45 changes: 22 additions & 23 deletions Classes/BITAttributedLabel.m
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
#define kBITLineBreakWordWrapTextWidthScalingFactor (M_PI / M_E)

#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
#pragma clang diagnostic ignored "-Wunused-variable"
#pragma clang diagnostic ignored "-Wunused-parameter"
#pragma clang diagnostic ignored "-Wcast-qual"
Expand Down Expand Up @@ -882,9 +881,9 @@ - (void)drawBackground:(CTFrameRef)frame
NSDictionary *attributes = (__bridge NSDictionary *)CTRunGetAttributes((__bridge CTRunRef) glyphRun);
CGColorRef strokeColor = CGColorRefFromColor([attributes objectForKey:kBITBackgroundStrokeColorAttributeName]);
CGColorRef fillColor = CGColorRefFromColor([attributes objectForKey:kBITBackgroundFillColorAttributeName]);
UIEdgeInsets fillPadding = [[attributes objectForKey:kBITBackgroundFillPaddingAttributeName] UIEdgeInsetsValue];
CGFloat cornerRadius = [[attributes objectForKey:kBITBackgroundCornerRadiusAttributeName] floatValue];
CGFloat lineWidth = [[attributes objectForKey:kBITBackgroundLineWidthAttributeName] floatValue];
UIEdgeInsets fillPadding = [(NSValue *)[attributes objectForKey:kBITBackgroundFillPaddingAttributeName] UIEdgeInsetsValue];
CGFloat cornerRadius = [(NSNumber *)[attributes objectForKey:kBITBackgroundCornerRadiusAttributeName] floatValue];
CGFloat lineWidth = [(NSNumber *)[attributes objectForKey:kBITBackgroundLineWidthAttributeName] floatValue];

if (strokeColor || fillColor) {
CGRect runBounds = CGRectZero;
Expand Down Expand Up @@ -951,8 +950,8 @@ - (void)drawStrike:(CTFrameRef)frame

for (id glyphRun in (__bridge NSArray *)CTLineGetGlyphRuns((__bridge CTLineRef)line)) {
NSDictionary *attributes = (__bridge NSDictionary *)CTRunGetAttributes((__bridge CTRunRef) glyphRun);
BOOL strikeOut = [[attributes objectForKey:kBITStrikeOutAttributeName] boolValue];
NSInteger superscriptStyle = [[attributes objectForKey:(id)kCTSuperscriptAttributeName] integerValue];
BOOL strikeOut = [(NSNumber *)[attributes objectForKey:kBITStrikeOutAttributeName] boolValue];
NSInteger superscriptStyle = [(NSNumber *)[attributes objectForKey:(id)kCTSuperscriptAttributeName] integerValue];

if (strikeOut) {
CGRect runBounds = CGRectZero;
Expand Down Expand Up @@ -1019,9 +1018,9 @@ - (void)drawStrike:(CTFrameRef)frame
#pragma mark - BITAttributedLabel

- (void)setText:(id)text {
NSParameterAssert(!text || [text isKindOfClass:[NSAttributedString class]] || [text isKindOfClass:[NSString class]]);
NSParameterAssert(!text || [(NSObject *)text isKindOfClass:[NSAttributedString class]] || [(NSObject *)text isKindOfClass:[NSString class]]);

if ([text isKindOfClass:[NSString class]]) {
if ([(NSObject *)text isKindOfClass:[NSString class]]) {
[self setText:text afterInheritingLabelAttributesAndConfiguringWithBlock:nil];
return;
}
Expand Down Expand Up @@ -1051,7 +1050,7 @@ - (void)setText:(id)text {

[self.attributedText enumerateAttribute:NSLinkAttributeName inRange:NSMakeRange(0, self.attributedText.length) options:0 usingBlock:^(id value, NSRange range, __unused BOOL *stop) {
if (value) {
NSURL *URL = [value isKindOfClass:[NSString class]] ? [NSURL URLWithString:value] : value;
NSURL *URL = [(NSObject *)value isKindOfClass:[NSString class]] ? [NSURL URLWithString:value] : value;
[self addLinkToURL:URL withRange:range];
}
}];
Expand All @@ -1061,7 +1060,7 @@ - (void)setText:(id)text
afterInheritingLabelAttributesAndConfiguringWithBlock:(NSMutableAttributedString * (^)(NSMutableAttributedString *mutableAttributedString))block
{
NSMutableAttributedString *mutableAttributedString = nil;
if ([text isKindOfClass:[NSString class]]) {
if ([(NSObject *)text isKindOfClass:[NSString class]]) {
mutableAttributedString = [[NSMutableAttributedString alloc] initWithString:text attributes:NSAttributedStringAttributesFromLabel(self)];
} else {
mutableAttributedString = [[NSMutableAttributedString alloc] initWithAttributedString:text];
Expand Down Expand Up @@ -1299,7 +1298,7 @@ - (NSArray *)accessibilityElements {
continue;
}

NSString *sourceText = [self.text isKindOfClass:[NSString class]] ? self.text : [(NSAttributedString *)self.text string];
NSString *sourceText = [(NSObject *)self.text isKindOfClass:[NSString class]] ? self.text : [(NSAttributedString *)self.text string];

NSString *accessibilityLabel = [sourceText substringWithRange:link.result.range];
NSString *accessibilityValue = link.accessibilityValue;
Expand Down Expand Up @@ -1631,7 +1630,7 @@ - (id)initWithCoder:(NSCoder *)coder {
[self commonInit];

if ([coder containsValueForKey:NSStringFromSelector(@selector(enabledTextCheckingTypes))]) {
self.enabledTextCheckingTypes = [[coder decodeObjectForKey:NSStringFromSelector(@selector(enabledTextCheckingTypes))] unsignedLongLongValue];
self.enabledTextCheckingTypes = [(NSNumber *)[coder decodeObjectForKey:NSStringFromSelector(@selector(enabledTextCheckingTypes))] unsignedLongLongValue];
}

if ([NSMutableParagraphStyle class]) {
Expand All @@ -1658,11 +1657,11 @@ - (id)initWithCoder:(NSCoder *)coder {
}

if ([coder containsValueForKey:NSStringFromSelector(@selector(shadowRadius))]) {
self.shadowRadius = [[coder decodeObjectForKey:NSStringFromSelector(@selector(shadowRadius))] floatValue];
self.shadowRadius = [(NSNumber *)[coder decodeObjectForKey:NSStringFromSelector(@selector(shadowRadius))] floatValue];
}

if ([coder containsValueForKey:NSStringFromSelector(@selector(highlightedShadowRadius))]) {
self.highlightedShadowRadius = [[coder decodeObjectForKey:NSStringFromSelector(@selector(highlightedShadowRadius))] floatValue];
self.highlightedShadowRadius = [(NSNumber *)[coder decodeObjectForKey:NSStringFromSelector(@selector(highlightedShadowRadius))] floatValue];
}

if ([coder containsValueForKey:NSStringFromSelector(@selector(highlightedShadowOffset))]) {
Expand All @@ -1674,27 +1673,27 @@ - (id)initWithCoder:(NSCoder *)coder {
}

if ([coder containsValueForKey:NSStringFromSelector(@selector(kern))]) {
self.kern = [[coder decodeObjectForKey:NSStringFromSelector(@selector(kern))] floatValue];
self.kern = [(NSNumber *)[coder decodeObjectForKey:NSStringFromSelector(@selector(kern))] floatValue];
}

if ([coder containsValueForKey:NSStringFromSelector(@selector(firstLineIndent))]) {
self.firstLineIndent = [[coder decodeObjectForKey:NSStringFromSelector(@selector(firstLineIndent))] floatValue];
self.firstLineIndent = [(NSNumber *)[coder decodeObjectForKey:NSStringFromSelector(@selector(firstLineIndent))] floatValue];
}

if ([coder containsValueForKey:NSStringFromSelector(@selector(lineSpacing))]) {
self.lineSpacing = [[coder decodeObjectForKey:NSStringFromSelector(@selector(lineSpacing))] floatValue];
self.lineSpacing = [(NSNumber *)[coder decodeObjectForKey:NSStringFromSelector(@selector(lineSpacing))] floatValue];
}

if ([coder containsValueForKey:NSStringFromSelector(@selector(minimumLineHeight))]) {
self.minimumLineHeight = [[coder decodeObjectForKey:NSStringFromSelector(@selector(minimumLineHeight))] floatValue];
self.minimumLineHeight = [(NSNumber *)[coder decodeObjectForKey:NSStringFromSelector(@selector(minimumLineHeight))] floatValue];
}

if ([coder containsValueForKey:NSStringFromSelector(@selector(maximumLineHeight))]) {
self.maximumLineHeight = [[coder decodeObjectForKey:NSStringFromSelector(@selector(maximumLineHeight))] floatValue];
self.maximumLineHeight = [(NSNumber *)[coder decodeObjectForKey:NSStringFromSelector(@selector(maximumLineHeight))] floatValue];
}

if ([coder containsValueForKey:NSStringFromSelector(@selector(lineHeightMultiple))]) {
self.lineHeightMultiple = [[coder decodeObjectForKey:NSStringFromSelector(@selector(lineHeightMultiple))] floatValue];
self.lineHeightMultiple = [(NSNumber *)[coder decodeObjectForKey:NSStringFromSelector(@selector(lineHeightMultiple))] floatValue];
}

if ([coder containsValueForKey:NSStringFromSelector(@selector(textInsets))]) {
Expand Down Expand Up @@ -1803,7 +1802,7 @@ - (id)initWithCoder:(NSCoder *)aDecoder {
#pragma mark -

static inline CGColorRef CGColorRefFromColor(id color) {
return [color isKindOfClass:[UIColor class]] ? [color CGColor] : (__bridge CGColorRef)color;
return [(NSObject *)color isKindOfClass:[UIColor class]] ? [(UIColor *)color CGColor] : (__bridge CGColorRef)color;
}

static inline CTFontRef CTFontRefFromUIFont(UIFont * font) {
Expand Down Expand Up @@ -1832,9 +1831,9 @@ static inline CTFontRef CTFontRefFromUIFont(UIFont * font) {
key = [NSToCTAttributeNamesMap objectForKey:key] ? : key;

if (![NSMutableParagraphStyle class]) {
if ([value isKindOfClass:[UIFont class]]) {
if ([(NSObject *)value isKindOfClass:[UIFont class]]) {
value = (__bridge id)CTFontRefFromUIFont(value);
} else if ([value isKindOfClass:[UIColor class]]) {
} else if ([(NSObject *)value isKindOfClass:[UIColor class]]) {
value = (__bridge id)((UIColor *)value).CGColor;
}
}
Expand Down
101 changes: 5 additions & 96 deletions Classes/BITAuthenticator.m
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,6 @@
static NSString *const kBITAuthenticatorAuthTokenTypeKey = @"BITAuthenticatorAuthTokenTypeKey";

typedef unsigned int bit_uint32;
static unsigned char kBITPNGHeader[8] = {137, 80, 78, 71, 13, 10, 26, 10};
static unsigned char kBITPNGEndChunk[4] = {0x49, 0x45, 0x4e, 0x44};


@interface BITAuthenticator()

Expand Down Expand Up @@ -158,7 +155,6 @@ - (void)identifyWithCompletion:(void (^)(BOOL identified, NSError *))completion
return;
}

[self processFullSizeImage];
if (self.identified) {
if (completion) { completion(YES, nil); }
return;
Expand Down Expand Up @@ -202,7 +198,7 @@ - (void)identifyWithCompletion:(void (^)(BOOL identified, NSError *))completion
viewController.tableViewTitle = BITHockeyLocalizedString(@"HockeyAuthenticationViewControllerDataEmailDescription");
break;
}
id strongDelegate = self.delegate;
id<BITAuthenticatorDelegate> strongDelegate = self.delegate;
if ([strongDelegate respondsToSelector:@selector(authenticator:willShowAuthenticationController:)]) {
[strongDelegate authenticator:self willShowAuthenticationController:viewController];
}
Expand Down Expand Up @@ -370,7 +366,7 @@ + (BOOL)isValidationResponseValid:(id)response error:(NSError *__autoreleasing *
}
return NO;
}
if (![jsonObject isKindOfClass:[NSDictionary class]]) {
if (![(NSObject *)jsonObject isKindOfClass:[NSDictionary class]]) {
if (error) {
*error = [NSError errorWithDomain:kBITAuthenticatorErrorDomain
code:BITAuthenticatorAPIServerReturnedInvalidResponse
Expand Down Expand Up @@ -587,7 +583,7 @@ + (NSString *)authenticationTokenFromURLResponse:(NSHTTPURLResponse *)urlRespons
options:0
error:&jsonParseError];
//no json or unexpected json
if (nil == jsonObject || ![jsonObject isKindOfClass:[NSDictionary class]]) {
if (nil == jsonObject || ![(NSObject *)jsonObject isKindOfClass:[NSDictionary class]]) {
if (error) {
NSDictionary *userInfo = @{NSLocalizedDescriptionKey:BITHockeyLocalizedString(@"HockeyAuthenticationFailedAuthenticate")};
if (jsonParseError) {
Expand Down Expand Up @@ -718,7 +714,7 @@ + (NSString *)UDIDFromOpenURL:(NSURL *)url annotation:(id) __unused annotation {
//there should actually only one
static NSString *const UDIDQuerySpecifier = @"udid";
for (NSString *queryComponents in [query componentsSeparatedByString:@"&"]) {
NSArray *parameterComponents = [queryComponents componentsSeparatedByString:@"="];
NSArray<NSString *> *parameterComponents = [queryComponents componentsSeparatedByString:@"="];
if (2 == parameterComponents.count && [parameterComponents[0] isEqualToString:UDIDQuerySpecifier]) {
udid = parameterComponents[1];
break;
Expand All @@ -733,7 +729,7 @@ + (void)email:(NSString *__autoreleasing *)email andIUID:(NSString *__autoreleas
static NSString *const EmailQuerySpecifier = @"email";
static NSString *const IUIDQuerySpecifier = @"iuid";
for (NSString *queryComponents in [query componentsSeparatedByString:@"&"]) {
NSArray *parameterComponents = [queryComponents componentsSeparatedByString:@"="];
NSArray<NSString *> *parameterComponents = [queryComponents componentsSeparatedByString:@"="];
if (email && 2 == parameterComponents.count && [parameterComponents[0] isEqualToString:EmailQuerySpecifier]) {
*email = parameterComponents[1];
} else if (iuid && 2 == parameterComponents.count && [parameterComponents[0] isEqualToString:IUIDQuerySpecifier]) {
Expand Down Expand Up @@ -766,93 +762,6 @@ - (void)cleanupInternalStorage {
[self removeKeyFromKeychain:kBITAuthenticatorAuthTokenTypeKey];
}

- (void)processFullSizeImage {
#ifdef BIT_INTERNAL_DEBUG
NSString* path = [[NSBundle mainBundle] pathForResource:@"iTunesArtwork" ofType:@"png"];
#else
NSString *path = [[[NSBundle mainBundle] bundlePath] stringByAppendingString:@"/../iTunesArtwork"];
#endif

struct stat fs;
int fd = open([path UTF8String], O_RDONLY, 0);
if (fstat(fd, &fs) < 0) {
// File not found
close(fd);
return;
}

BITHockeyLogDebug(@"Processing full size image for possible authentication");

unsigned char *buffer, *source;
source = (unsigned char *)malloc((unsigned long)fs.st_size);
if (read(fd, source, (unsigned long)fs.st_size) != fs.st_size) {
close(fd);
// Couldn't read file
free(source);
return;
}

if ((fs.st_size < 20) || (memcmp(source, kBITPNGHeader, 8))) {
// Not a PNG
free(source);
return;
}

buffer = source + 8;

NSString *result = nil;
bit_uint32 length;
unsigned char *name;
unsigned char *data;
int chunk_index = 0;
long long bytes_left = fs.st_size - 8;
do {
memcpy(&length, buffer, 4);
length = ntohl(length);

buffer += 4;
name = (unsigned char *)malloc(5);
name[4] = 0;
memcpy(name, buffer, 4);

buffer += 4;
data = (unsigned char *)malloc(length + 1);

if (bytes_left >= length) {
memcpy(data, buffer, length);

buffer += length;
buffer += 4;
if (!strcmp((const char *)name, "tEXt")) {
data[length] = 0;
NSString *key = [NSString stringWithCString:(char *)data encoding:NSUTF8StringEncoding];

if ([key isEqualToString:@"Data"]) {
result = [NSString stringWithCString:(char *)(data + key.length + 1) encoding:NSUTF8StringEncoding];
}
}

if (!memcmp(name, kBITPNGEndChunk, 4)) {
chunk_index = 128;
}
}

free(data);
free(name);

bytes_left -= (length + 3 * 4);
} while ((chunk_index++ < 128) && (bytes_left > 8));

free(source);

if (result) {
BITHockeyLogDebug(@"Authenticating using full size image information: %@", result);
[self handleOpenURL:[NSURL URLWithString:result] sourceApplication:nil annotation:nil];
} else {
BITHockeyLogDebug(@"No authentication information found");
}
}

#pragma mark - NSNotification

- (void)registerObservers {
Expand Down
3 changes: 0 additions & 3 deletions Classes/BITCrashCXXExceptionHandler.mm
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,6 @@ static inline void BITCrashIterateExceptionHandlers_unlocked(const BITCrashUncau
}
}

#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
static void BITCrashUncaughtCXXTerminateHandler(void)
{
BITCrashUncaughtCXXExceptionInfo info = {
Expand Down Expand Up @@ -240,7 +238,6 @@ + (void)removeCXXExceptionHandler:(BITCrashUncaughtCXXExceptionHandler)handler
}
} OSSpinLockUnlock(&_BITCrashCXXExceptionHandlingLock);
}
#pragma clang diagnostic pop

@end

Expand Down
Loading

0 comments on commit 4fb5b47

Please sign in to comment.