|
|
|
@ -55,10 +55,6 @@ const CGFloat kIconViewLength = 24;
|
|
|
|
|
@property (nonatomic) NSArray<NSNumber *> *disappearingMessagesDurations;
|
|
|
|
|
@property (nonatomic) OWSDisappearingMessagesConfiguration *disappearingMessagesConfiguration;
|
|
|
|
|
@property (nullable, nonatomic) MediaGallery *mediaGallery;
|
|
|
|
|
@property (nonatomic, readonly) TSAccountManager *accountManager;
|
|
|
|
|
@property (nonatomic, readonly) OWSContactsManager *contactsManager;
|
|
|
|
|
@property (nonatomic, readonly) OWSMessageSender *messageSender;
|
|
|
|
|
@property (nonatomic, readonly) OWSBlockingManager *blockingManager;
|
|
|
|
|
@property (nonatomic, readonly) ContactsViewHelper *contactsViewHelper;
|
|
|
|
|
@property (nonatomic, readonly) UIImageView *avatarView;
|
|
|
|
|
@property (nonatomic, readonly) UILabel *disappearingMessagesDurationLabel;
|
|
|
|
@ -110,10 +106,6 @@ const CGFloat kIconViewLength = 24;
|
|
|
|
|
|
|
|
|
|
- (void)commonInit
|
|
|
|
|
{
|
|
|
|
|
_accountManager = [TSAccountManager sharedInstance];
|
|
|
|
|
_contactsManager = Environment.shared.contactsManager;
|
|
|
|
|
_messageSender = SSKEnvironment.shared.messageSender;
|
|
|
|
|
_blockingManager = [OWSBlockingManager sharedManager];
|
|
|
|
|
_contactsViewHelper = [[ContactsViewHelper alloc] initWithDelegate:self];
|
|
|
|
|
|
|
|
|
|
[self observeNotifications];
|
|
|
|
@ -131,6 +123,33 @@ const CGFloat kIconViewLength = 24;
|
|
|
|
|
return SSKEnvironment.shared.messageSenderJobQueue;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
- (TSAccountManager *)tsAccountManager
|
|
|
|
|
{
|
|
|
|
|
OWSAssertDebug(SSKEnvironment.shared.tsAccountManager);
|
|
|
|
|
|
|
|
|
|
return SSKEnvironment.shared.tsAccountManager;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
- (OWSContactsManager *)contactsManager
|
|
|
|
|
{
|
|
|
|
|
return Environment.shared.contactsManager;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
- (OWSMessageSender *)messageSender
|
|
|
|
|
{
|
|
|
|
|
return SSKEnvironment.shared.messageSender;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
- (OWSBlockingManager *)blockingManager
|
|
|
|
|
{
|
|
|
|
|
return [OWSBlockingManager sharedManager];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
- (OWSProfileManager *)profileManager
|
|
|
|
|
{
|
|
|
|
|
return [OWSProfileManager sharedManager];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#pragma mark
|
|
|
|
|
|
|
|
|
|
- (void)observeNotifications
|
|
|
|
@ -291,6 +310,9 @@ const CGFloat kIconViewLength = 24;
|
|
|
|
|
OWSTableContents *contents = [OWSTableContents new];
|
|
|
|
|
contents.title = NSLocalizedString(@"CONVERSATION_SETTINGS", @"title for conversation settings screen");
|
|
|
|
|
|
|
|
|
|
BOOL isNoteToSelf = (!self.thread.isGroupThread &&
|
|
|
|
|
[self.thread.contactIdentifier isEqualToString:self.tsAccountManager.localNumber]);
|
|
|
|
|
|
|
|
|
|
__weak OWSConversationSettingsViewController *weakSelf = self;
|
|
|
|
|
|
|
|
|
|
// Main section.
|
|
|
|
@ -333,7 +355,7 @@ const CGFloat kIconViewLength = 24;
|
|
|
|
|
}]];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!self.isGroupThread && self.thread.hasSafetyNumbers) {
|
|
|
|
|
if (!isNoteToSelf && !self.isGroupThread && self.thread.hasSafetyNumbers) {
|
|
|
|
|
[mainSection addItem:[OWSTableItem itemWithCustomCellBlock:^{
|
|
|
|
|
return [weakSelf
|
|
|
|
|
disclosureCellWithName:
|
|
|
|
@ -346,7 +368,9 @@ const CGFloat kIconViewLength = 24;
|
|
|
|
|
}]];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ([OWSProfileManager.sharedManager isThreadInProfileWhitelist:self.thread]) {
|
|
|
|
|
if (isNoteToSelf) {
|
|
|
|
|
// Skip the profile whitelist.
|
|
|
|
|
} else if ([self.profileManager isThreadInProfileWhitelist:self.thread]) {
|
|
|
|
|
[mainSection
|
|
|
|
|
addItem:[OWSTableItem
|
|
|
|
|
itemWithCustomCellBlock:^{
|
|
|
|
@ -564,6 +588,7 @@ const CGFloat kIconViewLength = 24;
|
|
|
|
|
|
|
|
|
|
// Mute thread section.
|
|
|
|
|
|
|
|
|
|
if (!isNoteToSelf) {
|
|
|
|
|
OWSTableSection *notificationsSection = [OWSTableSection new];
|
|
|
|
|
// We need a section header to separate the notifications UI from the group settings UI.
|
|
|
|
|
notificationsSection.headerTitle = NSLocalizedString(
|
|
|
|
@ -609,7 +634,8 @@ const CGFloat kIconViewLength = 24;
|
|
|
|
|
}]];
|
|
|
|
|
|
|
|
|
|
[notificationsSection
|
|
|
|
|
addItem:[OWSTableItem
|
|
|
|
|
addItem:
|
|
|
|
|
[OWSTableItem
|
|
|
|
|
itemWithCustomCellBlock:^{
|
|
|
|
|
UITableViewCell *cell =
|
|
|
|
|
[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:nil];
|
|
|
|
@ -672,12 +698,13 @@ const CGFloat kIconViewLength = 24;
|
|
|
|
|
actionBlock:^{
|
|
|
|
|
[weakSelf showMuteUnmuteActionSheet];
|
|
|
|
|
}]];
|
|
|
|
|
notificationsSection.footerTitle
|
|
|
|
|
= NSLocalizedString(@"MUTE_BEHAVIOR_EXPLANATION", @"An explanation of the consequences of muting a thread.");
|
|
|
|
|
notificationsSection.footerTitle = NSLocalizedString(
|
|
|
|
|
@"MUTE_BEHAVIOR_EXPLANATION", @"An explanation of the consequences of muting a thread.");
|
|
|
|
|
[contents addSection:notificationsSection];
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
// Block Conversation section.
|
|
|
|
|
|
|
|
|
|
if (!isNoteToSelf) {
|
|
|
|
|
OWSTableSection *section = [OWSTableSection new];
|
|
|
|
|
if (self.thread.isGroupThread) {
|
|
|
|
|
section.footerTitle = NSLocalizedString(
|
|
|
|
@ -718,6 +745,7 @@ const CGFloat kIconViewLength = 24;
|
|
|
|
|
}
|
|
|
|
|
actionBlock:nil]];
|
|
|
|
|
[contents addSection:section];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
self.contents = contents;
|
|
|
|
|
}
|
|
|
|
@ -961,7 +989,7 @@ const CGFloat kIconViewLength = 24;
|
|
|
|
|
|
|
|
|
|
- (void)showShareProfileAlert
|
|
|
|
|
{
|
|
|
|
|
[OWSProfileManager.sharedManager presentAddThreadToProfileWhitelist:self.thread
|
|
|
|
|
[self.profileManager presentAddThreadToProfileWhitelist:self.thread
|
|
|
|
|
fromViewController:self
|
|
|
|
|
success:^{
|
|
|
|
|
[self updateTableContents];
|
|
|
|
@ -1118,8 +1146,8 @@ const CGFloat kIconViewLength = 24;
|
|
|
|
|
}
|
|
|
|
|
[BlockListUIUtils showUnblockThreadActionSheet:self.thread
|
|
|
|
|
fromViewController:self
|
|
|
|
|
blockingManager:_blockingManager
|
|
|
|
|
contactsManager:_contactsManager
|
|
|
|
|
blockingManager:self.blockingManager
|
|
|
|
|
contactsManager:self.contactsManager
|
|
|
|
|
completionBlock:^(BOOL isBlocked) {
|
|
|
|
|
// Update switch state if user cancels action.
|
|
|
|
|
blockConversationSwitch.on = isBlocked;
|
|
|
|
|