2
0

Theming for iOS 6, updated status hiding and more exception handling.

[ADDED]     More verbose log printing when trace enabled.
[ADDED]     More exception handling on application launch; we can't allow any of this to keep us from being able to open the emergency generator.
[UPDATED]   Only apply UI theming on iOS 6-.
[ADDED]     Modern way of hiding the status bar on iOS 7.
This commit is contained in:
Maarten Billemont 2013-08-27 23:28:10 -04:00
parent b2a608824c
commit 34645c9433
6 changed files with 181 additions and 163 deletions

2
External/Pearl vendored

@ -1 +1 @@
Subproject commit ed17f53324c5537d70cb08e25b07eb4def2eb9c5 Subproject commit 41c3582a72ddb251b9a3a055ecdad3fa49ec18f2

View File

@ -121,8 +121,9 @@
- (void)viewWillAppear:(BOOL)animated { - (void)viewWillAppear:(BOOL)animated {
[[UIApplication sharedApplication] setStatusBarHidden:NO withAnimation:UIStatusBarAnimationSlide];
[self.navigationController setNavigationBarHidden:NO animated:animated]; [self.navigationController setNavigationBarHidden:NO animated:animated];
if (![super respondsToSelector:@selector(prefersStatusBarHidden)])
[[UIApplication sharedApplication] setStatusBarHidden:NO withAnimation:UIStatusBarAnimationSlide];
MPElementEntity *activeElement = [self activeElementForMainThread]; MPElementEntity *activeElement = [self activeElementForMainThread];
if (activeElement.user != [[MPiOSAppDelegate get] activeUserForMainThread]) if (activeElement.user != [[MPiOSAppDelegate get] activeUserForMainThread])

View File

@ -202,6 +202,7 @@
inf(@"Lock screen will appear"); inf(@"Lock screen will appear");
[self.navigationController setNavigationBarHidden:YES animated:animated]; [self.navigationController setNavigationBarHidden:YES animated:animated];
if (![super respondsToSelector:@selector(prefersStatusBarHidden)])
[[UIApplication sharedApplication] setStatusBarHidden:YES withAnimation:UIStatusBarAnimationSlide]; [[UIApplication sharedApplication] setStatusBarHidden:YES withAnimation:UIStatusBarAnimationSlide];
[[MPiOSAppDelegate get] signOutAnimated:NO]; [[MPiOSAppDelegate get] signOutAnimated:NO];
@ -248,6 +249,16 @@
[super viewWillDisappear:animated]; [super viewWillDisappear:animated];
} }
- (BOOL)prefersStatusBarHidden {
return YES;
}
- (UIStatusBarAnimation)preferredStatusBarUpdateAnimation {
return UIStatusBarAnimationSlide;
}
- (BOOL)canBecomeFirstResponder { - (BOOL)canBecomeFirstResponder {
return YES; return YES;

View File

@ -23,21 +23,21 @@
+ (void)initialize { + (void)initialize {
[MPiOSConfig get];
[PearlLogger get].historyLevel = [[MPiOSConfig get].traceMode boolValue]? PearlLogLevelTrace: PearlLogLevelInfo; [PearlLogger get].historyLevel = [[MPiOSConfig get].traceMode boolValue]? PearlLogLevelTrace: PearlLogLevelInfo;
#ifdef DEBUG #ifdef DEBUG
[PearlLogger get].printLevel = PearlLogLevelDebug; [PearlLogger get].printLevel = PearlLogLevelDebug;
//[NSClassFromString(@"WebView") performSelector:NSSelectorFromString(@"_enableRemoteInspector")]; #else
[PearlLogger get].printLevel = [[MPiOSConfig get].traceMode boolValue]? PearlLogLevelDebug: PearlLogLevelInfo;
#endif #endif
} }
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
@try {
[[[NSBundle mainBundle] mutableInfoDictionary] setObject:@"Master Password" forKey:@"CFBundleDisplayName"]; [[[NSBundle mainBundle] mutableInfoDictionary] setObject:@"Master Password" forKey:@"CFBundleDisplayName"];
[[[NSBundle mainBundle] mutableLocalizedInfoDictionary] setObject:@"Master Password" forKey:@"CFBundleDisplayName"]; [[[NSBundle mainBundle] mutableLocalizedInfoDictionary] setObject:@"Master Password" forKey:@"CFBundleDisplayName"];
#ifdef TESTFLIGHT_SDK_VERSION #ifdef TESTFLIGHT_SDK_VERSION
@try {
NSString *testFlightToken = [self testFlightToken]; NSString *testFlightToken = [self testFlightToken];
if ([testFlightToken length]) { if ([testFlightToken length]) {
inf(@"Initializing TestFlight"); inf(@"Initializing TestFlight");
@ -61,23 +61,13 @@
TFLog( @"TestFlight (%@) initialized for: %@ v%@.", // TFLog( @"TestFlight (%@) initialized for: %@ v%@.", //
TESTFLIGHT_SDK_VERSION, [PearlInfoPlist get].CFBundleName, [PearlInfoPlist get].CFBundleVersion ); TESTFLIGHT_SDK_VERSION, [PearlInfoPlist get].CFBundleName, [PearlInfoPlist get].CFBundleVersion );
} }
}
@catch (id exception) {
err(@"TestFlight: %@", exception);
}
#endif #endif
@try {
NSString *googlePlusClientID = [self googlePlusClientID]; NSString *googlePlusClientID = [self googlePlusClientID];
if ([googlePlusClientID length]) { if ([googlePlusClientID length]) {
inf(@"Initializing Google+"); inf(@"Initializing Google+");
[[GPPSignIn sharedInstance] setClientID:googlePlusClientID]; [[GPPSignIn sharedInstance] setClientID:googlePlusClientID];
} }
}
@catch (id exception) {
err(@"Google+: %@", exception);
}
#ifdef CRASHLYTICS #ifdef CRASHLYTICS
@try {
NSString *crashlyticsAPIKey = [self crashlyticsAPIKey]; NSString *crashlyticsAPIKey = [self crashlyticsAPIKey];
if ([crashlyticsAPIKey length]) { if ([crashlyticsAPIKey length]) {
inf(@"Initializing Crashlytics"); inf(@"Initializing Crashlytics");
@ -102,13 +92,8 @@
CLSLog( @"Crashlytics (%@) initialized for: %@ v%@.", // CLSLog( @"Crashlytics (%@) initialized for: %@ v%@.", //
[Crashlytics sharedInstance].version, [PearlInfoPlist get].CFBundleName, [PearlInfoPlist get].CFBundleVersion ); [Crashlytics sharedInstance].version, [PearlInfoPlist get].CFBundleName, [PearlInfoPlist get].CFBundleVersion );
} }
}
@catch (id exception) {
err(@"Crashlytics: %@", exception);
}
#endif #endif
#ifdef LOCALYTICS #ifdef LOCALYTICS
@try {
NSString *localyticsKey = [self localyticsKey]; NSString *localyticsKey = [self localyticsKey];
if ([localyticsKey length]) { if ([localyticsKey length]) {
inf(@"Initializing Localytics"); inf(@"Initializing Localytics");
@ -128,42 +113,46 @@
return YES; return YES;
}]; }];
} }
#endif
} }
@catch (id exception) { @catch (id exception) {
err(@"Localytics exception: %@", exception); err(@"During Analytics Setup: %@", exception);
} }
#endif @try {
if (floor( NSFoundationVersionNumber ) <= NSFoundationVersionNumber_iOS_6_1) {
UIImage *navBarImage = [[UIImage imageNamed:@"ui_navbar_container"] resizableImageWithCapInsets:UIEdgeInsetsMake( 0, 5, 0, 5 )];
[[UINavigationBar appearance] setBackgroundImage:navBarImage forBarMetrics:UIBarMetricsDefault];
[[UINavigationBar appearance] setBackgroundImage:navBarImage forBarMetrics:UIBarMetricsLandscapePhone];
[[UINavigationBar appearance] setTitleTextAttributes:
@{
UITextAttributeTextColor : [UIColor colorWithRed:1.0f green:1.0f blue:1.0f alpha:1.0f],
UITextAttributeTextShadowColor : [UIColor colorWithRed:0.0f green:0.0f blue:0.0f alpha:0.8f],
UITextAttributeTextShadowOffset : [NSValue valueWithUIOffset:UIOffsetMake( 0, -1 )],
UITextAttributeFont : [UIFont fontWithName:@"Exo-Bold" size:20.0f]
}];
// UIImage *navBarImage = [[UIImage imageNamed:@"ui_navbar_container"] resizableImageWithCapInsets:UIEdgeInsetsMake( 0, 5, 0, 5 )]; UIImage *navBarButton = [[UIImage imageNamed:@"ui_navbar_button"] resizableImageWithCapInsets:UIEdgeInsetsMake( 0, 5, 0, 5 )];
// [[UINavigationBar appearance] setBackgroundImage:navBarImage forBarMetrics:UIBarMetricsDefault]; UIImage *navBarBack = [[UIImage imageNamed:@"ui_navbar_back"] resizableImageWithCapInsets:UIEdgeInsetsMake( 0, 13, 0, 5 )];
// [[UINavigationBar appearance] setBackgroundImage:navBarImage forBarMetrics:UIBarMetricsLandscapePhone]; [[UIBarButtonItem appearance] setBackgroundImage:navBarButton forState:UIControlStateNormal barMetrics:UIBarMetricsDefault];
// [[UINavigationBar appearance] setTitleTextAttributes: [[UIBarButtonItem appearance] setBackgroundImage:nil forState:UIControlStateNormal barMetrics:UIBarMetricsLandscapePhone];
// @{ [[UIBarButtonItem appearance]
// UITextAttributeTextColor : [UIColor colorWithRed:1.0f green:1.0f blue:1.0f alpha:1.0f], setBackButtonBackgroundImage:navBarBack forState:UIControlStateNormal barMetrics:UIBarMetricsDefault];
// UITextAttributeTextShadowColor : [UIColor colorWithRed:0.0f green:0.0f blue:0.0f alpha:0.8f], [[UIBarButtonItem appearance]
// UITextAttributeTextShadowOffset : [NSValue valueWithUIOffset:UIOffsetMake( 0, -1 )], setBackButtonBackgroundImage:nil forState:UIControlStateNormal barMetrics:UIBarMetricsLandscapePhone];
// UITextAttributeFont : [UIFont fontWithName:@"Exo-Bold" size:20.0f] [[UIBarButtonItem appearance] setTitleTextAttributes:
// }]; @{
// UITextAttributeTextColor : [UIColor colorWithRed:1.0f green:1.0f blue:1.0f alpha:1.0f],
// UIImage *navBarButton = [[UIImage imageNamed:@"ui_navbar_button"] resizableImageWithCapInsets:UIEdgeInsetsMake( 0, 5, 0, 5 )]; UITextAttributeTextShadowColor : [UIColor colorWithRed:0.0f green:0.0f blue:0.0f alpha:0.5f],
// UIImage *navBarBack = [[UIImage imageNamed:@"ui_navbar_back"] resizableImageWithCapInsets:UIEdgeInsetsMake( 0, 13, 0, 5 )]; UITextAttributeTextShadowOffset : [NSValue valueWithUIOffset:UIOffsetMake( 0, 1 )]//,
// [[UIBarButtonItem appearance] setBackgroundImage:navBarButton forState:UIControlStateNormal barMetrics:UIBarMetricsDefault]; // Causes a bug in iOS where image views get oddly stretched... or something.
// [[UIBarButtonItem appearance] setBackgroundImage:nil forState:UIControlStateNormal barMetrics:UIBarMetricsLandscapePhone]; //UITextAttributeFont: [UIFont fontWithName:@"HelveticaNeue" size:13.0f]
// [[UIBarButtonItem appearance] setBackButtonBackgroundImage:navBarBack forState:UIControlStateNormal barMetrics:UIBarMetricsDefault]; }
// [[UIBarButtonItem appearance] setBackButtonBackgroundImage:nil forState:UIControlStateNormal barMetrics:UIBarMetricsLandscapePhone]; forState:UIControlStateNormal];
// [[UIBarButtonItem appearance] setTitleTextAttributes:
// @{ UIImage *toolBarImage = [[UIImage imageNamed:@"ui_toolbar_container"]
// UITextAttributeTextColor : [UIColor colorWithRed:1.0f green:1.0f blue:1.0f alpha:1.0f], resizableImageWithCapInsets:UIEdgeInsetsMake( 25, 5, 5, 5 )];
// UITextAttributeTextShadowColor : [UIColor colorWithRed:0.0f green:0.0f blue:0.0f alpha:0.5f], [[UISearchBar appearance] setBackgroundImage:toolBarImage];
// UITextAttributeTextShadowOffset : [NSValue valueWithUIOffset:UIOffsetMake( 0, 1 )]//, [[UIToolbar appearance] setBackgroundImage:toolBarImage forToolbarPosition:UIToolbarPositionAny barMetrics:UIBarMetricsDefault];
// // Causes a bug in iOS where image views get oddly stretched... or something.
// //UITextAttributeFont: [UIFont fontWithName:@"HelveticaNeue" size:13.0f]
// }
// forState:UIControlStateNormal];
//
// UIImage *toolBarImage = [[UIImage imageNamed:@"ui_toolbar_container"] resizableImageWithCapInsets:UIEdgeInsetsMake( 25, 5, 5, 5 )];
// [[UISearchBar appearance] setBackgroundImage:toolBarImage];
// [[UIToolbar appearance] setBackgroundImage:toolBarImage forToolbarPosition:UIToolbarPositionAny barMetrics:UIBarMetricsDefault];
// UIImage *minImage = [[UIImage imageNamed:@"slider-minimum"] resizableImageWithCapInsets:UIEdgeInsetsMake(0, 5, 0, 0)]; // UIImage *minImage = [[UIImage imageNamed:@"slider-minimum"] resizableImageWithCapInsets:UIEdgeInsetsMake(0, 5, 0, 0)];
// UIImage *maxImage = [[UIImage imageNamed:@"slider-maximum"] resizableImageWithCapInsets:UIEdgeInsetsMake(0, 5, 0, 0)]; // UIImage *maxImage = [[UIImage imageNamed:@"slider-maximum"] resizableImageWithCapInsets:UIEdgeInsetsMake(0, 5, 0, 0)];
@ -185,7 +174,12 @@
// [[UISegmentedControl appearance] setDividerImage:segmentUnselectedUnselected forLeftSegmentState:UIControlStateNormal rightSegmentState:UIControlStateNormal barMetrics:UIBarMetricsDefault]; // [[UISegmentedControl appearance] setDividerImage:segmentUnselectedUnselected forLeftSegmentState:UIControlStateNormal rightSegmentState:UIControlStateNormal barMetrics:UIBarMetricsDefault];
// [[UISegmentedControl appearance] setDividerImage:segmentSelectedUnselected forLeftSegmentState:UIControlStateSelected rightSegmentState:UIControlStateNormal barMetrics:UIBarMetricsDefault]; // [[UISegmentedControl appearance] setDividerImage:segmentSelectedUnselected forLeftSegmentState:UIControlStateSelected rightSegmentState:UIControlStateNormal barMetrics:UIBarMetricsDefault];
// [[UISegmentedControl appearance] setDividerImage:segUnselectedSelected forLeftSegmentState:UIControlStateNormal rightSegmentState:UIControlStateSelected barMetrics:UIBarMetricsDefault]; // [[UISegmentedControl appearance] setDividerImage:segUnselectedSelected forLeftSegmentState:UIControlStateNormal rightSegmentState:UIControlStateSelected barMetrics:UIBarMetricsDefault];
}
}
@catch (id exception) {
err(@"During Theme Setup: %@", exception);
}
@try {
[[NSNotificationCenter defaultCenter] addObserverForName:MPCheckConfigNotification object:nil queue:nil usingBlock: [[NSNotificationCenter defaultCenter] addObserverForName:MPCheckConfigNotification object:nil queue:nil usingBlock:
^(NSNotification *note) { ^(NSNotification *note) {
if ([[MPiOSConfig get].sendInfo boolValue]) { if ([[MPiOSConfig get].sendInfo boolValue]) {
@ -262,9 +256,17 @@
viewStyle:UIAlertViewStyleDefault initAlert:nil tappedButtonBlock:nil viewStyle:UIAlertViewStyleDefault initAlert:nil tappedButtonBlock:nil
cancelTitle:nil otherTitles:[PearlStrings get].commonButtonOkay, nil]; cancelTitle:nil otherTitles:[PearlStrings get].commonButtonOkay, nil];
#endif #endif
}
@catch (id exception) {
err(@"During Config Test: %@", exception);
}
@try {
[super application:application didFinishLaunchingWithOptions:launchOptions]; [super application:application didFinishLaunchingWithOptions:launchOptions];
}
@catch (id exception) {
err(@"During Pearl Application Launch: %@", exception);
}
@try {
inf(@"Started up with device identifier: %@", [PearlKeyChain deviceIdentifier]); inf(@"Started up with device identifier: %@", [PearlKeyChain deviceIdentifier]);
dispatch_async( dispatch_get_main_queue(), ^{ dispatch_async( dispatch_get_main_queue(), ^{
@ -283,6 +285,10 @@
@"legal" : @"YES", @"legal" : @"YES",
#endif #endif
} ); } );
}
@catch (id exception) {
err(@"During Post-Startup: %@", exception);
}
return YES; return YES;
} }

View File

@ -1089,7 +1089,7 @@ L4m3P4sSw0rD</string>
</connections> </connections>
</viewController> </viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="mK2-p1-3zC" userLabel="First Responder" sceneMemberID="firstResponder"/> <placeholder placeholderIdentifier="IBFirstResponder" id="mK2-p1-3zC" userLabel="First Responder" sceneMemberID="firstResponder"/>
<searchDisplayController id="P8c-gf-nN3"> <searchDisplayController searchResultsTitle="" id="P8c-gf-nN3">
<connections> <connections>
<outlet property="searchBar" destination="qeo-n2-WVh" id="bFO-FC-Xdj"/> <outlet property="searchBar" destination="qeo-n2-WVh" id="bFO-FC-Xdj"/>
<outlet property="searchContentsController" destination="PQa-Xl-A3x" id="iEu-t3-hJY"/> <outlet property="searchContentsController" destination="PQa-Xl-A3x" id="iEu-t3-hJY"/>
@ -2918,6 +2918,6 @@ However, it means that anyone who finds your device unlocked can do the same.</s
</simulatedMetricsContainer> </simulatedMetricsContainer>
<inferredMetricsTieBreakers> <inferredMetricsTieBreakers>
<segue reference="swi-5o-hfK"/> <segue reference="swi-5o-hfK"/>
<segue reference="KIl-ZW-M7G"/> <segue reference="9Bs-cD-ddF"/>
</inferredMetricsTieBreakers> </inferredMetricsTieBreakers>
</document> </document>

View File

@ -99,9 +99,9 @@
<key>UIMainStoryboardFile</key> <key>UIMainStoryboardFile</key>
<string>MainStoryboard_iPhone</string> <string>MainStoryboard_iPhone</string>
<key>UIStatusBarHidden</key> <key>UIStatusBarHidden</key>
<false/> <true/>
<key>UIStatusBarStyle</key> <key>UIStatusBarStyle</key>
<string>UIStatusBarStyleBlackOpaque</string> <string>UIStatusBarStyleDefault</string>
<key>UIStatusBarTintParameters</key> <key>UIStatusBarTintParameters</key>
<dict> <dict>
<key>UINavigationBar</key> <key>UINavigationBar</key>