Skip to content

Commit

Permalink
Merge branch 'develop' into hold2record
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisballinger committed Apr 15, 2015
2 parents 2627e9a + b998683 commit 57b1b33
Show file tree
Hide file tree
Showing 33 changed files with 97 additions and 311 deletions.
54 changes: 40 additions & 14 deletions ChatSecure.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
objects = {

/* Begin PBXBuildFile section */
26456792F7EBE46ADC17E5BC /* libPods.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 25A3853627C1F67D3A296AB4 /* libPods.a */; };
3CC9B590E308D3C320E9548B /* libPods.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 25A3853627C1F67D3A296AB4 /* libPods.a */; };
632461521A1ADC77000EF33B /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = 633104D61A169EC800C17BAE /* Localizable.strings */; };
632461581A1AE553000EF33B /* OTRCoreDataMigrationTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 632461571A1AE553000EF33B /* OTRCoreDataMigrationTests.m */; };
Expand All @@ -24,7 +25,6 @@
633106811A16D1A300C17BAE /* OTREncryptionManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 633105181A16D1A300C17BAE /* OTREncryptionManager.m */; };
633106831A16D1A300C17BAE /* OTRLanguageManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 6331051C1A16D1A300C17BAE /* OTRLanguageManager.m */; };
633106841A16D1A300C17BAE /* OTROAuthRefresher.m in Sources */ = {isa = PBXBuildFile; fileRef = 6331051E1A16D1A300C17BAE /* OTROAuthRefresher.m */; };
633106851A16D1A300C17BAE /* OTROnboardingStepsController.m in Sources */ = {isa = PBXBuildFile; fileRef = 633105201A16D1A300C17BAE /* OTROnboardingStepsController.m */; };
633106861A16D1A300C17BAE /* OTRProtocolManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 633105231A16D1A300C17BAE /* OTRProtocolManager.m */; };
6331068C1A16D1A300C17BAE /* OTRSettingsManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 6331052F1A16D1A300C17BAE /* OTRSettingsManager.m */; };
6331068D1A16D1A300C17BAE /* OTRTorManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 633105311A16D1A300C17BAE /* OTRTorManager.m */; };
Expand Down Expand Up @@ -92,7 +92,6 @@
633106FD1A16D1A300C17BAE /* OTRComposeViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 633106211A16D1A300C17BAE /* OTRComposeViewController.m */; };
633106FE1A16D1A300C17BAE /* OTRConversationViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 633106231A16D1A300C17BAE /* OTRConversationViewController.m */; };
633106FF1A16D1A300C17BAE /* OTRCreateAccountChooserViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 633106251A16D1A300C17BAE /* OTRCreateAccountChooserViewController.m */; };
633107001A16D1A300C17BAE /* OTRDatabasePassphraseViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 633106271A16D1A300C17BAE /* OTRDatabasePassphraseViewController.m */; };
633107011A16D1A300C17BAE /* OTRDatabaseUnlockViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 633106291A16D1A300C17BAE /* OTRDatabaseUnlockViewController.m */; };
633107021A16D1A300C17BAE /* OTRDoubleSettingViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 6331062B1A16D1A300C17BAE /* OTRDoubleSettingViewController.m */; };
633107031A16D1A300C17BAE /* OTRFingerprintsViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 6331062D1A16D1A300C17BAE /* OTRFingerprintsViewController.m */; };
Expand Down Expand Up @@ -261,8 +260,6 @@
6331051C1A16D1A300C17BAE /* OTRLanguageManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = OTRLanguageManager.m; sourceTree = "<group>"; };
6331051D1A16D1A300C17BAE /* OTROAuthRefresher.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OTROAuthRefresher.h; sourceTree = "<group>"; };
6331051E1A16D1A300C17BAE /* OTROAuthRefresher.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = OTROAuthRefresher.m; sourceTree = "<group>"; };
6331051F1A16D1A300C17BAE /* OTROnboardingStepsController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OTROnboardingStepsController.h; sourceTree = "<group>"; };
633105201A16D1A300C17BAE /* OTROnboardingStepsController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = OTROnboardingStepsController.m; sourceTree = "<group>"; };
633105211A16D1A300C17BAE /* OTRProtocol.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OTRProtocol.h; sourceTree = "<group>"; };
633105221A16D1A300C17BAE /* OTRProtocolManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OTRProtocolManager.h; sourceTree = "<group>"; };
633105231A16D1A300C17BAE /* OTRProtocolManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = OTRProtocolManager.m; sourceTree = "<group>"; };
Expand Down Expand Up @@ -400,8 +397,6 @@
633106231A16D1A300C17BAE /* OTRConversationViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = OTRConversationViewController.m; sourceTree = "<group>"; };
633106241A16D1A300C17BAE /* OTRCreateAccountChooserViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OTRCreateAccountChooserViewController.h; sourceTree = "<group>"; };
633106251A16D1A300C17BAE /* OTRCreateAccountChooserViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = OTRCreateAccountChooserViewController.m; sourceTree = "<group>"; };
633106261A16D1A300C17BAE /* OTRDatabasePassphraseViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OTRDatabasePassphraseViewController.h; sourceTree = "<group>"; };
633106271A16D1A300C17BAE /* OTRDatabasePassphraseViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = OTRDatabasePassphraseViewController.m; sourceTree = "<group>"; };
633106281A16D1A300C17BAE /* OTRDatabaseUnlockViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OTRDatabaseUnlockViewController.h; sourceTree = "<group>"; };
633106291A16D1A300C17BAE /* OTRDatabaseUnlockViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = OTRDatabaseUnlockViewController.m; sourceTree = "<group>"; };
6331062A1A16D1A300C17BAE /* OTRDoubleSettingViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OTRDoubleSettingViewController.h; sourceTree = "<group>"; };
Expand Down Expand Up @@ -588,6 +583,7 @@
63FABC8F1A41218E009BF681 /* NSString+ChatSecure.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSString+ChatSecure.h"; sourceTree = "<group>"; };
63FABC901A41218E009BF681 /* NSString+ChatSecure.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSString+ChatSecure.m"; sourceTree = "<group>"; };
954B60A022C05FDE4DCFEF6E /* Pods.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = Pods.debug.xcconfig; path = "Pods/Target Support Files/Pods/Pods.debug.xcconfig"; sourceTree = "<group>"; };
B977533C20F88A4A840303F9 /* Pods.beta.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = Pods.beta.xcconfig; path = "Pods/Target Support Files/Pods/Pods.beta.xcconfig"; sourceTree = "<group>"; };
D9365E791A1EB0050006434A /* torrc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = torrc; path = Resources/torrc; sourceTree = "<group>"; };
D973D7051A2D4094004D353E /* Pods-acknowledgements.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = "Pods-acknowledgements.plist"; path = "Pods/Target Support Files/Pods/Pods-acknowledgements.plist"; sourceTree = SOURCE_ROOT; };
/* End PBXFileReference section */
Expand All @@ -605,6 +601,7 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
26456792F7EBE46ADC17E5BC /* libPods.a in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down Expand Up @@ -690,8 +687,6 @@
6331051C1A16D1A300C17BAE /* OTRLanguageManager.m */,
6331051D1A16D1A300C17BAE /* OTROAuthRefresher.h */,
6331051E1A16D1A300C17BAE /* OTROAuthRefresher.m */,
6331051F1A16D1A300C17BAE /* OTROnboardingStepsController.h */,
633105201A16D1A300C17BAE /* OTROnboardingStepsController.m */,
633105211A16D1A300C17BAE /* OTRProtocol.h */,
633105221A16D1A300C17BAE /* OTRProtocolManager.h */,
633105231A16D1A300C17BAE /* OTRProtocolManager.m */,
Expand Down Expand Up @@ -894,8 +889,6 @@
633106231A16D1A300C17BAE /* OTRConversationViewController.m */,
633106241A16D1A300C17BAE /* OTRCreateAccountChooserViewController.h */,
633106251A16D1A300C17BAE /* OTRCreateAccountChooserViewController.m */,
633106261A16D1A300C17BAE /* OTRDatabasePassphraseViewController.h */,
633106271A16D1A300C17BAE /* OTRDatabasePassphraseViewController.m */,
633106281A16D1A300C17BAE /* OTRDatabaseUnlockViewController.h */,
633106291A16D1A300C17BAE /* OTRDatabaseUnlockViewController.m */,
6331062A1A16D1A300C17BAE /* OTRDoubleSettingViewController.h */,
Expand Down Expand Up @@ -1204,6 +1197,7 @@
children = (
954B60A022C05FDE4DCFEF6E /* Pods.debug.xcconfig */,
154CBBDFA16BDE9C28017B1F /* Pods.release.xcconfig */,
B977533C20F88A4A840303F9 /* Pods.beta.xcconfig */,
);
name = Pods;
sourceTree = "<group>";
Expand Down Expand Up @@ -1243,9 +1237,11 @@
isa = PBXNativeTarget;
buildConfigurationList = 6396AFC01A169D54009F3E6C /* Build configuration list for PBXNativeTarget "ChatSecureTests" */;
buildPhases = (
C6209FD4E67B0AE13FA1CE51 /* Check Pods Manifest.lock */,
6396AFAF1A169D54009F3E6C /* Sources */,
6396AFB01A169D54009F3E6C /* Frameworks */,
6396AFB11A169D54009F3E6C /* Resources */,
F92CD31427EF6855AC77AF5E /* Copy Pods Resources */,
);
buildRules = (
);
Expand Down Expand Up @@ -1386,6 +1382,21 @@
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods/Pods-resources.sh\"\n";
showEnvVarsInLog = 0;
};
C6209FD4E67B0AE13FA1CE51 /* Check Pods Manifest.lock */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
name = "Check Pods Manifest.lock";
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [[ $? != 0 ]] ; then\n cat << EOM\nerror: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\nEOM\n exit 1\nfi\n";
showEnvVarsInLog = 0;
};
C7FDC650D88ABA89D81EBBF7 /* Check Pods Manifest.lock */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
Expand All @@ -1401,6 +1412,21 @@
shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [[ $? != 0 ]] ; then\n cat << EOM\nerror: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\nEOM\n exit 1\nfi\n";
showEnvVarsInLog = 0;
};
F92CD31427EF6855AC77AF5E /* Copy Pods Resources */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
name = "Copy Pods Resources";
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods/Pods-resources.sh\"\n";
showEnvVarsInLog = 0;
};
/* End PBXShellScriptBuildPhase section */

/* Begin PBXSourcesBuildPhase section */
Expand Down Expand Up @@ -1547,7 +1573,6 @@
633106D51A16D1A300C17BAE /* OTRMessage+JSQMessageData.m in Sources */,
633107011A16D1A300C17BAE /* OTRDatabaseUnlockViewController.m in Sources */,
633106EA1A16D1A300C17BAE /* OTRSecrets.m in Sources */,
633107001A16D1A300C17BAE /* OTRDatabasePassphraseViewController.m in Sources */,
633107021A16D1A300C17BAE /* OTRDoubleSettingViewController.m in Sources */,
633106D41A16D1A300C17BAE /* OTRBuddy.m in Sources */,
633106791A16D1A300C17BAE /* UIActivity+ChatSecure.m in Sources */,
Expand All @@ -1568,7 +1593,6 @@
633106C81A16D1A300C17BAE /* OTRSettingsGroup.m in Sources */,
633107271A16D1A400C17BAE /* OTRSocialButtonsView.m in Sources */,
63C4BD271A1E9BE1001696CD /* _OTRManagedOAuthAccount.m in Sources */,
633106851A16D1A300C17BAE /* OTROnboardingStepsController.m in Sources */,
63FABC911A41218E009BF681 /* NSString+ChatSecure.m in Sources */,
633106D91A16D1A300C17BAE /* OTRYapDatabaseObject.m in Sources */,
6331067C1A16D1A300C17BAE /* UIViewController+ChatSecure.m in Sources */,
Expand All @@ -1582,9 +1606,9 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
6396AFBA1A169D54009F3E6C /* ChatSecureTests.m in Sources */,
63DDD8B51A9E94B700C0A918 /* OTRMediaTests.m in Sources */,
632461581A1AE553000EF33B /* OTRCoreDataMigrationTests.m in Sources */,
63DDD8B51A9E94B700C0A918 /* OTRMediaTests.m in Sources */,
6396AFBA1A169D54009F3E6C /* ChatSecureTests.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down Expand Up @@ -1694,6 +1718,7 @@
};
632461561A1AE1C1000EF33B /* Beta */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = B977533C20F88A4A840303F9 /* Pods.beta.xcconfig */;
buildSettings = {
BUNDLE_LOADER = "$(TEST_HOST)";
FRAMEWORK_SEARCH_PATHS = (
Expand Down Expand Up @@ -1839,6 +1864,7 @@
};
6396AFC21A169D54009F3E6C /* Release */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 154CBBDFA16BDE9C28017B1F /* Pods.release.xcconfig */;
buildSettings = {
BUNDLE_LOADER = "$(TEST_HOST)";
FRAMEWORK_SEARCH_PATHS = (
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
<<<<<<< HEAD
LastUpgradeVersion = "0630"
=======
LastUpgradeVersion = "0610"
>>>>>>> develop
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
3 changes: 3 additions & 0 deletions ChatSecure/Classes/Controllers/OTRDatabaseManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
#import "YapDatabaseConnection.h"
#import "YapDatabase.h"
#import "YapDatabaseTransaction.h"
#import "OTRMediaServer.h"
#import "OTRMediaFileManager.h"

extern NSString *const OTRYapDatabaseRelationshipName;
extern NSString *const OTRYapDatabseMessageIdSecondaryIndex;
Expand All @@ -19,6 +21,7 @@ extern NSString *const OTRYapDatabseMessageIdSecondaryIndexExtension;
@interface OTRDatabaseManager : NSObject

@property (nonatomic, readonly) YapDatabase *database;
@property (nonatomic, strong) OTRMediaServer *mediaServer;
@property (nonatomic, readonly) YapDatabaseConnection *readOnlyDatabaseConnection;
@property (nonatomic, readonly) YapDatabaseConnection *readWriteDatabaseConnection;

Expand Down
22 changes: 20 additions & 2 deletions ChatSecure/Classes/Controllers/OTRDatabaseManager.m
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,30 @@ @interface OTRDatabaseManager ()
@implementation OTRDatabaseManager

- (BOOL) setupDatabaseWithName:(NSString*)databaseName {
BOOL success = NO;
if ([self setupYapDatabaseWithName:databaseName] )
{
[self migrateCoreDataToYapDatabase];
return YES;
success = YES;
}
return NO;
success = [self setupSecureMediaStorage];
return success;
}

- (BOOL)setupSecureMediaStorage
{
NSString *password = [self databasePassphrase];
NSString *path = [OTRDatabaseManager yapDatabasePathWithName:nil];
path = [path stringByAppendingPathComponent:@"ChatSecure-media.sqlite"];
BOOL success = [[OTRMediaFileManager sharedInstance] setupWithPath:path password:password];

self.mediaServer = [OTRMediaServer sharedInstance];
NSError *error = nil;
BOOL mediaServerStarted = [self.mediaServer startOnPort:8080 error:&error];
if (!mediaServerStarted) {
DDLogError(@"Error starting media server: %@",error);
}
return success;
}

- (void)migrateCoreDataToYapDatabase
Expand Down
1 change: 0 additions & 1 deletion ChatSecure/Classes/Controllers/OTREncryptionManager.m
Original file line number Diff line number Diff line change
Expand Up @@ -424,7 +424,6 @@ - (void)dataHandler:(OTRDataHandler*)dataHandler
DDLogInfo(@"offered file transfer: %@", transfer);

// for now, just accept all incoming files
#warning auto-accept of all incoming files
[dataHandler startIncomingTransfer:transfer];
}

Expand Down
2 changes: 1 addition & 1 deletion ChatSecure/Classes/Controllers/OTRMediaFileManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ extern NSString *const kOTRRootMediaDirectory;

@property (nonatomic, strong, readonly) IOCipher *ioCipher;

- (void)setupWithPath:(NSString *)path password:(NSString *)password;
- (BOOL)setupWithPath:(NSString *)path password:(NSString *)password;

- (void)copyDataFromFilePath:(NSString *)filePath
toEncryptedPath:(NSString *)path
Expand Down
3 changes: 2 additions & 1 deletion ChatSecure/Classes/Controllers/OTRMediaFileManager.m
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,10 @@ - (instancetype)init

#pragma - mark Public Methods

- (void)setupWithPath:(NSString *)path password:(NSString *)password
- (BOOL)setupWithPath:(NSString *)path password:(NSString *)password
{
_ioCipher = [[IOCipher alloc] initWithPath:path password:password];
return _ioCipher != nil;
}

- (void)copyDataFromFilePath:(NSString *)filePath toEncryptedPath:(NSString *)path completionQueue:(dispatch_queue_t)completionQueue completion:(void (^)(NSError *))completion
Expand Down
13 changes: 0 additions & 13 deletions ChatSecure/Classes/Controllers/OTROnboardingStepsController.h

This file was deleted.

58 changes: 0 additions & 58 deletions ChatSecure/Classes/Controllers/OTROnboardingStepsController.m

This file was deleted.

9 changes: 9 additions & 0 deletions ChatSecure/Classes/Controllers/XMPP/OTRXMPPManager.m
Original file line number Diff line number Diff line change
Expand Up @@ -450,6 +450,15 @@ - (void)disconnect

[self.xmppStream disconnect];

[self.databaseConnection asyncReadWriteWithBlock:^(YapDatabaseReadWriteTransaction *transaction) {
NSArray *buddiesArray = [self.account allBuddiesWithTransaction:transaction];
for (OTRXMPPBuddy *buddy in buddiesArray) {
buddy.status = OTRBuddyStatusOffline;
buddy.chatState = kOTRChatStateGone;

[buddy saveWithTransaction:transaction];
}
}];

if([OTRSettingsManager boolForOTRSettingKey:kOTRSettingKeyDeleteOnDisconnect])
{
Expand Down
Loading

0 comments on commit 57b1b33

Please sign in to comment.