From 46d944740b800556f5faec6e8d809558cf88d1f0 Mon Sep 17 00:00:00 2001 From: Michael Kirk Date: Fri, 2 Mar 2018 16:32:15 -0500 Subject: [PATCH] Make default audio tone more prominent Label Note as (default) Move it to the second item in the list, just after "None" // FREEBIE --- .../OWSSoundSettingsViewController.m | 16 ++++++++++++++-- Signal/translations/en.lproj/Localizable.strings | 3 +++ SignalMessaging/environment/OWSSounds.m | 13 ++++++------- .../migrations/OWSDatabaseMigrationRunner.m | 5 +---- 4 files changed, 24 insertions(+), 13 deletions(-) diff --git a/Signal/src/ViewControllers/OWSSoundSettingsViewController.m b/Signal/src/ViewControllers/OWSSoundSettingsViewController.m index ce7be75b2..0246644e1 100644 --- a/Signal/src/ViewControllers/OWSSoundSettingsViewController.m +++ b/Signal/src/ViewControllers/OWSSoundSettingsViewController.m @@ -74,13 +74,25 @@ NS_ASSUME_NONNULL_BEGIN for (NSNumber *nsValue in allSounds) { OWSSound sound = (OWSSound)nsValue.intValue; OWSTableItem *item; + + NSString *soundLabelText = ^{ + NSString *baseName = [OWSSounds displayNameForSound:sound]; + if (sound == OWSSound_Note) { + NSString *noteStringFormat = NSLocalizedString(@"SETTINGS_AUDIO_DEFAULT_TONE_LABEL_FORMAT", + @"Format string for the default 'Note' sound. Embeds the system {{sound name}}."); + return [NSString stringWithFormat:noteStringFormat, baseName]; + } else { + return [OWSSounds displayNameForSound:sound]; + } + }(); + if (sound == self.currentSound) { - item = [OWSTableItem checkmarkItemWithText:[OWSSounds displayNameForSound:sound] + item = [OWSTableItem checkmarkItemWithText:soundLabelText actionBlock:^{ [weakSelf soundWasSelected:sound]; }]; } else { - item = [OWSTableItem actionItemWithText:[OWSSounds displayNameForSound:sound] + item = [OWSTableItem actionItemWithText:soundLabelText actionBlock:^{ [weakSelf soundWasSelected:sound]; }]; diff --git a/Signal/translations/en.lproj/Localizable.strings b/Signal/translations/en.lproj/Localizable.strings index 0d37bc14c..c68e554da 100644 --- a/Signal/translations/en.lproj/Localizable.strings +++ b/Signal/translations/en.lproj/Localizable.strings @@ -1512,6 +1512,9 @@ /* No comment provided by engineer. */ "SETTINGS_ADVANCED_TITLE" = "Advanced"; +/* Format string for the default 'Note' sound. Embeds the system {{sound name}}. */ +"SETTINGS_AUDIO_DEFAULT_TONE_LABEL_FORMAT" = "%@ (default)"; + /* A label for the 'add phone number' button in the block list table. */ "SETTINGS_BLOCK_LIST_ADD_BUTTON" = "Add…"; diff --git a/SignalMessaging/environment/OWSSounds.m b/SignalMessaging/environment/OWSSounds.m index 54140475b..f1d3ea054 100644 --- a/SignalMessaging/environment/OWSSounds.m +++ b/SignalMessaging/environment/OWSSounds.m @@ -62,8 +62,9 @@ NSString *const kOWSSoundsStorageGlobalNotificationKey = @"kOWSSoundsStorageGlob + (NSArray *)allNotificationSounds { return @[ - // None should be first. + // None and Note (default) should be first. @(OWSSound_None), + @(OWSSound_Note), @(OWSSound_Aurora), @(OWSSound_Bamboo), @@ -74,7 +75,6 @@ NSString *const kOWSSoundsStorageGlobalNotificationKey = @"kOWSSoundsStorageGlob @(OWSSound_Hello), @(OWSSound_Input), @(OWSSound_Keys), - @(OWSSound_Note), @(OWSSound_Popcorn), @(OWSSound_Pulse), @(OWSSound_Synth), @@ -89,7 +89,7 @@ NSString *const kOWSSoundsStorageGlobalNotificationKey = @"kOWSSoundsStorageGlob OWSFail(@"%@ invalid argument.", self.logTag); return @""; - // Notification Sounds + // Notification Sounds case OWSSound_Aurora: return @"Aurora"; case OWSSound_Bamboo: @@ -117,11 +117,9 @@ NSString *const kOWSSoundsStorageGlobalNotificationKey = @"kOWSSoundsStorageGlob case OWSSound_ClassicNotification: return @"Classic"; - // Ringtone Sounds + // Call Audio case OWSSound_Opening: return @"Opening"; - - // Calls case OWSSound_CallConnecting: return @"Call Connecting"; case OWSSound_CallOutboundRinging: @@ -131,7 +129,7 @@ NSString *const kOWSSoundsStorageGlobalNotificationKey = @"kOWSSoundsStorageGlob case OWSSound_CallFailure: return @"Call Failure"; - // Other + // Other case OWSSound_None: return NSLocalizedString(@"SOUNDS_NONE", @"Label for the 'no sound' option that allows users to disable sounds for notifications, " @@ -286,6 +284,7 @@ NSString *const kOWSSoundsStorageGlobalNotificationKey = @"kOWSSoundsStorageGlob { OWSAssert(transaction); + DDLogInfo(@"%@ Setting global notification sound to: %s", sound); [transaction setObject:@(sound) forKey:kOWSSoundsStorageGlobalNotificationKey inCollection:kOWSSoundsStorageNotificationCollection]; diff --git a/SignalMessaging/environment/migrations/OWSDatabaseMigrationRunner.m b/SignalMessaging/environment/migrations/OWSDatabaseMigrationRunner.m index cfec11736..8ae0f01eb 100644 --- a/SignalMessaging/environment/migrations/OWSDatabaseMigrationRunner.m +++ b/SignalMessaging/environment/migrations/OWSDatabaseMigrationRunner.m @@ -65,10 +65,7 @@ NS_ASSUME_NONNULL_BEGIN NSMutableArray *migrationsToRun = [NSMutableArray new]; for (OWSDatabaseMigration *migration in migrations) { - if ([OWSDatabaseMigration fetchObjectWithUniqueID:migration.uniqueId]) { - DDLogDebug(@"%@ Skipping previously run migration: %@", self.logTag, migration); - } else { - DDLogWarn(@"%@ Running migration: %@", self.logTag, migration); + if ([OWSDatabaseMigration fetchObjectWithUniqueID:migration.uniqueId] == nil) { [migrationsToRun addObject:migration]; } }