diff --git a/clients/ios/Classes/FontSettingsViewController.m b/clients/ios/Classes/FontSettingsViewController.m index afd1de000..aa05b1a49 100644 --- a/clients/ios/Classes/FontSettingsViewController.m +++ b/clients/ios/Classes/FontSettingsViewController.m @@ -60,6 +60,7 @@ [self addBundledFontWithName:@"GothamNarrow-Book" styleClass:@"GothamNarrow-Book" displayName:nil]; [self addBuiltInFontWithName:@"Helvetica" styleClass:@"NB-helvetica" displayName:nil]; [self addBuiltInFontWithName:@"Palatino-Roman" styleClass:@"NB-palatino" displayName:nil]; + [self addBundledFontWithName:@"SanFrancisco" styleClass:@"NB-sanfrancisco" displayName:@"San Francisco"]; [self addBundledFontWithName:@"WhitneySSm-Book" styleClass:@"WhitneySSm-Book" displayName:@"Whitney"]; NSUserDefaults *userPreferences = [NSUserDefaults standardUserDefaults]; @@ -134,6 +135,9 @@ - (void)addBuiltInFontWithName:(NSString *)fontName styleClass:(NSString *)styleClass displayName:(NSString *)displayName { UIFont *font = [UIFont fontWithName:fontName size:16.0]; + if ([fontName isEqualToString:@"SanFrancisco"]) { + font = [UIFont systemFontOfSize:16.0 weight:UIFontWeightRegular]; + } if (font) { if (!displayName) { diff --git a/clients/ios/Classes/NewsBlurAppDelegate.m b/clients/ios/Classes/NewsBlurAppDelegate.m index 74ce7d0ae..b6c96809b 100644 --- a/clients/ios/Classes/NewsBlurAppDelegate.m +++ b/clients/ios/Classes/NewsBlurAppDelegate.m @@ -1731,6 +1731,10 @@ self.safariViewController = [[SFSafariViewController alloc] initWithURL:url]; self.safariViewController.delegate = self; [navigationController presentViewController:self.safariViewController animated:YES completion:nil]; + } else if ([storyBrowser isEqualToString:@"inappsafarireader"]) { + self.safariViewController = [[SFSafariViewController alloc] initWithURL:url entersReaderIfAvailable:YES]; + self.safariViewController.delegate = self; + [navigationController presentViewController:self.safariViewController animated:YES completion:nil]; } else { if (!originalStoryViewController) { originalStoryViewController = [[OriginalStoryViewController alloc] init]; diff --git a/clients/ios/Classes/StoryDetailViewController.m b/clients/ios/Classes/StoryDetailViewController.m index 7058fc1ea..a7e22185f 100644 --- a/clients/ios/Classes/StoryDetailViewController.m +++ b/clients/ios/Classes/StoryDetailViewController.m @@ -1252,8 +1252,9 @@ if (appDelegate.storyPageControl.currentPage != self) return; int webpageHeight = self.webView.scrollView.contentSize.height; - int viewportHeight = self.webView.scrollView.frame.size.height; + int viewportHeight = self.view.frame.size.height; int topPosition = self.webView.scrollView.contentOffset.y; + int safeBottomMargin = -32; int bottomPosition = webpageHeight - topPosition - viewportHeight; BOOL singlePage = webpageHeight - 200 <= viewportHeight; BOOL atBottom = bottomPosition < 150; @@ -1274,52 +1275,61 @@ }]; } else if (singlePage) { appDelegate.storyPageControl.traverseView.alpha = 1; - CGRect tvf = appDelegate.storyPageControl.traverseView.frame; - if (bottomPosition > 0) { - appDelegate.storyPageControl.traverseView.frame = CGRectMake(tvf.origin.x, - self.webView.scrollView.frame.size.height - tvf.size.height, - tvf.size.width, tvf.size.height); + NSLog(@" ---> Bottom position: %d", bottomPosition); + if (bottomPosition >= 0) { +// appDelegate.storyPageControl.traverseView.frame = CGRectMake(tvf.origin.x, +// self.webView.scrollView.frame.size.height - tvf.size.height - safeBottomMargin, +// tvf.size.width, tvf.size.height); + appDelegate.storyPageControl.traverseBottomConstraint.constant = safeBottomMargin; } else { - appDelegate.storyPageControl.traverseView.frame = CGRectMake(tvf.origin.x, - (self.webView.scrollView.contentSize.height - self.webView.scrollView.contentOffset.y) - tvf.size.height, - tvf.size.width, tvf.size.height); +// appDelegate.storyPageControl.traverseView.frame = CGRectMake(tvf.origin.x, +// (webpageHeight - topPosition) - tvf.size.height - safeBottomMargin, +// tvf.size.width, tvf.size.height); + appDelegate.storyPageControl.traverseBottomConstraint.constant = viewportHeight - (webpageHeight - topPosition) + safeBottomMargin; +// appDelegate.storyPageControl.traverseBottomConstraint.constant = safeBottomMargin; } } else if (!singlePage && (atTop && !atBottom)) { // Pin to bottom of viewport, regardless of scrollview appDelegate.storyPageControl.traversePinned = YES; appDelegate.storyPageControl.traverseFloating = NO; - CGRect tvf = appDelegate.storyPageControl.traverseView.frame; - appDelegate.storyPageControl.traverseView.frame = CGRectMake(tvf.origin.x, - self.webView.scrollView.frame.size.height - tvf.size.height, - tvf.size.width, tvf.size.height); +// appDelegate.storyPageControl.traverseView.frame = CGRectMake(tvf.origin.x, +// self.webView.scrollView.frame.size.height - tvf.size.height - safeBottomMargin, +// tvf.size.width, tvf.size.height); + [appDelegate.storyPageControl.view layoutIfNeeded]; + + appDelegate.storyPageControl.traverseBottomConstraint.constant = safeBottomMargin; [UIView animateWithDuration:.3 delay:0 options:UIViewAnimationOptionCurveEaseInOut animations:^{ + [appDelegate.storyPageControl.view layoutIfNeeded]; appDelegate.storyPageControl.traverseView.alpha = 1; } completion:nil]; } else if (appDelegate.storyPageControl.traverseView.alpha == 1 && appDelegate.storyPageControl.traversePinned) { // Scroll with bottom of scrollview, but smoothly appDelegate.storyPageControl.traverseFloating = YES; - CGRect tvf = appDelegate.storyPageControl.traverseView.frame; + [appDelegate.storyPageControl.view layoutIfNeeded]; + + appDelegate.storyPageControl.traverseBottomConstraint.constant = safeBottomMargin; [UIView animateWithDuration:.3 delay:0 options:UIViewAnimationOptionCurveEaseInOut animations:^{ - appDelegate.storyPageControl.traverseView.frame = CGRectMake(tvf.origin.x, - (self.webView.scrollView.contentSize.height - self.webView.scrollView.contentOffset.y) - tvf.size.height, - tvf.size.width, tvf.size.height); +// appDelegate.storyPageControl.traverseView.frame = CGRectMake(tvf.origin.x, +// (webpageHeight - topPosition) - tvf.size.height - safeBottomMargin, +// tvf.size.width, tvf.size.height); + [appDelegate.storyPageControl.view layoutIfNeeded]; } completion:^(BOOL finished) { - appDelegate.storyPageControl.traversePinned = NO; + appDelegate.storyPageControl.traversePinned = NO; }]; } else { // Scroll with bottom of scrollview appDelegate.storyPageControl.traversePinned = NO; appDelegate.storyPageControl.traverseFloating = YES; appDelegate.storyPageControl.traverseView.alpha = 1; - CGRect tvf = appDelegate.storyPageControl.traverseView.frame; - appDelegate.storyPageControl.traverseView.frame = CGRectMake(tvf.origin.x, - (self.webView.scrollView.contentSize.height - self.webView.scrollView.contentOffset.y) - tvf.size.height, - tvf.size.width, tvf.size.height); + appDelegate.storyPageControl.traverseBottomConstraint.constant = viewportHeight - (webpageHeight - topPosition) + safeBottomMargin; +// appDelegate.storyPageControl.traverseView.frame = CGRectMake(tvf.origin.x, +// (webpageHeight - topPosition) - tvf.size.height - safeBottomMargin, +// tvf.size.width, tvf.size.height); } [self storeScrollPosition:YES]; diff --git a/clients/ios/Classes/StoryPageControl.h b/clients/ios/Classes/StoryPageControl.h index a74c61ec4..8c4b14602 100644 --- a/clients/ios/Classes/StoryPageControl.h +++ b/clients/ios/Classes/StoryPageControl.h @@ -64,6 +64,7 @@ @property (nonatomic) IBOutlet UIBarButtonItem *originalStoryButton; @property (nonatomic, strong) IBOutlet UIBarButtonItem *subscribeButton; @property (nonatomic) IBOutlet UIImageView *dragBarImageView; +@property (nonatomic) IBOutlet NSLayoutConstraint *traverseBottomConstraint; @property (readwrite) BOOL traversePinned; @property (readwrite) BOOL traverseFloating; @property (readwrite) CGFloat inTouchMove; diff --git a/clients/ios/Classes/StoryPageControl.m b/clients/ios/Classes/StoryPageControl.m index 5cb4c0451..22cb3a9fe 100644 --- a/clients/ios/Classes/StoryPageControl.m +++ b/clients/ios/Classes/StoryPageControl.m @@ -52,6 +52,7 @@ @synthesize isAnimatedIntoPlace; @synthesize progressView, progressViewContainer; @synthesize traversePinned, traverseFloating; +@synthesize traverseBottomConstraint; - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil { self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]; @@ -750,15 +751,15 @@ // } // Stick to bottom - CGRect tvf = self.traverseView.frame; traversePinned = YES; [UIView animateWithDuration:.24 delay:0 options:UIViewAnimationOptionCurveEaseInOut animations:^{ [self.traverseView setNeedsLayout]; - self.traverseView.frame = CGRectMake(tvf.origin.x, - self.view.bounds.size.height - tvf.size.height - bottomSizeHeightConstraint.constant, - tvf.size.width, tvf.size.height); +// self.traverseView.frame = CGRectMake(tvf.origin.x, +// self.view.bounds.size.height - tvf.size.height - bottomSizeHeightConstraint.constant - (self.view.safeAreaInsets.bottom - 20), +// tvf.size.width, tvf.size.height); + self.traverseBottomConstraint.constant = -32; self.traverseView.alpha = 1; self.traversePinned = YES; } completion:^(BOOL finished) { diff --git a/clients/ios/Classes/StoryPageControl.xib b/clients/ios/Classes/StoryPageControl.xib index de7cae17e..c258bb639 100644 --- a/clients/ios/Classes/StoryPageControl.xib +++ b/clients/ios/Classes/StoryPageControl.xib @@ -19,7 +19,6 @@ - @@ -29,6 +28,7 @@ + diff --git a/clients/ios/Resources/Settings.bundle/Root.plist b/clients/ios/Resources/Settings.bundle/Root.plist index 1a3a97383..fd34c84e7 100644 --- a/clients/ios/Resources/Settings.bundle/Root.plist +++ b/clients/ios/Resources/Settings.bundle/Root.plist @@ -595,6 +595,7 @@ In-app browser In-app Safari + In-app Safari Reader Mode Safari Chrome Opera Mini @@ -606,6 +607,7 @@ inapp inappsafari + inappsafarireader safari chrome opera_mini diff --git a/clients/ios/Resources/Settings.bundle/Root~ipad.plist b/clients/ios/Resources/Settings.bundle/Root~ipad.plist index 08dedef4c..e8f423ed8 100644 --- a/clients/ios/Resources/Settings.bundle/Root~ipad.plist +++ b/clients/ios/Resources/Settings.bundle/Root~ipad.plist @@ -615,6 +615,7 @@ In-app browser In-app Safari + In-app Safari Reader Mode Safari Chrome Opera Mini @@ -626,6 +627,7 @@ inapp inappsafari + inappsafarireader safari chrome opera_mini diff --git a/clients/ios/static/storyDetailView.css b/clients/ios/static/storyDetailView.css index d214f70fc..8de13c29a 100644 --- a/clients/ios/static/storyDetailView.css +++ b/clients/ios/static/storyDetailView.css @@ -45,6 +45,9 @@ .NB-palatino { font-family: "Palatino"; } +.NB-sanfrancisco { + font-family: "-apple-system"; +} .NB-helvetica { font-family: "Helvetica"; }