You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@weex.apache.org by ac...@apache.org on 2017/08/22 08:28:03 UTC

[2/3] incubator-weex git commit: * [ios] change the class name of section component

* [ios] change the class name of section component


Project: http://git-wip-us.apache.org/repos/asf/incubator-weex/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-weex/commit/9710aa90
Tree: http://git-wip-us.apache.org/repos/asf/incubator-weex/tree/9710aa90
Diff: http://git-wip-us.apache.org/repos/asf/incubator-weex/diff/9710aa90

Branch: refs/heads/0.16-dev
Commit: 9710aa9000cd59d9619a04833ee587f61a41b17e
Parents: c1f2357
Author: acton393 <zh...@gmail.com>
Authored: Tue Aug 22 10:48:13 2017 +0800
Committer: acton393 <zh...@gmail.com>
Committed: Tue Aug 22 10:48:13 2017 +0800

----------------------------------------------------------------------
 .../WeexSDK/Sources/Component/WXListComponent.m | 52 ++++++++++----------
 1 file changed, 26 insertions(+), 26 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/9710aa90/ios/sdk/WeexSDK/Sources/Component/WXListComponent.m
----------------------------------------------------------------------
diff --git a/ios/sdk/WeexSDK/Sources/Component/WXListComponent.m b/ios/sdk/WeexSDK/Sources/Component/WXListComponent.m
index 3ce67ce..4db1c2f 100644
--- a/ios/sdk/WeexSDK/Sources/Component/WXListComponent.m
+++ b/ios/sdk/WeexSDK/Sources/Component/WXListComponent.m
@@ -64,15 +64,15 @@
 
 @end
 
-
-@interface WXSection : NSObject<NSCopying>
+// WXText is a non-public is not permitted
+@interface WXSectionComponent : NSObject<NSCopying>
 
 @property (nonatomic, strong) WXHeaderComponent *header;
 @property (nonatomic, strong) NSMutableArray<WXCellComponent *> *rows;
 
 @end
 
-@implementation WXSection
+@implementation WXSectionComponent
 
 - (instancetype)init
 {
@@ -85,7 +85,7 @@
 
 - (id)copyWithZone:(NSZone *)zone
 {
-    WXSection *newSection = [[[self class] allocWithZone:zone] init];
+    WXSectionComponent *newSection = [[[self class] allocWithZone:zone] init];
     newSection.header = _header;
     newSection.rows = [_rows mutableCopyWithZone:zone];
     
@@ -109,9 +109,9 @@
     __weak UITableView * _tableView;
 
     // Only accessed on component thread
-    NSMutableArray<WXSection *> *_sections;
+    NSMutableArray<WXSectionComponent *> *_sections;
     // Only accessed on main thread
-    NSMutableArray<WXSection *> *_completedSections;
+    NSMutableArray<WXSectionComponent *> *_completedSections;
     NSUInteger _previousLoadMoreRowNumber;
     
     BOOL _isUpdating;
@@ -247,7 +247,7 @@
     if ([subcomponent isKindOfClass:[WXHeaderComponent class]] || _sections.count <= indexPath.section) {
         // conditions to insert section: insert a header or insert first cell of table view
         // this will be updated by recycler's update controller in the future
-        WXSection *insertSection = [WXSection new];
+        WXSectionComponent *insertSection = [WXSectionComponent new];
         BOOL keepScrollPosition = NO;
         if ([subcomponent isKindOfClass:[WXHeaderComponent class]]) {
             WXHeaderComponent *header = (WXHeaderComponent*)subcomponent;
@@ -256,7 +256,7 @@
         }
         
         NSUInteger insertIndex = indexPath.section;
-        WXSection *reloadSection;
+        WXSectionComponent *reloadSection;
         if (insertIndex > 0 && insertIndex <= _sections.count
             && [subcomponent isKindOfClass:[WXHeaderComponent class]]) {
             // insert a header in the middle, one section may divide into two
@@ -271,8 +271,8 @@
         }
     
         [_sections insertObject:insertSection atIndex:insertIndex];
-        WXSection *completedInsertSection = [insertSection copy];
-        WXSection *completedReloadSection;
+        WXSectionComponent *completedInsertSection = [insertSection copy];
+        WXSectionComponent *completedReloadSection;
         if (reloadSection) {
             completedReloadSection = [reloadSection copy];
         }
@@ -346,8 +346,8 @@
 {
     NSUInteger headerIndex = [self indexForHeader:header sections:_sections];
     // this will be updated by recycler's update controller in the future
-    WXSection *headerSection = _sections[headerIndex];
-    WXSection *reloadSection;
+    WXSectionComponent *headerSection = _sections[headerIndex];
+    WXSectionComponent *reloadSection;
     NSUInteger reloadIndex = -1;
     BOOL isDeleteSection = NO;
     if (headerIndex == 0 && headerSection.rows.count > 0) {
@@ -371,7 +371,7 @@
         [_sections removeObjectAtIndex:headerIndex];
     }
     
-    WXSection *completedReloadSection;
+    WXSectionComponent *completedReloadSection;
     if (reloadSection) {
         completedReloadSection = [reloadSection copy];
     }
@@ -446,7 +446,7 @@
     NSInteger sectionNum = indexPath.section;
     NSInteger row = indexPath.row;
     NSMutableArray *sections = _sections;
-    WXSection *section = sections[sectionNum];
+    WXSectionComponent *section = sections[sectionNum];
     WXAssert(section, @"no section found for section number:%ld", sectionNum);
     NSMutableArray *completedSections;
     BOOL isReload = [section.rows containsObject:cell];
@@ -608,7 +608,7 @@
 
 - (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
 {
-    WXHeaderComponent *header = ((WXSection *)[_completedSections wx_safeObjectAtIndex:section]).header;
+    WXHeaderComponent *header = ((WXSectionComponent *)[_completedSections wx_safeObjectAtIndex:section]).header;
     if (header) {
         return header.calculatedFrame.size.height;
     } else {
@@ -623,13 +623,13 @@
         NSIndexPath *topCellPath = [[_tableView indexPathsForVisibleRows] objectAtIndex:0];
         if (self.currentTopVisibleSection != topCellPath.section) {
             if (self.currentTopVisibleSection) {
-                WXSection *removeSection = [_sections wx_safeObjectAtIndex:self.currentTopVisibleSection];
+                WXSectionComponent *removeSection = [_sections wx_safeObjectAtIndex:self.currentTopVisibleSection];
                 if (removeSection.header && [removeSection.header.events containsObject:@"unsticky"]) {
                     [removeSection.header fireEvent:@"unsticky" params:nil];
                 }
             }
             self.currentTopVisibleSection = topCellPath.section;
-            WXSection *showSection = [_sections wx_safeObjectAtIndex:topCellPath.section];
+            WXSectionComponent *showSection = [_sections wx_safeObjectAtIndex:topCellPath.section];
             if (showSection.header && [showSection.header.events containsObject:@"sticky"]) {
                 [showSection.header fireEvent:@"sticky" params:nil];
             }
@@ -639,7 +639,7 @@
 
 - (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section
 {
-    WXHeaderComponent *header = ((WXSection *)_completedSections[section]).header;
+    WXHeaderComponent *header = ((WXSectionComponent *)_completedSections[section]).header;
     WXLogDebug(@"header view for section %ld:%@", (long)section, header.view);
     return header.view;
 }
@@ -653,7 +653,7 @@
 
 - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
 {
-    return ((WXSection *)[_completedSections wx_safeObjectAtIndex:section]).rows.count;
+    return ((WXSectionComponent *)[_completedSections wx_safeObjectAtIndex:section]).rows.count;
 }
 
 - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
@@ -733,7 +733,7 @@
 
 - (WXCellComponent *)cellForIndexPath:(NSIndexPath *)indexPath
 {
-    WXSection *section = [_completedSections wx_safeObjectAtIndex:indexPath.section];
+    WXSectionComponent *section = [_completedSections wx_safeObjectAtIndex:indexPath.section];
     if (!section) {
         WXLogError(@"No section found for num:%ld, completed sections:%ld", (long)indexPath.section, (unsigned long)_completedSections.count);
         return nil;
@@ -750,7 +750,7 @@
 
 - (void)insertCell:(WXCellComponent *)cell forIndexPath:(NSIndexPath *)indexPath withSections:(NSMutableArray *)sections
 {
-    WXSection *section = [sections wx_safeObjectAtIndex:indexPath.section];
+    WXSectionComponent *section = [sections wx_safeObjectAtIndex:indexPath.section];
     if (indexPath.row > [section.rows count] || indexPath.row < 0) {
         WXLogError(@"inserting cell at indexPath:%@ outof range, sections:%@", indexPath, sections);
         return;
@@ -762,7 +762,7 @@
 
 - (void)removeCellForIndexPath:(NSIndexPath *)indexPath withSections:(NSMutableArray *)sections
 {
-    WXSection *section = [sections wx_safeObjectAtIndex:indexPath.section];
+    WXSectionComponent *section = [sections wx_safeObjectAtIndex:indexPath.section];
     if (0 == [section.rows count]) {
         return;
     }
@@ -771,10 +771,10 @@
     [section.rows removeObjectAtIndex:indexPath.row];
 }
 
-- (NSIndexPath *)indexPathForCell:(WXCellComponent *)cell sections:(NSMutableArray<WXSection *> *)sections
+- (NSIndexPath *)indexPathForCell:(WXCellComponent *)cell sections:(NSMutableArray<WXSectionComponent *> *)sections
 {
     __block NSIndexPath *indexPath;
-    [sections enumerateObjectsUsingBlock:^(WXSection * _Nonnull section, NSUInteger sectionIndex, BOOL * _Nonnull sectionStop) {
+    [sections enumerateObjectsUsingBlock:^(WXSectionComponent * _Nonnull section, NSUInteger sectionIndex, BOOL * _Nonnull sectionStop) {
         [section.rows enumerateObjectsUsingBlock:^(WXCellComponent * _Nonnull row, NSUInteger rowIndex, BOOL * _Nonnull stop) {
             if (row == cell) {
                 indexPath = [NSIndexPath indexPathForRow:rowIndex inSection:sectionIndex];
@@ -787,10 +787,10 @@
     return indexPath;
 }
 
-- (NSUInteger)indexForHeader:(WXHeaderComponent *)header sections:(NSMutableArray<WXSection *> *)sections
+- (NSUInteger)indexForHeader:(WXHeaderComponent *)header sections:(NSMutableArray<WXSectionComponent *> *)sections
 {
     __block NSUInteger index;
-    [sections enumerateObjectsUsingBlock:^(WXSection * _Nonnull section, NSUInteger sectionIndex, BOOL * _Nonnull stop) {
+    [sections enumerateObjectsUsingBlock:^(WXSectionComponent * _Nonnull section, NSUInteger sectionIndex, BOOL * _Nonnull stop) {
         if (section.header == header) {
             index = sectionIndex;
             *stop = YES;