Respond to CR.

pull/1/head
Matthew Chen 7 years ago
parent 38ff82ab97
commit 8f22facecc

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.0 KiB

After

Width:  |  Height:  |  Size: 2.2 KiB

@ -51,7 +51,6 @@
} }
actionBlock:^{ actionBlock:^{
OWSSoundSettingsViewController *vc = [OWSSoundSettingsViewController new]; OWSSoundSettingsViewController *vc = [OWSSoundSettingsViewController new];
vc.soundType = OWSSoundType_Notification;
[weakSelf.navigationController pushViewController:vc animated:YES]; [weakSelf.navigationController pushViewController:vc animated:YES];
}]]; }]];
[contents addSection:soundsSection]; [contents addSection:soundsSection];

@ -512,7 +512,6 @@ NS_ASSUME_NONNULL_BEGIN
customRowHeight:45.f customRowHeight:45.f
actionBlock:^{ actionBlock:^{
OWSSoundSettingsViewController *vc = [OWSSoundSettingsViewController new]; OWSSoundSettingsViewController *vc = [OWSSoundSettingsViewController new];
vc.soundType = OWSSoundType_Notification;
vc.thread = weakSelf.thread; vc.thread = weakSelf.thread;
[weakSelf.navigationController pushViewController:vc animated:YES]; [weakSelf.navigationController pushViewController:vc animated:YES];
}]]; }]];

@ -6,14 +6,10 @@
NS_ASSUME_NONNULL_BEGIN NS_ASSUME_NONNULL_BEGIN
typedef NS_ENUM(NSUInteger, OWSSoundType) { OWSSoundType_Notification = 0 };
@class TSThread; @class TSThread;
@interface OWSSoundSettingsViewController : OWSTableViewController @interface OWSSoundSettingsViewController : OWSTableViewController
@property (nonatomic) OWSSoundType soundType;
// This property is optional. If it is not set, we are // This property is optional. If it is not set, we are
// editing the global notification sound. // editing the global notification sound.
@property (nonatomic, nullable) TSThread *thread; @property (nonatomic, nullable) TSThread *thread;

@ -27,14 +27,10 @@ NS_ASSUME_NONNULL_BEGIN
{ {
[super viewDidLoad]; [super viewDidLoad];
switch (self.soundType) {
case OWSSoundType_Notification:
[self setTitle:NSLocalizedString(@"SETTINGS_ITEM_NOTIFICATION_SOUND", [self setTitle:NSLocalizedString(@"SETTINGS_ITEM_NOTIFICATION_SOUND",
@"Label for settings view that allows user to change the notification sound.")]; @"Label for settings view that allows user to change the notification sound.")];
self.currentSound self.currentSound
= (self.thread ? [OWSSounds notificationSoundForThread:self.thread] : [OWSSounds globalNotificationSound]); = (self.thread ? [OWSSounds notificationSoundForThread:self.thread] : [OWSSounds globalNotificationSound]);
break;
}
[self updateTableContents]; [self updateTableContents];
[self updateNavigationItems]; [self updateNavigationItems];
@ -74,12 +70,7 @@ NS_ASSUME_NONNULL_BEGIN
soundsSection.headerTitle = NSLocalizedString( soundsSection.headerTitle = NSLocalizedString(
@"NOTIFICATIONS_SECTION_SOUNDS", @"Label for settings UI that allows user to change the notification sound."); @"NOTIFICATIONS_SECTION_SOUNDS", @"Label for settings UI that allows user to change the notification sound.");
NSArray<NSNumber *> *allSounds; NSArray<NSNumber *> *allSounds = [OWSSounds allNotificationSounds];
switch (self.soundType) {
case OWSSoundType_Notification:
allSounds = [OWSSounds allNotificationSounds];
break;
}
for (NSNumber *nsValue in allSounds) { for (NSNumber *nsValue in allSounds) {
OWSSound sound = (OWSSound)nsValue.intValue; OWSSound sound = (OWSSound)nsValue.intValue;
OWSTableItem *item; OWSTableItem *item;
@ -131,15 +122,11 @@ NS_ASSUME_NONNULL_BEGIN
- (void)saveWasPressed:(id)sender - (void)saveWasPressed:(id)sender
{ {
switch (self.soundType) {
case OWSSoundType_Notification:
if (self.thread) { if (self.thread) {
[OWSSounds setNotificationSound:self.currentSound forThread:self.thread]; [OWSSounds setNotificationSound:self.currentSound forThread:self.thread];
} else { } else {
[OWSSounds setGlobalNotificationSound:self.currentSound]; [OWSSounds setGlobalNotificationSound:self.currentSound];
} }
break;
}
[self.audioPlayer stop]; [self.audioPlayer stop];
[self.navigationController popViewControllerAnimated:YES]; [self.navigationController popViewControllerAnimated:YES];

Loading…
Cancel
Save