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 #460 from bitstadium/fix/some-cleanup
Browse files Browse the repository at this point in the history
Fix/some cleanup
  • Loading branch information
Benjamin Scholtysik (Reimold) authored Sep 15, 2017
2 parents a16ddd3 + 3ba7117 commit 146146b
Show file tree
Hide file tree
Showing 8 changed files with 44 additions and 100 deletions.
7 changes: 1 addition & 6 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,10 @@ env:
- CONFIGURATION="DEBUG"

matrix:
- SCHEME="HockeySDK" DESTINATION="OS=8.1,name=iPad Air" RUN_TESTS="YES"
- SCHEME="HockeySDK" DESTINATION="OS=8.2,name=iPhone 6 Plus" RUN_TESTS="YES"
- SCHEME="HockeySDK" DESTINATION="OS=8.3,name=iPad 2" RUN_TESTS="YES"
- SCHEME="HockeySDK" DESTINATION="OS=8.4,name=iPhone 4s" RUN_TESTS="YES"
- SCHEME="HockeySDK" DESTINATION="OS=9.0,name=iPad Air" RUN_TESTS="YES"
- SCHEME="HockeySDK" DESTINATION="OS=9.1,name=iPhone 6 Plus" RUN_TESTS="YES"
- SCHEME="HockeySDK" DESTINATION="OS=10.2,name=iPad Pro (9.7-inch)" RUN_TESTS="YES"
- SCHEME="HockeySDK" DESTINATION="OS=10.3.1,name=iPhone 6s" RUN_TESTS="YES"
- SCHEME="HockeySDK Framework" DESTINATION="platform=iOS Simulator,OS=10.3.1,name=iPhone 6" RUN_TESTS="YES"
- SCHEME="HockeySDK Framework" DESTINATION="platform=iOS Simulator,OS=10.3.3,name=iPhone 6" RUN_TESTS="YES"
- SCHEME="HockeySDK Distribution" RUN_TESTS="NO" LINT="YES"

before_install:
Expand Down
4 changes: 0 additions & 4 deletions Classes/BITAppStoreHeader.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,6 @@

#import <UIKit/UIKit.h>

#ifndef __IPHONE_6_1
#define __IPHONE_6_1 60100
#endif

@interface BITAppStoreHeader : UIView

@property (nonatomic, copy) NSString *headerText;
Expand Down
104 changes: 41 additions & 63 deletions Classes/BITFeedbackComposeViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -151,13 +151,7 @@ - (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
BOOL isPortraitOrientation = isPortraitOrientation = UIInterfaceOrientationIsPortrait([[UIApplication sharedApplication] statusBarOrientation]);

CGRect frame = CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height);
if (UI_USER_INTERFACE_IDIOM() != UIUserInterfaceIdiomPad) {
Expand Down Expand Up @@ -238,7 +232,7 @@ - (void)viewDidLoad {
if([BITHockeyHelper isPhotoAccessPossible]) {
self.textAccessoryView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, CGRectGetWidth(self.view.frame), 44)];
self.textAccessoryView.backgroundColor = [UIColor colorWithRed:(CGFloat)0.9 green:(CGFloat)0.9 blue:(CGFloat)0.9 alpha:(CGFloat)1.0];

self.addPhotoButton = [UIButton buttonWithType:UIButtonTypeCustom];
[self.addPhotoButton setTitle:BITHockeyLocalizedString(@"HockeyFeedbackComposeAttachmentAddImage") forState:UIControlStateNormal];
[self.addPhotoButton setTitleColor:[UIColor darkGrayColor] forState:UIControlStateNormal];
Expand Down Expand Up @@ -546,64 +540,48 @@ - (void)imageButtonAction:(UIButton *)sender {
NSInteger index = [self.attachmentScrollViewImageViews indexOfObject:sender];

self.selectedAttachmentIndex = (self.attachmentScrollViewImageViews.count - index - 1);
/* We won't use this for now until we have a more robust solution for displaying UIAlertController
// requires iOS 8
id uialertcontrollerClass = NSClassFromString(@"UIAlertController");
if (uialertcontrollerClass) {
__weak typeof(self) weakSelf = self;
UIAlertController *alertController = [UIAlertController alertControllerWithTitle:nil
message:nil
preferredStyle:UIAlertControllerStyleActionSheet];
UIAlertAction *cancelAction = [UIAlertAction actionWithTitle:BITHockeyLocalizedString(@"HockeyFeedbackComposeAttachmentCancel")
style:UIAlertActionStyleCancel
handler:^(UIAlertAction * action) {
typeof(self) strongSelf = weakSelf;
[strongSelf cancelAction];
_actionSheetVisible = NO;
}];
[alertController addAction:cancelAction];
UIAlertAction *editAction = [UIAlertAction actionWithTitle:BITHockeyLocalizedString(@"HockeyFeedbackComposeAttachmentEdit")
style:UIAlertActionStyleDefault
handler:^(UIAlertAction * action) {
typeof(self) strongSelf = weakSelf;
[strongSelf editAction];
_actionSheetVisible = NO;
}];
[alertController addAction:editAction];
UIAlertAction *deleteAction = [UIAlertAction actionWithTitle:BITHockeyLocalizedString(@"HockeyFeedbackComposeAttachmentDelete")
style:UIAlertActionStyleDestructive
handler:^(UIAlertAction * action) {
typeof(self) strongSelf = weakSelf;
[strongSelf deleteAction];
_actionSheetVisible = NO;
}];
[alertController addAction:deleteAction];
[self presentViewController:alertController animated:YES completion:nil];
} else {
*/
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
UIActionSheet *actionSheet = [[UIActionSheet alloc] initWithTitle: nil
delegate: self
cancelButtonTitle: BITHockeyLocalizedString(@"HockeyFeedbackComposeAttachmentCancel")
destructiveButtonTitle: BITHockeyLocalizedString(@"HockeyFeedbackComposeAttachmentDelete")
otherButtonTitles: BITHockeyLocalizedString(@"HockeyFeedbackComposeAttachmentEdit"), nil];

[actionSheet showFromRect: sender.frame inView: self.attachmentScrollView animated: YES];
#pragma clang diagnostic push
/*}*/
__weak typeof(self) weakSelf = self;

UIAlertController *alertController = [UIAlertController alertControllerWithTitle:nil
message:nil
preferredStyle:UIAlertControllerStyleActionSheet];


UIAlertAction *cancelAction = [UIAlertAction actionWithTitle:BITHockeyLocalizedString(@"HockeyFeedbackComposeAttachmentCancel")
style:UIAlertActionStyleCancel
handler:^(UIAlertAction __unused *action) {
typeof(self) strongSelf = weakSelf;
[strongSelf cancelAction];
strongSelf.actionSheetVisible = NO;
}];

[alertController addAction:cancelAction];

UIAlertAction *editAction = [UIAlertAction actionWithTitle:BITHockeyLocalizedString(@"HockeyFeedbackComposeAttachmentEdit")
style:UIAlertActionStyleDefault
handler:^(UIAlertAction __unused *action) {
typeof(self) strongSelf = weakSelf;
[strongSelf editAction];
strongSelf.actionSheetVisible = NO;
}];

[alertController addAction:editAction];

UIAlertAction *deleteAction = [UIAlertAction actionWithTitle:BITHockeyLocalizedString(@"HockeyFeedbackComposeAttachmentDelete")
style:UIAlertActionStyleDestructive
handler:^(UIAlertAction __unused *action) {
typeof(self) strongSelf = weakSelf;
[strongSelf deleteAction];
strongSelf.actionSheetVisible = NO;
}];

[alertController addAction:deleteAction];

[self presentViewController:alertController animated:YES completion:nil];

self.actionSheetVisible = YES;
if ((UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) || ([[NSProcessInfo processInfo] respondsToSelector:@selector(isOperatingSystemAtLeastVersion:)] && [[NSProcessInfo processInfo] isOperatingSystemAtLeastVersion:(NSOperatingSystemVersion){9,0,0}])) {
if ((UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) || ([[NSProcessInfo processInfo] isOperatingSystemAtLeastVersion:(NSOperatingSystemVersion){9,0,0}])) {
[self.textView resignFirstResponder];
}
}
Expand Down
4 changes: 0 additions & 4 deletions Classes/BITFeedbackListViewCell.m
Original file line number Diff line number Diff line change
Expand Up @@ -170,11 +170,7 @@ - (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
4 changes: 2 additions & 2 deletions Classes/BITFeedbackManager.m
Original file line number Diff line number Diff line change
Expand Up @@ -1227,7 +1227,7 @@ - (void)requestLatestImageWithCompletionHandler:(BITLatestImageFetchCompletionBl
[self fetchLatestImageUsingPhotoLibraryWithCompletionHandler:completionHandler];
}

- (void)fetchLatestImageUsingPhotoLibraryWithCompletionHandler:(BITLatestImageFetchCompletionBlock)completionHandler NS_AVAILABLE_IOS(8_0) {
- (void)fetchLatestImageUsingPhotoLibraryWithCompletionHandler:(BITLatestImageFetchCompletionBlock)completionHandler {
// Safeguard in case the dev hasn't set the NSPhotoLibraryUsageDescription in their Info.plist
if (![self isiOS10PhotoPolicySet]) {return;}

Expand All @@ -1248,7 +1248,7 @@ - (void)fetchLatestImageUsingPhotoLibraryWithCompletionHandler:(BITLatestImageFe
}];
}

- (void)loadLatestImageAssetWithCompletionHandler:(BITLatestImageFetchCompletionBlock)completionHandler NS_AVAILABLE_IOS(8_0) {
- (void)loadLatestImageAssetWithCompletionHandler:(BITLatestImageFetchCompletionBlock)completionHandler {

// Safeguard in case the dev hasn't set the NSPhotoLibraryUsageDescription in their Info.plist
if (![self isiOS10PhotoPolicySet]) {return;}
Expand Down
4 changes: 0 additions & 4 deletions Classes/BITHockeyBaseManager.m
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,6 @@
#import <mach-o/dyld.h>
#import <mach-o/loader.h>

#ifndef __IPHONE_6_1
#define __IPHONE_6_1 60100
#endif

// We need BIT_UNUSED macro to make sure there aren't any warnings when building
// HockeySDK Distribution scheme. Since several configurations are build in this scheme
// and different features can be turned on and off we can't just use __unused attribute.
Expand Down
5 changes: 0 additions & 5 deletions Classes/BITStoreButton.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,6 @@
- (void)storeButtonFired:(BITStoreButton *)button;
@end


#ifndef __IPHONE_6_1
#define __IPHONE_6_1 60100
#endif

/**
* Button style depending on the iOS version
*/
Expand Down
12 changes: 0 additions & 12 deletions Classes/HockeySDKPrivate.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,6 @@ NSBundle *BITHockeyBundle(void);
NSString *BITHockeyLocalizedString(NSString *stringToken);
NSString *BITHockeyMD5(NSString *str);

#ifndef __IPHONE_8_0
#define __IPHONE_8_0 80000
#endif

#ifndef __IPHONE_11_0
#define __IPHONE_11_0 110000
#endif
Expand All @@ -96,14 +92,6 @@ NSString *BITHockeyMD5(NSString *str);

#endif /* TARGET_OS_SIMULATOR */

#if __IPHONE_OS_VERSION_MIN_REQUIRED > __IPHONE_6_1

#define kBITButtonTypeSystem UIButtonTypeSystem

#else

#define kBITButtonTypeSystem UIButtonTypeRoundedRect

#endif

#endif /* HockeySDK_HockeySDKPrivate_h */

0 comments on commit 146146b

Please sign in to comment.