iOS: fixed #929 (rotation issue on iPhone with Safari browser)

This was a curly one!  I also fixed a bunch of Xcode 8 warnings (for
non-third-party code; I'd like to fix the third-party ones to get to
zero warnings, but don't know how you feel about that).
This commit is contained in:
David Sinclair 2016-10-05 21:03:32 -07:00
parent c80bf86296
commit 27fbf12081
21 changed files with 70 additions and 40 deletions

View file

@ -63,7 +63,7 @@
if (self.fromStory && UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {
UIBarButtonItem *cancelButton = [[UIBarButtonItem alloc]
initWithTitle: @"Cancel"
style: UIBarButtonSystemItemCancel
style: UIBarButtonItemStylePlain
target: self
action: @selector(doCancelButton)];
self.navigationItem.leftBarButtonItem = cancelButton;

View file

@ -209,7 +209,7 @@ static UIFont *indicatorFont = nil;
} else if (cell.isRead) {
alpha = 0.34f;
}
[storyImageView.image drawInRect:imageFrame blendMode:Nil alpha:alpha];
[storyImageView.image drawInRect:imageFrame blendMode:0 alpha:alpha];
rect.size.width -= imageFrame.size.width;
}
}
@ -280,12 +280,12 @@ static UIFont *indicatorFont = nil;
int storyTitleX = leftMargin;
if (cell.isSaved) {
UIImage *savedIcon = [UIImage imageNamed:@"clock"];
[savedIcon drawInRect:CGRectMake(storyTitleX, storyTitleY - 1, 16, 16) blendMode:nil alpha:1];
[savedIcon drawInRect:CGRectMake(storyTitleX, storyTitleY - 1, 16, 16) blendMode:0 alpha:1];
storyTitleX += 20;
}
if (cell.isShared) {
UIImage *savedIcon = [UIImage imageNamed:@"menu_icn_share"];
[savedIcon drawInRect:CGRectMake(storyTitleX, storyTitleY - 1, 16, 16) blendMode:nil alpha:1];
[savedIcon drawInRect:CGRectMake(storyTitleX, storyTitleY - 1, 16, 16) blendMode:0 alpha:1];
storyTitleX += 20;
}
CGRect storyTitleFrame = CGRectMake(storyTitleX, storyTitleY,
@ -463,7 +463,7 @@ static UIFont *indicatorFont = nil;
unreadIcon = [UIImage imageNamed:@"g_icn_unread"];
}
[unreadIcon drawInRect:CGRectMake(15, storyIndicatorY - 3, 8, 8) blendMode:nil alpha:(cell.isRead ? .15 : 1)];
[unreadIcon drawInRect:CGRectMake(15, storyIndicatorY - 3, 8, 8) blendMode:0 alpha:(cell.isRead ? .15 : 1)];
}
@end

View file

@ -780,7 +780,7 @@
[offlineStories addObject:[NSJSONSerialization
JSONObjectWithData:[[story objectForKey:@"story_json"]
dataUsingEncoding:NSUTF8StringEncoding]
options:nil error:nil]];
options:0 error:nil]];
}
[cursor close];

View file

@ -39,7 +39,7 @@
// Do any additional setup after loading the view from its nib.
UIBarButtonItem *next = [[UIBarButtonItem alloc] initWithTitle:@"Skip this step" style:UIBarButtonSystemItemDone target:self action:@selector(tapNextButton)];
UIBarButtonItem *next = [[UIBarButtonItem alloc] initWithTitle:@"Skip this step" style:UIBarButtonItemStyleDone target:self action:@selector(tapNextButton)];
self.nextButton = next;
self.navigationItem.rightBarButtonItem = next;

View file

@ -29,7 +29,7 @@
// Do any additional setup after loading the view from its nib.
UIBarButtonItem *next = [[UIBarButtonItem alloc] initWithTitle:@"Start reading" style:UIBarButtonSystemItemDone target:self action:@selector(tapNextButton)];
UIBarButtonItem *next = [[UIBarButtonItem alloc] initWithTitle:@"Start reading" style:UIBarButtonItemStyleDone target:self action:@selector(tapNextButton)];
self.nextButton = next;
self.navigationItem.rightBarButtonItem = next;

View file

@ -53,7 +53,7 @@
// Do any additional setup after loading the view from its nib.
UIBarButtonItem *next = [[UIBarButtonItem alloc] initWithTitle:@"Next step" style:UIBarButtonSystemItemDone target:self action:@selector(tapNextButton)];
UIBarButtonItem *next = [[UIBarButtonItem alloc] initWithTitle:@"Next step" style:UIBarButtonItemStyleDone target:self action:@selector(tapNextButton)];
self.nextButton = next;
self.nextButton.enabled = YES;
self.navigationItem.rightBarButtonItem = next;
@ -443,7 +443,7 @@ didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
-(NSIndexPath *)tableView:(UITableView *)tableView willSelectRowAtIndexPath:(NSIndexPath *)indexPath {
UIView *header = [self.categoriesTable viewWithTag:indexPath.section];
UIButton *button = (UIButton *)[header viewWithTag:indexPath.section + 1000];
[button sendActionsForControlEvents:UIControlStateSelected];
[button sendActionsForControlEvents:UIControlEventTouchDragInside];
return indexPath;
}

View file

@ -51,7 +51,7 @@
// Do any additional setup after loading the view from its nib.
//
UIBarButtonItem *next = [[UIBarButtonItem alloc] initWithTitle:@"Get Started" style:UIBarButtonSystemItemDone target:self action:@selector(tapNextButton)];
UIBarButtonItem *next = [[UIBarButtonItem alloc] initWithTitle:@"Get Started" style:UIBarButtonItemStylePlain target:self action:@selector(tapNextButton)];
self.nextButton = next;
self.navigationItem.rightBarButtonItem = next;

View file

@ -48,7 +48,7 @@
self.navigationItem.title = @"Find Friends";
UIBarButtonItem *cancelButton = [[UIBarButtonItem alloc] initWithTitle: @"Done"
style: UIBarButtonSystemItemCancel
style: UIBarButtonItemStylePlain
target: self
action: @selector(doCancelButton)];
[self.navigationItem setRightBarButtonItem:cancelButton];
@ -415,4 +415,4 @@ viewForHeaderInSection:(NSInteger)section {
}
@end
@end

View file

@ -56,7 +56,6 @@
@property (readwrite) BOOL isHidingStory;
@property (readwrite) BOOL feedDetailIsVisible;
@property (readwrite) BOOL keyboardIsShown;
@property (readwrite) UIDeviceOrientation rotatingToOrientation;
@property (nonatomic) UIBackgroundTaskIdentifier reorientBackgroundTask;
@end
@ -204,7 +203,6 @@
[coordinator animateAlongsideTransition:^(id<UIViewControllerTransitionCoordinatorContext> _Nonnull context) {
UIInterfaceOrientation orientation = [UIApplication sharedApplication].statusBarOrientation;
self.rotatingToOrientation = orientation;
// leftBorder.frame = CGRectMake(0, 0, 1, CGRectGetHeight(self.view.bounds));
if (UIInterfaceOrientationIsPortrait(orientation) && !self.storyTitlesOnLeft) {

View file

@ -10,7 +10,7 @@
@interface NBLoadingCell : UITableViewCell
@property (nonatomic, readwrite) BOOL *animating;
@property (nonatomic, readwrite) BOOL animating;
- (void)animate;
- (void)endAnimation;

View file

@ -37,7 +37,7 @@
if (!self.window || !self.superview.window) return;
if (!animating) return;
self.backgroundColor = UIColorFromLightDarkRGB(0x5C89C9, 0x666666);
[UIView animateWithDuration:.650f delay:0.f options:nil animations:^{
[UIView animateWithDuration:.650f delay:0.f options:0 animations:^{
self.backgroundColor = UIColorFromLightDarkRGB(0xE1EBFF, 0x222222);
} completion:^(BOOL finished) {
[UIView animateWithDuration:1.05f animations:^{

View file

@ -423,7 +423,7 @@
user = [NSJSONSerialization
JSONObjectWithData:[[cursor stringForColumn:@"user_json"]
dataUsingEncoding:NSUTF8StringEncoding]
options:nil error:nil];
options:0 error:nil];
if (user) break;
}
[cursor close];
@ -742,7 +742,7 @@
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {
[self.masterContainerViewController transitionFromShareView];
[self.storyPageControl becomeFirstResponder];
} else {
} else if (!self.showingSafariViewController) {
[self.navigationController dismissViewControllerAnimated:YES completion:nil];
[self.shareViewController.commentField resignFirstResponder];
}
@ -1883,7 +1883,7 @@
[stories addObject:[NSJSONSerialization
JSONObjectWithData:[[story objectForKey:@"story_json"]
dataUsingEncoding:NSUTF8StringEncoding]
options:nil error:nil]];
options:0 error:nil]];
}
[cursor close];
@ -1979,7 +1979,7 @@
NSArray *feedIds = [request.userInfo objectForKey:@"feeds"];
NSDictionary *stories = [request.userInfo objectForKey:@"stories"];
[self markStoriesRead:stories inFeeds:feedIds cutoffTimestamp:nil];
[self markStoriesRead:stories inFeeds:feedIds cutoffTimestamp:0];
}
- (void)finishMarkAllAsRead:(ASIFormDataRequest *)request {

View file

@ -230,7 +230,7 @@ static UIFont *userLabelFont;
[super viewDidAppear:animated];
[self performSelector:@selector(fadeSelectedCell) withObject:self afterDelay:0.2];
// self.navigationController.navigationBar.backItem.title = @"All Sites";
[self layoutHeaderCounts:nil];
[self layoutHeaderCounts:0];
[self refreshHeaderCounts];
self.interactiveFeedDetailTransition = NO;
@ -766,7 +766,7 @@ static UIFont *userLabelFont;
self.intelligenceControl.hidden = NO;
[self showExplainerOnEmptyFeedlist];
[self layoutHeaderCounts:nil];
[self layoutHeaderCounts:0];
[self refreshHeaderCounts];
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad && finished) {
@ -830,7 +830,7 @@ static UIFont *userLabelFont;
results = [NSJSONSerialization
JSONObjectWithData:[[feedsCache objectForKey:@"feeds_json"]
dataUsingEncoding:NSUTF8StringEncoding]
options:nil error:nil];
options:0 error:nil];
break;
}
@ -1007,7 +1007,7 @@ static UIFont *userLabelFont;
barButton = self.settingsBarButton.customView;
[barButton setImage:[[ThemeManager themeManager] themedImage:[UIImage imageNamed:@"nav_icn_settings.png"]] forState:UIControlStateNormal];
[self layoutHeaderCounts:nil];
[self layoutHeaderCounts:0];
[self refreshHeaderCounts];
self.feedTitlesTable.backgroundColor = UIColorFromRGB(0xf4f4f4);
@ -1186,7 +1186,7 @@ static UIFont *userLabelFont;
// set the current row pointer
self.currentRowAtIndexPath = indexPath;
self.currentSection = nil;
self.currentSection = 0;
NSString *folderName;
if (indexPath.section == 0) {

View file

@ -187,7 +187,7 @@
paragraphStyle.lineBreakMode = bio.lineBreakMode;
CGSize expectedLabelSize = [bio.text
boundingRectWithSize:maximumLabelSize
options:nil
options:0
attributes:@{NSFontAttributeName: bio.font,
NSParagraphStyleAttributeName: paragraphStyle}
context:nil].size;
@ -411,4 +411,4 @@
NSLog(@"Error: %@", error);
[appDelegate informError:error];
}
@end
@end

View file

@ -53,14 +53,14 @@
UIBarButtonItem *cancel = [[UIBarButtonItem alloc]
initWithTitle:@"Cancel"
style:UIBarButtonSystemItemCancel
style:UIBarButtonItemStylePlain
target:self
action:@selector(doCancelButton:)];
self.navigationItem.leftBarButtonItem = cancel;
UIBarButtonItem *submit = [[UIBarButtonItem alloc]
initWithTitle:@"Post"
style:UIBarButtonSystemItemDone
style:UIBarButtonItemStyleDone
target:self
action:@selector(doShareThisStory:)];
self.submitButton = submit;

View file

@ -685,7 +685,7 @@
}
[newStory setValue:[NSNumber numberWithBool:saved] forKey:@"starred"];
if (saved && ![newStory objectForKey:@"starred_date"]) {
[newStory setObject:[Utilities formatLongDateFromTimestamp:nil] forKey:@"starred_date"];
[newStory setObject:[Utilities formatLongDateFromTimestamp:0] forKey:@"starred_date"];
appDelegate.savedStoriesCount += 1;
firstSaved = YES;
} else if (!saved) {

View file

@ -67,6 +67,8 @@ UIActionSheetDelegate> {
- (void)flashCheckmarkHud:(NSString *)messageType;
- (void)scrolltoComment;
- (void)tryScrollingDown:(BOOL)down;
- (void)scrollPageDown:(id)sender;
- (void)scrollPageUp:(id)sender;
- (void)changeWebViewWidth;
- (void)showUserProfile:(NSString *)userId xCoordinate:(int)x yCoordinate:(int)y width:(int)width height:(int)height;
- (void)checkTryFeedStory;
@ -98,7 +100,5 @@ UIActionSheetDelegate> {
- (void)showStoryView;
- (void)fetchTextView;
- (void)finishFetchTextView:(ASIHTTPRequest *)request;
- (void)requestFailed:(ASIHTTPRequest *)request;
@end

View file

@ -247,7 +247,7 @@
- (void)viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];
if (!self.isPhoneOrCompact) {
[appDelegate.feedDetailViewController.view endEditing:YES];
}
@ -2293,7 +2293,7 @@ shouldStartLoadWithRequest:(NSURLRequest *)request
[request addPostValue:[self.activeStory objectForKey:@"story_feed_id"] forKey:@"feed_id"];
[request setUserInfo:@{@"storyId": [self.activeStory objectForKey:@"id"]}];
[request setDidFinishSelector:@selector(finishFetchTextView:)];
[request setDidFailSelector:@selector(failedFetchText::)];
[request setDidFailSelector:@selector(failedFetchText:)];
[request setDelegate:self];
[request startAsynchronous];
}

View file

@ -167,7 +167,7 @@
UIBarButtonItem *subscribeBtn = [[UIBarButtonItem alloc]
initWithTitle:@"Follow User"
style:UIBarButtonSystemItemAction
style:UIBarButtonItemStylePlain
target:self
action:@selector(subscribeToBlurblog)
];
@ -1012,12 +1012,12 @@
if (storyViewController.inTextView) {
[buttonText setTitle:[@"Story" uppercaseString] forState:UIControlStateNormal];
[buttonText setBackgroundImage:[[ThemeManager themeManager] themedImage:[UIImage imageNamed:@"traverse_text_on.png"]]
forState:nil];
forState:0];
self.buttonText.titleEdgeInsets = UIEdgeInsetsMake(0, 26, 0, 0);
} else {
[buttonText setTitle:[@"Text" uppercaseString] forState:UIControlStateNormal];
[buttonText setBackgroundImage:[[ThemeManager themeManager] themedImage:[UIImage imageNamed:@"traverse_text.png"]]
forState:nil];
forState:0];
self.buttonText.titleEdgeInsets = UIEdgeInsetsMake(0, 22, 0, 0);
}
}

View file

@ -40,7 +40,7 @@
UIBarButtonItem *done = [[UIBarButtonItem alloc]
initWithTitle:@"Done Training"
style:UIBarButtonSystemItemDone
style:UIBarButtonItemStyleDone
target:self
action:@selector(doCloseDialog:)];
self.navigationItem.rightBarButtonItem = done;

View file

@ -2431,7 +2431,7 @@
29B97313FDCFA39411CA2CEA /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 0700;
LastUpgradeCheck = 0800;
ORGANIZATIONNAME = NewsBlur;
TargetAttributes = {
1D6058900D05DD3D006BFB54 = {
@ -3134,13 +3134,29 @@
C01FCF4F08A954540054247B /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = NO;
CLANG_ENABLE_MODULES = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
CODE_SIGN_IDENTITY = "iPhone Developer";
COPY_PHASE_STRIP = NO;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
GCC_C_LANGUAGE_STANDARD = "compiler-default";
GCC_NO_COMMON_BLOCKS = YES;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
HEADER_SEARCH_PATHS = "$(BUILT_PRODUCTS_DIR)/**";
IPHONEOS_DEPLOYMENT_TARGET = 7.0;
@ -3157,12 +3173,28 @@
C01FCF5008A954540054247B /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = NO;
CLANG_ENABLE_MODULES = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
CODE_SIGN_IDENTITY = "iPhone Developer";
COPY_PHASE_STRIP = NO;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
ENABLE_STRICT_OBJC_MSGSEND = YES;
GCC_C_LANGUAGE_STANDARD = "compiler-default";
GCC_NO_COMMON_BLOCKS = YES;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
HEADER_SEARCH_PATHS = "$(BUILT_PRODUCTS_DIR)/**";
IPHONEOS_DEPLOYMENT_TARGET = 7.0;