Update disappearing messages icon.

pull/1/head
Matthew Chen 7 years ago
parent 5caa289bc3
commit 9494023107

@ -2,17 +2,17 @@
"images" : [ "images" : [
{ {
"idiom" : "universal", "idiom" : "universal",
"filename" : "ic_timer.png", "filename" : "timer-48@1x.png",
"scale" : "1x" "scale" : "1x"
}, },
{ {
"idiom" : "universal", "idiom" : "universal",
"filename" : "ic_timer@2x.png", "filename" : "timer-48@2x.png",
"scale" : "2x" "scale" : "2x"
}, },
{ {
"idiom" : "universal", "idiom" : "universal",
"filename" : "ic_timer@3x.png", "filename" : "timer-48@3x.png",
"scale" : "3x" "scale" : "3x"
} }
], ],

Binary file not shown.

Before

Width:  |  Height:  |  Size: 778 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.3 KiB

@ -363,62 +363,63 @@ const CGFloat kIconViewLength = 24;
}]]; }]];
} }
[mainSection [mainSection addItem:[OWSTableItem
addItem:[OWSTableItem itemWithCustomCellBlock:^{ itemWithCustomCellBlock:^{
UITableViewCell *cell = [UITableViewCell new]; UITableViewCell *cell = [UITableViewCell new];
OWSConversationSettingsViewController *strongSelf = weakSelf; OWSConversationSettingsViewController *strongSelf = weakSelf;
OWSCAssert(strongSelf); OWSCAssert(strongSelf);
cell.preservesSuperviewLayoutMargins = YES; cell.preservesSuperviewLayoutMargins = YES;
cell.contentView.preservesSuperviewLayoutMargins = YES; cell.contentView.preservesSuperviewLayoutMargins = YES;
cell.selectionStyle = UITableViewCellSelectionStyleNone; cell.selectionStyle = UITableViewCellSelectionStyleNone;
UIView *topView = [UIView containerView]; UIView *topView = [UIView containerView];
[cell.contentView addSubview:topView]; [cell.contentView addSubview:topView];
[topView autoPinLeadingAndTrailingToSuperviewMargin]; [topView autoPinLeadingAndTrailingToSuperviewMargin];
[topView autoPinEdgeToSuperviewEdge:ALEdgeTop]; [topView autoPinEdgeToSuperviewEdge:ALEdgeTop];
[topView autoSetDimension:ALDimensionHeight toSize:kOWSTable_DefaultCellHeight]; [topView autoSetDimension:ALDimensionHeight toSize:kOWSTable_DefaultCellHeight];
UIImageView *iconView = [strongSelf viewForIconWithName:@"ic_timer"]; UIImageView *iconView = [strongSelf viewForIconWithName:@"ic_timer"];
[topView addSubview:iconView]; [topView addSubview:iconView];
[iconView autoVCenterInSuperview]; [iconView autoVCenterInSuperview];
[iconView autoPinLeadingToSuperviewMargin]; [iconView autoPinLeadingToSuperviewMargin];
UILabel *rowLabel = [UILabel new]; UILabel *rowLabel = [UILabel new];
rowLabel.text = NSLocalizedString(@"DISAPPEARING_MESSAGES", @"table cell label in conversation settings"); rowLabel.text = NSLocalizedString(
rowLabel.textColor = [UIColor blackColor]; @"DISAPPEARING_MESSAGES", @"table cell label in conversation settings");
rowLabel.font = [UIFont ows_regularFontWithSize:17.f]; rowLabel.textColor = [UIColor blackColor];
rowLabel.lineBreakMode = NSLineBreakByTruncatingTail; rowLabel.font = [UIFont ows_dynamicTypeBodyFont];
[topView addSubview:rowLabel]; rowLabel.lineBreakMode = NSLineBreakByTruncatingTail;
[rowLabel autoVCenterInSuperview]; [topView addSubview:rowLabel];
[rowLabel autoPinLeadingToTrailingEdgeOfView:iconView offset:weakSelf.iconSpacing]; [rowLabel autoVCenterInSuperview];
[rowLabel autoPinLeadingToTrailingEdgeOfView:iconView offset:weakSelf.iconSpacing];
UISwitch *switchView = [UISwitch new];
switchView.on = strongSelf.disappearingMessagesConfiguration.isEnabled; UISwitch *switchView = [UISwitch new];
[switchView addTarget:strongSelf switchView.on = strongSelf.disappearingMessagesConfiguration.isEnabled;
action:@selector(disappearingMessagesSwitchValueDidChange:) [switchView addTarget:strongSelf
forControlEvents:UIControlEventValueChanged]; action:@selector(disappearingMessagesSwitchValueDidChange:)
[topView addSubview:switchView]; forControlEvents:UIControlEventValueChanged];
[switchView autoVCenterInSuperview]; [topView addSubview:switchView];
[switchView autoPinLeadingToTrailingEdgeOfView:rowLabel offset:weakSelf.iconSpacing]; [switchView autoVCenterInSuperview];
[switchView autoPinTrailingToSuperviewMargin]; [switchView autoPinLeadingToTrailingEdgeOfView:rowLabel offset:weakSelf.iconSpacing];
[switchView autoPinTrailingToSuperviewMargin];
UILabel *subtitleLabel = [UILabel new];
subtitleLabel.text UILabel *subtitleLabel = [UILabel new];
= NSLocalizedString(@"DISAPPEARING_MESSAGES_DESCRIPTION", @"subheading in conversation settings"); subtitleLabel.text = NSLocalizedString(
subtitleLabel.textColor = [UIColor blackColor]; @"DISAPPEARING_MESSAGES_DESCRIPTION", @"subheading in conversation settings");
subtitleLabel.font = [UIFont ows_regularFontWithSize:11.f]; subtitleLabel.textColor = [UIColor blackColor];
subtitleLabel.numberOfLines = 0; subtitleLabel.font = [UIFont ows_dynamicTypeCaption1Font];
subtitleLabel.lineBreakMode = NSLineBreakByWordWrapping; subtitleLabel.numberOfLines = 0;
[cell.contentView addSubview:subtitleLabel]; subtitleLabel.lineBreakMode = NSLineBreakByWordWrapping;
[subtitleLabel autoPinEdge:ALEdgeTop toEdge:ALEdgeBottom ofView:topView]; [cell.contentView addSubview:subtitleLabel];
[subtitleLabel autoPinEdge:ALEdgeLeading toEdge:ALEdgeLeading ofView:rowLabel]; [subtitleLabel autoPinEdge:ALEdgeTop toEdge:ALEdgeBottom ofView:topView];
[subtitleLabel autoPinTrailingToSuperviewMargin]; [subtitleLabel autoPinEdge:ALEdgeLeading toEdge:ALEdgeLeading ofView:rowLabel];
[subtitleLabel autoPinTrailingToSuperviewMargin];
return cell; [subtitleLabel autoPinBottomToSuperviewMargin];
}
// TODO: We shouldn't hard-code a row height that will contain the cell content. return cell;
customRowHeight:108.f }
actionBlock:nil]]; customRowHeight:UITableViewAutomaticDimension
actionBlock:nil]];
if (self.disappearingMessagesConfiguration.isEnabled) { if (self.disappearingMessagesConfiguration.isEnabled) {
[mainSection [mainSection
@ -445,7 +446,7 @@ const CGFloat kIconViewLength = 24;
UILabel *rowLabel = strongSelf.disappearingMessagesDurationLabel; UILabel *rowLabel = strongSelf.disappearingMessagesDurationLabel;
[strongSelf updateDisappearingMessagesDurationLabel]; [strongSelf updateDisappearingMessagesDurationLabel];
rowLabel.textColor = [UIColor blackColor]; rowLabel.textColor = [UIColor blackColor];
rowLabel.font = [UIFont ows_regularFontWithSize:11.f]; rowLabel.font = [UIFont ows_dynamicTypeBodyFont];
rowLabel.lineBreakMode = NSLineBreakByTruncatingTail; rowLabel.lineBreakMode = NSLineBreakByTruncatingTail;
[topView addSubview:rowLabel]; [topView addSubview:rowLabel];
[rowLabel autoVCenterInSuperview]; [rowLabel autoVCenterInSuperview];
@ -463,11 +464,11 @@ const CGFloat kIconViewLength = 24;
[slider autoPinEdge:ALEdgeTop toEdge:ALEdgeBottom ofView:topView]; [slider autoPinEdge:ALEdgeTop toEdge:ALEdgeBottom ofView:topView];
[slider autoPinEdge:ALEdgeLeading toEdge:ALEdgeLeading ofView:rowLabel]; [slider autoPinEdge:ALEdgeLeading toEdge:ALEdgeLeading ofView:rowLabel];
[slider autoPinTrailingToSuperviewMargin]; [slider autoPinTrailingToSuperviewMargin];
[slider autoPinBottomToSuperviewMargin];
return cell; return cell;
} }
// TODO: We shouldn't hard-code a row height that will contain the cell content. customRowHeight:UITableViewAutomaticDimension
customRowHeight:84.f
actionBlock:nil]]; actionBlock:nil]];
} }
@ -515,97 +516,105 @@ const CGFloat kIconViewLength = 24;
notificationsSection.headerTitle = NSLocalizedString( notificationsSection.headerTitle = NSLocalizedString(
@"SETTINGS_SECTION_NOTIFICATIONS", @"Label for the notifications section of conversation settings view."); @"SETTINGS_SECTION_NOTIFICATIONS", @"Label for the notifications section of conversation settings view.");
[notificationsSection addItem:[OWSTableItem itemWithCustomCellBlock:^{ [notificationsSection
UITableViewCell *cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:nil]; addItem:[OWSTableItem
OWSConversationSettingsViewController *strongSelf = weakSelf; itemWithCustomCellBlock:^{
OWSCAssert(strongSelf); UITableViewCell *cell =
cell.preservesSuperviewLayoutMargins = YES; [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:nil];
cell.contentView.preservesSuperviewLayoutMargins = YES; OWSConversationSettingsViewController *strongSelf = weakSelf;
cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator; OWSCAssert(strongSelf);
cell.preservesSuperviewLayoutMargins = YES;
UIImageView *iconView = [strongSelf viewForIconWithName:@"table_ic_notification_sound"]; cell.contentView.preservesSuperviewLayoutMargins = YES;
[cell.contentView addSubview:iconView]; cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
[iconView autoVCenterInSuperview];
[iconView autoPinLeadingToSuperviewMargin]; UIImageView *iconView = [strongSelf viewForIconWithName:@"table_ic_notification_sound"];
[cell.contentView addSubview:iconView];
UILabel *rowLabel = [UILabel new]; [iconView autoVCenterInSuperview];
rowLabel.text = NSLocalizedString(@"SETTINGS_ITEM_NOTIFICATION_SOUND", [iconView autoPinLeadingToSuperviewMargin];
@"Label for settings view that allows user to change the notification sound.");
rowLabel.textColor = [UIColor blackColor]; UILabel *rowLabel = [UILabel new];
rowLabel.font = [UIFont ows_regularFontWithSize:17.f]; rowLabel.text = NSLocalizedString(@"SETTINGS_ITEM_NOTIFICATION_SOUND",
rowLabel.lineBreakMode = NSLineBreakByTruncatingTail; @"Label for settings view that allows user to change the notification sound.");
[cell.contentView addSubview:rowLabel]; rowLabel.textColor = [UIColor blackColor];
[rowLabel autoVCenterInSuperview]; rowLabel.font = [UIFont ows_dynamicTypeBodyFont];
[rowLabel autoPinLeadingToTrailingEdgeOfView:iconView offset:weakSelf.iconSpacing]; rowLabel.lineBreakMode = NSLineBreakByTruncatingTail;
[cell.contentView addSubview:rowLabel];
OWSSound sound = [OWSSounds notificationSoundForThread:self.thread]; [rowLabel autoVCenterInSuperview];
cell.detailTextLabel.text = [OWSSounds displayNameForSound:sound]; [rowLabel autoPinLeadingToTrailingEdgeOfView:iconView offset:weakSelf.iconSpacing];
return cell;
} OWSSound sound = [OWSSounds notificationSoundForThread:self.thread];
customRowHeight:45.f cell.detailTextLabel.text = [OWSSounds displayNameForSound:sound];
actionBlock:^{ return cell;
OWSSoundSettingsViewController *vc = [OWSSoundSettingsViewController new]; }
vc.thread = weakSelf.thread; customRowHeight:UITableViewAutomaticDimension
[weakSelf.navigationController pushViewController:vc animated:YES]; actionBlock:^{
}]]; OWSSoundSettingsViewController *vc = [OWSSoundSettingsViewController new];
vc.thread = weakSelf.thread;
[notificationsSection addItem:[OWSTableItem itemWithCustomCellBlock:^{ [weakSelf.navigationController pushViewController:vc animated:YES];
UITableViewCell *cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:nil]; }]];
OWSConversationSettingsViewController *strongSelf = weakSelf;
OWSCAssert(strongSelf); [notificationsSection
cell.preservesSuperviewLayoutMargins = YES; addItem:[OWSTableItem
cell.contentView.preservesSuperviewLayoutMargins = YES; itemWithCustomCellBlock:^{
cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator; UITableViewCell *cell =
[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:nil];
UIImageView *iconView = [strongSelf viewForIconWithName:@"table_ic_mute_thread"]; OWSConversationSettingsViewController *strongSelf = weakSelf;
[cell.contentView addSubview:iconView]; OWSCAssert(strongSelf);
[iconView autoVCenterInSuperview]; cell.preservesSuperviewLayoutMargins = YES;
[iconView autoPinLeadingToSuperviewMargin]; cell.contentView.preservesSuperviewLayoutMargins = YES;
cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
UILabel *rowLabel = [UILabel new];
rowLabel.text = NSLocalizedString( UIImageView *iconView = [strongSelf viewForIconWithName:@"table_ic_mute_thread"];
@"CONVERSATION_SETTINGS_MUTE_LABEL", @"label for 'mute thread' cell in conversation settings"); [cell.contentView addSubview:iconView];
rowLabel.textColor = [UIColor blackColor]; [iconView autoVCenterInSuperview];
rowLabel.font = [UIFont ows_regularFontWithSize:17.f]; [iconView autoPinLeadingToSuperviewMargin];
rowLabel.lineBreakMode = NSLineBreakByTruncatingTail;
[cell.contentView addSubview:rowLabel]; UILabel *rowLabel = [UILabel new];
[rowLabel autoVCenterInSuperview]; rowLabel.text = NSLocalizedString(@"CONVERSATION_SETTINGS_MUTE_LABEL",
[rowLabel autoPinLeadingToTrailingEdgeOfView:iconView offset:weakSelf.iconSpacing]; @"label for 'mute thread' cell in conversation settings");
rowLabel.textColor = [UIColor blackColor];
NSString *muteStatus = NSLocalizedString( rowLabel.font = [UIFont ows_dynamicTypeBodyFont];
@"CONVERSATION_SETTINGS_MUTE_NOT_MUTED", @"Indicates that the current thread is not muted."); rowLabel.lineBreakMode = NSLineBreakByTruncatingTail;
NSDate *mutedUntilDate = strongSelf.thread.mutedUntilDate; [cell.contentView addSubview:rowLabel];
NSDate *now = [NSDate date]; [rowLabel autoVCenterInSuperview];
if (mutedUntilDate != nil && [mutedUntilDate timeIntervalSinceDate:now] > 0) { [rowLabel autoPinLeadingToTrailingEdgeOfView:iconView offset:weakSelf.iconSpacing];
NSCalendar *calendar = [NSCalendar currentCalendar];
NSCalendarUnit calendarUnits = NSCalendarUnitYear | NSCalendarUnitMonth | NSCalendarUnitDay; NSString *muteStatus = NSLocalizedString(@"CONVERSATION_SETTINGS_MUTE_NOT_MUTED",
NSDateComponents *muteUntilComponents = [calendar components:calendarUnits fromDate:mutedUntilDate]; @"Indicates that the current thread is not muted.");
NSDateComponents *nowComponents = [calendar components:calendarUnits fromDate:now]; NSDate *mutedUntilDate = strongSelf.thread.mutedUntilDate;
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init]; NSDate *now = [NSDate date];
if (nowComponents.year != muteUntilComponents.year || nowComponents.month != muteUntilComponents.month if (mutedUntilDate != nil && [mutedUntilDate timeIntervalSinceDate:now] > 0) {
|| nowComponents.day != muteUntilComponents.day) { NSCalendar *calendar = [NSCalendar currentCalendar];
NSCalendarUnit calendarUnits = NSCalendarUnitYear | NSCalendarUnitMonth | NSCalendarUnitDay;
[dateFormatter setDateStyle:NSDateFormatterShortStyle]; NSDateComponents *muteUntilComponents =
[dateFormatter setTimeStyle:NSDateFormatterShortStyle]; [calendar components:calendarUnits fromDate:mutedUntilDate];
} else { NSDateComponents *nowComponents = [calendar components:calendarUnits fromDate:now];
[dateFormatter setDateStyle:NSDateFormatterNoStyle]; NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
[dateFormatter setTimeStyle:NSDateFormatterShortStyle]; if (nowComponents.year != muteUntilComponents.year
} || nowComponents.month != muteUntilComponents.month
|| nowComponents.day != muteUntilComponents.day) {
muteStatus =
[NSString stringWithFormat:NSLocalizedString(@"CONVERSATION_SETTINGS_MUTED_UNTIL_FORMAT", [dateFormatter setDateStyle:NSDateFormatterShortStyle];
@"Indicates that this thread is muted until a given date or time. " [dateFormatter setTimeStyle:NSDateFormatterShortStyle];
@"Embeds {{The date or time which the thread is muted until}}."), } else {
[dateFormatter stringFromDate:mutedUntilDate]]; [dateFormatter setDateStyle:NSDateFormatterNoStyle];
} [dateFormatter setTimeStyle:NSDateFormatterShortStyle];
}
muteStatus = [NSString
stringWithFormat:NSLocalizedString(@"CONVERSATION_SETTINGS_MUTED_UNTIL_FORMAT",
@"Indicates that this thread is muted until a given date or time. "
@"Embeds {{The date or time which the thread is muted until}}."),
[dateFormatter stringFromDate:mutedUntilDate]];
}
cell.detailTextLabel.text = muteStatus; cell.detailTextLabel.text = muteStatus;
return cell; return cell;
} }
customRowHeight:45.f customRowHeight:UITableViewAutomaticDimension
actionBlock:^{ actionBlock:^{
[weakSelf showMuteUnmuteActionSheet]; [weakSelf showMuteUnmuteActionSheet];
}]]; }]];
notificationsSection.footerTitle notificationsSection.footerTitle
= NSLocalizedString(@"MUTE_BEHAVIOR_EXPLANATION", @"An explanation of the consequences of muting a thread."); = NSLocalizedString(@"MUTE_BEHAVIOR_EXPLANATION", @"An explanation of the consequences of muting a thread.");
[contents addSection:notificationsSection]; [contents addSection:notificationsSection];
@ -687,7 +696,7 @@ const CGFloat kIconViewLength = 24;
UILabel *rowLabel = [UILabel new]; UILabel *rowLabel = [UILabel new];
rowLabel.text = name; rowLabel.text = name;
rowLabel.textColor = [UIColor blackColor]; rowLabel.textColor = [UIColor blackColor];
rowLabel.font = [UIFont ows_regularFontWithSize:17.f]; rowLabel.font = [UIFont ows_dynamicTypeBodyFont];
rowLabel.lineBreakMode = NSLineBreakByTruncatingTail; rowLabel.lineBreakMode = NSLineBreakByTruncatingTail;
[cell.contentView addSubview:rowLabel]; [cell.contentView addSubview:rowLabel];
[rowLabel autoVCenterInSuperview]; [rowLabel autoVCenterInSuperview];

Loading…
Cancel
Save