diff --git a/Podfile.lock b/Podfile.lock index af8dda1fe..153b82414 100644 --- a/Podfile.lock +++ b/Podfile.lock @@ -125,7 +125,7 @@ EXTERNAL SOURCES: :branch: signal-master :git: https://github.com/WhisperSystems/JSQMessagesViewController.git SignalServiceKit: - :path: "." + :path: . SocketRocket: :git: https://github.com/facebook/SocketRocket.git diff --git a/Signal/src/call/CallService.swift b/Signal/src/call/CallService.swift index 11a4aea5f..e8f81ea89 100644 --- a/Signal/src/call/CallService.swift +++ b/Signal/src/call/CallService.swift @@ -874,7 +874,7 @@ protocol CallServiceObserver: class { call.callRecord = callRecord let message = DataChannelMessage.forConnected(callId: call.signalingId) - peerConnectionClient.sendDataChannelMessage(data: message.asData(), description:"connected") + peerConnectionClient.sendDataChannelMessage(data: message.asData(), description:"connected", isCritical:true) handleConnectedCall(call) } @@ -994,7 +994,7 @@ protocol CallServiceObserver: class { // If the call is connected, we can send the hangup via the data channel. let message = DataChannelMessage.forHangup(callId: call.signalingId) - peerConnectionClient.sendDataChannelMessage(data: message.asData(), description:"hangup") + peerConnectionClient.sendDataChannelMessage(data: message.asData(), description:"hangup", isCritical:true) // If the call hasn't started yet, we don't have a data channel to communicate the hang up. Use Signal Service Message. let hangupMessage = OWSCallHangupMessage(callId: call.signalingId) diff --git a/Signal/src/call/PeerConnectionClient.swift b/Signal/src/call/PeerConnectionClient.swift index b9a38dc5f..859eacd03 100644 --- a/Signal/src/call/PeerConnectionClient.swift +++ b/Signal/src/call/PeerConnectionClient.swift @@ -504,7 +504,7 @@ class PeerConnectionClient: NSObject, RTCPeerConnectionDelegate, RTCDataChannelD // MARK: - Data Channel - public func sendDataChannelMessage(data: Data, description: String) { + public func sendDataChannelMessage(data: Data, description: String, isCritical: Bool = false) { AssertIsOnMainThread() PeerConnectionClient.signalingQueue.async { @@ -527,6 +527,9 @@ class PeerConnectionClient: NSObject, RTCPeerConnectionDelegate, RTCDataChannelD Logger.debug("\(self.TAG) sendDataChannelMessage succeeded: \(description)") } else { Logger.warn("\(self.TAG) sendDataChannelMessage failed: \(description)") + if isCritical { + OWSProdError(OWSAnalyticsEvents.peerConnectionClientErrorSendDataChannelMessageFailed(), file:#file, function:#function, line:#line) + } } } } diff --git a/SignalServiceKit/Utilities/extract_analytics_event_names.py b/SignalServiceKit/Utilities/extract_analytics_event_names.py index e14569f10..027627191 100755 --- a/SignalServiceKit/Utilities/extract_analytics_event_names.py +++ b/SignalServiceKit/Utilities/extract_analytics_event_names.py @@ -218,34 +218,6 @@ def update_event_names(header_file_path, source_file_path): # event_names = sorted(set(event_names)) code_generation_marker = '#pragma mark - Code Generation Marker' - # Header - filepath = header_file_path - with open(filepath, 'rt') as f: - text = f.read() - - code_generation_start = text.find(code_generation_marker) - code_generation_end = text.rfind(code_generation_marker) - if code_generation_start < 0: - print 'Could not find marker in file:', file - sys.exit(1) - if code_generation_end < 0 or code_generation_end == code_generation_start: - print 'Could not find marker in file:', file - sys.exit(1) - - generated = code_generation_marker - for event_name in sorted(set(event_names)): - # Example: - # + (NSString *)call_service_call_already_set; - objc_name = objc_name_for_event_name(event_name) - text_for_event = '+ (NSString *)%s;' % (objc_name,) - generated = generated + '\n\n' + text_for_event - generated = generated + '\n\n' + code_generation_marker - print 'generated', generated - new_text = text[:code_generation_start] + generated + text[code_generation_end + len(code_generation_marker):] - print 'text', new_text - with open(filepath, 'wt') as f: - f.write(new_text) - # Source filepath = source_file_path with open(filepath, 'rt') as f: @@ -331,6 +303,36 @@ def update_event_names(header_file_path, source_file_path): f.write(new_text) + # Header + filepath = header_file_path + with open(filepath, 'rt') as f: + text = f.read() + + code_generation_start = text.find(code_generation_marker) + code_generation_end = text.rfind(code_generation_marker) + if code_generation_start < 0: + print 'Could not find marker in file:', file + sys.exit(1) + if code_generation_end < 0 or code_generation_end == code_generation_start: + print 'Could not find marker in file:', file + sys.exit(1) + + generated = code_generation_marker + for event_name in all_event_names: + # Example: + # + (NSString *)call_service_call_already_set; + objc_name = objc_name_for_event_name(event_name) + text_for_event = '+ (NSString *)%s;' % (objc_name,) + generated = generated + '\n\n' + text_for_event + generated = generated + '\n\n' + code_generation_marker + print 'generated', generated + new_text = text[:code_generation_start] + generated + text[code_generation_end + len(code_generation_marker):] + print 'text', new_text + with open(filepath, 'wt') as f: + f.write(new_text) + + + if __name__ == "__main__": # print 'git_repo_path', git_repo_path diff --git a/SignalServiceKit/src/Util/OWSAnalyticsEvents.h b/SignalServiceKit/src/Util/OWSAnalyticsEvents.h index c77b84293..8e5410d5d 100755 --- a/SignalServiceKit/src/Util/OWSAnalyticsEvents.h +++ b/SignalServiceKit/src/Util/OWSAnalyticsEvents.h @@ -22,6 +22,28 @@ NS_ASSUME_NONNULL_BEGIN + (NSString *)appLaunch; ++ (NSString *)appLaunchComplete; + ++ (NSString *)callServiceCallAlreadySet; + ++ (NSString *)callServiceCallIdMismatch; + ++ (NSString *)callServiceCallMismatch; + ++ (NSString *)callServiceCallMissing; + ++ (NSString *)callServiceCallUnexpectedlyIdle; + ++ (NSString *)callServiceCouldNotCreatePeerConnectionClientPromise; + ++ (NSString *)callServiceCouldNotCreateReadyToSendIceUpdatesPromise; + ++ (NSString *)callServiceMissingFulfillReadyToSendIceUpdatesPromise; + ++ (NSString *)callServicePeerConnectionAlreadySet; + ++ (NSString *)callServicePeerConnectionMissing; + + (NSString *)contactsErrorContactsIntersectionFailed; + (NSString *)errorAttachmentRequestFailed; @@ -60,6 +82,8 @@ NS_ASSUME_NONNULL_BEGIN + (NSString *)messageManagerErrorMessageEnvelopeHasNoContent; ++ (NSString *)messageManagerErrorOversizeMessage; + + (NSString *)messageManagerErrorPrekeyBundleEnvelopeHasNoContent; + (NSString *)messageReceiverErrorLargeMessage; @@ -98,8 +122,12 @@ NS_ASSUME_NONNULL_BEGIN + (NSString *)messageSenderErrorUnexpectedKeyBundle; ++ (NSString *)peerConnectionClientErrorSendDataChannelMessageFailed; + + (NSString *)prekeysDeletedOldAcceptedSignedPrekey; ++ (NSString *)prekeysDeletedOldSignedPrekey; + + (NSString *)prekeysDeletedOldUnacceptedSignedPrekey; + (NSString *)registrationBegan; diff --git a/SignalServiceKit/src/Util/OWSAnalyticsEvents.m b/SignalServiceKit/src/Util/OWSAnalyticsEvents.m index 68823887a..fbe7f3c70 100755 --- a/SignalServiceKit/src/Util/OWSAnalyticsEvents.m +++ b/SignalServiceKit/src/Util/OWSAnalyticsEvents.m @@ -290,6 +290,11 @@ NS_ASSUME_NONNULL_BEGIN return @"message_sender_error_unexpected_key_bundle"; } ++ (NSString *)peerConnectionClientErrorSendDataChannelMessageFailed +{ + return @"peer_connection_client_error_send_data_channel_message_failed"; +} + + (NSString *)prekeysDeletedOldAcceptedSignedPrekey { return @"prekeys_deleted_old_accepted_signed_prekey";