Re-enable settings for group conversations

pull/49/head
Niels Andriesse 6 years ago
parent 6b0454317e
commit 4eda27dcc0

@ -191,6 +191,7 @@ typedef void (^SystemMessageActionBlock)(void);
[self.button setTitle:self.action.title forState:UIControlStateNormal]; [self.button setTitle:self.action.title forState:UIControlStateNormal];
UIFont *buttonFont = UIFont.ows_dynamicTypeSubheadlineFont.ows_mediumWeight; UIFont *buttonFont = UIFont.ows_dynamicTypeSubheadlineFont.ows_mediumWeight;
self.button.titleLabel.font = buttonFont; self.button.titleLabel.font = buttonFont;
[self.button setTitleColor:UIColor.lokiGreen forState:UIControlStateNormal];
self.button.hidden = NO; self.button.hidden = NO;
} else { } else {
self.button.hidden = YES; self.button.hidden = YES;

@ -97,10 +97,8 @@ public class ConversationHeaderView: UIStackView {
self.addArrangedSubview(avatarView) self.addArrangedSubview(avatarView)
self.addArrangedSubview(textRows) self.addArrangedSubview(textRows)
if (!thread.isGroupThread()) { let tapGesture = UITapGestureRecognizer(target: self, action: #selector(didTapView))
let tapGesture = UITapGestureRecognizer(target: self, action: #selector(didTapView)) self.addGestureRecognizer(tapGesture)
self.addGestureRecognizer(tapGesture)
}
} }
required public init(coder: NSCoder) { required public init(coder: NSCoder) {

@ -551,6 +551,7 @@ const CGFloat kIconViewLength = 24;
UISlider *slider = [UISlider new]; UISlider *slider = [UISlider new];
slider.maximumValue = (float)(strongSelf.disappearingMessagesDurations.count - 1); slider.maximumValue = (float)(strongSelf.disappearingMessagesDurations.count - 1);
slider.minimumValue = 0; slider.minimumValue = 0;
slider.tintColor = UIColor.lokiGreen;
slider.continuous = YES; // NO fires change event only once you let go slider.continuous = YES; // NO fires change event only once you let go
slider.value = strongSelf.disappearingMessagesConfiguration.durationIndex; slider.value = strongSelf.disappearingMessagesConfiguration.durationIndex;
[slider addTarget:strongSelf [slider addTarget:strongSelf
@ -600,6 +601,7 @@ const CGFloat kIconViewLength = 24;
// Group settings section. // Group settings section.
/*
if (self.isGroupThread) { if (self.isGroupThread) {
NSArray *groupItems = @[ NSArray *groupItems = @[
[OWSTableItem [OWSTableItem
@ -651,6 +653,7 @@ const CGFloat kIconViewLength = 24;
@"Conversation settings table section title") @"Conversation settings table section title")
items:groupItems]]; items:groupItems]];
} }
*/
// Mute thread section. // Mute thread section.
@ -703,78 +706,80 @@ const CGFloat kIconViewLength = 24;
[weakSelf.navigationController pushViewController:vc animated:YES]; [weakSelf.navigationController pushViewController:vc animated:YES];
}]]; }]];
[mainSection if (!self.thread.isGroupThread) {
addItem: [mainSection
[OWSTableItem addItem:
itemWithCustomCellBlock:^{ [OWSTableItem
UITableViewCell *cell = itemWithCustomCellBlock:^{
[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:nil]; UITableViewCell *cell =
[OWSTableItem configureCell:cell]; [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:nil];
OWSConversationSettingsViewController *strongSelf = weakSelf; [OWSTableItem configureCell:cell];
OWSCAssertDebug(strongSelf); OWSConversationSettingsViewController *strongSelf = weakSelf;
cell.preservesSuperviewLayoutMargins = YES; OWSCAssertDebug(strongSelf);
cell.contentView.preservesSuperviewLayoutMargins = YES; cell.preservesSuperviewLayoutMargins = YES;
cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator; cell.contentView.preservesSuperviewLayoutMargins = YES;
cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
UIImageView *iconView = [strongSelf viewForIconWithName:@"table_ic_mute_thread"];
UILabel *rowLabel = [UILabel new];
rowLabel.text = NSLocalizedString(@"CONVERSATION_SETTINGS_MUTE_LABEL",
@"label for 'mute thread' cell in conversation settings");
rowLabel.textColor = [Theme primaryColor];
rowLabel.font = [UIFont ows_dynamicTypeBodyFont];
rowLabel.lineBreakMode = NSLineBreakByTruncatingTail;
NSString *muteStatus = NSLocalizedString(@"CONVERSATION_SETTINGS_MUTE_NOT_MUTED",
@"Indicates that the current thread is not muted.");
NSDate *mutedUntilDate = strongSelf.thread.mutedUntilDate;
NSDate *now = [NSDate date];
if (mutedUntilDate != nil && [mutedUntilDate timeIntervalSinceDate:now] > 0) {
NSCalendar *calendar = [NSCalendar currentCalendar];
NSCalendarUnit calendarUnits = NSCalendarUnitYear | NSCalendarUnitMonth | NSCalendarUnitDay;
NSDateComponents *muteUntilComponents =
[calendar components:calendarUnits fromDate:mutedUntilDate];
NSDateComponents *nowComponents = [calendar components:calendarUnits fromDate:now];
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
if (nowComponents.year != muteUntilComponents.year
|| nowComponents.month != muteUntilComponents.month
|| nowComponents.day != muteUntilComponents.day) {
[dateFormatter setDateStyle:NSDateFormatterShortStyle];
[dateFormatter setTimeStyle:NSDateFormatterShortStyle];
} else {
[dateFormatter setDateStyle:NSDateFormatterNoStyle];
[dateFormatter setTimeStyle:NSDateFormatterShortStyle];
}
muteStatus = [NSString UIImageView *iconView = [strongSelf viewForIconWithName:@"table_ic_mute_thread"];
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]];
}
UIStackView *contentRow = UILabel *rowLabel = [UILabel new];
[[UIStackView alloc] initWithArrangedSubviews:@[ iconView, rowLabel ]]; rowLabel.text = NSLocalizedString(@"CONVERSATION_SETTINGS_MUTE_LABEL",
contentRow.spacing = strongSelf.iconSpacing; @"label for 'mute thread' cell in conversation settings");
contentRow.alignment = UIStackViewAlignmentCenter; rowLabel.textColor = [Theme primaryColor];
[cell.contentView addSubview:contentRow]; rowLabel.font = [UIFont ows_dynamicTypeBodyFont];
[contentRow autoPinEdgesToSuperviewMargins]; rowLabel.lineBreakMode = NSLineBreakByTruncatingTail;
cell.detailTextLabel.text = muteStatus; NSString *muteStatus = NSLocalizedString(@"CONVERSATION_SETTINGS_MUTE_NOT_MUTED",
@"Indicates that the current thread is not muted.");
NSDate *mutedUntilDate = strongSelf.thread.mutedUntilDate;
NSDate *now = [NSDate date];
if (mutedUntilDate != nil && [mutedUntilDate timeIntervalSinceDate:now] > 0) {
NSCalendar *calendar = [NSCalendar currentCalendar];
NSCalendarUnit calendarUnits = NSCalendarUnitYear | NSCalendarUnitMonth | NSCalendarUnitDay;
NSDateComponents *muteUntilComponents =
[calendar components:calendarUnits fromDate:mutedUntilDate];
NSDateComponents *nowComponents = [calendar components:calendarUnits fromDate:now];
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
if (nowComponents.year != muteUntilComponents.year
|| nowComponents.month != muteUntilComponents.month
|| nowComponents.day != muteUntilComponents.day) {
[dateFormatter setDateStyle:NSDateFormatterShortStyle];
[dateFormatter setTimeStyle:NSDateFormatterShortStyle];
} else {
[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.accessibilityIdentifier UIStackView *contentRow =
= ACCESSIBILITY_IDENTIFIER_WITH_NAME(OWSConversationSettingsViewController, @"mute"); [[UIStackView alloc] initWithArrangedSubviews:@[ iconView, rowLabel ]];
contentRow.spacing = strongSelf.iconSpacing;
contentRow.alignment = UIStackViewAlignmentCenter;
[cell.contentView addSubview:contentRow];
[contentRow autoPinEdgesToSuperviewMargins];
return cell; cell.detailTextLabel.text = muteStatus;
}
customRowHeight:UITableViewAutomaticDimension cell.accessibilityIdentifier
actionBlock:^{ = ACCESSIBILITY_IDENTIFIER_WITH_NAME(OWSConversationSettingsViewController, @"mute");
[weakSelf showMuteUnmuteActionSheet];
}]]; return cell;
mainSection.footerTitle = NSLocalizedString( }
@"MUTE_BEHAVIOR_EXPLANATION", @"An explanation of the consequences of muting a thread."); customRowHeight:UITableViewAutomaticDimension
// [contents addSection:notificationsSection]; actionBlock:^{
[weakSelf showMuteUnmuteActionSheet];
}]];
mainSection.footerTitle = NSLocalizedString(
@"MUTE_BEHAVIOR_EXPLANATION", @"An explanation of the consequences of muting a thread.");
// [contents addSection:notificationsSection];
}
} }
// Block Conversation section. // Block Conversation section.
@ -992,10 +997,12 @@ const CGFloat kIconViewLength = 24;
[lastTitleView autoPinEdgeToSuperviewEdge:ALEdgeBottom]; [lastTitleView autoPinEdgeToSuperviewEdge:ALEdgeBottom];
[mainSectionHeader if (!self.thread.isGroupThread) {
addGestureRecognizer:[[UITapGestureRecognizer alloc] initWithTarget:self [mainSectionHeader
action:@selector(conversationNameTouched:)]]; addGestureRecognizer:[[UITapGestureRecognizer alloc] initWithTarget:self
mainSectionHeader.userInteractionEnabled = YES; action:@selector(conversationNameTouched:)]];
mainSectionHeader.userInteractionEnabled = YES;
}
SET_SUBVIEW_ACCESSIBILITY_IDENTIFIER(self, mainSectionHeader); SET_SUBVIEW_ACCESSIBILITY_IDENTIFIER(self, mainSectionHeader);

Loading…
Cancel
Save