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.6.2'
Browse files Browse the repository at this point in the history
  • Loading branch information
DerAndereAndi committed Nov 25, 2014
2 parents 8e06273 + de7a7c5 commit 336c2c6
Show file tree
Hide file tree
Showing 23 changed files with 208 additions and 93 deletions.
24 changes: 12 additions & 12 deletions Classes/BITAttributedLabel.m
Original file line number Diff line number Diff line change
Expand Up @@ -957,41 +957,41 @@ - (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event {
}

- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event {
if (self.activeLink) {
NSTextCheckingResult *activeLink = self.activeLink;
if (activeLink) {
UITouch *touch = [touches anyObject];
if (self.activeLink == [self linkAtPoint:[touch locationInView:self]]) {
[self setLinkActive:NO withTextCheckingResult:self.activeLink];
if (activeLink == [self linkAtPoint:[touch locationInView:self]]) {
[self setLinkActive:NO withTextCheckingResult:activeLink];

if (!self.delegate) {
return;
}

NSTextCheckingResult *result = self.activeLink;
switch (result.resultType) {
switch (activeLink.resultType) {
case NSTextCheckingTypeLink:
if ([self.delegate respondsToSelector:@selector(attributedLabel:didSelectLinkWithURL:)]) {
[self.delegate attributedLabel:self didSelectLinkWithURL:result.URL];
[self.delegate attributedLabel:self didSelectLinkWithURL:activeLink.URL];
return;
}
break;
case NSTextCheckingTypeAddress:
if ([self.delegate respondsToSelector:@selector(attributedLabel:didSelectLinkWithAddress:)]) {
[self.delegate attributedLabel:self didSelectLinkWithAddress:result.addressComponents];
[self.delegate attributedLabel:self didSelectLinkWithAddress:activeLink.addressComponents];
return;
}
break;
case NSTextCheckingTypePhoneNumber:
if ([self.delegate respondsToSelector:@selector(attributedLabel:didSelectLinkWithPhoneNumber:)]) {
[self.delegate attributedLabel:self didSelectLinkWithPhoneNumber:result.phoneNumber];
[self.delegate attributedLabel:self didSelectLinkWithPhoneNumber:activeLink.phoneNumber];
return;
}
break;
case NSTextCheckingTypeDate:
if (result.timeZone && [self.delegate respondsToSelector:@selector(attributedLabel:didSelectLinkWithDate:timeZone:duration:)]) {
[self.delegate attributedLabel:self didSelectLinkWithDate:result.date timeZone:result.timeZone duration:result.duration];
if (activeLink.timeZone && [self.delegate respondsToSelector:@selector(attributedLabel:didSelectLinkWithDate:timeZone:duration:)]) {
[self.delegate attributedLabel:self didSelectLinkWithDate:activeLink.date timeZone:activeLink.timeZone duration:activeLink.duration];
return;
} else if ([self.delegate respondsToSelector:@selector(attributedLabel:didSelectLinkWithDate:)]) {
[self.delegate attributedLabel:self didSelectLinkWithDate:result.date];
[self.delegate attributedLabel:self didSelectLinkWithDate:activeLink.date];
return;
}
break;
Expand All @@ -1001,7 +1001,7 @@ - (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event {

// Fallback to `attributedLabel:didSelectLinkWithTextCheckingResult:` if no other delegate method matched.
if ([self.delegate respondsToSelector:@selector(attributedLabel:didSelectLinkWithTextCheckingResult:)]) {
[self.delegate attributedLabel:self didSelectLinkWithTextCheckingResult:result];
[self.delegate attributedLabel:self didSelectLinkWithTextCheckingResult:activeLink];
}
}
} else {
Expand Down
54 changes: 27 additions & 27 deletions Classes/BITCrashManager.m
Original file line number Diff line number Diff line change
Expand Up @@ -197,19 +197,19 @@ - (void)setCrashManagerStatus:(BITCrashManagerStatus)crashManagerStatus {
* This saves the list of approved crash reports
*/
- (void)saveSettings {
NSString *errorString = nil;
NSError *error = nil;

NSMutableDictionary *rootObj = [NSMutableDictionary dictionaryWithCapacity:2];
if (_approvedCrashReports && [_approvedCrashReports count] > 0) {
[rootObj setObject:_approvedCrashReports forKey:kBITCrashApprovedReports];
}
NSData *plist = [NSPropertyListSerialization dataFromPropertyList:(id)rootObj
format:NSPropertyListBinaryFormat_v1_0
errorDescription:&errorString];

NSData *plist = [NSPropertyListSerialization dataWithPropertyList:(id)rootObj format:NSPropertyListBinaryFormat_v1_0 options:0 error:&error];

if (plist) {
[plist writeToFile:_settingsFile atomically:YES];
} else {
BITHockeyLog(@"ERROR: Writing settings. %@", errorString);
BITHockeyLog(@"ERROR: Writing settings. %@", [error description]);
}
}

Expand All @@ -219,7 +219,7 @@ - (void)saveSettings {
* This contains the list of approved crash reports
*/
- (void)loadSettings {
NSString *errorString = nil;
NSError *error = nil;
NSPropertyListFormat format;

if (![_fileManager fileExistsAtPath:_settingsFile])
Expand All @@ -228,10 +228,10 @@ - (void)loadSettings {
NSData *plist = [NSData dataWithContentsOfFile:_settingsFile];
if (plist) {
NSDictionary *rootObj = (NSDictionary *)[NSPropertyListSerialization
propertyListFromData:plist
mutabilityOption:NSPropertyListMutableContainersAndLeaves
propertyListWithData:plist
options:NSPropertyListMutableContainersAndLeaves
format:&format
errorDescription:&errorString];
error:&error];

if ([rootObj objectForKey:kBITCrashApprovedReports])
[_approvedCrashReports setDictionary:[rootObj objectForKey:kBITCrashApprovedReports]];
Expand Down Expand Up @@ -689,7 +689,6 @@ - (void)storeMetaDataForCrashReportFilename:(NSString *)filename {
NSError *error = NULL;
NSMutableDictionary *metaDict = [NSMutableDictionary dictionaryWithCapacity:4];
NSString *applicationLog = @"";
NSString *errorString = nil;

[self addStringValueToKeychain:[self userNameForCrashReport] forKey:[NSString stringWithFormat:@"%@.%@", filename, kBITCrashMetaUserName]];
[self addStringValueToKeychain:[self userEmailForCrashReport] forKey:[NSString stringWithFormat:@"%@.%@", filename, kBITCrashMetaUserEmail]];
Expand All @@ -708,9 +707,10 @@ - (void)storeMetaDataForCrashReportFilename:(NSString *)filename {
}
}

NSData *plist = [NSPropertyListSerialization dataFromPropertyList:(id)metaDict
NSData *plist = [NSPropertyListSerialization dataWithPropertyList:(id)metaDict
format:NSPropertyListBinaryFormat_v1_0
errorDescription:&errorString];
options:0
error:&error];
if (plist) {
[plist writeToFile:[_crashesDir stringByAppendingPathComponent: [filename stringByAppendingPathExtension:@"meta"]] atomically:YES];
} else {
Expand Down Expand Up @@ -1173,7 +1173,7 @@ - (void)createCrashReportForAppKill {

NSString *fakeReportFilename = [NSString stringWithFormat: @"%.0f", [NSDate timeIntervalSinceReferenceDate]];

NSString *errorString = nil;
NSError *error = nil;

NSMutableDictionary *rootObj = [NSMutableDictionary dictionaryWithCapacity:2];
[rootObj setObject:fakeReportUUID forKey:kBITFakeCrashUUID];
Expand All @@ -1196,15 +1196,16 @@ - (void)createCrashReportForAppKill {
appBuild:fakeReportAppVersion
];

NSData *plist = [NSPropertyListSerialization dataFromPropertyList:(id)rootObj
NSData *plist = [NSPropertyListSerialization dataWithPropertyList:(id)rootObj
format:NSPropertyListBinaryFormat_v1_0
errorDescription:&errorString];
options:0
error:&error];
if (plist) {
if ([plist writeToFile:[_crashesDir stringByAppendingPathComponent:[fakeReportFilename stringByAppendingPathExtension:@"fake"]] atomically:YES]) {
[self storeMetaDataForCrashReportFilename:fakeReportFilename];
}
} else {
BITHockeyLog(@"ERROR: Writing fake crash report. %@", errorString);
BITHockeyLog(@"ERROR: Writing fake crash report. %@", [error description]);
}
}

Expand Down Expand Up @@ -1240,15 +1241,14 @@ - (void)sendNextCrashReport {
NSString *appBinaryUUIDs = nil;
NSString *metaFilename = nil;

NSString *errorString = nil;
NSPropertyListFormat format;

if ([[cacheFilename pathExtension] isEqualToString:@"fake"]) {
NSDictionary *fakeReportDict = (NSDictionary *)[NSPropertyListSerialization
propertyListFromData:crashData
mutabilityOption:NSPropertyListMutableContainersAndLeaves
propertyListWithData:crashData
options:NSPropertyListMutableContainersAndLeaves
format:&format
errorDescription:&errorString];
error:&error];

crashLogString = [fakeReportDict objectForKey:kBITFakeCrashReport];
crashUUID = [fakeReportDict objectForKey:kBITFakeCrashUUID];
Expand Down Expand Up @@ -1307,10 +1307,10 @@ - (void)sendNextCrashReport {
NSData *plist = [NSData dataWithContentsOfFile:[_crashesDir stringByAppendingPathComponent:metaFilename]];
if (plist) {
NSDictionary *metaDict = (NSDictionary *)[NSPropertyListSerialization
propertyListFromData:plist
mutabilityOption:NSPropertyListMutableContainersAndLeaves
propertyListWithData:plist
options:NSPropertyListMutableContainersAndLeaves
format:&format
errorDescription:&errorString];
error:&error];

username = [self stringValueFromKeychainForKey:[NSString stringWithFormat:@"%@.%@", cacheFilename, kBITCrashMetaUserName]] ?: @"";
useremail = [self stringValueFromKeychainForKey:[NSString stringWithFormat:@"%@.%@", cacheFilename, kBITCrashMetaUserEmail]] ?: @"";
Expand All @@ -1330,7 +1330,7 @@ - (void)sendNextCrashReport {
}
}

crashXML = [NSString stringWithFormat:@"<crashes><crash><applicationname>%@</applicationname><uuids>%@</uuids><bundleidentifier>%@</bundleidentifier><systemversion>%@</systemversion><platform>%@</platform><senderversion>%@</senderversion><version>%@</version><uuid>%@</uuid><log><![CDATA[%@]]></log><userid>%@</userid><username>%@</username><contact>%@</contact><installstring>%@</installstring><description><![CDATA[%@]]></description></crash></crashes>",
crashXML = [NSString stringWithFormat:@"<crashes><crash><applicationname><![CDATA[%@]]></applicationname><uuids>%@</uuids><bundleidentifier>%@</bundleidentifier><systemversion>%@</systemversion><platform>%@</platform><senderversion>%@</senderversion><version>%@</version><uuid>%@</uuid><log><![CDATA[%@]]></log><userid>%@</userid><username>%@</username><contact>%@</contact><installstring>%@</installstring><description><![CDATA[%@]]></description></crash></crashes>",
[[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleExecutable"],
appBinaryUUIDs,
appBundleIdentifier,
Expand Down Expand Up @@ -1468,10 +1468,10 @@ - (void)sendCrashReportWithFilename:(NSString *)filename xml:(NSString*)xml atta
[strongSelf cleanCrashReportWithFilename:filename];

// HockeyApp uses PList XML format
NSMutableDictionary *response = [NSPropertyListSerialization propertyListFromData:responseData
mutabilityOption:NSPropertyListMutableContainersAndLeaves
NSMutableDictionary *response = [NSPropertyListSerialization propertyListWithData:responseData
options:NSPropertyListMutableContainersAndLeaves
format:nil
errorDescription:NULL];
error:&error];
BITHockeyLog(@"INFO: Received API response: %@", response);

if (strongSelf.delegate != nil &&
Expand Down
9 changes: 7 additions & 2 deletions Classes/BITCrashReportTextFormatter.m
Original file line number Diff line number Diff line change
Expand Up @@ -539,8 +539,13 @@ + (NSString *)stringValueForCrashReport:(BITPLCrashReport *)report crashReporter
NSString *imagePath = [imageInfo.imageName stringByStandardizingPath];
NSString *appBundleContentsPath = [[report.processInfo.processPath stringByDeletingLastPathComponent] stringByDeletingLastPathComponent];

if ([imagePath isEqual: report.processInfo.processPath] || [imagePath hasPrefix:appBundleContentsPath])
binaryDesignator = @"+";
// exclude iOS swift dylibs
if ([imageInfo.imageName rangeOfString:@".app/Frameworks/libswift"].location == NSNotFound) {
if ([imagePath isEqual: report.processInfo.processPath] ||
[imagePath hasPrefix:appBundleContentsPath] ||
[imageInfo.imageName hasPrefix:appBundleContentsPath]) // Fix issue with iOS 8 `stringByStandardizingPath` removing leading `/private` path (when not running in the debugger only)
binaryDesignator = @"+";
}

/* base_address - terminating_address [designator]file_name arch <uuid> file_path */
NSString *fmt = nil;
Expand Down
14 changes: 11 additions & 3 deletions Classes/BITFeedbackComposeViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -144,9 +144,17 @@ - (void)keyboardWasShown:(NSNotification*)aNotification {
NSDictionary* info = [aNotification userInfo];
CGSize kbSize = [[info objectForKey:UIKeyboardFrameBeginUserInfoKey] CGRectValue].size;

BOOL isPortraitOrientation = NO;

#if __IPHONE_OS_VERSION_MIN_REQUIRED >= __IPHONE_8_0
isPortraitOrientation = UIInterfaceOrientationIsPortrait([[UIApplication sharedApplication] statusBarOrientation]);
#else
isPortraitOrientation = UIInterfaceOrientationIsPortrait(self.interfaceOrientation);
#endif

CGRect frame = CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height);
if (UI_USER_INTERFACE_IDIOM() != UIUserInterfaceIdiomPad) {
if (!bit_isPreiOS8Environment() || UIInterfaceOrientationIsPortrait(self.interfaceOrientation)) {
if (!bit_isPreiOS8Environment() || isPortraitOrientation) {
frame.size.height -= kbSize.height;
} else {
frame.size.height -= kbSize.width;
Expand All @@ -156,7 +164,7 @@ - (void)keyboardWasShown:(NSNotification*)aNotification {
CGFloat windowHeight = windowSize.height - 20;
CGFloat navBarHeight = self.navigationController.navigationBar.frame.size.height;

if (!bit_isPreiOS8Environment() || UIInterfaceOrientationIsPortrait(self.interfaceOrientation)) {
if (!bit_isPreiOS8Environment() || isPortraitOrientation) {
CGFloat modalGap = (windowHeight - self.view.bounds.size.height) / 2;
frame.size.height = windowHeight - navBarHeight - kbSize.height;
if (bit_isPreiOS8Environment()) {
Expand Down Expand Up @@ -261,7 +269,7 @@ - (void)viewWillAppear:(BOOL)animated {
[[UIApplication sharedApplication] setStatusBarStyle:(self.navigationController.navigationBar.barStyle == UIBarStyleDefault) ? UIStatusBarStyleDefault : UIStatusBarStyleBlackOpaque];
#endif

if (_text) {
if (_text && self.textView.text.length == 0) {
self.textView.text = _text;
}

Expand Down
5 changes: 5 additions & 0 deletions Classes/BITFeedbackListViewCell.m
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,12 @@ - (UIColor *)backgroundColor {
- (BOOL)isSameDayWithDate1:(NSDate*)date1 date2:(NSDate*)date2 {
NSCalendar* calendar = [NSCalendar currentCalendar];

#if __IPHONE_OS_VERSION_MIN_REQUIRED >= __IPHONE_8_0
unsigned unitFlags = NSCalendarUnitYear | NSCalendarUnitMonth | NSCalendarUnitDay;
#else
unsigned unitFlags = NSYearCalendarUnit | NSMonthCalendarUnit | NSDayCalendarUnit;
#endif

NSDateComponents *dateComponent1 = [calendar components:unitFlags fromDate:date1];
NSDateComponents *dateComponent2 = [calendar components:unitFlags fromDate:date2];

Expand Down
2 changes: 1 addition & 1 deletion Classes/BITFeedbackManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ typedef NS_ENUM(NSInteger, BITFeedbackObservationMode) {
*/
BITFeedbackObservationModeOnScreenshot = 1,
/**
* Triggers when the user taps with three fingers for three seconds on the screen.
* Triggers when the user taps with three fingers on the screen.
*/
BITFeedbackObservationModeThreeFingerTap = 2
};
Expand Down
9 changes: 7 additions & 2 deletions Classes/BITFeedbackManager.m
Original file line number Diff line number Diff line change
Expand Up @@ -1088,7 +1088,9 @@ - (void)setFeedbackObservationMode:(BITFeedbackObservationMode)feedbackObservati
self.tapRecognizer.delegate = self;

dispatch_async(dispatch_get_main_queue(), ^{
[[UIApplication sharedApplication].keyWindow addGestureRecognizer:self.tapRecognizer];
if (self.tapRecognizer) {
[[UIApplication sharedApplication].keyWindow addGestureRecognizer:self.tapRecognizer];
}
});
}

Expand All @@ -1103,7 +1105,10 @@ - (void)setFeedbackObservationMode:(BITFeedbackObservationMode)feedbackObservati
}

-(void)screenshotNotificationReceived:(NSNotification *)notification {
dispatch_async(dispatch_get_main_queue(), ^{
double amountOfSeconds = 0.5;
dispatch_time_t delayTime = dispatch_time(DISPATCH_TIME_NOW, (int64_t)(amountOfSeconds * NSEC_PER_SEC));

dispatch_after(delayTime, dispatch_get_main_queue(), ^{
[self extractLastPictureFromLibraryAndLaunchFeedback];
});
}
Expand Down
6 changes: 6 additions & 0 deletions Classes/BITHockeyBaseManager.m
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@

#import "BITHockeyBaseManager.h"
#import "BITHockeyBaseManagerPrivate.h"
#if HOCKEYSDK_FEATURE_AUTHENTICATOR || HOCKEYSDK_FEATURE_UPDATES || HOCKEYSDK_FEATURE_FEEDBACK
#import "BITHockeyBaseViewController.h"
#endif

#import "BITKeychainUtils.h"

Expand Down Expand Up @@ -199,6 +201,9 @@ - (UINavigationController *)customNavigationControllerWithRootViewController:(UI
}

- (void)showView:(UIViewController *)viewController {
// if we compile Crash only, then BITHockeyBaseViewController is not included
// in the headers and will cause a warning with the modulemap file
#if HOCKEYSDK_FEATURE_AUTHENTICATOR || HOCKEYSDK_FEATURE_UPDATES || HOCKEYSDK_FEATURE_FEEDBACK
UIViewController *parentViewController = nil;

if ([[BITHockeyManager sharedHockeyManager].delegate respondsToSelector:@selector(viewControllerForHockeyManager:componentManager:)]) {
Expand Down Expand Up @@ -259,6 +264,7 @@ - (void)showView:(UIViewController *)viewController {
[(BITHockeyBaseViewController *)viewController setModalAnimated:NO];
[visibleWindow addSubview:_navController.view];
}
#endif
}

- (BOOL)addStringValueToKeychain:(NSString *)stringValue forKey:(NSString *)key {
Expand Down
Loading

0 comments on commit 336c2c6

Please sign in to comment.