forked from ChatSecure/ChatSecure-iOS
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Version 3.1.2
- Loading branch information
Showing
33 changed files
with
272 additions
and
295 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,7 +15,7 @@ | |
url = [email protected]:chrisballinger/ProxyKit.git | ||
[submodule "Submodules/CPAProxy"] | ||
path = Submodules/CPAProxy | ||
url = [email protected]:ChatSecure/CPAProxy.git | ||
url = [email protected]:ursachec/CPAProxy.git | ||
[submodule "Submodules/YapDatabase"] | ||
path = Submodules/YapDatabase | ||
url = [email protected]:chrisballinger/YapDatabase.git | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
// | ||
// NSFileManager+ChatSecure.h | ||
// ChatSecure | ||
// | ||
// Created by David Chiles on 5/19/15. | ||
// Copyright (c) 2015 Chris Ballinger. All rights reserved. | ||
// | ||
|
||
#import <Foundation/Foundation.h> | ||
|
||
@interface NSFileManager (ChatSecure) | ||
|
||
|
||
- (void)otr_enumerateFilesInDirectory:(NSString *)directory block:(void (^)(NSString *fullPath,BOOL *stop))enumerateBlock; | ||
- (BOOL)otr_setFileProtection:(NSString *)fileProtection forFilesInDirectory:(NSString *)directory; | ||
- (BOOL)otr_excudeFromBackUpFilesInDirectory:(NSString *)directory; | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
// | ||
// NSFileManager+ChatSecure.m | ||
// ChatSecure | ||
// | ||
// Created by David Chiles on 5/19/15. | ||
// Copyright (c) 2015 Chris Ballinger. All rights reserved. | ||
// | ||
|
||
#import "NSFileManager+ChatSecure.h" | ||
|
||
@implementation NSFileManager (ChatSecure) | ||
|
||
- (void)otr_enumerateFilesInDirectory:(NSString *)directory block:(void (^)(NSString *fullPath,BOOL *stop))enumerateBlock | ||
{ | ||
BOOL isDirecotry = NO; | ||
BOOL exists = [self fileExistsAtPath:directory isDirectory:&isDirecotry]; | ||
if (enumerateBlock && isDirecotry && exists) { | ||
NSDirectoryEnumerator *directoryEnumerator = [self enumeratorAtPath:directory]; | ||
NSString *file = nil; | ||
BOOL stop = NO; | ||
while ((file = [directoryEnumerator nextObject]) && !stop) { | ||
NSString *path = [NSString pathWithComponents:@[directory,file]]; | ||
enumerateBlock(path,&stop); | ||
} | ||
} | ||
} | ||
|
||
- (BOOL)otr_setFileProtection:(NSString *)fileProtection forFilesInDirectory:(NSString *)directory | ||
{ | ||
__block BOOL success = YES; | ||
[self otr_enumerateFilesInDirectory:directory block:^(NSString *fullPath, BOOL *stop) { | ||
success = [self setAttributes:@{NSFileProtectionKey:fileProtection} | ||
ofItemAtPath:fullPath error:nil]; | ||
*stop = !success; | ||
}]; | ||
return success; | ||
} | ||
|
||
- (BOOL)otr_excudeFromBackUpFilesInDirectory:(NSString *)directory | ||
{ | ||
__block BOOL success = YES; | ||
[self otr_enumerateFilesInDirectory:directory block:^(NSString *fullPath, BOOL *stop) { | ||
success = [self setAttributes:@{NSURLIsExcludedFromBackupKey:@(YES)} ofItemAtPath:fullPath error:nil]; | ||
*stop = !success; | ||
}]; | ||
return success; | ||
} | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.