diff --git a/Signal/src/ViewControllers/OWSConversationSettingsViewController.m b/Signal/src/ViewControllers/OWSConversationSettingsViewController.m index 0f493de33..0d57cd748 100644 --- a/Signal/src/ViewControllers/OWSConversationSettingsViewController.m +++ b/Signal/src/ViewControllers/OWSConversationSettingsViewController.m @@ -6,6 +6,7 @@ #import "BlockListUIUtils.h" #import "ContactsViewHelper.h" #import "FingerprintViewController.h" +#import "NotificationSoundsViewController.h" #import "OWSAddToContactViewController.h" #import "OWSBlockingManager.h" #import "PhoneNumber.h" @@ -438,6 +439,24 @@ NS_ASSUME_NONNULL_BEGIN [contents addSection:mainSection]; + // Notifications section. + + OWSTableSection *notificationsSection = [OWSTableSection new]; + notificationsSection.headerTitle = NSLocalizedString(@"CONVERSATION_SETTINGS_NOTIFICATIONS_SECTION", + @"Label for notifications section of conversation settings view."); + [notificationsSection + addItem:[OWSTableItem disclosureItemWithText: + NSLocalizedString(@"NOTIFICATIONS_ITEM_SOUND", + @"Label for settings view that allows user to change the notification sound.") + actionBlock:^{ + NotificationSoundsViewController *vc = + [NotificationSoundsViewController new]; + vc.thread = weakSelf.thread; + [weakSelf.navigationController pushViewController:vc animated:YES]; + }]]; + + [contents addSection:notificationsSection]; + // Group settings section. if (self.isGroupThread) { diff --git a/Signal/translations/en.lproj/Localizable.strings b/Signal/translations/en.lproj/Localizable.strings index bf2546880..baaeed8bb 100644 --- a/Signal/translations/en.lproj/Localizable.strings +++ b/Signal/translations/en.lproj/Localizable.strings @@ -439,6 +439,9 @@ /* Label for 'new contact' button in conversation settings view. */ "CONVERSATION_SETTINGS_NEW_CONTACT" = "Create New Contact"; +/* Label for notifications section of conversation settings view. */ +"CONVERSATION_SETTINGS_NOTIFICATIONS_SECTION" = "Notifications"; + /* Label for button to unmute a thread. */ "CONVERSATION_SETTINGS_UNMUTE_ACTION" = "Unmute"; diff --git a/SignalMessaging/SignalMessaging.h b/SignalMessaging/SignalMessaging.h index 5122e313f..4e4d66a09 100644 --- a/SignalMessaging/SignalMessaging.h +++ b/SignalMessaging/SignalMessaging.h @@ -19,6 +19,7 @@ FOUNDATION_EXPORT const unsigned char SignalMessagingVersionString[]; #import #import #import +#import #import #import #import diff --git a/SignalMessaging/environment/NotificationSounds.m b/SignalMessaging/environment/NotificationSounds.m index 5c90296b8..1636a16e9 100644 --- a/SignalMessaging/environment/NotificationSounds.m +++ b/SignalMessaging/environment/NotificationSounds.m @@ -193,6 +193,7 @@ NSString *const kNotificationSoundsStorageGlobalNotificationKey = @"kNotificatio NSNumber *_Nullable value = [notificationSounds.dbConnection objectForKey:kNotificationSoundsStorageGlobalNotificationKey inCollection:kNotificationSoundsStorageNotificationCollection]; + // Default to the global default. return (value ? (NotificationSound)value.intValue : [self defaultNotificationSound]); } @@ -208,8 +209,9 @@ NSString *const kNotificationSoundsStorageGlobalNotificationKey = @"kNotificatio { NotificationSounds *notificationSounds = NotificationSounds.sharedManager; NSNumber *_Nullable value = - [notificationSounds.dbConnection objectForKey:kNotificationSoundsStorageGlobalNotificationKey + [notificationSounds.dbConnection objectForKey:thread.uniqueId inCollection:kNotificationSoundsStorageNotificationCollection]; + // Default to the "global" notification sound, which in turn will default to the global default. return (value ? (NotificationSound)value.intValue : [self globalNotificationSound]); }