Skip to content
Permalink
Browse files

iOS: done #1091 (story theme switch)

  • Loading branch information...
Dejal committed Oct 22, 2018
1 parent 0cf1994 commit 2c88f21331f9fbf2530e9fb7647b6bbbb7ffe9a0
@@ -54,6 +54,7 @@ UIActionSheetDelegate> {
- (void)hideNoStoryMessage;
- (void)drawStory;
- (void)drawStory:(BOOL)force withOrientation:(UIInterfaceOrientation)orientation;
- (void)updateStoryTheme;
- (void)drawFeedGradient;
- (void)showStory;
- (void)clearStory;
@@ -451,11 +451,7 @@ - (void)drawStory:(BOOL)force withOrientation:(UIInterfaceOrientation)orientatio
appDelegate.storiesCollection.isReadView) ?
@"NB-river" : @"NB-non-river";

NSString *themeStyle = [ThemeManager themeManager].themeCSSSuffix;

if (themeStyle.length) {
themeStyle = [NSString stringWithFormat:@"<link rel=\"stylesheet\" type=\"text/css\" href=\"storyDetailView%@.css\">", themeStyle];
}
NSString *themeStyle = [NSString stringWithFormat:@"<link rel=\"stylesheet\" type=\"text/css\" id=\"NB-theme-style\" href=\"storyDetailView%@.css\">", [ThemeManager themeManager].themeCSSSuffix];

// set up layout values based on iPad/iPhone
headerString = [NSString stringWithFormat:@
@@ -1749,6 +1745,13 @@ - (void)changeLineSpacing:(NSString *)lineSpacing {
[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

@@ -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;
@@ -628,7 +628,7 @@ - (void)updateTheme {
[self updateTraverseBackground];
[self setNextPreviousButtons];
[self setTextButton];
[self drawStories];
[self updateStoriesTheme];
}

// allow keyboard comands
@@ -1315,10 +1315,10 @@ - (void)changedScrollOrientation {
[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 {
@@ -83,7 +83,7 @@ - (NSString *)themeCSSSuffix {
} else if ([theme isEqualToString:ThemeStyleMedium]) {
return @"Medium";
} else {
return @"";
return @"Light";
}
}

@@ -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 = "<group>"; };
17432C871C534BC6003F8FD6 /* FeedChooserViewCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FeedChooserViewCell.h; sourceTree = "<group>"; };
17432C881C534BC6003F8FD6 /* FeedChooserViewCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FeedChooserViewCell.m; sourceTree = "<group>"; };
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 = "<group>"; };
174939131C251BFE003D98AA /* ShareViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ShareViewController.m; sourceTree = "<group>"; };
@@ -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 */,
@@ -0,0 +1,7 @@
/**
* Light Theme overrides
*/

/**
* None; just provided to enable switching themes via JavaScript.
*/

0 comments on commit 2c88f21

Please sign in to comment.
You can’t perform that action at this time.