Fix build warnings from XCode 9.

This commit is contained in:
Matthew Chen 2017-11-08 13:03:51 -05:00
parent 2d21e2ae2c
commit a6bfc0a60e
5 changed files with 103 additions and 62 deletions

View File

@ -20,4 +20,5 @@
#import <SignalServiceKit/OWSAnalytics.h> #import <SignalServiceKit/OWSAnalytics.h>
#import <SignalServiceKit/OWSDispatch.h> #import <SignalServiceKit/OWSDispatch.h>
#import <SignalServiceKit/iOSVersions.h> #import <SignalServiceKit/iOSVersions.h>
#import <SignalServiceKit/NSObject+OWS.h>
#endif #endif

View File

@ -63,26 +63,26 @@ static NSString *const kURLHostVerifyPrefix = @"verify";
@synthesize window = _window; @synthesize window = _window;
- (void)applicationDidEnterBackground:(UIApplication *)application { - (void)applicationDidEnterBackground:(UIApplication *)application {
DDLogWarn(@"%@ applicationDidEnterBackground.", self.tag); DDLogWarn(@"%@ applicationDidEnterBackground.", self.logTag);
[DDLog flushLog]; [DDLog flushLog];
} }
- (void)applicationWillEnterForeground:(UIApplication *)application { - (void)applicationWillEnterForeground:(UIApplication *)application {
DDLogWarn(@"%@ applicationWillEnterForeground.", self.tag); DDLogWarn(@"%@ applicationWillEnterForeground.", self.logTag);
[[UIApplication sharedApplication] setApplicationIconBadgeNumber:0]; [[UIApplication sharedApplication] setApplicationIconBadgeNumber:0];
} }
- (void)applicationDidReceiveMemoryWarning:(UIApplication *)application - (void)applicationDidReceiveMemoryWarning:(UIApplication *)application
{ {
DDLogWarn(@"%@ applicationDidReceiveMemoryWarning.", self.tag); DDLogWarn(@"%@ applicationDidReceiveMemoryWarning.", self.logTag);
} }
- (void)applicationWillTerminate:(UIApplication *)application - (void)applicationWillTerminate:(UIApplication *)application
{ {
DDLogWarn(@"%@ applicationWillTerminate.", self.tag); DDLogWarn(@"%@ applicationWillTerminate.", self.logTag);
[DDLog flushLog]; [DDLog flushLog];
} }
@ -100,7 +100,7 @@ static NSString *const kURLHostVerifyPrefix = @"verify";
[DebugLogger.sharedLogger enableFileLogging]; [DebugLogger.sharedLogger enableFileLogging];
} }
DDLogWarn(@"%@ application: didFinishLaunchingWithOptions.", self.tag); DDLogWarn(@"%@ application: didFinishLaunchingWithOptions.", self.logTag);
[AppVersion instance]; [AppVersion instance];
@ -164,7 +164,7 @@ static NSString *const kURLHostVerifyPrefix = @"verify";
name:kNSNotificationName_RegistrationStateDidChange name:kNSNotificationName_RegistrationStateDidChange
object:nil]; object:nil];
DDLogInfo(@"%@ application: didFinishLaunchingWithOptions completed.", self.tag); DDLogInfo(@"%@ application: didFinishLaunchingWithOptions completed.", self.logTag);
[OWSAnalytics appLaunchDidBegin]; [OWSAnalytics appLaunchDidBegin];
@ -205,7 +205,7 @@ static NSString *const kURLHostVerifyPrefix = @"verify";
&& (!lastCompletedLaunchAppVersion || && (!lastCompletedLaunchAppVersion ||
[VersionMigrations isVersion:lastCompletedLaunchAppVersion [VersionMigrations isVersion:lastCompletedLaunchAppVersion
lessThan:kLastVersionWithDatabaseViewChange])); lessThan:kLastVersionWithDatabaseViewChange]));
DDLogInfo(@"%@ mayNeedUpgrade: %d", self.tag, mayNeedUpgrade); DDLogInfo(@"%@ mayNeedUpgrade: %d", self.logTag, mayNeedUpgrade);
if (mayNeedUpgrade) { if (mayNeedUpgrade) {
UIView *rootView = viewController.view; UIView *rootView = viewController.view;
UIImageView *iconView = nil; UIImageView *iconView = nil;
@ -271,15 +271,16 @@ static NSString *const kURLHostVerifyPrefix = @"verify";
- (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken - (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken
{ {
DDLogInfo(@"%@ registered vanilla push token: %@", self.tag, deviceToken); DDLogInfo(@"%@ registered vanilla push token: %@", self.logTag, deviceToken);
[PushRegistrationManager.sharedManager didReceiveVanillaPushToken:deviceToken]; [PushRegistrationManager.sharedManager didReceiveVanillaPushToken:deviceToken];
} }
- (void)application:(UIApplication *)application didFailToRegisterForRemoteNotificationsWithError:(NSError *)error - (void)application:(UIApplication *)application didFailToRegisterForRemoteNotificationsWithError:(NSError *)error
{ {
DDLogError(@"%@ failed to register vanilla push token with error: %@", self.tag, error); DDLogError(@"%@ failed to register vanilla push token with error: %@", self.logTag, error);
#ifdef DEBUG #ifdef DEBUG
DDLogWarn(@"%@ We're in debug mode. Faking success for remote registration with a fake push identifier", self.tag); DDLogWarn(
@"%@ We're in debug mode. Faking success for remote registration with a fake push identifier", self.logTag);
[PushRegistrationManager.sharedManager didReceiveVanillaPushToken:[[NSMutableData dataWithLength:32] copy]]; [PushRegistrationManager.sharedManager didReceiveVanillaPushToken:[[NSMutableData dataWithLength:32] copy]];
#else #else
OWSProdError([OWSAnalyticsEvents appDelegateErrorFailedToRegisterForRemoteNotifications]); OWSProdError([OWSAnalyticsEvents appDelegateErrorFailedToRegisterForRemoteNotifications]);
@ -290,7 +291,7 @@ static NSString *const kURLHostVerifyPrefix = @"verify";
- (void)application:(UIApplication *)application - (void)application:(UIApplication *)application
didRegisterUserNotificationSettings:(UIUserNotificationSettings *)notificationSettings didRegisterUserNotificationSettings:(UIUserNotificationSettings *)notificationSettings
{ {
DDLogInfo(@"%@ registered user notification settings", self.tag); DDLogInfo(@"%@ registered user notification settings", self.logTag);
[PushRegistrationManager.sharedManager didRegisterUserNotificationSettings]; [PushRegistrationManager.sharedManager didRegisterUserNotificationSettings];
} }
@ -319,7 +320,7 @@ static NSString *const kURLHostVerifyPrefix = @"verify";
} else if ([url.scheme.lowercaseString isEqualToString:@"file"]) { } else if ([url.scheme.lowercaseString isEqualToString:@"file"]) {
if ([Environment getCurrent].callService.call != nil) { if ([Environment getCurrent].callService.call != nil) {
DDLogWarn(@"%@ ignoring 'open with Signal' due to ongoing WebRTC call.", self.tag); DDLogWarn(@"%@ ignoring 'open with Signal' due to ongoing WebRTC call.", self.logTag);
return NO; return NO;
} }
@ -351,12 +352,14 @@ static NSString *const kURLHostVerifyPrefix = @"verify";
NSError *typeError; NSError *typeError;
[url getResourceValue:&utiType forKey:NSURLTypeIdentifierKey error:&typeError]; [url getResourceValue:&utiType forKey:NSURLTypeIdentifierKey error:&typeError];
if (typeError) { if (typeError) {
OWSFail( OWSFail(@"%@ Determining type of picked document at url: %@ failed with error: %@",
@"%@ Determining type of picked document at url: %@ failed with error: %@", self.tag, url, typeError); self.logTag,
url,
typeError);
return NO; return NO;
} }
if (!utiType) { if (!utiType) {
OWSFail(@"%@ falling back to default filetype for picked document at url: %@", self.tag, url); OWSFail(@"%@ falling back to default filetype for picked document at url: %@", self.logTag, url);
utiType = (__bridge NSString *)kUTTypeData; utiType = (__bridge NSString *)kUTTypeData;
return NO; return NO;
} }
@ -366,12 +369,12 @@ static NSString *const kURLHostVerifyPrefix = @"verify";
[url getResourceValue:&isDirectory forKey:NSURLIsDirectoryKey error:&isDirectoryError]; [url getResourceValue:&isDirectory forKey:NSURLIsDirectoryKey error:&isDirectoryError];
if (isDirectoryError) { if (isDirectoryError) {
OWSFail(@"%@ Determining if picked document at url: %@ was a directory failed with error: %@", OWSFail(@"%@ Determining if picked document at url: %@ was a directory failed with error: %@",
self.tag, self.logTag,
url, url,
isDirectoryError); isDirectoryError);
return NO; return NO;
} else if ([isDirectory boolValue]) { } else if ([isDirectory boolValue]) {
DDLogInfo(@"%@ User picked directory at url: %@", self.tag, url); DDLogInfo(@"%@ User picked directory at url: %@", self.logTag, url);
DDLogError(@"Application opened with URL of unknown UTI type: %@", url); DDLogError(@"Application opened with URL of unknown UTI type: %@", url);
[OWSAlerts [OWSAlerts
showAlertWithTitle: showAlertWithTitle:
@ -462,7 +465,7 @@ static NSString *const kURLHostVerifyPrefix = @"verify";
} }
- (void)applicationDidBecomeActive:(UIApplication *)application { - (void)applicationDidBecomeActive:(UIApplication *)application {
DDLogWarn(@"%@ applicationDidBecomeActive.", self.tag); DDLogWarn(@"%@ applicationDidBecomeActive.", self.logTag);
if (getenv("runningTests_dontStartApp")) { if (getenv("runningTests_dontStartApp")) {
return; return;
@ -483,8 +486,10 @@ static NSString *const kURLHostVerifyPrefix = @"verify";
// At this point, potentially lengthy DB locking migrations could be running. // 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 // 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), ^{ dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
DDLogInfo(@"%@ running post launch block for registered user: %@", self.tag, [TSAccountManager localNumber]); DDLogInfo(@"%@ running post launch block for registered user: %@",
self.logTag,
[TSAccountManager localNumber]);
// Clean up any messages that expired since last launch immediately // Clean up any messages that expired since last launch immediately
// and continue cleaning in the background. // and continue cleaning in the background.
[[OWSDisappearingMessagesJob sharedJob] startIfNecessary]; [[OWSDisappearingMessagesJob sharedJob] startIfNecessary];
@ -503,7 +508,7 @@ static NSString *const kURLHostVerifyPrefix = @"verify";
[AppStoreRating setupRatingLibrary]; [AppStoreRating setupRatingLibrary];
}); });
} else { } else {
DDLogInfo(@"%@ running post launch block for unregistered user.", self.tag); DDLogInfo(@"%@ running post launch block for unregistered user.", self.logTag);
// Unregistered user should have no unread messages. e.g. if you delete your account. // Unregistered user should have no unread messages. e.g. if you delete your account.
[[UIApplication sharedApplication] setApplicationIconBadgeNumber:0]; [[UIApplication sharedApplication] setApplicationIconBadgeNumber:0];
@ -529,7 +534,7 @@ static NSString *const kURLHostVerifyPrefix = @"verify";
if (![UIApplication sharedApplication].isRegisteredForRemoteNotifications) { if (![UIApplication sharedApplication].isRegisteredForRemoteNotifications) {
DDLogInfo( DDLogInfo(
@"%@ Retrying to register for remote notifications since user hasn't registered yet.", self.tag); @"%@ Retrying to register for remote notifications since user hasn't registered yet.", self.logTag);
// Push tokens don't normally change while the app is launched, so checking once during launch is // 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 // 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 // "Background App Refresh" will not be able to obtain an APN token. Enabling those settings does not
@ -542,11 +547,11 @@ static NSString *const kURLHostVerifyPrefix = @"verify";
} }
DDLogInfo(@"%@ applicationDidBecomeActive completed.", self.tag); DDLogInfo(@"%@ applicationDidBecomeActive completed.", self.logTag);
} }
- (void)applicationWillResignActive:(UIApplication *)application { - (void)applicationWillResignActive:(UIApplication *)application {
DDLogWarn(@"%@ applicationWillResignActive.", self.tag); DDLogWarn(@"%@ applicationWillResignActive.", self.logTag);
UIBackgroundTaskIdentifier bgTask = [application beginBackgroundTaskWithExpirationHandler:nil]; UIBackgroundTaskIdentifier bgTask = [application beginBackgroundTaskWithExpirationHandler:nil];
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{ dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
@ -598,23 +603,23 @@ static NSString *const kURLHostVerifyPrefix = @"verify";
{ {
if ([userActivity.activityType isEqualToString:@"INStartVideoCallIntent"]) { if ([userActivity.activityType isEqualToString:@"INStartVideoCallIntent"]) {
if (!SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(10, 0)) { if (!SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(10, 0)) {
DDLogError(@"%@ unexpectedly received INStartVideoCallIntent pre iOS10", self.tag); DDLogError(@"%@ unexpectedly received INStartVideoCallIntent pre iOS10", self.logTag);
return NO; return NO;
} }
DDLogInfo(@"%@ got start video call intent", self.tag); DDLogInfo(@"%@ got start video call intent", self.logTag);
INInteraction *interaction = [userActivity interaction]; INInteraction *interaction = [userActivity interaction];
INIntent *intent = interaction.intent; INIntent *intent = interaction.intent;
if (![intent isKindOfClass:[INStartVideoCallIntent class]]) { if (![intent isKindOfClass:[INStartVideoCallIntent class]]) {
DDLogError(@"%@ unexpected class for start call video: %@", self.tag, intent); DDLogError(@"%@ unexpected class for start call video: %@", self.logTag, intent);
return NO; return NO;
} }
INStartVideoCallIntent *startCallIntent = (INStartVideoCallIntent *)intent; INStartVideoCallIntent *startCallIntent = (INStartVideoCallIntent *)intent;
NSString *_Nullable handle = startCallIntent.contacts.firstObject.personHandle.value; NSString *_Nullable handle = startCallIntent.contacts.firstObject.personHandle.value;
if (!handle) { if (!handle) {
DDLogWarn(@"%@ unable to find handle in startCallIntent: %@", self.tag, startCallIntent); DDLogWarn(@"%@ unable to find handle in startCallIntent: %@", self.logTag, startCallIntent);
return NO; return NO;
} }
@ -622,7 +627,7 @@ static NSString *const kURLHostVerifyPrefix = @"verify";
if ([handle hasPrefix:CallKitCallManager.kAnonymousCallHandlePrefix]) { if ([handle hasPrefix:CallKitCallManager.kAnonymousCallHandlePrefix]) {
phoneNumber = [[TSStorageManager sharedManager] phoneNumberForCallKitId:handle]; phoneNumber = [[TSStorageManager sharedManager] phoneNumberForCallKitId:handle];
if (phoneNumber.length < 1) { if (phoneNumber.length < 1) {
DDLogWarn(@"%@ ignoring attempt to initiate video call to unknown anonymous signal user.", self.tag); DDLogWarn(@"%@ ignoring attempt to initiate video call to unknown anonymous signal user.", self.logTag);
return NO; return NO;
} }
} }
@ -637,12 +642,12 @@ static NSString *const kURLHostVerifyPrefix = @"verify";
// to that user - unless there already is another call in progress. // to that user - unless there already is another call in progress.
if ([Environment getCurrent].callService.call != nil) { if ([Environment getCurrent].callService.call != nil) {
if ([phoneNumber isEqualToString:[Environment getCurrent].callService.call.remotePhoneNumber]) { if ([phoneNumber isEqualToString:[Environment getCurrent].callService.call.remotePhoneNumber]) {
DDLogWarn(@"%@ trying to upgrade ongoing call to video.", self.tag); DDLogWarn(@"%@ trying to upgrade ongoing call to video.", self.logTag);
[[Environment getCurrent].callService handleCallKitStartVideo]; [[Environment getCurrent].callService handleCallKitStartVideo];
return YES; return YES;
} else { } else {
DDLogWarn( DDLogWarn(
@"%@ ignoring INStartVideoCallIntent due to ongoing WebRTC call with another party.", self.tag); @"%@ ignoring INStartVideoCallIntent due to ongoing WebRTC call with another party.", self.logTag);
return NO; return NO;
} }
} }
@ -653,23 +658,23 @@ static NSString *const kURLHostVerifyPrefix = @"verify";
} else if ([userActivity.activityType isEqualToString:@"INStartAudioCallIntent"]) { } else if ([userActivity.activityType isEqualToString:@"INStartAudioCallIntent"]) {
if (!SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(10, 0)) { if (!SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(10, 0)) {
DDLogError(@"%@ unexpectedly received INStartAudioCallIntent pre iOS10", self.tag); DDLogError(@"%@ unexpectedly received INStartAudioCallIntent pre iOS10", self.logTag);
return NO; return NO;
} }
DDLogInfo(@"%@ got start audio call intent", self.tag); DDLogInfo(@"%@ got start audio call intent", self.logTag);
INInteraction *interaction = [userActivity interaction]; INInteraction *interaction = [userActivity interaction];
INIntent *intent = interaction.intent; INIntent *intent = interaction.intent;
if (![intent isKindOfClass:[INStartAudioCallIntent class]]) { if (![intent isKindOfClass:[INStartAudioCallIntent class]]) {
DDLogError(@"%@ unexpected class for start call audio: %@", self.tag, intent); DDLogError(@"%@ unexpected class for start call audio: %@", self.logTag, intent);
return NO; return NO;
} }
INStartAudioCallIntent *startCallIntent = (INStartAudioCallIntent *)intent; INStartAudioCallIntent *startCallIntent = (INStartAudioCallIntent *)intent;
NSString *_Nullable handle = startCallIntent.contacts.firstObject.personHandle.value; NSString *_Nullable handle = startCallIntent.contacts.firstObject.personHandle.value;
if (!handle) { if (!handle) {
DDLogWarn(@"%@ unable to find handle in startCallIntent: %@", self.tag, startCallIntent); DDLogWarn(@"%@ unable to find handle in startCallIntent: %@", self.logTag, startCallIntent);
return NO; return NO;
} }
@ -677,13 +682,13 @@ static NSString *const kURLHostVerifyPrefix = @"verify";
if ([handle hasPrefix:CallKitCallManager.kAnonymousCallHandlePrefix]) { if ([handle hasPrefix:CallKitCallManager.kAnonymousCallHandlePrefix]) {
phoneNumber = [[TSStorageManager sharedManager] phoneNumberForCallKitId:handle]; phoneNumber = [[TSStorageManager sharedManager] phoneNumberForCallKitId:handle];
if (phoneNumber.length < 1) { if (phoneNumber.length < 1) {
DDLogWarn(@"%@ ignoring attempt to initiate audio call to unknown anonymous signal user.", self.tag); DDLogWarn(@"%@ ignoring attempt to initiate audio call to unknown anonymous signal user.", self.logTag);
return NO; return NO;
} }
} }
if ([Environment getCurrent].callService.call != nil) { if ([Environment getCurrent].callService.call != nil) {
DDLogWarn(@"%@ ignoring INStartAudioCallIntent due to ongoing WebRTC call.", self.tag); DDLogWarn(@"%@ ignoring INStartAudioCallIntent due to ongoing WebRTC call.", self.logTag);
return NO; return NO;
} }
@ -692,7 +697,7 @@ static NSString *const kURLHostVerifyPrefix = @"verify";
return [outboundCallInitiator initiateCallWithHandle:phoneNumber]; return [outboundCallInitiator initiateCallWithHandle:phoneNumber];
} else { } else {
DDLogWarn(@"%@ called %s with userActivity: %@, but not yet supported.", DDLogWarn(@"%@ called %s with userActivity: %@, but not yet supported.",
self.tag, self.logTag,
__PRETTY_FUNCTION__, __PRETTY_FUNCTION__,
userActivity.activityType); userActivity.activityType);
} }
@ -768,11 +773,13 @@ static NSString *const kURLHostVerifyPrefix = @"verify";
OWSAssert([NSThread isMainThread]); OWSAssert([NSThread isMainThread]);
if (!self.isEnvironmentSetup) { if (!self.isEnvironmentSetup) {
OWSFail( OWSFail(@"%@ ignoring %s because environment is not yet set up: %@.",
@"%@ ignoring %s because environment is not yet set up: %@.", self.tag, __PRETTY_FUNCTION__, notification); self.logTag,
__PRETTY_FUNCTION__,
notification);
return; return;
} }
DDLogInfo(@"%@ %s %@", self.tag, __PRETTY_FUNCTION__, notification); DDLogInfo(@"%@ %s %@", self.logTag, __PRETTY_FUNCTION__, notification);
[AppStoreRating preventPromptAtNextTest]; [AppStoreRating preventPromptAtNextTest];
[[PushManager sharedManager] application:application didReceiveLocalNotification:notification]; [[PushManager sharedManager] application:application didReceiveLocalNotification:notification];
@ -784,7 +791,7 @@ static NSString *const kURLHostVerifyPrefix = @"verify";
completionHandler:(void (^)())completionHandler completionHandler:(void (^)())completionHandler
{ {
if (!self.isEnvironmentSetup) { if (!self.isEnvironmentSetup) {
OWSFail(@"%@ ignoring %s because environment is not yet set up.", self.tag, __PRETTY_FUNCTION__); OWSFail(@"%@ ignoring %s because environment is not yet set up.", self.logTag, __PRETTY_FUNCTION__);
return; return;
} }
@ -801,7 +808,7 @@ static NSString *const kURLHostVerifyPrefix = @"verify";
completionHandler:(void (^)())completionHandler completionHandler:(void (^)())completionHandler
{ {
if (!self.isEnvironmentSetup) { if (!self.isEnvironmentSetup) {
OWSFail(@"%@ ignoring %s because environment is not yet set up.", self.tag, __PRETTY_FUNCTION__); OWSFail(@"%@ ignoring %s because environment is not yet set up.", self.logTag, __PRETTY_FUNCTION__);
return; return;
} }
@ -822,7 +829,8 @@ static NSString *const kURLHostVerifyPrefix = @"verify";
} }
if (![TSStorageManager isDatabasePasswordAccessible]) { if (![TSStorageManager isDatabasePasswordAccessible]) {
DDLogInfo(@"%@ exiting because we are in the background and the database password is not accessible.", self.tag); DDLogInfo(
@"%@ exiting because we are in the background and the database password is not accessible.", self.logTag);
[DDLog flushLog]; [DDLog flushLog];
exit(0); exit(0);
} }
@ -830,7 +838,7 @@ static NSString *const kURLHostVerifyPrefix = @"verify";
- (void)databaseViewRegistrationComplete - (void)databaseViewRegistrationComplete
{ {
DDLogInfo(@"%@ databaseViewRegistrationComplete", self.tag); DDLogInfo(@"%@ databaseViewRegistrationComplete", self.logTag);
if ([TSAccountManager isRegistered]) { if ([TSAccountManager isRegistered]) {
DDLogInfo(@"localNumber: %@", [TSAccountManager localNumber]); DDLogInfo(@"localNumber: %@", [TSAccountManager localNumber]);
@ -901,7 +909,7 @@ static NSString *const kURLHostVerifyPrefix = @"verify";
- (void)ensureRootViewController - (void)ensureRootViewController
{ {
DDLogInfo(@"%@ ensureRootViewController", self.tag); DDLogInfo(@"%@ ensureRootViewController", self.logTag);
if ([TSDatabaseView hasPendingViewRegistrations] || self.hasInitialRootViewController) { if ([TSDatabaseView hasPendingViewRegistrations] || self.hasInitialRootViewController) {
return; return;
@ -926,16 +934,4 @@ static NSString *const kURLHostVerifyPrefix = @"verify";
[AppUpdateNag.sharedInstance showAppUpgradeNagIfNecessary]; [AppUpdateNag.sharedInstance showAppUpgradeNagIfNecessary];
} }
#pragma mark - Logging
+ (NSString *)tag
{
return [NSString stringWithFormat:@"[%@]", self.class];
}
- (NSString *)tag
{
return self.class.tag;
}
@end @end

View File

@ -4,9 +4,10 @@
#import "Asserts.h" #import "Asserts.h"
#import "Constraints.h" #import "Constraints.h"
#import "iOSVersions.h" #import "NSObject+OWS.h"
#import "OWSAnalytics.h" #import "OWSAnalytics.h"
#import "OWSDispatch.h" #import "OWSDispatch.h"
#import "iOSVersions.h"
#import <CocoaLumberjack/CocoaLumberjack.h> #import <CocoaLumberjack/CocoaLumberjack.h>
#import <Foundation/Foundation.h> #import <Foundation/Foundation.h>

View File

@ -0,0 +1,17 @@
//
// Copyright (c) 2017 Open Whisper Systems. All rights reserved.
//
NS_ASSUME_NONNULL_BEGIN
@interface NSObject (OWS)
#pragma mark - Logging
+ (NSString *)logTag;
- (NSString *)logTag;
@end
NS_ASSUME_NONNULL_END

View File

@ -0,0 +1,26 @@
//
// Copyright (c) 2017 Open Whisper Systems. All rights reserved.
//
#import "NSObject+OWS.h"
#import "TSYapDatabaseObject.h"
NS_ASSUME_NONNULL_BEGIN
@implementation NSObject (OWS)
#pragma mark - Logging
+ (NSString *)logTag
{
return [NSString stringWithFormat:@"[%@]", self.class];
}
- (NSString *)logTag
{
return self.class.logTag;
}
@end
NS_ASSUME_NONNULL_END