Preview sound settings in app settings and conversation settings views.

pull/1/head
Matthew Chen 7 years ago
parent 62af7ddc15
commit ed95eec769

@ -7,6 +7,7 @@
#import "OWSSoundSettingsViewController.h"
#import <SignalMessaging/Environment.h>
#import <SignalMessaging/OWSPreferences.h>
#import <SignalMessaging/OWSSounds.h>
@implementation NotificationSettingsViewController
@ -37,26 +38,37 @@
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;
[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];
}]];
[soundsSection addItem:[OWSTableItem itemWithCustomCellBlock:^{
UITableViewCell *cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue1
reuseIdentifier:@"UITableViewCellStyleValue1"];
cell.textLabel.text = NSLocalizedString(@"SETTINGS_ITEM_NOTIFICATION_SOUND",
@"Label for settings view that allows user to change the notification sound.");
OWSSound sound = [OWSSounds globalNotificationSound];
cell.detailTextLabel.text = [OWSSounds displayNameForSound:sound];
[cell setAccessoryType:UITableViewCellAccessoryDisclosureIndicator];
return cell;
}
actionBlock:^{
OWSSoundSettingsViewController *vc = [OWSSoundSettingsViewController new];
vc.soundType = OWSSoundType_Notification;
[weakSelf.navigationController pushViewController:vc animated:YES];
}]];
[soundsSection addItem:[OWSTableItem itemWithCustomCellBlock:^{
UITableViewCell *cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue1
reuseIdentifier:@"UITableViewCellStyleValue1"];
cell.textLabel.text = NSLocalizedString(
@"SETTINGS_ITEM_RINGTONE_SOUND", @"Label for settings view that allows user to change the ringtone sound.");
OWSSound sound = [OWSSounds globalRingtoneSound];
cell.detailTextLabel.text = [OWSSounds displayNameForSound:sound];
[cell setAccessoryType:UITableViewCellAccessoryDisclosureIndicator];
return cell;
}
actionBlock:^{
OWSSoundSettingsViewController *vc = [OWSSoundSettingsViewController new];
vc.soundType = OWSSoundType_Ringtone;
[weakSelf.navigationController pushViewController:vc animated:YES];
}]];
[contents addSection:soundsSection];
OWSTableSection *backgroundSection = [OWSTableSection new];

@ -20,6 +20,7 @@
#import <SignalMessaging/OWSAvatarBuilder.h>
#import <SignalMessaging/OWSContactsManager.h>
#import <SignalMessaging/OWSProfileManager.h>
#import <SignalMessaging/OWSSounds.h>
#import <SignalMessaging/OWSUserProfile.h>
#import <SignalMessaging/UIUtil.h>
#import <SignalServiceKit/NSDate+OWS.h>
@ -572,29 +573,40 @@ NS_ASSUME_NONNULL_BEGIN
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];
}]];
[soundsSection addItem:[OWSTableItem itemWithCustomCellBlock:^{
UITableViewCell *cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue1
reuseIdentifier:@"UITableViewCellStyleValue1"];
cell.textLabel.text = NSLocalizedString(@"SETTINGS_ITEM_NOTIFICATION_SOUND",
@"Label for settings view that allows user to change the notification sound.");
OWSSound sound = [OWSSounds notificationSoundForThread:self.thread];
cell.detailTextLabel.text = [OWSSounds displayNameForSound:sound];
[cell setAccessoryType:UITableViewCellAccessoryDisclosureIndicator];
return cell;
}
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];
}]];
[soundsSection addItem:[OWSTableItem itemWithCustomCellBlock:^{
UITableViewCell *cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue1
reuseIdentifier:@"UITableViewCellStyleValue1"];
cell.textLabel.text = NSLocalizedString(@"SETTINGS_ITEM_RINGTONE_SOUND",
@"Label for settings view that allows user to change the ringtone sound.");
OWSSound sound = [OWSSounds ringtoneSoundForThread:self.thread];
cell.detailTextLabel.text = [OWSSounds displayNameForSound:sound];
[cell setAccessoryType:UITableViewCellAccessoryDisclosureIndicator];
return cell;
}
actionBlock:^{
OWSSoundSettingsViewController *vc = [OWSSoundSettingsViewController new];
vc.soundType = OWSSoundType_Ringtone;
vc.thread = weakSelf.thread;
[weakSelf.navigationController pushViewController:vc animated:YES];
}]];
}
[contents addSection:soundsSection];

Loading…
Cancel
Save