Add script to extract and gather analytics event names.

// FREEBIE
pull/1/head
Matthew Chen 8 years ago
parent 0cf9c01af2
commit f1807cd709

@ -263,7 +263,7 @@ static NSString *const kURLHostVerifyPrefix = @"verify";
- (void)application:(UIApplication *)application didFailToRegisterForRemoteNotificationsWithError:(NSError *)error - (void)application:(UIApplication *)application didFailToRegisterForRemoteNotificationsWithError:(NSError *)error
{ {
OWSProdError(@"app_delegate_error_failed_to_register_for_remote_notifications"); OWSProdError([OWSAnalyticsEvents appDelegateErrorFailedToRegisterForRemoteNotifications]);
#ifdef DEBUG #ifdef DEBUG
DDLogWarn(@"%@ We're in debug mode. Faking success for remote registration with a fake push identifier", self.tag); DDLogWarn(@"%@ We're in debug mode. Faking success for remote registration with a fake push identifier", self.tag);
[PushManager.sharedManager.pushNotificationFutureSource trySetResult:[[NSMutableData dataWithLength:32] copy]]; [PushManager.sharedManager.pushNotificationFutureSource trySetResult:[[NSMutableData dataWithLength:32] copy]];

@ -261,10 +261,10 @@ NS_ASSUME_NONNULL_BEGIN
- (void)verifyChallengeAction:(nullable id)sender - (void)verifyChallengeAction:(nullable id)sender
{ {
[self startActivityIndicator]; [self startActivityIndicator];
OWSProdInfo(@"registration_registering_code"); OWSProdInfo([OWSAnalyticsEvents registrationRegisteringCode]);
[self.accountManager registerWithVerificationCode:[self validationCodeFromTextField]] [self.accountManager registerWithVerificationCode:[self validationCodeFromTextField]]
.then(^{ .then(^{
OWSProdInfo(@"registration_registering_submitted_code"); OWSProdInfo([OWSAnalyticsEvents registrationRegisteringSubmittedCode]);
DDLogInfo(@"%@ Successfully registered Signal account.", self.tag); DDLogInfo(@"%@ Successfully registered Signal account.", self.tag);
dispatch_async(dispatch_get_main_queue(), ^{ dispatch_async(dispatch_get_main_queue(), ^{
@ -280,7 +280,7 @@ NS_ASSUME_NONNULL_BEGIN
}); });
}) })
.catch(^(NSError *_Nonnull error) { .catch(^(NSError *_Nonnull error) {
OWSProdInfo(@"registration_registration_failed"); OWSProdInfo([OWSAnalyticsEvents registrationRegistrationFailed]);
DDLogError(@"%@ error verifying challenge: %@", self.tag, error); DDLogError(@"%@ error verifying challenge: %@", self.tag, error);
dispatch_async(dispatch_get_main_queue(), ^{ dispatch_async(dispatch_get_main_queue(), ^{
[self stopActivityIndicator]; [self stopActivityIndicator];
@ -324,7 +324,7 @@ NS_ASSUME_NONNULL_BEGIN
#pragma mark - Send codes again #pragma mark - Send codes again
- (void)sendCodeViaSMSAction:(id)sender { - (void)sendCodeViaSMSAction:(id)sender {
OWSProdInfo(@"registration_registering_requested_new_code_by_sms"); OWSProdInfo([OWSAnalyticsEvents registrationRegisteringRequestedNewCodeBySms]);
[self enableServerActions:NO]; [self enableServerActions:NO];
@ -343,7 +343,7 @@ NS_ASSUME_NONNULL_BEGIN
} }
- (void)sendCodeViaVoiceAction:(id)sender { - (void)sendCodeViaVoiceAction:(id)sender {
OWSProdInfo(@"registration_registering_requested_new_code_by_voice"); OWSProdInfo([OWSAnalyticsEvents registrationRegisteringRequestedNewCodeByVoice]);
[self enableServerActions:NO]; [self enableServerActions:NO];
@ -374,7 +374,7 @@ NS_ASSUME_NONNULL_BEGIN
} }
- (void)backButtonPressed:(id)sender { - (void)backButtonPressed:(id)sender {
OWSProdInfo(@"registration_verification_back"); OWSProdInfo([OWSAnalyticsEvents registrationVerificationBack]);
[self.navigationController popViewControllerAnimated:YES]; [self.navigationController popViewControllerAnimated:YES];
} }

@ -54,8 +54,8 @@ NSString *const kKeychainKey_LastRegisteredPhoneNumber = @"kKeychainKey_LastRegi
- (void)viewDidLoad { - (void)viewDidLoad {
[super viewDidLoad]; [super viewDidLoad];
OWSProdInfo(@"registration_began"); OWSProdInfo([OWSAnalyticsEvents registrationBegan]);
} }
- (void)createViews - (void)createViews
@ -341,7 +341,7 @@ NSString *const kKeychainKey_LastRegisteredPhoneNumber = @"kKeychainKey_LastRegi
__weak RegistrationViewController *weakSelf = self; __weak RegistrationViewController *weakSelf = self;
[TSAccountManager registerWithPhoneNumber:parsedPhoneNumber [TSAccountManager registerWithPhoneNumber:parsedPhoneNumber
success:^{ success:^{
OWSProdInfo(@"registration_registered_phone_number"); OWSProdInfo([OWSAnalyticsEvents registrationRegisteredPhoneNumber]);
[weakSelf.spinnerView stopAnimating]; [weakSelf.spinnerView stopAnimating];

@ -35,7 +35,8 @@ static NSString *const OWS103EnableVideoCallingMigrationId = @"103";
} }
failure:^(NSURLSessionDataTask *task, NSError *error) { failure:^(NSURLSessionDataTask *task, NSError *error) {
if (!IsNSErrorNetworkFailure(error)) { if (!IsNSErrorNetworkFailure(error)) {
OWSProdError(@"error_enable_video_calling_request_failed"); OWSProdError([OWSAnalyticsEvents
errorEnableVideoCallingRequestFailed]);
} }
DDLogError(@"%@ failed with error: %@", self.tag, error); DDLogError(@"%@ failed with error: %@", self.tag, error);
}]; }];

@ -151,7 +151,7 @@
} }
failure:^(NSURLSessionDataTask *task, NSError *error) { failure:^(NSURLSessionDataTask *task, NSError *error) {
if (!IsNSErrorNetworkFailure(error)) { if (!IsNSErrorNetworkFailure(error)) {
OWSProdError(@"error_update_attributes_request_failed"); OWSProdError([OWSAnalyticsEvents errorUpdateAttributesRequestFailed]);
} }
success = NO; success = NO;
DDLogError(@"Updating attributess failed with error: %@", error.description); DDLogError(@"Updating attributess failed with error: %@", error.description);

@ -160,7 +160,7 @@ NSString *const kNSNotificationName_LocalNumberDidChange = @"kNSNotificationName
remainingRetries:remainingRetries - 1]; remainingRetries:remainingRetries - 1];
} else { } else {
if (!IsNSErrorNetworkFailure(error)) { if (!IsNSErrorNetworkFailure(error)) {
OWSProdError(@"accounts_error_register_push_tokens_failed"); OWSProdError([OWSAnalyticsEvents accountsErrorRegisterPushTokensFailed]);
} }
failureHandler(error); failureHandler(error);
} }
@ -197,7 +197,7 @@ NSString *const kNSNotificationName_LocalNumberDidChange = @"kNSNotificationName
} }
failure:^(NSURLSessionDataTask *task, NSError *error) { failure:^(NSURLSessionDataTask *task, NSError *error) {
if (!IsNSErrorNetworkFailure(error)) { if (!IsNSErrorNetworkFailure(error)) {
OWSProdError(@"accounts_error_verification_code_request_failed"); OWSProdError([OWSAnalyticsEvents accountsErrorVerificationCodeRequestFailed]);
} }
DDLogError(@"%@ Failed to request verification code request with error:%@", self.tag, error); DDLogError(@"%@ Failed to request verification code request with error:%@", self.tag, error);
failureBlock(error); failureBlock(error);
@ -270,7 +270,7 @@ NSString *const kNSNotificationName_LocalNumberDidChange = @"kNSNotificationName
} }
failure:^(NSURLSessionDataTask *task, NSError *error) { failure:^(NSURLSessionDataTask *task, NSError *error) {
if (!IsNSErrorNetworkFailure(error)) { if (!IsNSErrorNetworkFailure(error)) {
OWSProdError(@"accounts_error_verify_account_request_failed"); OWSProdError([OWSAnalyticsEvents accountsErrorVerifyAccountRequestFailed]);
} }
DDLogWarn(@"%@ Error verifying code: %@", self.tag, error.debugDescription); DDLogWarn(@"%@ Error verifying code: %@", self.tag, error.debugDescription);
switch (error.code) { switch (error.code) {
@ -326,7 +326,7 @@ NSString *const kNSNotificationName_LocalNumberDidChange = @"kNSNotificationName
} }
failure:^(NSURLSessionDataTask *task, NSError *error) { failure:^(NSURLSessionDataTask *task, NSError *error) {
if (!IsNSErrorNetworkFailure(error)) { if (!IsNSErrorNetworkFailure(error)) {
OWSProdError(@"accounts_error_unregister_account_request_failed"); OWSProdError([OWSAnalyticsEvents accountsErrorUnregisterAccountRequestFailed]);
} }
DDLogError(@"%@ Failed to unregister with error: %@", self.tag, error); DDLogError(@"%@ Failed to unregister with error: %@", self.tag, error);
failureBlock(error); failureBlock(error);

@ -183,9 +183,9 @@ static const NSTimeInterval kSignedPreKeyUpdateFailureMaxFailureDuration = 10 *
failure:^(NSURLSessionDataTask *task, NSError *error) { failure:^(NSURLSessionDataTask *task, NSError *error) {
if (!IsNSErrorNetworkFailure(error)) { if (!IsNSErrorNetworkFailure(error)) {
if (modeCopy == RefreshPreKeysMode_SignedAndOneTime) { if (modeCopy == RefreshPreKeysMode_SignedAndOneTime) {
OWSProdError(@"error_prekeys_update_failed_signed_and_onetime"); OWSProdError([OWSAnalyticsEvents errorPrekeysUpdateFailedSignedAndOnetime]);
} else { } else {
OWSProdError(@"error_prekeys_update_failed_just_signed"); OWSProdError([OWSAnalyticsEvents errorPrekeysUpdateFailedJustSigned]);
} }
} }
@ -305,7 +305,7 @@ static const NSTimeInterval kSignedPreKeyUpdateFailureMaxFailureDuration = 10 *
} }
failure:^(NSURLSessionDataTask *task, NSError *error) { failure:^(NSURLSessionDataTask *task, NSError *error) {
if (!IsNSErrorNetworkFailure(error)) { if (!IsNSErrorNetworkFailure(error)) {
OWSProdError(@"error_prekeys_current_signed_prekey_request_failed"); OWSProdError([OWSAnalyticsEvents errorPrekeysCurrentSignedPrekeyRequestFailed]);
} }
DDLogWarn(@"%@ Could not retrieve current signed key from the service.", self.tag); DDLogWarn(@"%@ Could not retrieve current signed key from the service.", self.tag);
@ -316,7 +316,7 @@ static const NSTimeInterval kSignedPreKeyUpdateFailureMaxFailureDuration = 10 *
} }
failure:^(NSURLSessionDataTask *task, NSError *error) { failure:^(NSURLSessionDataTask *task, NSError *error) {
if (!IsNSErrorNetworkFailure(error)) { if (!IsNSErrorNetworkFailure(error)) {
OWSProdError(@"error_prekeys_available_prekeys_request_failed"); OWSProdError([OWSAnalyticsEvents errorPrekeysAvailablePrekeysRequestFailed]);
} }
DDLogError(@"%@ Failed to retrieve the number of available prekeys.", self.tag); DDLogError(@"%@ Failed to retrieve the number of available prekeys.", self.tag);
@ -402,9 +402,9 @@ static const NSTimeInterval kSignedPreKeyUpdateFailureMaxFailureDuration = 10 *
} }
if (signedPrekey.wasAcceptedByService) { if (signedPrekey.wasAcceptedByService) {
OWSProdInfo(@"prekeys_deleted_old_accepted_signed_prekey"); OWSProdInfo([OWSAnalyticsEvents prekeysDeletedOldAcceptedSignedPrekey]);
} else { } else {
OWSProdInfo(@"prekeys_deleted_old_unaccepted_signed_prekey"); OWSProdInfo([OWSAnalyticsEvents prekeysDeletedOldUnacceptedSignedPrekey]);
} }
oldSignedPreKeyCount--; oldSignedPreKeyCount--;

@ -206,7 +206,7 @@ NS_ASSUME_NONNULL_BEGIN
} }
failure:^(NSURLSessionDataTask *task, NSError *error) { failure:^(NSURLSessionDataTask *task, NSError *error) {
if (!IsNSErrorNetworkFailure(error)) { if (!IsNSErrorNetworkFailure(error)) {
OWSProdError(@"contacts_error_contacts_intersection_failed"); OWSProdError([OWSAnalyticsEvents contactsErrorContactsIntersectionFailed]);
} }
NSHTTPURLResponse *response = (NSHTTPURLResponse *)task.response; NSHTTPURLResponse *response = (NSHTTPURLResponse *)task.response;

@ -187,7 +187,7 @@ static const CGFloat kAttachmentDownloadProgressTheta = 0.001f;
} }
failure:^(NSURLSessionDataTask *task, NSError *error) { failure:^(NSURLSessionDataTask *task, NSError *error) {
if (!IsNSErrorNetworkFailure(error)) { if (!IsNSErrorNetworkFailure(error)) {
OWSProdError(@"error_attachment_request_failed"); OWSProdError([OWSAnalyticsEvents errorAttachmentRequestFailed]);
} }
DDLogError(@"Failed retrieval of attachment with error: %@", error); DDLogError(@"Failed retrieval of attachment with error: %@", error);
if (attachment.serverId < 100) { if (attachment.serverId < 100) {

@ -336,7 +336,7 @@ NSString *const OWSMessageProcessingJobFinderExtensionGroup = @"OWSMessageProces
// Drop any too-large messages on the floor. Well behaving clients should never send them. // Drop any too-large messages on the floor. Well behaving clients should never send them.
NSUInteger kMaxEnvelopeByteCount = 250 * 1024; NSUInteger kMaxEnvelopeByteCount = 250 * 1024;
if (envelope.serializedSize > kMaxEnvelopeByteCount) { if (envelope.serializedSize > kMaxEnvelopeByteCount) {
OWSProdError(@"message_receiver_error_oversize_message"); OWSProdError([OWSAnalyticsEvents messageReceiverErrorOversizeMessage]);
return; return;
} }
@ -344,7 +344,7 @@ NSString *const OWSMessageProcessingJobFinderExtensionGroup = @"OWSMessageProces
// This likely indicates a misbehaving sending client. // This likely indicates a misbehaving sending client.
NSUInteger kLargeEnvelopeWarningByteCount = 25 * 1024; NSUInteger kLargeEnvelopeWarningByteCount = 25 * 1024;
if (envelope.serializedSize > kLargeEnvelopeWarningByteCount) { if (envelope.serializedSize > kLargeEnvelopeWarningByteCount) {
OWSProdError(@"message_receiver_error_large_message"); OWSProdError([OWSAnalyticsEvents messageReceiverErrorLargeMessage]);
} }
[self.processingQueue enqueueEnvelopeForProcessing:envelope]; [self.processingQueue enqueueEnvelopeForProcessing:envelope];

@ -186,7 +186,7 @@ NSUInteger const OWSSendMessageOperationMaxRetries = 4;
_successHandler = ^{ _successHandler = ^{
typeof(self) strongSelf = weakSelf; typeof(self) strongSelf = weakSelf;
if (!strongSelf) { if (!strongSelf) {
OWSProdCFail(@"message_sender_error_send_operation_did_not_complete"); OWSProdCFail([OWSAnalyticsEvents messageSenderErrorSendOperationDidNotComplete]);
return; return;
} }
@ -200,7 +200,7 @@ NSUInteger const OWSSendMessageOperationMaxRetries = 4;
_failureHandler = ^(NSError *_Nonnull error) { _failureHandler = ^(NSError *_Nonnull error) {
typeof(self) strongSelf = weakSelf; typeof(self) strongSelf = weakSelf;
if (!strongSelf) { if (!strongSelf) {
OWSProdCFail(@"message_sender_error_send_operation_did_not_complete"); OWSProdCFail([OWSAnalyticsEvents messageSenderErrorSendOperationDidNotComplete]);
return; return;
} }
@ -474,7 +474,7 @@ NSString *const OWSMessageSenderRateLimitedException = @"RateLimitedException";
[TSAttachmentStream fetchObjectWithUniqueID:message.attachmentIds.firstObject]; [TSAttachmentStream fetchObjectWithUniqueID:message.attachmentIds.firstObject];
if (!attachmentStream) { if (!attachmentStream) {
OWSProdError(@"message_sender_error_could_not_load_attachment"); OWSProdError([OWSAnalyticsEvents messageSenderErrorCouldNotLoadAttachment]);
NSError *error = OWSErrorMakeFailedToSendOutgoingMessageError(); NSError *error = OWSErrorMakeFailedToSendOutgoingMessageError();
// Not finding local attachment is a terminal failure. // Not finding local attachment is a terminal failure.
[error setIsRetryable:NO]; [error setIsRetryable:NO];
@ -539,7 +539,7 @@ NSString *const OWSMessageSenderRateLimitedException = @"RateLimitedException";
NSError *error; NSError *error;
[attachmentStream writeData:dataCopy error:&error]; [attachmentStream writeData:dataCopy error:&error];
if (error) { if (error) {
OWSProdError(@"message_sender_error_could_not_write_attachment"); OWSProdError([OWSAnalyticsEvents messageSenderErrorCouldNotWriteAttachment]);
return failureHandler(error); return failureHandler(error);
} }
@ -575,7 +575,7 @@ NSString *const OWSMessageSenderRateLimitedException = @"RateLimitedException";
if (recipients.count == 0 && !*error) { if (recipients.count == 0 && !*error) {
// error should be set in contactsUpater, but just in case. // error should be set in contactsUpater, but just in case.
OWSProdError(@"message_sender_error_could_not_find_contacts_1"); OWSProdError([OWSAnalyticsEvents messageSenderErrorCouldNotFindContacts1]);
*error = OWSErrorMakeFailedToSendOutgoingMessageError(); *error = OWSErrorMakeFailedToSendOutgoingMessageError();
} }
@ -598,7 +598,7 @@ NSString *const OWSMessageSenderRateLimitedException = @"RateLimitedException";
if (recipients.count == 0) { if (recipients.count == 0) {
if (!error) { if (!error) {
OWSProdError(@"message_sender_error_could_not_find_contacts_2"); OWSProdError([OWSAnalyticsEvents messageSenderErrorCouldNotFindContacts2]);
error = OWSErrorMakeFailedToSendOutgoingMessageError(); error = OWSErrorMakeFailedToSendOutgoingMessageError();
} }
// If no recipients were found, there's no reason to retry. It will just fail again. // If no recipients were found, there's no reason to retry. It will just fail again.
@ -652,7 +652,7 @@ NSString *const OWSMessageSenderRateLimitedException = @"RateLimitedException";
[self unregisteredRecipient:recipient message:message thread:thread]; [self unregisteredRecipient:recipient message:message thread:thread];
} }
OWSProdError(@"message_sender_error_could_not_find_contacts_3"); OWSProdError([OWSAnalyticsEvents messageSenderErrorCouldNotFindContacts3]);
// No need to repeat trying to find a failure. Apart from repeatedly failing, it would also cause us // No need to repeat trying to find a failure. Apart from repeatedly failing, it would also cause us
// to print redundant error messages. // to print redundant error messages.
[error setIsRetryable:NO]; [error setIsRetryable:NO];
@ -834,7 +834,7 @@ NSString *const OWSMessageSenderRateLimitedException = @"RateLimitedException";
AssertIsOnSendingQueue(); AssertIsOnSendingQueue();
if ([TSPreKeyManager isAppLockedDueToPreKeyUpdateFailures]) { if ([TSPreKeyManager isAppLockedDueToPreKeyUpdateFailures]) {
OWSProdError(@"message_send_error_failed_due_to_prekey_update_failures"); OWSProdError([OWSAnalyticsEvents messageSendErrorFailedDueToPrekeyUpdateFailures]);
// Retry prekey update every time user tries to send a message while app // Retry prekey update every time user tries to send a message while app
// is disabled due to prekey update failures. // is disabled due to prekey update failures.
@ -856,7 +856,7 @@ NSString *const OWSMessageSenderRateLimitedException = @"RateLimitedException";
if (remainingAttempts <= 0) { if (remainingAttempts <= 0) {
// We should always fail with a specific error. // We should always fail with a specific error.
OWSProdFail(@"message_sender_error_generic_send_failure"); OWSProdFail([OWSAnalyticsEvents messageSenderErrorGenericSendFailure]);
NSError *error = OWSErrorMakeFailedToSendOutgoingMessageError(); NSError *error = OWSErrorMakeFailedToSendOutgoingMessageError();
[error setIsRetryable:YES]; [error setIsRetryable:YES];
@ -874,7 +874,7 @@ NSString *const OWSMessageSenderRateLimitedException = @"RateLimitedException";
// We expect it to happen whenever Bob reinstalls, and Alice messages Bob before // We expect it to happen whenever Bob reinstalls, and Alice messages Bob before
// she can pull down his latest identity. // she can pull down his latest identity.
// If it's happening a lot, we should rethink our profile fetching strategy. // If it's happening a lot, we should rethink our profile fetching strategy.
OWSProdInfo(@"message_send_error_failed_due_to_untrusted_key"); OWSProdInfo([OWSAnalyticsEvents messageSendErrorFailedDueToUntrustedKey]);
NSString *localizedErrorDescriptionFormat NSString *localizedErrorDescriptionFormat
= NSLocalizedString(@"FAILED_SENDING_BECAUSE_UNTRUSTED_IDENTITY_KEY", = NSLocalizedString(@"FAILED_SENDING_BECAUSE_UNTRUSTED_IDENTITY_KEY",
@ -893,7 +893,7 @@ NSString *const OWSMessageSenderRateLimitedException = @"RateLimitedException";
PreKeyBundle *newKeyBundle = exception.userInfo[TSInvalidPreKeyBundleKey]; PreKeyBundle *newKeyBundle = exception.userInfo[TSInvalidPreKeyBundleKey];
if (![newKeyBundle isKindOfClass:[PreKeyBundle class]]) { if (![newKeyBundle isKindOfClass:[PreKeyBundle class]]) {
OWSProdFail(@"message_sender_error_unexpected_key_bundle"); OWSProdFail([OWSAnalyticsEvents messageSenderErrorUnexpectedKeyBundle]);
failureHandler(error); failureHandler(error);
return; return;
} }
@ -901,14 +901,14 @@ NSString *const OWSMessageSenderRateLimitedException = @"RateLimitedException";
NSData *newIdentityKeyWithVersion = newKeyBundle.identityKey; NSData *newIdentityKeyWithVersion = newKeyBundle.identityKey;
if (![newIdentityKeyWithVersion isKindOfClass:[NSData class]]) { if (![newIdentityKeyWithVersion isKindOfClass:[NSData class]]) {
OWSProdFail(@"message_sender_error_invalid_identity_key_type"); OWSProdFail([OWSAnalyticsEvents messageSenderErrorInvalidIdentityKeyType]);
failureHandler(error); failureHandler(error);
return; return;
} }
// TODO migrate to storing the full 33 byte representation of the identity key. // TODO migrate to storing the full 33 byte representation of the identity key.
if (newIdentityKeyWithVersion.length != kIdentityKeyLength) { if (newIdentityKeyWithVersion.length != kIdentityKeyLength) {
OWSProdFail(@"message_sender_error_invalid_identity_key_length"); OWSProdFail([OWSAnalyticsEvents messageSenderErrorInvalidIdentityKeyLength]);
failureHandler(error); failureHandler(error);
return; return;
} }
@ -1013,7 +1013,7 @@ NSString *const OWSMessageSenderRateLimitedException = @"RateLimitedException";
NSDictionary *serializedResponse = NSDictionary *serializedResponse =
[NSJSONSerialization JSONObjectWithData:responseData options:0 error:&error]; [NSJSONSerialization JSONObjectWithData:responseData options:0 error:&error];
if (error) { if (error) {
OWSProdError(@"message_sender_error_could_not_parse_mismatched_devices_json"); OWSProdError([OWSAnalyticsEvents messageSenderErrorCouldNotParseMismatchedDevicesJson]);
[error setIsRetryable:YES]; [error setIsRetryable:YES];
return failureHandler(error); return failureHandler(error);
} }
@ -1053,7 +1053,7 @@ NSString *const OWSMessageSenderRateLimitedException = @"RateLimitedException";
dispatch_async([OWSDispatch sessionStoreQueue], ^{ dispatch_async([OWSDispatch sessionStoreQueue], ^{
if (extraDevices.count < 1 && missingDevices.count < 1) { if (extraDevices.count < 1 && missingDevices.count < 1) {
OWSProdFail(@"message_sender_error_no_missing_or_extra_devices"); OWSProdFail([OWSAnalyticsEvents messageSenderErrorNoMissingOrExtraDevices]);
} }
if (extraDevices && extraDevices.count > 0) { if (extraDevices && extraDevices.count > 0) {
@ -1217,7 +1217,7 @@ NSString *const OWSMessageSenderRateLimitedException = @"RateLimitedException";
} }
failure:^(NSURLSessionDataTask *task, NSError *error) { failure:^(NSURLSessionDataTask *task, NSError *error) {
if (!IsNSErrorNetworkFailure(error)) { if (!IsNSErrorNetworkFailure(error)) {
OWSProdError(@"message_sender_error_recipient_prekey_request_failed"); OWSProdError([OWSAnalyticsEvents messageSenderErrorRecipientPrekeyRequestFailed]);
} }
DDLogError(@"Server replied to PreKeyBundle request with error: %@", error); DDLogError(@"Server replied to PreKeyBundle request with error: %@", error);
NSHTTPURLResponse *response = (NSHTTPURLResponse *)task.response; NSHTTPURLResponse *response = (NSHTTPURLResponse *)task.response;
@ -1290,7 +1290,7 @@ NSString *const OWSMessageSenderRateLimitedException = @"RateLimitedException";
NSDictionary *jsonDict = [MTLJSONAdapter JSONDictionaryFromModel:messageParams error:&error]; NSDictionary *jsonDict = [MTLJSONAdapter JSONDictionaryFromModel:messageParams error:&error];
if (error) { if (error) {
OWSProdError(@"message_send_error_could_not_serialize_message_json"); OWSProdError([OWSAnalyticsEvents messageSendErrorCouldNotSerializeMessageJson]);
return nil; return nil;
} }

@ -158,19 +158,19 @@ NS_ASSUME_NONNULL_BEGIN
return @"DeliveryReceipt"; return @"DeliveryReceipt";
case OWSSignalServiceProtosEnvelopeTypeUnknown: case OWSSignalServiceProtosEnvelopeTypeUnknown:
// Shouldn't happen // Shouldn't happen
OWSProdFail(@"message_manager_error_envelope_type_unknown"); OWSProdFail([OWSAnalyticsEvents messageManagerErrorEnvelopeTypeUnknown]);
return @"Unknown"; return @"Unknown";
case OWSSignalServiceProtosEnvelopeTypeCiphertext: case OWSSignalServiceProtosEnvelopeTypeCiphertext:
return @"SignalEncryptedMessage"; return @"SignalEncryptedMessage";
case OWSSignalServiceProtosEnvelopeTypeKeyExchange: case OWSSignalServiceProtosEnvelopeTypeKeyExchange:
// Unsupported // Unsupported
OWSProdFail(@"message_manager_error_envelope_type_key_exchange"); OWSProdFail([OWSAnalyticsEvents messageManagerErrorEnvelopeTypeKeyExchange]);
return @"KeyExchange"; return @"KeyExchange";
case OWSSignalServiceProtosEnvelopeTypePrekeyBundle: case OWSSignalServiceProtosEnvelopeTypePrekeyBundle:
return @"PreKeyEncryptedMessage"; return @"PreKeyEncryptedMessage";
default: default:
// Shouldn't happen // Shouldn't happen
OWSProdFail(@"message_manager_error_envelope_type_other"); OWSProdFail([OWSAnalyticsEvents messageManagerErrorEnvelopeTypeOther]);
return @"Other"; return @"Other";
} }
} }
@ -312,7 +312,8 @@ NS_ASSUME_NONNULL_BEGIN
envelope.source, envelope.source,
(unsigned int)envelope.sourceDevice, (unsigned int)envelope.sourceDevice,
error); error);
OWSProdError(@"message_manager_error_could_not_handle_secure_message"); OWSProdError(
[OWSAnalyticsEvents messageManagerErrorCouldNotHandleSecureMessage]);
} }
completion(); completion();
}]; }];
@ -330,7 +331,8 @@ NS_ASSUME_NONNULL_BEGIN
envelope.source, envelope.source,
(unsigned int)envelope.sourceDevice, (unsigned int)envelope.sourceDevice,
error); error);
OWSProdError(@"message_manager_error_could_not_handle_prekey_bundle"); OWSProdError(
[OWSAnalyticsEvents messageManagerErrorCouldNotHandlePrekeyBundle]);
} }
completion(); completion();
}]; }];
@ -355,7 +357,7 @@ NS_ASSUME_NONNULL_BEGIN
} }
} @catch (NSException *exception) { } @catch (NSException *exception) {
DDLogError(@"Received an incorrectly formatted protocol buffer: %@", exception.debugDescription); DDLogError(@"Received an incorrectly formatted protocol buffer: %@", exception.debugDescription);
OWSProdFail(@"message_manager_error_invalid_protocol_message"); OWSProdFail([OWSAnalyticsEvents messageManagerErrorInvalidProtocolMessage]);
} }
completion(); completion();
@ -387,7 +389,7 @@ NS_ASSUME_NONNULL_BEGIN
NSData *encryptedData NSData *encryptedData
= messageEnvelope.hasContent ? messageEnvelope.content : messageEnvelope.legacyMessage; = messageEnvelope.hasContent ? messageEnvelope.content : messageEnvelope.legacyMessage;
if (!encryptedData) { if (!encryptedData) {
OWSProdFail(@"message_manager_error_message_envelope_has_no_content"); OWSProdFail([OWSAnalyticsEvents messageManagerErrorMessageEnvelopeHasNoContent]);
completion(nil); completion(nil);
return; return;
} }
@ -436,7 +438,7 @@ NS_ASSUME_NONNULL_BEGIN
// DEPRECATED - Remove after all clients have been upgraded. // DEPRECATED - Remove after all clients have been upgraded.
NSData *encryptedData = preKeyEnvelope.hasContent ? preKeyEnvelope.content : preKeyEnvelope.legacyMessage; NSData *encryptedData = preKeyEnvelope.hasContent ? preKeyEnvelope.content : preKeyEnvelope.legacyMessage;
if (!encryptedData) { if (!encryptedData) {
OWSProdFail(@"message_manager_error_prekey_bundle_envelope_has_no_content"); OWSProdFail([OWSAnalyticsEvents messageManagerErrorPrekeyBundleEnvelopeHasNoContent]);
completion(nil); completion(nil);
return; return;
} }

@ -51,7 +51,7 @@ NSString *const OWSDeviceProvisioningCodeServiceProvisioningCodeKey = @"verifica
} }
failure:^(NSURLSessionDataTask *task, NSError *error) { failure:^(NSURLSessionDataTask *task, NSError *error) {
if (!IsNSErrorNetworkFailure(error)) { if (!IsNSErrorNetworkFailure(error)) {
OWSProdError(@"error_provisioning_code_request_failed"); OWSProdError([OWSAnalyticsEvents errorProvisioningCodeRequestFailed]);
} }
DDLogVerbose(@"ProvisioningCode request failed with error: %@", error); DDLogVerbose(@"ProvisioningCode request failed with error: %@", error);
failureCallback(error); failureCallback(error);

@ -48,7 +48,7 @@ NS_ASSUME_NONNULL_BEGIN
} }
failure:^(NSURLSessionDataTask *task, NSError *error) { failure:^(NSURLSessionDataTask *task, NSError *error) {
if (!IsNSErrorNetworkFailure(error)) { if (!IsNSErrorNetworkFailure(error)) {
OWSProdError(@"error_provisioning_request_failed"); OWSProdError([OWSAnalyticsEvents errorProvisioningRequestFailed]);
} }
DDLogVerbose(@"Provisioning request failed with error: %@", error); DDLogVerbose(@"Provisioning request failed with error: %@", error);
failureCallback(error); failureCallback(error);

@ -33,7 +33,7 @@ NS_ASSUME_NONNULL_BEGIN
} }
failure:^(NSURLSessionDataTask *task, NSError *error) { failure:^(NSURLSessionDataTask *task, NSError *error) {
if (!IsNSErrorNetworkFailure(error)) { if (!IsNSErrorNetworkFailure(error)) {
OWSProdError(@"error_get_devices_failed"); OWSProdError([OWSAnalyticsEvents errorGetDevicesFailed]);
} }
DDLogVerbose(@"Get devices request failed with error: %@", error); DDLogVerbose(@"Get devices request failed with error: %@", error);
failureCallback(error); failureCallback(error);
@ -53,7 +53,7 @@ NS_ASSUME_NONNULL_BEGIN
} }
failure:^(NSURLSessionDataTask *task, NSError *error) { failure:^(NSURLSessionDataTask *task, NSError *error) {
if (!IsNSErrorNetworkFailure(error)) { if (!IsNSErrorNetworkFailure(error)) {
OWSProdError(@"error_unlink_device_failed"); OWSProdError([OWSAnalyticsEvents errorUnlinkDeviceFailed]);
} }
DDLogVerbose(@"Get devices request failed with error: %@", error); DDLogVerbose(@"Get devices request failed with error: %@", error);
failureCallback(error); failureCallback(error);

@ -86,7 +86,7 @@ static NSString *keychainDBPassAccount = @"TSDatabasePass";
- (nullable Class)unarchiver:(NSKeyedUnarchiver *)unarchiver cannotDecodeObjectOfClassName:(NSString *)name originalClasses:(NSArray<NSString *> *)classNames - (nullable Class)unarchiver:(NSKeyedUnarchiver *)unarchiver cannotDecodeObjectOfClassName:(NSString *)name originalClasses:(NSArray<NSString *> *)classNames
{ {
OWSProdError(@"storage_error_could_not_decode_class"); OWSProdError([OWSAnalyticsEvents storageErrorCouldNotDecodeClass]);
return [OWSUnknownObject class]; return [OWSUnknownObject class];
} }
@ -117,14 +117,14 @@ static NSString *keychainDBPassAccount = @"TSDatabasePass";
// //
// The best we can try to do is to discard the current database // The best we can try to do is to discard the current database
// and behave like a clean install. // and behave like a clean install.
OWSProdCritical(@"storage_error_could_not_load_database"); OWSProdCritical([OWSAnalyticsEvents storageErrorCouldNotLoadDatabase]);
// Try to reset app by deleting database. // Try to reset app by deleting database.
// Disabled resetting storage until we have better data on why this happens. // Disabled resetting storage until we have better data on why this happens.
// [self resetSignalStorage]; // [self resetSignalStorage];
if (![self tryToLoadDatabase]) { if (![self tryToLoadDatabase]) {
OWSProdCritical(@"storage_error_could_not_load_database_second_attempt"); OWSProdCritical([OWSAnalyticsEvents storageErrorCouldNotLoadDatabaseSecondAttempt]);
// Sleep to give analytics events time to be delivered. // Sleep to give analytics events time to be delivered.
[NSThread sleepForTimeInterval:15.0f]; [NSThread sleepForTimeInterval:15.0f];
@ -183,7 +183,7 @@ static NSString *keychainDBPassAccount = @"TSDatabasePass";
return [unarchiver decodeObjectForKey:@"root"]; return [unarchiver decodeObjectForKey:@"root"];
} @catch (NSException *exception) { } @catch (NSException *exception) {
// Sync log in case we bail. // Sync log in case we bail.
OWSProdError(@"storage_error_deserialization"); OWSProdError([OWSAnalyticsEvents storageErrorDeserialization]);
@throw exception; @throw exception;
} }
}; };
@ -253,7 +253,7 @@ static NSString *keychainDBPassAccount = @"TSDatabasePass";
BOOL success = [ressourceURL setResourceValues:resourcesAttrs error:&error]; BOOL success = [ressourceURL setResourceValues:resourcesAttrs error:&error];
if (error || !success) { if (error || !success) {
OWSProdCritical(@"storage_error_file_protection"); OWSProdCritical([OWSAnalyticsEvents storageErrorFileProtection]);
} }
} }
@ -353,7 +353,7 @@ static NSString *keychainDBPassAccount = @"TSDatabasePass";
BOOL shouldHavePassword = [NSFileManager.defaultManager fileExistsAtPath:[self dbPath]]; BOOL shouldHavePassword = [NSFileManager.defaultManager fileExistsAtPath:[self dbPath]];
if (shouldHavePassword) { if (shouldHavePassword) {
OWSProdCritical(@"storage_error_could_not_load_database_second_attempt"); OWSProdCritical([OWSAnalyticsEvents storageErrorCouldNotLoadDatabaseSecondAttempt]);
} }
// Try to reset app by deleting database. // Try to reset app by deleting database.
@ -372,7 +372,7 @@ static NSString *keychainDBPassAccount = @"TSDatabasePass";
NSError *keySetError; NSError *keySetError;
[SAMKeychain setPassword:newDBPassword forService:keychainService account:keychainDBPassAccount error:&keySetError]; [SAMKeychain setPassword:newDBPassword forService:keychainService account:keychainDBPassAccount error:&keySetError];
if (keySetError) { if (keySetError) {
OWSProdCritical(@"storage_error_could_not_store_database_password"); OWSProdCritical([OWSAnalyticsEvents storageErrorCouldNotStoreDatabasePassword]);
[self deletePasswordFromKeychain]; [self deletePasswordFromKeychain];

@ -411,7 +411,7 @@ NSString *NSStringForOWSAnalyticsSeverity(OWSAnalyticsSeverity severity)
- (void)appLaunchDidBegin - (void)appLaunchDidBegin
{ {
OWSProdInfo(@"app_launch"); OWSProdInfo([OWSAnalyticsEvents appLaunch]);
} }
#pragma mark - Logging #pragma mark - Logging

@ -22,28 +22,6 @@ NS_ASSUME_NONNULL_BEGIN
+ (NSString *)appLaunch; + (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 *)contactsErrorContactsIntersectionFailed;
+ (NSString *)errorAttachmentRequestFailed; + (NSString *)errorAttachmentRequestFailed;
@ -82,10 +60,12 @@ NS_ASSUME_NONNULL_BEGIN
+ (NSString *)messageManagerErrorMessageEnvelopeHasNoContent; + (NSString *)messageManagerErrorMessageEnvelopeHasNoContent;
+ (NSString *)messageManagerErrorOversizeMessage;
+ (NSString *)messageManagerErrorPrekeyBundleEnvelopeHasNoContent; + (NSString *)messageManagerErrorPrekeyBundleEnvelopeHasNoContent;
+ (NSString *)messageReceiverErrorLargeMessage;
+ (NSString *)messageReceiverErrorOversizeMessage;
+ (NSString *)messageSendErrorCouldNotSerializeMessageJson; + (NSString *)messageSendErrorCouldNotSerializeMessageJson;
+ (NSString *)messageSendErrorFailedDueToPrekeyUpdateFailures; + (NSString *)messageSendErrorFailedDueToPrekeyUpdateFailures;
@ -118,7 +98,25 @@ NS_ASSUME_NONNULL_BEGIN
+ (NSString *)messageSenderErrorUnexpectedKeyBundle; + (NSString *)messageSenderErrorUnexpectedKeyBundle;
+ (NSString *)prekeysDeletedOldSignedPrekey; + (NSString *)prekeysDeletedOldAcceptedSignedPrekey;
+ (NSString *)prekeysDeletedOldUnacceptedSignedPrekey;
+ (NSString *)registrationBegan;
+ (NSString *)registrationRegisteredPhoneNumber;
+ (NSString *)registrationRegisteringCode;
+ (NSString *)registrationRegisteringRequestedNewCodeBySms;
+ (NSString *)registrationRegisteringRequestedNewCodeByVoice;
+ (NSString *)registrationRegisteringSubmittedCode;
+ (NSString *)registrationRegistrationFailed;
+ (NSString *)registrationVerificationBack;
+ (NSString *)storageErrorCouldNotDecodeClass; + (NSString *)storageErrorCouldNotDecodeClass;

@ -200,6 +200,16 @@ NS_ASSUME_NONNULL_BEGIN
return @"message_manager_error_prekey_bundle_envelope_has_no_content"; return @"message_manager_error_prekey_bundle_envelope_has_no_content";
} }
+ (NSString *)messageReceiverErrorLargeMessage
{
return @"message_receiver_error_large_message";
}
+ (NSString *)messageReceiverErrorOversizeMessage
{
return @"message_receiver_error_oversize_message";
}
+ (NSString *)messageSendErrorCouldNotSerializeMessageJson + (NSString *)messageSendErrorCouldNotSerializeMessageJson
{ {
return @"message_send_error_could_not_serialize_message_json"; return @"message_send_error_could_not_serialize_message_json";
@ -280,11 +290,61 @@ NS_ASSUME_NONNULL_BEGIN
return @"message_sender_error_unexpected_key_bundle"; return @"message_sender_error_unexpected_key_bundle";
} }
+ (NSString *)prekeysDeletedOldAcceptedSignedPrekey
{
return @"prekeys_deleted_old_accepted_signed_prekey";
}
+ (NSString *)prekeysDeletedOldSignedPrekey + (NSString *)prekeysDeletedOldSignedPrekey
{ {
return @"prekeys_deleted_old_signed_prekey"; return @"prekeys_deleted_old_signed_prekey";
} }
+ (NSString *)prekeysDeletedOldUnacceptedSignedPrekey
{
return @"prekeys_deleted_old_unaccepted_signed_prekey";
}
+ (NSString *)registrationBegan
{
return @"registration_began";
}
+ (NSString *)registrationRegisteredPhoneNumber
{
return @"registration_registered_phone_number";
}
+ (NSString *)registrationRegisteringCode
{
return @"registration_registering_code";
}
+ (NSString *)registrationRegisteringRequestedNewCodeBySms
{
return @"registration_registering_requested_new_code_by_sms";
}
+ (NSString *)registrationRegisteringRequestedNewCodeByVoice
{
return @"registration_registering_requested_new_code_by_voice";
}
+ (NSString *)registrationRegisteringSubmittedCode
{
return @"registration_registering_submitted_code";
}
+ (NSString *)registrationRegistrationFailed
{
return @"registration_registration_failed";
}
+ (NSString *)registrationVerificationBack
{
return @"registration_verification_back";
}
+ (NSString *)storageErrorCouldNotDecodeClass + (NSString *)storageErrorCouldNotDecodeClass
{ {
return @"storage_error_could_not_decode_class"; return @"storage_error_could_not_decode_class";

Loading…
Cancel
Save