diff --git a/Session.xcodeproj/project.pbxproj b/Session.xcodeproj/project.pbxproj index 8d8826830..4a10b9daf 100644 --- a/Session.xcodeproj/project.pbxproj +++ b/Session.xcodeproj/project.pbxproj @@ -5063,7 +5063,7 @@ "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; CODE_SIGN_STYLE = Automatic; COPY_PHASE_STRIP = NO; - CURRENT_PROJECT_VERSION = 278; + CURRENT_PROJECT_VERSION = 279; DEBUG_INFORMATION_FORMAT = dwarf; DEVELOPMENT_TEAM = SUQ8J2PCT7; FRAMEWORK_SEARCH_PATHS = "$(inherited)"; @@ -5132,7 +5132,7 @@ "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; CODE_SIGN_STYLE = Automatic; COPY_PHASE_STRIP = NO; - CURRENT_PROJECT_VERSION = 278; + CURRENT_PROJECT_VERSION = 279; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; DEVELOPMENT_TEAM = SUQ8J2PCT7; ENABLE_NS_ASSERTIONS = NO; @@ -5193,7 +5193,7 @@ "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; CODE_SIGN_STYLE = Automatic; COPY_PHASE_STRIP = NO; - CURRENT_PROJECT_VERSION = 278; + CURRENT_PROJECT_VERSION = 279; DEBUG_INFORMATION_FORMAT = dwarf; DEVELOPMENT_TEAM = SUQ8J2PCT7; FRAMEWORK_SEARCH_PATHS = "$(inherited)"; @@ -5263,7 +5263,7 @@ "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; CODE_SIGN_STYLE = Automatic; COPY_PHASE_STRIP = NO; - CURRENT_PROJECT_VERSION = 278; + CURRENT_PROJECT_VERSION = 279; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; DEVELOPMENT_TEAM = SUQ8J2PCT7; ENABLE_NS_ASSERTIONS = NO; @@ -6148,7 +6148,7 @@ CODE_SIGN_ENTITLEMENTS = Session/Meta/Signal.entitlements; CODE_SIGN_IDENTITY = "iPhone Developer"; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; - CURRENT_PROJECT_VERSION = 278; + CURRENT_PROJECT_VERSION = 279; DEVELOPMENT_TEAM = SUQ8J2PCT7; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", @@ -6216,7 +6216,7 @@ CODE_SIGN_ENTITLEMENTS = Session/Meta/Signal.entitlements; CODE_SIGN_IDENTITY = "iPhone Developer"; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; - CURRENT_PROJECT_VERSION = 278; + CURRENT_PROJECT_VERSION = 279; DEVELOPMENT_TEAM = SUQ8J2PCT7; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", diff --git a/Session/Conversations/Settings/OWSConversationSettingsViewController.m b/Session/Conversations/Settings/OWSConversationSettingsViewController.m index 0e27958f8..4f54af7c5 100644 --- a/Session/Conversations/Settings/OWSConversationSettingsViewController.m +++ b/Session/Conversations/Settings/OWSConversationSettingsViewController.m @@ -318,55 +318,6 @@ CGFloat kIconViewLength = 24; } actionBlock:^{ [weakSelf inviteUsersToOpenGroup]; }]]; - - // Notification Settings - [section addItem:[OWSTableItem itemWithCustomCellBlock:^{ - UITableViewCell *cell = [OWSTableItem newCell]; - OWSConversationSettingsViewController *strongSelf = weakSelf; - OWSCAssertDebug(strongSelf); - cell.preservesSuperviewLayoutMargins = YES; - cell.contentView.preservesSuperviewLayoutMargins = YES; - cell.selectionStyle = UITableViewCellSelectionStyleNone; - - UIImageView *iconView = [strongSelf viewForIconWithName:@"NotifyMentions"]; - - UILabel *rowLabel = [UILabel new]; - rowLabel.text = NSLocalizedString( - @"CONVERSATION_SETTINGS_NOTIFICATION", @""); - rowLabel.textColor = LKColors.text; - rowLabel.font = [UIFont systemFontOfSize:LKValues.mediumFontSize]; - rowLabel.lineBreakMode = NSLineBreakByTruncatingTail; - - UISwitch *switchView = [UISwitch new]; - switchView.on = ((TSGroupThread *)strongSelf.thread).isOnlyNotifyMentions; - [switchView addTarget:strongSelf action:@selector(notifyMentionsSwitchValueDidChange:) - forControlEvents:UIControlEventValueChanged]; - - UIStackView *topRow = - [[UIStackView alloc] initWithArrangedSubviews:@[ iconView, rowLabel, switchView ]]; - topRow.spacing = strongSelf.iconSpacing; - topRow.alignment = UIStackViewAlignmentCenter; - [cell.contentView addSubview:topRow]; - [topRow autoPinEdgesToSuperviewMarginsExcludingEdge:ALEdgeBottom]; - - UILabel *subtitleLabel = [UILabel new]; - subtitleLabel.text = NSLocalizedString(@"When enabled, only messages mentioned you will be notified.", @""); - subtitleLabel.textColor = LKColors.text; - subtitleLabel.font = [UIFont systemFontOfSize:LKValues.smallFontSize]; - subtitleLabel.numberOfLines = 0; - subtitleLabel.lineBreakMode = NSLineBreakByWordWrapping; - [cell.contentView addSubview:subtitleLabel]; - [subtitleLabel autoPinEdge:ALEdgeTop toEdge:ALEdgeBottom ofView:topRow withOffset:8]; - [subtitleLabel autoPinEdge:ALEdgeLeading toEdge:ALEdgeLeading ofView:rowLabel]; - [subtitleLabel autoPinTrailingToSuperviewMargin]; - [subtitleLabel autoPinBottomToSuperviewMargin]; - - cell.userInteractionEnabled = !strongSelf.hasLeftGroup; - - cell.accessibilityIdentifier = ACCESSIBILITY_IDENTIFIER_WITH_NAME(OWSConversationSettingsViewController, @"notify_mentions_only"); - - return cell; - } customRowHeight:UITableViewAutomaticDimension actionBlock:nil]]; } // Search @@ -564,6 +515,56 @@ CGFloat kIconViewLength = 24; [weakSelf.navigationController pushViewController:vc animated:YES]; }]]; + if (self.isOpenGroup) { + // Notification Settings + [section addItem:[OWSTableItem itemWithCustomCellBlock:^{ + UITableViewCell *cell = [OWSTableItem newCell]; + OWSConversationSettingsViewController *strongSelf = weakSelf; + OWSCAssertDebug(strongSelf); + cell.preservesSuperviewLayoutMargins = YES; + cell.contentView.preservesSuperviewLayoutMargins = YES; + cell.selectionStyle = UITableViewCellSelectionStyleNone; + + UIImageView *iconView = [strongSelf viewForIconWithName:@"NotifyMentions"]; + + UILabel *rowLabel = [UILabel new]; + rowLabel.text = NSLocalizedString(@"vc_conversation_settings_notify_for_mentions_only_title", @""); + rowLabel.textColor = LKColors.text; + rowLabel.font = [UIFont systemFontOfSize:LKValues.mediumFontSize]; + rowLabel.lineBreakMode = NSLineBreakByTruncatingTail; + + UISwitch *switchView = [UISwitch new]; + switchView.on = ((TSGroupThread *)strongSelf.thread).isOnlyNotifyingForMentions; + [switchView addTarget:strongSelf action:@selector(notifyForMentionsOnlySwitchValueDidChange:) + forControlEvents:UIControlEventValueChanged]; + + UIStackView *topRow = + [[UIStackView alloc] initWithArrangedSubviews:@[ iconView, rowLabel, switchView ]]; + topRow.spacing = strongSelf.iconSpacing; + topRow.alignment = UIStackViewAlignmentCenter; + [cell.contentView addSubview:topRow]; + [topRow autoPinEdgesToSuperviewMarginsExcludingEdge:ALEdgeBottom]; + + UILabel *subtitleLabel = [UILabel new]; + subtitleLabel.text = NSLocalizedString(@"When enabled, only messages mentioned you will be notified.", @""); + subtitleLabel.textColor = LKColors.text; + subtitleLabel.font = [UIFont systemFontOfSize:LKValues.smallFontSize]; + subtitleLabel.numberOfLines = 0; + subtitleLabel.lineBreakMode = NSLineBreakByWordWrapping; + [cell.contentView addSubview:subtitleLabel]; + [subtitleLabel autoPinEdge:ALEdgeTop toEdge:ALEdgeBottom ofView:topRow withOffset:8]; + [subtitleLabel autoPinEdge:ALEdgeLeading toEdge:ALEdgeLeading ofView:rowLabel]; + [subtitleLabel autoPinTrailingToSuperviewMargin]; + [subtitleLabel autoPinBottomToSuperviewMargin]; + + cell.userInteractionEnabled = !strongSelf.hasLeftGroup; + + cell.accessibilityIdentifier = ACCESSIBILITY_IDENTIFIER_WITH_NAME(OWSConversationSettingsViewController, @"notify_for_mentions_only"); + + return cell; + } customRowHeight:UITableViewAutomaticDimension actionBlock:nil]]; + } + // Mute thread [section addItem:[OWSTableItem itemWithCustomCellBlock:^{ OWSConversationSettingsViewController *strongSelf = weakSelf; @@ -996,18 +997,13 @@ CGFloat kIconViewLength = 24; [self.conversationSettingsViewDelegate conversationSettingsDidRequestConversationSearch:self]; } -- (void)notifyMentionsSwitchValueDidChange:(id)sender +- (void)notifyForMentionsOnlySwitchValueDidChange:(id)sender { UISwitch *uiSwitch = (UISwitch *)sender; - if (uiSwitch.isOn) { - [LKStorage writeWithBlock:^(YapDatabaseReadWriteTransaction *transaction) { - [(TSGroupThread *)self.thread setIsOnlyNotifyMentions:true withTransaction:transaction]; - }]; - } else { - [LKStorage writeWithBlock:^(YapDatabaseReadWriteTransaction *transaction) { - [(TSGroupThread *)self.thread setIsOnlyNotifyMentions:false withTransaction:transaction]; - }]; - } + BOOL isEnabled = uiSwitch.isOn; + [LKStorage writeWithBlock:^(YapDatabaseReadWriteTransaction *transaction) { + [(TSGroupThread *)self.thread setisOnlyNotifyingForMentions:isEnabled withTransaction:transaction]; + }]; } - (void)hideEditNameUI diff --git a/Session/Conversations/Views & Modals/ConversationTitleView.swift b/Session/Conversations/Views & Modals/ConversationTitleView.swift index da4680d5b..d80912b29 100644 --- a/Session/Conversations/Views & Modals/ConversationTitleView.swift +++ b/Session/Conversations/Views & Modals/ConversationTitleView.swift @@ -92,13 +92,14 @@ final class ConversationTitleView : UIView { result.append(NSAttributedString(string: "Muted")) return result } else if let thread = self.thread as? TSGroupThread { - if thread.isOnlyNotifyMentions { + if thread.isOnlyNotifyingForMentions { let imageAttachment = NSTextAttachment() - imageAttachment.image = UIImage(named: "NotifyMentions.png")?.asTintedImage(color: Colors.text) + let color: UIColor = isDarkMode ? .white : .black + imageAttachment.image = UIImage(named: "NotifyMentions.png")?.asTintedImage(color: color) imageAttachment.bounds = CGRect(x: 0, y: -2, width: Values.smallFontSize, height: Values.smallFontSize) - let imageString = NSAttributedString(attachment: imageAttachment) - result.append(imageString) - result.append(NSAttributedString(string: " Only Notify Mentions")) + let imageAsString = NSAttributedString(attachment: imageAttachment) + result.append(imageAsString) + result.append(NSAttributedString(string: " " + NSLocalizedString("view_conversation_title_notify_for_mentions_only", comment: ""))) return result } else { var userCount: UInt64? diff --git a/Session/Meta/Translations/de.lproj/Localizable.strings b/Session/Meta/Translations/de.lproj/Localizable.strings index edbde38f7..6c0dca3f4 100644 --- a/Session/Meta/Translations/de.lproj/Localizable.strings +++ b/Session/Meta/Translations/de.lproj/Localizable.strings @@ -546,3 +546,6 @@ "modal_send_seed_title" = "Warning"; "modal_send_seed_explanation" = "This is your recovery phrase. If you send it to someone they'll have full access to your account."; "modal_send_seed_send_button_title" = "Send"; +"vc_conversation_settings_notify_for_mentions_only_title" = "Notify for Mentions Only"; +"vc_conversation_settings_notify_for_mentions_only_explanation" = "When enabled, you'll only be notified for messages mentioning you."; +"view_conversation_title_notify_for_mentions_only" = "Notifying for Mentions Only"; diff --git a/Session/Meta/Translations/en.lproj/Localizable.strings b/Session/Meta/Translations/en.lproj/Localizable.strings index 7d9603cd7..5ae81cb62 100644 --- a/Session/Meta/Translations/en.lproj/Localizable.strings +++ b/Session/Meta/Translations/en.lproj/Localizable.strings @@ -136,8 +136,6 @@ "CONVERSATION_SETTINGS_MUTED_UNTIL_FORMAT" = "until %@"; /* Table cell label in conversation settings which returns the user to the conversation with 'search mode' activated */ "CONVERSATION_SETTINGS_SEARCH" = "Search Conversation"; -/* Table cell label in conversation settings which returns the user to the conversation with 'notification settings' activated */ -"CONVERSATION_SETTINGS_NOTIFICATION" = "Notify Mentions Only"; /* Label for button to unmute a thread. */ "CONVERSATION_SETTINGS_UNMUTE_ACTION" = "Unmute"; /* Title for the 'crop/scale image' dialog. */ @@ -548,3 +546,6 @@ "modal_send_seed_title" = "Warning"; "modal_send_seed_explanation" = "This is your recovery phrase. If you send it to someone they'll have full access to your account."; "modal_send_seed_send_button_title" = "Send"; +"vc_conversation_settings_notify_for_mentions_only_title" = "Notify for Mentions Only"; +"vc_conversation_settings_notify_for_mentions_only_explanation" = "When enabled, you'll only be notified for messages mentioning you."; +"view_conversation_title_notify_for_mentions_only" = "Notifying for Mentions Only"; diff --git a/Session/Meta/Translations/es.lproj/Localizable.strings b/Session/Meta/Translations/es.lproj/Localizable.strings index 2c758a958..3c05898e9 100644 --- a/Session/Meta/Translations/es.lproj/Localizable.strings +++ b/Session/Meta/Translations/es.lproj/Localizable.strings @@ -546,3 +546,6 @@ "modal_send_seed_title" = "Warning"; "modal_send_seed_explanation" = "This is your recovery phrase. If you send it to someone they'll have full access to your account."; "modal_send_seed_send_button_title" = "Send"; +"vc_conversation_settings_notify_for_mentions_only_title" = "Notify for Mentions Only"; +"vc_conversation_settings_notify_for_mentions_only_explanation" = "When enabled, you'll only be notified for messages mentioning you."; +"view_conversation_title_notify_for_mentions_only" = "Notifying for Mentions Only"; diff --git a/Session/Meta/Translations/fa.lproj/Localizable.strings b/Session/Meta/Translations/fa.lproj/Localizable.strings index 8c7f27588..2f210126b 100644 --- a/Session/Meta/Translations/fa.lproj/Localizable.strings +++ b/Session/Meta/Translations/fa.lproj/Localizable.strings @@ -546,3 +546,6 @@ "modal_send_seed_title" = "Warning"; "modal_send_seed_explanation" = "This is your recovery phrase. If you send it to someone they'll have full access to your account."; "modal_send_seed_send_button_title" = "Send"; +"vc_conversation_settings_notify_for_mentions_only_title" = "Notify for Mentions Only"; +"vc_conversation_settings_notify_for_mentions_only_explanation" = "When enabled, you'll only be notified for messages mentioning you."; +"view_conversation_title_notify_for_mentions_only" = "Notifying for Mentions Only"; diff --git a/Session/Meta/Translations/fi.lproj/Localizable.strings b/Session/Meta/Translations/fi.lproj/Localizable.strings index 058f05a0d..ba0488b5c 100644 --- a/Session/Meta/Translations/fi.lproj/Localizable.strings +++ b/Session/Meta/Translations/fi.lproj/Localizable.strings @@ -546,3 +546,6 @@ "modal_send_seed_title" = "Warning"; "modal_send_seed_explanation" = "This is your recovery phrase. If you send it to someone they'll have full access to your account."; "modal_send_seed_send_button_title" = "Send"; +"vc_conversation_settings_notify_for_mentions_only_title" = "Notify for Mentions Only"; +"vc_conversation_settings_notify_for_mentions_only_explanation" = "When enabled, you'll only be notified for messages mentioning you."; +"view_conversation_title_notify_for_mentions_only" = "Notifying for Mentions Only"; diff --git a/Session/Meta/Translations/fr.lproj/Localizable.strings b/Session/Meta/Translations/fr.lproj/Localizable.strings index 116e66da9..3f3615722 100644 --- a/Session/Meta/Translations/fr.lproj/Localizable.strings +++ b/Session/Meta/Translations/fr.lproj/Localizable.strings @@ -546,3 +546,6 @@ "modal_send_seed_title" = "Warning"; "modal_send_seed_explanation" = "This is your recovery phrase. If you send it to someone they'll have full access to your account."; "modal_send_seed_send_button_title" = "Send"; +"vc_conversation_settings_notify_for_mentions_only_title" = "Notify for Mentions Only"; +"vc_conversation_settings_notify_for_mentions_only_explanation" = "When enabled, you'll only be notified for messages mentioning you."; +"view_conversation_title_notify_for_mentions_only" = "Notifying for Mentions Only"; diff --git a/Session/Meta/Translations/hi.lproj/Localizable.strings b/Session/Meta/Translations/hi.lproj/Localizable.strings index 62c69c9ab..4ac63066d 100644 --- a/Session/Meta/Translations/hi.lproj/Localizable.strings +++ b/Session/Meta/Translations/hi.lproj/Localizable.strings @@ -546,3 +546,6 @@ "modal_send_seed_title" = "Warning"; "modal_send_seed_explanation" = "This is your recovery phrase. If you send it to someone they'll have full access to your account."; "modal_send_seed_send_button_title" = "Send"; +"vc_conversation_settings_notify_for_mentions_only_title" = "Notify for Mentions Only"; +"vc_conversation_settings_notify_for_mentions_only_explanation" = "When enabled, you'll only be notified for messages mentioning you."; +"view_conversation_title_notify_for_mentions_only" = "Notifying for Mentions Only"; diff --git a/Session/Meta/Translations/hr.lproj/Localizable.strings b/Session/Meta/Translations/hr.lproj/Localizable.strings index a4f1ecec0..06175d3bd 100644 --- a/Session/Meta/Translations/hr.lproj/Localizable.strings +++ b/Session/Meta/Translations/hr.lproj/Localizable.strings @@ -546,3 +546,6 @@ "modal_send_seed_title" = "Warning"; "modal_send_seed_explanation" = "This is your recovery phrase. If you send it to someone they'll have full access to your account."; "modal_send_seed_send_button_title" = "Send"; +"vc_conversation_settings_notify_for_mentions_only_title" = "Notify for Mentions Only"; +"vc_conversation_settings_notify_for_mentions_only_explanation" = "When enabled, you'll only be notified for messages mentioning you."; +"view_conversation_title_notify_for_mentions_only" = "Notifying for Mentions Only"; diff --git a/Session/Meta/Translations/id-ID.lproj/Localizable.strings b/Session/Meta/Translations/id-ID.lproj/Localizable.strings index 4ea14eeb4..53f074e91 100644 --- a/Session/Meta/Translations/id-ID.lproj/Localizable.strings +++ b/Session/Meta/Translations/id-ID.lproj/Localizable.strings @@ -546,3 +546,6 @@ "modal_send_seed_title" = "Warning"; "modal_send_seed_explanation" = "This is your recovery phrase. If you send it to someone they'll have full access to your account."; "modal_send_seed_send_button_title" = "Send"; +"vc_conversation_settings_notify_for_mentions_only_title" = "Notify for Mentions Only"; +"vc_conversation_settings_notify_for_mentions_only_explanation" = "When enabled, you'll only be notified for messages mentioning you."; +"view_conversation_title_notify_for_mentions_only" = "Notifying for Mentions Only"; diff --git a/Session/Meta/Translations/it.lproj/Localizable.strings b/Session/Meta/Translations/it.lproj/Localizable.strings index d13c5ddb5..ba556afb2 100644 --- a/Session/Meta/Translations/it.lproj/Localizable.strings +++ b/Session/Meta/Translations/it.lproj/Localizable.strings @@ -546,3 +546,6 @@ "modal_send_seed_title" = "Warning"; "modal_send_seed_explanation" = "This is your recovery phrase. If you send it to someone they'll have full access to your account."; "modal_send_seed_send_button_title" = "Send"; +"vc_conversation_settings_notify_for_mentions_only_title" = "Notify for Mentions Only"; +"vc_conversation_settings_notify_for_mentions_only_explanation" = "When enabled, you'll only be notified for messages mentioning you."; +"view_conversation_title_notify_for_mentions_only" = "Notifying for Mentions Only"; diff --git a/Session/Meta/Translations/ja.lproj/Localizable.strings b/Session/Meta/Translations/ja.lproj/Localizable.strings index faf24bdc6..c7a4ddb46 100644 --- a/Session/Meta/Translations/ja.lproj/Localizable.strings +++ b/Session/Meta/Translations/ja.lproj/Localizable.strings @@ -546,3 +546,6 @@ "modal_send_seed_title" = "Warning"; "modal_send_seed_explanation" = "This is your recovery phrase. If you send it to someone they'll have full access to your account."; "modal_send_seed_send_button_title" = "Send"; +"vc_conversation_settings_notify_for_mentions_only_title" = "Notify for Mentions Only"; +"vc_conversation_settings_notify_for_mentions_only_explanation" = "When enabled, you'll only be notified for messages mentioning you."; +"view_conversation_title_notify_for_mentions_only" = "Notifying for Mentions Only"; diff --git a/Session/Meta/Translations/nl.lproj/Localizable.strings b/Session/Meta/Translations/nl.lproj/Localizable.strings index 8967ddfc9..f097fb431 100644 --- a/Session/Meta/Translations/nl.lproj/Localizable.strings +++ b/Session/Meta/Translations/nl.lproj/Localizable.strings @@ -546,3 +546,6 @@ "modal_send_seed_title" = "Warning"; "modal_send_seed_explanation" = "This is your recovery phrase. If you send it to someone they'll have full access to your account."; "modal_send_seed_send_button_title" = "Send"; +"vc_conversation_settings_notify_for_mentions_only_title" = "Notify for Mentions Only"; +"vc_conversation_settings_notify_for_mentions_only_explanation" = "When enabled, you'll only be notified for messages mentioning you."; +"view_conversation_title_notify_for_mentions_only" = "Notifying for Mentions Only"; diff --git a/Session/Meta/Translations/pl.lproj/Localizable.strings b/Session/Meta/Translations/pl.lproj/Localizable.strings index 59a6706ae..ebb5aa434 100644 --- a/Session/Meta/Translations/pl.lproj/Localizable.strings +++ b/Session/Meta/Translations/pl.lproj/Localizable.strings @@ -546,3 +546,6 @@ "modal_send_seed_title" = "Warning"; "modal_send_seed_explanation" = "This is your recovery phrase. If you send it to someone they'll have full access to your account."; "modal_send_seed_send_button_title" = "Send"; +"vc_conversation_settings_notify_for_mentions_only_title" = "Notify for Mentions Only"; +"vc_conversation_settings_notify_for_mentions_only_explanation" = "When enabled, you'll only be notified for messages mentioning you."; +"view_conversation_title_notify_for_mentions_only" = "Notifying for Mentions Only"; diff --git a/Session/Meta/Translations/pt_BR.lproj/Localizable.strings b/Session/Meta/Translations/pt_BR.lproj/Localizable.strings index 2555e945c..c5572ccc4 100644 --- a/Session/Meta/Translations/pt_BR.lproj/Localizable.strings +++ b/Session/Meta/Translations/pt_BR.lproj/Localizable.strings @@ -546,3 +546,6 @@ "modal_send_seed_title" = "Warning"; "modal_send_seed_explanation" = "This is your recovery phrase. If you send it to someone they'll have full access to your account."; "modal_send_seed_send_button_title" = "Send"; +"vc_conversation_settings_notify_for_mentions_only_title" = "Notify for Mentions Only"; +"vc_conversation_settings_notify_for_mentions_only_explanation" = "When enabled, you'll only be notified for messages mentioning you."; +"view_conversation_title_notify_for_mentions_only" = "Notifying for Mentions Only"; diff --git a/Session/Meta/Translations/ru.lproj/Localizable.strings b/Session/Meta/Translations/ru.lproj/Localizable.strings index 89119cb53..129b0b3d1 100644 --- a/Session/Meta/Translations/ru.lproj/Localizable.strings +++ b/Session/Meta/Translations/ru.lproj/Localizable.strings @@ -546,3 +546,6 @@ "modal_send_seed_title" = "Warning"; "modal_send_seed_explanation" = "This is your recovery phrase. If you send it to someone they'll have full access to your account."; "modal_send_seed_send_button_title" = "Send"; +"vc_conversation_settings_notify_for_mentions_only_title" = "Notify for Mentions Only"; +"vc_conversation_settings_notify_for_mentions_only_explanation" = "When enabled, you'll only be notified for messages mentioning you."; +"view_conversation_title_notify_for_mentions_only" = "Notifying for Mentions Only"; diff --git a/Session/Meta/Translations/sk.lproj/Localizable.strings b/Session/Meta/Translations/sk.lproj/Localizable.strings index 2ade1f164..495b874d0 100644 --- a/Session/Meta/Translations/sk.lproj/Localizable.strings +++ b/Session/Meta/Translations/sk.lproj/Localizable.strings @@ -546,3 +546,6 @@ "modal_send_seed_title" = "Warning"; "modal_send_seed_explanation" = "This is your recovery phrase. If you send it to someone they'll have full access to your account."; "modal_send_seed_send_button_title" = "Send"; +"vc_conversation_settings_notify_for_mentions_only_title" = "Notify for Mentions Only"; +"vc_conversation_settings_notify_for_mentions_only_explanation" = "When enabled, you'll only be notified for messages mentioning you."; +"view_conversation_title_notify_for_mentions_only" = "Notifying for Mentions Only"; diff --git a/Session/Meta/Translations/sv.lproj/Localizable.strings b/Session/Meta/Translations/sv.lproj/Localizable.strings index 81332a545..e6b1b4d59 100644 --- a/Session/Meta/Translations/sv.lproj/Localizable.strings +++ b/Session/Meta/Translations/sv.lproj/Localizable.strings @@ -546,3 +546,6 @@ "modal_send_seed_title" = "Warning"; "modal_send_seed_explanation" = "This is your recovery phrase. If you send it to someone they'll have full access to your account."; "modal_send_seed_send_button_title" = "Send"; +"vc_conversation_settings_notify_for_mentions_only_title" = "Notify for Mentions Only"; +"vc_conversation_settings_notify_for_mentions_only_explanation" = "When enabled, you'll only be notified for messages mentioning you."; +"view_conversation_title_notify_for_mentions_only" = "Notifying for Mentions Only"; diff --git a/Session/Meta/Translations/th.lproj/Localizable.strings b/Session/Meta/Translations/th.lproj/Localizable.strings index a92caaefa..5a99c82e0 100644 --- a/Session/Meta/Translations/th.lproj/Localizable.strings +++ b/Session/Meta/Translations/th.lproj/Localizable.strings @@ -546,3 +546,6 @@ "modal_send_seed_title" = "Warning"; "modal_send_seed_explanation" = "This is your recovery phrase. If you send it to someone they'll have full access to your account."; "modal_send_seed_send_button_title" = "Send"; +"vc_conversation_settings_notify_for_mentions_only_title" = "Notify for Mentions Only"; +"vc_conversation_settings_notify_for_mentions_only_explanation" = "When enabled, you'll only be notified for messages mentioning you."; +"view_conversation_title_notify_for_mentions_only" = "Notifying for Mentions Only"; diff --git a/Session/Meta/Translations/vi-VN.lproj/Localizable.strings b/Session/Meta/Translations/vi-VN.lproj/Localizable.strings index 9742ba586..0faba1ebe 100644 --- a/Session/Meta/Translations/vi-VN.lproj/Localizable.strings +++ b/Session/Meta/Translations/vi-VN.lproj/Localizable.strings @@ -546,3 +546,6 @@ "modal_send_seed_title" = "Warning"; "modal_send_seed_explanation" = "This is your recovery phrase. If you send it to someone they'll have full access to your account."; "modal_send_seed_send_button_title" = "Send"; +"vc_conversation_settings_notify_for_mentions_only_title" = "Notify for Mentions Only"; +"vc_conversation_settings_notify_for_mentions_only_explanation" = "When enabled, you'll only be notified for messages mentioning you."; +"view_conversation_title_notify_for_mentions_only" = "Notifying for Mentions Only"; diff --git a/Session/Meta/Translations/zh-Hant.lproj/Localizable.strings b/Session/Meta/Translations/zh-Hant.lproj/Localizable.strings index 0166c55c2..03fa38484 100644 --- a/Session/Meta/Translations/zh-Hant.lproj/Localizable.strings +++ b/Session/Meta/Translations/zh-Hant.lproj/Localizable.strings @@ -546,3 +546,6 @@ "modal_send_seed_title" = "Warning"; "modal_send_seed_explanation" = "This is your recovery phrase. If you send it to someone they'll have full access to your account."; "modal_send_seed_send_button_title" = "Send"; +"vc_conversation_settings_notify_for_mentions_only_title" = "Notify for Mentions Only"; +"vc_conversation_settings_notify_for_mentions_only_explanation" = "When enabled, you'll only be notified for messages mentioning you."; +"view_conversation_title_notify_for_mentions_only" = "Notifying for Mentions Only"; diff --git a/Session/Meta/Translations/zh_CN.lproj/Localizable.strings b/Session/Meta/Translations/zh_CN.lproj/Localizable.strings index 127219d84..764187588 100644 --- a/Session/Meta/Translations/zh_CN.lproj/Localizable.strings +++ b/Session/Meta/Translations/zh_CN.lproj/Localizable.strings @@ -546,3 +546,6 @@ "modal_send_seed_title" = "Warning"; "modal_send_seed_explanation" = "This is your recovery phrase. If you send it to someone they'll have full access to your account."; "modal_send_seed_send_button_title" = "Send"; +"vc_conversation_settings_notify_for_mentions_only_title" = "Notify for Mentions Only"; +"vc_conversation_settings_notify_for_mentions_only_explanation" = "When enabled, you'll only be notified for messages mentioning you."; +"view_conversation_title_notify_for_mentions_only" = "Notifying for Mentions Only"; diff --git a/Session/Notifications/AppNotifications.swift b/Session/Notifications/AppNotifications.swift index 42280c493..594430aeb 100644 --- a/Session/Notifications/AppNotifications.swift +++ b/Session/Notifications/AppNotifications.swift @@ -166,10 +166,10 @@ public class NotificationPresenter: NSObject, NotificationsProtocol { // for more details. let messageText = DisplayableText.filterNotificationText(rawMessageText) - // Do not fire the notification wihtout mentioning current user, - // if current user sets isOnlyNotifyMentions on. + // Don't fire the notification if the current user isn't mentioned + // and isOnlyNotifyingForMentions is on. let isUserMentioned = MentionUtilities.isUserMentioned(in: messageText ?? "") - if let groupThread = thread as? TSGroupThread, groupThread.isOnlyNotifyMentions && !isUserMentioned { + if let groupThread = thread as? TSGroupThread, groupThread.isOnlyNotifyingForMentions && !isUserMentioned { return } diff --git a/Session/Shared/ConversationCell.swift b/Session/Shared/ConversationCell.swift index e2e0f58d2..46074851b 100644 --- a/Session/Shared/ConversationCell.swift +++ b/Session/Shared/ConversationCell.swift @@ -230,7 +230,7 @@ final class ConversationCell : UITableViewCell { let result = NSMutableAttributedString() if threadViewModel.isMuted { result.append(NSAttributedString(string: "\u{e067} ", attributes: [ .font : UIFont.ows_elegantIconsFont(10), .foregroundColor : Colors.unimportant ])) - } else if threadViewModel.isOnlyNotifyMentions { + } else if threadViewModel.isOnlyNotifyingForMentions { let imageAttachment = NSTextAttachment() imageAttachment.image = UIImage(named: "NotifyMentions.png")?.asTintedImage(color: Colors.unimportant) imageAttachment.bounds = CGRect(x: 0, y: -2, width: Values.smallFontSize, height: Values.smallFontSize) diff --git a/SessionMessagingKit/Threads/TSGroupThread.h b/SessionMessagingKit/Threads/TSGroupThread.h index aa55f60f7..0599d0461 100644 --- a/SessionMessagingKit/Threads/TSGroupThread.h +++ b/SessionMessagingKit/Threads/TSGroupThread.h @@ -18,7 +18,7 @@ extern NSString *const TSGroupThread_NotificationKey_UniqueId; @property (nonatomic, strong) TSGroupModel *groupModel; @property (nonatomic, readonly) BOOL isOpenGroup; @property (nonatomic, readonly) BOOL isClosedGroup; -@property (nonatomic) BOOL isOnlyNotifyMentions; +@property (nonatomic) BOOL isOnlyNotifyingForMentions; + (instancetype)getOrCreateThreadWithGroupModel:(TSGroupModel *)groupModel; + (instancetype)getOrCreateThreadWithGroupModel:(TSGroupModel *)groupModel @@ -45,7 +45,7 @@ extern NSString *const TSGroupThread_NotificationKey_UniqueId; transaction:(YapDatabaseReadWriteTransaction *)transaction; - (void)setGroupModel:(TSGroupModel *)newGroupModel withTransaction:(YapDatabaseReadWriteTransaction *)transaction; -- (void)setIsOnlyNotifyMentions:(BOOL)isOnlyNotifyMentions withTransaction:(YapDatabaseReadWriteTransaction *)transaction; +- (void)setisOnlyNotifyingForMentions:(BOOL)isOnlyNotifyingForMentions withTransaction:(YapDatabaseReadWriteTransaction *)transaction; - (void)leaveGroupWithSneakyTransaction; - (void)leaveGroupWithTransaction:(YapDatabaseReadWriteTransaction *)transaction; diff --git a/SessionMessagingKit/Threads/TSGroupThread.m b/SessionMessagingKit/Threads/TSGroupThread.m index e0a94401b..f05d42732 100644 --- a/SessionMessagingKit/Threads/TSGroupThread.m +++ b/SessionMessagingKit/Threads/TSGroupThread.m @@ -208,9 +208,9 @@ NSString *const TSGroupThread_NotificationKey_UniqueId = @"TSGroupThread_Notific }]; } -- (void)setIsOnlyNotifyMentions:(BOOL)isOnlyNotifyMentions withTransaction:(YapDatabaseReadWriteTransaction *)transaction +- (void)setisOnlyNotifyingForMentions:(BOOL)isOnlyNotifyingForMentions withTransaction:(YapDatabaseReadWriteTransaction *)transaction { - self.isOnlyNotifyMentions = isOnlyNotifyMentions; + self.isOnlyNotifyingForMentions = isOnlyNotifyingForMentions; [self saveWithTransaction:transaction]; diff --git a/SessionSnodeKit/SnodeAPI.swift b/SessionSnodeKit/SnodeAPI.swift index afef979ee..fe15bccf5 100644 --- a/SessionSnodeKit/SnodeAPI.swift +++ b/SessionSnodeKit/SnodeAPI.swift @@ -413,6 +413,11 @@ public final class SnodeAPI : NSObject { private static func getMessagesInternal(from snode: Snode, associatedWith publicKey: String) -> RawResponsePromise { let storage = SNSnodeKitConfiguration.shared.storage + + // NOTE: All authentication logic is currently commented out, the reason being that we can't currently support + // it yet for closed groups. The Storage Server requires an ed25519 key pair, but we don't have that for our + // closed groups. + // guard let userED25519KeyPair = storage.getUserED25519KeyPair() else { return Promise(error: Error.noKeyPair) } // Get last message hash storage.pruneLastMessageHashInfoIfExpired(for: snode, associatedWith: publicKey) diff --git a/SignalUtilitiesKit/Messaging/ThreadViewModel.swift b/SignalUtilitiesKit/Messaging/ThreadViewModel.swift index 6b1f0ef60..30177ec11 100644 --- a/SignalUtilitiesKit/Messaging/ThreadViewModel.swift +++ b/SignalUtilitiesKit/Messaging/ThreadViewModel.swift @@ -14,7 +14,7 @@ public class ThreadViewModel: NSObject { @objc public let contactSessionID: String? @objc public let name: String @objc public let isMuted: Bool - @objc public let isOnlyNotifyMentions: Bool + @objc public let isOnlyNotifyingForMentions: Bool var isContactThread: Bool { return !isGroupThread @@ -42,9 +42,9 @@ public class ThreadViewModel: NSObject { } if let groupThread = thread as? TSGroupThread { - self.isOnlyNotifyMentions = groupThread.isOnlyNotifyMentions + self.isOnlyNotifyingForMentions = groupThread.isOnlyNotifyingForMentions } else { - self.isOnlyNotifyMentions = false + self.isOnlyNotifyingForMentions = false } self.unreadCount = thread.unreadMessageCount(transaction: transaction)