[MediaWiki-commits] [Gerrit] Support DISPLAYTITLE in article view - change (apps...wikipedia)
Brion VIBBER has submitted this change and it was merged. Change subject: Support DISPLAYTITLE in article view .. Support DISPLAYTITLE in article view Added support for the display title. Limited this to article view as this seems to be the consistent behavior across platforms. There was actually a field for this in the article model, but it was apparently never fully implemented. Perform nil check when create dictionary in DownloadSectionsOp.m, and in getHeaderTitle Section+DisplayHtml.m. Bug: 63971 Change-Id: I26fe6d723540b67da533e6b916a6a288a4ddc4c9 --- M wikipedia/Categories/Section+DisplayHtml.m M wikipedia/Data/Operations/DownloadSectionsOp.m M wikipedia/View Controllers/WebView/WebViewController.m 3 files changed, 19 insertions(+), 2 deletions(-) Approvals: Brion VIBBER: Verified; Looks good to me, approved diff --git a/wikipedia/Categories/Section+DisplayHtml.m b/wikipedia/Categories/Section+DisplayHtml.m index 318b1e7..c6babed 100644 --- a/wikipedia/Categories/Section+DisplayHtml.m +++ b/wikipedia/Categories/Section+DisplayHtml.m @@ -33,7 +33,7 @@ NSString *pencilAnchor = isMainPage ? @"" : [self getEditPencilAnchor]; // Use the article's title for lead section header text. -NSString *title = ([self.sectionId isEqualToNumber:@(0)]) ? self.article.title : self.title; +NSString *title = [self getHeaderTitle]; NSInteger headingTagSize = [self getHeadingTagSize]; @@ -53,6 +53,18 @@ ]; } +-(NSString*)getHeaderTitle{ +if ([self.sectionId isEqualToNumber:@(0)]) { +if (self.article.displayTitle != nil && self.article.displayTitle.length > 0) { +return self.article.displayTitle; +}else{ +return self.article.title; +} +}else{ +return self.title; +} +} + -(NSInteger)getHeadingTagSize { // Determines tag size based on section level. diff --git a/wikipedia/Data/Operations/DownloadSectionsOp.m b/wikipedia/Data/Operations/DownloadSectionsOp.m index dbdc6bb..4fe8947 100644 --- a/wikipedia/Data/Operations/DownloadSectionsOp.m +++ b/wikipedia/Data/Operations/DownloadSectionsOp.m @@ -24,7 +24,7 @@ NSMutableDictionary *params = @{ @"action": @"mobileview", - @"prop": @"sections|text|lastmodified|lastmodifiedby|languagecount|id|protection|editable", + @"prop": @"sections|text|lastmodified|lastmodifiedby|languagecount|id|protection|editable|displaytitle", @"sectionprop": @"toclevel|line|anchor|level|number|fromtitle|index", @"noheadings": @"true", @"page": title, @@ -137,6 +137,9 @@ NSNumber *editable = weakSelf.jsonRetrieved[@"mobileview"][@"editable"]; if (!editable || [editable isNull]) editable = @NO; +NSString *displaytitle = weakSelf.jsonRetrieved[@"mobileview"][@"displaytitle"]; +if (!displaytitle || [displaytitle isNull]) displaytitle = @""; + NSString *protectionStatus = @""; id protection = weakSelf.jsonRetrieved[@"mobileview"][@"protection"]; // if empty this can be an array instead of an object/dict! @@ -154,6 +157,7 @@ @"lastmodified": lastmodifiedDate, @"lastmodifiedby": lastmodifiedby, @"redirected": redirected, +@"displaytitle": displaytitle, @"languagecount": languagecount, @"articleId": articleId, @"editable": editable, diff --git a/wikipedia/View Controllers/WebView/WebViewController.m b/wikipedia/View Controllers/WebView/WebViewController.m index 5590785..794a199 100644 --- a/wikipedia/View Controllers/WebView/WebViewController.m +++ b/wikipedia/View Controllers/WebView/WebViewController.m @@ -1705,6 +1705,7 @@ article.articleId = dataRetrieved[@"articleId"]; article.editable = dataRetrieved[@"editable"]; article.protectionStatus = dataRetrieved[@"protectionStatus"]; +article.displayTitle = dataRetrieved[@"displaytitle"]; // Note: Because "retrieveArticleForPageTitle" recurses with the redirected-to title if -- To view, visit https://gerrit.wikimedia.org/r/164756 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I26fe6d723540b67da533e6b916a6a288a4ddc4c9 Gerrit-PatchSet: 3 Gerrit-Project: apps/ios/wikipedia Gerrit-Branch: master Gerrit-Owner: Saltymule Gerrit-Reviewer: Brion VIBBER Gerrit-Reviewer: Mhurd Gerrit-Reviewer: jenkins-bot <> ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://li
[MediaWiki-commits] [Gerrit] Support DISPLAYTITLE in article view - change (apps...wikipedia)
Saltymule has uploaded a new change for review. https://gerrit.wikimedia.org/r/164756 Change subject: Support DISPLAYTITLE in article view .. Support DISPLAYTITLE in article view Added support for the display title. Limited this to article view as this seems to be the consistent behavior across platforms. There was actually a field for this in the article model, but it was apparently never fully implemented. Bug: 63971 Change-Id: I26fe6d723540b67da533e6b916a6a288a4ddc4c9 --- M wikipedia/Categories/Section+DisplayHtml.m M wikipedia/Data/Operations/DownloadSectionsOp.m M wikipedia/View Controllers/WebView/WebViewController.m 3 files changed, 19 insertions(+), 2 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/apps/ios/wikipedia refs/changes/56/164756/1 diff --git a/wikipedia/Categories/Section+DisplayHtml.m b/wikipedia/Categories/Section+DisplayHtml.m index 318b1e7..371a049 100644 --- a/wikipedia/Categories/Section+DisplayHtml.m +++ b/wikipedia/Categories/Section+DisplayHtml.m @@ -33,7 +33,7 @@ NSString *pencilAnchor = isMainPage ? @"" : [self getEditPencilAnchor]; // Use the article's title for lead section header text. -NSString *title = ([self.sectionId isEqualToNumber:@(0)]) ? self.article.title : self.title; +NSString *title = [self getHeaderTitle]; NSInteger headingTagSize = [self getHeadingTagSize]; @@ -53,6 +53,18 @@ ]; } +-(NSString*)getHeaderTitle{ +if ([self.sectionId isEqualToNumber:@(0)]) { +if (self.article.displayTitle.length > 0) { +return self.article.displayTitle; +}else{ +return self.article.title; +} +}else{ +return self.title; +} +} + -(NSInteger)getHeadingTagSize { // Determines tag size based on section level. diff --git a/wikipedia/Data/Operations/DownloadSectionsOp.m b/wikipedia/Data/Operations/DownloadSectionsOp.m index dbdc6bb..1a25a3f 100644 --- a/wikipedia/Data/Operations/DownloadSectionsOp.m +++ b/wikipedia/Data/Operations/DownloadSectionsOp.m @@ -24,7 +24,7 @@ NSMutableDictionary *params = @{ @"action": @"mobileview", - @"prop": @"sections|text|lastmodified|lastmodifiedby|languagecount|id|protection|editable", + @"prop": @"sections|text|lastmodified|lastmodifiedby|languagecount|id|protection|editable|displaytitle", @"sectionprop": @"toclevel|line|anchor|level|number|fromtitle|index", @"noheadings": @"true", @"page": title, @@ -137,6 +137,9 @@ NSNumber *editable = weakSelf.jsonRetrieved[@"mobileview"][@"editable"]; if (!editable || [editable isNull]) editable = @NO; +NSNumber *displaytitle = weakSelf.jsonRetrieved[@"mobileview"][@"displaytitle"]; +if (!displaytitle || [displaytitle isNull]) editable = @NO; + NSString *protectionStatus = @""; id protection = weakSelf.jsonRetrieved[@"mobileview"][@"protection"]; // if empty this can be an array instead of an object/dict! @@ -154,6 +157,7 @@ @"lastmodified": lastmodifiedDate, @"lastmodifiedby": lastmodifiedby, @"redirected": redirected, +@"displaytitle": displaytitle, @"languagecount": languagecount, @"articleId": articleId, @"editable": editable, diff --git a/wikipedia/View Controllers/WebView/WebViewController.m b/wikipedia/View Controllers/WebView/WebViewController.m index c84c0c0..3a8670f 100644 --- a/wikipedia/View Controllers/WebView/WebViewController.m +++ b/wikipedia/View Controllers/WebView/WebViewController.m @@ -1692,6 +1692,7 @@ article.articleId = dataRetrieved[@"articleId"]; article.editable = dataRetrieved[@"editable"]; article.protectionStatus = dataRetrieved[@"protectionStatus"]; +article.displayTitle = dataRetrieved[@"displaytitle"]; // Note: Because "retrieveArticleForPageTitle" recurses with the redirected-to title if -- To view, visit https://gerrit.wikimedia.org/r/164756 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I26fe6d723540b67da533e6b916a6a288a4ddc4c9 Gerrit-PatchSet: 1 Gerrit-Project: apps/ios/wikipedia Gerrit-Branch: master Gerrit-Owner: Saltymule Gerrit-Reviewer: jenkins-bot <> ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits