Improve sound settings view.
This commit is contained in:
parent
5e8f3086de
commit
899799af92
|
@ -8,7 +8,7 @@
|
|||
|
||||
/* Begin PBXBuildFile section */
|
||||
2AE2882E4C2B96BFFF9EE27C /* Pods_SignalShareExtension.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0F94C85CB0B235DA37F68ED0 /* Pods_SignalShareExtension.framework */; };
|
||||
34074F5B203D093B004596AE /* NotificationSoundsViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 34074F59203D093A004596AE /* NotificationSoundsViewController.m */; };
|
||||
34074F5B203D093B004596AE /* OWSSoundSettingsViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 34074F59203D093A004596AE /* OWSSoundSettingsViewController.m */; };
|
||||
34074F61203D0CBE004596AE /* OWSSounds.m in Sources */ = {isa = PBXBuildFile; fileRef = 34074F5F203D0CBD004596AE /* OWSSounds.m */; };
|
||||
34074F62203D0CBE004596AE /* OWSSounds.h in Headers */ = {isa = PBXBuildFile; fileRef = 34074F60203D0CBE004596AE /* OWSSounds.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
34074FEE203E5436004596AE /* aurora.m4r in Resources */ = {isa = PBXBuildFile; fileRef = 34074FC6203E5435004596AE /* aurora.m4r */; };
|
||||
|
@ -518,8 +518,8 @@
|
|||
3400C7951EAF99F4008A8584 /* SelectThreadViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SelectThreadViewController.m; sourceTree = "<group>"; };
|
||||
3400C7971EAFB772008A8584 /* ThreadViewHelper.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ThreadViewHelper.h; sourceTree = "<group>"; };
|
||||
3400C7981EAFB772008A8584 /* ThreadViewHelper.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ThreadViewHelper.m; sourceTree = "<group>"; };
|
||||
34074F59203D093A004596AE /* NotificationSoundsViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = NotificationSoundsViewController.m; sourceTree = "<group>"; };
|
||||
34074F5A203D093B004596AE /* NotificationSoundsViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NotificationSoundsViewController.h; sourceTree = "<group>"; };
|
||||
34074F59203D093A004596AE /* OWSSoundSettingsViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = OWSSoundSettingsViewController.m; sourceTree = "<group>"; };
|
||||
34074F5A203D093B004596AE /* OWSSoundSettingsViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OWSSoundSettingsViewController.h; sourceTree = "<group>"; };
|
||||
34074F5F203D0CBD004596AE /* OWSSounds.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = OWSSounds.m; sourceTree = "<group>"; };
|
||||
34074F60203D0CBE004596AE /* OWSSounds.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OWSSounds.h; sourceTree = "<group>"; };
|
||||
34074FC6203E5435004596AE /* aurora.m4r */ = {isa = PBXFileReference; lastKnownFileType = file; path = aurora.m4r; sourceTree = "<group>"; };
|
||||
|
@ -1503,8 +1503,6 @@
|
|||
34B3F8571E8DF1700035BE1A /* NotificationSettingsOptionsViewController.m */,
|
||||
34B3F8581E8DF1700035BE1A /* NotificationSettingsViewController.h */,
|
||||
34B3F8591E8DF1700035BE1A /* NotificationSettingsViewController.m */,
|
||||
34074F5A203D093B004596AE /* NotificationSoundsViewController.h */,
|
||||
34074F59203D093A004596AE /* NotificationSoundsViewController.m */,
|
||||
34CCAF391F0C2748004084F4 /* OWSAddToContactViewController.h */,
|
||||
34CCAF3A1F0C2748004084F4 /* OWSAddToContactViewController.m */,
|
||||
347E0B772003CD7400BC2F76 /* OWSBackupExportViewController.h */,
|
||||
|
@ -1524,6 +1522,8 @@
|
|||
34C42D5A1F45F7A80072EC04 /* OWSNavigationController.m */,
|
||||
34B3F8621E8DF1700035BE1A /* OWSQRCodeScanningViewController.h */,
|
||||
34B3F8631E8DF1700035BE1A /* OWSQRCodeScanningViewController.m */,
|
||||
34074F5A203D093B004596AE /* OWSSoundSettingsViewController.h */,
|
||||
34074F59203D093A004596AE /* OWSSoundSettingsViewController.m */,
|
||||
34B3F8641E8DF1700035BE1A /* PrivacySettingsTableViewController.h */,
|
||||
34B3F8651E8DF1700035BE1A /* PrivacySettingsTableViewController.m */,
|
||||
34CE88E51F2FB9A10098030F /* ProfileViewController.h */,
|
||||
|
@ -3156,7 +3156,7 @@
|
|||
34D1F0B11F867BFC0066283D /* OWSUnreadIndicatorCell.m in Sources */,
|
||||
34B3F89C1E8DF3270035BE1A /* BlockListViewController.m in Sources */,
|
||||
34BECE2B1F74C12700D7438D /* DebugUIStress.m in Sources */,
|
||||
34074F5B203D093B004596AE /* NotificationSoundsViewController.m in Sources */,
|
||||
34074F5B203D093B004596AE /* OWSSoundSettingsViewController.m in Sources */,
|
||||
34C42D5B1F45F7A80072EC04 /* OWSNavigationController.m in Sources */,
|
||||
B609597C1C2C0FC6004E8797 /* iRate.m in Sources */,
|
||||
4574A5D61DD6704700C6B692 /* CallService.swift in Sources */,
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
#import "NotificationSettingsViewController.h"
|
||||
#import "NotificationSettingsOptionsViewController.h"
|
||||
#import "NotificationSoundsViewController.h"
|
||||
#import "OWSSoundSettingsViewController.h"
|
||||
#import <SignalMessaging/Environment.h>
|
||||
#import <SignalMessaging/OWSPreferences.h>
|
||||
|
||||
|
@ -31,21 +31,34 @@
|
|||
__weak NotificationSettingsViewController *weakSelf = self;
|
||||
|
||||
OWSPreferences *prefs = [Environment preferences];
|
||||
|
||||
|
||||
// Sounds section.
|
||||
|
||||
OWSTableSection *soundsSection = [OWSTableSection new];
|
||||
soundsSection.headerTitle = NSLocalizedString(
|
||||
@"NOTIFICATIONS_SECTION_SOUNDS", @"Label for settings UI that allows user to change the notification sound.");
|
||||
soundsSection.headerTitle = NSLocalizedString(@"SETTINGS_SECTION_SOUNDS",
|
||||
@"Label for the sounds section of settings views.");
|
||||
[soundsSection
|
||||
addItem:[OWSTableItem disclosureItemWithText:
|
||||
NSLocalizedString(@"NOTIFICATIONS_ITEM_SOUND",
|
||||
@"Label for settings view that allows user to change the notification sound.")
|
||||
actionBlock:^{
|
||||
NotificationSoundsViewController *vc =
|
||||
[NotificationSoundsViewController new];
|
||||
[weakSelf.navigationController pushViewController:vc animated:YES];
|
||||
}]];
|
||||
addItem:[OWSTableItem disclosureItemWithText:
|
||||
NSLocalizedString(@"SETTINGS_ITEM_NOTIFICATION_SOUND",
|
||||
@"Label for settings view that allows user to change the notification sound.")
|
||||
actionBlock:^{
|
||||
OWSSoundSettingsViewController *vc =
|
||||
[OWSSoundSettingsViewController new];
|
||||
vc.soundType = OWSSoundType_Notification;
|
||||
[weakSelf.navigationController pushViewController:vc animated:YES];
|
||||
}]];
|
||||
[soundsSection
|
||||
addItem:[OWSTableItem disclosureItemWithText:
|
||||
NSLocalizedString(@"SETTINGS_ITEM_RINGTONE_SOUND",
|
||||
@"Label for settings view that allows user to change the ringtone sound.")
|
||||
actionBlock:^{
|
||||
OWSSoundSettingsViewController *vc =
|
||||
[OWSSoundSettingsViewController new];
|
||||
vc.soundType = OWSSoundType_Ringtone;
|
||||
[weakSelf.navigationController pushViewController:vc animated:YES];
|
||||
}]];
|
||||
[contents addSection:soundsSection];
|
||||
|
||||
|
||||
OWSTableSection *backgroundSection = [OWSTableSection new];
|
||||
backgroundSection.headerTitle = NSLocalizedString(@"NOTIFICATIONS_SECTION_BACKGROUND", nil);
|
||||
[backgroundSection addItem:[OWSTableItem itemWithCustomCellBlock:^{
|
||||
|
|
|
@ -6,9 +6,9 @@
|
|||
#import "BlockListUIUtils.h"
|
||||
#import "ContactsViewHelper.h"
|
||||
#import "FingerprintViewController.h"
|
||||
#import "NotificationSoundsViewController.h"
|
||||
#import "OWSAddToContactViewController.h"
|
||||
#import "OWSBlockingManager.h"
|
||||
#import "OWSSoundSettingsViewController.h"
|
||||
#import "PhoneNumber.h"
|
||||
#import "ShowGroupMembersViewController.h"
|
||||
#import "Signal-Swift.h"
|
||||
|
@ -567,23 +567,36 @@ NS_ASSUME_NONNULL_BEGIN
|
|||
[contents addSection:section];
|
||||
}
|
||||
|
||||
// Notifications section.
|
||||
// Sounds 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];
|
||||
OWSTableSection *soundsSection = [OWSTableSection new];
|
||||
soundsSection.headerTitle = NSLocalizedString(@"SETTINGS_SECTION_SOUNDS",
|
||||
@"Label for the sounds section of settings views.");
|
||||
[soundsSection
|
||||
addItem:[OWSTableItem disclosureItemWithText:
|
||||
NSLocalizedString(@"SETTINGS_ITEM_NOTIFICATION_SOUND",
|
||||
@"Label for settings view that allows user to change the notification sound.")
|
||||
actionBlock:^{
|
||||
OWSSoundSettingsViewController *vc =
|
||||
[OWSSoundSettingsViewController new];
|
||||
vc.soundType = OWSSoundType_Notification;
|
||||
vc.thread = weakSelf.thread;
|
||||
[weakSelf.navigationController pushViewController:vc animated:YES];
|
||||
}]];
|
||||
if (!self.isGroupThread) {
|
||||
[soundsSection
|
||||
addItem:[OWSTableItem disclosureItemWithText:
|
||||
NSLocalizedString(@"SETTINGS_ITEM_RINGTONE_SOUND",
|
||||
@"Label for settings view that allows user to change the ringtone sound.")
|
||||
actionBlock:^{
|
||||
OWSSoundSettingsViewController *vc =
|
||||
[OWSSoundSettingsViewController new];
|
||||
vc.soundType = OWSSoundType_Ringtone;
|
||||
vc.thread = weakSelf.thread;
|
||||
[weakSelf.navigationController pushViewController:vc animated:YES];
|
||||
}]];
|
||||
}
|
||||
[contents addSection:soundsSection];
|
||||
|
||||
self.contents = contents;
|
||||
}
|
||||
|
|
|
@ -4,12 +4,23 @@
|
|||
|
||||
#import "OWSTableViewController.h"
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
typedef NS_ENUM(NSUInteger, OWSSoundType) {
|
||||
OWSSoundType_Notification = 0,
|
||||
OWSSoundType_Ringtone,
|
||||
};
|
||||
|
||||
@class TSThread;
|
||||
|
||||
@interface NotificationSoundsViewController : OWSTableViewController
|
||||
@interface OWSSoundSettingsViewController : OWSTableViewController
|
||||
|
||||
@property (nonatomic) OWSSoundType soundType;
|
||||
|
||||
// This property is optional. If it is not set, we are
|
||||
// editing the global notification sound.
|
||||
@property (nonatomic, nullable) TSThread *thread;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
|
@ -2,10 +2,12 @@
|
|||
// Copyright (c) 2018 Open Whisper Systems. All rights reserved.
|
||||
//
|
||||
|
||||
#import "NotificationSoundsViewController.h"
|
||||
#import "OWSSoundSettingsViewController.h"
|
||||
#import <SignalMessaging/OWSSounds.h>
|
||||
|
||||
@interface NotificationSoundsViewController ()
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface OWSSoundSettingsViewController ()
|
||||
|
||||
@property (nonatomic) BOOL isDirty;
|
||||
|
||||
|
@ -15,17 +17,26 @@
|
|||
|
||||
#pragma mark -
|
||||
|
||||
@implementation NotificationSoundsViewController
|
||||
@implementation OWSSoundSettingsViewController
|
||||
|
||||
- (void)viewDidLoad
|
||||
{
|
||||
[super viewDidLoad];
|
||||
|
||||
[self setTitle:NSLocalizedString(@"NOTIFICATIONS_ITEM_SOUND",
|
||||
@"Label for settings view that allows user to change the notification sound.")];
|
||||
|
||||
self.currentSound
|
||||
= (self.thread ? [OWSSounds notificationSoundForThread:self.thread] : [OWSSounds globalNotificationSound]);
|
||||
switch (self.soundType) {
|
||||
case OWSSoundType_Notification:
|
||||
[self setTitle:NSLocalizedString(@"SETTINGS_ITEM_NOTIFICATION_SOUND",
|
||||
@"Label for settings view that allows user to change the notification sound.")];
|
||||
self.currentSound
|
||||
= (self.thread ? [OWSSounds notificationSoundForThread:self.thread] : [OWSSounds globalNotificationSound]);
|
||||
break;
|
||||
case OWSSoundType_Ringtone:
|
||||
[self setTitle:NSLocalizedString(@"SETTINGS_ITEM_RINGTONE_SOUND",
|
||||
@"Label for settings view that allows user to change the ringtone sound.")];
|
||||
self.currentSound
|
||||
= (self.thread ? [OWSSounds ringtoneSoundForThread:self.thread] : [OWSSounds globalRingtoneSound]);
|
||||
break;
|
||||
}
|
||||
|
||||
[self updateTableContents];
|
||||
[self updateNavigationItems];
|
||||
|
@ -39,7 +50,7 @@
|
|||
- (void)updateNavigationItems
|
||||
{
|
||||
self.navigationItem.leftBarButtonItem =
|
||||
[[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemStop
|
||||
[[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemCancel
|
||||
target:self
|
||||
action:@selector(cancelWasPressed:)];
|
||||
|
||||
|
@ -59,12 +70,22 @@
|
|||
{
|
||||
OWSTableContents *contents = [OWSTableContents new];
|
||||
|
||||
__weak NotificationSoundsViewController *weakSelf = self;
|
||||
__weak OWSSoundSettingsViewController *weakSelf = self;
|
||||
|
||||
OWSTableSection *soundsSection = [OWSTableSection new];
|
||||
soundsSection.headerTitle = NSLocalizedString(
|
||||
@"NOTIFICATIONS_SECTION_SOUNDS", @"Label for settings UI that allows user to change the notification sound.");
|
||||
for (NSNumber *nsValue in [OWSSounds allNotificationSounds]) {
|
||||
|
||||
NSArray<NSNumber *> *allSounds;
|
||||
switch (self.soundType) {
|
||||
case OWSSoundType_Notification:
|
||||
allSounds = [OWSSounds allNotificationSounds];
|
||||
break;
|
||||
case OWSSoundType_Ringtone:
|
||||
allSounds = [OWSSounds allRingtoneSounds];
|
||||
break;
|
||||
}
|
||||
for (NSNumber *nsValue in allSounds) {
|
||||
OWSSound sound = (OWSSound)nsValue.intValue;
|
||||
OWSTableItem *item;
|
||||
if (sound == self.currentSound) {
|
||||
|
@ -110,13 +131,26 @@
|
|||
|
||||
- (void)saveWasPressed:(id)sender
|
||||
{
|
||||
if (self.thread) {
|
||||
[OWSSounds setNotificationSound:self.currentSound forThread:self.thread];
|
||||
} else {
|
||||
[OWSSounds setGlobalNotificationSound:self.currentSound];
|
||||
switch (self.soundType) {
|
||||
case OWSSoundType_Notification:
|
||||
if (self.thread) {
|
||||
[OWSSounds setNotificationSound:self.currentSound forThread:self.thread];
|
||||
} else {
|
||||
[OWSSounds setGlobalNotificationSound:self.currentSound];
|
||||
}
|
||||
break;
|
||||
case OWSSoundType_Ringtone:
|
||||
if (self.thread) {
|
||||
[OWSSounds setRingtoneSound:self.currentSound forThread:self.thread];
|
||||
} else {
|
||||
[OWSSounds setGlobalRingtoneSound:self.currentSound];
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
[self.navigationController popViewControllerAnimated:YES];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
|
@ -439,9 +439,6 @@
|
|||
/* 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";
|
||||
|
||||
|
@ -1149,9 +1146,6 @@
|
|||
/* No comment provided by engineer. */
|
||||
"NOTIFICATIONS_FOOTER_WARNING" = "Due to known bugs in Apple's push framework, message previews will only be shown if the message is retrieved within 30 seconds after being sent. The application badge might be inaccurate as a result.";
|
||||
|
||||
/* Label for settings view that allows user to change the notification sound. */
|
||||
"NOTIFICATIONS_ITEM_SOUND" = "Sound";
|
||||
|
||||
/* No comment provided by engineer. */
|
||||
"NOTIFICATIONS_NONE" = "No name or message";
|
||||
|
||||
|
@ -1575,6 +1569,12 @@
|
|||
/* content of tweet when inviting via twitter */
|
||||
"SETTINGS_INVITE_TWITTER_TEXT" = "You can reach me using Signal by @WhisperSystems, get it now.";
|
||||
|
||||
/* Label for settings view that allows user to change the notification sound. */
|
||||
"SETTINGS_ITEM_NOTIFICATION_SOUND" = "Notification Sound";
|
||||
|
||||
/* Label for settings view that allows user to change the ringtone sound. */
|
||||
"SETTINGS_ITEM_RINGTONE_SOUND" = "Ringtone Sound";
|
||||
|
||||
/* Title for settings activity */
|
||||
"SETTINGS_NAV_BAR_TITLE" = "Settings";
|
||||
|
||||
|
@ -1605,6 +1605,9 @@
|
|||
/* Settings table section footer. */
|
||||
"SETTINGS_SECTION_CALL_KIT_DESCRIPTION" = "iOS Call Integration shows Signal calls on your lock screen and in the system's call history. You may optionally show your contact's name and number. If iCloud is enabled, this call history will be shared with Apple.";
|
||||
|
||||
/* Label for the sounds section of settings views. */
|
||||
"SETTINGS_SECTION_SOUNDS" = "Sounds";
|
||||
|
||||
/* settings topic header for table section */
|
||||
"SETTINGS_SECTION_TITLE_CALLING" = "Calling";
|
||||
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
// Copyright (c) 2018 Open Whisper Systems. All rights reserved.
|
||||
//
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
typedef NS_ENUM(NSUInteger, OWSSound) {
|
||||
OWSSound_Default = 0,
|
||||
// Notification Sounds
|
||||
|
@ -45,7 +47,7 @@ typedef NS_ENUM(NSUInteger, OWSSound) {
|
|||
OWSSound_Twinkle,
|
||||
OWSSound_Uplift,
|
||||
OWSSound_Waves,
|
||||
|
||||
|
||||
// Calls
|
||||
OWSSound_CallConnecting,
|
||||
OWSSound_CallOutboundRinging,
|
||||
|
@ -53,8 +55,6 @@ typedef NS_ENUM(NSUInteger, OWSSound) {
|
|||
OWSSound_CallFailure,
|
||||
};
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@class AVAudioPlayer;
|
||||
@class TSThread;
|
||||
|
||||
|
|
Loading…
Reference in New Issue