Brion VIBBER has uploaded a new change for review.

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

Change subject: Work in progress: adding edit protection fields
......................................................................

Work in progress: adding edit protection fields

Requires CSS updates in https://gerrit.wikimedia.org/r/#/c/141762/
to get the edit buttons to show broken, assuming it works. :D

Change-Id: I894850b27e18eb150e98ad516b6a93def748c53e
---
M Wikipedia.xcodeproj/project.pbxproj
M wikipedia/Categories/Article+Convenience.h
M wikipedia/Categories/Article+Convenience.m
M wikipedia/Data/Model/Article.h
M wikipedia/Data/Model/Article.m
A wikipedia/Data/Model/ArticleData.xcdatamodeld/.xccurrentversion
A wikipedia/Data/Model/ArticleData.xcdatamodeld/ArticleData 
2.xcdatamodel/contents
M wikipedia/Data/Model/ArticleData.xcdatamodeld/ArticleData.xcdatamodel/contents
M wikipedia/Data/Operations/DownloadSectionsOp.m
M wikipedia/EventLogging/ProtectedEditAttemptFunnel.m
M wikipedia/View Controllers/WebView/WebViewController.m
M wikipedia/assets/bundle.js
M www/js/listeners.js
13 files changed, 179 insertions(+), 12 deletions(-)


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

diff --git a/Wikipedia.xcodeproj/project.pbxproj 
b/Wikipedia.xcodeproj/project.pbxproj
index 24c6f2a..eb49a04 100644
--- a/Wikipedia.xcodeproj/project.pbxproj
+++ b/Wikipedia.xcodeproj/project.pbxproj
@@ -634,6 +634,7 @@
                D4B0AE0C19366A5400F0AC90 /* LoginFunnel.h */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = 
LoginFunnel.h; path = EventLogging/LoginFunnel.h; sourceTree = "<group>"; };
                D4B0AE0D19366A5400F0AC90 /* LoginFunnel.m */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name 
= LoginFunnel.m; path = EventLogging/LoginFunnel.m; sourceTree = "<group>"; };
                D4BC22B3181E9E6300CAC673 /* empty.png */ = {isa = 
PBXFileReference; lastKnownFileType = image.png; path = empty.png; sourceTree = 
"<group>"; };
+               D4CA33D71959FDEC0093588B /* ArticleData 2.xcdatamodel */ = {isa 
= PBXFileReference; lastKnownFileType = wrapper.xcdatamodel; path = 
"ArticleData 2.xcdatamodel"; sourceTree = "<group>"; };
                D4DE203018283FF200148CA2 /* CommunicationBridgeTests.m */ = 
{isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = 
sourcecode.c.objc; path = CommunicationBridgeTests.m; sourceTree = "<group>"; };
                D4E8A8A2190835C100DA4765 /* DataMigrator.h */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = 
DataMigrator.h; path = wikipedia/DataMigrator.h; sourceTree = SOURCE_ROOT; };
                D4E8A8A3190835C100DA4765 /* DataMigrator.m */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name 
= DataMigrator.m; path = wikipedia/DataMigrator.m; sourceTree = SOURCE_ROOT; };
@@ -2225,9 +2226,10 @@
                04FD6C78184EBFCD002CA02F /* ArticleData.xcdatamodeld */ = {
                        isa = XCVersionGroup;
                        children = (
+                               D4CA33D71959FDEC0093588B /* ArticleData 
2.xcdatamodel */,
                                04FD6C79184EBFCD002CA02F /* 
ArticleData.xcdatamodel */,
                        );
-                       currentVersion = 04FD6C79184EBFCD002CA02F /* 
ArticleData.xcdatamodel */;
+                       currentVersion = D4CA33D71959FDEC0093588B /* 
ArticleData 2.xcdatamodel */;
                        path = ArticleData.xcdatamodeld;
                        sourceTree = "<group>";
                        versionGroupType = wrapper.xcdatamodel;
diff --git a/wikipedia/Categories/Article+Convenience.h 
b/wikipedia/Categories/Article+Convenience.h
index b5cba6a..33f8d3f 100644
--- a/wikipedia/Categories/Article+Convenience.h
+++ b/wikipedia/Categories/Article+Convenience.h
@@ -19,4 +19,6 @@
 
 @property (readonly) MWPageTitle* titleObj;
 
+@property (readonly) BOOL editableBool;
+
 @end
diff --git a/wikipedia/Categories/Article+Convenience.m 
b/wikipedia/Categories/Article+Convenience.m
index 0de5870..146b5b4 100644
--- a/wikipedia/Categories/Article+Convenience.m
+++ b/wikipedia/Categories/Article+Convenience.m
@@ -130,4 +130,13 @@
     return [MWPageTitle titleWithString:self.title];
 }
 
+-(BOOL)editableBool
+{
+    if (self.editable == nil) {
+        return YES; // default
+    } else {
+        return [self.editable boolValue];
+    }
+}
+
 @end
diff --git a/wikipedia/Data/Model/Article.h b/wikipedia/Data/Model/Article.h
index 2802a46..be8b1db 100644
--- a/wikipedia/Data/Model/Article.h
+++ b/wikipedia/Data/Model/Article.h
@@ -1,5 +1,10 @@
-//  Created by Monte Hurd on 5/2/14.
-//  Created by Monte Hurd on 4/29/14.
+//
+//  Article.h
+//  Wikipedia
+//
+//  Created by Brion on 6/24/14.
+//  Copyright (c) 2014 Wikimedia Foundation. All rights reserved.
+//
 
 #import <Foundation/Foundation.h>
 #import <CoreData/CoreData.h>
@@ -8,6 +13,7 @@
 
 @interface Article : NSManagedObject
 
+@property (nonatomic, retain) NSNumber * articleId;
 @property (nonatomic, retain) NSDate * dateCreated;
 @property (nonatomic, retain) NSString * domain;
 @property (nonatomic, retain) NSString * domainName;
@@ -20,7 +26,9 @@
 @property (nonatomic, retain) NSString * redirected;
 @property (nonatomic, retain) NSString * site;
 @property (nonatomic, retain) NSString * title;
-@property (nonatomic, retain) NSNumber * articleId;
+@property (nonatomic, retain) NSString * protectionStatus;
+@property (nonatomic, retain) NSNumber * editable;
+@property (nonatomic, retain) NSString * displayTitle;
 @property (nonatomic, retain) NSSet *galleryImage;
 @property (nonatomic, retain) NSSet *history;
 @property (nonatomic, retain) NSSet *saved;
diff --git a/wikipedia/Data/Model/Article.m b/wikipedia/Data/Model/Article.m
index 62d0fd6..464985a 100644
--- a/wikipedia/Data/Model/Article.m
+++ b/wikipedia/Data/Model/Article.m
@@ -1,5 +1,10 @@
-//  Created by Monte Hurd on 5/2/14.
-//  Created by Monte Hurd on 4/29/14.
+//
+//  Article.m
+//  Wikipedia
+//
+//  Created by Brion on 6/24/14.
+//  Copyright (c) 2014 Wikimedia Foundation. All rights reserved.
+//
 
 #import "Article.h"
 #import "GalleryImage.h"
@@ -11,6 +16,7 @@
 
 @implementation Article
 
+@dynamic articleId;
 @dynamic dateCreated;
 @dynamic domain;
 @dynamic domainName;
@@ -23,7 +29,9 @@
 @dynamic redirected;
 @dynamic site;
 @dynamic title;
-@dynamic articleId;
+@dynamic protectionStatus;
+@dynamic editable;
+@dynamic displayTitle;
 @dynamic galleryImage;
 @dynamic history;
 @dynamic saved;
diff --git a/wikipedia/Data/Model/ArticleData.xcdatamodeld/.xccurrentversion 
b/wikipedia/Data/Model/ArticleData.xcdatamodeld/.xccurrentversion
new file mode 100644
index 0000000..fd94876
--- /dev/null
+++ b/wikipedia/Data/Model/ArticleData.xcdatamodeld/.xccurrentversion
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" 
"http://www.apple.com/DTDs/PropertyList-1.0.dtd";>
+<plist version="1.0">
+<dict>
+       <key>_XCCurrentVersionName</key>
+       <string>ArticleData 2.xcdatamodel</string>
+</dict>
+</plist>
diff --git a/wikipedia/Data/Model/ArticleData.xcdatamodeld/ArticleData 
2.xcdatamodel/contents 
b/wikipedia/Data/Model/ArticleData.xcdatamodeld/ArticleData 
2.xcdatamodel/contents
new file mode 100644
index 0000000..16915cf
--- /dev/null
+++ b/wikipedia/Data/Model/ArticleData.xcdatamodeld/ArticleData 
2.xcdatamodel/contents
@@ -0,0 +1,100 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<model userDefinedModelVersionIdentifier="" 
type="com.apple.IDECoreDataModeler.DataModel" documentVersion="1.0" 
lastSavedToolsVersion="5064" systemVersion="13D65" minimumToolsVersion="Xcode 
4.3" macOSVersion="Automatic" iOSVersion="Automatic">
+    <entity name="Article" representedClassName="Article" syncable="YES">
+        <attribute name="articleId" attributeType="Integer 64" 
defaultValueString="0" indexed="YES" syncable="YES"/>
+        <attribute name="dateCreated" attributeType="Date" indexed="YES" 
syncable="YES"/>
+        <attribute name="displayTitle" optional="YES" attributeType="String" 
syncable="YES"/>
+        <attribute name="domain" attributeType="String" indexed="YES" 
syncable="YES"/>
+        <attribute name="domainName" attributeType="String" indexed="YES" 
syncable="YES"/>
+        <attribute name="editable" optional="YES" attributeType="Boolean" 
syncable="YES"/>
+        <attribute name="languagecount" attributeType="Integer 16" 
defaultValueString="1" syncable="YES"/>
+        <attribute name="lastmodified" optional="YES" attributeType="Date" 
indexed="YES" syncable="YES"/>
+        <attribute name="lastmodifiedby" attributeType="String" indexed="YES" 
syncable="YES"/>
+        <attribute name="lastScrollX" optional="YES" attributeType="Float" 
defaultValueString="0.0" syncable="YES"/>
+        <attribute name="lastScrollY" optional="YES" attributeType="Float" 
defaultValueString="0.0" syncable="YES"/>
+        <attribute name="needsRefresh" attributeType="Boolean" 
defaultValueString="NO" indexed="YES" syncable="YES"/>
+        <attribute name="protectionStatus" optional="YES" 
attributeType="String" syncable="YES"/>
+        <attribute name="redirected" attributeType="String" syncable="YES"/>
+        <attribute name="site" attributeType="String" indexed="YES" 
syncable="YES"/>
+        <attribute name="title" attributeType="String" indexed="YES" 
syncable="YES"/>
+        <relationship name="galleryImage" optional="YES" toMany="YES" 
deletionRule="Cascade" destinationEntity="GalleryImage" inverseName="article" 
inverseEntity="GalleryImage" syncable="YES"/>
+        <relationship name="history" optional="YES" toMany="YES" 
deletionRule="Cascade" destinationEntity="History" inverseName="article" 
inverseEntity="History" syncable="YES"/>
+        <relationship name="saved" optional="YES" toMany="YES" 
deletionRule="Cascade" destinationEntity="Saved" inverseName="article" 
inverseEntity="Saved" syncable="YES"/>
+        <relationship name="section" optional="YES" toMany="YES" 
deletionRule="Cascade" destinationEntity="Section" inverseName="article" 
inverseEntity="Section" syncable="YES"/>
+        <relationship name="thumbnailImage" optional="YES" maxCount="1" 
deletionRule="Nullify" destinationEntity="Image" inverseName="article" 
inverseEntity="Image" syncable="YES"/>
+    </entity>
+    <entity name="DiscoveryContext" representedClassName="DiscoveryContext" 
syncable="YES">
+        <attribute name="isPrefix" optional="YES" attributeType="Boolean" 
syncable="YES"/>
+        <attribute name="text" optional="YES" attributeType="String" 
syncable="YES"/>
+        <relationship name="history" maxCount="1" deletionRule="Nullify" 
destinationEntity="History" inverseName="discoveryContext" 
inverseEntity="History" syncable="YES"/>
+    </entity>
+    <entity name="GalleryImage" representedClassName="GalleryImage" 
syncable="YES">
+        <attribute name="index" attributeType="Integer 32" 
defaultValueString="0" indexed="YES" syncable="YES"/>
+        <relationship name="article" optional="YES" maxCount="1" 
deletionRule="Nullify" destinationEntity="Article" inverseName="galleryImage" 
inverseEntity="Article" syncable="YES"/>
+        <relationship name="image" maxCount="1" deletionRule="Nullify" 
destinationEntity="Image" inverseName="galleryImage" inverseEntity="Image" 
syncable="YES"/>
+    </entity>
+    <entity name="History" representedClassName="History" syncable="YES">
+        <attribute name="dateVisited" optional="YES" attributeType="Date" 
indexed="YES" syncable="YES"/>
+        <attribute name="discoveryMethod" attributeType="String" indexed="YES" 
syncable="YES"/>
+        <relationship name="article" maxCount="1" deletionRule="Nullify" 
destinationEntity="Article" inverseName="history" inverseEntity="Article" 
syncable="YES"/>
+        <relationship name="discoveryContext" optional="YES" toMany="YES" 
deletionRule="Cascade" destinationEntity="DiscoveryContext" 
inverseName="history" inverseEntity="DiscoveryContext" syncable="YES"/>
+    </entity>
+    <entity name="Image" representedClassName="Image" syncable="YES">
+        <attribute name="alt" optional="YES" attributeType="String" 
syncable="YES"/>
+        <attribute name="dataSize" attributeType="Integer 32" 
defaultValueString="0" indexed="YES" syncable="YES"/>
+        <attribute name="dateLastAccessed" attributeType="Date" indexed="YES" 
syncable="YES"/>
+        <attribute name="dateRetrieved" attributeType="Date" indexed="YES" 
syncable="YES"/>
+        <attribute name="extension" attributeType="String" indexed="YES" 
syncable="YES"/>
+        <attribute name="fileName" attributeType="String" indexed="YES" 
syncable="YES"/>
+        <attribute name="fileNameNoSizePrefix" attributeType="String" 
indexed="YES" syncable="YES"/>
+        <attribute name="height" optional="YES" attributeType="Float" 
defaultValueString="0.0" syncable="YES"/>
+        <attribute name="imageDescription" optional="YES" 
attributeType="String" syncable="YES"/>
+        <attribute name="mimeType" attributeType="String" indexed="YES" 
syncable="YES"/>
+        <attribute name="sourceUrl" attributeType="String" indexed="YES" 
syncable="YES"/>
+        <attribute name="width" optional="YES" attributeType="Float" 
defaultValueString="0.0" syncable="YES"/>
+        <relationship name="article" optional="YES" toMany="YES" 
deletionRule="Nullify" destinationEntity="Article" inverseName="thumbnailImage" 
inverseEntity="Article" syncable="YES"/>
+        <relationship name="galleryImage" optional="YES" toMany="YES" 
deletionRule="Cascade" destinationEntity="GalleryImage" inverseName="image" 
inverseEntity="GalleryImage" syncable="YES"/>
+        <relationship name="imageData" maxCount="1" deletionRule="Cascade" 
destinationEntity="ImageData" inverseName="imageData" inverseEntity="ImageData" 
syncable="YES"/>
+        <relationship name="section" optional="YES" toMany="YES" 
deletionRule="Nullify" destinationEntity="Section" inverseName="thumbnailImage" 
inverseEntity="Section" syncable="YES"/>
+        <relationship name="sectionImage" optional="YES" toMany="YES" 
deletionRule="Cascade" destinationEntity="SectionImage" inverseName="image" 
inverseEntity="SectionImage" syncable="YES"/>
+    </entity>
+    <entity name="ImageData" representedClassName="ImageData" syncable="YES">
+        <attribute name="data" attributeType="Binary" 
allowsExternalBinaryDataStorage="YES" syncable="YES"/>
+        <relationship name="imageData" maxCount="1" deletionRule="Nullify" 
destinationEntity="Image" inverseName="imageData" inverseEntity="Image" 
syncable="YES"/>
+    </entity>
+    <entity name="Saved" representedClassName="Saved" syncable="YES">
+        <attribute name="dateSaved" optional="YES" attributeType="Date" 
indexed="YES" syncable="YES"/>
+        <relationship name="article" maxCount="1" deletionRule="Nullify" 
destinationEntity="Article" inverseName="saved" inverseEntity="Article" 
syncable="YES"/>
+    </entity>
+    <entity name="Section" representedClassName="Section" syncable="YES">
+        <attribute name="anchor" attributeType="String" syncable="YES"/>
+        <attribute name="dateRetrieved" attributeType="Date" indexed="YES" 
syncable="YES"/>
+        <attribute name="fromTitle" optional="YES" attributeType="String" 
syncable="YES"/>
+        <attribute name="html" optional="YES" attributeType="String" 
syncable="YES"/>
+        <attribute name="index" optional="YES" attributeType="String" 
indexed="YES" syncable="YES"/>
+        <attribute name="level" optional="YES" attributeType="String" 
indexed="YES" syncable="YES"/>
+        <attribute name="number" optional="YES" attributeType="String" 
indexed="YES" syncable="YES"/>
+        <attribute name="sectionId" attributeType="Integer 16" 
defaultValueString="0" indexed="YES" syncable="YES"/>
+        <attribute name="title" optional="YES" attributeType="String" 
syncable="YES"/>
+        <attribute name="tocLevel" optional="YES" attributeType="Integer 16" 
defaultValueString="0" indexed="YES" syncable="YES"/>
+        <relationship name="article" maxCount="1" deletionRule="Nullify" 
destinationEntity="Article" inverseName="section" inverseEntity="Article" 
syncable="YES"/>
+        <relationship name="sectionImage" optional="YES" toMany="YES" 
deletionRule="Cascade" destinationEntity="SectionImage" inverseName="section" 
inverseEntity="SectionImage" syncable="YES"/>
+        <relationship name="thumbnailImage" optional="YES" maxCount="1" 
deletionRule="Nullify" destinationEntity="Image" inverseName="section" 
inverseEntity="Image" syncable="YES"/>
+    </entity>
+    <entity name="SectionImage" representedClassName="SectionImage" 
syncable="YES">
+        <attribute name="index" attributeType="Integer 32" 
defaultValueString="0" indexed="YES" syncable="YES"/>
+        <relationship name="image" maxCount="1" deletionRule="Nullify" 
destinationEntity="Image" inverseName="sectionImage" inverseEntity="Image" 
syncable="YES"/>
+        <relationship name="section" maxCount="1" deletionRule="Nullify" 
destinationEntity="Section" inverseName="sectionImage" inverseEntity="Section" 
syncable="YES"/>
+    </entity>
+    <elements>
+        <element name="Article" positionX="-72" positionY="-603" width="128" 
height="358"/>
+        <element name="DiscoveryContext" positionX="313" positionY="-675" 
width="128" height="90"/>
+        <element name="GalleryImage" positionX="-297" positionY="-144" 
width="128" height="90"/>
+        <element name="History" positionX="135" positionY="-738" width="128" 
height="105"/>
+        <element name="Image" positionX="135" positionY="-361" width="128" 
height="298"/>
+        <element name="ImageData" positionX="324" positionY="-297" width="128" 
height="73"/>
+        <element name="Saved" positionX="252" positionY="-513" width="128" 
height="75"/>
+        <element name="Section" positionX="-252" positionY="-27" width="128" 
height="238"/>
+        <element name="SectionImage" positionX="268" positionY="-88" 
width="128" height="88"/>
+    </elements>
+</model>
\ No newline at end of file
diff --git 
a/wikipedia/Data/Model/ArticleData.xcdatamodeld/ArticleData.xcdatamodel/contents
 
b/wikipedia/Data/Model/ArticleData.xcdatamodeld/ArticleData.xcdatamodel/contents
index 2762208..9c8ffe3 100644
--- 
a/wikipedia/Data/Model/ArticleData.xcdatamodeld/ArticleData.xcdatamodel/contents
+++ 
b/wikipedia/Data/Model/ArticleData.xcdatamodeld/ArticleData.xcdatamodel/contents
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
-<model userDefinedModelVersionIdentifier="" 
type="com.apple.IDECoreDataModeler.DataModel" documentVersion="1.0" 
lastSavedToolsVersion="5064" systemVersion="13C1021" minimumToolsVersion="Xcode 
4.3" macOSVersion="Automatic" iOSVersion="Automatic">
+<model userDefinedModelVersionIdentifier="" 
type="com.apple.IDECoreDataModeler.DataModel" documentVersion="1.0" 
lastSavedToolsVersion="5064" systemVersion="13D65" minimumToolsVersion="Xcode 
4.3" macOSVersion="Automatic" iOSVersion="Automatic">
     <entity name="Article" representedClassName="Article" syncable="YES">
         <attribute name="articleId" attributeType="Integer 64" 
defaultValueString="0" indexed="YES" syncable="YES"/>
         <attribute name="dateCreated" attributeType="Date" indexed="YES" 
syncable="YES"/>
diff --git a/wikipedia/Data/Operations/DownloadSectionsOp.m 
b/wikipedia/Data/Operations/DownloadSectionsOp.m
index 2d35e3d..8ca9423 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",
+          @"prop": 
@"sections|text|lastmodified|lastmodifiedby|languagecount|id|protection|editable",
           @"sectionprop": @"toclevel|line|anchor|level|number|fromtitle|index",
           @"noheadings": @"true",
           @"page": title,
@@ -127,6 +127,15 @@
             
             NSNumber *articleId = weakSelf.jsonRetrieved[@"mobileview"][@"id"];
             if (!articleId || [articleId isNull]) articleId = @0;
+            
+            NSNumber *editable = 
weakSelf.jsonRetrieved[@"mobileview"][@"editable"];
+            if (!editable || [editable isNull]) editable = @NO;
+            
+            NSDictionary *protection = 
weakSelf.jsonRetrieved[@"mobileview"][@"protection"];
+            NSString *protectionStatus = @"";
+            if (protection && protection[@"edit"]) {
+                protectionStatus = protection[@"edit"][0];
+            }
 
             NSMutableDictionary *output = @{
                                             @"sections": outputSections,
@@ -134,7 +143,9 @@
                                             @"lastmodifiedby": lastmodifiedby,
                                             @"redirected": redirected,
                                             @"languagecount": languagecount,
-                                            @"articleId": articleId
+                                            @"articleId": articleId,
+                                            @"editable": editable,
+                                            @"protectionStatus": 
protectionStatus
                                             }.mutableCopy;
 
 
diff --git a/wikipedia/EventLogging/ProtectedEditAttemptFunnel.m 
b/wikipedia/EventLogging/ProtectedEditAttemptFunnel.m
index 1d675d3..1e6a55b 100644
--- a/wikipedia/EventLogging/ProtectedEditAttemptFunnel.m
+++ b/wikipedia/EventLogging/ProtectedEditAttemptFunnel.m
@@ -20,7 +20,7 @@
 
 -(void)logProtectionStatus:(NSString *)protectionStatus
 {
-    // @fixme fill this out once we're actually checking status
+    [self log:@{@"protectionStatus": protectionStatus}];
 }
 
 @end
diff --git a/wikipedia/View Controllers/WebView/WebViewController.m 
b/wikipedia/View Controllers/WebView/WebViewController.m
index b97011c..0f7c6ec 100644
--- a/wikipedia/View Controllers/WebView/WebViewController.m
+++ b/wikipedia/View Controllers/WebView/WebViewController.m
@@ -1307,6 +1307,9 @@
         article.lastmodified = dataRetrieved[@"lastmodified"];
         article.lastmodifiedby = dataRetrieved[@"lastmodifiedby"];
         article.articleId = dataRetrieved[@"articleId"];
+        article.editable = dataRetrieved[@"editable"];
+        article.protectionStatus = dataRetrieved[@"protectionStatus"];
+
 
         // Note: Because "retrieveArticleForPageTitle" recurses with the 
redirected-to title if
         // the lead section op determines a redirect occurred, the 
"redirected" value below will
@@ -1368,6 +1371,9 @@
         section0.html = section0HTML;
         section0.anchor = @"";
         article.section = [NSSet setWithObjects:section0, nil];
+
+        // Save page properties
+                                     // @FIXME
 
         // Don't add multiple history items for the same article or 
back-forward button
         // behavior becomes a confusing mess.
@@ -1449,6 +1455,7 @@
     NSNumber *langCount = article.languagecount;
     NSDate *lastModified = article.lastmodified;
     NSString *lastModifiedBy = article.lastmodifiedby;
+    BOOL editable = article.editableBool;
     
     [self.bottomMenuViewController updateBottomBarButtonsEnabledState];
 
@@ -1516,6 +1523,10 @@
         [self.bridge sendMessage:@"append" withPayload:@{@"html": htmlStr}];
         // Note: we set the scroll position later, after the size has been 
calculated
         
+        if (!editable) {
+            [self.bridge sendMessage:@"setPageProtected" withPayload:@{}];
+        }
+        
         if ([self tocDrawerIsOpen]) {
             // Drawer is already open, so just refresh the toc quickly w/o 
animation.
             // Make sure "tocShowWithDuration:" is allowed to happen even if 
the TOC
diff --git a/wikipedia/assets/bundle.js b/wikipedia/assets/bundle.js
index 67f2be4..340f97b 100644
--- a/wikipedia/assets/bundle.js
+++ b/wikipedia/assets/bundle.js
@@ -171,6 +171,10 @@
     window.scroll( 0, rect.top );
 });
 
+bridge.registerListener( "setPageProtected", function() {
+    document.getElementsByTagName( "html" )[0].classList.add( "page-protected" 
);
+} );
+
 /**
  * Quickie function to walk from the current element up to parents and match 
CSS-ish selectors.
  * Think of it as a reverse element.querySelector :)
@@ -343,4 +347,4 @@
     }
 }
 
-},{}]},{},[1,2,3,4,5])
+},{}]},{},[1,2,3,4,5])
\ No newline at end of file
diff --git a/www/js/listeners.js b/www/js/listeners.js
index 7c2e742..8a475e3 100644
--- a/www/js/listeners.js
+++ b/www/js/listeners.js
@@ -75,6 +75,10 @@
     window.scroll( 0, rect.top );
 });
 
+bridge.registerListener( "setPageProtected", function() {
+    document.getElementsByTagName( "html" )[0].classList.add( "page-protected" 
);
+} );
+
 /**
  * Quickie function to walk from the current element up to parents and match 
CSS-ish selectors.
  * Think of it as a reverse element.querySelector :)

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I894850b27e18eb150e98ad516b6a93def748c53e
Gerrit-PatchSet: 1
Gerrit-Project: apps/ios/wikipedia
Gerrit-Branch: master
Gerrit-Owner: Brion VIBBER <br...@wikimedia.org>

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

Reply via email to