Merge branch 'charlesmchen/storageFailureAlert'

pull/1/head
Matthew Chen 8 years ago
commit b1c4dd7b55

@ -274,7 +274,10 @@ static NSString *const kURLHostVerifyPrefix = @"verify";
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
// Show the launch screen until the async database view registrations are complete. // Show the launch screen until the async database view registrations are complete.
self.window.rootViewController = [self loadingRootViewController]; //
// Note: we void using loadingRootViewController, since it will indirectly try to
// instantiate primary storage, which will fail.
self.window.rootViewController = [self loadingRootViewControllerWithShowUpgradeWarning:NO];
[self.window makeKeyAndVisible]; [self.window makeKeyAndVisible];
@ -358,9 +361,6 @@ static NSString *const kURLHostVerifyPrefix = @"verify";
- (UIViewController *)loadingRootViewController - (UIViewController *)loadingRootViewController
{ {
UIViewController *viewController =
[[UIStoryboard storyboardWithName:@"Launch Screen" bundle:nil] instantiateInitialViewController];
NSString *lastLaunchedAppVersion = AppVersion.instance.lastAppVersion; NSString *lastLaunchedAppVersion = AppVersion.instance.lastAppVersion;
NSString *lastCompletedLaunchAppVersion = AppVersion.instance.lastCompletedLaunchAppVersion; NSString *lastCompletedLaunchAppVersion = AppVersion.instance.lastCompletedLaunchAppVersion;
// Every time we change or add a database view in such a way that // Every time we change or add a database view in such a way that
@ -373,7 +373,19 @@ static NSString *const kURLHostVerifyPrefix = @"verify";
[VersionMigrations isVersion:lastCompletedLaunchAppVersion [VersionMigrations isVersion:lastCompletedLaunchAppVersion
lessThan:kLastVersionWithDatabaseViewChange])); lessThan:kLastVersionWithDatabaseViewChange]));
DDLogInfo(@"%@ mayNeedUpgrade: %d", self.logTag, mayNeedUpgrade); DDLogInfo(@"%@ mayNeedUpgrade: %d", self.logTag, mayNeedUpgrade);
if (mayNeedUpgrade) {
return [self loadingRootViewControllerWithShowUpgradeWarning:mayNeedUpgrade];
}
- (UIViewController *)loadingRootViewControllerWithShowUpgradeWarning:(BOOL)showUpgradeWarning
{
UIViewController *viewController =
[[UIStoryboard storyboardWithName:@"Launch Screen" bundle:nil] instantiateInitialViewController];
if (!showUpgradeWarning) {
return viewController;
}
UIView *rootView = viewController.view; UIView *rootView = viewController.view;
UIImageView *iconView = nil; UIImageView *iconView = nil;
for (UIView *subview in viewController.view.subviews) { for (UIView *subview in viewController.view.subviews) {
@ -384,7 +396,9 @@ static NSString *const kURLHostVerifyPrefix = @"verify";
} }
if (!iconView) { if (!iconView) {
OWSFail(@"Database view registration overlay has unexpected contents."); OWSFail(@"Database view registration overlay has unexpected contents.");
} else { return viewController;
}
UILabel *bottomLabel = [UILabel new]; UILabel *bottomLabel = [UILabel new];
bottomLabel.text = NSLocalizedString( bottomLabel.text = NSLocalizedString(
@"DATABASE_VIEW_OVERLAY_SUBTITLE", @"Subtitle shown while the app is updating its database."); @"DATABASE_VIEW_OVERLAY_SUBTITLE", @"Subtitle shown while the app is updating its database.");
@ -396,8 +410,8 @@ static NSString *const kURLHostVerifyPrefix = @"verify";
[rootView addSubview:bottomLabel]; [rootView addSubview:bottomLabel];
UILabel *topLabel = [UILabel new]; UILabel *topLabel = [UILabel new];
topLabel.text = NSLocalizedString( topLabel.text
@"DATABASE_VIEW_OVERLAY_TITLE", @"Title shown while the app is updating its database."); = NSLocalizedString(@"DATABASE_VIEW_OVERLAY_TITLE", @"Title shown while the app is updating its database.");
topLabel.font = [UIFont ows_mediumFontWithSize:20.f]; topLabel.font = [UIFont ows_mediumFontWithSize:20.f];
topLabel.textColor = [UIColor whiteColor]; topLabel.textColor = [UIColor whiteColor];
topLabel.numberOfLines = 0; topLabel.numberOfLines = 0;
@ -409,8 +423,6 @@ static NSString *const kURLHostVerifyPrefix = @"verify";
[topLabel autoPinWidthToSuperviewWithMargin:20.f]; [topLabel autoPinWidthToSuperviewWithMargin:20.f];
[bottomLabel autoPinEdge:ALEdgeTop toEdge:ALEdgeBottom ofView:topLabel withOffset:10.f]; [bottomLabel autoPinEdge:ALEdgeTop toEdge:ALEdgeBottom ofView:topLabel withOffset:10.f];
[iconView autoPinEdge:ALEdgeTop toEdge:ALEdgeBottom ofView:bottomLabel withOffset:40.f]; [iconView autoPinEdge:ALEdgeTop toEdge:ALEdgeBottom ofView:bottomLabel withOffset:40.f];
}
}
return viewController; return viewController;
} }

Loading…
Cancel
Save