Syntax fixes from #172

//FREEBIE
pull/1/head
Frederic Jacobs 11 years ago
parent d05791e699
commit 953d4d80fd

@ -81,22 +81,22 @@
NSError *error; NSError *error;
NSDictionary *attrs = @{NSFileProtectionKey: NSFileProtectionCompleteUntilFirstUserAuthentication}; NSDictionary *attrs = @{NSFileProtectionKey: NSFileProtectionCompleteUntilFirstUserAuthentication};
[[NSFileManager defaultManager] setAttributes:attrs ofItemAtPath:preferencesPath error:&error]; [NSFileManager.defaultManager setAttributes:attrs ofItemAtPath:preferencesPath error:&error];
[pathsToExclude addObject:[[preferencesPath stringByAppendingString:NSBundle.mainBundle.bundleIdentifier] stringByAppendingString:@".plist"]]; [pathsToExclude addObject:[[preferencesPath stringByAppendingString:NSBundle.mainBundle.bundleIdentifier] stringByAppendingString:@".plist"]];
NSString *logPath = [NSHomeDirectory() stringByAppendingString:@"/Library/Caches/Logs/"]; NSString *logPath = [NSHomeDirectory() stringByAppendingString:@"/Library/Caches/Logs/"];
NSArray *logsFiles = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:logPath error:&error]; NSArray *logsFiles = [NSFileManager.defaultManager contentsOfDirectoryAtPath:logPath error:&error];
attrs = @{NSFileProtectionKey: NSFileProtectionCompleteUntilFirstUserAuthentication}; attrs = @{NSFileProtectionKey: NSFileProtectionCompleteUntilFirstUserAuthentication};
[[NSFileManager defaultManager] setAttributes:attrs ofItemAtPath:logPath error:&error]; [NSFileManager.defaultManager setAttributes:attrs ofItemAtPath:logPath error:&error];
for (NSUInteger i = 0; i < logsFiles.count; i++) { for (NSString *logsFile in logsFiles) {
[pathsToExclude addObject:[logPath stringByAppendingString:logsFiles[i]]]; [pathsToExclude addObject:[logPath stringByAppendingString:logsFile]];
} }
for (NSUInteger i = 0; i < pathsToExclude.count; i++) { for (NSString *pathToExclude in pathsToExclude) {
[[NSURL fileURLWithPath:pathsToExclude[i]] setResourceValue:@YES [[NSURL fileURLWithPath:pathToExclude] setResourceValue:@YES
forKey:NSURLIsExcludedFromBackupKey forKey:NSURLIsExcludedFromBackupKey
error:&error]; error:&error];
} }
@ -187,15 +187,15 @@
} }
- (void)application:(UIApplication*)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData*)deviceToken { - (void)application:(UIApplication*)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData*)deviceToken {
[[PushManager sharedManager].pushNotificationFutureSource trySetResult:deviceToken]; [PushManager.sharedManager.pushNotificationFutureSource trySetResult:deviceToken];
} }
- (void)application:(UIApplication*)application didFailToRegisterForRemoteNotificationsWithError:(NSError*)error { - (void)application:(UIApplication*)application didFailToRegisterForRemoteNotificationsWithError:(NSError*)error {
[[PushManager sharedManager].pushNotificationFutureSource trySetFailure:error]; [PushManager.sharedManager.pushNotificationFutureSource trySetFailure:error];
} }
- (void)application:(UIApplication *)application didRegisterUserNotificationSettings:(UIUserNotificationSettings *)notificationSettings{ - (void)application:(UIApplication *)application didRegisterUserNotificationSettings:(UIUserNotificationSettings *)notificationSettings{
[[PushManager sharedManager].userNotificationFutureSource trySetResult:notificationSettings]; [PushManager.sharedManager.userNotificationFutureSource trySetResult:notificationSettings];
} }
-(void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo { -(void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo {

@ -18,7 +18,7 @@
NSString* documentsDirectory = [NSHomeDirectory() stringByAppendingPathComponent:@"/Documents/"]; NSString* documentsDirectory = [NSHomeDirectory() stringByAppendingPathComponent:@"/Documents/"];
NSString *path = [NSString stringWithFormat:@"%@/%@.plist", documentsDirectory, @"RedPhone-Data"]; NSString *path = [NSString stringWithFormat:@"%@/%@.plist", documentsDirectory, @"RedPhone-Data"];
if ([[NSFileManager defaultManager] fileExistsAtPath:path]) { if ([NSFileManager.defaultManager fileExistsAtPath:path]) {
NSData *plistData = [NSData dataWithContentsOfFile:path]; NSData *plistData = [NSData dataWithContentsOfFile:path];
NSError *error; NSError *error;
@ -35,7 +35,7 @@
[defaults synchronize]; [defaults synchronize];
[[NSFileManager defaultManager]removeItemAtPath:path error:&error]; [NSFileManager.defaultManager removeItemAtPath:path error:&error];
if (error) { if (error) {
DDLogError(@"Error while migrating data: %@", error.description); DDLogError(@"Error while migrating data: %@", error.description);
@ -49,7 +49,7 @@
DDLogError(@"Error re-registering on migration from 1.0.2"); DDLogError(@"Error re-registering on migration from 1.0.2");
}]; }];
[[NSFileManager defaultManager] removeItemAtPath:path error:&error]; [NSFileManager.defaultManager removeItemAtPath:path error:&error];
if (error) { if (error) {
DDLogError(@"Error upgrading from 1.0.2 : %@", error.description); DDLogError(@"Error upgrading from 1.0.2 : %@", error.description);

@ -9,7 +9,6 @@
#import "PushManager.h" #import "PushManager.h"
#import "Environment.h" #import "Environment.h"
#import "RPServerRequestsManager.h" #import "RPServerRequestsManager.h"
#import "FutureUtil.h"
@interface PushManager () @interface PushManager ()
@ -26,7 +25,11 @@
static dispatch_once_t onceToken; static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{ dispatch_once(&onceToken, ^{
sharedManager = [self new]; sharedManager = [self new];
sharedManager.missingPermissionsAlertView = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"ACTION_REQUIRED_TITLE", @"") message:NSLocalizedString(@"PUSH_SETTINGS_MESSAGE", @"") delegate:nil cancelButtonTitle:NSLocalizedString(@"OK", @"") otherButtonTitles:nil, nil]; sharedManager.missingPermissionsAlertView = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"ACTION_REQUIRED_TITLE", @"")
message:NSLocalizedString(@"PUSH_SETTINGS_MESSAGE", @"")
delegate:nil
cancelButtonTitle:NSLocalizedString(@"OK", @"")
otherButtonTitles:nil, nil];
}); });
return sharedManager; return sharedManager;
} }

@ -15,7 +15,9 @@
MacrosSingletonInterface MacrosSingletonInterface
- (void)performRequest:(RPAPICall*)apiCall success:(void (^)(NSURLSessionDataTask *task, id responseObject))success failure:(void (^)(NSURLSessionDataTask *task, NSError *error))failure; - (void)performRequest:(RPAPICall*)apiCall
success:(void (^)(NSURLSessionDataTask *task, id responseObject))success
failure:(void (^)(NSURLSessionDataTask *task, NSError *error))failure;
- (TOCFuture*)futureForRequest:(RPAPICall*)apiCall; - (TOCFuture*)futureForRequest:(RPAPICall*)apiCall;

Loading…
Cancel
Save