[MediaWiki-commits] [Gerrit] Fix for search term highlighting font size and TOC updates. - change (apps...wikipedia)

2014-05-22 Thread Brion VIBBER (Code Review)
Brion VIBBER has submitted this change and it was merged.

Change subject: Fix for search term highlighting font size and TOC updates.
..


Fix for search term highlighting font size and TOC updates.

When non-lead section of article were retrieved while TOC was
open, there was a regression which caused new sections/images
to not appear in the TOC until it was closed and opened again.

Ran ttfautohint on WikiFont.ttf

Fix for sharing some articles with special characters in
their titles causing app crash.

When you select a search result the top menu switches back
to default chrome.

Returned search result text size - had accidentally shrunken
the result article titles.

Change-Id: I1d96b8f9d01e5077f5091a4ad161a36272ac6112
---
M wikipedia/Categories/Article+Convenience.h
M wikipedia/Categories/Article+Convenience.m
M wikipedia/Defines/Defines.h
M wikipedia/Fonts/WikiFont.ttf
M wikipedia/View Controllers/Navigation/Bottom/BottomMenuViewController.m
M wikipedia/View Controllers/Navigation/Top/TopMenuViewController.m
M wikipedia/View Controllers/SearchResults/SearchResultsController.m
M wikipedia/View Controllers/WebView/WebViewController.m
8 files changed, 54 insertions(+), 24 deletions(-)

Approvals:
  Brion VIBBER: Verified; Looks good to me, approved



diff --git a/wikipedia/Categories/Article+Convenience.h 
b/wikipedia/Categories/Article+Convenience.h
index 8c6dac3..ed58405 100644
--- a/wikipedia/Categories/Article+Convenience.h
+++ b/wikipedia/Categories/Article+Convenience.h
@@ -12,4 +12,6 @@
 // larger than 99 x 99 px.
 - (UIImage *)getThumbnailUsingContext:(NSManagedObjectContext *)context;
 
+- (NSURL *)desktopURL;
+
 @end
diff --git a/wikipedia/Categories/Article+Convenience.m 
b/wikipedia/Categories/Article+Convenience.m
index 167ad22..70a22d0 100644
--- a/wikipedia/Categories/Article+Convenience.m
+++ b/wikipedia/Categories/Article+Convenience.m
@@ -5,6 +5,7 @@
 #import ArticleCoreDataObjects.h
 #import Image+Convenience.h
 #import Defines.h
+#import NSString+Extras.h
 
 @implementation Article (Convenience)
 
@@ -88,4 +89,17 @@
 return sectionImages;
 }
 
+-(NSURL *)desktopURL
+{
+NSString *titleWithoutSpaces = [self.title wikiTitleWithoutSpaces];
+
+NSString *urlString =
+[NSString stringWithFormat:@https://%@.%@/wiki/%@;, self.domain, 
self.site, titleWithoutSpaces];
+
+NSString *encodedUrlString =
+[urlString 
stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
+
+return encodedUrlString ? [NSURL URLWithString:encodedUrlString] : nil;
+}
+
 @end
diff --git a/wikipedia/Defines/Defines.h b/wikipedia/Defines/Defines.h
index 2983b1b..01ab479 100644
--- a/wikipedia/Defines/Defines.h
+++ b/wikipedia/Defines/Defines.h
@@ -4,11 +4,14 @@
 #define SEARCH_RESULT_HEIGHT 60
 #define SEARCH_MAX_RESULTS @25
 
-#define SEARCH_FONT [UIFont systemFontOfSize:14.0]
-#define SEARCH_FONT_COLOR [UIColor colorWithWhite:0.0 alpha:0.85]
+#define SEARCH_TEXT_FIELD_FONT [UIFont systemFontOfSize:14.0]
+#define SEARCH_TEXT_FIELD_HIGHLIGHTED_COLOR [UIColor blackColor]
 
-#define SEARCH_FONT_HIGHLIGHTED [UIFont boldSystemFontOfSize:16.0]
-#define SEARCH_FONT_HIGHLIGHTED_COLOR [UIColor blackColor]
+#define SEARCH_RESULT_FONT [UIFont systemFontOfSize:16.0]
+#define SEARCH_RESULT_FONT_COLOR [UIColor colorWithWhite:0.0 alpha:0.85]
+
+#define SEARCH_RESULT_FONT_HIGHLIGHTED [UIFont boldSystemFontOfSize:16.0]
+#define SEARCH_RESULT_FONT_HIGHLIGHTED_COLOR [UIColor blackColor]
 
 #define SEARCH_FIELD_PLACEHOLDER_TEXT_COLOR [UIColor colorWithRed:0.7 
green:0.7 blue:0.7 alpha:1.0]
 
diff --git a/wikipedia/Fonts/WikiFont.ttf b/wikipedia/Fonts/WikiFont.ttf
index ab851d0..66ec0c0 100644
--- a/wikipedia/Fonts/WikiFont.ttf
+++ b/wikipedia/Fonts/WikiFont.ttf
Binary files differ
diff --git a/wikipedia/View 
Controllers/Navigation/Bottom/BottomMenuViewController.m b/wikipedia/View 
Controllers/Navigation/Bottom/BottomMenuViewController.m
index a7ec2b2..b5df308 100644
--- a/wikipedia/View Controllers/Navigation/Bottom/BottomMenuViewController.m
+++ b/wikipedia/View Controllers/Navigation/Bottom/BottomMenuViewController.m
@@ -14,6 +14,7 @@
 #import UIViewController+Alert.h
 #import UIView+TemporaryAnimatedXF.h
 #import NSString+Extras.h
+#import Article+Convenience.h
 
 typedef NS_ENUM(NSInteger, BottomMenuItemTag) {
 BOTTOM_MENU_BUTTON_UNKNOWN = 0,
@@ -108,7 +109,7 @@
 - (void)shareButtonPushed
 {
 NSString *title = @;
-NSURL *URL = nil;
+NSURL *desktopURL = nil;
 
 NSManagedObjectID *articleID =
 [articleDataContext_.mainContext getArticleIDForTitle: [SessionSingleton 
sharedInstance].currentArticleTitle
@@ -116,13 +117,18 @@
 if (articleID) {
 Article *article = (Article *)[articleDataContext_.mainContext 
objectWithID:articleID];
 if (article) {
-NSString *titleWithoutSpaces = [article.title 
wikiTitleWithoutSpaces];
-URL = [NSURL 

[MediaWiki-commits] [Gerrit] Fix for search term highlighting font size and TOC updates. - change (apps...wikipedia)

2014-05-21 Thread Mhurd (Code Review)
Mhurd has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/134775

Change subject: Fix for search term highlighting font size and TOC updates.
..

Fix for search term highlighting font size and TOC updates.

When non-lead section of article were retrieved while TOC was
open, there was a regression which caused new sections/images
to not appear in the TOC until it was closed and opened again.

Change-Id: I1d96b8f9d01e5077f5091a4ad161a36272ac6112
---
M wikipedia/Defines/Defines.h
M wikipedia/View Controllers/WebView/WebViewController.m
2 files changed, 14 insertions(+), 9 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/apps/ios/wikipedia 
refs/changes/75/134775/1

diff --git a/wikipedia/Defines/Defines.h b/wikipedia/Defines/Defines.h
index 2983b1b..a266a47 100644
--- a/wikipedia/Defines/Defines.h
+++ b/wikipedia/Defines/Defines.h
@@ -7,7 +7,7 @@
 #define SEARCH_FONT [UIFont systemFontOfSize:14.0]
 #define SEARCH_FONT_COLOR [UIColor colorWithWhite:0.0 alpha:0.85]
 
-#define SEARCH_FONT_HIGHLIGHTED [UIFont boldSystemFontOfSize:16.0]
+#define SEARCH_FONT_HIGHLIGHTED [UIFont boldSystemFontOfSize:14.0]
 #define SEARCH_FONT_HIGHLIGHTED_COLOR [UIColor blackColor]
 
 #define SEARCH_FIELD_PLACEHOLDER_TEXT_COLOR [UIColor colorWithRed:0.7 
green:0.7 blue:0.7 alpha:1.0]
diff --git a/wikipedia/View Controllers/WebView/WebViewController.m 
b/wikipedia/View Controllers/WebView/WebViewController.m
index 027e01c..9ca4938 100644
--- a/wikipedia/View Controllers/WebView/WebViewController.m
+++ b/wikipedia/View Controllers/WebView/WebViewController.m
@@ -291,8 +291,10 @@
 return (self.webViewLeftConstraint.constant == 0) ? NO : YES;
 }
 
--(void)tocHideWithDurationNextRunLoop:(NSNumber *)duration
+-(void)tocHideIfSafeToToggleDuringNextRunLoopWithDuration:(NSNumber *)duration
 {
+if(self.unsafeToToggleTOC || !self.tocVC) return;
+
 // iOS 6 can blank out the web view this isn't scheduled for next run loop.
 [[NSRunLoop currentRunLoop] performSelector: 
@selector(tocHideWithDuration:)
  target: self
@@ -303,7 +305,6 @@
 
 -(void)tocHideWithDuration:(NSNumber *)duration
 {
-if(self.unsafeToToggleTOC || !self.tocVC)return;
 self.unsafeToToggleTOC = YES;
 
 // Clear alerts
@@ -330,9 +331,11 @@
  }];
 }
 
--(void)tocShowWithDurationNextRunLoop:(NSNumber *)duration
+-(void)tocShowIfSafeToToggleDuringNextRunLoopWithDuration:(NSNumber *)duration
 {
 if([[SessionSingleton sharedInstance] isCurrentArticleMain]) return;
+
+if(self.unsafeToToggleTOC || self.tocVC) return;
 
 // iOS 6 can blank out the web view this isn't scheduled for next run loop.
 [[NSRunLoop currentRunLoop] performSelector: 
@selector(tocShowWithDuration:)
@@ -344,7 +347,6 @@
 
 -(void)tocShowWithDuration:(NSNumber *)duration
 {
-if(self.unsafeToToggleTOC || self.tocVC)return;
 self.unsafeToToggleTOC = YES;
 
 // Clear alerts
@@ -410,12 +412,12 @@
 
 -(void)tocHide
 {
-[self tocHideWithDurationNextRunLoop:TOC_TOGGLE_ANIMATION_DURATION];
+[self 
tocHideIfSafeToToggleDuringNextRunLoopWithDuration:TOC_TOGGLE_ANIMATION_DURATION];
 }
 
 -(void)tocShow
 {
-[self tocShowWithDurationNextRunLoop:TOC_TOGGLE_ANIMATION_DURATION];
+[self 
tocShowIfSafeToToggleDuringNextRunLoopWithDuration:TOC_TOGGLE_ANIMATION_DURATION];
 }
 
 -(void)tocToggle
@@ -1309,7 +1311,7 @@
 self.scrollOffset = scrollOffset;
 
 
-if (mode != DISPLAY_LEAD_SECTION) {
+if ((mode != DISPLAY_LEAD_SECTION)  ![[SessionSingleton 
sharedInstance] isCurrentArticleMain]) {
 [sectionTextArray addObject: [self renderLanguageButtonForCount: 
langCount.integerValue]];
 }
 
@@ -1329,7 +1331,10 @@
 
 if ([self tocDrawerIsOpen]) {
 // Drawer is already open, so just refresh the toc quickly w/o 
animation.
-[self tocShowWithDurationNextRunLoop:@0.0f];
+// Make sure tocShowWithDuration: is allowed to happen even if 
the TOC
+// is already onscreen or non-lead sections won't appear in the 
TOC when
+// they've been retrieved if the TOC is open.
+[self tocShowWithDuration:@0.0f];
 }
 }];
 }

-- 
To view, visit https://gerrit.wikimedia.org/r/134775
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I1d96b8f9d01e5077f5091a4ad161a36272ac6112
Gerrit-PatchSet: 1
Gerrit-Project: apps/ios/wikipedia
Gerrit-Branch: master
Gerrit-Owner: Mhurd mh...@wikimedia.org

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits