Apply OWS log functions in Objective-C.

This commit is contained in:
Matthew Chen 2018-08-27 12:51:32 -04:00
parent 03829779cc
commit cc5a480baa
171 changed files with 1365 additions and 1563 deletions

View File

@ -78,23 +78,23 @@ static NSTimeInterval launchStartedAt;
@synthesize window = _window;
- (void)applicationDidEnterBackground:(UIApplication *)application {
OWSLogWarn(@"%@ applicationDidEnterBackground.", self.logTag);
OWSLogWarn(@"applicationDidEnterBackground.");
[DDLog flushLog];
}
- (void)applicationWillEnterForeground:(UIApplication *)application {
OWSLogWarn(@"%@ applicationWillEnterForeground.", self.logTag);
OWSLogWarn(@"applicationWillEnterForeground.");
}
- (void)applicationDidReceiveMemoryWarning:(UIApplication *)application
{
OWSLogWarn(@"%@ applicationDidReceiveMemoryWarning.", self.logTag);
OWSLogWarn(@"applicationDidReceiveMemoryWarning.");
}
- (void)applicationWillTerminate:(UIApplication *)application
{
OWSLogWarn(@"%@ applicationWillTerminate.", self.logTag);
OWSLogWarn(@"applicationWillTerminate.");
[DDLog flushLog];
}
@ -119,7 +119,7 @@ static NSTimeInterval launchStartedAt;
[DebugLogger.sharedLogger enableFileLogging];
}
OWSLogWarn(@"%@ application: didFinishLaunchingWithOptions.", self.logTag);
OWSLogWarn(@"application: didFinishLaunchingWithOptions.");
[Cryptography seedRandom];
// XXX - careful when moving this. It must happen before we initialize OWSPrimaryStorage.
@ -141,7 +141,7 @@ static NSTimeInterval launchStartedAt;
//
// ensureIsReadyForAppExtensions will show a failure mode UI that
// lets users report this error.
OWSLogInfo(@"%@ application: didFinishLaunchingWithOptions failed.", self.logTag);
OWSLogInfo(@"application: didFinishLaunchingWithOptions failed.");
return YES;
}
@ -209,7 +209,7 @@ static NSTimeInterval launchStartedAt;
name:NSNotificationName_2FAStateDidChange
object:nil];
OWSLogInfo(@"%@ application: didFinishLaunchingWithOptions completed.", self.logTag);
OWSLogInfo(@"application: didFinishLaunchingWithOptions completed.");
[OWSAnalytics appLaunchDidBegin];
@ -226,8 +226,7 @@ static NSTimeInterval launchStartedAt;
}
if (![OWSPrimaryStorage isDatabasePasswordAccessible]) {
OWSLogInfo(
@"%@ exiting because we are in the background and the database password is not accessible.", self.logTag);
OWSLogInfo(@"exiting because we are in the background and the database password is not accessible.");
UILocalNotification *notification = [UILocalNotification new];
NSString *messageFormat = NSLocalizedString(@"NOTIFICATION_BODY_PHONE_LOCKED_FORMAT",
@ -266,7 +265,7 @@ static NSTimeInterval launchStartedAt;
NSFileManager *fileManager = [NSFileManager defaultManager];
for (NSString *path in paths) {
if ([fileManager fileExistsAtPath:path]) {
OWSLogInfo(@"%@ storage file: %@, %@", self.logTag, path, [OWSFileSystem fileSizeOfPath:path]);
OWSLogInfo(@"storage file: %@, %@", path, [OWSFileSystem fileSizeOfPath:path]);
}
}
@ -278,14 +277,11 @@ static NSTimeInterval launchStartedAt;
SUPPRESS_DEADSTORE_WARNING(backgroundTask);
if ([NSFileManager.defaultManager fileExistsAtPath:OWSPrimaryStorage.legacyDatabaseFilePath]) {
OWSLogInfo(@"%@ Legacy Database file size: %@",
self.logTag,
[OWSFileSystem fileSizeOfPath:OWSPrimaryStorage.legacyDatabaseFilePath]);
OWSLogInfo(@"%@ \t Legacy SHM file size: %@",
self.logTag,
OWSLogInfo(
@"Legacy Database file size: %@", [OWSFileSystem fileSizeOfPath:OWSPrimaryStorage.legacyDatabaseFilePath]);
OWSLogInfo(@"\t Legacy SHM file size: %@",
[OWSFileSystem fileSizeOfPath:OWSPrimaryStorage.legacyDatabaseFilePath_SHM]);
OWSLogInfo(@"%@ \t Legacy WAL file size: %@",
self.logTag,
OWSLogInfo(@"\t Legacy WAL file size: %@",
[OWSFileSystem fileSizeOfPath:OWSPrimaryStorage.legacyDatabaseFilePath_WAL]);
}
@ -306,7 +302,7 @@ static NSTimeInterval launchStartedAt;
}
if (error) {
OWSFailDebug(@"%@ database conversion failed: %@", self.logTag, error);
OWSFailDebug(@"database conversion failed: %@", error);
[self showLaunchFailureUI:error];
return NO;
}
@ -345,8 +341,7 @@ static NSTimeInterval launchStartedAt;
style:UIAlertActionStyleDefault
handler:^(UIAlertAction *_Nonnull action) {
[Pastelog submitLogsWithCompletion:^{
OWSLogInfo(
@"%@ exiting after sharing debug logs.", self.logTag);
OWSLogInfo(@"exiting after sharing debug logs.");
[DDLog flushLog];
exit(0);
}];
@ -361,7 +356,7 @@ static NSTimeInterval launchStartedAt;
NSString *databaseFilePath = [OWSPrimaryStorage legacyDatabaseFilePath];
if (![[NSFileManager defaultManager] fileExistsAtPath:databaseFilePath]) {
OWSLogVerbose(@"%@ no legacy database file found", self.logTag);
OWSLogVerbose(@"no legacy database file found");
return nil;
}
@ -374,14 +369,14 @@ static NSTimeInterval launchStartedAt;
}
YapRecordDatabaseSaltBlock recordSaltBlock = ^(NSData *saltData) {
OWSLogVerbose(@"%@ saltData: %@", self.logTag, saltData.hexadecimalString);
OWSLogVerbose(@"saltData: %@", saltData.hexadecimalString);
// Derive and store the raw cipher key spec, to avoid the ongoing tax of future KDF
NSData *_Nullable keySpecData =
[YapDatabaseCryptoUtils deriveDatabaseKeySpecForPassword:databasePassword saltData:saltData];
if (!keySpecData) {
OWSLogError(@"%@ Failed to derive key spec.", self.logTag);
OWSLogError(@"Failed to derive key spec.");
return NO;
}
@ -436,7 +431,7 @@ static NSTimeInterval launchStartedAt;
return;
}
OWSLogInfo(@"%@ registered vanilla push token: %@", self.logTag, deviceToken);
OWSLogInfo(@"registered vanilla push token: %@", deviceToken);
[PushRegistrationManager.sharedManager didReceiveVanillaPushToken:deviceToken];
}
@ -449,10 +444,9 @@ static NSTimeInterval launchStartedAt;
return;
}
OWSLogError(@"%@ failed to register vanilla push token with error: %@", self.logTag, error);
OWSLogError(@"failed to register vanilla push token with error: %@", error);
#ifdef DEBUG
OWSLogWarn(
@"%@ We're in debug mode. Faking success for remote registration with a fake push identifier", self.logTag);
OWSLogWarn(@"We're in debug mode. Faking success for remote registration with a fake push identifier");
[PushRegistrationManager.sharedManager didReceiveVanillaPushToken:[[NSMutableData dataWithLength:32] copy]];
#else
OWSProdError([OWSAnalyticsEvents appDelegateErrorFailedToRegisterForRemoteNotifications]);
@ -470,7 +464,7 @@ static NSTimeInterval launchStartedAt;
return;
}
OWSLogInfo(@"%@ registered user notification settings", self.logTag);
OWSLogInfo(@"registered user notification settings");
[PushRegistrationManager.sharedManager didRegisterUserNotificationSettings];
}
@ -487,7 +481,7 @@ static NSTimeInterval launchStartedAt;
}
if (!AppReadiness.isAppReady) {
OWSLogWarn(@"%@ Ignoring openURL: app not ready.", self.logTag);
OWSLogWarn(@"Ignoring openURL: app not ready.");
// We don't need to use [AppReadiness runNowOrWhenAppIsReady:];
// the only URLs we handle in Signal iOS at the moment are used
// for resuming the verification step of the registration flow.
@ -527,7 +521,7 @@ static NSTimeInterval launchStartedAt;
return;
}
OWSLogWarn(@"%@ applicationDidBecomeActive.", self.logTag);
OWSLogWarn(@"applicationDidBecomeActive.");
if (CurrentAppContext().isRunningTests) {
return;
}
@ -549,7 +543,7 @@ static NSTimeInterval launchStartedAt;
// be called _before_ we become active.
[self clearAllNotificationsAndRestoreBadgeCount];
OWSLogInfo(@"%@ applicationDidBecomeActive completed.", self.logTag);
OWSLogInfo(@"applicationDidBecomeActive completed.");
}
- (void)enableBackgroundRefreshIfNecessary
@ -570,7 +564,7 @@ static NSTimeInterval launchStartedAt;
{
OWSAssertIsOnMainThread();
OWSLogWarn(@"%@ handleActivation.", self.logTag);
OWSLogWarn(@"handleActivation.");
// Always check prekeys after app launches, and sometimes check on app activation.
[TSPreKeyManager checkPreKeysIfNecessary];
@ -583,9 +577,7 @@ static NSTimeInterval launchStartedAt;
// At this point, potentially lengthy DB locking migrations could be running.
// Avoid blocking app launch by putting all further possible DB access in async block
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
OWSLogInfo(@"%@ running post launch block for registered user: %@",
self.logTag,
[TSAccountManager localNumber]);
OWSLogInfo(@"running post launch block for registered user: %@", [TSAccountManager localNumber]);
// Clean up any messages that expired since last launch immediately
// and continue cleaning in the background.
@ -603,7 +595,7 @@ static NSTimeInterval launchStartedAt;
run];
});
} else {
OWSLogInfo(@"%@ running post launch block for unregistered user.", self.logTag);
OWSLogInfo(@"running post launch block for unregistered user.");
// Unregistered user should have no unread messages. e.g. if you delete your account.
[SignalApp clearAllNotifications];
@ -628,8 +620,7 @@ static NSTimeInterval launchStartedAt;
[[PushManager sharedManager] applicationDidBecomeActive];
if (![UIApplication sharedApplication].isRegisteredForRemoteNotifications) {
OWSLogInfo(
@"%@ Retrying to register for remote notifications since user hasn't registered yet.", self.logTag);
OWSLogInfo(@"Retrying to register for remote notifications since user hasn't registered yet.");
// Push tokens don't normally change while the app is launched, so checking once during launch is
// usually sufficient, but e.g. on iOS11, users who have disabled "Allow Notifications" and disabled
// "Background App Refresh" will not be able to obtain an APN token. Enabling those settings does not
@ -641,8 +632,7 @@ static NSTimeInterval launchStartedAt;
if ([OWS2FAManager sharedManager].isDueForReminder) {
if (!self.hasInitialRootViewController || self.window.rootViewController == nil) {
OWSLogDebug(
@"%@ Skipping 2FA reminder since there isn't yet an initial view controller", self.logTag);
OWSLogDebug(@"Skipping 2FA reminder since there isn't yet an initial view controller");
} else {
UIViewController *rootViewController = self.window.rootViewController;
OWSNavigationController *reminderNavController =
@ -654,7 +644,7 @@ static NSTimeInterval launchStartedAt;
});
}
OWSLogInfo(@"%@ handleActivation completed.", self.logTag);
OWSLogInfo(@"handleActivation completed.");
}
- (void)applicationWillResignActive:(UIApplication *)application {
@ -665,7 +655,7 @@ static NSTimeInterval launchStartedAt;
return;
}
OWSLogWarn(@"%@ applicationWillResignActive.", self.logTag);
OWSLogWarn(@"applicationWillResignActive.");
[DDLog flushLog];
}
@ -741,23 +731,23 @@ static NSTimeInterval launchStartedAt;
if ([userActivity.activityType isEqualToString:@"INStartVideoCallIntent"]) {
if (!SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(10, 0)) {
OWSLogError(@"%@ unexpectedly received INStartVideoCallIntent pre iOS10", self.logTag);
OWSLogError(@"unexpectedly received INStartVideoCallIntent pre iOS10");
return NO;
}
OWSLogInfo(@"%@ got start video call intent", self.logTag);
OWSLogInfo(@"got start video call intent");
INInteraction *interaction = [userActivity interaction];
INIntent *intent = interaction.intent;
if (![intent isKindOfClass:[INStartVideoCallIntent class]]) {
OWSLogError(@"%@ unexpected class for start call video: %@", self.logTag, intent);
OWSLogError(@"unexpected class for start call video: %@", intent);
return NO;
}
INStartVideoCallIntent *startCallIntent = (INStartVideoCallIntent *)intent;
NSString *_Nullable handle = startCallIntent.contacts.firstObject.personHandle.value;
if (!handle) {
OWSLogWarn(@"%@ unable to find handle in startCallIntent: %@", self.logTag, startCallIntent);
OWSLogWarn(@"unable to find handle in startCallIntent: %@", startCallIntent);
return NO;
}
@ -766,8 +756,7 @@ static NSTimeInterval launchStartedAt;
if ([handle hasPrefix:CallKitCallManager.kAnonymousCallHandlePrefix]) {
phoneNumber = [[OWSPrimaryStorage sharedManager] phoneNumberForCallKitId:handle];
if (phoneNumber.length < 1) {
OWSLogWarn(
@"%@ ignoring attempt to initiate video call to unknown anonymous signal user.", self.logTag);
OWSLogWarn(@"ignoring attempt to initiate video call to unknown anonymous signal user.");
return;
}
}
@ -782,12 +771,11 @@ static NSTimeInterval launchStartedAt;
// to that user - unless there already is another call in progress.
if (SignalApp.sharedApp.callService.call != nil) {
if ([phoneNumber isEqualToString:SignalApp.sharedApp.callService.call.remotePhoneNumber]) {
OWSLogWarn(@"%@ trying to upgrade ongoing call to video.", self.logTag);
OWSLogWarn(@"trying to upgrade ongoing call to video.");
[SignalApp.sharedApp.callService handleCallKitStartVideo];
return;
} else {
OWSLogWarn(@"%@ ignoring INStartVideoCallIntent due to ongoing WebRTC call with another party.",
self.logTag);
OWSLogWarn(@"ignoring INStartVideoCallIntent due to ongoing WebRTC call with another party.");
return;
}
}
@ -800,23 +788,23 @@ static NSTimeInterval launchStartedAt;
} else if ([userActivity.activityType isEqualToString:@"INStartAudioCallIntent"]) {
if (!SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(10, 0)) {
OWSLogError(@"%@ unexpectedly received INStartAudioCallIntent pre iOS10", self.logTag);
OWSLogError(@"unexpectedly received INStartAudioCallIntent pre iOS10");
return NO;
}
OWSLogInfo(@"%@ got start audio call intent", self.logTag);
OWSLogInfo(@"got start audio call intent");
INInteraction *interaction = [userActivity interaction];
INIntent *intent = interaction.intent;
if (![intent isKindOfClass:[INStartAudioCallIntent class]]) {
OWSLogError(@"%@ unexpected class for start call audio: %@", self.logTag, intent);
OWSLogError(@"unexpected class for start call audio: %@", intent);
return NO;
}
INStartAudioCallIntent *startCallIntent = (INStartAudioCallIntent *)intent;
NSString *_Nullable handle = startCallIntent.contacts.firstObject.personHandle.value;
if (!handle) {
OWSLogWarn(@"%@ unable to find handle in startCallIntent: %@", self.logTag, startCallIntent);
OWSLogWarn(@"unable to find handle in startCallIntent: %@", startCallIntent);
return NO;
}
@ -825,14 +813,13 @@ static NSTimeInterval launchStartedAt;
if ([handle hasPrefix:CallKitCallManager.kAnonymousCallHandlePrefix]) {
phoneNumber = [[OWSPrimaryStorage sharedManager] phoneNumberForCallKitId:handle];
if (phoneNumber.length < 1) {
OWSLogWarn(
@"%@ ignoring attempt to initiate audio call to unknown anonymous signal user.", self.logTag);
OWSLogWarn(@"ignoring attempt to initiate audio call to unknown anonymous signal user.");
return;
}
}
if (SignalApp.sharedApp.callService.call != nil) {
OWSLogWarn(@"%@ ignoring INStartAudioCallIntent due to ongoing WebRTC call.", self.logTag);
OWSLogWarn(@"ignoring INStartAudioCallIntent due to ongoing WebRTC call.");
return;
}
@ -842,10 +829,7 @@ static NSTimeInterval launchStartedAt;
}];
return YES;
} else {
OWSLogWarn(@"%@ called %s with userActivity: %@, but not yet supported.",
self.logTag,
__PRETTY_FUNCTION__,
userActivity.activityType);
OWSLogWarn(@"userActivity: %@, but not yet supported.", userActivity.activityType);
}
// TODO Something like...
@ -949,7 +933,7 @@ static NSTimeInterval launchStartedAt;
withResponseInfo:(NSDictionary *)responseInfo
completionHandler:(void (^)())completionHandler
{
OWSLogInfo(@"%@ handling action with identifier: %@", self.logTag, identifier);
OWSLogInfo(@"handling action with identifier: %@", identifier);
OWSAssertIsOnMainThread();
@ -976,7 +960,7 @@ static NSTimeInterval launchStartedAt;
- (void)application:(UIApplication *)application
performFetchWithCompletionHandler:(void (^)(UIBackgroundFetchResult result))completionHandler
{
OWSLogInfo(@"%@ performing background fetch", self.logTag);
OWSLogInfo(@"performing background fetch");
[AppReadiness runNowOrWhenAppIsReady:^{
__block AnyPromise *job = [[SignalApp sharedApp].messageFetcherJob run].then(^{
// HACK: Call completion handler after n seconds.
@ -999,7 +983,7 @@ static NSTimeInterval launchStartedAt;
{
OWSAssertIsOnMainThread();
OWSLogInfo(@"%@ versionMigrationsDidComplete", self.logTag);
OWSLogInfo(@"versionMigrationsDidComplete");
self.areVersionMigrationsComplete = YES;
@ -1009,7 +993,7 @@ static NSTimeInterval launchStartedAt;
- (void)storageIsReady
{
OWSAssertIsOnMainThread();
OWSLogInfo(@"%@ storageIsReady", self.logTag);
OWSLogInfo(@"storageIsReady");
[self checkIfAppIsReady];
}
@ -1030,7 +1014,7 @@ static NSTimeInterval launchStartedAt;
return;
}
OWSLogInfo(@"%@ checkIfAppIsReady", self.logTag);
OWSLogInfo(@"checkIfAppIsReady");
// TODO: Once "app ready" logic is moved into AppSetup, move this line there.
[[OWSProfileManager sharedManager] ensureLocalProfileCached];
@ -1113,7 +1097,7 @@ static NSTimeInterval launchStartedAt;
[self enableBackgroundRefreshIfNecessary];
if ([TSAccountManager isRegistered]) {
OWSLogInfo(@"%@ localNumber: %@", [TSAccountManager localNumber], self.logTag);
OWSLogInfo(@"localNumber: %@", [TSAccountManager localNumber]);
[[OWSPrimaryStorage sharedManager].newDatabaseConnection
readWriteWithBlock:^(YapDatabaseReadWriteTransaction *_Nonnull transaction) {
@ -1138,7 +1122,7 @@ static NSTimeInterval launchStartedAt;
{
OWSAssertIsOnMainThread();
OWSLogInfo(@"%@ ensureRootViewController", self.logTag);
OWSLogInfo(@"ensureRootViewController");
if (!AppReadiness.isAppReady || self.hasInitialRootViewController) {
return;
@ -1146,7 +1130,7 @@ static NSTimeInterval launchStartedAt;
self.hasInitialRootViewController = YES;
NSTimeInterval startupDuration = CACurrentMediaTime() - launchStartedAt;
OWSLogInfo(@"%@ Presenting app %.2f seconds after launch started.", self.logTag, startupDuration);
OWSLogInfo(@"Presenting app %.2f seconds after launch started.", startupDuration);
if ([TSAccountManager isRegistered]) {
HomeViewController *homeView = [HomeViewController new];
@ -1172,7 +1156,7 @@ static NSTimeInterval launchStartedAt;
CGPoint location = [[[event allTouches] anyObject] locationInView:[self window]];
CGRect statusBarFrame = [UIApplication sharedApplication].statusBarFrame;
if (CGRectContainsPoint(statusBarFrame, location)) {
OWSLogDebug(@"%@ touched status bar", self.logTag);
OWSLogDebug(@"touched status bar");
[[NSNotificationCenter defaultCenter] postNotificationName:TappedStatusBarNotification object:nil];
}
}

View File

@ -75,7 +75,7 @@ NS_ASSUME_NONNULL_BEGIN
__weak AddToBlockListViewController *weakSelf = self;
ContactsViewHelper *helper = self.contactsViewHelper;
if ([helper isRecipientIdBlocked:signalAccount.recipientId]) {
OWSFailDebug(@"%@ Cannot add already blocked user to block list.", self.logTag);
OWSFailDebug(@"Cannot add already blocked user to block list.");
return;
}
[BlockListUIUtils showBlockSignalAccountActionSheet:signalAccount

View File

@ -267,12 +267,12 @@ NS_ASSUME_NONNULL_BEGIN
- (void)didToggleEnableLogSwitch:(UISwitch *)sender
{
if (!sender.isOn) {
OWSLogInfo(@"%@ disabling logging.", self.logTag);
OWSLogInfo(@"disabling logging.");
[[DebugLogger sharedLogger] wipeLogs];
[[DebugLogger sharedLogger] disableFileLogging];
} else {
[[DebugLogger sharedLogger] enableFileLogging];
OWSLogInfo(@"%@ enabling logging.", self.logTag);
OWSLogInfo(@"enabling logging.");
}
[OWSPreferences setIsLoggingEnabled:sender.isOn];

View File

@ -135,7 +135,7 @@ NS_ASSUME_NONNULL_BEGIN
if (self.scanDelegate) {
if ([self.scanDelegate respondsToSelector:@selector(controller:didDetectQRCodeWithData:)]) {
OWSLogInfo(@"%@ Scanned Data Code.", self.logTag);
OWSLogInfo(@"Scanned Data Code.");
ZXByteArray *byteArray = result.resultMetadata[@(kResultMetadataTypeByteSegments)][0];
NSData *decodedData = [NSData dataWithBytes:byteArray.array length:byteArray.length];
@ -143,7 +143,7 @@ NS_ASSUME_NONNULL_BEGIN
}
if ([self.scanDelegate respondsToSelector:@selector(controller:didDetectQRCodeWithString:)]) {
OWSLogInfo(@"%@ Scanned String Code.", self.logTag);
OWSLogInfo(@"Scanned String Code.");
[self.scanDelegate controller:self didDetectQRCodeWithString:result.text];
}
}

View File

@ -233,21 +233,21 @@ NS_ASSUME_NONNULL_BEGIN
- (void)didToggleScreenSecuritySwitch:(UISwitch *)sender
{
BOOL enabled = sender.isOn;
OWSLogInfo(@"%@ toggled screen security: %@", self.logTag, enabled ? @"ON" : @"OFF");
OWSLogInfo(@"toggled screen security: %@", enabled ? @"ON" : @"OFF");
[Environment.preferences setScreenSecurity:enabled];
}
- (void)didToggleReadReceiptsSwitch:(UISwitch *)sender
{
BOOL enabled = sender.isOn;
OWSLogInfo(@"%@ toggled areReadReceiptsEnabled: %@", self.logTag, enabled ? @"ON" : @"OFF");
OWSLogInfo(@"toggled areReadReceiptsEnabled: %@", enabled ? @"ON" : @"OFF");
[OWSReadReceiptManager.sharedManager setAreReadReceiptsEnabled:enabled];
}
- (void)didToggleCallsHideIPAddressSwitch:(UISwitch *)sender
{
BOOL enabled = sender.isOn;
OWSLogInfo(@"%@ toggled callsHideIPAddress: %@", self.logTag, enabled ? @"ON" : @"OFF");
OWSLogInfo(@"toggled callsHideIPAddress: %@", enabled ? @"ON" : @"OFF");
[Environment.preferences setDoCallsHideIPAddress:enabled];
}
@ -295,7 +295,7 @@ NS_ASSUME_NONNULL_BEGIN
BOOL shouldBeEnabled = sender.isOn;
if (shouldBeEnabled == OWSScreenLock.sharedManager.isScreenLockEnabled) {
OWSLogError(@"%@ ignoring redundant screen lock.", self.logTag);
OWSLogError(@"ignoring redundant screen lock.");
return;
}

View File

@ -71,7 +71,7 @@ NS_ASSUME_NONNULL_BEGIN
[self.delegate.fromViewController ows_askForCameraPermissions:^(BOOL granted) {
if (!granted) {
OWSLogWarn(@"%@ Camera permission denied.", self.logTag);
OWSLogWarn(@"Camera permission denied.");
return;
}
@ -92,7 +92,7 @@ NS_ASSUME_NONNULL_BEGIN
[self.delegate.fromViewController ows_askForMediaLibraryPermissions:^(BOOL granted) {
if (!granted) {
OWSLogWarn(@"%@ Media Library permission denied.", self.logTag);
OWSLogWarn(@"Media Library permission denied.");
return;
}

View File

@ -142,7 +142,7 @@ NS_ASSUME_NONNULL_BEGIN
self.lastProgress = (CGFloat)progress;
self.isAttachmentReady = self.attachment.isUploaded;
} else {
OWSFailDebug(@"%@ Invalid attachment progress.", self.logTag);
OWSFailDebug(@"Invalid attachment progress.");
self.isAttachmentReady = YES;
}
}

View File

@ -204,7 +204,7 @@ NS_ASSUME_NONNULL_BEGIN
OWSAssert(self.viewItem);
OWSAssert(self.viewItem.interaction);
if (![self.viewItem.interaction isKindOfClass:[OWSContactOffersInteraction class]]) {
OWSFailDebug(@"%@ expected OWSContactOffersInteraction but found: %@", self.logTag, self.viewItem.interaction);
OWSFailDebug(@"expected OWSContactOffersInteraction but found: %@", self.viewItem.interaction);
return nil;
}
return (OWSContactOffersInteraction *)self.viewItem.interaction;

View File

@ -126,7 +126,7 @@ NS_ASSUME_NONNULL_BEGIN
label.text = NSLocalizedString(@"CONVERSATION_VIEW_ADD_TO_CONTACTS_OFFER",
@"Message shown in conversation view that offers to add an unknown user to your phone's contacts.");
} else {
OWSFailDebug(@"%@ unexpected button state.", self.logTag);
OWSFailDebug(@"unexpected button state.");
}
label.font = OWSContactShareButtonsView.buttonFont;
label.textColor = (Theme.isDarkThemeEnabled ? UIColor.ows_whiteColor : UIColor.ows_materialBlueColor);
@ -158,7 +158,7 @@ NS_ASSUME_NONNULL_BEGIN
} else if ([OWSContactShareButtonsView hasAddToContactsButton:self.contactShare]) {
[self.delegate didTapShowAddToContactUIForContactShare:self.contactShare];
} else {
OWSFailDebug(@"%@ unexpected button tap.", self.logTag);
OWSFailDebug(@"unexpected button tap.");
}
return YES;

View File

@ -134,7 +134,7 @@ const UIDataDetectorTypes kOWSAllowedDataDetectorTypes
case 5:
return [UIFont ows_regularFontWithSize:basePointSize + 18.f];
default:
OWSFailDebug(@"%@ Unexpected jumbomoji count: %zd", self.logTag, self.displayableBodyText.jumbomojiCount);
OWSFailDebug(@"Unexpected jumbomoji count: %zd", self.displayableBodyText.jumbomojiCount);
break;
}
@ -669,12 +669,12 @@ const UIDataDetectorTypes kOWSAllowedDataDetectorTypes
id _Nullable cellMedia = [self.cellMediaCache objectForKey:cacheKey];
if (cellMedia) {
OWSLogVerbose(@"%@ cell media cache hit", self.logTag);
OWSLogVerbose(@"cell media cache hit");
return cellMedia;
}
cellMedia = loadCellMediaBlock();
if (cellMedia) {
OWSLogVerbose(@"%@ cell media cache miss", self.logTag);
OWSLogVerbose(@"cell media cache miss");
if (!shouldSkipCache) {
[self.cellMediaCache setObject:cellMedia forKey:cacheKey];
}
@ -1479,7 +1479,7 @@ const UIDataDetectorTypes kOWSAllowedDataDetectorTypes
OWSAssert(self.delegate);
if (sender.state != UIGestureRecognizerStateRecognized) {
OWSLogVerbose(@"%@ Ignoring tap on message: %@", self.logTag, self.viewItem.interaction.debugDescription);
OWSLogVerbose(@"Ignoring tap on message: %@", self.viewItem.interaction.debugDescription);
return;
}
@ -1514,7 +1514,7 @@ const UIDataDetectorTypes kOWSAllowedDataDetectorTypes
if (self.viewItem.quotedReply) {
[self.delegate didTapConversationItem:self.viewItem quotedReply:self.viewItem.quotedReply];
} else {
OWSFailDebug(@"%@ Missing quoted message.", self.logTag);
OWSFailDebug(@"Missing quoted message.");
}
break;
}

View File

@ -254,17 +254,17 @@ NS_ASSUME_NONNULL_BEGIN
return NO;
}
if (!self.viewItem.isGroupThread) {
OWSFailDebug(@"%@ not a group thread.", self.logTag);
OWSFailDebug(@"not a group thread.");
return NO;
}
if (self.viewItem.interaction.interactionType != OWSInteractionType_IncomingMessage) {
OWSFailDebug(@"%@ not an incoming message.", self.logTag);
OWSFailDebug(@"not an incoming message.");
return NO;
}
OWSContactsManager *contactsManager = self.delegate.contactsManager;
if (contactsManager == nil) {
OWSFailDebug(@"%@ contactsManager should not be nil", self.logTag);
OWSFailDebug(@"contactsManager should not be nil");
return NO;
}
@ -297,11 +297,11 @@ NS_ASSUME_NONNULL_BEGIN
return;
}
if (!self.viewItem.isGroupThread) {
OWSFailDebug(@"%@ not a group thread.", self.logTag);
OWSFailDebug(@"not a group thread.");
return;
}
if (self.viewItem.interaction.interactionType != OWSInteractionType_IncomingMessage) {
OWSFailDebug(@"%@ not an incoming message.", self.logTag);
OWSFailDebug(@"not an incoming message.");
return;
}
@ -395,7 +395,7 @@ NS_ASSUME_NONNULL_BEGIN
OWSAssert(self.delegate);
if (sender.state != UIGestureRecognizerStateRecognized) {
OWSLogVerbose(@"%@ Ignoring tap on message: %@", self.logTag, self.viewItem.interaction.debugDescription);
OWSLogVerbose(@"Ignoring tap on message: %@", self.viewItem.interaction.debugDescription);
return;
}

View File

@ -332,7 +332,7 @@ const CGFloat kRemotelySourcedContentRowSpacing = 3;
- (void)didTapFailedThumbnailDownload:(UITapGestureRecognizer *)gestureRecognizer
{
OWSLogDebug(@"%@ in didTapFailedThumbnailDownload", self.logTag);
OWSLogDebug(@"in didTapFailedThumbnailDownload");
if (!self.quotedMessage.thumbnailDownloadFailed) {
OWSFailDebug(@"thumbnailDownloadFailed was unexpectedly false");

View File

@ -280,7 +280,7 @@ typedef void (^SystemMessageActionBlock)(void);
areDisappearingMessagesEnabled
= ((OWSDisappearingConfigurationUpdateInfoMessage *)interaction).configurationIsEnabled;
} else {
OWSFailDebug(@"%@ unexpected interaction type: %@", self.logTag, interaction.class);
OWSFailDebug(@"unexpected interaction type: %@", interaction.class);
}
result = (areDisappearingMessagesEnabled
? [UIImage imageNamed:@"system_message_disappearing_messages"]
@ -447,7 +447,7 @@ typedef void (^SystemMessageActionBlock)(void);
}];
}
OWSLogWarn(@"%@ Unhandled tap for error message:%@", self.logTag, message);
OWSLogWarn(@"Unhandled tap for error message:%@", message);
return nil;
}
@ -495,7 +495,7 @@ typedef void (^SystemMessageActionBlock)(void);
}];
}
OWSLogInfo(@"%@ Unhandled tap for info message: %@", self.logTag, message);
OWSLogInfo(@"Unhandled tap for info message: %@", message);
return nil;
}
@ -561,7 +561,7 @@ typedef void (^SystemMessageActionBlock)(void);
- (void)buttonWasPressed:(id)sender
{
if (!self.action.block) {
OWSFailDebug(@"%@ Missing action", self.logTag);
OWSFailDebug(@"Missing action");
} else {
self.action.block();
}

View File

@ -220,7 +220,7 @@ NS_ASSUME_NONNULL_BEGIN
- (void)modifiedReturnPressed:(UIKeyCommand *)sender
{
OWSLogInfo(@"%@ modifiedReturnPressed: %@", self.logTag, sender.input);
OWSLogInfo(@"modifiedReturnPressed: %@", sender.input);
[self.inputTextViewDelegate inputTextViewSendMessagePressed];
}

View File

@ -443,7 +443,7 @@ typedef enum : NSUInteger {
{
OWSAssert(thread);
OWSLogInfo(@"%@ configureForThread.", self.logTag);
OWSLogInfo(@"configureForThread.");
_thread = thread;
self.actionOnOpen = action;
@ -461,7 +461,7 @@ typedef enum : NSUInteger {
[self createNewMessageMappings];
if (![self reloadViewItems]) {
OWSFailDebug(@"%@ failed to reload view items in configureForThread.", self.logTag);
OWSFailDebug(@"failed to reload view items in configureForThread.");
}
[self updateShouldObserveDBModifications];
@ -496,7 +496,7 @@ typedef enum : NSUInteger {
}
}
OWSLogVerbose(@"%@ reloading conversation view contents.", self.logTag);
OWSLogVerbose(@"reloading conversation view contents.");
[self resetContentAndLayout];
}
@ -660,18 +660,18 @@ typedef enum : NSUInteger {
{
UIViewController *_Nullable presentedViewController = self.presentedViewController;
if (!presentedViewController) {
OWSLogDebug(@"%@ presentedViewController was nil", self.logTag);
OWSLogDebug(@"presentedViewController was nil");
return;
}
if ([presentedViewController isKindOfClass:[UIAlertController class]]) {
OWSLogDebug(@"%@ dismissing presentedViewController: %@", self.logTag, presentedViewController);
OWSLogDebug(@"dismissing presentedViewController: %@", presentedViewController);
[self dismissViewControllerAnimated:NO completion:nil];
return;
}
if ([presentedViewController isKindOfClass:[UIImagePickerController class]]) {
OWSLogDebug(@"%@ dismissing presentedViewController: %@", self.logTag, presentedViewController);
OWSLogDebug(@"dismissing presentedViewController: %@", presentedViewController);
[self dismissViewControllerAnimated:NO completion:nil];
return;
}
@ -679,7 +679,7 @@ typedef enum : NSUInteger {
- (void)viewWillAppear:(BOOL)animated
{
OWSLogDebug(@"%@ viewWillAppear", self.logTag);
OWSLogDebug(@"viewWillAppear");
[self ensureBannerState];
@ -711,7 +711,7 @@ typedef enum : NSUInteger {
if (!self.viewHasEverAppeared) {
NSTimeInterval appearenceDuration = CACurrentMediaTime() - self.viewControllerCreatedAt;
OWSLogVerbose(@"%@ First viewWillAppear took: %.2fms", self.logTag, appearenceDuration * 1000);
OWSLogVerbose(@"First viewWillAppear took: %.2fms", appearenceDuration * 1000);
}
}
@ -735,14 +735,14 @@ typedef enum : NSUInteger {
if (!self.dynamicInteractions.focusMessagePosition) {
// This might happen if the focus message has disappeared
// before this view could appear.
OWSFailDebug(@"%@ focus message has unknown position.", self.logTag);
OWSFailDebug(@"focus message has unknown position.");
return nil;
}
NSUInteger focusMessagePosition = self.dynamicInteractions.focusMessagePosition.unsignedIntegerValue;
if (focusMessagePosition >= self.viewItems.count) {
// This might happen if the focus message is outside the maximum
// valid load window size for this view.
OWSFailDebug(@"%@ focus message has invalid position.", self.logTag);
OWSFailDebug(@"focus message has invalid position.");
return nil;
}
NSInteger row = (NSInteger)((self.viewItems.count - 1) - focusMessagePosition);
@ -801,7 +801,7 @@ typedef enum : NSUInteger {
self.lastReloadDate = [NSDate new];
self.collapseCutoffDate = [NSDate new];
if (![self reloadViewItems]) {
OWSFailDebug(@"%@ failed to reload view items in resetContentAndLayout.", self.logTag);
OWSFailDebug(@"failed to reload view items in resetContentAndLayout.");
}
[self.collectionView.collectionViewLayout invalidateLayout];
[self.collectionView reloadData];
@ -1153,7 +1153,7 @@ typedef enum : NSUInteger {
// In fact doing so would unnecessarily dismiss the keyboard which is probably not desirable and at least
// a distracting animation.
if (!self.inputToolbar.isInputTextViewFirstResponder) {
OWSLogDebug(@"%@ reclaiming first responder to ensure toolbar is shown.", self.logTag);
OWSLogDebug(@"reclaiming first responder to ensure toolbar is shown.");
[self becomeFirstResponder];
}
}
@ -1182,7 +1182,7 @@ typedef enum : NSUInteger {
// until `viewDidDisappear`.
- (void)viewWillDisappear:(BOOL)animated
{
OWSLogDebug(@"%@ viewWillDisappear", self.logTag);
OWSLogDebug(@"viewWillDisappear");
[super viewWillDisappear:animated];
@ -1549,7 +1549,7 @@ typedef enum : NSUInteger {
*/
- (void)didChangePreferredContentSize:(NSNotification *)notification
{
OWSLogInfo(@"%@ didChangePreferredContentSize", self.logTag);
OWSLogInfo(@"didChangePreferredContentSize");
// Evacuate cached cell sizes.
for (ConversationViewItem *viewItem in self.viewItems) {
@ -1581,7 +1581,7 @@ typedef enum : NSUInteger {
- (void)showConversationSettingsAndShowVerification:(BOOL)showVerification
{
if (self.userLeftGroup) {
OWSLogDebug(@"%@ Ignoring request to show conversation settings, since user left group", self.logTag);
OWSLogDebug(@"Ignoring request to show conversation settings, since user left group");
return;
}
@ -1596,7 +1596,7 @@ typedef enum : NSUInteger {
- (void)disappearingTimerConfigurationViewWasTapped:(DisappearingTimerConfigurationView *)disappearingTimerView
{
OWSLogDebug(@"%@ Tapped timer in navbar", self.logTag);
OWSLogDebug(@"Tapped timer in navbar");
[self showConversationSettings];
}
@ -1717,9 +1717,7 @@ typedef enum : NSUInteger {
if (self.focusMessageIdOnOpen) {
OWSAssert(self.dynamicInteractions.focusMessagePosition);
if (self.dynamicInteractions.focusMessagePosition) {
OWSLogVerbose(@"%@ ensuring load of focus message: %@",
self.logTag,
self.dynamicInteractions.focusMessagePosition);
OWSLogVerbose(@"ensuring load of focus message: %@", self.dynamicInteractions.focusMessagePosition);
rangeLength = MAX(rangeLength, 1 + self.dynamicInteractions.focusMessagePosition.unsignedIntegerValue);
}
}
@ -1773,10 +1771,10 @@ typedef enum : NSUInteger {
[processor fetchAttachmentsForMessage:message
primaryStorage:self.primaryStorage
success:^(TSAttachmentStream *attachmentStream) {
OWSLogInfo(@"%@ Successfully redownloaded attachment in thread: %@", self.logTag, message.thread);
OWSLogInfo(@"Successfully redownloaded attachment in thread: %@", message.thread);
}
failure:^(NSError *error) {
OWSLogWarn(@"%@ Failed to redownload message with error: %@", self.logTag, error);
OWSLogWarn(@"Failed to redownload message with error: %@", error);
}];
}
@ -1802,10 +1800,10 @@ typedef enum : NSUInteger {
handler:^(UIAlertAction *action) {
[self.messageSender enqueueMessage:message
success:^{
OWSLogInfo(@"%@ Successfully resent failed message.", self.logTag);
OWSLogInfo(@"Successfully resent failed message.");
}
failure:^(NSError *error) {
OWSLogWarn(@"%@ Failed to send message with error: %@", self.logTag, error);
OWSLogWarn(@"Failed to send message with error: %@", error);
}];
}];
@ -1820,13 +1818,11 @@ typedef enum : NSUInteger {
if (signalIdParam == nil) {
if (self.thread.isGroupThread) {
// Before 2.13 we didn't track the recipient id in the identity change error.
OWSLogWarn(@"%@ Ignoring tap on legacy nonblocking identity change since it has no signal id", self.logTag);
OWSLogWarn(@"Ignoring tap on legacy nonblocking identity change since it has no signal id");
return;
} else {
OWSLogInfo(
@"%@ Assuming tap on legacy nonblocking identity change corresponds to current contact thread: %@",
self.logTag,
OWSLogInfo(@"Assuming tap on legacy nonblocking identity change corresponds to current contact thread: %@",
self.thread.contactIdentifier);
signalIdParam = self.thread.contactIdentifier;
}
@ -1854,7 +1850,7 @@ typedef enum : NSUInteger {
handler:^(UIAlertAction *action) {
if (![self.thread isKindOfClass:[TSContactThread class]]) {
// Corrupt Message errors only appear in contact threads.
OWSLogError(@"%@ Unexpected request to reset session in group thread. Refusing", self.logTag);
OWSLogError(@"Unexpected request to reset session in group thread. Refusing");
return;
}
TSContactThread *contactThread = (TSContactThread *)self.thread;
@ -1885,7 +1881,7 @@ typedef enum : NSUInteger {
[UIAlertAction actionWithTitle:NSLocalizedString(@"SHOW_SAFETY_NUMBER_ACTION", @"Action sheet item")
style:UIAlertActionStyleDefault
handler:^(UIAlertAction *action) {
OWSLogInfo(@"%@ Remote Key Changed actions: Show fingerprint display", self.logTag);
OWSLogInfo(@"Remote Key Changed actions: Show fingerprint display");
[self showFingerprintWithRecipientId:errorMessage.theirSignalId];
}];
[actionSheetController addAction:showSafteyNumberAction];
@ -1894,7 +1890,7 @@ typedef enum : NSUInteger {
[UIAlertAction actionWithTitle:NSLocalizedString(@"ACCEPT_NEW_IDENTITY_ACTION", @"Action sheet item")
style:UIAlertActionStyleDefault
handler:^(UIAlertAction *action) {
OWSLogInfo(@"%@ Remote Key Changed actions: Accepted new identity key", self.logTag);
OWSLogInfo(@"Remote Key Changed actions: Accepted new identity key");
// DEPRECATED: we're no longer creating these incoming SN error's per message,
// but there will be some legacy ones in the wild, behind which await
@ -1914,7 +1910,7 @@ typedef enum : NSUInteger {
OWSAssert(call);
if (![self.thread isKindOfClass:[TSContactThread class]]) {
OWSFailDebug(@"%@ unexpected thread: %@ in %s", self.logTag, self.thread, __PRETTY_FUNCTION__);
OWSFailDebug(@"unexpected thread: %@", self.thread);
return;
}
@ -1975,9 +1971,7 @@ typedef enum : NSUInteger {
newInset.bottom -= verticalChange;
newOffset.y -= verticalChange;
OWSLogDebug(@"%@ in %s verticalChange: %f, insets: %@ -> %@",
self.logTag,
__PRETTY_FUNCTION__,
OWSLogDebug(@"verticalChange: %f, insets: %@ -> %@",
verticalChange,
NSStringFromUIEdgeInsets(oldInset),
NSStringFromUIEdgeInsets(newInset));
@ -2003,9 +1997,7 @@ typedef enum : NSUInteger {
newInset.bottom += verticalChange;
newOffset.y += verticalChange;
OWSLogDebug(@"%@ in %s verticalChange: %f, insets: %@ -> %@",
self.logTag,
__PRETTY_FUNCTION__,
OWSLogDebug(@"verticalChange: %f, insets: %@ -> %@",
verticalChange,
NSStringFromUIEdgeInsets(oldInset),
NSStringFromUIEdgeInsets(newInset));
@ -2065,7 +2057,7 @@ typedef enum : NSUInteger {
- (void)tappedUnknownContactBlockOfferMessage:(OWSContactOffersInteraction *)interaction
{
if (![self.thread isKindOfClass:[TSContactThread class]]) {
OWSFailDebug(@"%@ unexpected thread: %@ in %s", self.logTag, self.thread, __PRETTY_FUNCTION__);
OWSFailDebug(@"unexpected thread: %@", self.thread);
return;
}
TSContactThread *contactThread = (TSContactThread *)self.thread;
@ -2087,7 +2079,7 @@ typedef enum : NSUInteger {
@"BLOCK_OFFER_ACTIONSHEET_BLOCK_ACTION", @"Action sheet that will block an unknown user.")
style:UIAlertActionStyleDestructive
handler:^(UIAlertAction *action) {
OWSLogInfo(@"%@ Blocking an unknown user.", self.logTag);
OWSLogInfo(@"Blocking an unknown user.");
[self.blockingManager addBlockedPhoneNumber:interaction.recipientId];
// Delete the offers.
[self.editingDatabaseConnection readWriteWithBlock:^(YapDatabaseReadWriteTransaction *transaction) {
@ -2105,11 +2097,11 @@ typedef enum : NSUInteger {
- (void)tappedAddToContactsOfferMessage:(OWSContactOffersInteraction *)interaction
{
if (!self.contactsManager.supportsContactEditing) {
OWSFailDebug(@"%@ Contact editing not supported", self.logTag);
OWSFailDebug(@"Contact editing not supported");
return;
}
if (![self.thread isKindOfClass:[TSContactThread class]]) {
OWSFailDebug(@"%@ unexpected thread: %@ in %s", self.logTag, [self.thread class], __PRETTY_FUNCTION__);
OWSFailDebug(@"unexpected thread: %@", [self.thread class]);
return;
}
TSContactThread *contactThread = (TSContactThread *)self.thread;
@ -2129,7 +2121,7 @@ typedef enum : NSUInteger {
{
// This is accessed via the contact offer. Group whitelisting happens via a different interaction.
if (![self.thread isKindOfClass:[TSContactThread class]]) {
OWSFailDebug(@"%@ unexpected thread: %@ in %s", self.logTag, [self.thread class], __PRETTY_FUNCTION__);
OWSFailDebug(@"unexpected thread: %@", [self.thread class]);
return;
}
TSContactThread *contactThread = (TSContactThread *)self.thread;
@ -2221,7 +2213,7 @@ typedef enum : NSUInteger {
NSFileManager *fileManager = [NSFileManager defaultManager];
if (![fileManager fileExistsAtPath:[attachmentStream.mediaURL path]]) {
OWSFailDebug(@"%@ Missing video file: %@", self.logTag, attachmentStream.mediaURL);
OWSFailDebug(@"Missing video file: %@", attachmentStream.mediaURL);
}
[self dismissKeyBoard];
@ -2336,7 +2328,7 @@ typedef enum : NSUInteger {
}];
}
failure:^(NSError *error) {
OWSLogWarn(@"%@ Failed to redownload thumbnail with error: %@", self.logTag, error);
OWSLogWarn(@"Failed to redownload thumbnail with error: %@", error);
[self.editingDatabaseConnection
asyncReadWriteWithBlock:^(YapDatabaseReadWriteTransaction *postSuccessTransaction) {
[message touchWithTransaction:transaction];
@ -2390,7 +2382,7 @@ typedef enum : NSUInteger {
YapDatabaseAutoViewTransaction *_Nullable extension =
[transaction extension:TSMessageDatabaseViewExtensionName];
if (!extension) {
OWSFailDebug(@"%@ Couldn't load view.", self.logTag);
OWSFailDebug(@"Couldn't load view.");
return;
}
@ -2416,7 +2408,7 @@ typedef enum : NSUInteger {
NSUInteger oldLoadWindowSize = [self.messageMappings numberOfItemsInGroup:self.thread.uniqueId];
NSInteger additionalItemsToLoad = MAX(0, desiredWindowSize - (NSInteger)oldLoadWindowSize);
if (additionalItemsToLoad < 1) {
OWSLogError(@"%@ Couldn't determine how to load quoted reply.", self.logTag);
OWSLogError(@"Couldn't determine how to load quoted reply.");
return;
}
@ -2435,7 +2427,7 @@ typedef enum : NSUInteger {
}];
if (!quotedInteraction || !groupIndex) {
OWSLogError(@"%@ Failed to find quoted reply in group.", self.logTag);
OWSLogError(@"Failed to find quoted reply in group.");
return;
}
@ -2445,7 +2437,7 @@ typedef enum : NSUInteger {
inGroup:self.thread.uniqueId];
if (!isInMappings) {
OWSLogError(@"%@ Could not load quoted reply into mapping.", self.logTag);
OWSLogError(@"Could not load quoted reply into mapping.");
return;
}
}
@ -2466,7 +2458,7 @@ typedef enum : NSUInteger {
YapDatabaseAutoViewTransaction *_Nullable extension = [transaction extension:TSMessageDatabaseViewExtensionName];
if (!extension) {
OWSFailDebug(@"%@ Couldn't load view.", self.logTag);
OWSFailDebug(@"Couldn't load view.");
return nil;
}
@ -2474,7 +2466,7 @@ typedef enum : NSUInteger {
BOOL foundInGroup =
[extension getGroup:nil index:&groupIndex forKey:interaction.uniqueId inCollection:TSInteraction.collection];
if (!foundInGroup) {
OWSLogError(@"%@ Couldn't find quoted message in group.", self.logTag);
OWSLogError(@"Couldn't find quoted message in group.");
return nil;
}
return @(groupIndex);
@ -2497,7 +2489,7 @@ typedef enum : NSUInteger {
- (void)populateReplyForViewItem:(ConversationViewItem *)conversationItem
{
OWSLogDebug(@"%@ user did tap reply", self.logTag);
OWSLogDebug(@"user did tap reply");
__block OWSQuotedReplyModel *quotedReply;
[self.uiDatabaseConnection readWithBlock:^(YapDatabaseReadTransaction *transaction) {
@ -2506,7 +2498,7 @@ typedef enum : NSUInteger {
}];
if (![quotedReply isKindOfClass:[OWSQuotedReplyModel class]]) {
OWSFailDebug(@"%@ unexpected quotedMessage: %@", self.logTag, quotedReply.class);
OWSFailDebug(@"unexpected quotedMessage: %@", quotedReply.class);
return;
}
@ -2532,10 +2524,10 @@ typedef enum : NSUInteger {
// Saving normally returns you to the "Show Contact" view
// which we're not interested in, so we skip it here. There is
// an unfortunate blip of the "Show Contact" view on slower devices.
OWSLogDebug(@"%@ completed editing contact.", self.logTag);
OWSLogDebug(@"completed editing contact.");
[self dismissViewControllerAnimated:NO completion:nil];
} else {
OWSLogDebug(@"%@ canceled editing contact.", self.logTag);
OWSLogDebug(@"canceled editing contact.");
[self dismissViewControllerAnimated:YES completion:nil];
}
}
@ -2815,17 +2807,16 @@ typedef enum : NSUInteger {
- (void)documentPicker:(UIDocumentPickerViewController *)controller didPickDocumentAtURL:(NSURL *)url
{
OWSLogDebug(@"%@ Picked document at url: %@", self.logTag, url);
OWSLogDebug(@"Picked document at url: %@", url);
NSString *type;
NSError *typeError;
[url getResourceValue:&type forKey:NSURLTypeIdentifierKey error:&typeError];
if (typeError) {
OWSFailDebug(
@"%@ Determining type of picked document at url: %@ failed with error: %@", self.logTag, url, typeError);
OWSFailDebug(@"Determining type of picked document at url: %@ failed with error: %@", url, typeError);
}
if (!type) {
OWSFailDebug(@"%@ falling back to default filetype for picked document at url: %@", self.logTag, url);
OWSFailDebug(@"falling back to default filetype for picked document at url: %@", url);
type = (__bridge NSString *)kUTTypeData;
}
@ -2833,10 +2824,9 @@ typedef enum : NSUInteger {
NSError *isDirectoryError;
[url getResourceValue:&isDirectory forKey:NSURLIsDirectoryKey error:&isDirectoryError];
if (isDirectoryError) {
OWSFailDebug(
@"%@ Determining if picked document was a directory failed with error: %@", self.logTag, isDirectoryError);
OWSFailDebug(@"Determining if picked document was a directory failed with error: %@", isDirectoryError);
} else if ([isDirectory boolValue]) {
OWSLogInfo(@"%@ User picked directory.", self.logTag);
OWSLogInfo(@"User picked directory.");
dispatch_async(dispatch_get_main_queue(), ^{
[OWSAlerts
@ -2852,7 +2842,7 @@ typedef enum : NSUInteger {
NSString *filename = url.lastPathComponent;
if (!filename) {
OWSFailDebug(@"%@ Unable to determine filename", self.logTag);
OWSFailDebug(@"Unable to determine filename");
filename = NSLocalizedString(
@"ATTACHMENT_DEFAULT_FILENAME", @"Generic filename for an attachment with no known name");
}
@ -2861,7 +2851,7 @@ typedef enum : NSUInteger {
OWSAssert(filename);
DataSource *_Nullable dataSource = [DataSourcePath dataSourceWithURL:url shouldDeleteOnDeallocation:NO];
if (!dataSource) {
OWSFailDebug(@"%@ attachment data was unexpectedly empty for picked document", self.logTag);
OWSFailDebug(@"attachment data was unexpectedly empty for picked document");
dispatch_async(dispatch_get_main_queue(), ^{
[OWSAlerts showAlertWithTitle:NSLocalizedString(@"ATTACHMENT_PICKER_DOCUMENTS_FAILED_ALERT_TITLE",
@ -2894,7 +2884,7 @@ typedef enum : NSUInteger {
{
[self ows_askForCameraPermissions:^(BOOL granted) {
if (!granted) {
OWSLogWarn(@"%@ camera permission denied.", self.logTag);
OWSLogWarn(@"camera permission denied.");
return;
}
@ -2931,7 +2921,7 @@ typedef enum : NSUInteger {
[self ows_askForMediaLibraryPermissions:^(BOOL granted) {
if (!granted) {
OWSLogWarn(@"%@ Media Library permission denied.", self.logTag);
OWSLogWarn(@"Media Library permission denied.");
return;
}
@ -3028,9 +3018,7 @@ typedef enum : NSUInteger {
filename:filename
imageQuality:TSImageQualityCompact];
if (!attachment || [attachment hasError]) {
OWSLogWarn(@"%@ %s Invalid attachment: %@.",
self.logTag,
__PRETTY_FUNCTION__,
OWSLogWarn(@"Invalid attachment: %@.",
attachment ? [attachment errorName] : @"Missing data");
[self showErrorAlertForAttachment:attachment];
failedToPickAttachment(nil);
@ -3084,9 +3072,7 @@ typedef enum : NSUInteger {
completion:^{
OWSAssertIsOnMainThread();
if (!attachment || [attachment hasError]) {
OWSLogWarn(@"%@ %s Invalid attachment: %@.",
self.logTag,
__PRETTY_FUNCTION__,
OWSLogWarn(@"Invalid attachment: %@.",
attachment ? [attachment errorName] : @"Missing data");
[self showErrorAlertForAttachment:attachment];
failedToPickAttachment(nil);
@ -3129,7 +3115,7 @@ typedef enum : NSUInteger {
OWSAssertIsOnMainThread();
OWSAssert(contactShare);
OWSLogVerbose(@"%@ Sending contact share.", self.logTag);
OWSLogVerbose(@"Sending contact share.");
BOOL didAddToProfileWhitelist = [ThreadUtil addThreadToProfileWhitelistIfEmptyContactThread:self.thread];
@ -3179,9 +3165,7 @@ typedef enum : NSUInteger {
[modalActivityIndicator dismissWithCompletion:^{
if (!attachment || [attachment hasError]) {
OWSLogError(@"%@ %s Invalid attachment: %@.",
self.logTag,
__PRETTY_FUNCTION__,
OWSLogError(@"Invalid attachment: %@.",
attachment ? [attachment errorName] : @"Missing data");
[self showErrorAlertForAttachment:attachment];
} else {
@ -3261,7 +3245,7 @@ typedef enum : NSUInteger {
if (updatedThread) {
self.thread = updatedThread;
} else {
OWSFailDebug(@"%@ Could not reload thread.", self.logTag);
OWSFailDebug(@"Could not reload thread.");
}
}
}];
@ -3344,7 +3328,7 @@ typedef enum : NSUInteger {
if (hasMalformedRowChange) {
// These errors seems to be very rare; they can only be reproduced
// using the more extreme actions in the debug UI.
OWSFailDebug(@"%@ hasMalformedRowChange", self.logTag);
OWSFailDebug(@"hasMalformedRowChange");
[self resetMappings];
[self updateLastVisibleTimestamp];
[self scrollToBottomAnimated:NO];
@ -3354,7 +3338,7 @@ typedef enum : NSUInteger {
NSUInteger oldViewItemCount = self.viewItems.count;
if (![self reloadViewItems]) {
// These errors are rare.
OWSFailDebug(@"%@ could not reload view items; hard resetting message mappings.", self.logTag);
OWSFailDebug(@"could not reload view items; hard resetting message mappings.");
[self resetMappings];
[self updateLastVisibleTimestamp];
[self scrollToBottomAnimated:NO];
@ -3432,7 +3416,7 @@ typedef enum : NSUInteger {
if (!finished) {
OWSLogInfo(@"%@ performBatchUpdates did not finish", self.logTag);
OWSLogInfo(@"performBatchUpdates did not finish");
}
[self updateLastVisibleTimestamp];
@ -3469,8 +3453,7 @@ typedef enum : NSUInteger {
}];
}
} @catch (NSException *exception) {
OWSFailDebug(@"%@ exception: %@ of type: %@ with reason: %@, user info: %@.",
self.logTag,
OWSFailDebug(@"exception: %@ of type: %@ with reason: %@, user info: %@.",
exception.description,
exception.name,
exception.reason,
@ -3580,7 +3563,7 @@ typedef enum : NSUInteger {
if (granted) {
[strongSelf startRecordingVoiceMemo];
} else {
OWSLogInfo(@"%@ we do not have recording permission.", self.logTag);
OWSLogInfo(@"we do not have recording permission.");
[strongSelf cancelVoiceMemo];
[OWSAlerts showNoMicrophonePermissionAlert];
}
@ -3605,7 +3588,7 @@ typedef enum : NSUInteger {
// Setup audio session
BOOL configuredAudio = [OWSAudioSession.shared startRecordingAudioActivity:self.voiceNoteAudioActivity];
if (!configuredAudio) {
OWSFailDebug(@"%@ Couldn't configure audio session", self.logTag);
OWSFailDebug(@"Couldn't configure audio session");
[self cancelVoiceMemo];
return;
}
@ -3621,7 +3604,7 @@ typedef enum : NSUInteger {
}
error:&error];
if (error) {
OWSFailDebug(@"%@ Couldn't create audioRecorder: %@", self.logTag, error);
OWSFailDebug(@"Couldn't create audioRecorder: %@", error);
[self cancelVoiceMemo];
return;
}
@ -3629,13 +3612,13 @@ typedef enum : NSUInteger {
self.audioRecorder.meteringEnabled = YES;
if (![self.audioRecorder prepareToRecord]) {
OWSFailDebug(@"%@ audioRecorder couldn't prepareToRecord.", self.logTag);
OWSFailDebug(@"audioRecorder couldn't prepareToRecord.");
[self cancelVoiceMemo];
return;
}
if (![self.audioRecorder record]) {
OWSFailDebug(@"%@ audioRecorder couldn't record.", self.logTag);
OWSFailDebug(@"audioRecorder couldn't record.");
[self cancelVoiceMemo];
return;
}
@ -3652,7 +3635,7 @@ typedef enum : NSUInteger {
if (!self.audioRecorder) {
// No voice message recording is in progress.
// We may be cancelling before the recording could begin.
OWSLogError(@"%@ Missing audioRecorder", self.logTag);
OWSLogError(@"Missing audioRecorder");
return;
}
@ -3682,7 +3665,7 @@ typedef enum : NSUInteger {
self.audioRecorder = nil;
if (!dataSource) {
OWSFailDebug(@"%@ Couldn't load audioRecorder data", self.logTag);
OWSFailDebug(@"Couldn't load audioRecorder data");
self.audioRecorder = nil;
return;
}
@ -3692,12 +3675,9 @@ typedef enum : NSUInteger {
[dataSource setSourceFilename:filename];
SignalAttachment *attachment =
[SignalAttachment voiceMessageAttachmentWithDataSource:dataSource dataUTI:(NSString *)kUTTypeMPEG4Audio];
OWSLogVerbose(@"%@ voice memo duration: %f, file size: %zd", self.logTag, durationSeconds, [dataSource dataLength]);
OWSLogVerbose(@"voice memo duration: %f, file size: %zd", durationSeconds, [dataSource dataLength]);
if (!attachment || [attachment hasError]) {
OWSLogWarn(@"%@ %s Invalid attachment: %@.",
self.logTag,
__PRETTY_FUNCTION__,
attachment ? [attachment errorName] : @"Missing data");
OWSLogWarn(@"Invalid attachment: %@.", attachment ? [attachment errorName] : @"Missing data");
[self showErrorAlertForAttachment:attachment];
} else {
[self tryToSendAttachmentIfApproved:attachment skipApprovalDialog:YES];
@ -3900,15 +3880,15 @@ typedef enum : NSUInteger {
- (void)markVisibleMessagesAsRead
{
if (self.presentedViewController) {
OWSLogInfo(@"%@ Not marking messages as read; another view is presented.", self.logTag);
OWSLogInfo(@"Not marking messages as read; another view is presented.");
return;
}
if (OWSWindowManager.sharedManager.shouldShowCallView) {
OWSLogInfo(@"%@ Not marking messages as read; call view is presented.", self.logTag);
OWSLogInfo(@"Not marking messages as read; call view is presented.");
return;
}
if (self.navigationController.topViewController != self) {
OWSLogInfo(@"%@ Not marking messages as read; another view is pushed.", self.logTag);
OWSLogInfo(@"Not marking messages as read; another view is pushed.");
return;
}
@ -3953,24 +3933,24 @@ typedef enum : NSUInteger {
contentType:OWSMimeTypeImagePng
inMessage:message
success:^{
OWSLogDebug(@"%@ Successfully sent group update with avatar", self.logTag);
OWSLogDebug(@"Successfully sent group update with avatar");
if (successCompletion) {
successCompletion();
}
}
failure:^(NSError *error) {
OWSLogError(@"%@ Failed to send group avatar update with error: %@", self.logTag, error);
OWSLogError(@"Failed to send group avatar update with error: %@", error);
}];
} else {
[self.messageSender enqueueMessage:message
success:^{
OWSLogDebug(@"%@ Successfully sent group update", self.logTag);
OWSLogDebug(@"Successfully sent group update");
if (successCompletion) {
successCompletion();
}
}
failure:^(NSError *error) {
OWSLogError(@"%@ Failed to send group update with error: %@", self.logTag, error);
OWSLogError(@"Failed to send group update with error: %@", error);
}];
}
@ -4118,10 +4098,7 @@ typedef enum : NSUInteger {
}
if (attachment == nil || [attachment hasError]) {
OWSLogWarn(@"%@ %s Invalid attachment: %@.",
self.logTag,
__PRETTY_FUNCTION__,
attachment ? [attachment errorName] : @"Missing data");
OWSLogWarn(@"Invalid attachment: %@.", attachment ? [attachment errorName] : @"Missing data");
[self showErrorAlertForAttachment:attachment];
} else if (skipApprovalDialog) {
[self sendMessageAttachment:attachment];
@ -4150,13 +4127,13 @@ typedef enum : NSUInteger {
NSValue *_Nullable keyboardBeginFrameValue = userInfo[UIKeyboardFrameBeginUserInfoKey];
if (!keyboardBeginFrameValue) {
OWSFailDebug(@"%@ Missing keyboard begin frame", self.logTag);
OWSFailDebug(@"Missing keyboard begin frame");
return;
}
NSValue *_Nullable keyboardEndFrameValue = userInfo[UIKeyboardFrameEndUserInfoKey];
if (!keyboardEndFrameValue) {
OWSFailDebug(@"%@ Missing keyboard end frame", self.logTag);
OWSFailDebug(@"Missing keyboard end frame");
return;
}
CGRect keyboardEndFrame = [keyboardEndFrameValue CGRectValue];
@ -4586,7 +4563,7 @@ typedef enum : NSUInteger {
_shouldObserveDBModifications = shouldObserveDBModifications;
if (self.shouldObserveDBModifications) {
OWSLogVerbose(@"%@ resume observation of database modifications.", self.logTag);
OWSLogVerbose(@"resume observation of database modifications.");
// We need to call resetMappings when we _resume_ observing DB modifications,
// since we've been ignore DB modifications so the mappings can be wrong.
//
@ -4636,7 +4613,7 @@ typedef enum : NSUInteger {
BOOL hasAddedNewItems = (lastViewItem && previousLastTimestamp
&& lastViewItem.interaction.timestamp > previousLastTimestamp.unsignedLongLongValue);
OWSLogInfo(@"%@ hasAddedNewItems: %d", self.logTag, hasAddedNewItems);
OWSLogInfo(@"hasAddedNewItems: %d", hasAddedNewItems);
if (hasAddedNewItems) {
NSIndexPath *_Nullable indexPathToShow = [self firstIndexPathAtViewHorizonTimestamp];
if (indexPathToShow) {
@ -4651,9 +4628,9 @@ typedef enum : NSUInteger {
}
}
self.viewHorizonTimestamp = nil;
OWSLogVerbose(@"%@ resumed observation of database modifications.", self.logTag);
OWSLogVerbose(@"resumed observation of database modifications.");
} else {
OWSLogVerbose(@"%@ pausing observation of database modifications.", self.logTag);
OWSLogVerbose(@"pausing observation of database modifications.");
// When stopping observation, try to record the timestamp of the "view horizon".
// The "view horizon" is where we'll want to focus the users when we resume
// observation if any changes have happened while we weren't observing.
@ -4683,7 +4660,7 @@ typedef enum : NSUInteger {
} else {
self.viewHorizonTimestamp = nil;
}
OWSLogVerbose(@"%@ paused observation of database modifications.", self.logTag);
OWSLogVerbose(@"paused observation of database modifications.");
}
}
@ -4720,10 +4697,10 @@ typedef enum : NSUInteger {
OWSAssert(left == right);
ConversationViewItem *viewItem = self.viewItems[left];
if (viewItem.interaction.timestamp >= viewHorizonTimestamp) {
OWSLogInfo(@"%@ firstIndexPathAtViewHorizonTimestamp: %zd / %zd", self.logTag, left, self.viewItems.count);
OWSLogInfo(@"firstIndexPathAtViewHorizonTimestamp: %zd / %zd", left, self.viewItems.count);
return [NSIndexPath indexPathForRow:(NSInteger) left inSection:0];
} else {
OWSLogInfo(@"%@ firstIndexPathAtViewHorizonTimestamp: none / %zd", self.logTag, self.viewItems.count);
OWSLogInfo(@"firstIndexPathAtViewHorizonTimestamp: none / %zd", self.viewItems.count);
return nil;
}
}
@ -4768,7 +4745,7 @@ typedef enum : NSUInteger {
addedItemCount++;
}];
}];
OWSLogInfo(@"%@ extendRangeToIncludeUnobservedItems: %zd", self.logTag, addedItemCount);
OWSLogInfo(@"extendRangeToIncludeUnobservedItems: %zd", addedItemCount);
self.lastRangeLength += addedItemCount;
// We only want to do this once, so clear the "previous last timestamp".
self.previousLastTimestamp = nil;
@ -4901,7 +4878,7 @@ typedef enum : NSUInteger {
// Flag to ensure that we only increment once per launch.
static BOOL hasIncrementedDatabaseView = NO;
if (hasError && !hasIncrementedDatabaseView) {
OWSLogWarn(@"%@ incrementing version of: %@", self.logTag, TSMessageDatabaseViewExtensionName);
OWSLogWarn(@"incrementing version of: %@", TSMessageDatabaseViewExtensionName);
[OWSPrimaryStorage incrementVersionOfDatabaseExtension:TSMessageDatabaseViewExtensionName];
hasIncrementedDatabaseView = YES;
}
@ -4982,7 +4959,7 @@ typedef enum : NSUInteger {
if (unreadIndicator) {
// This isn't necessarily a bug - all of the interactions after the
// unread indicator may have disappeared or been deleted.
OWSLogWarn(@"%@ Couldn't find an interaction to hang the unread indicator on.", self.logTag);
OWSLogWarn(@"Couldn't find an interaction to hang the unread indicator on.");
}
// Update the properties of the view items.
@ -5154,7 +5131,7 @@ typedef enum : NSUInteger {
TSInteraction *_Nullable interaction =
[TSInteraction fetchObjectWithUniqueID:viewItem.interaction.uniqueId transaction:transaction];
if (!interaction) {
OWSFailDebug(@"%@ could not reload interaction", self.logTag);
OWSFailDebug(@"could not reload interaction");
} else {
[viewItem replaceInteraction:interaction transaction:transaction];
}
@ -5183,7 +5160,7 @@ typedef enum : NSUInteger {
ConversationViewItem *_Nullable viewItem = [self viewItemForIndex:indexPath.row];
ConversationViewCell *cell = [viewItem dequeueCellForCollectionView:self.collectionView indexPath:indexPath];
if (!cell) {
OWSFailDebug(@"%@ Could not dequeue cell.", self.logTag);
OWSFailDebug(@"Could not dequeue cell.");
return cell;
}
cell.viewItem = viewItem;
@ -5241,7 +5218,7 @@ typedef enum : NSUInteger {
CNContact *_Nullable cnContact = [self.contactsManager cnContactWithId:contact.cnContactId];
if (!cnContact) {
OWSFailDebug(@"%@ Could not load system contact.", self.logTag);
OWSFailDebug(@"Could not load system contact.");
return;
}
@ -5249,7 +5226,7 @@ typedef enum : NSUInteger {
OWSContact *_Nullable contactShareRecord = [OWSContacts contactForSystemContact:cnContact];
if (!contactShareRecord) {
OWSFailDebug(@"%@ Could not convert system contact.", self.logTag);
OWSFailDebug(@"Could not convert system contact.");
return;
}

View File

@ -250,7 +250,7 @@ NSString *NSStringForOWSMessageCellType(OWSMessageCellType cellType)
if (!measurementCell) {
switch (self.interaction.interactionType) {
case OWSInteractionType_Unknown:
OWSFailDebug(@"%@ Unknown interaction type.", self.logTag);
OWSFailDebug(@"Unknown interaction type.");
return nil;
case OWSInteractionType_IncomingMessage:
case OWSInteractionType_OutgoingMessage:
@ -307,7 +307,7 @@ NSString *NSStringForOWSMessageCellType(OWSMessageCellType cellType)
switch (self.interaction.interactionType) {
case OWSInteractionType_Unknown:
OWSFailDebug(@"%@ Unknown interaction type.", self.logTag);
OWSFailDebug(@"Unknown interaction type.");
return nil;
case OWSInteractionType_IncomingMessage:
case OWSInteractionType_OutgoingMessage:
@ -452,7 +452,7 @@ NSString *NSStringForOWSMessageCellType(OWSMessageCellType cellType)
case OWSInteractionType_OutgoingMessage:
break;
default:
OWSFailDebug(@"%@ Unknown interaction type.", self.logTag);
OWSFailDebug(@"Unknown interaction type.");
return;
}
@ -486,7 +486,7 @@ NSString *NSStringForOWSMessageCellType(OWSMessageCellType cellType)
} else if ([self.attachmentStream isVideo]) {
self.messageCellType = OWSMessageCellType_Video;
} else {
OWSFailDebug(@"%@ unexpected attachment type.", self.logTag);
OWSFailDebug(@"unexpected attachment type.");
self.messageCellType = OWSMessageCellType_GenericAttachment;
return;
}
@ -509,14 +509,14 @@ NSString *NSStringForOWSMessageCellType(OWSMessageCellType cellType)
self.messageCellType = OWSMessageCellType_DownloadingAttachment;
self.attachmentPointer = (TSAttachmentPointer *)attachment;
} else {
OWSFailDebug(@"%@ Unknown attachment type", self.logTag);
OWSFailDebug(@"Unknown attachment type");
}
}
// Ignore message body for oversize text attachments.
if (message.body.length > 0) {
if (self.hasBodyText) {
OWSFailDebug(@"%@ oversize text message has unexpected caption.", self.logTag);
OWSFailDebug(@"oversize text message has unexpected caption.");
}
// If we haven't already assigned an attachment type at this point, message.body isn't a caption,
@ -532,10 +532,7 @@ NSString *NSStringForOWSMessageCellType(OWSMessageCellType cellType)
if (self.messageCellType == OWSMessageCellType_Unknown) {
// Messages of unknown type (including messages with missing attachments)
// are rendered like empty text messages, but without any interactivity.
OWSLogWarn(@"%@ Treating unknown message as empty text message: %@ %llu",
self.logTag,
message.class,
message.timestamp);
OWSLogWarn(@"Treating unknown message as empty text message: %@ %llu", message.class, message.timestamp);
self.messageCellType = OWSMessageCellType_TextMessage;
self.displayableBodyText = [[DisplayableText alloc] initWithFullText:@"" displayText:@"" isTextTruncated:NO];
}
@ -597,7 +594,7 @@ NSString *NSStringForOWSMessageCellType(OWSMessageCellType cellType)
return [call previewTextWithTransaction:transaction];
}
default:
OWSFailDebug(@"%@ not a system message.", self.logTag);
OWSFailDebug(@"not a system message.");
return nil;
}
}
@ -682,16 +679,16 @@ NSString *NSStringForOWSMessageCellType(OWSMessageCellType cellType)
break;
}
case OWSMessageCellType_DownloadingAttachment: {
OWSFailDebug(@"%@ Can't copy not-yet-downloaded attachment", self.logTag);
OWSFailDebug(@"Can't copy not-yet-downloaded attachment");
break;
}
case OWSMessageCellType_Unknown: {
OWSFailDebug(@"%@ No text to copy", self.logTag);
OWSFailDebug(@"No text to copy");
break;
}
case OWSMessageCellType_ContactShare: {
// TODO: Implement copy contact.
OWSFailDebug(@"%@ Not implemented yet", self.logTag);
OWSFailDebug(@"Not implemented yet");
break;
}
}
@ -704,7 +701,7 @@ NSString *NSStringForOWSMessageCellType(OWSMessageCellType cellType)
case OWSMessageCellType_TextMessage:
case OWSMessageCellType_OversizeTextMessage:
case OWSMessageCellType_ContactShare: {
OWSFailDebug(@"%@ No media to copy", self.logTag);
OWSFailDebug(@"No media to copy");
break;
}
case OWSMessageCellType_StillImage:
@ -714,19 +711,19 @@ NSString *NSStringForOWSMessageCellType(OWSMessageCellType cellType)
case OWSMessageCellType_GenericAttachment: {
NSString *utiType = [MIMETypeUtil utiTypeForMIMEType:self.attachmentStream.contentType];
if (!utiType) {
OWSFailDebug(@"%@ Unknown MIME type: %@", self.logTag, self.attachmentStream.contentType);
OWSFailDebug(@"Unknown MIME type: %@", self.attachmentStream.contentType);
utiType = (NSString *)kUTTypeGIF;
}
NSData *data = [NSData dataWithContentsOfURL:[self.attachmentStream mediaURL]];
if (!data) {
OWSFailDebug(@"%@ Could not load attachment data", self.logTag);
OWSFailDebug(@"Could not load attachment data");
return;
}
[UIPasteboard.generalPasteboard setData:data forPasteboardType:utiType];
break;
}
case OWSMessageCellType_DownloadingAttachment: {
OWSFailDebug(@"%@ Can't copy not-yet-downloaded attachment", self.logTag);
OWSFailDebug(@"Can't copy not-yet-downloaded attachment");
break;
}
}
@ -747,15 +744,15 @@ NSString *NSStringForOWSMessageCellType(OWSMessageCellType cellType)
break;
}
case OWSMessageCellType_DownloadingAttachment: {
OWSFailDebug(@"%@ Can't share not-yet-downloaded attachment", self.logTag);
OWSFailDebug(@"Can't share not-yet-downloaded attachment");
break;
}
case OWSMessageCellType_Unknown: {
OWSFailDebug(@"%@ No text to share", self.logTag);
OWSFailDebug(@"No text to share");
break;
}
case OWSMessageCellType_ContactShare: {
OWSFailDebug(@"%@ share contact not implemented.", self.logTag);
OWSFailDebug(@"share contact not implemented.");
break;
}
}
@ -778,7 +775,7 @@ NSString *NSStringForOWSMessageCellType(OWSMessageCellType cellType)
[AttachmentSharing showShareUIForAttachment:self.attachmentStream];
break;
case OWSMessageCellType_DownloadingAttachment: {
OWSFailDebug(@"%@ Can't share not-yet-downloaded attachment", self.logTag);
OWSFailDebug(@"Can't share not-yet-downloaded attachment");
break;
}
}
@ -814,13 +811,13 @@ NSString *NSStringForOWSMessageCellType(OWSMessageCellType cellType)
case OWSMessageCellType_TextMessage:
case OWSMessageCellType_OversizeTextMessage:
case OWSMessageCellType_ContactShare:
OWSFailDebug(@"%@ Cannot save text data.", self.logTag);
OWSFailDebug(@"Cannot save text data.");
break;
case OWSMessageCellType_StillImage:
case OWSMessageCellType_AnimatedImage: {
NSData *data = [NSData dataWithContentsOfURL:[self.attachmentStream mediaURL]];
if (!data) {
OWSFailDebug(@"%@ Could not load image data", self.logTag);
OWSFailDebug(@"Could not load image data");
return;
}
ALAssetsLibrary *library = [[ALAssetsLibrary alloc] init];
@ -834,20 +831,20 @@ NSString *NSStringForOWSMessageCellType(OWSMessageCellType cellType)
break;
}
case OWSMessageCellType_Audio:
OWSFailDebug(@"%@ Cannot save media data.", self.logTag);
OWSFailDebug(@"Cannot save media data.");
break;
case OWSMessageCellType_Video:
if (UIVideoAtPathIsCompatibleWithSavedPhotosAlbum(self.attachmentStream.mediaURL.path)) {
UISaveVideoAtPathToSavedPhotosAlbum(self.attachmentStream.mediaURL.path, self, nil, nil);
} else {
OWSFailDebug(@"%@ Could not save incompatible video data.", self.logTag);
OWSFailDebug(@"Could not save incompatible video data.");
}
break;
case OWSMessageCellType_GenericAttachment:
OWSFailDebug(@"%@ Cannot save media data.", self.logTag);
OWSFailDebug(@"Cannot save media data.");
break;
case OWSMessageCellType_DownloadingAttachment: {
OWSFailDebug(@"%@ Can't save not-yet-downloaded attachment", self.logTag);
OWSFailDebug(@"Can't save not-yet-downloaded attachment");
break;
}
}

View File

@ -74,7 +74,7 @@ NS_ASSUME_NONNULL_BEGIN
id<ConversationViewLayoutDelegate> delegate = self.delegate;
if (!delegate) {
OWSFailDebug(@"%@ Missing delegate", self.logTag);
OWSFailDebug(@"Missing delegate");
[self clearState];
return;
}
@ -92,7 +92,7 @@ NS_ASSUME_NONNULL_BEGIN
self.hasLayout = YES;
// TODO: Remove this log statement after we've reduced the invalidation churn.
OWSLogVerbose(@"%@ prepareLayout", self.logTag);
OWSLogVerbose(@"prepareLayout");
[self prepareLayoutOfItems];
}

View File

@ -58,7 +58,7 @@ NS_ASSUME_NONNULL_BEGIN
+ (void)backupTestFile
{
OWSLogInfo(@"%@ backupTestFile.", self.logTag);
OWSLogInfo(@"backupTestFile.");
NSData *_Nullable data = [Randomness generateRandomBytes:32];
OWSAssert(data);
@ -81,11 +81,11 @@ NS_ASSUME_NONNULL_BEGIN
+ (void)checkForBackup
{
OWSLogInfo(@"%@ checkForBackup.", self.logTag);
OWSLogInfo(@"checkForBackup.");
[OWSBackup.sharedManager
checkCanImportBackup:^(BOOL value) {
OWSLogInfo(@"%@ has backup available for import? %d", self.logTag, value);
OWSLogInfo(@"has backup available for import? %d", value);
}
failure:^(NSError *error){
// Do nothing.
@ -94,14 +94,14 @@ NS_ASSUME_NONNULL_BEGIN
+ (void)logBackupRecords
{
OWSLogInfo(@"%@ logBackupRecords.", self.logTag);
OWSLogInfo(@"logBackupRecords.");
[OWSBackup.sharedManager logBackupRecords];
}
+ (void)tryToImportBackup
{
OWSLogInfo(@"%@ tryToImportBackup.", self.logTag);
OWSLogInfo(@"tryToImportBackup.");
UIAlertController *controller =
[UIAlertController alertControllerWithTitle:@"Restore CloudKit Backup"
@ -120,7 +120,7 @@ NS_ASSUME_NONNULL_BEGIN
+ (void)logDatabaseSizeStats
{
OWSLogInfo(@"%@ logDatabaseSizeStats.", self.logTag);
OWSLogInfo(@"logDatabaseSizeStats.");
__block unsigned long long interactionCount = 0;
__block unsigned long long interactionSizeTotal = 0;
@ -147,13 +147,13 @@ NS_ASSUME_NONNULL_BEGIN
}];
}];
OWSLogInfo(@"%@ interactionCount: %llu", self.logTag, interactionCount);
OWSLogInfo(@"%@ interactionSizeTotal: %llu", self.logTag, interactionSizeTotal);
OWSLogInfo(@"interactionCount: %llu", interactionCount);
OWSLogInfo(@"interactionSizeTotal: %llu", interactionSizeTotal);
if (interactionCount > 0) {
OWSLogInfo(@"%@ interaction average size: %f", self.logTag, interactionSizeTotal / (double)interactionCount);
}
OWSLogInfo(@"%@ attachmentCount: %llu", self.logTag, attachmentCount);
OWSLogInfo(@"%@ attachmentSizeTotal: %llu", self.logTag, attachmentSizeTotal);
OWSLogInfo(@"attachmentCount: %llu", attachmentCount);
OWSLogInfo(@"attachmentSizeTotal: %llu", attachmentSizeTotal);
if (attachmentCount > 0) {
OWSLogInfo(@"%@ attachment average size: %f", self.logTag, attachmentSizeTotal / (double)attachmentCount);
}
@ -161,14 +161,14 @@ NS_ASSUME_NONNULL_BEGIN
+ (void)clearAllCloudKitRecords
{
OWSLogInfo(@"%@ clearAllCloudKitRecords.", self.logTag);
OWSLogInfo(@"clearAllCloudKitRecords.");
[OWSBackup.sharedManager clearAllCloudKitRecords];
}
+ (void)clearBackupMetadataCache
{
OWSLogInfo(@"%@ ClearBackupMetadataCache.", self.logTag);
OWSLogInfo(@"ClearBackupMetadataCache.");
[OWSPrimaryStorage.sharedManager.newDatabaseConnection
readWriteWithBlock:^(YapDatabaseReadWriteTransaction *transaction) {

View File

@ -1300,13 +1300,13 @@ NS_ASSUME_NONNULL_BEGIN
+ (void)clearSignalAccountCache
{
OWSLogWarn(@"%@ Deleting all signal accounts.", self.logTag);
OWSLogWarn(@"Deleting all signal accounts.");
[SignalAccount removeAllObjectsInCollection];
}
+ (void)clearSignalRecipientCache
{
OWSLogWarn(@"%@ Deleting all signal recipients.", self.logTag);
OWSLogWarn(@"Deleting all signal recipients.");
[SignalRecipient removeAllObjectsInCollection];
}

View File

@ -232,17 +232,16 @@ NS_ASSUME_NONNULL_BEGIN
[OWSTableItem
itemWithTitle:@"Request Bogus group info"
actionBlock:^{
OWSLogInfo(@"%@ Requesting bogus group info for thread: %@", self.logTag, thread);
OWSLogInfo(@"Requesting bogus group info for thread: %@", thread);
OWSSyncGroupsRequestMessage *syncGroupsRequestMessage =
[[OWSSyncGroupsRequestMessage alloc] initWithThread:thread
groupId:[Randomness generateRandomBytes:16]];
[[Environment current].messageSender enqueueMessage:syncGroupsRequestMessage
success:^{
OWSLogWarn(@"%@ Successfully sent Request Group Info message.", self.logTag);
OWSLogWarn(@"Successfully sent Request Group Info message.");
}
failure:^(NSError *error) {
OWSLogError(
@"%@ Failed to send Request Group Info message with error: %@", self.logTag, error);
OWSLogError(@"Failed to send Request Group Info message with error: %@", error);
}];
}],
[OWSTableItem itemWithTitle:@"Message with stalled timer"
@ -311,7 +310,7 @@ NS_ASSUME_NONNULL_BEGIN
+ (void)sendTextMessageInThread:(TSThread *)thread counter:(NSUInteger)counter
{
OWSLogInfo(@"%@ sendTextMessageInThread: %zd", self.logTag, counter);
OWSLogInfo(@"sendTextMessageInThread: %zd", counter);
[DDLog flushLog];
NSString *randomText = [self randomText];
@ -319,7 +318,7 @@ NS_ASSUME_NONNULL_BEGIN
OWSMessageSender *messageSender = [Environment current].messageSender;
TSOutgoingMessage *message =
[ThreadUtil sendMessageWithText:text inThread:thread quotedReplyModel:nil messageSender:messageSender];
OWSLogError(@"%@ sendTextMessageInThread timestamp: %llu.", self.logTag, message.timestamp);
OWSLogError(@"sendTextMessageInThread timestamp: %llu.", message.timestamp);
}
+ (void)sendNTextMessagesInThread:(TSThread *)thread
@ -1989,7 +1988,7 @@ NS_ASSUME_NONNULL_BEGIN
quotedMessage:nil
transaction:transaction];
OWSAssert(messageToQuote);
OWSLogVerbose(@"%@ %@", self.logTag, label);
OWSLogVerbose(@"%@", label);
[DDLog flushLog];
ConversationViewItem *viewItem = [[ConversationViewItem alloc] initWithInteraction:messageToQuote
isGroupThread:thread.isGroupThread
@ -3139,7 +3138,7 @@ typedef OWSContact * (^OWSContactBlock)(YapDatabaseReadWriteTransaction *transac
ActionSuccessBlock success,
ActionFailureBlock failure) {
OWSContact *contact = contactBlock(transaction);
OWSLogVerbose(@"%@ sending contact: %@", self.logTag, contact.debugDescription);
OWSLogVerbose(@"sending contact: %@", contact.debugDescription);
OWSMessageSender *messageSender = [Environment current].messageSender;
[ThreadUtil sendMessageWithContactShare:contact inThread:thread messageSender:messageSender completion:nil];
@ -3396,7 +3395,7 @@ typedef OWSContact * (^OWSContactBlock)(YapDatabaseReadWriteTransaction *transac
TSContactThread *contactThread = (TSContactThread *)thread;
return contactThread.contactIdentifier;
} else {
OWSFailDebug(@"%@ failure: unknown thread type", self.logTag);
OWSFailDebug(@"failure: unknown thread type");
return @"unknown-source-id";
}
}();
@ -3409,7 +3408,7 @@ typedef OWSContact * (^OWSContactBlock)(YapDatabaseReadWriteTransaction *transac
NSError *error;
SSKProtoEnvelope *_Nullable envelope = [envelopeBuilder buildAndReturnError:&error];
if (error || !envelope) {
OWSFailDebug(@"%@ Could not construct envelope: %@.", self.logTag, error);
OWSFailDebug(@"Could not construct envelope: %@.", error);
return nil;
}
return envelope;
@ -3932,7 +3931,7 @@ typedef OWSContact * (^OWSContactBlock)(YapDatabaseReadWriteTransaction *transac
NSError *error;
NSData *_Nullable envelopeData = [envelopeBuilder buildSerializedDataAndReturnError:&error];
if (error || !envelopeData) {
OWSFailDebug(@"%@ Could not serialize envelope: %@.", self.logTag, error);
OWSFailDebug(@"Could not serialize envelope: %@.", error);
return;
}
@ -4013,7 +4012,7 @@ typedef OWSContact * (^OWSContactBlock)(YapDatabaseReadWriteTransaction *transac
thread:(TSThread *)thread
transaction:(YapDatabaseReadWriteTransaction *)transaction
{
OWSLogInfo(@"%@ deleteRandomMessages: %zd", self.logTag, count);
OWSLogInfo(@"deleteRandomMessages: %zd", count);
YapDatabaseViewTransaction *interactionsByThread = [transaction ext:TSMessageDatabaseViewExtensionName];
NSUInteger messageCount = [interactionsByThread numberOfItemsInGroup:thread.uniqueId];
@ -4043,7 +4042,7 @@ typedef OWSContact * (^OWSContactBlock)(YapDatabaseReadWriteTransaction *transac
thread:(TSThread *)thread
transaction:(YapDatabaseReadWriteTransaction *)transaction
{
OWSLogInfo(@"%@ deleteLastMessages", self.logTag);
OWSLogInfo(@"deleteLastMessages");
YapDatabaseViewTransaction *interactionsByThread = [transaction ext:TSMessageDatabaseViewExtensionName];
NSUInteger messageCount = (NSUInteger)[interactionsByThread numberOfItemsInGroup:thread.uniqueId];
@ -4069,7 +4068,7 @@ typedef OWSContact * (^OWSContactBlock)(YapDatabaseReadWriteTransaction *transac
thread:(TSThread *)thread
transaction:(YapDatabaseReadWriteTransaction *)transaction
{
OWSLogInfo(@"%@ deleteRandomRecentMessages: %zd", self.logTag, count);
OWSLogInfo(@"deleteRandomRecentMessages: %zd", count);
YapDatabaseViewTransaction *interactionsByThread = [transaction ext:TSMessageDatabaseViewExtensionName];
NSInteger messageCount = (NSInteger)[interactionsByThread numberOfItemsInGroup:thread.uniqueId];
@ -4102,7 +4101,7 @@ typedef OWSContact * (^OWSContactBlock)(YapDatabaseReadWriteTransaction *transac
thread:(TSThread *)thread
transaction:(YapDatabaseReadWriteTransaction *)transaction
{
OWSLogInfo(@"%@ insertAndDeleteNewOutgoingMessages: %zd", self.logTag, count);
OWSLogInfo(@"insertAndDeleteNewOutgoingMessages: %zd", count);
NSMutableArray<TSOutgoingMessage *> *messages = [NSMutableArray new];
for (NSUInteger i =0; i < count; i++) {
@ -4115,7 +4114,7 @@ typedef OWSContact * (^OWSContactBlock)(YapDatabaseReadWriteTransaction *transac
messageBody:text
attachmentId:nil
expiresInSeconds:expiresInSeconds];
OWSLogError(@"%@ insertAndDeleteNewOutgoingMessages timestamp: %llu.", self.logTag, message.timestamp);
OWSLogError(@"insertAndDeleteNewOutgoingMessages timestamp: %llu.", message.timestamp);
[messages addObject:message];
}
@ -4131,7 +4130,7 @@ typedef OWSContact * (^OWSContactBlock)(YapDatabaseReadWriteTransaction *transac
thread:(TSThread *)thread
transaction:(YapDatabaseReadWriteTransaction *)initialTransaction
{
OWSLogInfo(@"%@ resurrectNewOutgoingMessages1.1: %zd", self.logTag, count);
OWSLogInfo(@"resurrectNewOutgoingMessages1.1: %zd", count);
NSMutableArray<TSOutgoingMessage *> *messages = [NSMutableArray new];
for (NSUInteger i =0; i < count; i++) {
@ -4145,7 +4144,7 @@ typedef OWSContact * (^OWSContactBlock)(YapDatabaseReadWriteTransaction *transac
messageBody:text
attachmentId:nil
expiresInSeconds:expiresInSeconds];
OWSLogError(@"%@ resurrectNewOutgoingMessages1 timestamp: %llu.", self.logTag, message.timestamp);
OWSLogError(@"resurrectNewOutgoingMessages1 timestamp: %llu.", message.timestamp);
[messages addObject:message];
}
@ -4154,7 +4153,7 @@ typedef OWSContact * (^OWSContactBlock)(YapDatabaseReadWriteTransaction *transac
}
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1.f * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
OWSLogInfo(@"%@ resurrectNewOutgoingMessages1.2: %zd", self.logTag, count);
OWSLogInfo(@"resurrectNewOutgoingMessages1.2: %zd", count);
[OWSPrimaryStorage.dbReadWriteConnection readWriteWithBlock:^(YapDatabaseReadWriteTransaction *transaction) {
for (TSOutgoingMessage *message in messages) {
[message removeWithTransaction:transaction];
@ -4170,7 +4169,7 @@ typedef OWSContact * (^OWSContactBlock)(YapDatabaseReadWriteTransaction *transac
thread:(TSThread *)thread
transaction:(YapDatabaseReadWriteTransaction *)initialTransaction
{
OWSLogInfo(@"%@ resurrectNewOutgoingMessages2.1: %zd", self.logTag, count);
OWSLogInfo(@"resurrectNewOutgoingMessages2.1: %zd", count);
NSMutableArray<TSOutgoingMessage *> *messages = [NSMutableArray new];
for (NSUInteger i =0; i < count; i++) {
@ -4189,7 +4188,7 @@ typedef OWSContact * (^OWSContactBlock)(YapDatabaseReadWriteTransaction *transac
groupMetaMessage:TSGroupMessageUnspecified
quotedMessage:nil
contactShare:nil];
OWSLogError(@"%@ resurrectNewOutgoingMessages2 timestamp: %llu.", self.logTag, message.timestamp);
OWSLogError(@"resurrectNewOutgoingMessages2 timestamp: %llu.", message.timestamp);
[messages addObject:message];
}
@ -4199,14 +4198,14 @@ typedef OWSContact * (^OWSContactBlock)(YapDatabaseReadWriteTransaction *transac
}
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1.f * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
OWSLogInfo(@"%@ resurrectNewOutgoingMessages2.2: %zd", self.logTag, count);
OWSLogInfo(@"resurrectNewOutgoingMessages2.2: %zd", count);
[OWSPrimaryStorage.dbReadWriteConnection readWriteWithBlock:^(YapDatabaseReadWriteTransaction *transaction) {
for (TSOutgoingMessage *message in messages) {
[message removeWithTransaction:transaction];
}
}];
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1.f * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
OWSLogInfo(@"%@ resurrectNewOutgoingMessages2.3: %zd", self.logTag, count);
OWSLogInfo(@"resurrectNewOutgoingMessages2.3: %zd", count);
[OWSPrimaryStorage.dbReadWriteConnection
readWriteWithBlock:^(YapDatabaseReadWriteTransaction *transaction) {
for (TSOutgoingMessage *message in messages) {
@ -4312,7 +4311,7 @@ typedef OWSContact * (^OWSContactBlock)(YapDatabaseReadWriteTransaction *transac
readWriteWithBlock:^(YapDatabaseReadWriteTransaction *transaction) {
for (NSString *string in strings) {
// DO NOT log these strings with the debugger attached.
// OWSLogInfo(@"%@ %@", self.logTag, string);
// OWSLogInfo(@"%@", string);
{
[self createFakeIncomingMessage:thread
@ -4351,7 +4350,7 @@ typedef OWSContact * (^OWSContactBlock)(YapDatabaseReadWriteTransaction *transac
[OWSPrimaryStorage.sharedManager.dbReadWriteConnection
readWriteWithBlock:^(YapDatabaseReadWriteTransaction *transaction) {
for (NSString *string in strings) {
OWSLogInfo(@"%@ sending zalgo", self.logTag);
OWSLogInfo(@"sending zalgo");
{
[self createFakeIncomingMessage:thread
@ -4454,7 +4453,7 @@ typedef OWSContact * (^OWSContactBlock)(YapDatabaseReadWriteTransaction *transac
[label appendString:@" (Sent)"];
}
} else {
OWSFailDebug(@"%@ unknown message state.", self.logTag);
OWSFailDebug(@"unknown message state.");
}
return label;
}

View File

@ -46,7 +46,7 @@ NS_ASSUME_NONNULL_BEGIN
- (void)prepareAndPerformNTimes:(NSUInteger)count
{
OWSLogInfo(@"%@ %@ prepareAndPerformNTimes: %zd", self.logTag, self.label, count);
OWSLogInfo(@"%@ prepareAndPerformNTimes: %zd", self.label, count);
[DDLog flushLog];
[self prepare:^{
@ -65,7 +65,7 @@ NS_ASSUME_NONNULL_BEGIN
OWSAssert(success);
OWSAssert(failure);
OWSLogInfo(@"%@ %@ performNTimes: %zd", self.logTag, self.label, countParam);
OWSLogInfo(@"%@ performNTimes: %zd", self.label, countParam);
[DDLog flushLog];
if (countParam < 1) {
@ -90,7 +90,7 @@ NS_ASSUME_NONNULL_BEGIN
^{
dispatch_after(
dispatch_time(DISPATCH_TIME_NOW, (int64_t)1.f * NSEC_PER_SEC), dispatch_get_main_queue(), ^{
OWSLogInfo(@"%@ %@ performNTimes success: %zd", self.logTag, self.label, count);
OWSLogInfo(@"%@ performNTimes success: %zd", self.label, count);
[self performNTimes:count - 1 success:success failure:failure];
});
},
@ -108,7 +108,7 @@ NS_ASSUME_NONNULL_BEGIN
if (batchSize >= kMaxBatchSize) {
dispatch_after(
dispatch_time(DISPATCH_TIME_NOW, (int64_t)1.f * NSEC_PER_SEC), dispatch_get_main_queue(), ^{
OWSLogInfo(@"%@ %@ performNTimes success: %zd", self.logTag, self.label, count);
OWSLogInfo(@"%@ performNTimes success: %zd", self.label, count);
[self performNTimes:count - 1 success:success failure:failure];
});
@ -248,7 +248,7 @@ NS_ASSUME_NONNULL_BEGIN
DebugUIMessagesAction *nextAction = unpreparedSubactions.lastObject;
[unpreparedSubactions removeLastObject];
OWSLogInfo(@"%@ preparing: %@", self.logTag, nextAction.label);
OWSLogInfo(@"preparing: %@", nextAction.label);
[DDLog flushLog];
[nextAction prepare:^{
[self prepareSubactions:unpreparedSubactions success:success failure:failure];

View File

@ -142,10 +142,10 @@ NS_ASSUME_NONNULL_BEGIN
+ (void)reregister
{
OWSLogInfo(@"%@ re-registering.", self.logTag);
OWSLogInfo(@"re-registering.");
if (![[TSAccountManager sharedInstance] resetForReregistration]) {
OWSFailDebug(@"%@ could not reset for re-registration.", self.logTag);
OWSFailDebug(@"could not reset for re-registration.");
return;
}
@ -221,7 +221,7 @@ NS_ASSUME_NONNULL_BEGIN
toPath:filePath
error:&error];
if (!success || error) {
OWSFailDebug(@"%@ Could not copy database file: %@.", self.logTag, error);
OWSFailDebug(@"Could not copy database file: %@.", error);
success = NO;
}
}];
@ -238,7 +238,7 @@ NS_ASSUME_NONNULL_BEGIN
NSData *databasePassword = [OWSPrimaryStorage.sharedManager databasePassword];
attachment.captionText = [databasePassword hexadecimalString];
if (!attachment || [attachment hasError]) {
OWSFailDebug(@"%@ attachment[%@]: %@", self.logTag, [attachment sourceFilename], [attachment errorName]);
OWSFailDebug(@"attachment[%@]: %@", [attachment sourceFilename], [attachment errorName]);
return;
}
[ThreadUtil sendMessageWithAttachment:attachment
@ -255,7 +255,7 @@ NS_ASSUME_NONNULL_BEGIN
NSError *error = [OWSPrimaryStorage.sharedManager.newDatabaseConnection backupToPath:filePath];
if (error) {
OWSFailDebug(@"%@ Could not copy database file: %@.", self.logTag, error);
OWSFailDebug(@"Could not copy database file: %@.", error);
return;
}
@ -265,7 +265,7 @@ NS_ASSUME_NONNULL_BEGIN
[dataSource setSourceFilename:fileName];
SignalAttachment *attachment = [SignalAttachment attachmentWithDataSource:dataSource dataUTI:utiType];
if (!attachment || [attachment hasError]) {
OWSFailDebug(@"%@ attachment[%@]: %@", self.logTag, [attachment sourceFilename], [attachment errorName]);
OWSFailDebug(@"attachment[%@]: %@", [attachment sourceFilename], [attachment errorName]);
return;
}
[ThreadUtil sendMessageWithAttachment:attachment

View File

@ -466,10 +466,10 @@ NS_ASSUME_NONNULL_BEGIN
OWSMessageSender *messageSender = [Environment current].messageSender;
[messageSender enqueueMessage:message
success:^{
OWSLogInfo(@"%@ Successfully sent message.", self.logTag);
OWSLogInfo(@"Successfully sent message.");
}
failure:^(NSError *error) {
OWSLogWarn(@"%@ Failed to deliver message with error: %@", self.logTag, error);
OWSLogWarn(@"Failed to deliver message with error: %@", error);
}];
}

View File

@ -109,10 +109,10 @@ NS_ASSUME_NONNULL_BEGIN
contentType:OWSMimeTypeApplicationOctetStream
inMessage:syncContactsMessage
success:^{
OWSLogInfo(@"%@ Successfully sent Contacts response syncMessage.", self.logTag);
OWSLogInfo(@"Successfully sent Contacts response syncMessage.");
}
failure:^(NSError *error) {
OWSLogError(@"%@ Failed to send Contacts response syncMessage with error: %@", self.logTag, error);
OWSLogError(@"Failed to send Contacts response syncMessage with error: %@", error);
}];
}
@ -128,10 +128,10 @@ NS_ASSUME_NONNULL_BEGIN
contentType:OWSMimeTypeApplicationOctetStream
inMessage:syncGroupsMessage
success:^{
OWSLogInfo(@"%@ Successfully sent Groups response syncMessage.", self.logTag);
OWSLogInfo(@"Successfully sent Groups response syncMessage.");
}
failure:^(NSError *error) {
OWSLogError(@"%@ Failed to send Groups response syncMessage with error: %@", self.logTag, error);
OWSLogError(@"Failed to send Groups response syncMessage with error: %@", error);
}];
}
@ -152,10 +152,10 @@ NS_ASSUME_NONNULL_BEGIN
[[OWSSyncConfigurationMessage alloc] initWithReadReceiptsEnabled:areReadReceiptsEnabled];
[self.messageSender enqueueMessage:syncConfigurationMessage
success:^{
OWSLogInfo(@"%@ Successfully sent Configuration response syncMessage.", self.logTag);
OWSLogInfo(@"Successfully sent Configuration response syncMessage.");
}
failure:^(NSError *error) {
OWSLogError(@"%@ Failed to send Configuration response syncMessage with error: %@", self.logTag, error);
OWSLogError(@"Failed to send Configuration response syncMessage with error: %@", error);
}];
}

View File

@ -324,14 +324,14 @@ NS_ASSUME_NONNULL_BEGIN
{
OWSContactsManager *contactsManager = self.contactsManager;
if (contactsManager == nil) {
OWSFailDebug(@"%@ contactsManager should not be nil", self.logTag);
OWSFailDebug(@"contactsManager should not be nil");
self.avatarView.image = nil;
return;
}
ThreadViewModel *thread = self.thread;
if (thread == nil) {
OWSFailDebug(@"%@ thread should not be nil", self.logTag);
OWSFailDebug(@"thread should not be nil");
self.avatarView.image = nil;
return;
}
@ -398,7 +398,7 @@ NS_ASSUME_NONNULL_BEGIN
- (NSString *)stringForDate:(nullable NSDate *)date
{
if (date == nil) {
OWSFailDebug(@"%@ date was unexpectedly nil", self.logTag);
OWSFailDebug(@"date was unexpectedly nil");
return @"";
}
@ -491,14 +491,14 @@ NS_ASSUME_NONNULL_BEGIN
ThreadViewModel *thread = self.thread;
if (thread == nil) {
OWSFailDebug(@"%@ thread should not be nil", self.logTag);
OWSFailDebug(@"thread should not be nil");
self.nameLabel.attributedText = nil;
return;
}
OWSContactsManager *contactsManager = self.contactsManager;
if (contactsManager == nil) {
OWSFailDebug(@"%@ contacts manager should not be nil", self.logTag);
OWSFailDebug(@"contacts manager should not be nil");
self.nameLabel.attributedText = nil;
return;
}

View File

@ -547,7 +547,7 @@ NSString *const kArchivedConversationsReuseIdentifier = @"kArchivedConversations
[self.contactsManager requestSystemContactsOnceWithCompletion:^(NSError *_Nullable error) {
if (error) {
OWSLogError(@"%@ Error when requesting contacts: %@", self.logTag, error);
OWSLogError(@"Error when requesting contacts: %@", error);
}
// Even if there is an error fetching contacts we proceed to the next screen.
// As the compose view will present the proper thing depending on contact access.
@ -899,9 +899,9 @@ NSString *const kArchivedConversationsReuseIdentifier = @"kArchivedConversations
- (void)pullToRefreshPerformed:(UIRefreshControl *)refreshControl
{
OWSAssertIsOnMainThread();
OWSLogInfo(@"%@ beggining refreshing.", self.logTag);
OWSLogInfo(@"beggining refreshing.");
[SignalApp.sharedApp.messageFetcherJob run].always(^{
OWSLogInfo(@"%@ ending refreshing.", self.logTag);
OWSLogInfo(@"ending refreshing.");
[refreshControl endRefreshing];
});
}
@ -1143,7 +1143,7 @@ NSString *const kArchivedConversationsReuseIdentifier = @"kArchivedConversations
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
OWSLogInfo(@"%@ %s %ld %ld", self.logTag, __PRETTY_FUNCTION__, (long)indexPath.row, (long)indexPath.section);
OWSLogInfo(@"%ld %ld", (long)indexPath.row, (long)indexPath.section);
[self.searchBar resignFirstResponder];
HomeViewControllerSection section = (HomeViewControllerSection)indexPath.section;

View File

@ -262,7 +262,7 @@ NS_ASSUME_NONNULL_BEGIN
{
NSFileManager *fileManager = [NSFileManager defaultManager];
if (![fileManager fileExistsAtPath:[self.attachmentUrl path]]) {
OWSFailDebug(@"%@ Missing video file", self.logTag);
OWSFailDebug(@"Missing video file");
}
OWSVideoPlayer *player = [[OWSVideoPlayer alloc] initWithUrl:self.attachmentUrl];
@ -308,7 +308,7 @@ NS_ASSUME_NONNULL_BEGIN
- (void)didDoubleTapImage:(UITapGestureRecognizer *)gesture
{
OWSLogVerbose(@"%@ did double tap image.", self.logTag);
OWSLogVerbose(@"did double tap image.");
if (self.scrollView.zoomScale == self.scrollView.minimumZoomScale) {
CGFloat kDoubleTapZoomScale = 2;
@ -333,7 +333,7 @@ NS_ASSUME_NONNULL_BEGIN
- (void)didPressShare:(id)sender
{
OWSLogInfo(@"%@: didPressShare", self.logTag);
OWSLogInfo(@"didPressShare");
if (!self.viewItem) {
OWSFailDebug(@"share should only be available when a viewItem is present");
return;
@ -344,7 +344,7 @@ NS_ASSUME_NONNULL_BEGIN
- (void)didPressDelete:(id)sender
{
OWSLogInfo(@"%@: didPressDelete", self.logTag);
OWSLogInfo(@"didPressDelete");
if (!self.viewItem) {
OWSFailDebug(@"delete should only be available when a viewItem is present");
return;
@ -491,9 +491,7 @@ NS_ASSUME_NONNULL_BEGIN
- (void)image:(UIImage *)image didFinishSavingWithError:(NSError *)error contextInfo:(void *)contextInfo
{
if (error) {
OWSLogWarn(@"There was a problem saving <%@> to camera roll from %s ",
error.localizedDescription,
__PRETTY_FUNCTION__);
OWSLogWarn(@"There was a problem saving <%@> to camera roll.", error.localizedDescription);
}
}

View File

@ -157,7 +157,7 @@ NS_ASSUME_NONNULL_BEGIN
[self.contactsViewHelper.contactsManager
userRequestedSystemContactsRefreshWithCompletion:^(NSError *_Nullable error) {
if (error) {
OWSLogError(@"%@ refreshing contacts failed with error: %@", self.logTag, error);
OWSLogError(@"refreshing contacts failed with error: %@", error);
}
[refreshControl endRefreshing];
}];

View File

@ -298,7 +298,7 @@ NS_ASSUME_NONNULL_BEGIN
{
switch (self.mode) {
case OWS2FASettingsMode_Status:
OWSFailDebug(@"%@ status mode should not have a next button.", self.logTag);
OWSFailDebug(@"status mode should not have a next button.");
return;
case OWS2FASettingsMode_SelectPIN: {
OWSAssert(self.hasValidPin);

View File

@ -292,7 +292,7 @@ NSString *const kKeychainKey_LastRegisteredPhoneNumber = @"kKeychainKey_LastRegi
// and phone number state.
NSString *_Nullable phoneNumberE164 = [TSAccountManager sharedInstance].reregisterationPhoneNumber;
if (!phoneNumberE164) {
OWSFailDebug(@"%@ Could not resume re-registration; missing phone number.", self.logTag);
OWSFailDebug(@"Could not resume re-registration; missing phone number.");
} else if ([self tryToApplyPhoneNumberE164:phoneNumberE164]) {
// Don't let user edit their phone number while re-registering.
self.phoneNumberTextField.enabled = NO;
@ -305,34 +305,34 @@ NSString *const kKeychainKey_LastRegisteredPhoneNumber = @"kKeychainKey_LastRegi
OWSAssert(phoneNumberE164);
if (phoneNumberE164.length < 1) {
OWSFailDebug(@"%@ Could not resume re-registration; invalid phoneNumberE164.", self.logTag);
OWSFailDebug(@"Could not resume re-registration; invalid phoneNumberE164.");
return NO;
}
PhoneNumber *_Nullable parsedPhoneNumber = [PhoneNumber phoneNumberFromE164:phoneNumberE164];
if (!parsedPhoneNumber) {
OWSFailDebug(@"%@ Could not resume re-registration; couldn't parse phoneNumberE164.", self.logTag);
OWSFailDebug(@"Could not resume re-registration; couldn't parse phoneNumberE164.");
return NO;
}
NSNumber *_Nullable callingCode = parsedPhoneNumber.getCountryCode;
if (!callingCode) {
OWSFailDebug(@"%@ Could not resume re-registration; missing callingCode.", self.logTag);
OWSFailDebug(@"Could not resume re-registration; missing callingCode.");
return NO;
}
NSString *callingCodeText = [NSString stringWithFormat:@"+%d", callingCode.intValue];
NSArray<NSString *> *_Nullable countryCodes =
[PhoneNumberUtil.sharedThreadLocal countryCodesFromCallingCode:callingCodeText];
if (countryCodes.count < 1) {
OWSFailDebug(@"%@ Could not resume re-registration; unknown countryCode.", self.logTag);
OWSFailDebug(@"Could not resume re-registration; unknown countryCode.");
return NO;
}
NSString *countryCode = countryCodes.firstObject;
NSString *_Nullable countryName = [PhoneNumberUtil countryNameFromCountryCode:countryCode];
if (!countryName) {
OWSFailDebug(@"%@ Could not resume re-registration; unknown countryName.", self.logTag);
OWSFailDebug(@"Could not resume re-registration; unknown countryName.");
return NO;
}
if (![phoneNumberE164 hasPrefix:callingCodeText]) {
OWSFailDebug(@"%@ Could not resume re-registration; non-matching calling code.", self.logTag);
OWSFailDebug(@"Could not resume re-registration; non-matching calling code.");
return NO;
}
NSString *phoneNumberWithoutCallingCode = [phoneNumberE164 substringFromIndex:callingCodeText.length];
@ -583,7 +583,7 @@ NSString *const kKeychainKey_LastRegisteredPhoneNumber = @"kKeychainKey_LastRegi
[SAMKeychain setAccessibilityType:kSecAttrAccessibleAfterFirstUnlockThisDeviceOnly];
BOOL success = [SAMKeychain setPassword:value forService:kKeychainService_LastRegistered account:key error:&error];
if (!success || error) {
OWSLogError(@"%@ Error persisting 'last registered' value in keychain: %@", self.logTag, error);
OWSLogError(@"Error persisting 'last registered' value in keychain: %@", error);
}
}

View File

@ -99,7 +99,7 @@ NS_ASSUME_NONNULL_BEGIN
__weak AddToGroupViewController *weakSelf = self;
ContactsViewHelper *helper = self.contactsViewHelper;
if ([self.addToGroupDelegate isRecipientGroupMember:signalAccount.recipientId]) {
OWSFailDebug(@"%@ Cannot add user to group member if already a member.", self.logTag);
OWSFailDebug(@"Cannot add user to group member if already a member.");
return;
}

View File

@ -400,7 +400,7 @@ typedef void (^CustomLayoutBlock)(void);
- (void)showSharingActivityWithCompletion:(nullable void (^)(void))completionHandler
{
OWSLogDebug(@"%@ Sharing safety numbers", self.logTag);
OWSLogDebug(@"Sharing safety numbers");
OWSCompareSafetyNumbersActivity *compareActivity = [[OWSCompareSafetyNumbersActivity alloc] initWithDelegate:self];

View File

@ -110,7 +110,7 @@ NS_ASSUME_NONNULL_BEGIN
// Also, it's less obvious whats being "shared" at this point,
// so just disable sharing when in capture mode.
OWSLogInfo(@"%@ Showing Scanner", self.logTag);
OWSLogInfo(@"Showing Scanner");
[self.qrScanningController startCapture];
} else {

View File

@ -94,13 +94,13 @@ NS_ASSUME_NONNULL_BEGIN
// Saving normally returns you to the "Show Contact" view
// which we're not interested in, so we skip it here. There is
// an unfortunate blip of the "Show Contact" view on slower devices.
OWSLogDebug(@"%@ completed editing contact.", self.logTag);
OWSLogDebug(@"completed editing contact.");
[self dismissViewControllerAnimated:NO
completion:^{
[self.navigationController popViewControllerAnimated:YES];
}];
} else {
OWSLogDebug(@"%@ canceled editing contact.", self.logTag);
OWSLogDebug(@"canceled editing contact.");
[self dismissViewControllerAnimated:YES
completion:^{
[self.navigationController popViewControllerAnimated:YES];
@ -190,12 +190,12 @@ NS_ASSUME_NONNULL_BEGIN
OWSAssert(self.recipientId);
if (!self.contactsManager.supportsContactEditing) {
OWSFailDebug(@"%@ Contact editing not supported", self.logTag);
OWSFailDebug(@"Contact editing not supported");
return;
}
CNContact *_Nullable cnContact = [self.contactsManager cnContactWithId:contact.cnContactId];
if (!cnContact) {
OWSFailDebug(@"%@ Could not load system contact.", self.logTag);
OWSFailDebug(@"Could not load system contact.");
return;
}
[self.contactsViewHelper presentContactViewControllerForRecipientId:self.recipientId

View File

@ -211,10 +211,10 @@ const CGFloat kIconViewLength = 24;
// Saving normally returns you to the "Show Contact" view
// which we're not interested in, so we skip it here. There is
// an unfortunate blip of the "Show Contact" view on slower devices.
OWSLogDebug(@"%@ completed editing contact.", self.logTag);
OWSLogDebug(@"completed editing contact.");
[self dismissViewControllerAnimated:NO completion:nil];
} else {
OWSLogDebug(@"%@ canceled editing contact.", self.logTag);
OWSLogDebug(@"canceled editing contact.");
[self dismissViewControllerAnimated:YES completion:nil];
}
}
@ -927,11 +927,11 @@ const CGFloat kIconViewLength = 24;
- (void)presentContactViewController
{
if (!self.contactsManager.supportsContactEditing) {
OWSFailDebug(@"%@ Contact editing not supported", self.logTag);
OWSFailDebug(@"Contact editing not supported");
return;
}
if (![self.thread isKindOfClass:[TSContactThread class]]) {
OWSFailDebug(@"%@ unexpected thread: %@ in %s", self.logTag, [self.thread class], __PRETTY_FUNCTION__);
OWSFailDebug(@"unexpected thread: %@", [self.thread class]);
return;
}
@ -945,7 +945,7 @@ const CGFloat kIconViewLength = 24;
{
if (!self.contactsManager.supportsContactEditing) {
// Should not expose UI that lets the user get here.
OWSFailDebug(@"%@ Contact editing not supported.", self.logTag);
OWSFailDebug(@"Contact editing not supported.");
return;
}
@ -990,10 +990,10 @@ const CGFloat kIconViewLength = 24;
[TSOutgoingMessage outgoingMessageInThread:gThread groupMetaMessage:TSGroupMessageQuit expiresInSeconds:0];
[self.messageSender enqueueMessage:message
success:^{
OWSLogInfo(@"%@ Successfully left group.", self.logTag);
OWSLogInfo(@"Successfully left group.");
}
failure:^(NSError *error) {
OWSLogWarn(@"%@ Failed to leave group with error: %@", self.logTag, error);
OWSLogWarn(@"Failed to leave group with error: %@", error);
}];
NSMutableArray *newGroupMemberIds = [NSMutableArray arrayWithArray:gThread.groupModel.groupMemberIds];
@ -1018,7 +1018,7 @@ const CGFloat kIconViewLength = 24;
OWSAssert(!self.isGroupThread);
if (![sender isKindOfClass:[UISwitch class]]) {
OWSFailDebug(@"%@ Unexpected sender for block user switch: %@", self.logTag, sender);
OWSFailDebug(@"Unexpected sender for block user switch: %@", sender);
}
UISwitch *blockUserSwitch = (UISwitch *)sender;
@ -1215,7 +1215,7 @@ const CGFloat kIconViewLength = 24;
- (void)showMediaGallery
{
OWSLogDebug(@"%@ in showMediaGallery", self.logTag);
OWSLogDebug(@"in showMediaGallery");
MediaGalleryViewController *vc =
[[MediaGalleryViewController alloc] initWithThread:self.thread

View File

@ -447,7 +447,7 @@ NS_ASSUME_NONNULL_BEGIN
- (void)contactViewController:(CNContactViewController *)viewController
didCompleteWithContact:(nullable CNContact *)contact
{
OWSLogDebug(@"%@ done editing contact.", self.logTag);
OWSLogDebug(@"done editing contact.");
[self dismissViewControllerAnimated:YES completion:nil];
}

View File

@ -57,7 +57,7 @@
*/
- (void)presentIncomingCall:(SignalCall *)call callerName:(NSString *)callerName
{
OWSLogDebug(@"%@ incoming call from: %@", self.logTag, call.remotePhoneNumber);
OWSLogDebug(@"incoming call from: %@", call.remotePhoneNumber);
UILocalNotification *notification = [UILocalNotification new];
notification.category = PushManagerCategoriesIncomingCall;
@ -208,7 +208,7 @@
OWSAssert(message);
if (!thread) {
OWSFailDebug(@"%@ unexpected notification not associated with a thread: %@.", self.logTag, [message class]);
OWSFailDebug(@"unexpected notification not associated with a thread: %@.", [message class]);
[self notifyUserForThreadlessErrorMessage:message transaction:transaction];
return;
}
@ -449,7 +449,7 @@
DispatchMainThreadSafe(^{
if (UIApplication.sharedApplication.applicationState == UIApplicationStateActive) {
OWSLogWarn(@"%@ skipping notification; app is in foreground and active.", self.logTag);
OWSLogWarn(@"skipping notification; app is in foreground and active.");
return;
}
@ -460,7 +460,7 @@
}
[[UIApplication sharedApplication] scheduleLocalNotification:notification];
OWSLogDebug(@"%@ presenting notification with identifier: %@", self.logTag, identifier);
OWSLogDebug(@"presenting notification with identifier: %@", identifier);
self.currentNotifications[identifier] = notification;
});
@ -471,8 +471,7 @@
DispatchMainThreadSafe(^{
UILocalNotification *notification = self.currentNotifications[identifier];
if (!notification) {
OWSLogWarn(
@"%@ Couldn't cancel notification because none was found with identifier: %@", self.logTag, identifier);
OWSLogWarn(@"Couldn't cancel notification because none was found with identifier: %@", identifier);
return;
}
[self.currentNotifications removeObjectForKey:identifier];

View File

@ -175,7 +175,7 @@ NS_ASSUME_NONNULL_BEGIN
TSThread *thread = [TSThread fetchObjectWithUniqueID:threadId];
if (thread == nil) {
OWSFailDebug(@"%@ unable to find thread with id: %@", self.logTag, threadId);
OWSFailDebug(@"unable to find thread with id: %@", threadId);
return;
}
@ -202,7 +202,7 @@ NS_ASSUME_NONNULL_BEGIN
OWSLogInfo(@"");
if (!thread) {
OWSFailDebug(@"%@ Can't present nil thread.", self.logTag);
OWSFailDebug(@"Can't present nil thread.");
return;
}
@ -246,7 +246,7 @@ NS_ASSUME_NONNULL_BEGIN
+ (void)clearAllNotifications
{
OWSLogInfo(@"%@ clearAllNotifications.", self.logTag);
OWSLogInfo(@"clearAllNotifications.");
// This will cancel all "scheduled" local notifications that haven't
// been presented yet.

View File

@ -100,7 +100,7 @@ NSString *const Signal_Message_MarkAsRead_Identifier = @"Signal_Message_MarkAsRe
if ([notification.object isKindOfClass:[TSIncomingMessage class]]) {
TSIncomingMessage *message = (TSIncomingMessage *)notification.object;
OWSLogDebug(@"%@ canceled notification for message:%@", self.logTag, message);
OWSLogDebug(@"canceled notification for message:%@", message);
[self cancelNotificationsWithThreadId:message.uniqueThreadId];
}
}
@ -109,7 +109,7 @@ NSString *const Signal_Message_MarkAsRead_Identifier = @"Signal_Message_MarkAsRe
- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo
{
OWSLogInfo(@"%@ received remote notification", self.logTag);
OWSLogInfo(@"received remote notification");
[AppReadiness runNowOrWhenAppIsReady:^{
[self.messageFetcherJob run];
@ -131,7 +131,7 @@ NSString *const Signal_Message_MarkAsRead_Identifier = @"Signal_Message_MarkAsRe
didReceiveRemoteNotification:(NSDictionary *)userInfo
fetchCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler
{
OWSLogInfo(@"%@ received content-available push", self.logTag);
OWSLogInfo(@"received content-available push");
// If we want to re-introduce silent pushes we can remove this assert.
OWSFailDebug(@"Unexpected content-available push.");
@ -146,10 +146,7 @@ NSString *const Signal_Message_MarkAsRead_Identifier = @"Signal_Message_MarkAsRe
- (void)presentOncePerActivationConversationWithThreadId:(NSString *)threadId
{
if (self.hasPresentedConversationSinceLastDeactivation) {
OWSFailDebug(@"%@ in %s refusing to present conversation: %@ multiple times.",
self.logTag,
__PRETTY_FUNCTION__,
threadId);
OWSFailDebug(@"refusing to present conversation: %@ multiple times.", threadId);
return;
}
@ -164,14 +161,14 @@ NSString *const Signal_Message_MarkAsRead_Identifier = @"Signal_Message_MarkAsRe
- (void)application:(UIApplication *)application didReceiveLocalNotification:(UILocalNotification *)notification
{
OWSAssertIsOnMainThread();
OWSLogInfo(@"%@ launched from local notification", self.logTag);
OWSLogInfo(@"launched from local notification");
NSString *_Nullable threadId = notification.userInfo[Signal_Thread_UserInfo_Key];
if (threadId) {
[self presentOncePerActivationConversationWithThreadId:threadId];
} else {
OWSFailDebug(@"%@ threadId was unexpectedly nil in %s", self.logTag, __PRETTY_FUNCTION__);
OWSFailDebug(@"threadId was unexpectedly nil");
}
// We only want to receive a single local notification per launch.
@ -185,7 +182,7 @@ NSString *const Signal_Message_MarkAsRead_Identifier = @"Signal_Message_MarkAsRe
forLocalNotification:(UILocalNotification *)notification
completionHandler:(void (^)(void))completionHandler
{
OWSLogInfo(@"%@ in %s", self.logTag, __FUNCTION__);
OWSLogInfo(@"in %s", __FUNCTION__);
[self application:application
handleActionWithIdentifier:identifier
@ -200,7 +197,7 @@ NSString *const Signal_Message_MarkAsRead_Identifier = @"Signal_Message_MarkAsRe
withResponseInfo:(NSDictionary *)responseInfo
completionHandler:(void (^)(void))completionHandler
{
OWSLogInfo(@"%@ handling action with identifier: %@", self.logTag, identifier);
OWSLogInfo(@"handling action with identifier: %@", identifier);
if ([identifier isEqualToString:Signal_Message_Reply_Identifier]) {
NSString *threadId = notification.userInfo[Signal_Thread_UserInfo_Key];
@ -237,13 +234,13 @@ NSString *const Signal_Message_MarkAsRead_Identifier = @"Signal_Message_MarkAsRe
} else if ([identifier isEqualToString:PushManagerActionsAcceptCall]) {
NSString *localIdString = notification.userInfo[PushManagerUserInfoKeysLocalCallId];
if (!localIdString) {
OWSLogError(@"%@ missing localIdString.", self.logTag);
OWSLogError(@"missing localIdString.");
return;
}
NSUUID *localId = [[NSUUID alloc] initWithUUIDString:localIdString];
if (!localId) {
OWSLogError(@"%@ localIdString failed to parse as UUID.", self.logTag);
OWSLogError(@"localIdString failed to parse as UUID.");
return;
}
@ -252,13 +249,13 @@ NSString *const Signal_Message_MarkAsRead_Identifier = @"Signal_Message_MarkAsRe
} else if ([identifier isEqualToString:PushManagerActionsDeclineCall]) {
NSString *localIdString = notification.userInfo[PushManagerUserInfoKeysLocalCallId];
if (!localIdString) {
OWSLogError(@"%@ missing localIdString.", self.logTag);
OWSLogError(@"missing localIdString.");
return;
}
NSUUID *localId = [[NSUUID alloc] initWithUUIDString:localIdString];
if (!localId) {
OWSLogError(@"%@ localIdString failed to parse as UUID.", self.logTag);
OWSLogError(@"localIdString failed to parse as UUID.");
return;
}
@ -267,7 +264,7 @@ NSString *const Signal_Message_MarkAsRead_Identifier = @"Signal_Message_MarkAsRe
} else if ([identifier isEqualToString:PushManagerActionsCallBack]) {
NSString *recipientId = notification.userInfo[PushManagerUserInfoKeysCallBackSignalRecipientId];
if (!recipientId) {
OWSLogError(@"%@ missing call back id", self.logTag);
OWSLogError(@"missing call back id");
return;
}
@ -279,16 +276,16 @@ NSString *const Signal_Message_MarkAsRead_Identifier = @"Signal_Message_MarkAsRe
if (threadId) {
[self presentOncePerActivationConversationWithThreadId:threadId];
} else {
OWSFailDebug(@"%@ threadId was unexpectedly nil in action with identifier: %@", self.logTag, identifier);
OWSFailDebug(@"threadId was unexpectedly nil in action with identifier: %@", identifier);
}
completionHandler();
} else {
OWSFailDebug(@"%@ Unhandled action with identifier: %@", self.logTag, identifier);
OWSFailDebug(@"Unhandled action with identifier: %@", identifier);
NSString *threadId = notification.userInfo[Signal_Thread_UserInfo_Key];
if (threadId) {
[self presentOncePerActivationConversationWithThreadId:threadId];
} else {
OWSFailDebug(@"%@ threadId was unexpectedly nil in action with identifier: %@", self.logTag, identifier);
OWSFailDebug(@"threadId was unexpectedly nil in action with identifier: %@", identifier);
}
completionHandler();
}
@ -298,7 +295,7 @@ NSString *const Signal_Message_MarkAsRead_Identifier = @"Signal_Message_MarkAsRe
{
NSString *threadId = userInfo[Signal_Thread_UserInfo_Key];
if (!threadId) {
OWSFailDebug(@"%@ missing thread id for notification.", self.logTag);
OWSFailDebug(@"missing thread id for notification.");
return;
}
@ -442,7 +439,7 @@ NSString *const PushManagerUserInfoKeysCallBackSignalRecipientId = @"PushManager
- (UIUserNotificationSettings *)userNotificationSettings
{
OWSLogDebug(@"%@ registering user notification settings", self.logTag);
OWSLogDebug(@"registering user notification settings");
UIUserNotificationSettings *settings = [UIUserNotificationSettings
settingsForTypes:(UIUserNotificationType)[self allNotificationTypes]
categories:[NSSet setWithObjects:[self fullNewMessageNotificationCategory],

View File

@ -195,7 +195,7 @@ NS_ASSUME_NONNULL_BEGIN
}
OWSLogInfo(@"%@", logString);
} else {
OWSLogInfo(@"%@ Unblocking Sleep.", self.logTag);
OWSLogInfo(@"Unblocking Sleep.");
}
}
UIApplication.sharedApplication.idleTimerDisabled = shouldBeBlocking;

View File

@ -278,7 +278,7 @@ NS_ASSUME_NONNULL_BEGIN
} else if (lastExportFailureDate) {
backupExportState = OWSBackupState_Failed;
} else {
OWSFailDebug(@"%@ unexpected condition.", self.logTag);
OWSFailDebug(@"unexpected condition.");
}
}
@ -381,7 +381,7 @@ NS_ASSUME_NONNULL_BEGIN
[self ensureBackupExportState];
} else {
OWSLogWarn(@"%@ obsolete job succeeded: %@", self.logTag, [backupJob class]);
OWSLogWarn(@"obsolete job succeeded: %@", [backupJob class]);
return;
}
@ -405,7 +405,7 @@ NS_ASSUME_NONNULL_BEGIN
[self ensureBackupExportState];
} else {
OWSLogInfo(@"%@ obsolete backup job failed.", self.logTag);
OWSLogInfo(@"obsolete backup job failed.");
return;
}
@ -452,12 +452,12 @@ NS_ASSUME_NONNULL_BEGIN
[OWSBackupAPI
fetchAllRecordNamesWithSuccess:^(NSArray<NSString *> *recordNames) {
for (NSString *recordName in [recordNames sortedArrayUsingSelector:@selector(compare:)]) {
OWSLogInfo(@"%@ \t %@", self.logTag, recordName);
OWSLogInfo(@"\t %@", recordName);
}
OWSLogInfo(@"%@ record count: %zd", self.logTag, recordNames.count);
OWSLogInfo(@"record count: %zd", recordNames.count);
}
failure:^(NSError *error) {
OWSLogError(@"%@ Failed to retrieve backup records: %@", self.logTag, error);
OWSLogError(@"Failed to retrieve backup records: %@", error);
}];
}
@ -470,19 +470,19 @@ NS_ASSUME_NONNULL_BEGIN
[OWSBackupAPI
fetchAllRecordNamesWithSuccess:^(NSArray<NSString *> *recordNames) {
if (recordNames.count < 1) {
OWSLogInfo(@"%@ No CloudKit records found to clear.", self.logTag);
OWSLogInfo(@"No CloudKit records found to clear.");
return;
}
[OWSBackupAPI deleteRecordsFromCloudWithRecordNames:recordNames
success:^{
OWSLogInfo(@"%@ Clear all CloudKit records succeeded.", self.logTag);
OWSLogInfo(@"Clear all CloudKit records succeeded.");
}
failure:^(NSError *error) {
OWSLogError(@"%@ Clear all CloudKit records failed: %@.", self.logTag, error);
OWSLogError(@"Clear all CloudKit records failed: %@.", error);
}];
}
failure:^(NSError *error) {
OWSLogError(@"%@ Failed to retrieve CloudKit records: %@", self.logTag, error);
OWSLogError(@"Failed to retrieve CloudKit records: %@", error);
}];
}
@ -494,7 +494,7 @@ NS_ASSUME_NONNULL_BEGIN
[self.dbConnection readWithBlock:^(YapDatabaseReadTransaction *transaction) {
id ext = [transaction ext:TSLazyRestoreAttachmentsDatabaseViewExtensionName];
if (!ext) {
OWSFailDebug(@"%@ Could not load database view.", self.logTag);
OWSFailDebug(@"Could not load database view.");
return;
}
@ -502,18 +502,14 @@ NS_ASSUME_NONNULL_BEGIN
usingBlock:^(
NSString *collection, NSString *key, id object, NSUInteger index, BOOL *stop) {
if (![object isKindOfClass:[TSAttachmentStream class]]) {
OWSFailDebug(@"%@ Unexpected object: %@ in collection:%@",
self.logTag,
[object class],
collection);
OWSFailDebug(
@"Unexpected object: %@ in collection:%@", [object class], collection);
return;
}
TSAttachmentStream *attachmentStream = object;
if (!attachmentStream.lazyRestoreFragment) {
OWSFailDebug(@"%@ Invalid object: %@ in collection:%@",
self.logTag,
[object class],
collection);
OWSFailDebug(
@"Invalid object: %@ in collection:%@", [object class], collection);
return;
}
[recordNames addObject:attachmentStream.lazyRestoreFragment.recordName];
@ -528,7 +524,7 @@ NS_ASSUME_NONNULL_BEGIN
[self.dbConnection readWithBlock:^(YapDatabaseReadTransaction *transaction) {
id ext = [transaction ext:TSLazyRestoreAttachmentsDatabaseViewExtensionName];
if (!ext) {
OWSFailDebug(@"%@ Could not load database view.", self.logTag);
OWSFailDebug(@"Could not load database view.");
return;
}
@ -550,21 +546,21 @@ NS_ASSUME_NONNULL_BEGIN
NSString *_Nullable attachmentFilePath = [attachment filePath];
if (attachmentFilePath.length < 1) {
OWSLogError(@"%@ Attachment has invalid file path.", self.logTag);
OWSLogError(@"Attachment has invalid file path.");
return completion(NO);
}
if ([NSFileManager.defaultManager fileExistsAtPath:attachmentFilePath]) {
OWSLogError(@"%@ Attachment already has file.", self.logTag);
OWSLogError(@"Attachment already has file.");
return completion(NO);
}
OWSBackupFragment *_Nullable lazyRestoreFragment = attachment.lazyRestoreFragment;
if (!lazyRestoreFragment) {
OWSLogWarn(@"%@ Attachment missing lazy restore metadata.", self.logTag);
OWSLogWarn(@"Attachment missing lazy restore metadata.");
return completion(NO);
}
if (lazyRestoreFragment.recordName.length < 1 || lazyRestoreFragment.encryptionKey.length < 1) {
OWSLogError(@"%@ Incomplete lazy restore metadata.", self.logTag);
OWSLogError(@"Incomplete lazy restore metadata.");
return completion(NO);
}
@ -606,7 +602,7 @@ NS_ASSUME_NONNULL_BEGIN
NSData *_Nullable data = [NSData dataWithContentsOfFile:encryptedFilePath];
if (!data) {
OWSLogError(@"%@ Could not load encrypted file.", self.logTag);
OWSLogError(@"Could not load encrypted file.");
return completion(NO);
}
@ -614,20 +610,20 @@ NS_ASSUME_NONNULL_BEGIN
@autoreleasepool {
if (![backupIO decryptFileAsFile:encryptedFilePath dstFilePath:decryptedFilePath encryptionKey:encryptionKey]) {
OWSLogError(@"%@ Could not load decrypt file.", self.logTag);
OWSLogError(@"Could not load decrypt file.");
return completion(NO);
}
}
NSString *_Nullable attachmentFilePath = [attachment filePath];
if (attachmentFilePath.length < 1) {
OWSLogError(@"%@ Attachment has invalid file path.", self.logTag);
OWSLogError(@"Attachment has invalid file path.");
return completion(NO);
}
NSString *attachmentDirPath = [attachmentFilePath stringByDeletingLastPathComponent];
if (![OWSFileSystem ensureDirectoryExists:attachmentDirPath]) {
OWSLogError(@"%@ Couldn't create directory for attachment file.", self.logTag);
OWSLogError(@"Couldn't create directory for attachment file.");
return completion(NO);
}
@ -635,7 +631,7 @@ NS_ASSUME_NONNULL_BEGIN
BOOL success =
[NSFileManager.defaultManager moveItemAtPath:decryptedFilePath toPath:attachmentFilePath error:&error];
if (!success || error) {
OWSLogError(@"%@ Attachment file could not be restored: %@.", self.logTag, error);
OWSLogError(@"Attachment file could not be restored: %@.", error);
return completion(NO);
}

View File

@ -117,7 +117,7 @@ NS_ASSUME_NONNULL_BEGIN
NSData *_Nullable data = [NSKeyedArchiver archivedDataWithRootObject:object];
if (!data) {
OWSFailDebug(@"%@ couldn't serialize database object: %@", self.logTag, [object class]);
OWSFailDebug(@"couldn't serialize database object: %@", [object class]);
return NO;
}
@ -131,7 +131,7 @@ NS_ASSUME_NONNULL_BEGIN
NSError *error;
SignalIOSProtoBackupSnapshotBackupEntity *_Nullable entity = [entityBuilder buildAndReturnError:&error];
if (!entity || error) {
OWSFailDebug(@"%@ couldn't build proto: %@", self.logTag, error);
OWSFailDebug(@"couldn't build proto: %@", error);
return NO;
}
@ -165,7 +165,7 @@ NS_ASSUME_NONNULL_BEGIN
NSError *error;
NSData *_Nullable uncompressedData = [self.backupSnapshotBuilder buildSerializedDataAndReturnError:&error];
if (!uncompressedData || error) {
OWSFailDebug(@"%@ couldn't serialize proto: %@", self.logTag, error);
OWSFailDebug(@"couldn't serialize proto: %@", error);
return NO;
}
@ -173,7 +173,7 @@ NS_ASSUME_NONNULL_BEGIN
self.backupSnapshotBuilder = nil;
self.cachedItemCount = 0;
if (!uncompressedData) {
OWSFailDebug(@"%@ couldn't convert database snapshot to data.", self.logTag);
OWSFailDebug(@"couldn't convert database snapshot to data.");
return NO;
}
@ -181,7 +181,7 @@ NS_ASSUME_NONNULL_BEGIN
OWSBackupEncryptedItem *_Nullable encryptedItem = [self.backupIO encryptDataAsTempFile:compressedData];
if (!encryptedItem) {
OWSFailDebug(@"%@ couldn't encrypt database snapshot.", self.logTag);
OWSFailDebug(@"couldn't encrypt database snapshot.");
return NO;
}
@ -256,7 +256,7 @@ NS_ASSUME_NONNULL_BEGIN
NSString *attachmentsDirPath = [TSAttachmentStream attachmentsFolder];
if (![self.attachmentFilePath hasPrefix:attachmentsDirPath]) {
OWSFailDebug(@"%@ attachment has unexpected path: %@", self.logTag, self.attachmentFilePath);
OWSFailDebug(@"attachment has unexpected path: %@", self.attachmentFilePath);
return NO;
}
NSString *relativeFilePath = [self.attachmentFilePath substringFromIndex:attachmentsDirPath.length];
@ -268,7 +268,7 @@ NS_ASSUME_NONNULL_BEGIN
OWSBackupEncryptedItem *_Nullable encryptedItem = [self.backupIO encryptFileAsTempFile:self.attachmentFilePath];
if (!encryptedItem) {
OWSFailDebug(@"%@ attachment could not be encrypted: %@", self.logTag, self.attachmentFilePath);
OWSFailDebug(@"attachment could not be encrypted: %@", self.attachmentFilePath);
return NO;
}
self.encryptedItem = encryptedItem;
@ -399,7 +399,7 @@ NS_ASSUME_NONNULL_BEGIN
OWSLogVerbose(@"");
if (![self ensureJobTempDir]) {
OWSFailDebug(@"%@ Could not create jobTempDirPath.", self.logTag);
OWSFailDebug(@"Could not create jobTempDirPath.");
return completion(NO);
}
@ -421,7 +421,7 @@ NS_ASSUME_NONNULL_BEGIN
}
failure:^(NSURLSessionDataTask *task, NSError *error) {
// TODO: We may want to surface this in the UI.
OWSLogError(@"%@ could not verify account status: %@.", self.logTag, error);
OWSLogError(@"could not verify account status: %@.", error);
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
completion(NO);
});
@ -471,7 +471,7 @@ NS_ASSUME_NONNULL_BEGIN
YapDatabaseConnection *_Nullable dbConnection = self.primaryStorage.newDatabaseConnection;
if (!dbConnection) {
OWSFailDebug(@"%@ Could not create dbConnection.", self.logTag);
OWSFailDebug(@"Could not create dbConnection.");
return NO;
}
@ -501,7 +501,7 @@ NS_ASSUME_NONNULL_BEGIN
return;
}
if (![object isKindOfClass:expectedClass]) {
OWSFailDebug(@"%@ unexpected class: %@", self.logTag, [object class]);
OWSFailDebug(@"unexpected class: %@", [object class]);
return;
}
TSYapDatabaseObject *entity = object;
@ -541,7 +541,7 @@ NS_ASSUME_NONNULL_BEGIN
TSAttachmentStream *attachmentStream = object;
NSString *_Nullable filePath = attachmentStream.filePath;
if (!filePath) {
OWSLogError(@"%@ attachment is missing file.", self.logTag);
OWSLogError(@"attachment is missing file.");
return NO;
OWSAssert(attachmentStream.uniqueId.length > 0);
}
@ -598,7 +598,7 @@ NS_ASSUME_NONNULL_BEGIN
@autoreleasepool {
if (![exportStream flush]) {
OWSFailDebug(@"%@ Could not flush database snapshots.", self.logTag);
OWSFailDebug(@"Could not flush database snapshots.");
return NO;
}
}
@ -607,11 +607,11 @@ NS_ASSUME_NONNULL_BEGIN
// TODO: Should we do a database checkpoint?
OWSLogInfo(@"%@ copiedThreads: %zd", self.logTag, copiedThreads);
OWSLogInfo(@"%@ copiedMessages: %zd", self.logTag, copiedInteractions);
OWSLogInfo(@"%@ copiedAttachments: %zd", self.logTag, copiedAttachments);
OWSLogInfo(@"%@ copiedMigrations: %zd", self.logTag, copiedMigrations);
OWSLogInfo(@"%@ copiedEntities: %zd", self.logTag, exportStream.totalItemCount);
OWSLogInfo(@"copiedThreads: %zd", copiedThreads);
OWSLogInfo(@"copiedMessages: %zd", copiedInteractions);
OWSLogInfo(@"copiedAttachments: %zd", copiedAttachments);
OWSLogInfo(@"copiedMigrations: %zd", copiedMigrations);
OWSLogInfo(@"copiedEntities: %zd", exportStream.totalItemCount);
return YES;
}
@ -632,8 +632,7 @@ NS_ASSUME_NONNULL_BEGIN
for (OWSBackupExportItem *item in self.unsavedDatabaseItems) {
databaseFileSize += [OWSFileSystem fileSizeOfPath:item.encryptedItem.filePath].unsignedLongLongValue;
}
OWSLogInfo(@"%@ exporting %@: count: %zd, bytes: %llu.",
self.logTag,
OWSLogInfo(@"exporting %@: count: %zd, bytes: %llu.",
@"database items",
self.unsavedDatabaseItems.count,
databaseFileSize);
@ -646,15 +645,14 @@ NS_ASSUME_NONNULL_BEGIN
attachmentFileSize +=
[OWSFileSystem fileSizeOfPath:attachmentExport.attachmentFilePath].unsignedLongLongValue;
}
OWSLogInfo(@"%@ exporting %@: count: %zd, bytes: %llu.",
self.logTag,
OWSLogInfo(@"exporting %@: count: %zd, bytes: %llu.",
@"attachment items",
self.unsavedAttachmentExports.count,
attachmentFileSize);
totalFileSize += attachmentFileSize;
totalFileCount += self.unsavedAttachmentExports.count;
}
OWSLogInfo(@"%@ exporting %@: count: %zd, bytes: %llu.", self.logTag, @"all items", totalFileCount, totalFileSize);
OWSLogInfo(@"exporting %@: count: %zd, bytes: %llu.", @"all items", totalFileCount, totalFileSize);
[self saveNextFileToCloudWithCompletion:completion];
}
@ -768,8 +766,7 @@ NS_ASSUME_NONNULL_BEGIN
exportItem.attachmentExport = attachmentExport;
[self.savedAttachmentItems addObject:exportItem];
OWSLogVerbose(@"%@ recycled attachment: %@ as %@",
self.logTag,
OWSLogVerbose(@"recycled attachment: %@ as %@",
attachmentExport.attachmentFilePath,
attachmentExport.relativeFilePath);
[self saveNextFileToCloudWithCompletion:completion];
@ -792,11 +789,11 @@ NS_ASSUME_NONNULL_BEGIN
[OWSBackupAPI savePersistentFileOnceToCloudWithFileId:attachmentExport.attachmentId
fileUrlBlock:^{
if (attachmentExport.encryptedItem.filePath.length < 1) {
OWSLogError(@"%@ attachment export missing temp file path", self.logTag);
OWSLogError(@"attachment export missing temp file path");
return (NSURL *)nil;
}
if (attachmentExport.relativeFilePath.length < 1) {
OWSLogError(@"%@ attachment export missing relative file path", self.logTag);
OWSLogError(@"attachment export missing relative file path");
return (NSURL *)nil;
}
return [NSURL fileURLWithPath:attachmentExport.encryptedItem.filePath];
@ -810,7 +807,7 @@ NS_ASSUME_NONNULL_BEGIN
}
if (![attachmentExport cleanUp]) {
OWSLogError(@"%@ couldn't clean up attachment export.", self.logTag);
OWSLogError(@"couldn't clean up attachment export.");
// Attachment files are non-critical so any error uploading them is recoverable.
}
@ -829,8 +826,7 @@ NS_ASSUME_NONNULL_BEGIN
backupFragment.uncompressedDataLength = exportItem.uncompressedDataLength;
[backupFragment save];
OWSLogVerbose(@"%@ saved attachment: %@ as %@",
self.logTag,
OWSLogVerbose(@"saved attachment: %@ as %@",
attachmentExport.attachmentFilePath,
attachmentExport.relativeFilePath);
[strongSelf saveNextFileToCloudWithCompletion:completion];
@ -840,7 +836,7 @@ NS_ASSUME_NONNULL_BEGIN
// Ensure that we continue to work off the main thread.
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
if (![attachmentExport cleanUp]) {
OWSLogError(@"%@ couldn't clean up attachment export.", self.logTag);
OWSLogError(@"couldn't clean up attachment export.");
// Attachment files are non-critical so any error uploading them is recoverable.
}
@ -906,13 +902,13 @@ NS_ASSUME_NONNULL_BEGIN
kOWSBackup_ManifestKey_AttachmentFiles : [self jsonForItems:self.savedAttachmentItems],
};
OWSLogVerbose(@"%@ json: %@", self.logTag, json);
OWSLogVerbose(@"json: %@", json);
NSError *error;
NSData *_Nullable jsonData =
[NSJSONSerialization dataWithJSONObject:json options:NSJSONWritingPrettyPrinted error:&error];
if (!jsonData || error) {
OWSFailDebug(@"%@ error encoding manifest file: %@", self.logTag, error);
OWSFailDebug(@"error encoding manifest file: %@", error);
return nil;
}
return [self.backupIO encryptDataAsTempFile:jsonData encryptionKey:self.delegate.backupEncryptionKey];
@ -1030,8 +1026,7 @@ NS_ASSUME_NONNULL_BEGIN
[obsoleteRecordNames addObjectsFromArray:recordNames];
[obsoleteRecordNames minusSet:activeRecordNames];
OWSLogVerbose(@"%@ recordNames: %zd - activeRecordNames: %zd = obsoleteRecordNames: %zd",
self.logTag,
OWSLogVerbose(@"recordNames: %zd - activeRecordNames: %zd = obsoleteRecordNames: %zd",
recordNames.count,
activeRecordNames.count,
obsoleteRecordNames.count);

View File

@ -53,7 +53,7 @@ static const compression_algorithm SignalCompressionAlgorithm = COMPRESSION_LZMA
{
NSString *filePath = [self generateTempFilePath];
if (![OWSFileSystem ensureFileExists:filePath]) {
OWSFailDebug(@"%@ could not create temp file.", self.logTag);
OWSFailDebug(@"could not create temp file.");
return nil;
}
return filePath;
@ -80,7 +80,7 @@ static const compression_algorithm SignalCompressionAlgorithm = COMPRESSION_LZMA
// TODO: Encrypt the file without loading it into memory.
NSData *_Nullable srcData = [NSData dataWithContentsOfFile:srcFilePath];
if (srcData.length < 1) {
OWSFailDebug(@"%@ could not load file into memory for encryption.", self.logTag);
OWSFailDebug(@"could not load file into memory for encryption.");
return nil;
}
return [self encryptDataAsTempFile:srcData encryptionKey:encryptionKey];
@ -114,7 +114,7 @@ static const compression_algorithm SignalCompressionAlgorithm = COMPRESSION_LZMA
NSError *error;
BOOL success = [encryptedData writeToFile:dstFilePath options:NSDataWritingAtomic error:&error];
if (!success || error) {
OWSFailDebug(@"%@ error writing encrypted data: %@", self.logTag, error);
OWSFailDebug(@"error writing encrypted data: %@", error);
return nil;
}
[OWSFileSystem protectFileOrFolderAtPath:dstFilePath];
@ -146,7 +146,7 @@ static const compression_algorithm SignalCompressionAlgorithm = COMPRESSION_LZMA
NSError *error;
BOOL success = [data writeToFile:dstFilePath options:NSDataWritingAtomic error:&error];
if (!success || error) {
OWSFailDebug(@"%@ error writing decrypted data: %@", self.logTag, error);
OWSFailDebug(@"error writing decrypted data: %@", error);
return NO;
}
[OWSFileSystem protectFileOrFolderAtPath:dstFilePath];
@ -163,13 +163,13 @@ static const compression_algorithm SignalCompressionAlgorithm = COMPRESSION_LZMA
@autoreleasepool {
if (![NSFileManager.defaultManager fileExistsAtPath:srcFilePath]) {
OWSLogError(@"%@ missing downloaded file.", self.logTag);
OWSLogError(@"missing downloaded file.");
return nil;
}
NSData *_Nullable srcData = [NSData dataWithContentsOfFile:srcFilePath];
if (srcData.length < 1) {
OWSFailDebug(@"%@ could not load file into memory for decryption.", self.logTag);
OWSFailDebug(@"could not load file into memory for decryption.");
return nil;
}
@ -201,7 +201,7 @@ static const compression_algorithm SignalCompressionAlgorithm = COMPRESSION_LZMA
@autoreleasepool {
if (!srcData) {
OWSFailDebug(@"%@ missing unencrypted data.", self.logTag);
OWSFailDebug(@"missing unencrypted data.");
return nil;
}
@ -213,7 +213,7 @@ static const compression_algorithm SignalCompressionAlgorithm = COMPRESSION_LZMA
size_t dstBufferLength = srcLength + 64 * 1024;
NSMutableData *dstBufferData = [NSMutableData dataWithLength:dstBufferLength];
if (!dstBufferData) {
OWSFailDebug(@"%@ Failed to allocate buffer.", self.logTag);
OWSFailDebug(@"Failed to allocate buffer.");
return nil;
}
@ -238,7 +238,7 @@ static const compression_algorithm SignalCompressionAlgorithm = COMPRESSION_LZMA
@autoreleasepool {
if (!srcData) {
OWSFailDebug(@"%@ missing unencrypted data.", self.logTag);
OWSFailDebug(@"missing unencrypted data.");
return nil;
}
@ -248,7 +248,7 @@ static const compression_algorithm SignalCompressionAlgorithm = COMPRESSION_LZMA
size_t dstBufferLength = uncompressedDataLength + 1024;
NSMutableData *dstBufferData = [NSMutableData dataWithLength:dstBufferLength];
if (!dstBufferData) {
OWSFailDebug(@"%@ Failed to allocate buffer.", self.logTag);
OWSFailDebug(@"Failed to allocate buffer.");
return nil;
}

View File

@ -175,7 +175,7 @@ NSString *const kOWSBackup_ImportDatabaseKeySpec = @"kOWSBackup_ImportDatabaseKe
OWSLogVerbose(@"");
if (![self ensureJobTempDir]) {
OWSFailDebug(@"%@ Could not create jobTempDirPath.", self.logTag);
OWSFailDebug(@"Could not create jobTempDirPath.");
return NO;
}
@ -266,24 +266,24 @@ NSString *const kOWSBackup_ImportDatabaseKeySpec = @"kOWSBackup_ImportDatabaseKe
return;
}
if (item.recordName.length < 1) {
OWSLogError(@"%@ attachment was not downloaded.", self.logTag);
OWSLogError(@"attachment was not downloaded.");
// Attachment-related errors are recoverable and can be ignored.
continue;
}
if (item.attachmentId.length < 1) {
OWSLogError(@"%@ attachment missing attachment id.", self.logTag);
OWSLogError(@"attachment missing attachment id.");
// Attachment-related errors are recoverable and can be ignored.
continue;
}
if (item.relativeFilePath.length < 1) {
OWSLogError(@"%@ attachment missing relative file path.", self.logTag);
OWSLogError(@"attachment missing relative file path.");
// Attachment-related errors are recoverable and can be ignored.
continue;
}
TSAttachmentStream *_Nullable attachment =
[TSAttachmentStream fetchObjectWithUniqueID:item.attachmentId transaction:transaction];
if (!attachment) {
OWSLogError(@"%@ attachment to restore could not be found.", self.logTag);
OWSLogError(@"attachment to restore could not be found.");
// Attachment-related errors are recoverable and can be ignored.
continue;
}
@ -295,7 +295,7 @@ NSString *const kOWSBackup_ImportDatabaseKeySpec = @"kOWSBackup_ImportDatabaseKe
}
}];
OWSLogError(@"%@ enqueued lazy restore of %zd files.", self.logTag, count);
OWSLogError(@"enqueued lazy restore of %zd files.", count);
}
- (void)restoreDatabaseWithCompletion:(OWSBackupJobBoolCompletion)completion
@ -310,7 +310,7 @@ NSString *const kOWSBackup_ImportDatabaseKeySpec = @"kOWSBackup_ImportDatabaseKe
YapDatabaseConnection *_Nullable dbConnection = self.primaryStorage.newDatabaseConnection;
if (!dbConnection) {
OWSFailDebug(@"%@ Could not create dbConnection.", self.logTag);
OWSFailDebug(@"Could not create dbConnection.");
return completion(NO);
}
@ -334,7 +334,7 @@ NSString *const kOWSBackup_ImportDatabaseKeySpec = @"kOWSBackup_ImportDatabaseKe
continue;
}
if ([transaction numberOfKeysInCollection:collection] > 0) {
OWSLogError(@"%@ unexpected contents in database (%@).", self.logTag, collection);
OWSLogError(@"unexpected contents in database (%@).", collection);
}
}
@ -356,14 +356,14 @@ NSString *const kOWSBackup_ImportDatabaseKeySpec = @"kOWSBackup_ImportDatabaseKe
return;
}
if (item.recordName.length < 1) {
OWSLogError(@"%@ database snapshot was not downloaded.", self.logTag);
OWSLogError(@"database snapshot was not downloaded.");
// Attachment-related errors are recoverable and can be ignored.
// Database-related errors are unrecoverable.
aborted = YES;
return completion(NO);
}
if (!item.uncompressedDataLength || item.uncompressedDataLength.unsignedIntValue < 1) {
OWSLogError(@"%@ database snapshot missing size.", self.logTag);
OWSLogError(@"database snapshot missing size.");
// Attachment-related errors are recoverable and can be ignored.
// Database-related errors are unrecoverable.
aborted = YES;
@ -395,13 +395,13 @@ NSString *const kOWSBackup_ImportDatabaseKeySpec = @"kOWSBackup_ImportDatabaseKe
SignalIOSProtoBackupSnapshot *_Nullable entities =
[SignalIOSProtoBackupSnapshot parseData:uncompressedData error:&error];
if (!entities || error) {
OWSLogError(@"%@ could not parse proto: %@.", self.logTag, error);
OWSLogError(@"could not parse proto: %@.", error);
// Database-related errors are unrecoverable.
aborted = YES;
return completion(NO);
}
if (!entities || entities.entity.count < 1) {
OWSLogError(@"%@ missing entities.", self.logTag);
OWSLogError(@"missing entities.");
// Database-related errors are unrecoverable.
aborted = YES;
return completion(NO);
@ -409,7 +409,7 @@ NSString *const kOWSBackup_ImportDatabaseKeySpec = @"kOWSBackup_ImportDatabaseKe
for (SignalIOSProtoBackupSnapshotBackupEntity *entity in entities.entity) {
NSData *_Nullable entityData = entity.entityData;
if (entityData.length < 1) {
OWSLogError(@"%@ missing entity data.", self.logTag);
OWSLogError(@"missing entity data.");
// Database-related errors are unrecoverable.
aborted = YES;
return completion(NO);
@ -420,13 +420,13 @@ NSString *const kOWSBackup_ImportDatabaseKeySpec = @"kOWSBackup_ImportDatabaseKe
NSKeyedUnarchiver *unarchiver = [[NSKeyedUnarchiver alloc] initForReadingWithData:entityData];
object = [unarchiver decodeObjectForKey:@"root"];
if (![object isKindOfClass:[object class]]) {
OWSLogError(@"%@ invalid decoded entity: %@.", self.logTag, [object class]);
OWSLogError(@"invalid decoded entity: %@.", [object class]);
// Database-related errors are unrecoverable.
aborted = YES;
return completion(NO);
}
} @catch (NSException *exception) {
OWSLogError(@"%@ could not decode entity.", self.logTag);
OWSLogError(@"could not decode entity.");
// Database-related errors are unrecoverable.
aborted = YES;
return completion(NO);
@ -447,9 +447,9 @@ NSString *const kOWSBackup_ImportDatabaseKeySpec = @"kOWSBackup_ImportDatabaseKe
}
for (NSString *collection in restoredEntityCounts) {
OWSLogInfo(@"%@ copied %@: %@", self.logTag, collection, restoredEntityCounts[collection]);
OWSLogInfo(@"copied %@: %@", collection, restoredEntityCounts[collection]);
}
OWSLogInfo(@"%@ copiedEntities: %llu", self.logTag, copiedEntities);
OWSLogInfo(@"copiedEntities: %llu", copiedEntities);
[self.primaryStorage logFileSizes];

View File

@ -84,7 +84,7 @@ NSString *const kOWSBackup_KeychainService = @"kOWSBackup_KeychainService";
self.jobTempDirPath = [temporaryDirectory stringByAppendingPathComponent:[NSUUID UUID].UUIDString];
if (![OWSFileSystem ensureDirectoryExists:self.jobTempDirPath]) {
OWSFailDebug(@"%@ Could not create jobTempDirPath.", self.logTag);
OWSFailDebug(@"Could not create jobTempDirPath.");
return NO;
}
return YES;
@ -203,7 +203,7 @@ NSString *const kOWSBackup_KeychainService = @"kOWSBackup_KeychainService";
NSData *_Nullable manifestDataDecrypted =
[backupIO decryptDataAsData:manifestDataEncrypted encryptionKey:self.delegate.backupEncryptionKey];
if (!manifestDataDecrypted) {
OWSFailDebug(@"%@ Could not decrypt manifest.", self.logTag);
OWSFailDebug(@"Could not decrypt manifest.");
return failure();
}
@ -211,11 +211,11 @@ NSString *const kOWSBackup_KeychainService = @"kOWSBackup_KeychainService";
NSDictionary<NSString *, id> *_Nullable json =
[NSJSONSerialization JSONObjectWithData:manifestDataDecrypted options:0 error:&error];
if (![json isKindOfClass:[NSDictionary class]]) {
OWSFailDebug(@"%@ Could not download manifest.", self.logTag);
OWSFailDebug(@"Could not download manifest.");
return failure();
}
OWSLogVerbose(@"%@ json: %@", self.logTag, json);
OWSLogVerbose(@"json: %@", json);
NSArray<OWSBackupFragment *> *_Nullable databaseItems =
[self parseItems:json key:kOWSBackup_ManifestKey_DatabaseFiles];
@ -241,18 +241,18 @@ NSString *const kOWSBackup_KeychainService = @"kOWSBackup_KeychainService";
OWSAssert(key.length);
if (![json isKindOfClass:[NSDictionary class]]) {
OWSFailDebug(@"%@ manifest has invalid data.", self.logTag);
OWSFailDebug(@"manifest has invalid data.");
return nil;
}
NSArray *itemMaps = json[key];
if (![itemMaps isKindOfClass:[NSArray class]]) {
OWSFailDebug(@"%@ manifest has invalid data.", self.logTag);
OWSFailDebug(@"manifest has invalid data.");
return nil;
}
NSMutableArray<OWSBackupFragment *> *items = [NSMutableArray new];
for (NSDictionary *itemMap in itemMaps) {
if (![itemMap isKindOfClass:[NSDictionary class]]) {
OWSFailDebug(@"%@ manifest has invalid item.", self.logTag);
OWSFailDebug(@"manifest has invalid item.");
return nil;
}
NSString *_Nullable recordName = itemMap[kOWSBackup_ManifestKey_RecordName];
@ -261,33 +261,33 @@ NSString *const kOWSBackup_KeychainService = @"kOWSBackup_KeychainService";
NSString *_Nullable attachmentId = itemMap[kOWSBackup_ManifestKey_AttachmentId];
NSNumber *_Nullable uncompressedDataLength = itemMap[kOWSBackup_ManifestKey_DataSize];
if (![recordName isKindOfClass:[NSString class]]) {
OWSFailDebug(@"%@ manifest has invalid recordName: %@.", self.logTag, recordName);
OWSFailDebug(@"manifest has invalid recordName: %@.", recordName);
return nil;
}
if (![encryptionKeyString isKindOfClass:[NSString class]]) {
OWSFailDebug(@"%@ manifest has invalid encryptionKey.", self.logTag);
OWSFailDebug(@"manifest has invalid encryptionKey.");
return nil;
}
// relativeFilePath is an optional field.
if (relativeFilePath && ![relativeFilePath isKindOfClass:[NSString class]]) {
OWSLogDebug(@"%@ manifest has invalid relativeFilePath: %@.", self.logTag, relativeFilePath);
OWSFailDebug(@"%@ manifest has invalid relativeFilePath", self.logTag);
OWSLogDebug(@"manifest has invalid relativeFilePath: %@.", relativeFilePath);
OWSFailDebug(@"manifest has invalid relativeFilePath");
return nil;
}
// attachmentId is an optional field.
if (attachmentId && ![attachmentId isKindOfClass:[NSString class]]) {
OWSLogDebug(@"%@ manifest has invalid attachmentId: %@.", self.logTag, attachmentId);
OWSFailDebug(@"%@ manifest has invalid attachmentId", self.logTag);
OWSLogDebug(@"manifest has invalid attachmentId: %@.", attachmentId);
OWSFailDebug(@"manifest has invalid attachmentId");
return nil;
}
NSData *_Nullable encryptionKey = [NSData dataFromBase64String:encryptionKeyString];
if (!encryptionKey) {
OWSFailDebug(@"%@ manifest has corrupt encryptionKey", self.logTag);
OWSFailDebug(@"manifest has corrupt encryptionKey");
return nil;
}
// uncompressedDataLength is an optional field.
if (uncompressedDataLength && ![uncompressedDataLength isKindOfClass:[NSNumber class]]) {
OWSFailDebug(@"%@ manifest has invalid uncompressedDataLength: %@.", self.logTag, uncompressedDataLength);
OWSFailDebug(@"manifest has invalid uncompressedDataLength: %@.", uncompressedDataLength);
return nil;
}

View File

@ -56,7 +56,7 @@ typedef void (^OrphanDataBlock)(OWSOrphanData *);
+ (void)printPaths:(NSArray<NSString *> *)paths label:(NSString *)label
{
for (NSString *path in [paths sortedArrayUsingSelector:@selector(compare:)]) {
OWSLogDebug(@"%@ %@: %@", self.logTag, label, path);
OWSLogDebug(@"%@: %@", label, path);
}
}
@ -66,10 +66,10 @@ typedef void (^OrphanDataBlock)(OWSOrphanData *);
NSNumber *fileSize = [[NSFileManager defaultManager] attributesOfItemAtPath:filePath error:&error][NSFileSize];
if (error) {
if ([error.domain isEqualToString:NSCocoaErrorDomain] && error.code == 260) {
OWSLogWarn(@"%@ can't find size of missing file.", self.logTag);
OWSLogDebug(@"%@ can't find size of missing file: %@", self.logTag, filePath);
OWSLogWarn(@"can't find size of missing file.");
OWSLogDebug(@"can't find size of missing file: %@", filePath);
} else {
OWSFailDebug(@"%@ attributesOfItemAtPath: %@ error: %@", self.logTag, filePath, error);
OWSFailDebug(@"attributesOfItemAtPath: %@ error: %@", filePath, error);
}
return 0;
}
@ -97,7 +97,7 @@ typedef void (^OrphanDataBlock)(OWSOrphanData *);
NSError *error;
NSArray<NSString *> *fileNames = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:dirPath error:&error];
if (error) {
OWSFailDebug(@"%@ contentsOfDirectoryAtPath error: %@", self.logTag, error);
OWSFailDebug(@"contentsOfDirectoryAtPath error: %@", error);
return [NSSet new];
}
for (NSString *fileName in fileNames) {
@ -144,7 +144,7 @@ typedef void (^OrphanDataBlock)(OWSOrphanData *);
OWSAssert(databaseConnection);
if (remainingRetries < 1) {
OWSLogInfo(@"%@ Aborting orphan data search.", self.logTag);
OWSLogInfo(@"Aborting orphan data search.");
dispatch_async(self.workQueue, ^{
failure();
});
@ -191,7 +191,7 @@ typedef void (^OrphanDataBlock)(OWSOrphanData *);
if ([filePath hasPrefix:attachmentsFolder]) {
continue;
}
OWSLogVerbose(@"%@ non-attachment file: %@", self.logTag, filePath);
OWSLogVerbose(@"non-attachment file: %@", filePath);
}
}
{
@ -204,7 +204,7 @@ typedef void (^OrphanDataBlock)(OWSOrphanData *);
if ([filePath hasPrefix:attachmentsFolder]) {
continue;
}
OWSLogVerbose(@"%@ non-attachment file: %@", self.logTag, filePath);
OWSLogVerbose(@"non-attachment file: %@", filePath);
}
}
#endif
@ -231,14 +231,12 @@ typedef void (^OrphanDataBlock)(OWSOrphanData *);
NSError *error;
NSDictionary *attributes = [[NSFileManager defaultManager] attributesOfItemAtPath:filePath error:&error];
if (!attributes || error) {
OWSLogDebug(@"%@ Could not get attributes of file at: %@", self.logTag, filePath);
OWSFailDebug(@"%@ Could not get attributes of file", self.logTag);
OWSLogDebug(@"Could not get attributes of file at: %@", filePath);
OWSFailDebug(@"Could not get attributes of file");
continue;
}
OWSLogVerbose(@"%@ temp file: %@, %@",
self.logTag,
filePath,
[dateFormatter stringFromDate:attributes.fileModificationDate]);
OWSLogVerbose(
@"temp file: %@, %@", filePath, [dateFormatter stringFromDate:attributes.fileModificationDate]);
}
}
#endif
@ -320,7 +318,7 @@ typedef void (^OrphanDataBlock)(OWSOrphanData *);
if (filePath) {
[allAttachmentFilePaths addObject:filePath];
} else {
OWSFailDebug(@"%@ attachment has no file path.", self.logTag);
OWSFailDebug(@"attachment has no file path.");
}
NSString *_Nullable thumbnailPath = [attachmentStream thumbnailPath];
@ -374,10 +372,10 @@ typedef void (^OrphanDataBlock)(OWSOrphanData *);
return nil;
}
OWSLogDebug(@"%@ fileCount: %zu", self.logTag, fileCount);
OWSLogDebug(@"%@ totalFileSize: %lld", self.logTag, totalFileSize.longLongValue);
OWSLogDebug(@"%@ attachmentStreams: %d", self.logTag, attachmentStreamCount);
OWSLogDebug(@"%@ attachmentStreams with file paths: %zu", self.logTag, allAttachmentFilePaths.count);
OWSLogDebug(@"fileCount: %zu", fileCount);
OWSLogDebug(@"totalFileSize: %lld", totalFileSize.longLongValue);
OWSLogDebug(@"attachmentStreams: %d", attachmentStreamCount);
OWSLogDebug(@"attachmentStreams with file paths: %zu", allAttachmentFilePaths.count);
NSMutableSet<NSString *> *orphanFilePaths = [allOnDiskFilePaths mutableCopy];
[orphanFilePaths minusSet:allAttachmentFilePaths];
@ -385,16 +383,16 @@ typedef void (^OrphanDataBlock)(OWSOrphanData *);
NSMutableSet<NSString *> *missingAttachmentFilePaths = [allAttachmentFilePaths mutableCopy];
[missingAttachmentFilePaths minusSet:allOnDiskFilePaths];
OWSLogDebug(@"%@ orphan file paths: %zu", self.logTag, orphanFilePaths.count);
OWSLogDebug(@"%@ missing attachment file paths: %zu", self.logTag, missingAttachmentFilePaths.count);
OWSLogDebug(@"orphan file paths: %zu", orphanFilePaths.count);
OWSLogDebug(@"missing attachment file paths: %zu", missingAttachmentFilePaths.count);
[self printPaths:orphanFilePaths.allObjects label:@"orphan file paths"];
[self printPaths:missingAttachmentFilePaths.allObjects label:@"missing attachment file paths"];
OWSLogDebug(@"%@ attachmentIds: %zu", self.logTag, allAttachmentIds.count);
OWSLogDebug(@"%@ messageAttachmentIds: %zu", self.logTag, messageAttachmentIds.count);
OWSLogDebug(@"%@ quotedReplyThumbnailAttachmentIds: %zu", self.logTag, quotedReplyThumbnailAttachmentIds.count);
OWSLogDebug(@"%@ contactShareAvatarAttachmentIds: %zu", self.logTag, contactShareAvatarAttachmentIds.count);
OWSLogDebug(@"attachmentIds: %zu", allAttachmentIds.count);
OWSLogDebug(@"messageAttachmentIds: %zu", messageAttachmentIds.count);
OWSLogDebug(@"quotedReplyThumbnailAttachmentIds: %zu", quotedReplyThumbnailAttachmentIds.count);
OWSLogDebug(@"contactShareAvatarAttachmentIds: %zu", contactShareAvatarAttachmentIds.count);
NSMutableSet<NSString *> *orphanAttachmentIds = [allAttachmentIds mutableCopy];
[orphanAttachmentIds minusSet:messageAttachmentIds];
@ -403,9 +401,9 @@ typedef void (^OrphanDataBlock)(OWSOrphanData *);
NSMutableSet<NSString *> *missingAttachmentIds = [messageAttachmentIds mutableCopy];
[missingAttachmentIds minusSet:allAttachmentIds];
OWSLogDebug(@"%@ orphan attachmentIds: %zu", self.logTag, orphanAttachmentIds.count);
OWSLogDebug(@"%@ missing attachmentIds: %zu", self.logTag, missingAttachmentIds.count);
OWSLogDebug(@"%@ orphan interactions: %zu", self.logTag, orphanInteractionIds.count);
OWSLogDebug(@"orphan attachmentIds: %zu", orphanAttachmentIds.count);
OWSLogDebug(@"missing attachmentIds: %zu", missingAttachmentIds.count);
OWSLogDebug(@"orphan interactions: %zu", orphanInteractionIds.count);
OWSOrphanData *result = [OWSOrphanData new];
result.interactionIds = [orphanInteractionIds copy];
@ -438,13 +436,13 @@ typedef void (^OrphanDataBlock)(OWSOrphanData *);
// Only clean up once per app version.
NSString *currentAppVersion = AppVersion.sharedInstance.currentAppVersion;
if (lastCleaningVersion && [lastCleaningVersion isEqualToString:currentAppVersion]) {
OWSLogVerbose(@"%@ skipping orphan data cleanup; already done on %@.", self.logTag, currentAppVersion);
OWSLogVerbose(@"skipping orphan data cleanup; already done on %@.", currentAppVersion);
return;
}
// Only clean up once per day.
if (lastCleaningDate && [DateUtil dateIsToday:lastCleaningDate]) {
OWSLogVerbose(@"%@ skipping orphan data cleanup; already done today.", self.logTag);
OWSLogVerbose(@"skipping orphan data cleanup; already done today.");
return;
}
@ -474,11 +472,11 @@ typedef void (^OrphanDataBlock)(OWSOrphanData *);
OWSAssert(databaseConnection);
if (!AppReadiness.isAppReady) {
OWSFailDebug(@"%@ can't audit orphan data until app is ready.", self.logTag);
OWSFailDebug(@"can't audit orphan data until app is ready.");
return;
}
if (!CurrentAppContext().isMainApp) {
OWSFailDebug(@"%@ can't audit orphan data in app extensions.", self.logTag);
OWSFailDebug(@"can't audit orphan data in app extensions.");
return;
}
@ -515,7 +513,7 @@ typedef void (^OrphanDataBlock)(OWSOrphanData *);
databaseConnection:databaseConnection
shouldRemoveOrphans:shouldRemoveOrphans
success:^{
OWSLogInfo(@"%@ Completed orphan data cleanup.", self.logTag);
OWSLogInfo(@"Completed orphan data cleanup.");
[databaseConnection readWriteWithBlock:^(YapDatabaseReadWriteTransaction *transaction) {
[transaction setObject:AppVersion.sharedInstance.currentAppVersion
@ -527,11 +525,11 @@ typedef void (^OrphanDataBlock)(OWSOrphanData *);
}];
}
failure:^{
OWSLogInfo(@"%@ Aborting orphan data cleanup.", self.logTag);
OWSLogInfo(@"Aborting orphan data cleanup.");
}];
}
failure:^{
OWSLogInfo(@"%@ Aborting orphan data cleanup.", self.logTag);
OWSLogInfo(@"Aborting orphan data cleanup.");
}];
}
@ -549,7 +547,7 @@ typedef void (^OrphanDataBlock)(OWSOrphanData *);
OWSAssert(orphanData);
if (remainingRetries < 1) {
OWSLogInfo(@"%@ Aborting orphan data audit.", self.logTag);
OWSLogInfo(@"Aborting orphan data audit.");
dispatch_async(self.workQueue, ^{
failure();
});
@ -606,7 +604,7 @@ typedef void (^OrphanDataBlock)(OWSOrphanData *);
[TSInteraction fetchObjectWithUniqueID:interactionId transaction:transaction];
if (!interaction) {
// This could just be a race condition, but it should be very unlikely.
OWSLogWarn(@"%@ Could not load interaction: %@", self.logTag, interactionId);
OWSLogWarn(@"Could not load interaction: %@", interactionId);
continue;
}
// Don't delete interactions which were created in the last N minutes.
@ -617,14 +615,14 @@ typedef void (^OrphanDataBlock)(OWSOrphanData *);
fabs(creationDate.timeIntervalSinceNow));
continue;
}
OWSLogInfo(@"%@ Removing orphan message: %@", self.logTag, interaction.uniqueId);
OWSLogInfo(@"Removing orphan message: %@", interaction.uniqueId);
interactionsRemoved++;
if (!shouldRemoveOrphans) {
continue;
}
[interaction removeWithTransaction:transaction];
}
OWSLogInfo(@"%@ Deleted orphan interactions: %zu", self.logTag, interactionsRemoved);
OWSLogInfo(@"Deleted orphan interactions: %zu", interactionsRemoved);
NSUInteger attachmentsRemoved = 0;
for (NSString *attachmentId in orphanData.attachmentIds) {
@ -637,7 +635,7 @@ typedef void (^OrphanDataBlock)(OWSOrphanData *);
if (!attachment) {
// This can happen on launch since we sync contacts/groups, especially if you have a lot of attachments
// to churn through, it's likely it's been deleted since starting this job.
OWSLogWarn(@"%@ Could not load attachment: %@", self.logTag, attachmentId);
OWSLogWarn(@"Could not load attachment: %@", attachmentId);
continue;
}
if (![attachment isKindOfClass:[TSAttachmentStream class]]) {
@ -652,14 +650,14 @@ typedef void (^OrphanDataBlock)(OWSOrphanData *);
fabs(creationDate.timeIntervalSinceNow));
continue;
}
OWSLogInfo(@"%@ Removing orphan attachmentStream: %@", self.logTag, attachmentStream.uniqueId);
OWSLogInfo(@"Removing orphan attachmentStream: %@", attachmentStream.uniqueId);
attachmentsRemoved++;
if (!shouldRemoveOrphans) {
continue;
}
[attachmentStream removeWithTransaction:transaction];
}
OWSLogInfo(@"%@ Deleted orphan attachments: %zu", self.logTag, attachmentsRemoved);
OWSLogInfo(@"Deleted orphan attachments: %zu", attachmentsRemoved);
}];
if (shouldAbort) {
@ -676,8 +674,8 @@ typedef void (^OrphanDataBlock)(OWSOrphanData *);
NSError *error;
NSDictionary *attributes = [[NSFileManager defaultManager] attributesOfItemAtPath:filePath error:&error];
if (!attributes || error) {
OWSLogDebug(@"%@ Could not get attributes of file at: %@", self.logTag, filePath);
OWSFailDebug(@"%@ Could not get attributes of file", self.logTag);
OWSLogDebug(@"Could not get attributes of file at: %@", filePath);
OWSFailDebug(@"Could not get attributes of file");
continue;
}
// Don't delete files which were created in the last N minutes.
@ -688,18 +686,18 @@ typedef void (^OrphanDataBlock)(OWSOrphanData *);
fabs([creationDate timeIntervalSinceNow]));
continue;
}
OWSLogInfo(@"%@ Deleting orphan attachment file: %@", self.logTag, filePath);
OWSLogInfo(@"Deleting orphan attachment file: %@", filePath);
filesRemoved++;
if (!shouldRemoveOrphans) {
continue;
}
[[NSFileManager defaultManager] removeItemAtPath:filePath error:&error];
if (error) {
OWSLogDebug(@"%@ Could not remove orphan file at: %@", self.logTag, filePath);
OWSFailDebug(@"%@ Could not remove orphan file", self.logTag);
OWSLogDebug(@"Could not remove orphan file at: %@", filePath);
OWSFailDebug(@"Could not remove orphan file");
}
}
OWSLogInfo(@"%@ Deleted orphan attachment files: %zu", self.logTag, filesRemoved);
OWSLogInfo(@"Deleted orphan attachment files: %zu", filesRemoved);
return YES;
}

View File

@ -158,22 +158,22 @@ NS_ASSUME_NONNULL_BEGIN
//
// We don't need to try to lock the screen lock;
// It will be initialized by `setupWithRootWindow`.
OWSLogVerbose(@"%@ tryToActivateScreenLockUponBecomingActive NO 0", self.logTag);
OWSLogVerbose(@"tryToActivateScreenLockUponBecomingActive NO 0");
return;
}
if (!OWSScreenLock.sharedManager.isScreenLockEnabled) {
// Screen lock is not enabled.
OWSLogVerbose(@"%@ tryToActivateScreenLockUponBecomingActive NO 1", self.logTag);
OWSLogVerbose(@"tryToActivateScreenLockUponBecomingActive NO 1");
return;
}
if (self.isScreenLockLocked) {
// Screen lock is already activated.
OWSLogVerbose(@"%@ tryToActivateScreenLockUponBecomingActive NO 2", self.logTag);
OWSLogVerbose(@"tryToActivateScreenLockUponBecomingActive NO 2");
return;
}
if (!self.screenLockCountdownDate) {
// We became inactive, but never started a countdown.
OWSLogVerbose(@"%@ tryToActivateScreenLockUponBecomingActive NO 3", self.logTag);
OWSLogVerbose(@"tryToActivateScreenLockUponBecomingActive NO 3");
return;
}
NSTimeInterval countdownInterval = fabs([self.screenLockCountdownDate timeIntervalSinceNow]);
@ -183,15 +183,11 @@ NS_ASSUME_NONNULL_BEGIN
if (countdownInterval >= screenLockTimeout) {
self.isScreenLockLocked = YES;
OWSLogVerbose(@"%@ tryToActivateScreenLockUponBecomingActive YES 4 (%0.3f >= %0.3f)",
self.logTag,
countdownInterval,
screenLockTimeout);
OWSLogVerbose(
@"tryToActivateScreenLockUponBecomingActive YES 4 (%0.3f >= %0.3f)", countdownInterval, screenLockTimeout);
} else {
OWSLogVerbose(@"%@ tryToActivateScreenLockUponBecomingActive NO 5 (%0.3f < %0.3f)",
self.logTag,
countdownInterval,
screenLockTimeout);
OWSLogVerbose(
@"tryToActivateScreenLockUponBecomingActive NO 5 (%0.3f < %0.3f)", countdownInterval, screenLockTimeout);
}
}
@ -210,7 +206,7 @@ NS_ASSUME_NONNULL_BEGIN
} else {
[self tryToActivateScreenLockBasedOnCountdown];
OWSLogInfo(@"%@ setAppIsInactiveOrBackground clear screenLockCountdownDate.", self.logTag);
OWSLogInfo(@"setAppIsInactiveOrBackground clear screenLockCountdownDate.");
self.screenLockCountdownDate = nil;
}
@ -236,10 +232,10 @@ NS_ASSUME_NONNULL_BEGIN
- (void)startScreenLockCountdownIfNecessary
{
OWSLogVerbose(@"%@ startScreenLockCountdownIfNecessary: %d", self.logTag, self.screenLockCountdownDate != nil);
OWSLogVerbose(@"startScreenLockCountdownIfNecessary: %d", self.screenLockCountdownDate != nil);
if (!self.screenLockCountdownDate) {
OWSLogInfo(@"%@ startScreenLockCountdown.", self.logTag);
OWSLogInfo(@"startScreenLockCountdown.");
self.screenLockCountdownDate = [NSDate new];
}
@ -286,13 +282,13 @@ NS_ASSUME_NONNULL_BEGIN
return;
}
OWSLogInfo(@"%@, try to unlock screen lock", self.logTag);
OWSLogInfo(@"try to unlock screen lock");
self.isShowingScreenLockUI = YES;
[OWSScreenLock.sharedManager
tryToUnlockScreenLockWithSuccess:^{
OWSLogInfo(@"%@ unlock screen lock succeeded.", self.logTag);
OWSLogInfo(@"unlock screen lock succeeded.");
self.isShowingScreenLockUI = NO;
@ -301,7 +297,7 @@ NS_ASSUME_NONNULL_BEGIN
[self ensureUI];
}
failure:^(NSError *error) {
OWSLogInfo(@"%@ unlock screen lock failed.", self.logTag);
OWSLogInfo(@"unlock screen lock failed.");
[self clearAuthUIWhenActive];
@ -310,7 +306,7 @@ NS_ASSUME_NONNULL_BEGIN
[self showScreenLockFailureAlertWithMessage:error.localizedDescription];
}
unexpectedFailure:^(NSError *error) {
OWSLogInfo(@"%@ unlock screen lock unexpectedly failed.", self.logTag);
OWSLogInfo(@"unlock screen lock unexpectedly failed.");
// Local Authentication isn't working properly.
// This isn't covered by the docs or the forums but in practice
@ -320,7 +316,7 @@ NS_ASSUME_NONNULL_BEGIN
});
}
cancel:^{
OWSLogInfo(@"%@ unlock screen lock cancelled.", self.logTag);
OWSLogInfo(@"unlock screen lock cancelled.");
[self clearAuthUIWhenActive];
@ -338,25 +334,25 @@ NS_ASSUME_NONNULL_BEGIN
{
if (self.isScreenLockLocked) {
if (self.appIsInactiveOrBackground) {
OWSLogVerbose(@"%@ desiredUIState: screen protection 1.", self.logTag);
OWSLogVerbose(@"desiredUIState: screen protection 1.");
return ScreenLockUIStateScreenProtection;
} else {
OWSLogVerbose(@"%@ desiredUIState: screen lock 2.", self.logTag);
OWSLogVerbose(@"desiredUIState: screen lock 2.");
return ScreenLockUIStateScreenLock;
}
}
if (!self.appIsInactiveOrBackground) {
// App is inactive or background.
OWSLogVerbose(@"%@ desiredUIState: none 3.", self.logTag);
OWSLogVerbose(@"desiredUIState: none 3.");
return ScreenLockUIStateNone;
}
if (Environment.preferences.screenSecurityIsEnabled) {
OWSLogVerbose(@"%@ desiredUIState: screen protection 4.", self.logTag);
OWSLogVerbose(@"desiredUIState: screen protection 4.");
return ScreenLockUIStateScreenProtection;
} else {
OWSLogVerbose(@"%@ desiredUIState: none 5.", self.logTag);
OWSLogVerbose(@"desiredUIState: none 5.");
return ScreenLockUIStateNone;
}
}
@ -467,7 +463,7 @@ NS_ASSUME_NONNULL_BEGIN
// trigger screen lock immediately if enabled.
- (void)clockDidChange:(NSNotification *)notification
{
OWSLogInfo(@"%@ clock did change", self.logTag);
OWSLogInfo(@"clock did change");
if (!AppReadiness.isAppReady) {
// It's not safe to access OWSScreenLock.isScreenLockEnabled
@ -475,7 +471,7 @@ NS_ASSUME_NONNULL_BEGIN
//
// We don't need to try to lock the screen lock;
// It will be initialized by `setupWithRootWindow`.
OWSLogVerbose(@"%@ clockDidChange 0", self.logTag);
OWSLogVerbose(@"clockDidChange 0");
return;
}
self.isScreenLockLocked = OWSScreenLock.sharedManager.isScreenLockEnabled;
@ -498,7 +494,7 @@ NS_ASSUME_NONNULL_BEGIN
return;
}
OWSLogInfo(@"%@ unlockButtonWasTapped", self.logTag);
OWSLogInfo(@"unlockButtonWasTapped");
self.didLastUnlockAttemptFail = NO;

View File

@ -196,8 +196,8 @@ typedef void (^DebugLogUploadFailure)(DebugLogUploader *uploader, NSError *error
// We'll accept any 2xx status code.
NSInteger statusCodeClass = statusCode - (statusCode % 100);
if (statusCodeClass != 200) {
OWSLogError(@"%@ statusCode: %zd, %zd", self.logTag, statusCode, statusCodeClass);
OWSLogError(@"%@ headers: %@", self.logTag, httpResponse.allHeaderFields);
OWSLogError(@"statusCode: %zd, %zd", statusCode, statusCodeClass);
OWSLogError(@"headers: %@", httpResponse.allHeaderFields);
[self failWithError:[NSError errorWithDomain:@"PastelogKit"
code:10001
userInfo:@{ NSLocalizedDescriptionKey : @"Invalid response code." }]];

View File

@ -34,10 +34,10 @@ NS_ASSUME_NONNULL_BEGIN
+ (void)reregisterWithFromViewController:(UIViewController *)fromViewController
{
OWSLogInfo(@"%@ reregisterWithSamePhoneNumber.", self.logTag);
OWSLogInfo(@"reregisterWithSamePhoneNumber.");
if (![[TSAccountManager sharedInstance] resetForReregistration]) {
OWSFailDebug(@"%@ could not reset for re-registration.", self.logTag);
OWSFailDebug(@"could not reset for re-registration.");
return;
}
@ -50,7 +50,7 @@ NS_ASSUME_NONNULL_BEGIN
[TSAccountManager
registerWithPhoneNumber:[TSAccountManager sharedInstance].reregisterationPhoneNumber
success:^{
OWSLogInfo(@"%@ re-registering: send verification code succeeded.", self.logTag);
OWSLogInfo(@"re-registering: send verification code succeeded.");
dispatch_async(dispatch_get_main_queue(), ^{
[modalActivityIndicator dismissWithCompletion:^{
@ -67,7 +67,7 @@ NS_ASSUME_NONNULL_BEGIN
});
}
failure:^(NSError *error) {
OWSLogError(@"%@ re-registering: send verification code failed.", self.logTag);
OWSLogError(@"re-registering: send verification code failed.");
dispatch_async(dispatch_get_main_queue(), ^{
[modalActivityIndicator dismissWithCompletion:^{

View File

@ -118,7 +118,7 @@ NS_ASSUME_NONNULL_BEGIN
}
if (![UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypePhotoLibrary]) {
OWSLogError(@"%@ PhotoLibrary ImagePicker source not available", self.logTag);
OWSLogError(@"PhotoLibrary ImagePicker source not available");
completionCallback(NO);
}

View File

@ -101,20 +101,19 @@ NS_ASSUME_NONNULL_BEGIN
CGFloat aspectRatio = remoteVideoSize.width / remoteVideoSize.height;
OWSLogVerbose(@"%@ Remote video size: width: %f height: %f ratio: %f",
self.logTag,
OWSLogVerbose(@"Remote video size: width: %f height: %f ratio: %f",
remoteVideoSize.width,
remoteVideoSize.height,
aspectRatio);
UIView *containingView = self.superview;
if (containingView == nil) {
OWSLogDebug(@"%@ Cannot layout video view without superview", self.logTag);
OWSLogDebug(@"Cannot layout video view without superview");
return;
}
if (![self.videoRenderer isKindOfClass:[RTCEAGLVideoView class]]) {
OWSFailDebug(@"%@ Unexpected video renderer: %@", self.logTag, self.videoRenderer);
OWSFailDebug(@"Unexpected video renderer: %@", self.videoRenderer);
return;
}

View File

@ -81,7 +81,7 @@ NS_ASSUME_NONNULL_BEGIN
YapDatabaseOptions *options = [[YapDatabaseOptions alloc] init];
options.corruptAction = YapDatabaseCorruptAction_Fail;
if (databasePassword) {
OWSLogInfo(@"%@ Using password.", self.logTag);
OWSLogInfo(@"Using password.");
options.cipherKeyBlock = ^{
return databasePassword;
};
@ -89,13 +89,13 @@ NS_ASSUME_NONNULL_BEGIN
options.enableMultiProcessSupport = YES;
if (databaseSalt) {
OWSLogInfo(@"%@ Using salt & unencrypted header.", self.logTag);
OWSLogInfo(@"Using salt & unencrypted header.");
options.cipherSaltBlock = ^{
return databaseSalt;
};
options.cipherUnencryptedHeaderLength = kSqliteHeaderLength;
} else if (databaseKeySpec) {
OWSLogInfo(@"%@ Using key spec & unencrypted header.", self.logTag);
OWSLogInfo(@"Using key spec & unencrypted header.");
options.cipherKeySpecBlock = ^{
return databaseKeySpec;
};
@ -195,7 +195,7 @@ NS_ASSUME_NONNULL_BEGIN
NSDictionary *fileAttributes =
[[NSFileManager defaultManager] attributesOfItemAtPath:databaseFilePath error:&error];
OWSAssert(fileAttributes && !error);
OWSLogVerbose(@"%@ test database file size: %@", self.logTag, fileAttributes[NSFileSize]);
OWSLogVerbose(@"test database file size: %@", fileAttributes[NSFileSize]);
}
- (BOOL)verifyTestDatabase:(NSString *)databaseFilePath
@ -233,7 +233,7 @@ NS_ASSUME_NONNULL_BEGIN
{
NSString *databaseFilePath = [OWSFileSystem temporaryFilePathWithFileExtension:@"sqlite"];
OWSLogInfo(@"%@ databaseFilePath: %@", self.logTag, databaseFilePath);
OWSLogInfo(@"databaseFilePath: %@", databaseFilePath);
[DDLog flushLog];
return databaseFilePath;
@ -319,7 +319,7 @@ NS_ASSUME_NONNULL_BEGIN
databasePassword:databasePassword
recordSaltBlock:recordSaltBlock];
if (error) {
OWSLogError(@"%s error: %@", __PRETTY_FUNCTION__, error);
OWSLogError(@"error: %@", error);
}
XCTAssertNil(error);
XCTAssertFalse([YapDatabaseCryptoUtils doesDatabaseNeedToBeConverted:databaseFilePath]);
@ -360,7 +360,7 @@ NS_ASSUME_NONNULL_BEGIN
databasePassword:databasePassword
recordSaltBlock:recordSaltBlock];
if (error) {
OWSLogError(@"%s error: %@", __PRETTY_FUNCTION__, error);
OWSLogError(@"error: %@", error);
}
XCTAssertNil(error);
XCTAssertFalse([YapDatabaseCryptoUtils doesDatabaseNeedToBeConverted:databaseFilePath]);
@ -452,7 +452,7 @@ NS_ASSUME_NONNULL_BEGIN
databasePassword:databasePassword
recordSaltBlock:recordSaltBlock];
if (error) {
OWSLogError(@"%s error: %@", __PRETTY_FUNCTION__, error);
OWSLogError(@"error: %@", error);
}
XCTAssertNil(error);
XCTAssertFalse([YapDatabaseCryptoUtils doesDatabaseNeedToBeConverted:databaseFilePath]);
@ -487,7 +487,7 @@ NS_ASSUME_NONNULL_BEGIN
YapRecordDatabaseSaltBlock recordSaltBlock = ^(NSData *saltData) {
OWSAssert(saltData);
XCTFail(@"%s No conversion should be necessary", __PRETTY_FUNCTION__);
XCTFail(@"No conversion should be necessary");
return NO;
};
@ -495,7 +495,7 @@ NS_ASSUME_NONNULL_BEGIN
databasePassword:databasePassword
recordSaltBlock:recordSaltBlock];
if (error) {
OWSLogError(@"%s error: %@", __PRETTY_FUNCTION__, error);
OWSLogError(@"error: %@", error);
}
XCTAssertNil(error);
XCTAssertFalse([YapDatabaseCryptoUtils doesDatabaseNeedToBeConverted:databaseFilePath]);
@ -520,7 +520,7 @@ NS_ASSUME_NONNULL_BEGIN
YapRecordDatabaseSaltBlock recordSaltBlock = ^(NSData *saltData) {
OWSAssert(saltData);
XCTFail(@"%s No conversion should be necessary", __PRETTY_FUNCTION__);
XCTFail(@"No conversion should be necessary");
return NO;
};
@ -528,7 +528,7 @@ NS_ASSUME_NONNULL_BEGIN
databasePassword:databasePassword
recordSaltBlock:recordSaltBlock];
if (error) {
OWSLogError(@"%s error: %@", __PRETTY_FUNCTION__, error);
OWSLogError(@"error: %@", error);
}
XCTAssertNil(error);
XCTAssertFalse([YapDatabaseCryptoUtils doesDatabaseNeedToBeConverted:databaseFilePath]);

View File

@ -41,7 +41,7 @@ NS_ASSUME_NONNULL_BEGIN
- (NSString *)contactsSectionTitle
{
OWSFailDebug(@"%s Method should never be called.", __PRETTY_FUNCTION__);
OWSFailDebug(@"Method should never be called.");
return nil;
}
@ -84,14 +84,14 @@ NS_ASSUME_NONNULL_BEGIN
- (BOOL)canSignalAccountBeSelected:(SignalAccount *)signalAccount
{
OWSFailDebug(@"%s Method should never be called.", __PRETTY_FUNCTION__);
OWSFailDebug(@"Method should never be called.");
return NO;
}
- (nullable NSString *)accessoryMessageForSignalAccount:(SignalAccount *)signalAccount
{
OWSFailDebug(@"%s Method should never be called.", __PRETTY_FUNCTION__);
OWSFailDebug(@"Method should never be called.");
return nil;
}

View File

@ -34,7 +34,7 @@ NS_ASSUME_NONNULL_BEGIN
[self pushViewController:rootViewController animated:NO];
if (![self.navigationBar isKindOfClass:[OWSNavigationBar class]]) {
OWSFailDebug(@"%@ navigationBar was unexpected class: %@", self.logTag, self.navigationBar);
OWSFailDebug(@"navigationBar was unexpected class: %@", self.navigationBar);
return self;
}

View File

@ -155,7 +155,7 @@ NS_ASSUME_NONNULL_BEGIN
NSValue *_Nullable keyboardEndFrameValue = userInfo[UIKeyboardFrameEndUserInfoKey];
if (!keyboardEndFrameValue) {
OWSFailDebug(@"%@ Missing keyboard end frame", self.logTag);
OWSFailDebug(@"Missing keyboard end frame");
return;
}

View File

@ -137,7 +137,7 @@ typedef void (^SendMessageBlock)(SendCompletionBlock completion);
NSData *data = self.attachment.data;
OWSAssert(data.length < kOversizeTextMessageSizeThreshold);
NSString *_Nullable messageText = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];
OWSLogVerbose(@"%@ messageTextForAttachment: %@", self.logTag, messageText);
OWSLogVerbose(@"messageTextForAttachment: %@", messageText);
return [messageText filterStringForDisplay];
}
@ -182,7 +182,7 @@ typedef void (^SendMessageBlock)(SendCompletionBlock completion);
Contact *_Nullable contact = [[Contact alloc] initWithSystemContact:cnContact];
OWSContact *_Nullable contactShareRecord = [OWSContacts contactForSystemContact:cnContact];
if (!contactShareRecord) {
OWSLogError(@"%@ Could not convert system contact.", self.logTag);
OWSLogError(@"Could not convert system contact.");
return;
}
@ -212,13 +212,13 @@ typedef void (^SendMessageBlock)(SendCompletionBlock completion);
// override
- (void)dismissPressed:(id)sender
{
OWSLogDebug(@"%@ tapped dismiss share button", self.logTag);
OWSLogDebug(@"tapped dismiss share button");
[self cancelShareExperience];
}
- (void)didTapCancelShareButton
{
OWSLogDebug(@"%@ tapped cancel share button", self.logTag);
OWSLogDebug(@"tapped cancel share button");
[self cancelShareExperience];
}
@ -372,7 +372,7 @@ typedef void (^SendMessageBlock)(SendCompletionBlock completion);
[fromViewController
dismissViewControllerAnimated:YES
completion:^(void) {
OWSLogInfo(@"%@ Sending message failed with error: %@", self.logTag, error);
OWSLogInfo(@"Sending message failed with error: %@", error);
[self showSendFailureAlertWithError:error
message:message
fromViewController:fromViewController];
@ -380,7 +380,7 @@ typedef void (^SendMessageBlock)(SendCompletionBlock completion);
return;
}
OWSLogInfo(@"%@ Sending message succeeded.", self.logTag);
OWSLogInfo(@"Sending message succeeded.");
[self.shareViewDelegate shareViewWasCompleted];
});
};
@ -437,7 +437,7 @@ typedef void (^SendMessageBlock)(SendCompletionBlock completion);
} else {
// This shouldn't happen, but if it does we won't offer the user the ability to confirm.
// They may have to return to the main app to accept the identity change.
OWSFailDebug(@"%@ Untrusted recipient error is missing recipient id.", self.logTag);
OWSFailDebug(@"Untrusted recipient error is missing recipient id.");
}
[fromViewController presentViewController:failureAlert animated:YES completion:nil];
@ -476,7 +476,7 @@ typedef void (^SendMessageBlock)(SendCompletionBlock completion);
OWSAssert(recipientId.length > 0);
OWSAssert(fromViewController);
OWSLogDebug(@"%@ Confirming identity for recipient: %@", self.logTag, recipientId);
OWSLogDebug(@"Confirming identity for recipient: %@", recipientId);
[OWSPrimaryStorage.sharedManager.newDatabaseConnection asyncReadWriteWithBlock:^(
YapDatabaseReadWriteTransaction *transaction) {
@ -484,7 +484,7 @@ typedef void (^SendMessageBlock)(SendCompletionBlock completion);
[[OWSIdentityManager sharedManager] verificationStateForRecipientId:recipientId transaction:transaction];
switch (verificationState) {
case OWSVerificationStateVerified: {
OWSFailDebug(@"%@ Shouldn't need to confirm identity if it was already verified", self.logTag);
OWSFailDebug(@"Shouldn't need to confirm identity if it was already verified");
break;
}
case OWSVerificationStateDefault: {
@ -493,11 +493,11 @@ typedef void (^SendMessageBlock)(SendCompletionBlock completion);
// We don't want to redundantly set status to "default" because we would create a
// "You marked Alice as unverified" notice, which wouldn't make sense if Alice was never
// marked as "Verified".
OWSLogInfo(@"%@ recipient has acceptable verification status. Next send will succeed.", self.logTag);
OWSLogInfo(@"recipient has acceptable verification status. Next send will succeed.");
break;
}
case OWSVerificationStateNoLongerVerified: {
OWSLogInfo(@"%@ marked recipient: %@ as default verification status.", self.logTag, recipientId);
OWSLogInfo(@"marked recipient: %@ as default verification status.", recipientId);
NSData *identityKey =
[[OWSIdentityManager sharedManager] identityKeyForRecipientId:recipientId transaction:transaction];
OWSAssert(identityKey);
@ -540,7 +540,7 @@ typedef void (^SendMessageBlock)(SendCompletionBlock completion);
completion:^(void) {
[self.messageSender enqueueMessage:message
success:^(void) {
OWSLogInfo(@"%@ Resending attachment succeeded.", self.logTag);
OWSLogInfo(@"Resending attachment succeeded.");
dispatch_async(dispatch_get_main_queue(), ^(void) {
[self.shareViewDelegate shareViewWasCompleted];
});
@ -550,9 +550,8 @@ typedef void (^SendMessageBlock)(SendCompletionBlock completion);
[fromViewController
dismissViewControllerAnimated:YES
completion:^(void) {
OWSLogInfo(@"%@ Sending attachment failed with error: %@",
self.logTag,
error);
OWSLogInfo(
@"Sending attachment failed with error: %@", error);
[self showSendFailureAlertWithError:error
message:message
fromViewController:fromViewController];
@ -564,18 +563,18 @@ typedef void (^SendMessageBlock)(SendCompletionBlock completion);
- (void)attachmentUploadProgress:(NSNotification *)notification
{
OWSLogDebug(@"%@ upload progress.", self.logTag);
OWSLogDebug(@"upload progress.");
OWSAssertIsOnMainThread();
OWSAssert(self.progressView);
if (!self.outgoingMessage) {
OWSLogDebug(@"%@ Ignoring upload progress until there is an outgoing message.", self.logTag);
OWSLogDebug(@"Ignoring upload progress until there is an outgoing message.");
return;
}
NSString *_Nullable attachmentRecordId = self.outgoingMessage.attachmentIds.firstObject;
if (!attachmentRecordId) {
OWSLogDebug(@"%@ Ignoring upload progress until outgoing message has an attachment record id", self.logTag);
OWSLogDebug(@"Ignoring upload progress until outgoing message has an attachment record id");
return;
}
@ -587,7 +586,7 @@ typedef void (^SendMessageBlock)(SendCompletionBlock completion);
if (!isnan(progress)) {
[self.progressView setProgress:progress animated:YES];
} else {
OWSFailDebug(@"%@ Invalid attachment progress.", self.logTag);
OWSFailDebug(@"Invalid attachment progress.");
}
}
}

View File

@ -123,7 +123,7 @@ NS_ASSUME_NONNULL_BEGIN
TSMessage *message = (TSMessage *)conversationItem.interaction;
if (![message isKindOfClass:[TSMessage class]]) {
OWSFailDebug(@"%@ unexpected reply message: %@", self.logTag, message);
OWSFailDebug(@"unexpected reply message: %@", message);
return nil;
}
@ -138,7 +138,7 @@ NS_ASSUME_NONNULL_BEGIN
} else if ([message isKindOfClass:[TSIncomingMessage class]]) {
return [(TSIncomingMessage *)message authorId];
} else {
OWSFailDebug(@"%@ Unexpected message type: %@", self.logTag, message.class);
OWSFailDebug(@"Unexpected message type: %@", message.class);
return (NSString * _Nullable) nil;
}
}();
@ -208,7 +208,7 @@ NS_ASSUME_NONNULL_BEGIN
if ([truncatedText dataUsingEncoding:NSUTF8StringEncoding].length < kOversizeTextMessageSizeThreshold) {
quotedText = truncatedText;
} else {
OWSFailDebug(@"%@ Missing valid text snippet.", self.logTag);
OWSFailDebug(@"Missing valid text snippet.");
}
}
} else {
@ -218,7 +218,7 @@ NS_ASSUME_NONNULL_BEGIN
}
if (!hasText && !hasAttachment) {
OWSFailDebug(@"%@ quoted message has neither text nor attachment", self.logTag);
OWSFailDebug(@"quoted message has neither text nor attachment");
quotedText = @"";
hasText = YES;
}

View File

@ -180,14 +180,14 @@ const CGFloat kContactCellAvatarTextMargin = 12;
{
OWSContactsManager *contactsManager = self.contactsManager;
if (contactsManager == nil) {
OWSFailDebug(@"%@ contactsManager should not be nil", self.logTag);
OWSFailDebug(@"contactsManager should not be nil");
self.avatarView.image = nil;
return;
}
NSString *recipientId = self.recipientId;
if (recipientId.length == 0) {
OWSFailDebug(@"%@ recipientId should not be nil", self.logTag);
OWSFailDebug(@"recipientId should not be nil");
self.avatarView.image = nil;
return;
}
@ -212,14 +212,14 @@ const CGFloat kContactCellAvatarTextMargin = 12;
{
OWSContactsManager *contactsManager = self.contactsManager;
if (contactsManager == nil) {
OWSFailDebug(@"%@ contactsManager should not be nil", self.logTag);
OWSFailDebug(@"contactsManager should not be nil");
self.profileNameLabel.text = nil;
return;
}
NSString *recipientId = self.recipientId;
if (recipientId.length == 0) {
OWSFailDebug(@"%@ recipientId should not be nil", self.logTag);
OWSFailDebug(@"recipientId should not be nil");
self.profileNameLabel.text = nil;
return;
}

View File

@ -37,7 +37,7 @@ NS_ASSUME_NONNULL_BEGIN
- (void)setAccessoryView:(nullable UIView *)accessoryView
{
OWSFailDebug(@"%@ use ows_setAccessoryView instead.", self.logTag);
OWSFailDebug(@"use ows_setAccessoryView instead.");
}
- (void)configure

View File

@ -322,7 +322,7 @@ NS_ASSUME_NONNULL_BEGIN
if (!self.contactsManager.supportsContactEditing) {
// Should not expose UI that lets the user get here.
OWSFailDebug(@"%@ Contact editing not supported.", self.logTag);
OWSFailDebug(@"Contact editing not supported.");
return;
}

View File

@ -75,9 +75,9 @@ NS_ASSUME_NONNULL_BEGIN
NSError *__nullable activityError) {
if (activityError) {
OWSLogInfo(@"%@ Failed to share with activityError: %@", self.logTag, activityError);
OWSLogInfo(@"Failed to share with activityError: %@", activityError);
} else if (completed) {
OWSLogInfo(@"%@ Did share with activityType: %@", self.logTag, activityType);
OWSLogInfo(@"Did share with activityType: %@", activityType);
}
if (completion) {

View File

@ -499,7 +499,7 @@ CGFloat ScaleFromIPhone5(CGFloat iPhone5Value)
- (void)logHierarchyUpwardLaterWithLabel:(NSString *)label
{
dispatch_async(dispatch_get_main_queue(), ^{
OWSLogVerbose(@"%@ %@ ----", self.logTag, label);
OWSLogVerbose(@"%@ ----", label);
});
UIResponder *responder = self;

View File

@ -302,17 +302,15 @@ NSString *const OWSContactsManagerKeyNextFullIntersectionDate = @"OWSContactsMan
OWSAssert(recipientIdsForIntersection);
if (recipientIdsForIntersection.count < 1) {
OWSLogInfo(@"%@ Skipping intersection; no contacts to intersect.", self.logTag);
OWSLogInfo(@"Skipping intersection; no contacts to intersect.");
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
completion(nil);
});
return;
} else if (isFullIntersection) {
OWSLogInfo(
@"%@ Doing full intersection with %zu contacts.", self.logTag, recipientIdsForIntersection.count);
OWSLogInfo(@"Doing full intersection with %zu contacts.", recipientIdsForIntersection.count);
} else {
OWSLogInfo(
@"%@ Doing delta intersection with %zu contacts.", self.logTag, recipientIdsForIntersection.count);
OWSLogInfo(@"Doing delta intersection with %zu contacts.", recipientIdsForIntersection.count);
}
[self intersectContacts:recipientIdsForIntersection
@ -363,7 +361,7 @@ NSString *const OWSContactsManagerKeyNextFullIntersectionDate = @"OWSContactsMan
OWSAssert(failureParameter);
void (^success)(NSArray<SignalRecipient *> *) = ^(NSArray<SignalRecipient *> *registeredRecipientIds) {
OWSLogInfo(@"%@ Successfully intersected contacts.", self.logTag);
OWSLogInfo(@"Successfully intersected contacts.");
successParameter([NSSet setWithArray:registeredRecipientIds]);
};
void (^failure)(NSError *) = ^(NSError *error) {
@ -374,7 +372,7 @@ NSString *const OWSContactsManagerKeyNextFullIntersectionDate = @"OWSContactsMan
return;
}
OWSLogWarn(@"%@ Failed to intersect contacts with error: %@. Rescheduling", self.logTag, error);
OWSLogWarn(@"Failed to intersect contacts with error: %@. Rescheduling", error);
// Retry with exponential backoff.
//
@ -517,14 +515,14 @@ NSString *const OWSContactsManagerKeyNextFullIntersectionDate = @"OWSContactsMan
[self.dbWriteConnection readWriteWithBlock:^(YapDatabaseReadWriteTransaction *_Nonnull transaction) {
OWSLogInfo(@"%@ Saving %lu SignalAccounts", self.logTag, (unsigned long)accountsToSave.count);
for (SignalAccount *signalAccount in accountsToSave) {
OWSLogVerbose(@"%@ Saving SignalAccount: %@", self.logTag, signalAccount);
OWSLogVerbose(@"Saving SignalAccount: %@", signalAccount);
[signalAccount saveWithTransaction:transaction];
}
if (shouldClearStaleCache) {
OWSLogInfo(@"%@ Removing %lu old SignalAccounts.", self.logTag, (unsigned long)oldSignalAccounts.count);
for (SignalAccount *signalAccount in oldSignalAccounts.allValues) {
OWSLogVerbose(@"%@ Removing old SignalAccount: %@", self.logTag, signalAccount);
OWSLogVerbose(@"Removing old SignalAccount: %@", signalAccount);
[signalAccount removeWithTransaction:transaction];
}
} else {
@ -539,8 +537,7 @@ NSString *const OWSContactsManagerKeyNextFullIntersectionDate = @"OWSContactsMan
self.logTag,
(unsigned long)oldSignalAccounts.count);
for (SignalAccount *signalAccount in oldSignalAccounts.allValues) {
OWSLogVerbose(
@"%@ Ensuring old SignalAccount is not inadvertently lost: %@", self.logTag, signalAccount);
OWSLogVerbose(@"Ensuring old SignalAccount is not inadvertently lost: %@", signalAccount);
[signalAccounts addObject:signalAccount];
}
@ -592,7 +589,7 @@ NSString *const OWSContactsManagerKeyNextFullIntersectionDate = @"OWSContactsMan
SignalAccount *_Nullable signalAccount = [self fetchSignalAccountForRecipientId:recipientId];
if (!signalAccount) {
// search system contacts for no-longer-registered signal users, for which there will be no SignalAccount
OWSLogDebug(@"%@ no signal account", self.logTag);
OWSLogDebug(@"no signal account");
Contact *_Nullable nonSignalContact = self.allContactsMap[recipientId];
if (!nonSignalContact) {
return nil;

View File

@ -133,7 +133,7 @@ NSString *const kOWSPrimaryStorageOWSContactsSyncingLastMessageKey
}];
if (!messageData) {
OWSFailDebug(@"%@ Failed to serialize contacts sync message.", self.logTag);
OWSFailDebug(@"Failed to serialize contacts sync message.");
return;
}
@ -149,7 +149,7 @@ NSString *const kOWSPrimaryStorageOWSContactsSyncingLastMessageKey
contentType:OWSMimeTypeApplicationOctetStream
inMessage:syncContactsMessage
success:^{
OWSLogInfo(@"%@ Successfully sent contacts sync message.", self.logTag);
OWSLogInfo(@"Successfully sent contacts sync message.");
[self.editingDatabaseConnection setObject:messageData
forKey:kOWSPrimaryStorageOWSContactsSyncingLastMessageKey
@ -160,7 +160,7 @@ NSString *const kOWSPrimaryStorageOWSContactsSyncingLastMessageKey
});
}
failure:^(NSError *error) {
OWSLogError(@"%@ Failed to send contacts sync message with error: %@", self.logTag, error);
OWSLogError(@"Failed to send contacts sync message with error: %@", error);
dispatch_async(self.serialQueue, ^{
self.isRequestInFlight = NO;

View File

@ -34,7 +34,7 @@ NSString *const kOWSSoundsStorageGlobalNotificationKey = @"kOWSSoundsStorageGlob
return self;
}
OWSLogDebug(@"%@ creating system sound for %@", self.logTag, url.lastPathComponent);
OWSLogDebug(@"creating system sound for %@", url.lastPathComponent);
_soundURL = url;
SystemSoundID newSoundID;
@ -48,7 +48,7 @@ NSString *const kOWSSoundsStorageGlobalNotificationKey = @"kOWSSoundsStorageGlob
- (void)dealloc
{
OWSLogDebug(@"%@ in dealloc disposing sound: %@", self.logTag, _soundURL.lastPathComponent);
OWSLogDebug(@"in dealloc disposing sound: %@", _soundURL.lastPathComponent);
OSStatus status = AudioServicesDisposeSystemSoundID(_soundID);
OWSAssert(status == kAudioServicesNoError);
}
@ -130,7 +130,7 @@ NSString *const kOWSSoundsStorageGlobalNotificationKey = @"kOWSSoundsStorageGlob
// TODO: Should we localize these sound names?
switch (sound) {
case OWSSound_Default:
OWSFailDebug(@"%@ invalid argument.", self.logTag);
OWSFailDebug(@"invalid argument.");
return @"";
// Notification Sounds
@ -192,7 +192,7 @@ NSString *const kOWSSoundsStorageGlobalNotificationKey = @"kOWSSoundsStorageGlob
{
switch (sound) {
case OWSSound_Default:
OWSFailDebug(@"%@ invalid argument.", self.logTag);
OWSFailDebug(@"invalid argument.");
return @"";
// Notification Sounds
@ -316,7 +316,7 @@ NSString *const kOWSSoundsStorageGlobalNotificationKey = @"kOWSSoundsStorageGlob
{
OWSAssert(transaction);
OWSLogInfo(@"%@ Setting global notification sound to: %@", self.logTag, [[self class] displayNameForSound:sound]);
OWSLogInfo(@"Setting global notification sound to: %@", [[self class] displayNameForSound:sound]);
// Fallback push notifications play a sound specified by the server, but we don't want to store this configuration
// on the server. Instead, we create a file with the same name as the default to be played when receiving
@ -328,7 +328,7 @@ NSString *const kOWSSoundsStorageGlobalNotificationKey = @"kOWSSoundsStorageGlob
NSString *kDefaultNotificationSoundFilename = @"NewMessage.aifc";
NSString *defaultSoundPath = [dirPath stringByAppendingPathComponent:kDefaultNotificationSoundFilename];
OWSLogDebug(@"%@ writing new default sound to %@", self.logTag, defaultSoundPath);
OWSLogDebug(@"writing new default sound to %@", defaultSoundPath);
NSURL *_Nullable soundURL = [OWSSounds soundURLForSound:sound quiet:NO];
@ -350,8 +350,7 @@ NSString *const kOWSSoundsStorageGlobalNotificationKey = @"kOWSSoundsStorageGlob
[OWSFileSystem protectFileOrFolderAtPath:defaultSoundPath fileProtectionType:NSFileProtectionNone];
if (!success) {
OWSFailDebug(
@"%@ Unable to write new default sound data from: %@ to :%@", self.logTag, soundURL, defaultSoundPath);
OWSFailDebug(@"Unable to write new default sound data from: %@ to :%@", soundURL, defaultSoundPath);
return;
}

View File

@ -43,10 +43,7 @@ NS_ASSUME_NONNULL_BEGIN
NSString *previousVersion = AppVersion.sharedInstance.lastAppVersion;
NSString *currentVersion = AppVersion.sharedInstance.currentAppVersion;
OWSLogInfo(@"%@ Checking migrations. currentVersion: %@, lastRanVersion: %@",
self.logTag,
currentVersion,
previousVersion);
OWSLogInfo(@"Checking migrations. currentVersion: %@, lastRanVersion: %@", currentVersion, previousVersion);
if (!previousVersion) {
OWSLogInfo(@"No previous version found. Probably first launch since install - nothing to migrate.");

View File

@ -29,18 +29,18 @@ static NSString *const OWS102MoveLoggingPreferenceToUserDefaultsMigrationId = @"
[transaction objectForKey:OWSPreferencesKeyEnableDebugLog inCollection:OWSPreferencesSignalDatabaseCollection];
if (existingValue) {
OWSLogInfo(@"%@ assigning existing value: %@", self.logTag, existingValue);
OWSLogInfo(@"assigning existing value: %@", existingValue);
[OWSPreferences setIsLoggingEnabled:[existingValue boolValue]];
if (![existingValue boolValue]) {
OWSLogInfo(@"%@ Disabling file logger after one-time log settings migration.", self.logTag);
OWSLogInfo(@"Disabling file logger after one-time log settings migration.");
// Since we're migrating, we didn't have the appropriate value on startup, and incorrectly started logging.
[DebugLogger.sharedLogger disableFileLogging];
} else {
OWSLogInfo(@"%@ Continuing to log after one-time log settings migration.", self.logTag);
OWSLogInfo(@"Continuing to log after one-time log settings migration.");
}
} else {
OWSLogInfo(@"%@ not assigning any value, since no previous value was stored.", self.logTag);
OWSLogInfo(@"not assigning any value, since no previous value was stored.");
}
}

View File

@ -22,13 +22,13 @@ static NSString *const OWS103EnableVideoCallingMigrationId = @"103";
{
OWSAssert(completion);
OWSLogWarn(@"%@ running migration...", self.logTag);
OWSLogWarn(@"running migration...");
if ([TSAccountManager isRegistered]) {
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
TSRequest *request = [OWSRequestFactory updateAttributesRequestWithManualMessageFetching:NO];
[[TSNetworkManager sharedManager] makeRequest:request
success:^(NSURLSessionDataTask *task, id responseObject) {
OWSLogInfo(@"%@ successfully ran", self.logTag);
OWSLogInfo(@"successfully ran");
[self save];
completion();
@ -37,14 +37,14 @@ static NSString *const OWS103EnableVideoCallingMigrationId = @"103";
if (!IsNSErrorNetworkFailure(error)) {
OWSProdError([OWSAnalyticsEvents errorEnableVideoCallingRequestFailed]);
}
OWSLogError(@"%@ failed with error: %@", self.logTag, error);
OWSLogError(@"failed with error: %@", error);
completion();
}];
});
} else {
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
OWSLogInfo(@"%@ skipping; not registered", self.logTag);
OWSLogInfo(@"skipping; not registered");
[self save];
completion();

View File

@ -35,8 +35,7 @@ static NSString *const OWS104CreateRecipientIdentitiesMigrationId = @"104";
usingBlock:^(NSString *_Nonnull recipientId, id _Nonnull object, BOOL *_Nonnull stop) {
if (![object isKindOfClass:[NSData class]]) {
OWSFailDebug(
@"%@ Unexpected object in trusted keys collection key: %@ object: %@",
self.logTag,
@"Unexpected object in trusted keys collection key: %@ object: %@",
recipientId,
[object class]);
return;
@ -47,7 +46,7 @@ static NSString *const OWS104CreateRecipientIdentitiesMigrationId = @"104";
[identityKeys enumerateKeysAndObjectsUsingBlock:^(
NSString *_Nonnull recipientId, NSData *_Nonnull identityKey, BOOL *_Nonnull stop) {
OWSLogInfo(@"%@ Migrating identity key for recipient: %@", self.logTag, recipientId);
OWSLogInfo(@"Migrating identity key for recipient: %@", recipientId);
[[[OWSRecipientIdentity alloc] initWithRecipientId:recipientId
identityKey:identityKey
isFirstKnownKey:NO

View File

@ -11,7 +11,7 @@ NS_ASSUME_NONNULL_BEGIN
- (void)saveWithTransaction:(YapDatabaseReadWriteTransaction *)transaction
{
OWSLogInfo(@"%@ marking migration as complete.", self.logTag);
OWSLogInfo(@"marking migration as complete.");
[super saveWithTransaction:transaction];
}

View File

@ -51,7 +51,7 @@ NS_ASSUME_NONNULL_BEGIN
- (void)assumeAllExistingMigrationsRun
{
for (OWSDatabaseMigration *migration in self.allMigrations) {
OWSLogInfo(@"%@ Skipping migration on new install: %@", self.logTag, migration);
OWSLogInfo(@"Skipping migration on new install: %@", migration);
[migration save];
}
}
@ -89,9 +89,9 @@ NS_ASSUME_NONNULL_BEGIN
return;
}
OWSLogInfo(@"%@ Running migration: %@", self.logTag, migration);
OWSLogInfo(@"Running migration: %@", migration);
[migration runUpWithCompletion:^{
OWSLogInfo(@"%@ Migration complete: %@", self.logTag, migration);
OWSLogInfo(@"Migration complete: %@", migration);
[self runMigrations:migrations completion:completion];
}];
}

View File

@ -45,7 +45,7 @@ NS_ASSUME_NONNULL_BEGIN
OWSAssert(dbConnection);
OWSAssert(completion);
OWSLogVerbose(@"%@ %s: %lu", self.logTag, __PRETTY_FUNCTION__, (unsigned long)recordIds.count);
OWSLogVerbose(@"%lu", (unsigned long)recordIds.count);
if (recordIds.count < 1) {
completion();

View File

@ -198,14 +198,14 @@ const NSUInteger kOWSProfileManager_MaxAvatarDiameter = 640;
// Ensure that the success and failure blocks are called on the main thread.
void (^failureBlock)(void) = ^{
OWSLogError(@"%@ Updating service with profile failed.", self.logTag);
OWSLogError(@"Updating service with profile failed.");
dispatch_async(dispatch_get_main_queue(), ^{
failureBlockParameter();
});
};
void (^successBlock)(void) = ^{
OWSLogInfo(@"%@ Successfully updated service with profile.", self.logTag);
OWSLogInfo(@"Successfully updated service with profile.");
dispatch_async(dispatch_get_main_queue(), ^{
successBlockParameter();
@ -255,11 +255,11 @@ const NSUInteger kOWSProfileManager_MaxAvatarDiameter = 640;
OWSAssert(userProfile.avatarUrlPath.length > 0);
OWSAssert(userProfile.avatarFileName.length > 0);
OWSLogVerbose(@"%@ Updating local profile on service with unchanged avatar.", self.logTag);
OWSLogVerbose(@"Updating local profile on service with unchanged avatar.");
// If the avatar hasn't changed, reuse the existing metadata.
tryToUpdateService(userProfile.avatarUrlPath, userProfile.avatarFileName);
} else {
OWSLogVerbose(@"%@ Updating local profile on service with new avatar.", self.logTag);
OWSLogVerbose(@"Updating local profile on service with new avatar.");
[self writeAvatarToDisk:avatarImage
success:^(NSData *data, NSString *fileName) {
[self uploadAvatarToService:data
@ -275,7 +275,7 @@ const NSUInteger kOWSProfileManager_MaxAvatarDiameter = 640;
}];
}
} else if (userProfile.avatarUrlPath) {
OWSLogVerbose(@"%@ Updating local profile on service with cleared avatar.", self.logTag);
OWSLogVerbose(@"Updating local profile on service with cleared avatar.");
[self uploadAvatarToService:nil
success:^(NSString *_Nullable avatarUrlPath) {
tryToUpdateService(nil, nil);
@ -284,7 +284,7 @@ const NSUInteger kOWSProfileManager_MaxAvatarDiameter = 640;
failureBlock();
}];
} else {
OWSLogVerbose(@"%@ Updating local profile on service with no avatar.", self.logTag);
OWSLogVerbose(@"Updating local profile on service with no avatar.");
tryToUpdateService(nil, nil);
}
}
@ -372,7 +372,7 @@ const NSUInteger kOWSProfileManager_MaxAvatarDiameter = 640;
clearLocalAvatar();
if (avatarData == nil) {
OWSLogDebug(@"%@ successfully cleared avatar", self.logTag);
OWSLogDebug(@"successfully cleared avatar");
successBlock(nil);
return;
}
@ -452,18 +452,17 @@ const NSUInteger kOWSProfileManager_MaxAvatarDiameter = 640;
OWSAssert(encryptedAvatarData.length > 0);
[formData appendPartWithFormData:encryptedAvatarData name:@"file"];
OWSLogVerbose(@"%@ constructed body", self.logTag);
OWSLogVerbose(@"constructed body");
}
progress:^(NSProgress *_Nonnull uploadProgress) {
OWSLogVerbose(
@"%@ avatar upload progress: %.2f%%", self.logTag, uploadProgress.fractionCompleted * 100);
OWSLogVerbose(@"avatar upload progress: %.2f%%", uploadProgress.fractionCompleted * 100);
}
success:^(NSURLSessionDataTask *_Nonnull uploadTask, id _Nullable responseObject) {
OWSLogInfo(@"%@ successfully uploaded avatar with key: %@", self.logTag, formKey);
OWSLogInfo(@"successfully uploaded avatar with key: %@", formKey);
successBlock(formKey);
}
failure:^(NSURLSessionDataTask *_Nullable uploadTask, NSError *_Nonnull error) {
OWSLogError(@"%@ uploading avatar failed with error: %@", self.logTag, error);
OWSLogError(@"uploading avatar failed with error: %@", error);
failureBlock();
}];
}
@ -474,7 +473,7 @@ const NSUInteger kOWSProfileManager_MaxAvatarDiameter = 640;
clearLocalAvatar();
}
OWSLogError(@"%@ Failed to get profile avatar upload form: %@", self.logTag, error);
OWSLogError(@"Failed to get profile avatar upload form: %@", error);
failureBlock();
}];
});
@ -496,7 +495,7 @@ const NSUInteger kOWSProfileManager_MaxAvatarDiameter = 640;
successBlock();
}
failure:^(NSURLSessionDataTask *task, NSError *error) {
OWSLogError(@"%@ Failed to update profile with error: %@", self.logTag, error);
OWSLogError(@"Failed to update profile with error: %@", error);
failureBlock();
}];
});
@ -517,7 +516,7 @@ const NSUInteger kOWSProfileManager_MaxAvatarDiameter = 640;
- (void)clearProfileWhitelist
{
OWSLogWarn(@"%@ Clearing the profile whitelist.", self.logTag);
OWSLogWarn(@"Clearing the profile whitelist.");
[self.dbConnection asyncReadWriteWithBlock:^(YapDatabaseReadWriteTransaction *transaction) {
[transaction removeAllObjectsInCollection:kOWSProfileManager_UserWhitelistCollection];
@ -804,7 +803,7 @@ const NSUInteger kOWSProfileManager_MaxAvatarDiameter = 640;
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
if (userProfile.avatarUrlPath.length < 1) {
OWSFailDebug(@"%@ Malformed avatar URL: %@", self.logTag, userProfile.avatarUrlPath);
OWSFailDebug(@"Malformed avatar URL: %@", userProfile.avatarUrlPath);
return;
}
NSString *_Nullable avatarUrlPathAtStart = userProfile.avatarUrlPath;
@ -827,7 +826,7 @@ const NSUInteger kOWSProfileManager_MaxAvatarDiameter = 640;
[self.currentAvatarDownloads addObject:userProfile.recipientId];
}
OWSLogVerbose(@"%@ downloading profile avatar: %@", self.logTag, userProfile.uniqueId);
OWSLogVerbose(@"downloading profile avatar: %@", userProfile.uniqueId);
NSString *tempDirectory = NSTemporaryDirectory();
NSString *tempFilePath = [tempDirectory stringByAppendingPathComponent:fileName];
@ -856,20 +855,20 @@ const NSUInteger kOWSProfileManager_MaxAvatarDiameter = 640;
dbConnection:self.dbConnection];
if (latestUserProfile.profileKey.keyData.length < 1
|| ![latestUserProfile.profileKey isEqual:userProfile.profileKey]) {
OWSLogWarn(@"%@ Ignoring avatar download for obsolete user profile.", self.logTag);
OWSLogWarn(@"Ignoring avatar download for obsolete user profile.");
} else if (![avatarUrlPathAtStart isEqualToString:latestUserProfile.avatarUrlPath]) {
OWSLogInfo(@"%@ avatar url has changed during download", self.logTag);
OWSLogInfo(@"avatar url has changed during download");
if (latestUserProfile.avatarUrlPath.length > 0) {
[self downloadAvatarForUserProfile:latestUserProfile];
}
} else if (error) {
OWSLogError(@"%@ avatar download failed: %@", self.logTag, error);
OWSLogError(@"avatar download failed: %@", error);
} else if (!encryptedData) {
OWSLogError(@"%@ avatar encrypted data could not be read.", self.logTag);
OWSLogError(@"avatar encrypted data could not be read.");
} else if (!decryptedData) {
OWSLogError(@"%@ avatar data could not be decrypted.", self.logTag);
OWSLogError(@"avatar data could not be decrypted.");
} else if (!image) {
OWSLogError(@"%@ avatar image could not be loaded: %@", self.logTag, error);
OWSLogError(@"avatar image could not be loaded: %@", error);
} else {
[self updateProfileAvatarCache:image filename:fileName];
@ -897,10 +896,8 @@ const NSUInteger kOWSProfileManager_MaxAvatarDiameter = 640;
NSURLRequest *request = [NSURLRequest requestWithURL:avatarUrlPath];
NSURLSessionDownloadTask *downloadTask = [self.avatarHTTPManager downloadTaskWithRequest:request
progress:^(NSProgress *_Nonnull downloadProgress) {
OWSLogVerbose(@"%@ Downloading avatar for %@ %f",
self.logTag,
userProfile.recipientId,
downloadProgress.fractionCompleted);
OWSLogVerbose(
@"Downloading avatar for %@ %f", userProfile.recipientId, downloadProgress.fractionCompleted);
}
destination:^NSURL *_Nonnull(NSURL *_Nonnull targetPath, NSURLResponse *_Nonnull response) {
return [NSURL fileURLWithPath:tempFilePath];
@ -916,11 +913,7 @@ const NSUInteger kOWSProfileManager_MaxAvatarDiameter = 640;
{
OWSAssert(recipientId.length > 0);
OWSLogDebug(@"%@ update profile for: %@ name: %@ avatar: %@",
self.logTag,
recipientId,
profileNameEncrypted,
avatarUrlPath);
OWSLogDebug(@"update profile for: %@ name: %@ avatar: %@", recipientId, profileNameEncrypted, avatarUrlPath);
// Ensure decryption, etc. off main thread.
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
@ -1150,8 +1143,7 @@ const NSUInteger kOWSProfileManager_MaxAvatarDiameter = 640;
BOOL isFeatureEnabled = NO;
if (!isFeatureEnabled) {
OWSLogWarn(
@"%@ skipping sending profile-key message because the feature is not yet fully available.", self.logTag);
OWSLogWarn(@"skipping sending profile-key message because the feature is not yet fully available.");
[OWSProfileManager.sharedManager addThreadToProfileWhitelist:thread];
successHandler();
return;
@ -1159,7 +1151,7 @@ const NSUInteger kOWSProfileManager_MaxAvatarDiameter = 640;
[self.messageSender enqueueMessage:message
success:^{
OWSLogInfo(@"%@ Successfully sent profile key message to thread: %@", self.logTag, thread);
OWSLogInfo(@"Successfully sent profile key message to thread: %@", thread);
[OWSProfileManager.sharedManager addThreadToProfileWhitelist:thread];
dispatch_async(dispatch_get_main_queue(), ^{
@ -1168,7 +1160,7 @@ const NSUInteger kOWSProfileManager_MaxAvatarDiameter = 640;
}
failure:^(NSError *_Nonnull error) {
dispatch_async(dispatch_get_main_queue(), ^{
OWSLogError(@"%@ Failed to send profile key message to thread: %@", self.logTag, thread);
OWSLogError(@"Failed to send profile key message to thread: %@", thread);
});
}];
}

View File

@ -184,8 +184,7 @@ NSString *const kLocalProfileUniqueId = @"kLocalProfileUniqueId";
NSDictionary *afterSnapshot = [latestInstance.dictionaryValue copy];
if ([beforeSnapshot isEqual:afterSnapshot]) {
OWSLogVerbose(
@"%@ Ignoring redundant update in %s: %@", self.logTag, functionName, self.debugDescription);
OWSLogVerbose(@"Ignoring redundant update in %s: %@", functionName, self.debugDescription);
didChange = NO;
} else {
[latestInstance saveWithTransaction:transaction];
@ -329,28 +328,28 @@ NSString *const kLocalProfileUniqueId = @"kLocalProfileUniqueId";
- (YapDatabaseConnection *)dbReadConnection
{
OWSFailDebug(@"%@ UserProfile should always use OWSProfileManager's database connection.", self.logTag);
OWSFailDebug(@"UserProfile should always use OWSProfileManager's database connection.");
return TSYapDatabaseObject.dbReadConnection;
}
+ (YapDatabaseConnection *)dbReadConnection
{
OWSFailDebug(@"%@ UserProfile should always use OWSProfileManager's database connection.", self.logTag);
OWSFailDebug(@"UserProfile should always use OWSProfileManager's database connection.");
return TSYapDatabaseObject.dbReadConnection;
}
- (YapDatabaseConnection *)dbReadWriteConnection
{
OWSFailDebug(@"%@ UserProfile should always use OWSProfileManager's database connection.", self.logTag);
OWSFailDebug(@"UserProfile should always use OWSProfileManager's database connection.");
return TSYapDatabaseObject.dbReadWriteConnection;
}
+ (YapDatabaseConnection *)dbReadWriteConnection
{
OWSFailDebug(@"%@ UserProfile should always use OWSProfileManager's database connection.", self.logTag);
OWSFailDebug(@"UserProfile should always use OWSProfileManager's database connection.");
return TSYapDatabaseObject.dbReadWriteConnection;
}
@ -446,9 +445,8 @@ NSString *const kLocalProfileUniqueId = @"kLocalProfileUniqueId";
enumerateCollectionObjectsWithTransaction:transaction
usingBlock:^(id object, BOOL *stop) {
if (![object isKindOfClass:[OWSUserProfile class]]) {
OWSFailDebug(@"%@ unexpected object in user profiles: %@",
self.logTag,
[object class]);
OWSFailDebug(
@"unexpected object in user profiles: %@", [object class]);
return;
}
OWSUserProfile *userProfile = object;

View File

@ -100,7 +100,7 @@ const NSUInteger kMaxDebugLogFileSize = 1024 * 1024 * 3;
[logPathSet addObject:logPath];
}
if (error) {
OWSFailDebug(@"%@ Failed to find log files: %@", self.logTag, error);
OWSFailDebug(@"Failed to find log files: %@", error);
}
}
// To be extra conservative, also add all logs from log file manager.
@ -124,7 +124,7 @@ const NSUInteger kMaxDebugLogFileSize = 1024 * 1024 * 3;
for (NSString *logFilePath in logFilePaths) {
BOOL success = [fileManager removeItemAtPath:logFilePath error:&error];
if (!success || error) {
OWSFailDebug(@"%@ Failed to delete log file: %@", self.logTag, error);
OWSFailDebug(@"Failed to delete log file: %@", error);
}
}

View File

@ -118,7 +118,7 @@ NS_ASSUME_NONNULL_BEGIN
NSError *error;
self.audioPlayer = [[AVAudioPlayer alloc] initWithContentsOfURL:self.mediaUrl error:&error];
if (error) {
OWSLogError(@"%@ error: %@", self.logTag, error);
OWSLogError(@"error: %@", error);
[self stop];
if ([error.domain isEqualToString:NSOSStatusErrorDomain]

View File

@ -33,7 +33,7 @@ NS_ASSUME_NONNULL_BEGIN
} else if ([thread isKindOfClass:[TSGroupThread class]]) {
avatarBuilder = [[OWSGroupAvatarBuilder alloc] initWithThread:(TSGroupThread *)thread];
} else {
OWSLogError(@"%@ called with unsupported thread: %@", self.logTag, thread);
OWSLogError(@"called with unsupported thread: %@", thread);
}
return [avatarBuilder build];
}

View File

@ -197,7 +197,7 @@ NSString *const OWSPreferencesKeySystemCallLogEnabled = @"OWSPreferencesKeySyste
if (@available(iOS 11, *)) {
// do nothing
} else {
OWSFailDebug(@"%@ Call Logging can only be configured on iOS11+", self.logTag);
OWSFailDebug(@"Call Logging can only be configured on iOS11+");
return NO;
}
@ -210,7 +210,7 @@ NSString *const OWSPreferencesKeySystemCallLogEnabled = @"OWSPreferencesKeySyste
if (@available(iOS 11, *)) {
// do nothing
} else {
OWSFailDebug(@"%@ Call Logging can only be configured on iOS11+", self.logTag);
OWSFailDebug(@"Call Logging can only be configured on iOS11+");
return;
}
@ -253,7 +253,7 @@ NSString *const OWSPreferencesKeySystemCallLogEnabled = @"OWSPreferencesKeySyste
}
}();
OWSLogInfo(@"%@ Migrating setting - System Call Log Enabled: %d", self.logTag, shouldLogCallsInRecents);
OWSLogInfo(@"Migrating setting - System Call Log Enabled: %d", shouldLogCallsInRecents);
[self setValueForKey:OWSPreferencesKeySystemCallLogEnabled
toValue:@(shouldLogCallsInRecents)
transaction:transaction];
@ -267,7 +267,7 @@ NSString *const OWSPreferencesKeySystemCallLogEnabled = @"OWSPreferencesKeySyste
- (BOOL)isCallKitEnabled
{
if (@available(iOS 11, *)) {
OWSFailDebug(@"%@ CallKit is always enabled for iOS11+", self.logTag);
OWSFailDebug(@"CallKit is always enabled for iOS11+");
return YES;
}
@ -278,7 +278,7 @@ NSString *const OWSPreferencesKeySystemCallLogEnabled = @"OWSPreferencesKeySyste
- (void)setIsCallKitEnabled:(BOOL)flag
{
if (@available(iOS 11, *)) {
OWSFailDebug(@"%@ CallKit is always enabled for iOS11+", self.logTag);
OWSFailDebug(@"CallKit is always enabled for iOS11+");
return;
}
@ -289,7 +289,7 @@ NSString *const OWSPreferencesKeySystemCallLogEnabled = @"OWSPreferencesKeySyste
- (BOOL)isCallKitEnabledSet
{
if (@available(iOS 11, *)) {
OWSFailDebug(@"%@ CallKit is always enabled for iOS11+", self.logTag);
OWSFailDebug(@"CallKit is always enabled for iOS11+");
return NO;
}
@ -300,7 +300,7 @@ NSString *const OWSPreferencesKeySystemCallLogEnabled = @"OWSPreferencesKeySyste
- (BOOL)isCallKitPrivacyEnabled
{
if (@available(iOS 11, *)) {
OWSFailDebug(@"%@ CallKit privacy is irrelevant for iOS11+", self.logTag);
OWSFailDebug(@"CallKit privacy is irrelevant for iOS11+");
return NO;
}
@ -316,7 +316,7 @@ NSString *const OWSPreferencesKeySystemCallLogEnabled = @"OWSPreferencesKeySyste
- (void)setIsCallKitPrivacyEnabled:(BOOL)flag
{
if (@available(iOS 11, *)) {
OWSFailDebug(@"%@ CallKit privacy is irrelevant for iOS11+", self.logTag);
OWSFailDebug(@"CallKit privacy is irrelevant for iOS11+");
return;
}
@ -326,7 +326,7 @@ NSString *const OWSPreferencesKeySystemCallLogEnabled = @"OWSPreferencesKeySyste
- (BOOL)isCallKitPrivacySet
{
if (@available(iOS 11, *)) {
OWSFailDebug(@"%@ CallKit privacy is irrelevant for iOS11+", self.logTag);
OWSFailDebug(@"CallKit privacy is irrelevant for iOS11+");
return NO;
}
@ -421,7 +421,7 @@ NSString *const OWSPreferencesKeySystemCallLogEnabled = @"OWSPreferencesKeySyste
- (void)unsetRecordedAPNSTokens
{
OWSLogWarn(@"%@ Forgetting recorded APNS tokens", self.logTag);
OWSLogWarn(@"Forgetting recorded APNS tokens");
[self setValueForKey:OWSPreferencesKeyLastRecordedPushToken toValue:nil];
[self setValueForKey:OWSPreferencesKeyLastRecordedVoipToken toValue:nil];
}

View File

@ -18,7 +18,7 @@ NS_ASSUME_NONNULL_BEGIN
options:NSRegularExpressionCaseInsensitive
error:&error];
if (error || !regex) {
OWSFail(@"%@ could not compile regular expression: %@", self.logTag, error);
OWSFail(@"could not compile regular expression: %@", error);
}
});
return regex;
@ -34,7 +34,7 @@ NS_ASSUME_NONNULL_BEGIN
options:NSRegularExpressionCaseInsensitive
error:&error];
if (error || !regex) {
OWSFail(@"%@ could not compile regular expression: %@", self.logTag, error);
OWSFail(@"could not compile regular expression: %@", error);
}
});
return regex;
@ -51,7 +51,7 @@ NS_ASSUME_NONNULL_BEGIN
options:NSRegularExpressionCaseInsensitive
error:&error];
if (error || !regex) {
OWSFail(@"%@ could not compile regular expression: %@", self.logTag, error);
OWSFail(@"could not compile regular expression: %@", error);
}
});
return regex;

View File

@ -333,7 +333,7 @@ const UIWindowLevel UIWindowLevel_MessageActions(void)
OWSAssert(self.callViewController);
if (self.callViewController != callViewController) {
OWSLogWarn(@"%@ Ignoring end call request from obsolete call view controller.", self.logTag);
OWSLogWarn(@"Ignoring end call request from obsolete call view controller.");
return;
}
@ -439,7 +439,7 @@ const UIWindowLevel UIWindowLevel_MessageActions(void)
OWSAssertIsOnMainThread();
if (self.rootWindow.hidden) {
OWSLogInfo(@"%@ showing root window.", self.logTag);
OWSLogInfo(@"showing root window.");
}
// By calling makeKeyAndVisible we ensure the rootViewController becomes firt responder.
@ -453,7 +453,7 @@ const UIWindowLevel UIWindowLevel_MessageActions(void)
OWSAssertIsOnMainThread();
if (!self.rootWindow.hidden) {
OWSLogInfo(@"%@ hiding root window.", self.logTag);
OWSLogInfo(@"hiding root window.");
}
self.rootWindow.hidden = YES;
@ -467,7 +467,7 @@ const UIWindowLevel UIWindowLevel_MessageActions(void)
return;
}
OWSLogInfo(@"%@ showing 'return to call' window.", self.logTag);
OWSLogInfo(@"showing 'return to call' window.");
self.returnToCallWindow.hidden = NO;
[self.returnToCallViewController startAnimating];
}
@ -480,7 +480,7 @@ const UIWindowLevel UIWindowLevel_MessageActions(void)
return;
}
OWSLogInfo(@"%@ hiding 'return to call' window.", self.logTag);
OWSLogInfo(@"hiding 'return to call' window.");
self.returnToCallWindow.hidden = YES;
[self.returnToCallViewController stopAnimating];
}
@ -490,7 +490,7 @@ const UIWindowLevel UIWindowLevel_MessageActions(void)
OWSAssertIsOnMainThread();
if (self.callViewWindow.hidden) {
OWSLogInfo(@"%@ showing call window.", self.logTag);
OWSLogInfo(@"showing call window.");
}
[self.callViewWindow makeKeyAndVisible];
@ -501,7 +501,7 @@ const UIWindowLevel UIWindowLevel_MessageActions(void)
OWSAssertIsOnMainThread();
if (!self.callViewWindow.hidden) {
OWSLogInfo(@"%@ hiding call window.", self.logTag);
OWSLogInfo(@"hiding call window.");
}
self.callViewWindow.hidden = YES;
@ -512,7 +512,7 @@ const UIWindowLevel UIWindowLevel_MessageActions(void)
OWSAssertIsOnMainThread();
if (self.menuActionsWindow.hidden) {
OWSLogInfo(@"%@ showing message actions window.", self.logTag);
OWSLogInfo(@"showing message actions window.");
}
// Do not make key, we want the keyboard to stay popped.
@ -524,7 +524,7 @@ const UIWindowLevel UIWindowLevel_MessageActions(void)
OWSAssertIsOnMainThread();
if (!self.menuActionsWindow.hidden) {
OWSLogInfo(@"%@ hiding message actions window.", self.logTag);
OWSLogInfo(@"hiding message actions window.");
}
self.menuActionsWindow.hidden = YES;
@ -535,7 +535,7 @@ const UIWindowLevel UIWindowLevel_MessageActions(void)
OWSAssertIsOnMainThread();
if (self.screenBlockingWindow.windowLevel != UIWindowLevel_ScreenBlocking()) {
OWSLogInfo(@"%@ showing block window.", self.logTag);
OWSLogInfo(@"showing block window.");
}
self.screenBlockingWindow.windowLevel = UIWindowLevel_ScreenBlocking();
@ -547,7 +547,7 @@ const UIWindowLevel UIWindowLevel_MessageActions(void)
OWSAssertIsOnMainThread();
if (self.screenBlockingWindow.windowLevel != UIWindowLevel_Background) {
OWSLogInfo(@"%@ hiding block window.", self.logTag);
OWSLogInfo(@"hiding block window.");
}
// Never hide the blocking window (that can lead to bad frames).

View File

@ -61,10 +61,10 @@ NS_ASSUME_NONNULL_BEGIN
quotedReplyModel:quotedReplyModel
messageSender:messageSender
success:^{
OWSLogInfo(@"%@ Successfully sent message.", self.logTag);
OWSLogInfo(@"Successfully sent message.");
}
failure:^(NSError *error) {
OWSLogWarn(@"%@ Failed to deliver message with error: %@", self.logTag, error);
OWSLogWarn(@"Failed to deliver message with error: %@", error);
}];
}
@ -145,7 +145,7 @@ NS_ASSUME_NONNULL_BEGIN
sourceFilename:attachment.filenameOrDefault
inMessage:message
success:^{
OWSLogDebug(@"%@ Successfully sent message attachment.", self.logTag);
OWSLogDebug(@"Successfully sent message attachment.");
if (completion) {
dispatch_async(dispatch_get_main_queue(), ^(void) {
completion(nil);
@ -153,7 +153,7 @@ NS_ASSUME_NONNULL_BEGIN
}
}
failure:^(NSError *error) {
OWSLogError(@"%@ Failed to send message attachment with error: %@", self.logTag, error);
OWSLogError(@"Failed to send message attachment with error: %@", error);
if (completion) {
dispatch_async(dispatch_get_main_queue(), ^(void) {
completion(error);
@ -193,7 +193,7 @@ NS_ASSUME_NONNULL_BEGIN
[messageSender enqueueMessage:message
success:^{
OWSLogDebug(@"%@ Successfully sent contact share.", self.logTag);
OWSLogDebug(@"Successfully sent contact share.");
if (completion) {
dispatch_async(dispatch_get_main_queue(), ^(void) {
completion(nil);
@ -201,7 +201,7 @@ NS_ASSUME_NONNULL_BEGIN
}
}
failure:^(NSError *error) {
OWSLogError(@"%@ Failed to send contact share with error: %@", self.logTag, error);
OWSLogError(@"Failed to send contact share with error: %@", error);
if (completion) {
dispatch_async(dispatch_get_main_queue(), ^(void) {
completion(error);
@ -434,8 +434,7 @@ NS_ASSUME_NONNULL_BEGIN
if (existingContactOffers.hasBlockOffer != shouldHaveBlockOffer
|| existingContactOffers.hasAddToContactsOffer != shouldHaveAddToContactsOffer
|| existingContactOffers.hasAddToProfileWhitelistOffer != shouldHaveAddToProfileWhitelistOffer) {
OWSLogInfo(@"%@ Removing stale contact offers: %@ (%llu)",
self.logTag,
OWSLogInfo(@"Removing stale contact offers: %@ (%llu)",
existingContactOffers.uniqueId,
existingContactOffers.timestampForSorting);
// Preserve the timestamp of the existing "contact offers" so that
@ -447,8 +446,7 @@ NS_ASSUME_NONNULL_BEGIN
}
if (existingContactOffers && !shouldHaveContactOffers) {
OWSLogInfo(@"%@ Removing contact offers: %@ (%llu)",
self.logTag,
OWSLogInfo(@"Removing contact offers: %@ (%llu)",
existingContactOffers.uniqueId,
existingContactOffers.timestampForSorting);
[existingContactOffers removeWithTransaction:transaction];
@ -464,10 +462,8 @@ NS_ASSUME_NONNULL_BEGIN
recipientId:recipientId];
[offersMessage saveWithTransaction:transaction];
OWSLogInfo(@"%@ Creating contact offers: %@ (%llu)",
self.logTag,
offersMessage.uniqueId,
offersMessage.timestampForSorting);
OWSLogInfo(
@"Creating contact offers: %@ (%llu)", offersMessage.uniqueId, offersMessage.timestampForSorting);
}
[self ensureUnreadIndicator:result
@ -615,7 +611,7 @@ NS_ASSUME_NONNULL_BEGIN
missingUnseenSafetyNumberChangeCount:missingUnseenSafetyNumberChangeCount
unreadIndicatorPosition:unreadIndicatorPosition
firstUnseenInteractionTimestamp:firstUnseenInteractionTimestamp.unsignedLongLongValue];
OWSLogInfo(@"%@ Creating Unread Indicator: %llu", self.logTag, dynamicInteractions.unreadIndicator.timestamp);
OWSLogInfo(@"Creating Unread Indicator: %llu", dynamicInteractions.unreadIndicator.timestamp);
}
+ (nullable NSNumber *)focusMessagePositionForThread:(TSThread *)thread
@ -635,16 +631,16 @@ NS_ASSUME_NONNULL_BEGIN
if (!success) {
// This might happen if the focus message has disappeared
// before this view could appear.
OWSFailDebug(@"%@ failed to find focus message index.", self.logTag);
OWSFailDebug(@"failed to find focus message index.");
return nil;
}
if (![group isEqualToString:thread.uniqueId]) {
OWSFailDebug(@"%@ focus message has invalid group.", self.logTag);
OWSFailDebug(@"focus message has invalid group.");
return nil;
}
NSUInteger count = [databaseView numberOfItemsInGroup:thread.uniqueId];
if (index >= count) {
OWSFailDebug(@"%@ focus message has invalid index.", self.logTag);
OWSFailDebug(@"focus message has invalid index.");
return nil;
}
NSUInteger position = (count - index) - 1;
@ -729,7 +725,7 @@ NS_ASSUME_NONNULL_BEGIN
NSArray<NSString *> *_Nullable uniqueIds = [transaction allKeysInCollection:collection];
if (!uniqueIds) {
OWSFailDebug(@"%@ couldn't load uniqueIds for collection: %@.", self.logTag, collection);
OWSFailDebug(@"couldn't load uniqueIds for collection: %@.", collection);
return;
}
OWSLogInfo(@"%@ Deleting %lu objects from: %@", self.logTag, (unsigned long)uniqueIds.count, collection);
@ -739,7 +735,7 @@ NS_ASSUME_NONNULL_BEGIN
// work.
TSYapDatabaseObject *_Nullable object = [class fetchObjectWithUniqueID:uniqueId transaction:transaction];
if (!object) {
OWSFailDebug(@"%@ couldn't load object for deletion: %@.", self.logTag, collection);
OWSFailDebug(@"couldn't load object for deletion: %@.", collection);
continue;
}
[object removeWithTransaction:transaction];
@ -764,7 +760,7 @@ NS_ASSUME_NONNULL_BEGIN
NSString *localNumber = [TSAccountManager localNumber];
if (localNumber.length < 1) {
OWSFailDebug(@"%@ missing long number.", self.logTag);
OWSFailDebug(@"missing long number.");
return nil;
}
@ -796,7 +792,7 @@ NS_ASSUME_NONNULL_BEGIN
}
if (interactions.count > 1) {
// In case of collision, take the first.
OWSLogError(@"%@ more than one matching interaction in thread.", self.logTag);
OWSLogError(@"more than one matching interaction in thread.");
}
return interactions.firstObject;
}

View File

@ -126,7 +126,7 @@ NSString *const TSAccountManager_ServerSignalingKey = @"TSStorageServerSignaling
- (void)didRegister
{
OWSLogInfo(@"%@ didRegister", self.logTag);
OWSLogInfo(@"didRegister");
NSString *phoneNumber = self.phoneNumberAwaitingVerification;
if (!phoneNumber) {
@ -220,7 +220,7 @@ NSString *const TSAccountManager_ServerSignalingKey = @"TSStorageServerSignaling
if (registrationID == 0) {
registrationID = (uint32_t)arc4random_uniform(16380) + 1;
OWSLogWarn(@"%@ Generated a new registrationID: %u", self.logTag, registrationID);
OWSLogWarn(@"Generated a new registrationID: %u", registrationID);
[transaction setObject:[NSNumber numberWithUnsignedInteger:registrationID]
forKey:TSAccountManager_LocalRegistrationIdKey
@ -293,8 +293,7 @@ NSString *const TSAccountManager_ServerSignalingKey = @"TSStorageServerSignaling
: TSVerificationTransportVoice)];
[[TSNetworkManager sharedManager] makeRequest:request
success:^(NSURLSessionDataTask *task, id responseObject) {
OWSLogInfo(@"%@ Successfully requested verification code request for number: %@ method:%@",
self.logTag,
OWSLogInfo(@"Successfully requested verification code request for number: %@ method:%@",
phoneNumber,
isSMS ? @"SMS" : @"Voice");
successBlock();
@ -303,7 +302,7 @@ NSString *const TSAccountManager_ServerSignalingKey = @"TSStorageServerSignaling
if (!IsNSErrorNetworkFailure(error)) {
OWSProdError([OWSAnalyticsEvents accountsErrorVerificationCodeRequestFailed]);
}
OWSLogError(@"%@ Failed to request verification code request with error:%@", self.logTag, error);
OWSLogError(@"Failed to request verification code request with error:%@", error);
failureBlock(error);
}];
}
@ -334,11 +333,11 @@ NSString *const TSAccountManager_ServerSignalingKey = @"TSStorageServerSignaling
TSRequest *request = [OWSRequestFactory updateAttributesRequestWithManualMessageFetching:YES];
[self.networkManager makeRequest:request
success:^(NSURLSessionDataTask *_Nonnull task, id _Nonnull responseObject) {
OWSLogInfo(@"%@ updated server with account attributes to enableManualFetching", self.logTag);
OWSLogInfo(@"updated server with account attributes to enableManualFetching");
successBlock();
}
failure:^(NSURLSessionDataTask *_Nonnull task, NSError *_Nonnull error) {
OWSLogInfo(@"%@ failed to updat server with account attributes with error: %@", self.logTag, error);
OWSLogInfo(@"failed to updat server with account attributes with error: %@", error);
failureBlock(error);
}];
}
@ -370,7 +369,7 @@ NSString *const TSAccountManager_ServerSignalingKey = @"TSStorageServerSignaling
switch (statuscode) {
case 200:
case 204: {
OWSLogInfo(@"%@ Verification code accepted.", self.logTag);
OWSLogInfo(@"Verification code accepted.");
[self storeServerAuthToken:authToken signalingKey:signalingKey];
[TSPreKeyManager registerPreKeysWithMode:RefreshPreKeysMode_SignedAndOneTime
success:successBlock
@ -378,7 +377,7 @@ NSString *const TSAccountManager_ServerSignalingKey = @"TSStorageServerSignaling
break;
}
default: {
OWSLogError(@"%@ Unexpected status while verifying code: %ld", self.logTag, statuscode);
OWSLogError(@"Unexpected status while verifying code: %ld", statuscode);
NSError *error = OWSErrorMakeUnableToProcessServerResponseError();
failureBlock(error);
break;
@ -391,7 +390,7 @@ NSString *const TSAccountManager_ServerSignalingKey = @"TSStorageServerSignaling
}
OWSAssert([error.domain isEqualToString:TSNetworkManagerDomain]);
OWSLogWarn(@"%@ Error verifying code: %@", self.logTag, error.debugDescription);
OWSLogWarn(@"Error verifying code: %@", error.debugDescription);
switch (error.code) {
case 403: {
@ -420,7 +419,7 @@ NSString *const TSAccountManager_ServerSignalingKey = @"TSStorageServerSignaling
break;
}
default: {
OWSLogError(@"%@ verifying code failed with unknown error: %@", self.logTag, error);
OWSLogError(@"verifying code failed with unknown error: %@", error);
failureBlock(error);
break;
}
@ -485,7 +484,7 @@ NSString *const TSAccountManager_ServerSignalingKey = @"TSStorageServerSignaling
TSRequest *request = [OWSRequestFactory unregisterAccountRequest];
[[TSNetworkManager sharedManager] makeRequest:request
success:^(NSURLSessionDataTask *task, id responseObject) {
OWSLogInfo(@"%@ Successfully unregistered", self.logTag);
OWSLogInfo(@"Successfully unregistered");
success();
// This is called from `[AppSettingsViewController proceedToUnregistration]` whose
@ -502,7 +501,7 @@ NSString *const TSAccountManager_ServerSignalingKey = @"TSStorageServerSignaling
if (!IsNSErrorNetworkFailure(error)) {
OWSProdError([OWSAnalyticsEvents accountsErrorUnregisterAccountRequestFailed]);
}
OWSLogError(@"%@ Failed to unregister with error: %@", self.logTag, error);
OWSLogError(@"Failed to unregister with error: %@", error);
failureBlock(error);
}];
}
@ -546,7 +545,7 @@ NSString *const TSAccountManager_ServerSignalingKey = @"TSStorageServerSignaling
return;
}
OWSLogWarn(@"%@ isDeregistered: %d", self.logTag, isDeregistered);
OWSLogWarn(@"isDeregistered: %d", isDeregistered);
self.cachedIsDeregistered = @(isDeregistered);
}
@ -569,7 +568,7 @@ NSString *const TSAccountManager_ServerSignalingKey = @"TSStorageServerSignaling
@synchronized(self) {
NSString *_Nullable localNumber = self.localNumber;
if (!localNumber) {
OWSFailDebug(@"%@ can't re-register without valid local number.", self.logTag);
OWSFailDebug(@"can't re-register without valid local number.");
return NO;
}

View File

@ -163,7 +163,7 @@ static const NSUInteger kMaxPrekeyUpdateFailureCount = 5;
[[TSNetworkManager sharedManager] makeRequest:request
success:^(NSURLSessionDataTask *task, id responseObject) {
OWSLogInfo(@"%@ Successfully registered %@.", self.logTag, description);
OWSLogInfo(@"Successfully registered %@.", description);
// Mark signed prekey as accepted by service.
[signedPreKey markAsAcceptedByService];
@ -237,20 +237,19 @@ static const NSUInteger kMaxPrekeyUpdateFailureCount = 5;
void (^updatePreKeys)(RefreshPreKeysMode) = ^(RefreshPreKeysMode mode) {
[self registerPreKeysWithMode:mode
success:^{
OWSLogInfo(@"%@ New prekeys registered with server.", self.logTag);
OWSLogInfo(@"New prekeys registered with server.");
[self clearSignedPreKeyRecords];
}
failure:^(NSError *error) {
OWSLogWarn(@"%@ Failed to update prekeys with the server: %@", self.logTag, error);
OWSLogWarn(@"Failed to update prekeys with the server: %@", error);
}];
};
BOOL shouldUpdateOneTimePreKeys = count.integerValue <= kEphemeralPreKeysMinimumCount;
if (shouldUpdateOneTimePreKeys) {
OWSLogInfo(
@"%@ Updating one-time and signed prekeys due to shortage of one-time prekeys.", self.logTag);
OWSLogInfo(@"Updating one-time and signed prekeys due to shortage of one-time prekeys.");
updatePreKeys(RefreshPreKeysMode_SignedAndOneTime);
didUpdatePreKeys = YES;
} else {
@ -264,10 +263,7 @@ static const NSUInteger kMaxPrekeyUpdateFailureCount = 5;
SignedPreKeyRecord *currentRecord =
[primaryStorage loadSignedPrekeyOrNil:currentSignedPrekeyId.intValue];
if (!currentRecord) {
OWSFailDebug(@"%@ %s Couldn't find signed prekey for id: %@",
self.logTag,
__PRETTY_FUNCTION__,
currentSignedPrekeyId);
OWSFailDebug(@"Couldn't find signed prekey for id: %@", currentSignedPrekeyId);
shouldUpdateSignedPrekey = YES;
} else {
shouldUpdateSignedPrekey
@ -276,11 +272,11 @@ static const NSUInteger kMaxPrekeyUpdateFailureCount = 5;
}
if (shouldUpdateSignedPrekey) {
OWSLogInfo(@"%@ Updating signed prekey due to rotation period.", self.logTag);
OWSLogInfo(@"Updating signed prekey due to rotation period.");
updatePreKeys(RefreshPreKeysMode_SignedOnly);
didUpdatePreKeys = YES;
} else {
OWSLogDebug(@"%@ Not updating prekeys.", self.logTag);
OWSLogDebug(@"Not updating prekeys.");
}
}
@ -299,9 +295,7 @@ static const NSUInteger kMaxPrekeyUpdateFailureCount = 5;
NSNumber *currentSignedPrekeyId = [primaryStorage currentSignedPrekeyId];
if (!keyId || !currentSignedPrekeyId || ![currentSignedPrekeyId isEqualToNumber:keyId]) {
OWSLogError(
@"%@ Local and service 'current signed prekey ids' did not match. %@ == %@ == %d.",
self.logTag,
OWSLogError(@"Local and service 'current signed prekey ids' did not match. %@ == %@ == %d.",
keyId,
currentSignedPrekeyId,
[currentSignedPrekeyId isEqualToNumber:keyId]);
@ -311,7 +305,7 @@ static const NSUInteger kMaxPrekeyUpdateFailureCount = 5;
if (!IsNSErrorNetworkFailure(error)) {
OWSProdError([OWSAnalyticsEvents errorPrekeysCurrentSignedPrekeyRequestFailed]);
}
OWSLogWarn(@"%@ Could not retrieve current signed key from the service.", self.logTag);
OWSLogWarn(@"Could not retrieve current signed key from the service.");
// Mark the prekeys as _NOT_ checked on failure.
[self markPreKeysAsNotChecked];
@ -322,7 +316,7 @@ static const NSUInteger kMaxPrekeyUpdateFailureCount = 5;
if (!IsNSErrorNetworkFailure(error)) {
OWSProdError([OWSAnalyticsEvents errorPrekeysAvailablePrekeysRequestFailed]);
}
OWSLogError(@"%@ Failed to retrieve the number of available prekeys.", self.logTag);
OWSLogError(@"Failed to retrieve the number of available prekeys.");
// Mark the prekeys as _NOT_ checked on failure.
[self markPreKeysAsNotChecked];
@ -345,7 +339,7 @@ static const NSUInteger kMaxPrekeyUpdateFailureCount = 5;
+ (void)clearSignedPreKeyRecordsWithKeyId:(NSNumber *)keyId success:(void (^_Nullable)(void))successHandler
{
if (!keyId) {
OWSFailDebug(@"%@ Ignoring request to clear signed preKeys since no keyId was specified", self.logTag);
OWSFailDebug(@"Ignoring request to clear signed preKeys since no keyId was specified");
return;
}

View File

@ -69,19 +69,19 @@ static const long SGX_XFRM_RESERVED = 0xFFFFFFFFFFFFFFF8L;
pceSvn = parser.nextShort;
} else {
if (![parser readZero:2]) {
OWSFailDebug(@"%@ non-zero pceSvn.", self.logTag);
OWSFailDebug(@"non-zero pceSvn.");
return nil;
}
}
if (![parser readZero:4]) {
OWSFailDebug(@"%@ non-zero xeid.", self.logTag);
OWSFailDebug(@"non-zero xeid.");
return nil;
}
NSData *_Nullable basename = [parser readBytes:32];
if (!basename) {
OWSFailDebug(@"%@ couldn't read basename.", self.logTag);
OWSFailDebug(@"couldn't read basename.");
return nil;
}
@ -89,69 +89,69 @@ static const long SGX_XFRM_RESERVED = 0xFFFFFFFFFFFFFFF8L;
NSData *_Nullable cpuSvn = [parser readBytes:16];
if (!cpuSvn) {
OWSFailDebug(@"%@ couldn't read cpuSvn.", self.logTag);
OWSFailDebug(@"couldn't read cpuSvn.");
return nil;
}
if (![parser readZero:4]) {
OWSFailDebug(@"%@ non-zero misc_select.", self.logTag);
OWSFailDebug(@"non-zero misc_select.");
return nil;
}
if (![parser readZero:28]) {
OWSFailDebug(@"%@ non-zero reserved1.", self.logTag);
OWSFailDebug(@"non-zero reserved1.");
return nil;
}
uint64_t flags = parser.nextLong;
if ((flags & SGX_FLAGS_RESERVED) != 0 || (flags & SGX_FLAGS_INITTED) == 0 || (flags & SGX_FLAGS_MODE64BIT) == 0) {
OWSFailDebug(@"%@ invalid flags.", self.logTag);
OWSFailDebug(@"invalid flags.");
return nil;
}
uint64_t xfrm = parser.nextLong;
if ((xfrm & SGX_XFRM_RESERVED) != 0) {
OWSFailDebug(@"%@ invalid xfrm.", self.logTag);
OWSFailDebug(@"invalid xfrm.");
return nil;
}
NSData *_Nullable mrenclave = [parser readBytes:32];
if (!mrenclave) {
OWSFailDebug(@"%@ couldn't read mrenclave.", self.logTag);
OWSFailDebug(@"couldn't read mrenclave.");
return nil;
}
if (![parser readZero:32]) {
OWSFailDebug(@"%@ non-zero reserved2.", self.logTag);
OWSFailDebug(@"non-zero reserved2.");
return nil;
}
NSData *_Nullable mrsigner = [parser readBytes:32];
if (!mrsigner) {
OWSFailDebug(@"%@ couldn't read mrsigner.", self.logTag);
OWSFailDebug(@"couldn't read mrsigner.");
return nil;
}
if (![parser readZero:96]) {
OWSFailDebug(@"%@ non-zero reserved3.", self.logTag);
OWSFailDebug(@"non-zero reserved3.");
return nil;
}
uint16_t isvProdId = parser.nextShort;
uint16_t isvSvn = parser.nextShort;
if (![parser readZero:60]) {
OWSFailDebug(@"%@ non-zero reserved4.", self.logTag);
OWSFailDebug(@"non-zero reserved4.");
return nil;
}
NSData *_Nullable reportData = [parser readBytes:64];
if (!reportData) {
OWSFailDebug(@"%@ couldn't read reportData.", self.logTag);
OWSFailDebug(@"couldn't read reportData.");
return nil;
}
// quote signature
uint32_t signatureLength = parser.nextInt;
if (signatureLength != quoteData.length - 436) {
OWSFailDebug(@"%@ invalid signatureLength.", self.logTag);
OWSFailDebug(@"invalid signatureLength.");
return nil;
}
NSData *_Nullable signature = [parser readBytes:signatureLength];
if (!signature) {
OWSFailDebug(@"%@ couldn't read signature.", self.logTag);
OWSFailDebug(@"couldn't read signature.");
return nil;
}

View File

@ -57,25 +57,25 @@ NS_ASSUME_NONNULL_BEGIN
NSArray<NSData *> *_Nullable anchorCertificates = [self anchorCertificates];
if (anchorCertificates.count < 1) {
OWSFailDebug(@"%@ Could not load anchor certificates.", self.logTag);
OWSFailDebug(@"Could not load anchor certificates.");
return nil;
}
NSArray<NSData *> *_Nullable certificateDerDatas = [self convertPemToDer:certificatePem];
if (certificateDerDatas.count < 1) {
OWSFailDebug(@"%@ Could not parse PEM.", self.logTag);
OWSFailDebug(@"Could not parse PEM.");
return nil;
}
// The leaf is always the first certificate.
NSData *_Nullable leafCertificateData = [certificateDerDatas firstObject];
if (!leafCertificateData) {
OWSLogError(@"%@ Could not extract leaf certificate data.", self.logTag);
OWSLogError(@"Could not extract leaf certificate data.");
return nil;
}
if (![self verifyDistinguishedNameOfCertificate:leafCertificateData]) {
OWSFailDebug(@"%@ Leaf certificate has invalid name.", self.logTag);
OWSFailDebug(@"Leaf certificate has invalid name.");
return nil;
}
@ -83,7 +83,7 @@ NS_ASSUME_NONNULL_BEGIN
for (NSData *certificateDerData in certificateDerDatas) {
SecCertificateRef certificate = SecCertificateCreateWithData(NULL, (__bridge CFDataRef)(certificateDerData));
if (!certificate) {
OWSFailDebug(@"%@ Could not load DER.", self.logTag);
OWSFailDebug(@"Could not load DER.");
return nil;
}
[certificates addObject:(__bridge_transfer id)certificate];
@ -92,7 +92,7 @@ NS_ASSUME_NONNULL_BEGIN
SecPolicyRef policy = SecPolicyCreateBasicX509();
signingCertificate.policy = policy;
if (!policy) {
OWSLogError(@"%@ Could not create policy.", self.logTag);
OWSLogError(@"Could not create policy.");
return nil;
}
@ -100,23 +100,23 @@ NS_ASSUME_NONNULL_BEGIN
OSStatus status = SecTrustCreateWithCertificates((__bridge CFTypeRef)certificates, policy, &trust);
signingCertificate.trust = trust;
if (status != errSecSuccess) {
OWSLogError(@"%@ trust could not be created.", self.logTag);
OWSLogError(@"trust could not be created.");
return nil;
}
if (!trust) {
OWSLogError(@"%@ Could not create trust.", self.logTag);
OWSLogError(@"Could not create trust.");
return nil;
}
status = SecTrustSetNetworkFetchAllowed(trust, NO);
if (status != errSecSuccess) {
OWSLogError(@"%@ trust fetch could not be configured.", self.logTag);
OWSLogError(@"trust fetch could not be configured.");
return nil;
}
status = SecTrustSetAnchorCertificatesOnly(trust, YES);
if (status != errSecSuccess) {
OWSLogError(@"%@ trust anchor certs could not be configured.", self.logTag);
OWSLogError(@"trust anchor certs could not be configured.");
return nil;
}
@ -124,7 +124,7 @@ NS_ASSUME_NONNULL_BEGIN
for (NSData *certificateData in anchorCertificates) {
SecCertificateRef certificate = SecCertificateCreateWithData(NULL, (__bridge CFDataRef)(certificateData));
if (!certificate) {
OWSFailDebug(@"%@ Could not load DER.", self.logTag);
OWSFailDebug(@"Could not load DER.");
return nil;
}
@ -132,14 +132,14 @@ NS_ASSUME_NONNULL_BEGIN
}
status = SecTrustSetAnchorCertificates(trust, (__bridge CFArrayRef)pinnedCertificates);
if (status != errSecSuccess) {
OWSLogError(@"%@ The anchor certificates couldn't be set.", self.logTag);
OWSLogError(@"The anchor certificates couldn't be set.");
return nil;
}
SecTrustResultType result;
status = SecTrustEvaluate(trust, &result);
if (status != errSecSuccess) {
OWSLogError(@"%@ Could not evaluate certificates.", self.logTag);
OWSLogError(@"Could not evaluate certificates.");
return nil;
}
@ -147,14 +147,14 @@ NS_ASSUME_NONNULL_BEGIN
// See the comments in the header where it is defined.
BOOL isValid = (result == kSecTrustResultUnspecified || result == kSecTrustResultProceed);
if (!isValid) {
OWSLogError(@"%@ Certificate evaluation failed.", self.logTag);
OWSLogError(@"Certificate evaluation failed.");
return nil;
}
SecKeyRef publicKey = SecTrustCopyPublicKey(trust);
signingCertificate.publicKey = publicKey;
if (!publicKey) {
OWSLogError(@"%@ Could not extract public key.", self.logTag);
OWSLogError(@"Could not extract public key.");
return nil;
}
@ -175,7 +175,7 @@ NS_ASSUME_NONNULL_BEGIN
options:NSRegularExpressionCaseInsensitive | NSRegularExpressionDotMatchesLineSeparators
error:&error];
if (!regex || error) {
OWSFailDebug(@"%@ could parse regex: %@.", self.logTag, error);
OWSFailDebug(@"could parse regex: %@.", error);
return nil;
}
@ -184,19 +184,19 @@ NS_ASSUME_NONNULL_BEGIN
range:NSMakeRange(0, pemString.length)
usingBlock:^(NSTextCheckingResult *_Nullable result, NSMatchingFlags flags, BOOL *stop) {
if (result.numberOfRanges != 2) {
OWSFailDebug(@"%@ invalid PEM regex match.", self.logTag);
OWSFailDebug(@"invalid PEM regex match.");
return;
}
NSString *_Nullable derString = [pemString substringWithRange:[result rangeAtIndex:1]];
if (derString.length < 1) {
OWSFailDebug(@"%@ empty PEM match.", self.logTag);
OWSFailDebug(@"empty PEM match.");
return;
}
// dataFromBase64String will ignore whitespace, which is
// necessary.
NSData *_Nullable derData = [NSData dataFromBase64String:derString];
if (derData.length < 1) {
OWSFailDebug(@"%@ could not parse PEM match.", self.logTag);
OWSFailDebug(@"could not parse PEM match.");
return;
}
[certificateDatas addObject:derData];
@ -213,7 +213,7 @@ NS_ASSUME_NONNULL_BEGIN
// We need to use an Intel certificate as the anchor for IAS verification.
NSData *_Nullable anchorCertificate = [self certificateDataForService:@"ias-root"];
if (!anchorCertificate) {
OWSFailDebug(@"%@ could not load anchor certificate.", self.logTag);
OWSFailDebug(@"could not load anchor certificate.");
OWSRaiseException(@"OWSSignalService_CouldNotLoadCertificate", @"%s", __PRETTY_FUNCTION__);
} else {
anchorCertificates = @[ anchorCertificate ];
@ -228,7 +228,7 @@ NS_ASSUME_NONNULL_BEGIN
NSString *path = [bundle pathForResource:service ofType:@"cer"];
if (![[NSFileManager defaultManager] fileExistsAtPath:path]) {
OWSFailDebug(@"%@ could not locate certificate file.", self.logTag);
OWSFailDebug(@"could not locate certificate file.");
return nil;
}
@ -247,7 +247,7 @@ NS_ASSUME_NONNULL_BEGIN
NSData *_Nullable hashData = [Cryptography computeSHA256Digest:bodyData];
if (hashData.length != CC_SHA256_DIGEST_LENGTH) {
OWSFailDebug(@"%@ could not SHA256 for signature verification.", self.logTag);
OWSFailDebug(@"could not SHA256 for signature verification.");
return NO;
}
size_t hashBytesSize = CC_SHA256_DIGEST_LENGTH;
@ -258,7 +258,7 @@ NS_ASSUME_NONNULL_BEGIN
BOOL isValid = status == errSecSuccess;
if (!isValid) {
OWSFailDebug(@"%@ signatures do not match.", self.logTag);
OWSFailDebug(@"signatures do not match.");
return NO;
}
return YES;
@ -272,7 +272,7 @@ NS_ASSUME_NONNULL_BEGIN
// with API available on iOS 9. We use OpenSSL to extract the name.
NSDictionary<NSString *, NSString *> *_Nullable properties = [self propertiesForCertificate:certificateData];
if (!properties) {
OWSFailDebug(@"%@ Could not retrieve certificate properties.", self.logTag);
OWSFailDebug(@"Could not retrieve certificate properties.");
return NO;
}
// NSString *expectedDistinguishedName
@ -291,7 +291,7 @@ NS_ASSUME_NONNULL_BEGIN
};
if (![properties isEqualToDictionary:expectedProperties]) {
OWSFailDebug(@"%@ Unexpected certificate properties. %@ != %@", self.logTag, expectedProperties, properties);
OWSFailDebug(@"Unexpected certificate properties. %@ != %@", expectedProperties, properties);
return NO;
}
return YES;
@ -302,19 +302,19 @@ NS_ASSUME_NONNULL_BEGIN
OWSAssert(certificateData);
if (certificateData.length >= UINT32_MAX) {
OWSFailDebug(@"%@ certificate data is too long.", self.logTag);
OWSFailDebug(@"certificate data is too long.");
return nil;
}
const unsigned char *certificateDataBytes = (const unsigned char *)[certificateData bytes];
X509 *_Nullable certificateX509 = d2i_X509(NULL, &certificateDataBytes, [certificateData length]);
if (!certificateX509) {
OWSFailDebug(@"%@ could not parse certificate.", self.logTag);
OWSFailDebug(@"could not parse certificate.");
return nil;
}
X509_NAME *_Nullable subjectName = X509_get_subject_name(certificateX509);
if (!subjectName) {
OWSFailDebug(@"%@ could not extract subject name.", self.logTag);
OWSFailDebug(@"could not extract subject name.");
return nil;
}
@ -331,24 +331,24 @@ NS_ASSUME_NONNULL_BEGIN
X509_NAME_ENTRY *_Nullable entry = X509_NAME_get_entry(subjectName, index);
if (!entry) {
OWSFailDebug(@"%@ could not extract entry.", self.logTag);
OWSFailDebug(@"could not extract entry.");
return nil;
}
ASN1_STRING *_Nullable entryData = X509_NAME_ENTRY_get_data(entry);
if (!entryData) {
OWSFailDebug(@"%@ could not extract entry data.", self.logTag);
OWSFailDebug(@"could not extract entry data.");
return nil;
}
unsigned char *entryName = ASN1_STRING_data(entryData);
if (entryName == NULL) {
OWSFailDebug(@"%@ could not extract entry string.", self.logTag);
OWSFailDebug(@"could not extract entry string.");
return nil;
}
NSString *_Nullable entryString = [NSString stringWithUTF8String:(char *)entryName];
if (!entryString) {
OWSFailDebug(@"%@ could not parse entry name data.", self.logTag);
OWSFailDebug(@"could not parse entry name data.");
return nil;
}
certificateProperties[oid] = entryString;

View File

@ -111,7 +111,7 @@ NS_ASSUME_NONNULL_BEGIN
if (hashData) {
[hashData getBytes:&hashValue length:sizeof(hashValue)];
} else {
OWSFailDebug(@"%@ could not compute hash for avatar.", self.logTag);
OWSFailDebug(@"could not compute hash for avatar.");
}
_imageHash = hashValue;
} else {
@ -310,15 +310,15 @@ NS_ASSUME_NONNULL_BEGIN
NSError *error;
NSArray<CNContact *> *_Nullable contacts = [CNContactVCardSerialization contactsWithData:data error:&error];
if (!contacts || error) {
OWSFailDebug(@"%@ could not parse vcard: %@", self.logTag, error);
OWSFailDebug(@"could not parse vcard: %@", error);
return nil;
}
if (contacts.count < 1) {
OWSFailDebug(@"%@ empty vcard: %@", self.logTag, error);
OWSFailDebug(@"empty vcard: %@", error);
return nil;
}
if (contacts.count > 1) {
OWSFailDebug(@"%@ more than one contact in vcard: %@", self.logTag, error);
OWSFailDebug(@"more than one contact in vcard: %@", error);
}
return contacts.firstObject;
}

View File

@ -77,16 +77,16 @@ NS_ASSUME_NONNULL_BEGIN
derivedMaterial =
[HKDFKit deriveKey:masterSecret info:nil salt:publicKeys outputSize:(int)kAES256_KeyByteLength * 2];
} @catch (NSException *exception) {
OWSLogError(@"%@ could not derive service key: %@", self.logTag, exception);
OWSLogError(@"could not derive service key: %@", exception);
return NO;
}
if (!derivedMaterial) {
OWSFailDebug(@"%@ missing derived service key.", self.logTag);
OWSFailDebug(@"missing derived service key.");
return NO;
}
if (derivedMaterial.length != kAES256_KeyByteLength * 2) {
OWSFailDebug(@"%@ derived service key has unexpected length.", self.logTag);
OWSFailDebug(@"derived service key has unexpected length.");
return NO;
}
@ -94,7 +94,7 @@ NS_ASSUME_NONNULL_BEGIN
[derivedMaterial subdataWithRange:NSMakeRange(kAES256_KeyByteLength * 0, kAES256_KeyByteLength)];
OWSAES256Key *_Nullable clientKey = [OWSAES256Key keyWithData:clientKeyData];
if (!clientKey) {
OWSFailDebug(@"%@ clientKey has unexpected length.", self.logTag);
OWSFailDebug(@"clientKey has unexpected length.");
return NO;
}
@ -102,7 +102,7 @@ NS_ASSUME_NONNULL_BEGIN
[derivedMaterial subdataWithRange:NSMakeRange(kAES256_KeyByteLength * 1, kAES256_KeyByteLength)];
OWSAES256Key *_Nullable serverKey = [OWSAES256Key keyWithData:serverKeyData];
if (!serverKey) {
OWSFailDebug(@"%@ serverKey has unexpected length.", self.logTag);
OWSFailDebug(@"serverKey has unexpected length.");
return NO;
}
@ -172,7 +172,7 @@ NS_ASSUME_NONNULL_BEGIN
{
NSString *_Nullable valueString = self[key];
if (![valueString isKindOfClass:[NSString class]]) {
OWSFailDebug(@"%@ couldn't parse string for key: %@", self.logTag, key);
OWSFailDebug(@"couldn't parse string for key: %@", key);
return nil;
}
return valueString;
@ -182,12 +182,12 @@ NS_ASSUME_NONNULL_BEGIN
{
NSString *_Nullable valueString = self[key];
if (![valueString isKindOfClass:[NSString class]]) {
OWSFailDebug(@"%@ couldn't parse base 64 value for key: %@", self.logTag, key);
OWSFailDebug(@"couldn't parse base 64 value for key: %@", key);
return nil;
}
NSData *_Nullable valueData = [[NSData alloc] initWithBase64EncodedString:valueString options:0];
if (!valueData) {
OWSFailDebug(@"%@ couldn't decode base 64 value for key: %@", self.logTag, key);
OWSFailDebug(@"couldn't decode base 64 value for key: %@", key);
return nil;
}
return valueData;
@ -197,8 +197,7 @@ NS_ASSUME_NONNULL_BEGIN
{
NSData *_Nullable valueData = [self base64DataForKey:key];
if (valueData && valueData.length != expectedLength) {
OWSLogDebug(@"%@ decoded base 64 value for key: %@, has unexpected length: %zd != %zd",
self.logTag,
OWSLogDebug(@"decoded base 64 value for key: %@, has unexpected length: %zd != %zd",
key,
valueData.length,
expectedLength);
@ -271,7 +270,7 @@ NS_ASSUME_NONNULL_BEGIN
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
RemoteAttestationAuth *_Nullable auth = [self parseAuthParams:responseDict];
if (!auth) {
OWSLogError(@"%@ remote attestation auth could not be parsed: %@", self.logTag, responseDict);
OWSLogError(@"remote attestation auth could not be parsed: %@", responseDict);
NSError *error = OWSErrorMakeUnableToProcessServerResponseError();
failureHandler(error);
return;
@ -282,7 +281,7 @@ NS_ASSUME_NONNULL_BEGIN
}
failure:^(NSURLSessionDataTask *task, NSError *error) {
NSHTTPURLResponse *response = (NSHTTPURLResponse *)task.response;
OWSLogVerbose(@"%@ remote attestation auth failure: %zd", self.logTag, response.statusCode);
OWSLogVerbose(@"remote attestation auth failure: %zd", response.statusCode);
failureHandler(error);
}];
}
@ -296,13 +295,13 @@ NS_ASSUME_NONNULL_BEGIN
NSDictionary *responseDict = response;
NSString *_Nullable password = [responseDict stringForKey:@"password"];
if (password.length < 1) {
OWSFailDebug(@"%@ missing or empty password.", self.logTag);
OWSFailDebug(@"missing or empty password.");
return nil;
}
NSString *_Nullable username = [responseDict stringForKey:@"username"];
if (username.length < 1) {
OWSFailDebug(@"%@ missing or empty username.", self.logTag);
OWSFailDebug(@"missing or empty username.");
return nil;
}
@ -346,7 +345,7 @@ NS_ASSUME_NONNULL_BEGIN
}
failure:^(NSURLSessionDataTask *task, NSError *error) {
NSHTTPURLResponse *response = (NSHTTPURLResponse *)task.response;
OWSLogVerbose(@"%@ remote attestation failure: %zd", self.logTag, response.statusCode);
OWSLogVerbose(@"remote attestation failure: %zd", response.statusCode);
failureHandler(error);
}];
}
@ -363,14 +362,14 @@ NS_ASSUME_NONNULL_BEGIN
OWSAssert(enclaveId.length > 0);
if (![response isKindOfClass:[NSHTTPURLResponse class]]) {
OWSFailDebug(@"%@ unexpected response type.", self.logTag);
OWSFailDebug(@"unexpected response type.");
return nil;
}
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *)response;
NSArray<NSHTTPCookie *> *cookies =
[NSHTTPCookie cookiesWithResponseHeaderFields:httpResponse.allHeaderFields forURL:[NSURL new]];
if (cookies.count < 1) {
OWSFailDebug(@"%@ couldn't parse cookie.", self.logTag);
OWSFailDebug(@"couldn't parse cookie.");
return nil;
}
@ -381,52 +380,52 @@ NS_ASSUME_NONNULL_BEGIN
NSData *_Nullable serverEphemeralPublic =
[responseDict base64DataForKey:@"serverEphemeralPublic" expectedLength:32];
if (!serverEphemeralPublic) {
OWSFailDebug(@"%@ couldn't parse serverEphemeralPublic.", self.logTag);
OWSFailDebug(@"couldn't parse serverEphemeralPublic.");
return nil;
}
NSData *_Nullable serverStaticPublic = [responseDict base64DataForKey:@"serverStaticPublic" expectedLength:32];
if (!serverStaticPublic) {
OWSFailDebug(@"%@ couldn't parse serverStaticPublic.", self.logTag);
OWSFailDebug(@"couldn't parse serverStaticPublic.");
return nil;
}
NSData *_Nullable encryptedRequestId = [responseDict base64DataForKey:@"ciphertext"];
if (!encryptedRequestId) {
OWSFailDebug(@"%@ couldn't parse encryptedRequestId.", self.logTag);
OWSFailDebug(@"couldn't parse encryptedRequestId.");
return nil;
}
NSData *_Nullable encryptedRequestIv = [responseDict base64DataForKey:@"iv" expectedLength:12];
if (!encryptedRequestIv) {
OWSFailDebug(@"%@ couldn't parse encryptedRequestIv.", self.logTag);
OWSFailDebug(@"couldn't parse encryptedRequestIv.");
return nil;
}
NSData *_Nullable encryptedRequestTag = [responseDict base64DataForKey:@"tag" expectedLength:16];
if (!encryptedRequestTag) {
OWSFailDebug(@"%@ couldn't parse encryptedRequestTag.", self.logTag);
OWSFailDebug(@"couldn't parse encryptedRequestTag.");
return nil;
}
NSData *_Nullable quoteData = [responseDict base64DataForKey:@"quote"];
if (!quoteData) {
OWSFailDebug(@"%@ couldn't parse quote data.", self.logTag);
OWSFailDebug(@"couldn't parse quote data.");
return nil;
}
NSString *_Nullable signatureBody = [responseDict stringForKey:@"signatureBody"];
if (![signatureBody isKindOfClass:[NSString class]]) {
OWSFailDebug(@"%@ couldn't parse signatureBody.", self.logTag);
OWSFailDebug(@"couldn't parse signatureBody.");
return nil;
}
NSData *_Nullable signature = [responseDict base64DataForKey:@"signature"];
if (!signature) {
OWSFailDebug(@"%@ couldn't parse signature.", self.logTag);
OWSFailDebug(@"couldn't parse signature.");
return nil;
}
NSString *_Nullable encodedCertificates = [responseDict stringForKey:@"certificates"];
if (![encodedCertificates isKindOfClass:[NSString class]]) {
OWSFailDebug(@"%@ couldn't parse encodedCertificates.", self.logTag);
OWSFailDebug(@"couldn't parse encodedCertificates.");
return nil;
}
NSString *_Nullable certificates = [encodedCertificates stringByRemovingPercentEncoding];
if (!certificates) {
OWSFailDebug(@"%@ couldn't parse certificates.", self.logTag);
OWSFailDebug(@"couldn't parse certificates.");
return nil;
}
@ -434,13 +433,13 @@ NS_ASSUME_NONNULL_BEGIN
serverEphemeralPublic:serverEphemeralPublic
serverStaticPublic:serverStaticPublic];
if (!keys) {
OWSFailDebug(@"%@ couldn't derive keys.", self.logTag);
OWSFailDebug(@"couldn't derive keys.");
return nil;
}
CDSQuote *_Nullable quote = [CDSQuote parseQuoteFromData:quoteData];
if (!quote) {
OWSFailDebug(@"%@ couldn't parse quote.", self.logTag);
OWSFailDebug(@"couldn't parse quote.");
return nil;
}
NSData *_Nullable requestId = [self decryptRequestId:encryptedRequestId
@ -448,12 +447,12 @@ NS_ASSUME_NONNULL_BEGIN
encryptedRequestTag:encryptedRequestTag
keys:keys];
if (!requestId) {
OWSFailDebug(@"%@ couldn't decrypt request id.", self.logTag);
OWSFailDebug(@"couldn't decrypt request id.");
return nil;
}
if (![self verifyServerQuote:quote keys:keys enclaveId:enclaveId]) {
OWSFailDebug(@"%@ couldn't verify quote.", self.logTag);
OWSFailDebug(@"couldn't verify quote.");
return nil;
}
@ -461,7 +460,7 @@ NS_ASSUME_NONNULL_BEGIN
signatureBody:signatureBody
signature:signature
quoteData:quoteData]) {
OWSFailDebug(@"%@ couldn't verify ias signature.", self.logTag);
OWSFailDebug(@"couldn't verify ias signature.");
return nil;
}
@ -472,7 +471,7 @@ NS_ASSUME_NONNULL_BEGIN
result.enclaveId = enclaveId;
result.auth = auth;
OWSLogVerbose(@"%@ remote attestation complete.", self.logTag);
OWSLogVerbose(@"remote attestation complete.");
return result;
}
@ -489,42 +488,42 @@ NS_ASSUME_NONNULL_BEGIN
CDSSigningCertificate *_Nullable certificate = [CDSSigningCertificate parseCertificateFromPem:certificates];
if (!certificate) {
OWSFailDebug(@"%@ could not parse signing certificate.", self.logTag);
OWSFailDebug(@"could not parse signing certificate.");
return NO;
}
if (![certificate verifySignatureOfBody:signatureBody signature:signature]) {
OWSFailDebug(@"%@ could not verify signature.", self.logTag);
OWSFailDebug(@"could not verify signature.");
return NO;
}
SignatureBodyEntity *_Nullable signatureBodyEntity = [self parseSignatureBodyEntity:signatureBody];
if (!signatureBodyEntity) {
OWSFailDebug(@"%@ could not parse signature body.", self.logTag);
OWSFailDebug(@"could not parse signature body.");
return NO;
}
// Compare the first N bytes of the quote data with the signed quote body.
const NSUInteger kQuoteBodyComparisonLength = 432;
if (signatureBodyEntity.isvEnclaveQuoteBody.length < kQuoteBodyComparisonLength) {
OWSFailDebug(@"%@ isvEnclaveQuoteBody has unexpected length.", self.logTag);
OWSFailDebug(@"isvEnclaveQuoteBody has unexpected length.");
return NO;
}
if (quoteData.length < kQuoteBodyComparisonLength) {
OWSFailDebug(@"%@ quoteData has unexpected length.", self.logTag);
OWSFailDebug(@"quoteData has unexpected length.");
return NO;
}
NSData *isvEnclaveQuoteBodyForComparison =
[signatureBodyEntity.isvEnclaveQuoteBody subdataWithRange:NSMakeRange(0, kQuoteBodyComparisonLength)];
NSData *quoteDataForComparison = [quoteData subdataWithRange:NSMakeRange(0, kQuoteBodyComparisonLength)];
if (![isvEnclaveQuoteBodyForComparison ows_constantTimeIsEqualToData:quoteDataForComparison]) {
OWSFailDebug(@"%@ isvEnclaveQuoteBody and quoteData do not match.", self.logTag);
OWSFailDebug(@"isvEnclaveQuoteBody and quoteData do not match.");
return NO;
}
// TODO: Before going to production, remove GROUP_OUT_OF_DATE.
if (![@"OK" isEqualToString:signatureBodyEntity.isvEnclaveQuoteStatus]
&& ![@"GROUP_OUT_OF_DATE" isEqualToString:signatureBodyEntity.isvEnclaveQuoteStatus]) {
OWSFailDebug(@"%@ invalid isvEnclaveQuoteStatus: %@.", self.logTag, signatureBodyEntity.isvEnclaveQuoteStatus);
OWSFailDebug(@"invalid isvEnclaveQuoteStatus: %@.", signatureBodyEntity.isvEnclaveQuoteStatus);
return NO;
}
@ -534,7 +533,7 @@ NS_ASSUME_NONNULL_BEGIN
[dateFormatter setDateFormat:@"yyy-MM-dd'T'HH:mm:ss.SSSSSS"];
NSDate *timestampDate = [dateFormatter dateFromString:signatureBodyEntity.timestamp];
if (!timestampDate) {
OWSFailDebug(@"%@ could not parse signature body timestamp.", self.logTag);
OWSFailDebug(@"could not parse signature body timestamp.");
return NO;
}
@ -548,7 +547,7 @@ NS_ASSUME_NONNULL_BEGIN
BOOL isExpired = [now isAfterDate:timestampDatePlus1Day];
if (isExpired) {
OWSFailDebug(@"%@ Signature is expired.", self.logTag);
OWSFailDebug(@"Signature is expired.");
return NO;
}
@ -565,22 +564,22 @@ NS_ASSUME_NONNULL_BEGIN
options:0
error:&error];
if (error || ![jsonDict isKindOfClass:[NSDictionary class]]) {
OWSFailDebug(@"%@ could not parse signature body JSON: %@.", self.logTag, error);
OWSFailDebug(@"could not parse signature body JSON: %@.", error);
return nil;
}
NSString *_Nullable timestamp = [jsonDict stringForKey:@"timestamp"];
if (timestamp.length < 1) {
OWSFailDebug(@"%@ could not parse signature timestamp.", self.logTag);
OWSFailDebug(@"could not parse signature timestamp.");
return nil;
}
NSData *_Nullable isvEnclaveQuoteBody = [jsonDict base64DataForKey:@"isvEnclaveQuoteBody"];
if (isvEnclaveQuoteBody.length < 1) {
OWSFailDebug(@"%@ could not parse signature isvEnclaveQuoteBody.", self.logTag);
OWSFailDebug(@"could not parse signature isvEnclaveQuoteBody.");
return nil;
}
NSString *_Nullable isvEnclaveQuoteStatus = [jsonDict stringForKey:@"isvEnclaveQuoteStatus"];
if (isvEnclaveQuoteStatus.length < 1) {
OWSFailDebug(@"%@ could not parse signature isvEnclaveQuoteStatus.", self.logTag);
OWSFailDebug(@"could not parse signature isvEnclaveQuoteStatus.");
return nil;
}
@ -598,21 +597,19 @@ NS_ASSUME_NONNULL_BEGIN
OWSAssert(enclaveId.length > 0);
if (quote.reportData.length < keys.serverStaticPublic.length) {
OWSFailDebug(@"%@ reportData has unexpected length: %zd != %zd.",
self.logTag,
quote.reportData.length,
keys.serverStaticPublic.length);
OWSFailDebug(
@"reportData has unexpected length: %zd != %zd.", quote.reportData.length, keys.serverStaticPublic.length);
return NO;
}
NSData *_Nullable theirServerPublicStatic =
[quote.reportData subdataWithRange:NSMakeRange(0, keys.serverStaticPublic.length)];
if (theirServerPublicStatic.length != keys.serverStaticPublic.length) {
OWSFailDebug(@"%@ could not extract server public static.", self.logTag);
OWSFailDebug(@"could not extract server public static.");
return NO;
}
if (![keys.serverStaticPublic ows_constantTimeIsEqualToData:theirServerPublicStatic]) {
OWSFailDebug(@"%@ server public statics do not match.", self.logTag);
OWSFailDebug(@"server public statics do not match.");
return NO;
}
// It's easier to compare as hex data than parsing hexadecimal.
@ -621,12 +618,12 @@ NS_ASSUME_NONNULL_BEGIN
[quote.mrenclave.hexadecimalString dataUsingEncoding:NSUTF8StringEncoding];
if (!ourEnclaveIdHexData || !theirEnclaveIdHexData
|| ![ourEnclaveIdHexData ows_constantTimeIsEqualToData:theirEnclaveIdHexData]) {
OWSFailDebug(@"%@ enclave ids do not match.", self.logTag);
OWSFailDebug(@"enclave ids do not match.");
return NO;
}
// TODO: Reverse this condition in production.
if (!quote.isDebugQuote) {
OWSFailDebug(@"%@ quote has invalid isDebugQuote value.", self.logTag);
OWSFailDebug(@"quote has invalid isDebugQuote value.");
return NO;
}
return YES;
@ -644,7 +641,7 @@ NS_ASSUME_NONNULL_BEGIN
OWSAES256Key *_Nullable key = keys.serverKey;
if (!key) {
OWSFailDebug(@"%@ invalid server key.", self.logTag);
OWSFailDebug(@"invalid server key.");
return nil;
}
NSData *_Nullable decryptedData = [Cryptography decryptAESGCMWithInitializationVector:encryptedRequestIv
@ -653,7 +650,7 @@ NS_ASSUME_NONNULL_BEGIN
authTag:encryptedRequestTag
key:key];
if (!decryptedData) {
OWSFailDebug(@"%@ couldn't decrypt request id.", self.logTag);
OWSFailDebug(@"couldn't decrypt request id.");
return nil;
}
return decryptedData;

View File

@ -53,7 +53,7 @@ NS_ASSUME_NONNULL_BEGIN
failure:(void (^)(NSError *error))failure
{
if (identifiers.count < 1) {
OWSFailDebug(@"%@ Cannot lookup zero identifiers", self.logTag);
OWSFailDebug(@"Cannot lookup zero identifiers");
DispatchMainThreadSafe(^{
failure(
OWSErrorWithCodeDescription(OWSErrorCodeInvalidMethodParameters, @"Cannot lookup zero identifiers"));

View File

@ -80,7 +80,7 @@ static NSString *const RPDefaultsKeyPhoneNumberCanonical = @"RPDefaultsKeyPhoneN
countryCode = [locale objectForKey:NSLocaleCountryCode];
#endif
if (!countryCode) {
OWSFailDebug(@"%@ Could not identify country code for locale: %@", self.logTag, locale);
OWSFailDebug(@"Could not identify country code for locale: %@", locale);
countryCode = @"US";
}
return countryCode;
@ -140,24 +140,24 @@ static NSString *const RPDefaultsKeyPhoneNumberCanonical = @"RPDefaultsKeyPhoneN
PhoneNumber *_Nullable parsedPhoneNumber = [self tryParsePhoneNumberFromE164:phoneNumber];
if (!parsedPhoneNumber) {
OWSLogWarn(@"%@ could not parse phone number.", self.logTag);
OWSLogWarn(@"could not parse phone number.");
return phoneNumber;
}
NSNumber *_Nullable countryCode = [parsedPhoneNumber getCountryCode];
if (!countryCode) {
OWSLogWarn(@"%@ parsed phone number has no country code.", self.logTag);
OWSLogWarn(@"parsed phone number has no country code.");
return phoneNumber;
}
NSString *countryCodeString = [self formatIntAsEN:countryCode.intValue];
if (countryCodeString.length < 1) {
OWSLogWarn(@"%@ invalid country code.", self.logTag);
OWSLogWarn(@"invalid country code.");
return phoneNumber;
}
NSString *_Nullable formattedPhoneNumber =
[self bestEffortFormatPartialUserSpecifiedTextToLookLikeAPhoneNumber:phoneNumber
withSpecifiedRegionCode:countryCodeString];
if (!countryCode) {
OWSLogWarn(@"%@ could not format phone number.", self.logTag);
OWSLogWarn(@"could not format phone number.");
return phoneNumber;
}
return formattedPhoneNumber;
@ -379,7 +379,7 @@ static NSString *const RPDefaultsKeyPhoneNumberCanonical = @"RPDefaultsKeyPhoneN
numberFormat:NBEPhoneNumberFormatNATIONAL
error:&error];
if (error) {
OWSLogVerbose(@"%@ error parsing number into national format: %@", self.logTag, error);
OWSLogVerbose(@"error parsing number into national format: %@", error);
return nil;
}

View File

@ -143,7 +143,7 @@ NS_ASSUME_NONNULL_BEGIN
if ([devices isSubsetOfSet:latest.devices.set]) {
return;
}
OWSLogDebug(@"%@ adding devices: %@, to recipient: %@", self.logTag, devices, latest.recipientId);
OWSLogDebug(@"adding devices: %@, to recipient: %@", devices, latest.recipientId);
[latest addDevices:devices];
[latest saveWithTransaction_internal:transaction];
@ -165,7 +165,7 @@ NS_ASSUME_NONNULL_BEGIN
if (![devices intersectsSet:latest.devices.set]) {
return;
}
OWSLogDebug(@"%@ removing devices: %@, from registered recipient: %@", self.logTag, devices, latest.recipientId);
OWSLogDebug(@"removing devices: %@, from registered recipient: %@", devices, latest.recipientId);
[latest removeDevices:devices];
[latest saveWithTransaction_internal:transaction];
@ -189,7 +189,7 @@ NS_ASSUME_NONNULL_BEGIN
// be strict about using persisted SignalRecipients as a cache to
// reflect "last known registration status". Forcing our codebase to
// use those methods helps ensure that we update the cache deliberately.
OWSFailDebug(@"%@ Don't call saveWithTransaction from outside this class.", self.logTag);
OWSFailDebug(@"Don't call saveWithTransaction from outside this class.");
[self saveWithTransaction_internal:transaction];
}
@ -198,7 +198,7 @@ NS_ASSUME_NONNULL_BEGIN
{
[super saveWithTransaction:transaction];
OWSLogVerbose(@"%@ saved signal recipient: %@", self.logTag, self.recipientId);
OWSLogVerbose(@"saved signal recipient: %@", self.recipientId);
}
+ (BOOL)isRegisteredRecipient:(NSString *)recipientId transaction:(YapDatabaseReadTransaction *)transaction
@ -216,7 +216,7 @@ NS_ASSUME_NONNULL_BEGIN
SignalRecipient *_Nullable instance = [self registeredRecipientForRecipientId:recipientId transaction:transaction];
if (!instance) {
OWSLogDebug(@"%@ creating recipient: %@", self.logTag, recipientId);
OWSLogDebug(@"creating recipient: %@", recipientId);
instance = [[self alloc] initWithTextSecureIdentifier:recipientId];
[instance saveWithTransaction_internal:transaction];
@ -233,10 +233,7 @@ NS_ASSUME_NONNULL_BEGIN
SignalRecipient *recipient = [self markRecipientAsRegisteredAndGet:recipientId transaction:transaction];
if (![recipient.devices containsObject:@(deviceId)]) {
OWSLogDebug(@"%@ in %s adding device %u to existing recipient.",
self.logTag,
__PRETTY_FUNCTION__,
(unsigned int)deviceId);
OWSLogDebug(@"Adding device %u to existing recipient.", (unsigned int)deviceId);
[recipient addDevices:[NSSet setWithObject:@(deviceId)]];
[recipient saveWithTransaction_internal:transaction];
@ -252,7 +249,7 @@ NS_ASSUME_NONNULL_BEGIN
if (!instance) {
return;
}
OWSLogDebug(@"%@ removing recipient: %@", self.logTag, recipientId);
OWSLogDebug(@"removing recipient: %@", recipientId);
[instance removeWithTransaction:transaction];
}

View File

@ -101,10 +101,8 @@ NS_ASSUME_NONNULL_BEGIN
[interactionsByThread enumerateKeysInGroup:self.uniqueId
usingBlock:^(NSString *collection, NSString *key, NSUInteger index, BOOL *stop) {
if (![key isKindOfClass:[NSString class]] || key.length < 1) {
OWSFailDebug(@"%@ invalid key in thread interactions: %@, %@.",
self.logTag,
key,
[key class]);
OWSFailDebug(
@"invalid key in thread interactions: %@, %@.", key, [key class]);
didDetectCorruption = YES;
return;
}
@ -112,7 +110,7 @@ NS_ASSUME_NONNULL_BEGIN
}];
if (didDetectCorruption) {
OWSLogWarn(@"%@ incrementing version of: %@", self.logTag, TSMessageDatabaseViewExtensionName);
OWSLogWarn(@"incrementing version of: %@", TSMessageDatabaseViewExtensionName);
[OWSPrimaryStorage incrementVersionOfDatabaseExtension:TSMessageDatabaseViewExtensionName];
}
@ -121,7 +119,7 @@ NS_ASSUME_NONNULL_BEGIN
TSInteraction *_Nullable interaction =
[TSInteraction fetchObjectWithUniqueID:interactionId transaction:transaction];
if (!interaction) {
OWSFailDebug(@"%@ couldn't load thread's interaction for deletion.", self.logTag);
OWSFailDebug(@"couldn't load thread's interaction for deletion.");
continue;
}
[interaction removeWithTransaction:transaction];
@ -242,7 +240,7 @@ NS_ASSUME_NONNULL_BEGIN
NSString *collection, NSString *key, id object, id metadata, NSUInteger index, BOOL *stop) {
if (![object conformsToProtocol:@protocol(OWSReadTracking)]) {
OWSFailDebug(@"%@ Unexpected object in unseen messages: %@", self.logTag, [object class]);
OWSFailDebug(@"Unexpected object in unseen messages: %@", [object class]);
return;
}
[messages addObject:(id<OWSReadTracking>)object];
@ -461,7 +459,7 @@ NS_ASSUME_NONNULL_BEGIN
if (hashData) {
[hashData getBytes:&hash length:hashingLength];
} else {
OWSFailDebug(@"%@ could not compute hash for color seed.", self.logTag);
OWSFailDebug(@"could not compute hash for color seed.");
}
NSUInteger index = (hash % [self.conversationColorNames count]);

View File

@ -39,7 +39,7 @@ NS_ASSUME_NONNULL_BEGIN
NSError *error;
SSKProtoSyncMessageBlocked *_Nullable blockedProto = [blockedBuilder buildAndReturnError:&error];
if (error || !blockedProto) {
OWSFailDebug(@"%@ could not build protobuf: %@", self.logTag, error);
OWSFailDebug(@"could not build protobuf: %@", error);
return nil;
}

View File

@ -32,7 +32,7 @@ NS_ASSUME_NONNULL_BEGIN
{
NSInteger written = [self.outputStream write:&value maxLength:sizeof(value)];
if (written != sizeof(value)) {
OWSFailDebug(@"%@ could not write to output stream.", self.logTag);
OWSFailDebug(@"could not write to output stream.");
self.hasError = YES;
return NO;
}
@ -50,7 +50,7 @@ NS_ASSUME_NONNULL_BEGIN
while (YES) {
NSInteger written = [self.outputStream write:data.bytes maxLength:data.length];
if (written < 1) {
OWSFailDebug(@"%@ could not write to output stream.", self.logTag);
OWSFailDebug(@"could not write to output stream.");
self.hasError = YES;
return NO;
}

View File

@ -42,7 +42,7 @@ disappearingMessagesConfiguration:(nullable OWSDisappearingMessagesConfiguration
recipientIdentity.verificationState,
0);
if (!verified) {
OWSLogError(@"%@ could not build protobuf.", self.logTag);
OWSLogError(@"could not build protobuf.");
return;
}
contactBuilder.verified = verified;
@ -61,7 +61,7 @@ disappearingMessagesConfiguration:(nullable OWSDisappearingMessagesConfiguration
NSError *error;
SSKProtoContactDetailsAvatar *_Nullable avatar = [avatarBuilder buildAndReturnError:&error];
if (error || !avatar) {
OWSLogError(@"%@ could not build protobuf: %@", self.logTag, error);
OWSLogError(@"could not build protobuf: %@", error);
return;
}
[contactBuilder setAvatar:avatar];
@ -89,7 +89,7 @@ disappearingMessagesConfiguration:(nullable OWSDisappearingMessagesConfiguration
NSError *error;
NSData *_Nullable contactData = [contactBuilder buildSerializedDataAndReturnError:&error];
if (error || !contactData) {
OWSFailDebug(@"%@ could not serialize protobuf: %@", self.logTag, error);
OWSFailDebug(@"could not serialize protobuf: %@", error);
return;
}

View File

@ -175,7 +175,7 @@ NSString *const kOWSPrimaryStorage_MayHaveLinkedDevices = @"kTSStorageManager_Ma
}
}
*success = NO;
OWSLogError(@"%@ unable to decode date from %@", self.logTag, value);
OWSLogError(@"unable to decode date from %@", value);
*error = OWSErrorWithCodeDescription(OWSErrorCodeFailedToDecodeJson, @"Unable to decode date from %@");
return nil;
}
@ -188,7 +188,7 @@ NSString *const kOWSPrimaryStorage_MayHaveLinkedDevices = @"kTSStorageManager_Ma
return result;
}
}
OWSLogError(@"%@ unable to encode date from %@", self.logTag, value);
OWSLogError(@"unable to encode date from %@", value);
*error = OWSErrorWithCodeDescription(OWSErrorCodeFailedToEncodeJson, @"Unable to encode date");
*success = NO;
return nil;

View File

@ -39,7 +39,7 @@ NS_ASSUME_NONNULL_BEGIN
NSError *error;
SSKProtoGroupDetailsAvatar *_Nullable avatarProto = [avatarBuilder buildAndReturnError:&error];
if (error || !avatarProto) {
OWSFailDebug(@"%@ could not build protobuf: %@", self.logTag, error);
OWSFailDebug(@"could not build protobuf: %@", error);
} else {
[groupBuilder setAvatar:avatarProto];
}
@ -60,7 +60,7 @@ NS_ASSUME_NONNULL_BEGIN
NSError *error;
NSData *_Nullable groupData = [groupBuilder buildSerializedDataAndReturnError:&error];
if (error || !groupData) {
OWSFailDebug(@"%@ could not serialize protobuf: %@", self.logTag, error);
OWSFailDebug(@"could not serialize protobuf: %@", error);
return;
}

View File

@ -69,7 +69,7 @@ NS_ASSUME_NONNULL_BEGIN
NSData *_Nullable cipherText = [self encrypt:dataToEncrypt withKey:cipherKey];
if (cipherText == nil) {
OWSFailDebug(@"%@ Provisioning cipher failed.", self.logTag);
OWSFailDebug(@"Provisioning cipher failed.");
return nil;
}
@ -77,7 +77,7 @@ NS_ASSUME_NONNULL_BEGIN
NSData *_Nullable mac = [self macForMessage:message withKey:macKey];
if (mac == nil) {
OWSFailDebug(@"%@ mac failed.", self.logTag);
OWSFailDebug(@"mac failed.");
return nil;
}
[message appendData:mac];
@ -89,11 +89,11 @@ NS_ASSUME_NONNULL_BEGIN
{
NSData *iv = self.initializationVector;
if (iv.length != kCCBlockSizeAES128) {
OWSFailDebug(@"%@ Unexpected length for iv", self.logTag);
OWSFailDebug(@"Unexpected length for iv");
return nil;
}
if (dataToEncrypt.length >= SIZE_MAX - (kCCBlockSizeAES128 + iv.length)) {
OWSFailDebug(@"%@ data is too long to encrypt.", self.logTag);
OWSFailDebug(@"data is too long to encrypt.");
return nil;
}

View File

@ -63,7 +63,7 @@ NS_ASSUME_NONNULL_BEGIN
NSError *error;
NSData *_Nullable plainTextProvisionMessage = [messageBuilder buildSerializedDataAndReturnError:&error];
if (!plainTextProvisionMessage || error) {
OWSFailDebug(@"%@ could not serialize proto: %@.", self.logTag, error);
OWSFailDebug(@"could not serialize proto: %@.", error);
return nil;
}
@ -81,7 +81,7 @@ NS_ASSUME_NONNULL_BEGIN
NSData *_Nullable envelopeData = [envelopeBuilder buildSerializedDataAndReturnError:&error];
if (!envelopeData || error) {
OWSFailDebug(@"%@ could not serialize proto: %@.", self.logTag, error);
OWSFailDebug(@"could not serialize proto: %@.", error);
return nil;
}

View File

@ -44,7 +44,7 @@ NS_ASSUME_NONNULL_BEGIN
NSError *error;
SSKProtoSyncMessageRead *_Nullable readProto = [readProtoBuilder buildAndReturnError:&error];
if (error || !readProto) {
OWSFailDebug(@"%@ could not build protobuf: %@", self.logTag, error);
OWSFailDebug(@"could not build protobuf: %@", error);
return nil;
}
[syncMessageBuilder addRead:readProto];

View File

@ -60,7 +60,7 @@ NS_ASSUME_NONNULL_BEGIN
SSKProtoReceiptMessage *_Nullable receiptMessage = [self buildReceiptMessage:recipient.recipientId];
if (!receiptMessage) {
OWSFailDebug(@"%@ could not build protobuf.", self.logTag);
OWSFailDebug(@"could not build protobuf.");
return nil;
}
@ -70,7 +70,7 @@ NS_ASSUME_NONNULL_BEGIN
NSError *error;
NSData *_Nullable contentData = [contentBuilder buildSerializedDataAndReturnError:&error];
if (error || !contentData) {
OWSFailDebug(@"%@ could not serialize protobuf: %@", self.logTag, error);
OWSFailDebug(@"could not serialize protobuf: %@", error);
return nil;
}
return contentData;
@ -89,7 +89,7 @@ NS_ASSUME_NONNULL_BEGIN
NSError *error;
SSKProtoReceiptMessage *_Nullable receiptMessage = [builder buildAndReturnError:&error];
if (error || !receiptMessage) {
OWSFailDebug(@"%@ could not build protobuf: %@", self.logTag, error);
OWSFailDebug(@"could not build protobuf: %@", error);
return nil;
}
return receiptMessage;

Some files were not shown because too many files have changed in this diff Show More