Improved cloud store enumeration.
[ADDED] Stores now enumerated in a TVC.
This commit is contained in:
parent
0921796136
commit
8ea0f00cf0
2
External/Pearl
vendored
2
External/Pearl
vendored
@ -1 +1 @@
|
|||||||
Subproject commit 41c3582a72ddb251b9a3a055ecdad3fa49ec18f2
|
Subproject commit ea7054e328bd7162d1f5a56a0f64a3eed6e3fc66
|
2
External/UbiquityStoreManager
vendored
2
External/UbiquityStoreManager
vendored
@ -1 +1 @@
|
|||||||
Subproject commit ebc094f4c160f8aa3ebbe3f760fbf734b58bc5e6
|
Subproject commit 5a19df087f7a694ad6427708f6d23c62ad8999bb
|
@ -91,8 +91,8 @@
|
|||||||
for (NSURL *content in contents)
|
for (NSURL *content in contents)
|
||||||
if ([[NSFileManager defaultManager] fileExistsAtPath:content.path isDirectory:&directory] && directory) {
|
if ([[NSFileManager defaultManager] fileExistsAtPath:content.path isDirectory:&directory] && directory) {
|
||||||
NSString *contentString = [content lastPathComponent];
|
NSString *contentString = [content lastPathComponent];
|
||||||
NSUInteger lastDash = [contentString rangeOfString:@"-" options:NSBackwardsSearch].location;
|
NSUInteger firstDash = [contentString rangeOfString:@"-" options:0].location;
|
||||||
NSString *storeDescription = lastDash == NSNotFound? contentString: [contentString substringFromIndex:lastDash + 1];
|
NSString *storeDescription = firstDash == NSNotFound? contentString: [contentString substringToIndex:firstDash];
|
||||||
NSPersistentStore *store = nil;
|
NSPersistentStore *store = nil;
|
||||||
@try {
|
@try {
|
||||||
NSURL *storeURL = [[cloudStoreDirectory
|
NSURL *storeURL = [[cloudStoreDirectory
|
||||||
@ -135,27 +135,21 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
NSString *storeUUID = [[MPiOSAppDelegate get].storeManager valueForKey:@"storeUUID_ThreadSafe"];
|
NSString *storeUUID = [[MPiOSAppDelegate get].storeManager valueForKey:@"storeUUID_ThreadSafe"];
|
||||||
NSUInteger lastDash = [storeUUID rangeOfString:@"-" options:NSBackwardsSearch].location;
|
NSUInteger firstDash = [storeUUID rangeOfString:@"-" options:0].location;
|
||||||
NSString *title = PearlString( @"Current: %@", lastDash == NSNotFound? storeUUID: [storeUUID substringFromIndex:lastDash + 1] );
|
PearlArrayTVC *vc = [[PearlArrayTVC alloc] initWithStyle:UITableViewStylePlain];
|
||||||
dispatch_async( dispatch_get_main_queue(), ^{
|
vc.title = PearlString( @"Current: %@", firstDash == NSNotFound? storeUUID: [storeUUID substringToIndex:firstDash] );
|
||||||
[switchCloudStoreProgress cancelAlertAnimated:YES];
|
[stores enumerateKeysAndObjectsUsingBlock:^(id key, id obj, BOOL *stop) {
|
||||||
|
[vc addRowWithName:obj style:PearlArrayTVCRowStyleLink toggled:NO toSection:@"Cloud Stores"
|
||||||
NSArray *storeUUIDs = [stores allKeys];
|
activationBlock:^BOOL(BOOL wasToggled) {
|
||||||
[PearlSheet showSheetWithTitle:title viewStyle:UIActionSheetStyleAutomatic
|
[[MPiOSAppDelegate get].storeManager setValue:key forKey:@"storeUUID"];
|
||||||
initSheet:^(UIActionSheet *sheet) {
|
|
||||||
for (NSString *contentName in storeUUIDs)
|
|
||||||
[sheet addButtonWithTitle:[stores objectForKey:contentName]];
|
|
||||||
}
|
|
||||||
tappedButtonBlock:^(UIActionSheet *sheet, NSInteger buttonIndex) {
|
|
||||||
if (buttonIndex == sheet.cancelButtonIndex)
|
|
||||||
return;
|
|
||||||
|
|
||||||
[[MPiOSAppDelegate get].storeManager setValue:[storeUUIDs objectAtIndex:(unsigned)buttonIndex]
|
|
||||||
forKey:@"storeUUID"];
|
|
||||||
[[MPiOSAppDelegate get].storeManager reloadStore];
|
[[MPiOSAppDelegate get].storeManager reloadStore];
|
||||||
[[MPiOSAppDelegate get] signOutAnimated:YES];
|
[[MPiOSAppDelegate get] signOutAnimated:YES];
|
||||||
}
|
return YES;
|
||||||
cancelTitle:[PearlStrings get].commonButtonCancel destructiveTitle:nil otherTitles:nil];
|
}];
|
||||||
|
}];
|
||||||
|
dispatch_async( dispatch_get_main_queue(), ^{
|
||||||
|
[switchCloudStoreProgress cancelAlertAnimated:YES];
|
||||||
|
[self.navigationController pushViewController:vc animated:YES];
|
||||||
} );
|
} );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user