Mhurd has uploaded a new change for review.
https://gerrit.wikimedia.org/r/192973
Change subject: Fix for entries in TOC doubling up after pull to refresh.
......................................................................
Fix for entries in TOC doubling up after pull to refresh.
Change-Id: Ie838e0109e05683a5f1ddd56950e96420ace443d
---
M MediaWikiKit/MediaWikiKit/MWKArticle.m
M MediaWikiKit/MediaWikiKit/MWKSectionList.h
M MediaWikiKit/MediaWikiKit/MWKSectionList.m
3 files changed, 7 insertions(+), 0 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/apps/ios/wikipedia
refs/changes/73/192973/1
diff --git a/MediaWikiKit/MediaWikiKit/MWKArticle.m
b/MediaWikiKit/MediaWikiKit/MWKArticle.m
index aa33a81..509cade 100644
--- a/MediaWikiKit/MediaWikiKit/MWKArticle.m
+++ b/MediaWikiKit/MediaWikiKit/MWKArticle.m
@@ -115,6 +115,7 @@
// Populate sections
NSArray *sectionsData = dict[@"sections"];
if (sectionsData && [sectionsData isKindOfClass:[NSArray class]]) {
+ [self.sections removeAllSections];
for (NSDictionary *sectionData in sectionsData) {
MWKSection *section = [[MWKSection alloc] initWithArticle:self
dict:sectionData];
[self.sections addSection:section];
diff --git a/MediaWikiKit/MediaWikiKit/MWKSectionList.h
b/MediaWikiKit/MediaWikiKit/MWKSectionList.h
index 7569743..a9ee3e5 100644
--- a/MediaWikiKit/MediaWikiKit/MWKSectionList.h
+++ b/MediaWikiKit/MediaWikiKit/MWKSectionList.h
@@ -16,6 +16,7 @@
- (MWKSection *)objectAtIndexedSubscript:(NSUInteger)idx;
-(void)addSection:(MWKSection *)section;
+-(void)removeAllSections;
- (instancetype)initWithArticle:(MWKArticle *)article;
diff --git a/MediaWikiKit/MediaWikiKit/MWKSectionList.m
b/MediaWikiKit/MediaWikiKit/MWKSectionList.m
index fcd32c8..b6e2444 100644
--- a/MediaWikiKit/MediaWikiKit/MWKSectionList.m
+++ b/MediaWikiKit/MediaWikiKit/MWKSectionList.m
@@ -84,6 +84,11 @@
[_sections addObject:section];
}
+-(void)removeAllSections
+{
+ [_sections removeAllObjects];
+}
+
-(void)save
{
for (MWKSection *section in self) {
--
To view, visit https://gerrit.wikimedia.org/r/192973
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ie838e0109e05683a5f1ddd56950e96420ace443d
Gerrit-PatchSet: 1
Gerrit-Project: apps/ios/wikipedia
Gerrit-Branch: master
Gerrit-Owner: Mhurd <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits