mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-23 06:35:51 +00:00
Fix iOS 9 warnings
- Require iOS 7 as base SDK (for compiling) - Hide deprecation message for NSURLConnection calls, these will be refactored soon - Remove statusbar adjustment code (which isn't needed any longer) - Remove kBITTextLabel... defines and use NSText.. instead - Remove a few `#if __IPHONE_OS_VERSION_MAX_ALLOWED > __IPHONE_6_1` since we require iOS 7 as base now (for real)
This commit is contained in:
@@ -34,7 +34,6 @@
|
|||||||
#import "BITHockeyAppClient.h"
|
#import "BITHockeyAppClient.h"
|
||||||
|
|
||||||
@interface BITAuthenticationViewController ()<UITextFieldDelegate> {
|
@interface BITAuthenticationViewController ()<UITextFieldDelegate> {
|
||||||
UIStatusBarStyle _statusBarStyle;
|
|
||||||
__weak UITextField *_emailField;
|
__weak UITextField *_emailField;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -66,24 +65,11 @@
|
|||||||
- (void)viewWillAppear:(BOOL)animated {
|
- (void)viewWillAppear:(BOOL)animated {
|
||||||
[super viewWillAppear:animated];
|
[super viewWillAppear:animated];
|
||||||
|
|
||||||
_statusBarStyle = [[UIApplication sharedApplication] statusBarStyle];
|
|
||||||
#if __IPHONE_OS_VERSION_MAX_ALLOWED > __IPHONE_6_1
|
|
||||||
[[UIApplication sharedApplication] setStatusBarStyle:(self.navigationController.navigationBar.barStyle == UIBarStyleDefault) ? UIStatusBarStyleDefault : UIStatusBarStyleLightContent];
|
|
||||||
#else
|
|
||||||
[[UIApplication sharedApplication] setStatusBarStyle:(self.navigationController.navigationBar.barStyle == UIBarStyleDefault) ? UIStatusBarStyleDefault : UIStatusBarStyleBlackOpaque];
|
|
||||||
#endif
|
|
||||||
|
|
||||||
[self updateBarButtons];
|
[self updateBarButtons];
|
||||||
|
|
||||||
self.navigationItem.rightBarButtonItem.enabled = [self allRequiredFieldsEntered];
|
self.navigationItem.rightBarButtonItem.enabled = [self allRequiredFieldsEntered];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)viewWillDisappear:(BOOL)animated {
|
|
||||||
[super viewWillDisappear:animated];
|
|
||||||
|
|
||||||
[[UIApplication sharedApplication] setStatusBarStyle:_statusBarStyle];
|
|
||||||
}
|
|
||||||
|
|
||||||
#pragma mark - Property overrides
|
#pragma mark - Property overrides
|
||||||
|
|
||||||
- (void) updateBarButtons {
|
- (void) updateBarButtons {
|
||||||
@@ -242,7 +228,7 @@
|
|||||||
textField.backgroundColor = [UIColor whiteColor];
|
textField.backgroundColor = [UIColor whiteColor];
|
||||||
textField.autocorrectionType = UITextAutocorrectionTypeNo;
|
textField.autocorrectionType = UITextAutocorrectionTypeNo;
|
||||||
textField.autocapitalizationType = UITextAutocapitalizationTypeNone;
|
textField.autocapitalizationType = UITextAutocapitalizationTypeNone;
|
||||||
textField.textAlignment = kBITTextLabelAlignmentLeft;
|
textField.textAlignment = NSTextAlignmentLeft;
|
||||||
textField.delegate = self;
|
textField.delegate = self;
|
||||||
textField.tag = indexPath.row;
|
textField.tag = indexPath.row;
|
||||||
|
|
||||||
|
|||||||
@@ -47,7 +47,6 @@
|
|||||||
|
|
||||||
|
|
||||||
@interface BITFeedbackComposeViewController () <BITFeedbackUserDataDelegate, UIImagePickerControllerDelegate, UINavigationControllerDelegate, UIActionSheetDelegate, BITImageAnnotationDelegate> {
|
@interface BITFeedbackComposeViewController () <BITFeedbackUserDataDelegate, UIImagePickerControllerDelegate, UINavigationControllerDelegate, UIActionSheetDelegate, BITImageAnnotationDelegate> {
|
||||||
UIStatusBarStyle _statusBarStyle;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@property (nonatomic, weak) BITFeedbackManager *manager;
|
@property (nonatomic, weak) BITFeedbackManager *manager;
|
||||||
@@ -275,19 +274,20 @@
|
|||||||
|
|
||||||
[super viewWillAppear:animated];
|
[super viewWillAppear:animated];
|
||||||
|
|
||||||
_statusBarStyle = [[UIApplication sharedApplication] statusBarStyle];
|
|
||||||
#if __IPHONE_OS_VERSION_MAX_ALLOWED > __IPHONE_6_1
|
|
||||||
[[UIApplication sharedApplication] setStatusBarStyle:(self.navigationController.navigationBar.barStyle == UIBarStyleDefault) ? UIStatusBarStyleDefault : UIStatusBarStyleLightContent];
|
|
||||||
#else
|
|
||||||
[[UIApplication sharedApplication] setStatusBarStyle:(self.navigationController.navigationBar.barStyle == UIBarStyleDefault) ? UIStatusBarStyleDefault : UIStatusBarStyleBlackOpaque];
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (_text && self.textView.text.length == 0) {
|
if (_text && self.textView.text.length == 0) {
|
||||||
self.textView.text = _text;
|
self.textView.text = _text;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (self.isStatusBarHiddenBeforeShowingPhotoPicker) {
|
if (self.isStatusBarHiddenBeforeShowingPhotoPicker) {
|
||||||
|
// requires iOS 7
|
||||||
|
if ([self respondsToSelector:@selector(prefersStatusBarHidden)]) {
|
||||||
|
[self setNeedsStatusBarAppearanceUpdate];
|
||||||
|
} else {
|
||||||
|
#pragma clang diagnostic push
|
||||||
|
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
|
||||||
[[UIApplication sharedApplication] setStatusBarHidden:self.isStatusBarHiddenBeforeShowingPhotoPicker.boolValue];
|
[[UIApplication sharedApplication] setStatusBarHidden:self.isStatusBarHiddenBeforeShowingPhotoPicker.boolValue];
|
||||||
|
#pragma clang diagnostic pop
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
self.isStatusBarHiddenBeforeShowingPhotoPicker = nil;
|
self.isStatusBarHiddenBeforeShowingPhotoPicker = nil;
|
||||||
@@ -295,6 +295,14 @@
|
|||||||
[self updateBarButtonState];
|
[self updateBarButtonState];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (BOOL)prefersStatusBarHidden {
|
||||||
|
if (self.isStatusBarHiddenBeforeShowingPhotoPicker) {
|
||||||
|
return self.isStatusBarHiddenBeforeShowingPhotoPicker.boolValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
return [super prefersStatusBarHidden];
|
||||||
|
}
|
||||||
|
|
||||||
- (void)viewDidAppear:(BOOL)animated {
|
- (void)viewDidAppear:(BOOL)animated {
|
||||||
[super viewDidAppear:animated];
|
[super viewDidAppear:animated];
|
||||||
|
|
||||||
@@ -318,8 +326,6 @@
|
|||||||
self.manager.currentFeedbackComposeViewController = nil;
|
self.manager.currentFeedbackComposeViewController = nil;
|
||||||
|
|
||||||
[super viewWillDisappear:animated];
|
[super viewWillDisappear:animated];
|
||||||
|
|
||||||
[[UIApplication sharedApplication] setStatusBarStyle:_statusBarStyle];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)viewDidDisappear:(BOOL)animated {
|
- (void)viewDidDisappear:(BOOL)animated {
|
||||||
|
|||||||
@@ -110,7 +110,7 @@
|
|||||||
_labelText = [[BITAttributedLabel alloc] init];
|
_labelText = [[BITAttributedLabel alloc] init];
|
||||||
_labelText.font = [UIFont systemFontOfSize:TEXT_FONTSIZE];
|
_labelText.font = [UIFont systemFontOfSize:TEXT_FONTSIZE];
|
||||||
_labelText.numberOfLines = 0;
|
_labelText.numberOfLines = 0;
|
||||||
_labelText.textAlignment = kBITTextLabelAlignmentLeft;
|
_labelText.textAlignment = NSTextAlignmentLeft;
|
||||||
_labelText.dataDetectorTypes = UIDataDetectorTypeAll;
|
_labelText.dataDetectorTypes = UIDataDetectorTypeAll;
|
||||||
|
|
||||||
_attachmentViews = [NSMutableArray new];
|
_attachmentViews = [NSMutableArray new];
|
||||||
@@ -214,7 +214,6 @@
|
|||||||
+ (CGFloat) heightForTextInRowWithMessage:(BITFeedbackMessage *)message tableViewWidth:(CGFloat)width {
|
+ (CGFloat) heightForTextInRowWithMessage:(BITFeedbackMessage *)message tableViewWidth:(CGFloat)width {
|
||||||
CGFloat calculatedHeight;
|
CGFloat calculatedHeight;
|
||||||
|
|
||||||
#if __IPHONE_OS_VERSION_MAX_ALLOWED > __IPHONE_6_1
|
|
||||||
if ([message.text respondsToSelector:@selector(boundingRectWithSize:options:attributes:context:)]) {
|
if ([message.text respondsToSelector:@selector(boundingRectWithSize:options:attributes:context:)]) {
|
||||||
CGRect calculatedRect = [message.text boundingRectWithSize:CGSizeMake(width - (2 * FRAME_SIDE_BORDER), CGFLOAT_MAX)
|
CGRect calculatedRect = [message.text boundingRectWithSize:CGSizeMake(width - (2 * FRAME_SIDE_BORDER), CGFLOAT_MAX)
|
||||||
options:NSStringDrawingUsesLineFragmentOrigin | NSStringDrawingUsesFontLeading
|
options:NSStringDrawingUsesLineFragmentOrigin | NSStringDrawingUsesFontLeading
|
||||||
@@ -226,7 +225,6 @@
|
|||||||
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
#endif
|
|
||||||
#pragma clang diagnostic push
|
#pragma clang diagnostic push
|
||||||
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
|
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
|
||||||
calculatedHeight = [message.text sizeWithFont:[UIFont systemFontOfSize:TEXT_FONTSIZE]
|
calculatedHeight = [message.text sizeWithFont:[UIFont systemFontOfSize:TEXT_FONTSIZE]
|
||||||
@@ -234,9 +232,7 @@
|
|||||||
].height + FRAME_TOP_BORDER + LABEL_TEXT_Y + FRAME_BOTTOM_BORDER;
|
].height + FRAME_TOP_BORDER + LABEL_TEXT_Y + FRAME_BOTTOM_BORDER;
|
||||||
|
|
||||||
#pragma clang diagnostic pop
|
#pragma clang diagnostic pop
|
||||||
#if __IPHONE_OS_VERSION_MAX_ALLOWED > __IPHONE_6_1
|
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
return ceil(calculatedHeight);
|
return ceil(calculatedHeight);
|
||||||
}
|
}
|
||||||
@@ -312,11 +308,11 @@
|
|||||||
[self.labelTitle setFrame:CGRectMake(FRAME_SIDE_BORDER, FRAME_TOP_BORDER + LABEL_TITLE_Y, self.frame.size.width - (2 * FRAME_SIDE_BORDER), LABEL_TITLE_HEIGHT)];
|
[self.labelTitle setFrame:CGRectMake(FRAME_SIDE_BORDER, FRAME_TOP_BORDER + LABEL_TITLE_Y, self.frame.size.width - (2 * FRAME_SIDE_BORDER), LABEL_TITLE_HEIGHT)];
|
||||||
|
|
||||||
if (_message.userMessage) {
|
if (_message.userMessage) {
|
||||||
self.labelTitle.textAlignment = kBITTextLabelAlignmentRight;
|
self.labelTitle.textAlignment = NSTextAlignmentRight;
|
||||||
self.labelText.textAlignment = kBITTextLabelAlignmentRight;
|
self.labelText.textAlignment = NSTextAlignmentRight;
|
||||||
} else {
|
} else {
|
||||||
self.labelTitle.textAlignment = kBITTextLabelAlignmentLeft;
|
self.labelTitle.textAlignment = NSTextAlignmentLeft;
|
||||||
self.labelText.textAlignment = kBITTextLabelAlignmentLeft;
|
self.labelText.textAlignment = NSTextAlignmentLeft;
|
||||||
}
|
}
|
||||||
|
|
||||||
[self addSubview:self.labelTitle];
|
[self addSubview:self.labelTitle];
|
||||||
|
|||||||
@@ -494,7 +494,7 @@
|
|||||||
cell.textLabel.textColor = DEFAULT_TEXTCOLOR;
|
cell.textLabel.textColor = DEFAULT_TEXTCOLOR;
|
||||||
cell.accessoryType = UITableViewCellAccessoryNone;
|
cell.accessoryType = UITableViewCellAccessoryNone;
|
||||||
cell.selectionStyle = UITableViewCellSelectionStyleNone;
|
cell.selectionStyle = UITableViewCellSelectionStyleNone;
|
||||||
cell.textLabel.textAlignment = kBITTextLabelAlignmentCenter;
|
cell.textLabel.textAlignment = NSTextAlignmentCenter;
|
||||||
}
|
}
|
||||||
|
|
||||||
cell.textLabel.text = [NSString stringWithFormat:BITHockeyLocalizedString(@"HockeyFeedbackListLastUpdated"),
|
cell.textLabel.text = [NSString stringWithFormat:BITHockeyLocalizedString(@"HockeyFeedbackListLastUpdated"),
|
||||||
@@ -619,7 +619,7 @@
|
|||||||
|
|
||||||
statusLabel.font = [UIFont systemFontOfSize:10];
|
statusLabel.font = [UIFont systemFontOfSize:10];
|
||||||
statusLabel.textColor = DEFAULT_TEXTCOLOR;
|
statusLabel.textColor = DEFAULT_TEXTCOLOR;
|
||||||
statusLabel.textAlignment = kBITTextLabelAlignmentCenter;
|
statusLabel.textAlignment = NSTextAlignmentCenter;
|
||||||
if ([self.manager isPreiOS7Environment]) {
|
if ([self.manager isPreiOS7Environment]) {
|
||||||
statusLabel.backgroundColor = DEFAULT_BACKGROUNDCOLOR;
|
statusLabel.backgroundColor = DEFAULT_BACKGROUNDCOLOR;
|
||||||
} else {
|
} else {
|
||||||
@@ -672,7 +672,10 @@
|
|||||||
if (attachment.needsLoadingFromURL && !attachment.isLoading){
|
if (attachment.needsLoadingFromURL && !attachment.isLoading){
|
||||||
attachment.isLoading = YES;
|
attachment.isLoading = YES;
|
||||||
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:attachment.sourceURL]];
|
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:attachment.sourceURL]];
|
||||||
|
#pragma clang diagnostic push
|
||||||
|
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
|
||||||
[NSURLConnection sendAsynchronousRequest:request queue:self.thumbnailQueue completionHandler:^(NSURLResponse *response, NSData *responseData, NSError *err) {
|
[NSURLConnection sendAsynchronousRequest:request queue:self.thumbnailQueue completionHandler:^(NSURLResponse *response, NSData *responseData, NSError *err) {
|
||||||
|
#pragma clang diagnostic pop
|
||||||
attachment.isLoading = NO;
|
attachment.isLoading = NO;
|
||||||
if (responseData.length) {
|
if (responseData.length) {
|
||||||
dispatch_async(dispatch_get_main_queue(), ^{
|
dispatch_async(dispatch_get_main_queue(), ^{
|
||||||
@@ -873,7 +876,10 @@
|
|||||||
if (attachment.needsLoadingFromURL && !attachment.isLoading) {
|
if (attachment.needsLoadingFromURL && !attachment.isLoading) {
|
||||||
attachment.isLoading = YES;
|
attachment.isLoading = YES;
|
||||||
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:attachment.sourceURL]];
|
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:attachment.sourceURL]];
|
||||||
|
#pragma clang diagnostic push
|
||||||
|
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
|
||||||
[NSURLConnection sendAsynchronousRequest:request queue:self.thumbnailQueue completionHandler:^(NSURLResponse *response, NSData *responseData, NSError *err) {
|
[NSURLConnection sendAsynchronousRequest:request queue:self.thumbnailQueue completionHandler:^(NSURLResponse *response, NSData *responseData, NSError *err) {
|
||||||
|
#pragma clang diagnostic pop
|
||||||
attachment.isLoading = NO;
|
attachment.isLoading = NO;
|
||||||
if (responseData.length) {
|
if (responseData.length) {
|
||||||
[attachment replaceData:responseData];
|
[attachment replaceData:responseData];
|
||||||
|
|||||||
@@ -921,7 +921,10 @@ NSString *const kBITFeedbackUpdateAttachmentThumbnail = @"BITFeedbackUpdateAttac
|
|||||||
[request setHTTPBody:postBody];
|
[request setHTTPBody:postBody];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#pragma clang diagnostic push
|
||||||
|
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
|
||||||
[NSURLConnection sendAsynchronousRequest:request queue:[NSOperationQueue mainQueue] completionHandler:^(NSURLResponse *response, NSData *responseData, NSError *err) {
|
[NSURLConnection sendAsynchronousRequest:request queue:[NSOperationQueue mainQueue] completionHandler:^(NSURLResponse *response, NSData *responseData, NSError *err) {
|
||||||
|
#pragma clang diagnostic pop
|
||||||
_networkRequestInProgress = NO;
|
_networkRequestInProgress = NO;
|
||||||
|
|
||||||
if (err) {
|
if (err) {
|
||||||
|
|||||||
@@ -38,7 +38,6 @@
|
|||||||
#import "BITFeedbackManagerPrivate.h"
|
#import "BITFeedbackManagerPrivate.h"
|
||||||
|
|
||||||
@interface BITFeedbackUserDataViewController () {
|
@interface BITFeedbackUserDataViewController () {
|
||||||
UIStatusBarStyle _statusBarStyle;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@property (nonatomic, weak) BITFeedbackManager *manager;
|
@property (nonatomic, weak) BITFeedbackManager *manager;
|
||||||
@@ -74,13 +73,6 @@
|
|||||||
- (void)viewWillAppear:(BOOL)animated {
|
- (void)viewWillAppear:(BOOL)animated {
|
||||||
[super viewWillAppear:animated];
|
[super viewWillAppear:animated];
|
||||||
|
|
||||||
_statusBarStyle = [[UIApplication sharedApplication] statusBarStyle];
|
|
||||||
#if __IPHONE_OS_VERSION_MAX_ALLOWED > __IPHONE_6_1
|
|
||||||
[[UIApplication sharedApplication] setStatusBarStyle:(self.navigationController.navigationBar.barStyle == UIBarStyleDefault) ? UIStatusBarStyleDefault : UIStatusBarStyleLightContent];
|
|
||||||
#else
|
|
||||||
[[UIApplication sharedApplication] setStatusBarStyle:(self.navigationController.navigationBar.barStyle == UIBarStyleDefault) ? UIStatusBarStyleDefault : UIStatusBarStyleBlackOpaque];
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// Do any additional setup after loading the view.
|
// Do any additional setup after loading the view.
|
||||||
self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemCancel
|
self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemCancel
|
||||||
target:self
|
target:self
|
||||||
@@ -101,12 +93,6 @@
|
|||||||
self.navigationItem.rightBarButtonItem.enabled = [self allRequiredFieldsEntered];
|
self.navigationItem.rightBarButtonItem.enabled = [self allRequiredFieldsEntered];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)viewWillDisappear:(BOOL)animated {
|
|
||||||
[super viewWillDisappear:animated];
|
|
||||||
|
|
||||||
[[UIApplication sharedApplication] setStatusBarStyle:_statusBarStyle];
|
|
||||||
}
|
|
||||||
|
|
||||||
#pragma mark - UIViewController Rotation
|
#pragma mark - UIViewController Rotation
|
||||||
|
|
||||||
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)orientation {
|
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)orientation {
|
||||||
@@ -227,7 +213,7 @@
|
|||||||
|
|
||||||
textField.backgroundColor = [UIColor whiteColor];
|
textField.backgroundColor = [UIColor whiteColor];
|
||||||
textField.autocorrectionType = UITextAutocorrectionTypeNo;
|
textField.autocorrectionType = UITextAutocorrectionTypeNo;
|
||||||
textField.textAlignment = kBITTextLabelAlignmentLeft;
|
textField.textAlignment = NSTextAlignmentLeft;
|
||||||
textField.delegate = self;
|
textField.delegate = self;
|
||||||
textField.tag = indexPath.row;
|
textField.tag = indexPath.row;
|
||||||
|
|
||||||
|
|||||||
@@ -77,9 +77,12 @@
|
|||||||
_isExecuting = YES;
|
_isExecuting = YES;
|
||||||
[self didChangeValueForKey:@"isExecuting"];
|
[self didChangeValueForKey:@"isExecuting"];
|
||||||
|
|
||||||
|
#pragma clang diagnostic push
|
||||||
|
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
|
||||||
_connection = [[NSURLConnection alloc] initWithRequest:_URLRequest
|
_connection = [[NSURLConnection alloc] initWithRequest:_URLRequest
|
||||||
delegate:self
|
delegate:self
|
||||||
startImmediately:YES];
|
startImmediately:YES];
|
||||||
|
#pragma clang diagnostic pop
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) finish {
|
- (void) finish {
|
||||||
|
|||||||
@@ -32,7 +32,6 @@
|
|||||||
|
|
||||||
@implementation BITHockeyBaseViewController {
|
@implementation BITHockeyBaseViewController {
|
||||||
BOOL _modal;
|
BOOL _modal;
|
||||||
UIStatusBarStyle _statusBarStyle;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -82,30 +81,6 @@
|
|||||||
} else {
|
} else {
|
||||||
[self.navigationController popViewControllerAnimated:YES];
|
[self.navigationController popViewControllerAnimated:YES];
|
||||||
}
|
}
|
||||||
|
|
||||||
[[UIApplication sharedApplication] setStatusBarStyle:_statusBarStyle];
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
- (void)viewWillAppear:(BOOL)animated {
|
|
||||||
[super viewWillAppear:animated];
|
|
||||||
|
|
||||||
_statusBarStyle = [[UIApplication sharedApplication] statusBarStyle];
|
|
||||||
if ([self.navigationController.navigationBar.tintColor isEqual:BIT_RGBCOLOR(25, 25, 25)]) {
|
|
||||||
#if __IPHONE_OS_VERSION_MAX_ALLOWED > __IPHONE_6_1
|
|
||||||
[[UIApplication sharedApplication] setStatusBarStyle:(self.navigationController.navigationBar.barStyle == UIBarStyleDefault) ? UIStatusBarStyleDefault : UIStatusBarStyleLightContent];
|
|
||||||
#else
|
|
||||||
[[UIApplication sharedApplication] setStatusBarStyle:(self.navigationController.navigationBar.barStyle == UIBarStyleDefault) ? UIStatusBarStyleDefault : UIStatusBarStyleBlackOpaque];
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void)viewWillDisappear:(BOOL)animated {
|
|
||||||
[super viewWillDisappear:animated];
|
|
||||||
|
|
||||||
if ([self.navigationController.navigationBar.tintColor isEqual:BIT_RGBCOLOR(25, 25, 25)]) {
|
|
||||||
[[UIApplication sharedApplication] setStatusBarStyle:_statusBarStyle];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -34,46 +34,52 @@
|
|||||||
#import <QuartzCore/QuartzCore.h>
|
#import <QuartzCore/QuartzCore.h>
|
||||||
|
|
||||||
|
|
||||||
#if __IPHONE_OS_VERSION_MAX_ALLOWED < 70000
|
|
||||||
@interface NSData (BITHockeySDKiOS7)
|
|
||||||
- (NSString *)base64Encoding;
|
|
||||||
@end
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
#pragma mark NSString helpers
|
#pragma mark NSString helpers
|
||||||
|
|
||||||
NSString *bit_URLEncodedString(NSString *inputString) {
|
NSString *bit_URLEncodedString(NSString *inputString) {
|
||||||
|
// Requires iOS 7
|
||||||
|
if ([inputString respondsToSelector:@selector(stringByAddingPercentEncodingWithAllowedCharacters:)]) {
|
||||||
|
NSCharacterSet *allowedSet = [NSCharacterSet characterSetWithCharactersInString:@"!*'();:@&=+$,/?%#[]"];
|
||||||
|
return [inputString stringByAddingPercentEncodingWithAllowedCharacters:allowedSet];
|
||||||
|
} else {
|
||||||
|
#pragma clang diagnostic push
|
||||||
|
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
|
||||||
return CFBridgingRelease(CFURLCreateStringByAddingPercentEscapes(kCFAllocatorDefault,
|
return CFBridgingRelease(CFURLCreateStringByAddingPercentEscapes(kCFAllocatorDefault,
|
||||||
(__bridge CFStringRef)inputString,
|
(__bridge CFStringRef)inputString,
|
||||||
NULL,
|
NULL,
|
||||||
CFSTR("!*'();:@&=+$,/?%#[]"),
|
CFSTR("!*'();:@&=+$,/?%#[]"),
|
||||||
kCFStringEncodingUTF8)
|
kCFStringEncodingUTF8)
|
||||||
);
|
);
|
||||||
|
#pragma clang diagnostic pop
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
NSString *bit_URLDecodedString(NSString *inputString) {
|
NSString *bit_URLDecodedString(NSString *inputString) {
|
||||||
|
// Requires iOS 7
|
||||||
|
if ([inputString respondsToSelector:@selector(stringByRemovingPercentEncoding)]) {
|
||||||
|
return [inputString stringByRemovingPercentEncoding];
|
||||||
|
} else {
|
||||||
|
#pragma clang diagnostic push
|
||||||
|
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
|
||||||
return CFBridgingRelease(CFURLCreateStringByReplacingPercentEscapesUsingEncoding(kCFAllocatorDefault,
|
return CFBridgingRelease(CFURLCreateStringByReplacingPercentEscapesUsingEncoding(kCFAllocatorDefault,
|
||||||
(__bridge CFStringRef)inputString,
|
(__bridge CFStringRef)inputString,
|
||||||
CFSTR(""),
|
CFSTR(""),
|
||||||
kCFStringEncodingUTF8)
|
kCFStringEncodingUTF8)
|
||||||
);
|
);
|
||||||
|
#pragma clang diagnostic pop
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
NSString *bit_base64String(NSData * data, unsigned long length) {
|
NSString *bit_base64String(NSData * data, unsigned long length) {
|
||||||
#if __IPHONE_OS_VERSION_MAX_ALLOWED > __IPHONE_6_1
|
|
||||||
SEL base64EncodingSelector = NSSelectorFromString(@"base64EncodedStringWithOptions:");
|
SEL base64EncodingSelector = NSSelectorFromString(@"base64EncodedStringWithOptions:");
|
||||||
if ([data respondsToSelector:base64EncodingSelector]) {
|
if ([data respondsToSelector:base64EncodingSelector]) {
|
||||||
return [data base64EncodedStringWithOptions:0];
|
return [data base64EncodedStringWithOptions:0];
|
||||||
} else {
|
} else {
|
||||||
#endif
|
|
||||||
#pragma clang diagnostic push
|
#pragma clang diagnostic push
|
||||||
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
|
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
|
||||||
return [data base64Encoding];
|
return [data base64Encoding];
|
||||||
#pragma clang diagnostic pop
|
#pragma clang diagnostic pop
|
||||||
#if __IPHONE_OS_VERSION_MAX_ALLOWED > __IPHONE_6_1
|
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
NSString *bit_settingsDir(void) {
|
NSString *bit_settingsDir(void) {
|
||||||
|
|||||||
@@ -221,7 +221,6 @@
|
|||||||
CGSize constr = (CGSize){.height = self.frame.size.height, .width = BIT_MAX_WIDTH};
|
CGSize constr = (CGSize){.height = self.frame.size.height, .width = BIT_MAX_WIDTH};
|
||||||
CGSize newSize;
|
CGSize newSize;
|
||||||
|
|
||||||
#if __IPHONE_OS_VERSION_MAX_ALLOWED > __IPHONE_6_1
|
|
||||||
if ([self.buttonData.label respondsToSelector:@selector(boundingRectWithSize:options:attributes:context:)]) {
|
if ([self.buttonData.label respondsToSelector:@selector(boundingRectWithSize:options:attributes:context:)]) {
|
||||||
CGRect calculatedRect = [self.buttonData.label boundingRectWithSize:constr
|
CGRect calculatedRect = [self.buttonData.label boundingRectWithSize:constr
|
||||||
options:NSStringDrawingUsesFontLeading
|
options:NSStringDrawingUsesFontLeading
|
||||||
@@ -229,16 +228,13 @@
|
|||||||
context:nil];
|
context:nil];
|
||||||
newSize = calculatedRect.size;
|
newSize = calculatedRect.size;
|
||||||
} else {
|
} else {
|
||||||
#endif
|
|
||||||
#pragma clang diagnostic push
|
#pragma clang diagnostic push
|
||||||
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
|
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
|
||||||
newSize = [self.buttonData.label sizeWithFont:self.titleLabel.font
|
newSize = [self.buttonData.label sizeWithFont:self.titleLabel.font
|
||||||
constrainedToSize:constr
|
constrainedToSize:constr
|
||||||
lineBreakMode:kBITLineBreakModeMiddleTruncation];
|
lineBreakMode:NSLineBreakByTruncatingMiddle];
|
||||||
#pragma clang diagnostic pop
|
#pragma clang diagnostic pop
|
||||||
#if __IPHONE_OS_VERSION_MAX_ALLOWED > __IPHONE_6_1
|
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
CGFloat newWidth = newSize.width + (BIT_PADDING * 2);
|
CGFloat newWidth = newSize.width + (BIT_PADDING * 2);
|
||||||
CGFloat newHeight = BIT_MIN_HEIGHT > newSize.height ? BIT_MIN_HEIGHT : newSize.height;
|
CGFloat newHeight = BIT_MIN_HEIGHT > newSize.height ? BIT_MIN_HEIGHT : newSize.height;
|
||||||
|
|||||||
@@ -352,7 +352,10 @@
|
|||||||
[request setHTTPMethod:@"GET"];
|
[request setHTTPMethod:@"GET"];
|
||||||
[request setValue:@"gzip" forHTTPHeaderField:@"Accept-Encoding"];
|
[request setValue:@"gzip" forHTTPHeaderField:@"Accept-Encoding"];
|
||||||
|
|
||||||
|
#pragma clang diagnostic push
|
||||||
|
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
|
||||||
[NSURLConnection sendAsynchronousRequest:request queue:[NSOperationQueue mainQueue] completionHandler:^(NSURLResponse *response, NSData *responseData, NSError *error){
|
[NSURLConnection sendAsynchronousRequest:request queue:[NSOperationQueue mainQueue] completionHandler:^(NSURLResponse *response, NSData *responseData, NSError *error){
|
||||||
|
#pragma clang diagnostic pop
|
||||||
self.checkInProgress = NO;
|
self.checkInProgress = NO;
|
||||||
|
|
||||||
if (error) {
|
if (error) {
|
||||||
|
|||||||
@@ -591,7 +591,7 @@ typedef NS_ENUM(NSInteger, BITUpdateAlertViewTag) {
|
|||||||
|
|
||||||
UILabel *label = [[UILabel alloc] initWithFrame:frame];
|
UILabel *label = [[UILabel alloc] initWithFrame:frame];
|
||||||
label.text = message;
|
label.text = message;
|
||||||
label.textAlignment = kBITTextLabelAlignmentCenter;
|
label.textAlignment = NSTextAlignmentCenter;
|
||||||
label.numberOfLines = 3;
|
label.numberOfLines = 3;
|
||||||
label.adjustsFontSizeToFitWidth = YES;
|
label.adjustsFontSizeToFitWidth = YES;
|
||||||
label.backgroundColor = [UIColor clearColor];
|
label.backgroundColor = [UIColor clearColor];
|
||||||
@@ -720,7 +720,10 @@ typedef NS_ENUM(NSInteger, BITUpdateAlertViewTag) {
|
|||||||
[request setValue:@"Hockey/iOS" forHTTPHeaderField:@"User-Agent"];
|
[request setValue:@"Hockey/iOS" forHTTPHeaderField:@"User-Agent"];
|
||||||
[request setValue:@"gzip" forHTTPHeaderField:@"Accept-Encoding"];
|
[request setValue:@"gzip" forHTTPHeaderField:@"Accept-Encoding"];
|
||||||
|
|
||||||
|
#pragma clang diagnostic push
|
||||||
|
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
|
||||||
self.urlConnection = [[NSURLConnection alloc] initWithRequest:request delegate:self];
|
self.urlConnection = [[NSURLConnection alloc] initWithRequest:request delegate:self];
|
||||||
|
#pragma clang diagnostic pop
|
||||||
if (!_urlConnection) {
|
if (!_urlConnection) {
|
||||||
self.checkInProgress = NO;
|
self.checkInProgress = NO;
|
||||||
[self reportError:[NSError errorWithDomain:kBITUpdateErrorDomain
|
[self reportError:[NSError errorWithDomain:kBITUpdateErrorDomain
|
||||||
|
|||||||
@@ -79,21 +79,6 @@ NSString *BITHockeyMD5(NSString *str);
|
|||||||
#define __IPHONE_8_0 80000
|
#define __IPHONE_8_0 80000
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef __IPHONE_6_0
|
|
||||||
|
|
||||||
#define kBITTextLabelAlignmentCenter NSTextAlignmentCenter
|
|
||||||
#define kBITTextLabelAlignmentLeft NSTextAlignmentLeft
|
|
||||||
#define kBITTextLabelAlignmentRight NSTextAlignmentRight
|
|
||||||
#define kBITLineBreakModeMiddleTruncation NSLineBreakByTruncatingMiddle
|
|
||||||
|
|
||||||
#else
|
|
||||||
|
|
||||||
#define kBITTextLabelAlignmentCenter UITextAlignmentCenter
|
|
||||||
#define kBITTextLabelAlignmentLeft UITextAlignmentLeft
|
|
||||||
#define kBITTextLabelAlignmentRight UITextAlignmentRight
|
|
||||||
#define kBITLineBreakModeMiddleTruncation UILineBreakModeMiddleTruncation
|
|
||||||
|
|
||||||
#endif /* __IPHONE_6_0 */
|
|
||||||
|
|
||||||
#if __IPHONE_OS_VERSION_MIN_REQUIRED > __IPHONE_6_1
|
#if __IPHONE_OS_VERSION_MIN_REQUIRED > __IPHONE_6_1
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user