From a16c2adda78a900cfdbb12d37bae891b8743b832 Mon Sep 17 00:00:00 2001 From: Matthew Chen Date: Fri, 23 Feb 2018 15:25:58 -0500 Subject: [PATCH] Rework conversation settings view. --- .../Contents.json | 23 +++++ .../table_ic_notification_sound@1x.png | Bin 0 -> 1476 bytes .../table_ic_notification_sound@2x.png | Bin 0 -> 1786 bytes .../table_ic_notification_sound@3x.png | Bin 0 -> 2052 bytes .../OWSConversationSettingsViewController.m | 81 ++++++++++-------- .../translations/en.lproj/Localizable.strings | 6 +- 6 files changed, 73 insertions(+), 37 deletions(-) create mode 100644 Signal/Images.xcassets/table_ic_notification_sound.imageset/Contents.json create mode 100644 Signal/Images.xcassets/table_ic_notification_sound.imageset/table_ic_notification_sound@1x.png create mode 100644 Signal/Images.xcassets/table_ic_notification_sound.imageset/table_ic_notification_sound@2x.png create mode 100644 Signal/Images.xcassets/table_ic_notification_sound.imageset/table_ic_notification_sound@3x.png diff --git a/Signal/Images.xcassets/table_ic_notification_sound.imageset/Contents.json b/Signal/Images.xcassets/table_ic_notification_sound.imageset/Contents.json new file mode 100644 index 000000000..bb6bef806 --- /dev/null +++ b/Signal/Images.xcassets/table_ic_notification_sound.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "idiom" : "universal", + "filename" : "table_ic_notification_sound@1x.png", + "scale" : "1x" + }, + { + "idiom" : "universal", + "filename" : "table_ic_notification_sound@2x.png", + "scale" : "2x" + }, + { + "idiom" : "universal", + "filename" : "table_ic_notification_sound@3x.png", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/Signal/Images.xcassets/table_ic_notification_sound.imageset/table_ic_notification_sound@1x.png b/Signal/Images.xcassets/table_ic_notification_sound.imageset/table_ic_notification_sound@1x.png new file mode 100644 index 0000000000000000000000000000000000000000..17f78166ab327a07619b7baa6910b5afb7f3fc07 GIT binary patch literal 1476 zcmeAS@N?(olHy`uVBq!ia0vp^5+KaM1|%Pp+x`GjjKx9jP7LeL$-D$|I14-?iy0WW zg+Z8+Vb&a=au%h`kcg59UmvUF{9L`nl>DSry^7odplSvNn+hu+GdHy)QK2F?C$HG5 z!d3~a!V1U+3F|8Y3;nDA{o-C@9zzrKDK}xwt{K19`Se z86_nJR{Hwo<>h+i#(Mch>H3D2mX`VkM*2oZx=P7{9O-#x!EwNQn0$BtH5OLR{C|l=&b@WD^hbJTrzUQ&7fj`d;j+G=Xx|_U2bgR^%@GH*^uKmiARFG5N z)sX!o=M2L`j(37J&2d^XS#0c4hVjlj4nJ29_-hqw^XkV!H~s{T^~;xgTVhD#(+)+LG;Ua@D&RAH8m}wZ~=kCEh-8 z@zL~6yxZ!Eo@U;Du=viS=^Onoa#zopr05TKt_5c6? literal 0 HcmV?d00001 diff --git a/Signal/Images.xcassets/table_ic_notification_sound.imageset/table_ic_notification_sound@2x.png b/Signal/Images.xcassets/table_ic_notification_sound.imageset/table_ic_notification_sound@2x.png new file mode 100644 index 0000000000000000000000000000000000000000..48b1a26cad0353b6c0d83ca7e2e905007ddb9c0b GIT binary patch literal 1786 zcmeAS@N?(olHy`uVBq!ia0vp^1|ZDA1|-9oezpTC#^NA%Cx&(BWL^R}oCO|{#S9GG z!XV7ZFl&wk0|SdvW=KRygs+cPa(=E}VoH8es$NBI0Z=sqgH44MkeQoWlBiITo0C^; zRbi_HR$&EXgM{^!6u?SKvTcwsYk*NEcCio^nlW#B-B_{|37a;u=! z;{2RaP!NRXWtP|(*?>KSE{q5fh%V>++=8Oi;$omSJ5#6@WHEI05eRGS%wcvQ3!-cA zFUkb^G!f)3J42`i$YSW~Be7Y4EQq856!caBnH8xy5iXg)00sNP#KJ}&s|316=lq=f zqTqtW-m&{c!2iNs|Mk_3{*lw_;o(xj}^&9Q?K>r=>mv!<=wnrF z15624zWFJcX_YRCC8>5s28I?^21Zs!#tMd}Aci3@*3i@-xd0^NT$Gwvl3x^(pPyp~ z_C+p;t6;2W4$+A$57la;56VSIxeAhH!J@!CYsUrD3CsU>T)o19bqowlg`O^sAsMW1 zXW4qlI7+m=H#x%Ws3>SEz!B9kXKSkhhZEOD2an0G6d1b&c&0@y-6$mekzM+t6X%VN z-l>KX1qG;E#KjUcRsL-p!l0qxU*3lzgTg zur};;#wnX%E=dM?*Z2!nT$gA2a(=O}au<4EvT5rJ9wS-i9L}>7p9@z7o&FxK{+@ZR zqgpb<`_w;1Rk72TM_li_`X!6uhvSNE7d&)!NvK!eb~>=X<@pJEIUy3p9k-ed+GT$JoIwtknOvVSlXV$R#u2S&nvo>V-V-T=A;{c1^xro=_89pTY z?0L%^#}j4B@W;gR`^5<=-v!;GIUa;5JawyWVX2ezoWDIIgW*7)N7V!dFUc*tv)&$` zGIs^@SH<@iFEE&7zhJHESd(Y|DUx$4W8~dQQ)kMk2CjW&@BTT;d$rMnuWeTfml_3J z^L$m@bE@Ih4*zQ>b{g?Zc*?%Yk>b#G)4KXh)Fbt#^W;_Q9Nx*N+;>Vdjtq@$yzLXz zz957xFVdQ&MBb@05o`YxBvhE literal 0 HcmV?d00001 diff --git a/Signal/Images.xcassets/table_ic_notification_sound.imageset/table_ic_notification_sound@3x.png b/Signal/Images.xcassets/table_ic_notification_sound.imageset/table_ic_notification_sound@3x.png new file mode 100644 index 0000000000000000000000000000000000000000..429e224251dc5a62893ce4f34d8e556719c837cc GIT binary patch literal 2052 zcmeAS@N?(olHy`uVBq!ia0vp^9w5xY1|&n@ZgvM!jKx9jP7LeL$-D$|I14-?iy0WW zg+Z8+Vb&Z81_llpi<;HsXMd|v6mX?-X(Gs7c7{+3kj2o|M`E)8SrADBDCn&MGAmMZB3v?o0Sfj7$W>S+&^0>e=j0a! z7bGU9f*c0cf+U2l8f;A@E^Ck^kTj+wTNRfkWu+#UAjK9i&cJEkDKT9iN!Ugot7;oy zO0e?HPsvQHbV)2pwKFm>w6HQTvNAGOFf;`*OwDZc(bOQh03_pFl$uzQUlfv`pJNC1 zMJ|Y|V60~j(TOY%)oP;;%0)=I3X)~PqQE?B#|6|0%l~#75Hq`G%&j7()7cv26Xp~bbYxoV zlprDNqfVbqO#0u)7tb#iTfV${R`L6v^56fwzHa&b+~+&R=hENpHGW(vS6jPtlY^MU zg3B*+RHB`deYk56NE~N=rt)~7O0!CaDnHA)P?vR+B~x@(_?=>BUN)a+GH1}0Z&R*| zuQ>ULEj`p?xXL_q&YfIAKAAgN9H9v`z!vkd*KxdVtVEej;BPo9=70L zE5|X1G403 zcraap<5T<6KPI!h#U{9>7~XX6o490^i2(O>*YoqwI7LN%3DWjf`+oBJlfvQ?Izg`^ zPgOXsHW64Hr{dn>;H%!NA-~|!nG6=6jUMwa*DtCFnj9s+Ky7Eq^;wO(MBe$a740th z{)-{^o!x3jS@{KQ8)qy{Q%HXJCRIVb`{vBXp4QFN8|UbxrL!4{or_~D+B9RX=6%pEJ9mLvJ&u)y-x@IS@F#mXz^OCz?BfpeS`_=r% zuli)&=KQI(6-xRt?=rSVoj<*9<(bD``}K|;*l)4mN%nf?|M~j1-=nfWtZy`TxwT{! z*FV4N`PCPu9JJupFPy-<HZ1iCZb!ce9sl`W>{% zp-F}HQs%7SlsPVcdu$)S*8Ru3ebWC$-tW6UpSdLPgWHZde&UmRCaj>U+0)g}Wt~$( F695PA_~8Hm literal 0 HcmV?d00001 diff --git a/Signal/src/ViewControllers/OWSConversationSettingsViewController.m b/Signal/src/ViewControllers/OWSConversationSettingsViewController.m index 4b554036d..ea333a0b5 100644 --- a/Signal/src/ViewControllers/OWSConversationSettingsViewController.m +++ b/Signal/src/ViewControllers/OWSConversationSettingsViewController.m @@ -477,11 +477,47 @@ NS_ASSUME_NONNULL_BEGIN // Mute thread section. - OWSTableSection *muteSection = [OWSTableSection new]; - // We need a section header to separate the mute UI from the group settings UI. - muteSection.headerTitle = NSLocalizedString( - @"CONVERSATION_SETTINGS_MUTE_SECTION", @"Title for the 'mute' section of the conversation settings view."); - [muteSection addItem:[OWSTableItem itemWithCustomCellBlock:^{ + OWSTableSection *notificationsSection = [OWSTableSection new]; + // We need a section header to separate the notifications UI from the group settings UI. + notificationsSection.headerTitle = NSLocalizedString( + @"SETTINGS_SECTION_NOTIFICATIONS", @"Label for the notifications section of conversation settings view."); + + [notificationsSection addItem:[OWSTableItem itemWithCustomCellBlock:^{ + UITableViewCell *cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:nil]; + OWSConversationSettingsViewController *strongSelf = weakSelf; + OWSCAssert(strongSelf); + cell.preservesSuperviewLayoutMargins = YES; + cell.contentView.preservesSuperviewLayoutMargins = YES; + cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator; + + UIImageView *iconView = [strongSelf viewForIconWithName:@"table_ic_notification_sound"]; + [cell.contentView addSubview:iconView]; + [iconView autoVCenterInSuperview]; + [iconView autoPinLeadingToSuperview]; + + UILabel *rowLabel = [UILabel new]; + rowLabel.text = NSLocalizedString(@"SETTINGS_ITEM_NOTIFICATION_SOUND", + @"Label for settings view that allows user to change the notification sound."); + rowLabel.textColor = [UIColor blackColor]; + rowLabel.font = [UIFont ows_regularFontWithSize:17.f]; + rowLabel.lineBreakMode = NSLineBreakByTruncatingTail; + [cell.contentView addSubview:rowLabel]; + [rowLabel autoVCenterInSuperview]; + [rowLabel autoPinLeadingToTrailingOfView:iconView margin:weakSelf.iconSpacing]; + + OWSSound sound = [OWSSounds notificationSoundForThread:self.thread]; + cell.detailTextLabel.text = [OWSSounds displayNameForSound:sound]; + return cell; + } + customRowHeight:45.f + actionBlock:^{ + OWSSoundSettingsViewController *vc = [OWSSoundSettingsViewController new]; + vc.soundType = OWSSoundType_Notification; + vc.thread = weakSelf.thread; + [weakSelf.navigationController pushViewController:vc animated:YES]; + }]]; + + [notificationsSection addItem:[OWSTableItem itemWithCustomCellBlock:^{ UITableViewCell *cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:nil]; OWSConversationSettingsViewController *strongSelf = weakSelf; OWSCAssert(strongSelf); @@ -534,13 +570,13 @@ NS_ASSUME_NONNULL_BEGIN cell.detailTextLabel.text = muteStatus; return cell; } - customRowHeight:45.f - actionBlock:^{ - [weakSelf showMuteUnmuteActionSheet]; - }]]; - muteSection.footerTitle + customRowHeight:45.f + actionBlock:^{ + [weakSelf showMuteUnmuteActionSheet]; + }]]; + notificationsSection.footerTitle = NSLocalizedString(@"MUTE_BEHAVIOR_EXPLANATION", @"An explanation of the consequences of muting a thread."); - [contents addSection:muteSection]; + [contents addSection:notificationsSection]; // Block user section. @@ -571,29 +607,6 @@ NS_ASSUME_NONNULL_BEGIN [contents addSection:section]; } - // Sounds section. - - OWSTableSection *soundsSection = [OWSTableSection new]; - soundsSection.headerTitle = NSLocalizedString(@"SETTINGS_SECTION_SOUNDS", - @"Label for the sounds section of settings views."); - [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]; - }]]; - [contents addSection:soundsSection]; - self.contents = contents; } diff --git a/Signal/translations/en.lproj/Localizable.strings b/Signal/translations/en.lproj/Localizable.strings index c6bc2f6b1..0ae24fd8f 100644 --- a/Signal/translations/en.lproj/Localizable.strings +++ b/Signal/translations/en.lproj/Localizable.strings @@ -433,9 +433,6 @@ /* Label for button to mute a thread for a year. */ "CONVERSATION_SETTINGS_MUTE_ONE_YEAR_ACTION" = "Mute for one year"; -/* Title for the 'mute' section of the conversation settings view. */ -"CONVERSATION_SETTINGS_MUTE_SECTION" = "Mute"; - /* Indicates that this thread is muted until a given date or time. Embeds {{The date or time which the thread is muted until}}. */ "CONVERSATION_SETTINGS_MUTED_UNTIL_FORMAT" = "until %@"; @@ -1605,6 +1602,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 notifications section of conversation settings view. */ +"SETTINGS_SECTION_NOTIFICATIONS" = "Notifications"; + /* Label for the sounds section of settings views. */ "SETTINGS_SECTION_SOUNDS" = "Sounds";