Respond to CR.

// FREEBIE
pull/1/head
Matthew Chen 9 years ago
parent c6a280e005
commit e724acc978

@ -410,8 +410,7 @@ static NSString *const kURLHostVerifyPrefix = @"verify";
OutboundCallInitiator *outboundCallInitiator = [Environment getCurrent].outboundCallInitiator; OutboundCallInitiator *outboundCallInitiator = [Environment getCurrent].outboundCallInitiator;
OWSAssert(outboundCallInitiator); OWSAssert(outboundCallInitiator);
[outboundCallInitiator initiateCallWithHandle:phoneNumber]; return [outboundCallInitiator initiateCallWithHandle:phoneNumber];
return YES;
} else if ([userActivity.activityType isEqualToString:@"INStartAudioCallIntent"]) { } else if ([userActivity.activityType isEqualToString:@"INStartAudioCallIntent"]) {
if (!SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(10, 0)) { if (!SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(10, 0)) {
@ -455,8 +454,7 @@ static NSString *const kURLHostVerifyPrefix = @"verify";
OutboundCallInitiator *outboundCallInitiator = [Environment getCurrent].outboundCallInitiator; OutboundCallInitiator *outboundCallInitiator = [Environment getCurrent].outboundCallInitiator;
OWSAssert(outboundCallInitiator); OWSAssert(outboundCallInitiator);
[outboundCallInitiator initiateCallWithHandle:phoneNumber]; return [outboundCallInitiator initiateCallWithHandle:phoneNumber];
return YES;
} else { } else {
DDLogWarn(@"%@ called %s with userActivity: %@, but not yet supported.", DDLogWarn(@"%@ called %s with userActivity: %@, but not yet supported.",
self.tag, self.tag,

@ -23,33 +23,30 @@ import Foundation
/** /**
* |handle| is a user formatted phone number, e.g. from a system contacts entry * |handle| is a user formatted phone number, e.g. from a system contacts entry
*/ */
public func initiateCall(handle: String) { public func initiateCall(handle: String) -> Bool {
Logger.info("\(TAG) in \(#function) with handle: \(handle)") Logger.info("\(TAG) in \(#function) with handle: \(handle)")
guard let recipientId = PhoneNumber(fromUserSpecifiedText: handle)?.toE164() else { guard let recipientId = PhoneNumber(fromUserSpecifiedText: handle)?.toE164() else {
Logger.warn("\(TAG) unable to parse signalId from phone number: \(handle)") Logger.warn("\(TAG) unable to parse signalId from phone number: \(handle)")
return return false
} }
initiateCall(recipientId: recipientId) return initiateCall(recipientId: recipientId)
} }
/** /**
* |recipientId| is a e164 formatted phone number. * |recipientId| is a e164 formatted phone number.
*/ */
public func initiateCall(recipientId: String) { public func initiateCall(recipientId: String) -> Bool {
self.initiateWebRTCAudioCall(recipientId: recipientId) // Rather than an init-assigned dependency property, we access `callUIAdapter` via Environment
}
private func initiateWebRTCAudioCall(recipientId: String) {
// Rather than an init-assigned dependency property, we access `callUIAdapter` via Environment
// because it can change after app launch due to user settings // because it can change after app launch due to user settings
guard let callUIAdapter = Environment.getCurrent().callUIAdapter else { guard let callUIAdapter = Environment.getCurrent().callUIAdapter else {
assertionFailure() assertionFailure()
Logger.error("\(TAG) can't initiate call because callUIAdapter is nil") Logger.error("\(TAG) can't initiate call because callUIAdapter is nil")
return return false
} }
callUIAdapter.startAndShowOutgoingCall(recipientId: recipientId) callUIAdapter.startAndShowOutgoingCall(recipientId: recipientId)
return true
} }
} }

Loading…
Cancel
Save