Modernized Obj-C syntax.
[UPDATED] Modernized Obj-C syntax.
This commit is contained in:
parent
14e34e8e7a
commit
b67132671a
2
External/Pearl
vendored
2
External/Pearl
vendored
@ -1 +1 @@
|
||||
Subproject commit 00b732f8b73035b81c4abd763ee2a7e54f6ad3c5
|
||||
Subproject commit fb1b46e2b4f2e661f84521ce243d31a10aa9cee7
|
2
External/UbiquityStoreManager
vendored
2
External/UbiquityStoreManager
vendored
@ -1 +1 @@
|
||||
Subproject commit 7fb753f0f84afdb5607332b586f1345d9a2ae1a1
|
||||
Subproject commit 4834f69d55b7cd84d719869336ba213ecc456542
|
@ -23,9 +23,9 @@ id<MPAlgorithm> MPAlgorithmForVersion(NSUInteger version) {
|
||||
if (!versionToAlgorithm)
|
||||
versionToAlgorithm = [NSMutableDictionary dictionary];
|
||||
|
||||
id<MPAlgorithm> algorithm = [versionToAlgorithm objectForKey:@(version)];
|
||||
id<MPAlgorithm> algorithm = versionToAlgorithm[@(version)];
|
||||
if (!algorithm) if ((algorithm = [NSClassFromString( PearlString( @"MPAlgorithmV%lu", (unsigned long)version ) ) new]))
|
||||
[versionToAlgorithm setObject:algorithm forKey:@(version)];
|
||||
versionToAlgorithm[@(version)] = algorithm;
|
||||
|
||||
return algorithm;
|
||||
}
|
||||
|
@ -229,7 +229,7 @@
|
||||
NSAssert([seed length], @"Missing seed.");
|
||||
NSArray *typeCiphers = [[MPTypes_ciphers valueForKey:[self classNameOfType:type]]
|
||||
valueForKey:[self nameOfType:type]];
|
||||
NSString *cipher = [typeCiphers objectAtIndex:htons(seedBytes[0]) % [typeCiphers count]];
|
||||
NSString *cipher = typeCiphers[htons(seedBytes[0]) % [typeCiphers count]];
|
||||
trc(@"type %@, ciphers: %@, selected: %@", [self nameOfType:type], typeCiphers, cipher);
|
||||
|
||||
// Encode the content, character by character, using subsequent seed bytes and the cipher.
|
||||
|
@ -70,7 +70,7 @@
|
||||
// Determine the cipher from the first seed byte.
|
||||
NSAssert([seed length], @"Missing seed.");
|
||||
NSArray *typeCiphers = [[MPTypes_ciphers valueForKey:[self classNameOfType:type]] valueForKey:[self nameOfType:type]];
|
||||
NSString *cipher = [typeCiphers objectAtIndex:seedBytes[0] % [typeCiphers count]];
|
||||
NSString *cipher = typeCiphers[seedBytes[0] % [typeCiphers count]];
|
||||
trc(@"type %@, ciphers: %@, selected: %@", [self nameOfType:type], typeCiphers, cipher);
|
||||
|
||||
// Encode the content, character by character, using subsequent seed bytes and the cipher.
|
||||
|
@ -608,12 +608,12 @@ PearlAssociatedObjectProperty(NSManagedObjectContext*, MainManagedObjectContext,
|
||||
|
||||
// Import new sites.
|
||||
for (NSArray *siteElements in importedSiteElements) {
|
||||
NSDate *lastUsed = [[NSDateFormatter rfc3339DateFormatter] dateFromString:[siteElements objectAtIndex:0]];
|
||||
NSUInteger uses = (unsigned)[[siteElements objectAtIndex:1] integerValue];
|
||||
MPElementType type = (MPElementType)[[siteElements objectAtIndex:2] integerValue];
|
||||
NSUInteger version = (unsigned)[[siteElements objectAtIndex:3] integerValue];
|
||||
NSString *name = [siteElements objectAtIndex:4];
|
||||
NSString *exportContent = [siteElements objectAtIndex:5];
|
||||
NSDate *lastUsed = [[NSDateFormatter rfc3339DateFormatter] dateFromString:siteElements[0]];
|
||||
NSUInteger uses = (unsigned)[siteElements[1] integerValue];
|
||||
MPElementType type = (MPElementType)[siteElements[2] integerValue];
|
||||
NSUInteger version = (unsigned)[siteElements[3] integerValue];
|
||||
NSString *name = siteElements[4];
|
||||
NSString *exportContent = siteElements[5];
|
||||
|
||||
// Create new site.
|
||||
MPElementEntity
|
||||
|
@ -64,7 +64,7 @@
|
||||
[UIApp setStatusBarHidden:YES withAnimation:UIStatusBarAnimationSlide];
|
||||
MPCheckpoint( MPCheckpointApps, nil );
|
||||
|
||||
[self.pageViewController setViewControllers:@[ [self.pageVCs objectAtIndex:1] ] direction:UIPageViewControllerNavigationDirectionForward
|
||||
[self.pageViewController setViewControllers:@[ (self.pageVCs)[1] ] direction:UIPageViewControllerNavigationDirectionForward
|
||||
animated:NO completion:nil];
|
||||
|
||||
[super viewWillAppear:animated];
|
||||
@ -76,7 +76,7 @@
|
||||
[[LocalyticsSession sharedLocalyticsSession] tagScreen:@"Apps"];
|
||||
#endif
|
||||
|
||||
[self.pageViewController setViewControllers:@[ [self.pageVCs objectAtIndex:0] ] direction:UIPageViewControllerNavigationDirectionForward
|
||||
[self.pageViewController setViewControllers:@[ (self.pageVCs)[0] ] direction:UIPageViewControllerNavigationDirectionForward
|
||||
animated:YES completion:nil];
|
||||
|
||||
[super viewDidAppear:animated];
|
||||
@ -103,14 +103,14 @@
|
||||
viewControllerBeforeViewController:(UIViewController *)viewController {
|
||||
|
||||
NSUInteger vcIndex = [self.pageVCs indexOfObject:viewController];
|
||||
return [self.pageVCs objectAtIndex:(vcIndex + [self.pageVCs count] - 1) % self.pageVCs.count];
|
||||
return (self.pageVCs)[(vcIndex + [self.pageVCs count] - 1) % self.pageVCs.count];
|
||||
}
|
||||
|
||||
- (UIViewController *)pageViewController:(UIPageViewController *)pageViewController
|
||||
viewControllerAfterViewController:(UIViewController *)viewController {
|
||||
|
||||
NSUInteger vcIndex = [self.pageVCs indexOfObject:viewController];
|
||||
return [self.pageVCs objectAtIndex:(vcIndex + 1) % self.pageVCs.count];
|
||||
return (self.pageVCs)[(vcIndex + 1) % self.pageVCs.count];
|
||||
}
|
||||
|
||||
- (IBAction)exit {
|
||||
|
@ -117,10 +117,10 @@
|
||||
id newContent = [element.algorithm resolveContentForElement:element usingKey:key];
|
||||
|
||||
if (!(element.type & MPElementFeatureDevicePrivate) && (!oldContent || ![oldContent isEqual:newContent]))
|
||||
[elementChanges setObject:@{
|
||||
elementChanges[element.name] = @{
|
||||
MPElementUpgradeOldContentKey : oldContent,
|
||||
MPElementUpgradeNewContentKey : newContent,
|
||||
} forKey:element.name];
|
||||
};
|
||||
}
|
||||
|
||||
[moc saveToStore];
|
||||
@ -135,9 +135,9 @@
|
||||
|
||||
NSMutableString *formattedChanges = [NSMutableString new];
|
||||
for (NSString *changedElementName in changes) {
|
||||
NSDictionary *elementChanges = [changes objectForKey:changedElementName];
|
||||
id oldContent = [elementChanges objectForKey:MPElementUpgradeOldContentKey];
|
||||
id newContent = [elementChanges objectForKey:MPElementUpgradeNewContentKey];
|
||||
NSDictionary *elementChanges = changes[changedElementName];
|
||||
id oldContent = elementChanges[MPElementUpgradeOldContentKey];
|
||||
id newContent = elementChanges[MPElementUpgradeNewContentKey];
|
||||
[formattedChanges appendFormat:@"%@: %@ -> %@\n", changedElementName, oldContent, newContent];
|
||||
}
|
||||
|
||||
|
@ -88,7 +88,7 @@
|
||||
NSFetchRequest *sitesFetchRequest = [NSFetchRequest fetchRequestWithEntityName:NSStringFromClass( [MPElementEntity class] )];
|
||||
for (NSURL *cloudStoreURL in cloudStores) {
|
||||
NSString *storeUUID = [[cloudStoreURL URLByDeletingPathExtension] lastPathComponent];
|
||||
for (NSDictionary *cloudStoreOptions in [cloudStores objectForKey:cloudStoreURL]) {
|
||||
for (NSDictionary *cloudStoreOptions in cloudStores[cloudStoreURL]) {
|
||||
NSError *error = nil;
|
||||
NSPersistentStore *store = nil;
|
||||
NSUInteger firstDash = [storeUUID rangeOfString:@"-" options:0].location;
|
||||
@ -127,7 +127,7 @@
|
||||
storePSC = [[NSPersistentStoreCoordinator alloc] initWithManagedObjectModel:model];
|
||||
}
|
||||
|
||||
[stores setObject:cloudStoreOptions forKey:storeDescription];
|
||||
stores[storeDescription] = cloudStoreOptions;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -94,7 +94,7 @@
|
||||
[[NSNotificationCenter defaultCenter] addObserverForName:MPSignedOutNotification object:nil
|
||||
queue:[NSOperationQueue mainQueue] usingBlock:
|
||||
^(NSNotification *note) {
|
||||
BOOL animated = [[note.userInfo objectForKey:@"animated"] boolValue];
|
||||
BOOL animated = [(note.userInfo)[@"animated"] boolValue];
|
||||
|
||||
_activeElementOID = nil;
|
||||
self.suppressOutdatedAlert = NO;
|
||||
@ -294,7 +294,7 @@
|
||||
|
||||
- (void)toggleUserAnimated:(BOOL)animated {
|
||||
|
||||
[MPiOSConfig get].siteInfoHidden = PearlBool(!self.siteInfoHidden);
|
||||
[MPiOSConfig get].siteInfoHidden = @(!self.siteInfoHidden);
|
||||
self.siteInfoHidden = [[MPiOSConfig get].siteInfoHidden boolValue];
|
||||
[self updateUserHiddenAnimated:animated];
|
||||
}
|
||||
|
@ -365,7 +365,7 @@
|
||||
|
||||
} options:0];
|
||||
|
||||
[self.avatarToUserOID setObject:NilToNSNull([user objectID]) forKey:[NSValue valueWithNonretainedObject:avatar]];
|
||||
(self.avatarToUserOID)[[NSValue valueWithNonretainedObject:avatar]] = NilToNSNull([user objectID]);
|
||||
|
||||
if ([_selectedUserOID isEqual:[user objectID]])
|
||||
avatar.selected = YES;
|
||||
@ -625,7 +625,7 @@
|
||||
- (void)initializeWordLabel:(UILabel *)wordLabel {
|
||||
|
||||
wordLabel.alpha = 0.05 + (random() % 35) / 100.0F;
|
||||
wordLabel.text = [self.wordList objectAtIndex:(NSUInteger)random() % [self.wordList count]];
|
||||
wordLabel.text = (self.wordList)[(NSUInteger)random() % [self.wordList count]];
|
||||
}
|
||||
|
||||
- (void)setPasswordTip:(NSString *)string {
|
||||
@ -686,7 +686,7 @@
|
||||
|
||||
- (MPUserEntity *)userForAvatar:(UIButton *)avatar inContext:(NSManagedObjectContext *)context {
|
||||
|
||||
NSManagedObjectID *userOID = NSNullToNil([self.avatarToUserOID objectForKey:[NSValue valueWithNonretainedObject:avatar]]);
|
||||
NSManagedObjectID *userOID = NSNullToNil((self.avatarToUserOID)[[NSValue valueWithNonretainedObject:avatar]]);
|
||||
if (!userOID)
|
||||
return nil;
|
||||
|
||||
@ -707,7 +707,7 @@
|
||||
|
||||
if (active) {
|
||||
rotate.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionLinear];
|
||||
rotate.fromValue = [NSNumber numberWithFloat:0];
|
||||
rotate.fromValue = @0.0;
|
||||
rotate.repeatCount = MAXFLOAT;
|
||||
}
|
||||
else {
|
||||
@ -741,12 +741,12 @@
|
||||
toShadowColorAnimation.fillMode = kCAFillModeForwards;
|
||||
|
||||
CABasicAnimation *toShadowOpacityAnimation = [CABasicAnimation animationWithKeyPath:@"shadowOpacity"];
|
||||
toShadowOpacityAnimation.toValue = PearlFloat(0.2);
|
||||
toShadowOpacityAnimation.toValue = @0.2f;
|
||||
toShadowOpacityAnimation.duration = 0.5f;
|
||||
|
||||
CABasicAnimation *pulseShadowOpacityAnimation = [CABasicAnimation animationWithKeyPath:@"shadowOpacity"];
|
||||
pulseShadowOpacityAnimation.fromValue = PearlFloat(0.2);
|
||||
pulseShadowOpacityAnimation.toValue = PearlFloat(0.6);
|
||||
pulseShadowOpacityAnimation.fromValue = @0.2f;
|
||||
pulseShadowOpacityAnimation.toValue = @0.6f;
|
||||
pulseShadowOpacityAnimation.beginTime = 0.5f;
|
||||
pulseShadowOpacityAnimation.duration = 2.0f;
|
||||
pulseShadowOpacityAnimation.autoreverses = YES;
|
||||
@ -767,7 +767,7 @@
|
||||
toShadowColorAnimation.duration = 0.5f;
|
||||
|
||||
CABasicAnimation *toShadowOpacityAnimation = [CABasicAnimation animationWithKeyPath:@"shadowOpacity"];
|
||||
toShadowOpacityAnimation.toValue = PearlFloat(1);
|
||||
toShadowOpacityAnimation.toValue = @1.0f;
|
||||
toShadowOpacityAnimation.duration = 0.5f;
|
||||
|
||||
CAAnimationGroup *group = [[CAAnimationGroup alloc] init];
|
||||
|
@ -33,8 +33,8 @@
|
||||
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
|
||||
|
||||
@try {
|
||||
[[[NSBundle mainBundle] mutableInfoDictionary] setObject:@"Master Password" forKey:@"CFBundleDisplayName"];
|
||||
[[[NSBundle mainBundle] mutableLocalizedInfoDictionary] setObject:@"Master Password" forKey:@"CFBundleDisplayName"];
|
||||
[[NSBundle mainBundle] mutableInfoDictionary][@"CFBundleDisplayName"] = @"Master Password";
|
||||
[[NSBundle mainBundle] mutableLocalizedInfoDictionary][@"CFBundleDisplayName"] = @"Master Password";
|
||||
|
||||
#ifdef TESTFLIGHT_SDK_VERSION
|
||||
NSString *testFlightToken = [self testFlightToken];
|
||||
|
Loading…
Reference in New Issue
Block a user