Fjalapeno has uploaded a new change for review.
https://gerrit.wikimedia.org/r/199300
Change subject: Add progress line to data migration
......................................................................
Add progress line to data migration
Change-Id: I3170de637aa3a194e2566be2c41bfa8c780f3710
---
M wikipedia/Custom Views/WMFProgressLineView.m
M wikipedia/View Controllers/DataMigration/DataMigrationProgressViewController.h
M wikipedia/View Controllers/DataMigration/DataMigrationProgressViewController.m
M wikipedia/View
Controllers/DataMigration/DataMigrationProgressViewController.xib
4 files changed, 59 insertions(+), 18 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/apps/ios/wikipedia
refs/changes/00/199300/1
diff --git a/wikipedia/Custom Views/WMFProgressLineView.m b/wikipedia/Custom
Views/WMFProgressLineView.m
index 974bca5..b9c5c43 100644
--- a/wikipedia/Custom Views/WMFProgressLineView.m
+++ b/wikipedia/Custom Views/WMFProgressLineView.m
@@ -15,17 +15,31 @@
- (instancetype)initWithFrame:(CGRect)frame {
if (self = [super initWithFrame:frame]) {
- self.frame = frame;
- self.clipsToBounds = YES;
- self.backgroundColor = [UIColor clearColor];
- self.progressBar = [[UIView alloc] init];
- self.progressBar.backgroundColor = [UIColor colorWithRed:0.106
green:0.682 blue:0.541 alpha:1];
- self.progress = 0.0;
- [self addSubview:self.progressBar];
+ self.frame = frame;
+ [self setup];
}
return self;
}
+- (void)awakeFromNib{
+
+ [super awakeFromNib];
+ [self setup];
+}
+
+
+- (void)setup{
+
+ self.clipsToBounds = YES;
+ self.backgroundColor = [UIColor clearColor];
+ self.progressBar = [[UIView alloc] init];
+ self.progressBar.backgroundColor = [UIColor colorWithRed:0.106 green:0.682
blue:0.541 alpha:1];
+ self.progress = 0.0;
+ [self addSubview:self.progressBar];
+
+}
+
+
- (void)setFrame:(CGRect)frame {
//whole pixels for non-retina screens
frame.origin.y = ceilf(frame.origin.y);
diff --git a/wikipedia/View
Controllers/DataMigration/DataMigrationProgressViewController.h
b/wikipedia/View Controllers/DataMigration/DataMigrationProgressViewController.h
index 57c928f..450eb40 100644
--- a/wikipedia/View
Controllers/DataMigration/DataMigrationProgressViewController.h
+++ b/wikipedia/View
Controllers/DataMigration/DataMigrationProgressViewController.h
@@ -10,6 +10,7 @@
#import <MessageUI/MessageUI.h>
@class DataMigrationProgressViewController;
+@class WMFProgressLineView;
@protocol DataMigrationProgressDelegete
-
(void)dataMigrationProgressComplete:(DataMigrationProgressViewController*)viewController;
@@ -18,7 +19,7 @@
@interface DataMigrationProgressViewController : UIViewController
<UIActionSheetDelegate, MFMailComposeViewControllerDelegate>
-@property (weak, nonatomic) IBOutlet UIActivityIndicatorView*
progressIndicator;
+@property (weak, nonatomic) IBOutlet WMFProgressLineView* progressIndicator;
@property (weak, nonatomic) IBOutlet UILabel* progressLabel;
@property (weak, nonatomic) id<DataMigrationProgressDelegete> delegate;
diff --git a/wikipedia/View
Controllers/DataMigration/DataMigrationProgressViewController.m
b/wikipedia/View Controllers/DataMigration/DataMigrationProgressViewController.m
index d423eb1..4569fc7 100644
--- a/wikipedia/View
Controllers/DataMigration/DataMigrationProgressViewController.m
+++ b/wikipedia/View
Controllers/DataMigration/DataMigrationProgressViewController.m
@@ -17,6 +17,7 @@
#import "ArticleImporter.h"
#import "WikipediaAppUtils.h"
+#import "WMFProgressLineView.h"
enum {
BUTTON_INDEX_DISCARD = 0,
@@ -83,6 +84,9 @@
// Middle-Ages Converter
// From the native app's initial CoreData-based implementation,
// which now lives in OldDataSchema subproject.
+
+ self.progressIndicator.progress = 0.0;
+
SchemaConverter* schemaConverter = [[SchemaConverter alloc]
initWithDataStore:[SessionSingleton sharedInstance].dataStore];
self.oldDataSchema.delegate = schemaConverter;
self.oldDataSchema.progressDelegate = self;
@@ -95,6 +99,9 @@
// Ye Ancient Converter
// From the old PhoneGap app
// @fixme: fix this to work again
+
+ self.progressIndicator.progress = 0.0;
+
NSLog(@"Old data to migrate found!");
NSArray* titles = [self.dataMigrator extractSavedPages];
ArticleImporter* importer = [[ArticleImporter alloc] init];
@@ -106,6 +113,8 @@
[importer importArticles:titles];
[self.dataMigrator removeOldData];
+
+ [self.progressIndicator setProgress:1.0 animated:YES completion:NULL];
}
- (void)oldDataSchema:(OldDataSchemaMigrator*)schema
didUpdateProgressWithArticlesCompleted:(NSUInteger)completed
total:(NSUInteger)total {
@@ -120,20 +129,32 @@
NSString* progressString = [NSString stringWithFormat:@"%@\n%@", lineOne,
lineTwo];
self.progressLabel.text = progressString;
+
+ [self.progressIndicator setProgress:((float)completed/(float)total)
animated:YES];
}
- (void)oldDataSchemaDidFinishMigration:(OldDataSchemaMigrator *)schema{
[[SessionSingleton sharedInstance].userDataStore reset];
- [self.delegate dataMigrationProgressComplete:self];
NSLog(@"end migration");
+
+ [self.progressIndicator setProgress:1.0 animated:YES completion:^{
+
+ [self.delegate dataMigrationProgressComplete:self];
+ }];
}
-(void)oldDataSchema:(OldDataSchemaMigrator *)schema
didFinishWithError:(NSError*)error{
+
[self displayErrorCondition];
- [self.delegate dataMigrationProgressComplete:self];
NSLog(@"end migration");
+
+ [self.progressIndicator setProgress:1.0 animated:YES completion:^{
+
+ [self.delegate dataMigrationProgressComplete:self];
+ }];
+
}
- (void)displayErrorCondition {
diff --git a/wikipedia/View
Controllers/DataMigration/DataMigrationProgressViewController.xib
b/wikipedia/View
Controllers/DataMigration/DataMigrationProgressViewController.xib
index 0a0dd30..ac5e1a6 100644
--- a/wikipedia/View
Controllers/DataMigration/DataMigrationProgressViewController.xib
+++ b/wikipedia/View
Controllers/DataMigration/DataMigrationProgressViewController.xib
@@ -5,9 +5,9 @@
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin"
version="6736"/>
</dependencies>
<objects>
- <placeholder placeholderIdentifier="IBFilesOwner" id="-1"
userLabel="File's Owner" customClass="DataMigrationProgress">
+ <placeholder placeholderIdentifier="IBFilesOwner" id="-1"
userLabel="File's Owner" customClass="DataMigrationProgressViewController">
<connections>
- <outlet property="progressIndicator" destination="59a-LK-cye"
id="lQE-94-AB0"/>
+ <outlet property="progressIndicator" destination="GeP-Ts-2S2"
id="n9q-dL-QWa"/>
<outlet property="progressLabel" destination="9Bj-11-8XX"
id="ek2-9N-3Sx"/>
<outlet property="view" destination="i5M-Pr-FkT"
id="sfx-zR-JGt"/>
</connections>
@@ -17,22 +17,27 @@
<rect key="frame" x="0.0" y="0.0" width="320" height="568"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES"
heightSizable="YES"/>
<subviews>
- <activityIndicatorView opaque="NO" contentMode="scaleToFill"
horizontalHuggingPriority="750" verticalHuggingPriority="750"
hidesWhenStopped="YES" animating="YES" style="gray"
translatesAutoresizingMaskIntoConstraints="NO" id="59a-LK-cye">
- <rect key="frame" x="150" y="274" width="20" height="20"/>
- </activityIndicatorView>
<label opaque="NO" userInteractionEnabled="NO"
contentMode="left" horizontalHuggingPriority="251"
verticalHuggingPriority="251" text="3 / 40 Imported" textAlignment="center"
lineBreakMode="tailTruncation" numberOfLines="0"
baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO"
translatesAutoresizingMaskIntoConstraints="NO" id="9Bj-11-8XX">
<rect key="frame" x="101" y="233" width="118.5"
height="20.5"/>
<fontDescription key="fontDescription" type="system"
pointSize="17"/>
<color key="textColor"
cocoaTouchSystemColor="darkTextColor"/>
<nil key="highlightedColor"/>
</label>
+ <view contentMode="scaleToFill"
translatesAutoresizingMaskIntoConstraints="NO" id="GeP-Ts-2S2"
customClass="WMFProgressLineView">
+ <rect key="frame" x="8" y="277" width="304" height="4"/>
+ <color key="backgroundColor" white="1" alpha="1"
colorSpace="calibratedWhite"/>
+ <constraints>
+ <constraint firstAttribute="height" constant="4"
id="h2T-Cl-4kv"/>
+ </constraints>
+ </view>
</subviews>
<color key="backgroundColor" white="1" alpha="1"
colorSpace="custom" customColorSpace="calibratedWhite"/>
<constraints>
- <constraint firstItem="59a-LK-cye" firstAttribute="top"
secondItem="9Bj-11-8XX" secondAttribute="bottom" constant="20" id="6hU-0D-UYa"/>
- <constraint firstAttribute="centerY" secondItem="59a-LK-cye"
secondAttribute="centerY" id="N5m-um-eCk"/>
- <constraint firstAttribute="centerX" secondItem="59a-LK-cye"
secondAttribute="centerX" id="N9Z-be-UDt"/>
+ <constraint firstAttribute="bottom" secondItem="GeP-Ts-2S2"
secondAttribute="bottom" constant="287" id="5k4-X3-Pyv"/>
+ <constraint firstItem="GeP-Ts-2S2" firstAttribute="top"
secondItem="9Bj-11-8XX" secondAttribute="bottom" constant="23.5"
id="G01-bV-XBG"/>
<constraint firstAttribute="centerX" secondItem="9Bj-11-8XX"
secondAttribute="centerX" id="cRM-yQ-ug6"/>
+ <constraint firstItem="GeP-Ts-2S2" firstAttribute="leading"
secondItem="i5M-Pr-FkT" secondAttribute="leading" constant="8" id="d9q-M6-Shg"/>
+ <constraint firstAttribute="trailing" secondItem="GeP-Ts-2S2"
secondAttribute="trailing" constant="8" id="dZQ-oA-Doj"/>
</constraints>
<point key="canvasLocation" x="673" y="442"/>
</view>
--
To view, visit https://gerrit.wikimedia.org/r/199300
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I3170de637aa3a194e2566be2c41bfa8c780f3710
Gerrit-PatchSet: 1
Gerrit-Project: apps/ios/wikipedia
Gerrit-Branch: master
Gerrit-Owner: Fjalapeno <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits