Pearl update + search tip.
[ADDED] A tip when searching for sites suggesting a site name format for sites and email accounts.
This commit is contained in:
parent
ada6d6b36a
commit
2020637f0e
2
External/Pearl
vendored
2
External/Pearl
vendored
@ -1 +1 @@
|
|||||||
Subproject commit 80c57a94fdcafb90cccd7371b175a5c56ac7571f
|
Subproject commit c07a0e24f061a4e4bb822c0763827c5b7f0efc21
|
@ -195,7 +195,7 @@ static NSDateFormatter *rfc3339DateFormatter = nil;
|
|||||||
- (void)ubiquityStoreManager:(UbiquityStoreManager *)manager didEncounterError:(NSError *)error cause:(UbiquityStoreManagerErrorCause)cause context:(id)context {
|
- (void)ubiquityStoreManager:(UbiquityStoreManager *)manager didEncounterError:(NSError *)error cause:(UbiquityStoreManagerErrorCause)cause context:(id)context {
|
||||||
|
|
||||||
#ifdef TESTFLIGHT_SDK_VERSION
|
#ifdef TESTFLIGHT_SDK_VERSION
|
||||||
[TestFlight passCheckpoint:str(@"MPTestFlightCheckpointMPErrorUbiquity_%d", cause)];
|
[TestFlight passCheckpoint:PearlString(@"MPTestFlightCheckpointMPErrorUbiquity_%d", cause)];
|
||||||
#endif
|
#endif
|
||||||
err(@"StoreManager: cause=%d, context=%@, error=%@", cause, context, error);
|
err(@"StoreManager: cause=%d, context=%@, error=%@", cause, context, error);
|
||||||
|
|
||||||
|
@ -39,13 +39,13 @@
|
|||||||
|
|
||||||
- (NSString *)description {
|
- (NSString *)description {
|
||||||
|
|
||||||
return str(@"%@:%@", [self class], [self name]);
|
return PearlString(@"%@:%@", [self class], [self name]);
|
||||||
}
|
}
|
||||||
|
|
||||||
- (NSString *)debugDescription {
|
- (NSString *)debugDescription {
|
||||||
|
|
||||||
return str(@"{%@: name=%@, keyID=%@, type=%d, uses=%d, lastUsed=%@}",
|
return PearlString(@"{%@: name=%@, keyID=%@, type=%d, uses=%d, lastUsed=%@}",
|
||||||
NSStringFromClass([self class]), self.name, self.keyID, self.type, self.uses, self.lastUsed);
|
NSStringFromClass([self class]), self.name, self.keyID, self.type, self.uses, self.lastUsed);
|
||||||
}
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
@ -299,7 +299,7 @@
|
|||||||
dispatch_group_enter(confirmationGroup);
|
dispatch_group_enter(confirmationGroup);
|
||||||
dispatch_async(dispatch_get_main_queue(), ^{
|
dispatch_async(dispatch_get_main_queue(), ^{
|
||||||
[PearlAlert showAlertWithTitle:@"Import Sites?"
|
[PearlAlert showAlertWithTitle:@"Import Sites?"
|
||||||
message:l(@"Import %d sites, overwriting %d existing sites?", importCount, deleteCount)
|
message:PearlLocalize(@"Import %d sites, overwriting %d existing sites?", importCount, deleteCount)
|
||||||
viewStyle:UIAlertViewStyleDefault
|
viewStyle:UIAlertViewStyleDefault
|
||||||
tappedButtonBlock:^(UIAlertView *alert, NSInteger buttonIndex) {
|
tappedButtonBlock:^(UIAlertView *alert, NSInteger buttonIndex) {
|
||||||
if (buttonIndex != [alert cancelButtonIndex])
|
if (buttonIndex != [alert cancelButtonIndex])
|
||||||
@ -426,7 +426,7 @@
|
|||||||
@"It is highly recommended you enable iCloud."
|
@"It is highly recommended you enable iCloud."
|
||||||
viewStyle:UIAlertViewStyleDefault tappedButtonBlock:^(UIAlertView *alert, NSInteger buttonIndex) {
|
viewStyle:UIAlertViewStyleDefault tappedButtonBlock:^(UIAlertView *alert, NSInteger buttonIndex) {
|
||||||
[MPConfig get].iCloudDecided = [NSNumber numberWithBool:YES];
|
[MPConfig get].iCloudDecided = [NSNumber numberWithBool:YES];
|
||||||
|
|
||||||
if (buttonIndex == [alert cancelButtonIndex])
|
if (buttonIndex == [alert cancelButtonIndex])
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -471,7 +471,7 @@
|
|||||||
|
|
||||||
- (NSString *)testFlightToken {
|
- (NSString *)testFlightToken {
|
||||||
|
|
||||||
return NSNullToNil([[self testFlightInfo] valueForKeyPath:@"Team Token"]);
|
return NullToNil([[self testFlightInfo] valueForKeyPath:@"Team Token"]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -490,7 +490,7 @@
|
|||||||
|
|
||||||
- (NSString *)crashlyticsAPIKey {
|
- (NSString *)crashlyticsAPIKey {
|
||||||
|
|
||||||
return NSNullToNil([[self crashlyticsInfo] valueForKeyPath:@"API Key"]);
|
return NullToNil([[self crashlyticsInfo] valueForKeyPath:@"API Key"]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -510,11 +510,11 @@
|
|||||||
- (NSString *)localyticsKey {
|
- (NSString *)localyticsKey {
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
return NSNullToNil([[self localyticsInfo] valueForKeyPath:@"Key.development"]);
|
return NullToNil([[self localyticsInfo] valueForKeyPath:@"Key.development"]);
|
||||||
#elif defined(LITE)
|
#elif defined(LITE)
|
||||||
return NSNullToNil([[self localyticsInfo] valueForKeyPath:@"Key.distribution.lite"]);
|
return NullToNil([[self localyticsInfo] valueForKeyPath:@"Key.distribution.lite"]);
|
||||||
#else
|
#else
|
||||||
return NSNullToNil([[self localyticsInfo] valueForKeyPath:@"Key.distribution"]);
|
return NullToNil([[self localyticsInfo] valueForKeyPath:@"Key.distribution"]);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -357,11 +357,11 @@
|
|||||||
|
|
||||||
// Show new and old password.
|
// Show new and old password.
|
||||||
if ([oldPassword length] && ![oldPassword isEqualToString:newPassword])
|
if ([oldPassword length] && ![oldPassword isEqualToString:newPassword])
|
||||||
[self showAlertWithTitle:@"Password Changed!" message:l(@"The password for %@ has changed.\n\n"
|
[self showAlertWithTitle:@"Password Changed!" message:PearlLocalize(@"The password for %@ has changed.\n\n"
|
||||||
@"IMPORTANT:\n"
|
@"IMPORTANT:\n"
|
||||||
@"Don't forget to update the site with your new password! "
|
@"Don't forget to update the site with your new password! "
|
||||||
@"Your old password was:\n"
|
@"Your old password was:\n"
|
||||||
@"%@", self.activeElement.name, oldPassword)];
|
@"%@", self.activeElement.name, oldPassword)];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -486,13 +486,13 @@
|
|||||||
self.activeElement = element;
|
self.activeElement = element;
|
||||||
if ([self.activeElement use] == 1)
|
if ([self.activeElement use] == 1)
|
||||||
[self showAlertWithTitle:@"New Site" message:
|
[self showAlertWithTitle:@"New Site" message:
|
||||||
l(@"You've just created a password for %@.\n\n"
|
PearlLocalize(@"You've just created a password for %@.\n\n"
|
||||||
@"IMPORTANT:\n"
|
@"IMPORTANT:\n"
|
||||||
@"Go to %@ and set or change the password for your account to the password above.\n"
|
@"Go to %@ and set or change the password for your account to the password above.\n"
|
||||||
@"Do this right away: if you forget, you may have trouble remembering which password to use to log into the site later on.",
|
@"Do this right away: if you forget, you may have trouble remembering which password to use to log into the site later on.",
|
||||||
self.activeElement.name, self.activeElement.name)];
|
self.activeElement.name, self.activeElement.name)];
|
||||||
[[MPAppDelegate get] saveContext];
|
[[MPAppDelegate get] saveContext];
|
||||||
|
|
||||||
[self.searchDisplayController setActive:NO animated:YES];
|
[self.searchDisplayController setActive:NO animated:YES];
|
||||||
self.searchDisplayController.searchBar.text = self.activeElement.name;
|
self.searchDisplayController.searchBar.text = self.activeElement.name;
|
||||||
|
|
||||||
|
@ -20,6 +20,7 @@
|
|||||||
@property (strong, nonatomic) NSDateFormatter *dateFormatter;
|
@property (strong, nonatomic) NSDateFormatter *dateFormatter;
|
||||||
@property (strong, nonatomic) NSFetchedResultsController *fetchedResultsController;
|
@property (strong, nonatomic) NSFetchedResultsController *fetchedResultsController;
|
||||||
@property (strong, nonatomic) NSString *query;
|
@property (strong, nonatomic) NSString *query;
|
||||||
|
@property (strong, nonatomic) UILabel *tipView;
|
||||||
|
|
||||||
@property (weak, nonatomic) IBOutlet id<MPSearchResultsDelegate> delegate;
|
@property (weak, nonatomic) IBOutlet id<MPSearchResultsDelegate> delegate;
|
||||||
@property (weak, nonatomic) IBOutlet UISearchDisplayController *searchDisplayController;
|
@property (weak, nonatomic) IBOutlet UISearchDisplayController *searchDisplayController;
|
||||||
|
@ -19,6 +19,7 @@
|
|||||||
@end
|
@end
|
||||||
|
|
||||||
@implementation MPSearchDelegate
|
@implementation MPSearchDelegate
|
||||||
|
@synthesize tipView;
|
||||||
@synthesize query;
|
@synthesize query;
|
||||||
@synthesize dateFormatter;
|
@synthesize dateFormatter;
|
||||||
@synthesize fetchedResultsController;
|
@synthesize fetchedResultsController;
|
||||||
@ -38,10 +39,26 @@
|
|||||||
NSFetchRequest *fetchRequest = [NSFetchRequest fetchRequestWithEntityName:NSStringFromClass([MPElementEntity class])];
|
NSFetchRequest *fetchRequest = [NSFetchRequest fetchRequestWithEntityName:NSStringFromClass([MPElementEntity class])];
|
||||||
fetchRequest.sortDescriptors = [NSArray arrayWithObject:[[NSSortDescriptor alloc] initWithKey:@"uses" ascending:NO]];
|
fetchRequest.sortDescriptors = [NSArray arrayWithObject:[[NSSortDescriptor alloc] initWithKey:@"uses" ascending:NO]];
|
||||||
self.fetchedResultsController = [[NSFetchedResultsController alloc] initWithFetchRequest:fetchRequest
|
self.fetchedResultsController = [[NSFetchedResultsController alloc] initWithFetchRequest:fetchRequest
|
||||||
managedObjectContext:[MPAppDelegate managedObjectContext]
|
managedObjectContext:[MPAppDelegate managedObjectContext]
|
||||||
sectionNameKeyPath:nil cacheName:nil];
|
sectionNameKeyPath:nil cacheName:nil];
|
||||||
self.fetchedResultsController.delegate = self;
|
self.fetchedResultsController.delegate = self;
|
||||||
|
|
||||||
|
self.tipView = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 320, 170)];
|
||||||
|
self.tipView.textAlignment = UITextAlignmentCenter;
|
||||||
|
self.tipView.backgroundColor = [UIColor clearColor];
|
||||||
|
self.tipView.textColor = [UIColor lightTextColor];
|
||||||
|
self.tipView.shadowColor = [UIColor blackColor];
|
||||||
|
self.tipView.shadowOffset = CGSizeMake(0, -1);
|
||||||
|
self.tipView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleBottomMargin;
|
||||||
|
self.tipView.numberOfLines = 0;
|
||||||
|
self.tipView.font = [UIFont systemFontOfSize:14];
|
||||||
|
self.tipView.text =
|
||||||
|
@"Tip:\n"
|
||||||
|
@"Name your sites by their domain name:\n"
|
||||||
|
@"apple.com, twitter.com\n\n"
|
||||||
|
@"For email accounts, use the address:\n"
|
||||||
|
@"john@apple.com, john@gmail.com";
|
||||||
|
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -78,7 +95,7 @@
|
|||||||
|
|
||||||
- (void)searchDisplayControllerWillBeginSearch:(UISearchDisplayController *)controller {
|
- (void)searchDisplayControllerWillBeginSearch:(UISearchDisplayController *)controller {
|
||||||
|
|
||||||
controller.searchBar.prompt = @"Enter the site's name (eg. apple.com):";
|
controller.searchBar.prompt = @"Enter the site's name:";
|
||||||
|
|
||||||
[UIView animateWithDuration:0.2f animations:^{
|
[UIView animateWithDuration:0.2f animations:^{
|
||||||
self.searchTipContainer.alpha = 0;
|
self.searchTipContainer.alpha = 0;
|
||||||
@ -123,6 +140,18 @@
|
|||||||
if (![self.fetchedResultsController performFetch:&error])
|
if (![self.fetchedResultsController performFetch:&error])
|
||||||
err(@"Couldn't fetch elements: %@", error);
|
err(@"Couldn't fetch elements: %@", error);
|
||||||
[self.searchDisplayController.searchResultsTableView reloadData];
|
[self.searchDisplayController.searchResultsTableView reloadData];
|
||||||
|
|
||||||
|
NSArray *subviews = self.searchDisplayController.searchBar.superview.subviews;
|
||||||
|
UIView *overlay = [subviews objectAtIndex:[subviews indexOfObject:self.searchDisplayController.searchBar] + 1];
|
||||||
|
if (self.tipView.superview != overlay && overlay != self.searchDisplayController.searchResultsTableView) {
|
||||||
|
[self.tipView removeFromSuperview];
|
||||||
|
[overlay addSubview:self.tipView];
|
||||||
|
}
|
||||||
|
|
||||||
|
//dbg(@"Superviews of superview:");
|
||||||
|
//[self.searchDisplayController.searchBar.superview printSuperHierarchy];
|
||||||
|
//dbg(@"Subviews of superview:");
|
||||||
|
//[self.searchDisplayController.searchBar.superview printChildHierarchy];
|
||||||
}
|
}
|
||||||
|
|
||||||
// See MP-14, also crashes easily on internal assertions etc..
|
// See MP-14, also crashes easily on internal assertions etc..
|
||||||
@ -181,7 +210,7 @@
|
|||||||
- (void)controllerDidChangeContent:(NSFetchedResultsController *)controller {
|
- (void)controllerDidChangeContent:(NSFetchedResultsController *)controller {
|
||||||
|
|
||||||
[self.searchDisplayController.searchResultsTableView reloadData];
|
[self.searchDisplayController.searchResultsTableView reloadData];
|
||||||
// [self.searchDisplayController.searchResultsTableView endUpdates];
|
// [self.searchDisplayController.searchResultsTableView endUpdates];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
|
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
|
||||||
@ -271,7 +300,7 @@
|
|||||||
// "New" section.
|
// "New" section.
|
||||||
NSString *siteName = self.query;
|
NSString *siteName = self.query;
|
||||||
[PearlAlert showAlertWithTitle:@"New Site"
|
[PearlAlert showAlertWithTitle:@"New Site"
|
||||||
message:l(@"Do you want to create a new site named:\n%@", siteName)
|
message:PearlLocalize(@"Do you want to create a new site named:\n%@", siteName)
|
||||||
viewStyle:UIAlertViewStyleDefault
|
viewStyle:UIAlertViewStyleDefault
|
||||||
tappedButtonBlock:^(UIAlertView *alert, NSInteger buttonIndex) {
|
tappedButtonBlock:^(UIAlertView *alert, NSInteger buttonIndex) {
|
||||||
[tableView deselectRowAtIndexPath:indexPath animated:YES];
|
[tableView deselectRowAtIndexPath:indexPath animated:YES];
|
||||||
|
Loading…
Reference in New Issue
Block a user