diff --git a/ChatSecure.xcodeproj/project.pbxproj b/ChatSecure.xcodeproj/project.pbxproj index 5aa96e450..4efadd7b7 100644 --- a/ChatSecure.xcodeproj/project.pbxproj +++ b/ChatSecure.xcodeproj/project.pbxproj @@ -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 */; }; @@ -594,6 +595,7 @@ 63DC0EB41A1ABC86002C9598 /* OTR_Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = OTR_Debug.xcconfig; path = configurations/OTR_Debug.xcconfig; sourceTree = ""; }; 63DC0EB61A1ABC86002C9598 /* OTR_Release.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = OTR_Release.xcconfig; path = configurations/OTR_Release.xcconfig; sourceTree = ""; }; 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 = ""; }; + 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 = ""; }; D9365E791A1EB0050006434A /* torrc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = torrc; path = Resources/torrc; sourceTree = ""; }; 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 */ @@ -611,6 +613,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + 26456792F7EBE46ADC17E5BC /* libPods.a in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -1190,6 +1193,7 @@ children = ( 954B60A022C05FDE4DCFEF6E /* Pods.debug.xcconfig */, 154CBBDFA16BDE9C28017B1F /* Pods.release.xcconfig */, + B977533C20F88A4A840303F9 /* Pods.beta.xcconfig */, ); name = Pods; sourceTree = ""; @@ -1229,9 +1233,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 = ( ); @@ -1372,6 +1378,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; @@ -1387,6 +1408,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 */ @@ -1570,8 +1606,8 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - 6396AFBA1A169D54009F3E6C /* ChatSecureTests.m in Sources */, 632461581A1AE553000EF33B /* OTRCoreDataMigrationTests.m in Sources */, + 6396AFBA1A169D54009F3E6C /* ChatSecureTests.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -1680,6 +1716,7 @@ }; 632461561A1AE1C1000EF33B /* Beta */ = { isa = XCBuildConfiguration; + baseConfigurationReference = B977533C20F88A4A840303F9 /* Pods.beta.xcconfig */; buildSettings = { BUNDLE_LOADER = "$(TEST_HOST)"; FRAMEWORK_SEARCH_PATHS = ( @@ -1823,6 +1860,7 @@ }; 6396AFC21A169D54009F3E6C /* Release */ = { isa = XCBuildConfiguration; + baseConfigurationReference = 154CBBDFA16BDE9C28017B1F /* Pods.release.xcconfig */; buildSettings = { BUNDLE_LOADER = "$(TEST_HOST)"; FRAMEWORK_SEARCH_PATHS = ( diff --git a/ChatSecure.xcodeproj/xcshareddata/xcschemes/ChatSecureTests.xcscheme b/ChatSecure.xcodeproj/xcshareddata/xcschemes/ChatSecureTests.xcscheme new file mode 100644 index 000000000..98e237da5 --- /dev/null +++ b/ChatSecure.xcodeproj/xcshareddata/xcschemes/ChatSecureTests.xcscheme @@ -0,0 +1,96 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ChatSecure/Classes/Controllers/XMPP/OTRXMPPManager.m b/ChatSecure/Classes/Controllers/XMPP/OTRXMPPManager.m index 0a4e67f34..0ae03141f 100644 --- a/ChatSecure/Classes/Controllers/XMPP/OTRXMPPManager.m +++ b/ChatSecure/Classes/Controllers/XMPP/OTRXMPPManager.m @@ -57,6 +57,8 @@ #import "OTRAccount.h" #import "OTRXMPPPresenceSubscriptionRequest.h" #import "OTRvCardYapDatabaseStorage.h" +#import "OTRFacebookOAuthXMPPAccount.h" +#import "FBAccessTokenData.h" NSString *const OTRXMPPRegisterSucceededNotificationName = @"OTRXMPPRegisterSucceededNotificationName"; NSString *const OTRXMPPRegisterFailedNotificationName = @"OTRXMPPRegisterFailedNotificationName"; @@ -405,6 +407,26 @@ - (BOOL)connectWithJID:(NSString*) myJID password:(NSString*)myPassword; self.password = myPassword; self.connectionStatus = OTRProtocolConnectionStatusConnecting; + // We aren't properly storing the Facebook JID after the OAuthToken refresher + // so have to rely on this hack for now. In theory this should be fixed elsewhere + // however that code requires a refactor first to avoid code duplication. + // Facebook Chat over XMPP will be disabled on April 30, 2015 anyway. :( + if (!myJID.length) { + if ([self.account isKindOfClass:[OTRFacebookOAuthXMPPAccount class]]) { + OTRFacebookOAuthXMPPAccount *facebookAccount = (OTRFacebookOAuthXMPPAccount*)self.account; + FBAccessTokenData *tokenData = facebookAccount.accountSpecificToken; + myJID = [NSString stringWithFormat:@"%@@%@", tokenData.userID, @"chat.facebook.com"]; + [[OTRDatabaseManager sharedInstance].readWriteDatabaseConnection asyncReadWriteWithBlock:^(YapDatabaseReadWriteTransaction *transaction) { + OTRFacebookOAuthXMPPAccount *account = [transaction objectForKey:facebookAccount.uniqueId inCollection:[[facebookAccount class] collection]]; + if (account) { + account = [account copy]; + account.username = myJID; + [transaction setObject:account forKey:account.uniqueId inCollection:[[facebookAccount class] collection]]; + } + } completionBlock:nil]; + } + } + self.JID = [XMPPJID jidWithString:myJID resource:self.account.resource]; if (![self.JID.domain isEqualToString:self.xmppStream.myJID.domain]) { diff --git a/ChatSecure/Info.plist b/ChatSecure/Info.plist index cce2034d7..a8e73a65a 100644 --- a/ChatSecure/Info.plist +++ b/ChatSecure/Info.plist @@ -31,7 +31,7 @@ CFBundleVersion - 9 + 10 FacebookAppID 447241325394334 FacebookDisplayName diff --git a/Podfile b/Podfile index 1b63a7712..c5e1d3470 100755 --- a/Podfile +++ b/Podfile @@ -4,6 +4,8 @@ inhibit_all_warnings! source 'https://github.com/CocoaPods/Specs.git' +link_with 'ChatSecure', 'ChatSecureTests' + pod 'AFNetworking', '~> 2.4' pod "Appirater", '~> 2.0' pod 'OpenInChrome', '~> 0.0'