mirror of
https://github.com/oxen-io/session-ios.git
synced 2023-12-13 21:30:14 +01:00
Merge branch 'dev' into voice-calls
This commit is contained in:
commit
3b7ec33aa1
37 changed files with 227 additions and 26 deletions
|
@ -5279,7 +5279,7 @@
|
|||
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
COPY_PHASE_STRIP = NO;
|
||||
CURRENT_PROJECT_VERSION = 277;
|
||||
CURRENT_PROJECT_VERSION = 279;
|
||||
DEBUG_INFORMATION_FORMAT = dwarf;
|
||||
DEVELOPMENT_TEAM = SUQ8J2PCT7;
|
||||
FRAMEWORK_SEARCH_PATHS = "$(inherited)";
|
||||
|
@ -5348,7 +5348,7 @@
|
|||
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
COPY_PHASE_STRIP = NO;
|
||||
CURRENT_PROJECT_VERSION = 277;
|
||||
CURRENT_PROJECT_VERSION = 279;
|
||||
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
|
||||
DEVELOPMENT_TEAM = SUQ8J2PCT7;
|
||||
ENABLE_NS_ASSERTIONS = NO;
|
||||
|
@ -5409,7 +5409,7 @@
|
|||
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
COPY_PHASE_STRIP = NO;
|
||||
CURRENT_PROJECT_VERSION = 277;
|
||||
CURRENT_PROJECT_VERSION = 279;
|
||||
DEBUG_INFORMATION_FORMAT = dwarf;
|
||||
DEVELOPMENT_TEAM = SUQ8J2PCT7;
|
||||
FRAMEWORK_SEARCH_PATHS = "$(inherited)";
|
||||
|
@ -5479,7 +5479,7 @@
|
|||
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
COPY_PHASE_STRIP = NO;
|
||||
CURRENT_PROJECT_VERSION = 277;
|
||||
CURRENT_PROJECT_VERSION = 279;
|
||||
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
|
||||
DEVELOPMENT_TEAM = SUQ8J2PCT7;
|
||||
ENABLE_NS_ASSERTIONS = NO;
|
||||
|
@ -6364,7 +6364,7 @@
|
|||
CODE_SIGN_ENTITLEMENTS = Session/Meta/Signal.entitlements;
|
||||
CODE_SIGN_IDENTITY = "iPhone Developer";
|
||||
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
|
||||
CURRENT_PROJECT_VERSION = 277;
|
||||
CURRENT_PROJECT_VERSION = 279;
|
||||
DEVELOPMENT_TEAM = SUQ8J2PCT7;
|
||||
FRAMEWORK_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
|
@ -6433,7 +6433,7 @@
|
|||
CODE_SIGN_ENTITLEMENTS = Session/Meta/Signal.entitlements;
|
||||
CODE_SIGN_IDENTITY = "iPhone Developer";
|
||||
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
|
||||
CURRENT_PROJECT_VERSION = 277;
|
||||
CURRENT_PROJECT_VERSION = 279;
|
||||
DEVELOPMENT_TEAM = SUQ8J2PCT7;
|
||||
FRAMEWORK_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
|
|
|
@ -22,6 +22,7 @@ extension ConversationVC : InputViewDelegate, MessageCellDelegate, ContextMenuAc
|
|||
// so the result may be inaccurate before all the cells are loaded. Use this
|
||||
// to scroll to the last row instead.
|
||||
let indexPath = IndexPath(row: viewItems.count - 1, section: 0)
|
||||
unreadViewItems.removeAll()
|
||||
messagesTableView.scrollToRow(at: indexPath, at: .top, animated: true)
|
||||
}
|
||||
|
||||
|
|
|
@ -150,7 +150,7 @@ final class ConversationVC : BaseVC, ConversationViewModelDelegate, OWSConversat
|
|||
/// The button will be invisible until the user has scrolled at least this amount from the bottom of the table view.
|
||||
static let scrollButtonNoVisibilityThreshold: CGFloat = 20
|
||||
/// Automatically scroll to the bottom of the conversation when sending a message if the scroll distance from the bottom is less than this number.
|
||||
static let scrollToBottomMargin: CGFloat = 40
|
||||
static let scrollToBottomMargin: CGFloat = 60
|
||||
|
||||
// MARK: Lifecycle
|
||||
init(thread: TSThread, focusedMessageID: String? = nil) {
|
||||
|
|
|
@ -515,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(@"vc_conversation_settings_notify_for_mentions_only_explanation", @"");
|
||||
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;
|
||||
|
@ -947,6 +997,15 @@ CGFloat kIconViewLength = 24;
|
|||
[self.conversationSettingsViewDelegate conversationSettingsDidRequestConversationSearch:self];
|
||||
}
|
||||
|
||||
- (void)notifyForMentionsOnlySwitchValueDidChange:(id)sender
|
||||
{
|
||||
UISwitch *uiSwitch = (UISwitch *)sender;
|
||||
BOOL isEnabled = uiSwitch.isOn;
|
||||
[LKStorage writeWithBlock:^(YapDatabaseReadWriteTransaction *transaction) {
|
||||
[(TSGroupThread *)self.thread setisOnlyNotifyingForMentions:isEnabled withTransaction:transaction];
|
||||
}];
|
||||
}
|
||||
|
||||
- (void)hideEditNameUI
|
||||
{
|
||||
self.isEditingDisplayName = NO;
|
||||
|
|
|
@ -86,12 +86,22 @@ final class ConversationTitleView : UIView {
|
|||
}
|
||||
|
||||
private func getSubtitle() -> NSAttributedString? {
|
||||
if thread.isMuted {
|
||||
let result = NSMutableAttributedString()
|
||||
if thread.isMuted {
|
||||
result.append(NSAttributedString(string: "\u{e067} ", attributes: [ .font : UIFont.ows_elegantIconsFont(10), .foregroundColor : Colors.text ]))
|
||||
result.append(NSAttributedString(string: "Muted"))
|
||||
return result
|
||||
} else if let thread = self.thread as? TSGroupThread {
|
||||
if thread.isOnlyNotifyingForMentions {
|
||||
let imageAttachment = NSTextAttachment()
|
||||
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 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?
|
||||
switch thread.groupModel.groupType {
|
||||
case .closedGroup: userCount = UInt64(thread.groupModel.groupMemberIds.count)
|
||||
|
@ -104,6 +114,7 @@ final class ConversationTitleView : UIView {
|
|||
return NSAttributedString(string: "\(userCount) members")
|
||||
}
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
|
|
23
Session/Meta/Images.xcassets/Session/NotifyMentions.imageset/Contents.json
vendored
Normal file
23
Session/Meta/Images.xcassets/Session/NotifyMentions.imageset/Contents.json
vendored
Normal file
|
@ -0,0 +1,23 @@
|
|||
{
|
||||
"images" : [
|
||||
{
|
||||
"filename" : "ic_notification_mentions.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"filename" : "ic_notification_mentions-1.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"filename" : "ic_notification_mentions-2.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
BIN
Session/Meta/Images.xcassets/Session/NotifyMentions.imageset/ic_notification_mentions-1.png
vendored
Normal file
BIN
Session/Meta/Images.xcassets/Session/NotifyMentions.imageset/ic_notification_mentions-1.png
vendored
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.5 KiB |
BIN
Session/Meta/Images.xcassets/Session/NotifyMentions.imageset/ic_notification_mentions-2.png
vendored
Normal file
BIN
Session/Meta/Images.xcassets/Session/NotifyMentions.imageset/ic_notification_mentions-2.png
vendored
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.5 KiB |
BIN
Session/Meta/Images.xcassets/Session/NotifyMentions.imageset/ic_notification_mentions.png
vendored
Normal file
BIN
Session/Meta/Images.xcassets/Session/NotifyMentions.imageset/ic_notification_mentions.png
vendored
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.5 KiB |
|
@ -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";
|
||||
|
|
|
@ -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";
|
||||
|
|
|
@ -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";
|
||||
|
|
|
@ -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";
|
||||
|
|
|
@ -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";
|
||||
|
|
|
@ -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";
|
||||
|
|
|
@ -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";
|
||||
|
|
|
@ -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";
|
||||
|
|
|
@ -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";
|
||||
|
|
|
@ -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";
|
||||
|
|
|
@ -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";
|
||||
|
|
|
@ -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";
|
||||
|
|
|
@ -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";
|
||||
|
|
|
@ -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";
|
||||
|
|
|
@ -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";
|
||||
|
|
|
@ -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";
|
||||
|
|
|
@ -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";
|
||||
|
|
|
@ -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";
|
||||
|
|
|
@ -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";
|
||||
|
|
|
@ -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";
|
||||
|
|
|
@ -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";
|
||||
|
|
|
@ -166,6 +166,13 @@ public class NotificationPresenter: NSObject, NotificationsProtocol {
|
|||
// for more details.
|
||||
let messageText = DisplayableText.filterNotificationText(rawMessageText)
|
||||
|
||||
// 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.isOnlyNotifyingForMentions && !isUserMentioned {
|
||||
return
|
||||
}
|
||||
|
||||
let context = Contact.context(for: thread)
|
||||
let senderName = Storage.shared.getContact(with: incomingMessage.authorId)?.displayName(for: context) ?? incomingMessage.authorId
|
||||
|
||||
|
|
|
@ -230,6 +230,13 @@ 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.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)
|
||||
let imageString = NSAttributedString(attachment: imageAttachment)
|
||||
result.append(imageString)
|
||||
result.append(NSAttributedString(string: " ", attributes: [ .font : UIFont.ows_elegantIconsFont(10), .foregroundColor : Colors.unimportant ]))
|
||||
}
|
||||
if let rawSnippet = threadViewModel.lastMessageText {
|
||||
let snippet = MentionUtilities.highlightMentions(in: rawSnippet, threadID: threadViewModel.threadRecord.uniqueId!)
|
||||
|
|
|
@ -44,4 +44,9 @@ public final class MentionUtilities : NSObject {
|
|||
}
|
||||
return result
|
||||
}
|
||||
|
||||
public static func isUserMentioned(in string: String) -> Bool {
|
||||
let userPublicKey = getUserHexEncodedPublicKey()
|
||||
return string.contains("@\(userPublicKey)")
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,6 +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 isOnlyNotifyingForMentions;
|
||||
|
||||
+ (instancetype)getOrCreateThreadWithGroupModel:(TSGroupModel *)groupModel;
|
||||
+ (instancetype)getOrCreateThreadWithGroupModel:(TSGroupModel *)groupModel
|
||||
|
@ -44,6 +45,7 @@ extern NSString *const TSGroupThread_NotificationKey_UniqueId;
|
|||
transaction:(YapDatabaseReadWriteTransaction *)transaction;
|
||||
|
||||
- (void)setGroupModel:(TSGroupModel *)newGroupModel withTransaction:(YapDatabaseReadWriteTransaction *)transaction;
|
||||
- (void)setisOnlyNotifyingForMentions:(BOOL)isOnlyNotifyingForMentions withTransaction:(YapDatabaseReadWriteTransaction *)transaction;
|
||||
- (void)leaveGroupWithSneakyTransaction;
|
||||
- (void)leaveGroupWithTransaction:(YapDatabaseReadWriteTransaction *)transaction;
|
||||
|
||||
|
|
|
@ -208,6 +208,17 @@ NSString *const TSGroupThread_NotificationKey_UniqueId = @"TSGroupThread_Notific
|
|||
}];
|
||||
}
|
||||
|
||||
- (void)setisOnlyNotifyingForMentions:(BOOL)isOnlyNotifyingForMentions withTransaction:(YapDatabaseReadWriteTransaction *)transaction
|
||||
{
|
||||
self.isOnlyNotifyingForMentions = isOnlyNotifyingForMentions;
|
||||
|
||||
[self saveWithTransaction:transaction];
|
||||
|
||||
[transaction addCompletionQueue:dispatch_get_main_queue() completionBlock:^{
|
||||
[NSNotificationCenter.defaultCenter postNotificationName:NSNotification.groupThreadUpdated object:self.uniqueId];
|
||||
}];
|
||||
}
|
||||
|
||||
- (void)leaveGroupWithSneakyTransaction
|
||||
{
|
||||
[LKStorage writeSyncWithBlock:^(YapDatabaseReadWriteTransaction *_Nonnull transaction) {
|
||||
|
|
|
@ -413,22 +413,27 @@ public final class SnodeAPI : NSObject {
|
|||
|
||||
private static func getMessagesInternal(from snode: Snode, associatedWith publicKey: String) -> RawResponsePromise {
|
||||
let storage = SNSnodeKitConfiguration.shared.storage
|
||||
guard let userED25519KeyPair = storage.getUserED25519KeyPair() else { return Promise(error: Error.noKeyPair) }
|
||||
|
||||
// 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)
|
||||
let lastHash = storage.getLastMessageHash(for: snode, associatedWith: publicKey) ?? ""
|
||||
// Construct signature
|
||||
let timestamp = UInt64(Int64(NSDate.millisecondTimestamp()) + SnodeAPI.clockOffset)
|
||||
let ed25519PublicKey = userED25519KeyPair.publicKey.toHexString()
|
||||
let verificationData = ("retrieve" + String(timestamp)).data(using: String.Encoding.utf8)!
|
||||
let signature = sodium.sign.signature(message: Bytes(verificationData), secretKey: userED25519KeyPair.secretKey)!
|
||||
// let timestamp = UInt64(Int64(NSDate.millisecondTimestamp()) + SnodeAPI.clockOffset)
|
||||
// let ed25519PublicKey = userED25519KeyPair.publicKey.toHexString()
|
||||
// let verificationData = ("retrieve" + String(timestamp)).data(using: String.Encoding.utf8)!
|
||||
// let signature = sodium.sign.signature(message: Bytes(verificationData), secretKey: userED25519KeyPair.secretKey)!
|
||||
// Make the request
|
||||
let parameters: JSON = [
|
||||
"pubKey" : Features.useTestnet ? publicKey.removing05PrefixIfNeeded() : publicKey,
|
||||
"lastHash" : lastHash,
|
||||
"timestamp" : timestamp,
|
||||
"pubkey_ed25519" : ed25519PublicKey,
|
||||
"signature" : signature.toBase64()!
|
||||
// "timestamp" : timestamp,
|
||||
// "pubkey_ed25519" : ed25519PublicKey,
|
||||
// "signature" : signature.toBase64()!
|
||||
]
|
||||
return invoke(.getMessages, on: snode, associatedWith: publicKey, parameters: parameters)
|
||||
}
|
||||
|
|
|
@ -14,6 +14,7 @@ public class ThreadViewModel: NSObject {
|
|||
@objc public let contactSessionID: String?
|
||||
@objc public let name: String
|
||||
@objc public let isMuted: Bool
|
||||
@objc public let isOnlyNotifyingForMentions: Bool
|
||||
|
||||
var isContactThread: Bool {
|
||||
return !isGroupThread
|
||||
|
@ -40,6 +41,12 @@ public class ThreadViewModel: NSObject {
|
|||
self.contactSessionID = nil
|
||||
}
|
||||
|
||||
if let groupThread = thread as? TSGroupThread {
|
||||
self.isOnlyNotifyingForMentions = groupThread.isOnlyNotifyingForMentions
|
||||
} else {
|
||||
self.isOnlyNotifyingForMentions = false
|
||||
}
|
||||
|
||||
self.unreadCount = thread.unreadMessageCount(transaction: transaction)
|
||||
self.hasUnreadMessages = unreadCount > 0
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue