diff --git a/clients/ios/Classes/StoryDetailViewController.h b/clients/ios/Classes/StoryDetailViewController.h index ccd450e82..0cea3dc23 100644 --- a/clients/ios/Classes/StoryDetailViewController.h +++ b/clients/ios/Classes/StoryDetailViewController.h @@ -54,6 +54,7 @@ UIActionSheetDelegate> { - (void)hideNoStoryMessage; - (void)drawStory; - (void)drawStory:(BOOL)force withOrientation:(UIInterfaceOrientation)orientation; +- (void)updateStoryTheme; - (void)drawFeedGradient; - (void)showStory; - (void)clearStory; diff --git a/clients/ios/Classes/StoryDetailViewController.m b/clients/ios/Classes/StoryDetailViewController.m index 6db51dbe3..a641adda9 100644 --- a/clients/ios/Classes/StoryDetailViewController.m +++ b/clients/ios/Classes/StoryDetailViewController.m @@ -451,11 +451,7 @@ appDelegate.storiesCollection.isReadView) ? @"NB-river" : @"NB-non-river"; - NSString *themeStyle = [ThemeManager themeManager].themeCSSSuffix; - - if (themeStyle.length) { - themeStyle = [NSString stringWithFormat:@"", themeStyle]; - } + NSString *themeStyle = [NSString stringWithFormat:@"", [ThemeManager themeManager].themeCSSSuffix]; // set up layout values based on iPad/iPhone headerString = [NSString stringWithFormat:@ @@ -1749,6 +1745,13 @@ shouldStartLoadWithRequest:(NSURLRequest *)request [self.webView stringByEvaluatingJavaScriptFromString:jsString]; } +- (void)updateStoryTheme { + NSString *jsString = [NSString stringWithFormat:@"document.getElementById('NB-theme-style').href='storyDetailView%@.css';", + [ThemeManager themeManager].themeCSSSuffix]; + + [self.webView stringByEvaluatingJavaScriptFromString:jsString]; +} + #pragma mark - #pragma mark Actions diff --git a/clients/ios/Classes/StoryPageControl.h b/clients/ios/Classes/StoryPageControl.h index ed2dd65ce..9e7ab659e 100644 --- a/clients/ios/Classes/StoryPageControl.h +++ b/clients/ios/Classes/StoryPageControl.h @@ -106,7 +106,7 @@ - (void)changeFontSize:(NSString *)fontSize; - (void)changeLineSpacing:(NSString *)lineSpacing; - (void)changedScrollOrientation; -- (void)drawStories; +- (void)updateStoriesTheme; - (void)showShareHUD:(NSString *)msg; - (void)showFetchingTextNotifier; - (void)hideNotifier; diff --git a/clients/ios/Classes/StoryPageControl.m b/clients/ios/Classes/StoryPageControl.m index 95966761b..539b75784 100644 --- a/clients/ios/Classes/StoryPageControl.m +++ b/clients/ios/Classes/StoryPageControl.m @@ -628,7 +628,7 @@ [self updateTraverseBackground]; [self setNextPreviousButtons]; [self setTextButton]; - [self drawStories]; + [self updateStoriesTheme]; } // allow keyboard comands @@ -1315,10 +1315,10 @@ [self reorientPages]; } -- (void)drawStories { - [self.currentPage drawStory]; - [self.nextPage drawStory]; - [self.previousPage drawStory]; +- (void)updateStoriesTheme { + [self.currentPage updateStoryTheme]; + [self.nextPage updateStoryTheme]; + [self.previousPage updateStoryTheme]; } - (void)backToDashboard:(id)sender { diff --git a/clients/ios/Classes/ThemeManager.m b/clients/ios/Classes/ThemeManager.m index 9623b0ea2..2fb3c5411 100644 --- a/clients/ios/Classes/ThemeManager.m +++ b/clients/ios/Classes/ThemeManager.m @@ -83,7 +83,7 @@ NSString * const ThemeStyleDark = @"dark"; } else if ([theme isEqualToString:ThemeStyleMedium]) { return @"Medium"; } else { - return @""; + return @"Light"; } } diff --git a/clients/ios/NewsBlur.xcodeproj/project.pbxproj b/clients/ios/NewsBlur.xcodeproj/project.pbxproj index e98b98f2f..e78619d02 100755 --- a/clients/ios/NewsBlur.xcodeproj/project.pbxproj +++ b/clients/ios/NewsBlur.xcodeproj/project.pbxproj @@ -32,6 +32,7 @@ 17432C831C53438D003F8FD6 /* FeedChooserViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 17432C821C53438D003F8FD6 /* FeedChooserViewController.m */; }; 17432C861C5343C0003F8FD6 /* FeedChooserTitleView.m in Sources */ = {isa = PBXBuildFile; fileRef = 17432C851C5343C0003F8FD6 /* FeedChooserTitleView.m */; }; 17432C891C534BC6003F8FD6 /* FeedChooserViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 17432C881C534BC6003F8FD6 /* FeedChooserViewCell.m */; }; + 1745FABB217E7FD400336F24 /* storyDetailViewLight.css in Resources */ = {isa = PBXBuildFile; fileRef = 1745FABA217E7FD400336F24 /* storyDetailViewLight.css */; }; 174939141C251BFE003D98AA /* ShareViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 174939131C251BFE003D98AA /* ShareViewController.m */; }; 174939171C251BFE003D98AA /* MainInterface.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 174939151C251BFE003D98AA /* MainInterface.storyboard */; }; 1749391B1C251BFE003D98AA /* Share Extension.appex in Embed App Extensions */ = {isa = PBXBuildFile; fileRef = 174939101C251BFE003D98AA /* Share Extension.appex */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; }; @@ -658,6 +659,7 @@ 17432C851C5343C0003F8FD6 /* FeedChooserTitleView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FeedChooserTitleView.m; sourceTree = ""; }; 17432C871C534BC6003F8FD6 /* FeedChooserViewCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FeedChooserViewCell.h; sourceTree = ""; }; 17432C881C534BC6003F8FD6 /* FeedChooserViewCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FeedChooserViewCell.m; sourceTree = ""; }; + 1745FABA217E7FD400336F24 /* storyDetailViewLight.css */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.css; name = storyDetailViewLight.css; path = static/storyDetailViewLight.css; sourceTree = SOURCE_ROOT; }; 174939101C251BFE003D98AA /* Share Extension.appex */ = {isa = PBXFileReference; explicitFileType = "wrapper.app-extension"; includeInIndex = 0; path = "Share Extension.appex"; sourceTree = BUILT_PRODUCTS_DIR; }; 174939121C251BFE003D98AA /* ShareViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ShareViewController.h; sourceTree = ""; }; 174939131C251BFE003D98AA /* ShareViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ShareViewController.m; sourceTree = ""; }; @@ -2089,6 +2091,7 @@ isa = PBXGroup; children = ( FF67D3BD168A708D0057A7DA /* storyDetailView.css */, + 1745FABA217E7FD400336F24 /* storyDetailViewLight.css */, 17E265DD1C0D17340060655F /* storyDetailViewDark.css */, 17E57D551C0E592600EB3D4B /* storyDetailViewMedium.css */, 17E57D561C0E592600EB3D4B /* storyDetailViewSepia.css */, @@ -2900,6 +2903,7 @@ 43A4BAE215C866FA00F3B8D4 /* popoverArrowRight@2x.png in Resources */, 43A4BAE315C866FA00F3B8D4 /* popoverArrowRightSimple.png in Resources */, FFC486AF19CA413C00F4758F /* logo_180.png in Resources */, + 1745FABB217E7FD400336F24 /* storyDetailViewLight.css in Resources */, 43A4BAE415C866FA00F3B8D4 /* popoverArrowUp.png in Resources */, 1740C68A1C10FD75005EA453 /* theme_color_medium.png in Resources */, 43A4BAE515C866FA00F3B8D4 /* popoverArrowUp@2x.png in Resources */, diff --git a/clients/ios/static/storyDetailViewLight.css b/clients/ios/static/storyDetailViewLight.css new file mode 100644 index 000000000..b7cbb3b42 --- /dev/null +++ b/clients/ios/static/storyDetailViewLight.css @@ -0,0 +1,7 @@ +/** + * Light Theme overrides + */ + +/** + * None; just provided to enable switching themes via JavaScript. + */