Merge branch 'charlesmchen/noteToSelfFeatureFlag' into release/2.34.0

pull/1/head
Matthew Chen 6 years ago
commit 710b80e566

@ -1,5 +1,5 @@
// //
// Copyright (c) 2018 Open Whisper Systems. All rights reserved. // Copyright (c) 2019 Open Whisper Systems. All rights reserved.
// //
#import "ContactCellView.h" #import "ContactCellView.h"
@ -140,7 +140,7 @@ const CGFloat kContactCellAvatarTextMargin = 12;
self.thread = [TSContactThread getThreadWithContactId:recipientId transaction:transaction]; self.thread = [TSContactThread getThreadWithContactId:recipientId transaction:transaction];
}]; }];
BOOL isNoteToSelf = [recipientId isEqualToString:self.tsAccountManager.localNumber]; BOOL isNoteToSelf = (IsNoteToSelfEnabled() && [recipientId isEqualToString:self.tsAccountManager.localNumber]);
if (isNoteToSelf) { if (isNoteToSelf) {
self.nameLabel.attributedText = [[NSAttributedString alloc] self.nameLabel.attributedText = [[NSAttributedString alloc]
initWithString:NSLocalizedString(@"NOTE_TO_SELF", @"Label for 1:1 conversation with yourself.") initWithString:NSLocalizedString(@"NOTE_TO_SELF", @"Label for 1:1 conversation with yourself.")

@ -241,11 +241,11 @@ public class ConversationSearcher: NSObject {
private func conversationIndexingString(recipientId: String) -> String { private func conversationIndexingString(recipientId: String) -> String {
var result = self.indexingString(recipientId: recipientId) var result = self.indexingString(recipientId: recipientId)
if let localNumber = tsAccountManager.localNumber() { if IsNoteToSelfEnabled(),
if localNumber == recipientId { let localNumber = tsAccountManager.localNumber(),
let noteToSelfLabel = NSLocalizedString("NOTE_TO_SELF", comment: "Label for 1:1 conversation with yourself.") localNumber == recipientId {
result += " \(noteToSelfLabel)" let noteToSelfLabel = NSLocalizedString("NOTE_TO_SELF", comment: "Label for 1:1 conversation with yourself.")
} result += " \(noteToSelfLabel)"
} }
return result return result

@ -6,6 +6,8 @@
NS_ASSUME_NONNULL_BEGIN NS_ASSUME_NONNULL_BEGIN
BOOL IsNoteToSelfEnabled(void);
@class OWSDisappearingMessagesConfiguration; @class OWSDisappearingMessagesConfiguration;
@class TSInteraction; @class TSInteraction;
@class TSInvalidIdentityKeyReceivingErrorMessage; @class TSInvalidIdentityKeyReceivingErrorMessage;

@ -22,6 +22,11 @@
NS_ASSUME_NONNULL_BEGIN NS_ASSUME_NONNULL_BEGIN
BOOL IsNoteToSelfEnabled(void)
{
return NO;
}
ConversationColorName const ConversationColorNameCrimson = @"red"; ConversationColorName const ConversationColorNameCrimson = @"red";
ConversationColorName const ConversationColorNameVermilion = @"orange"; ConversationColorName const ConversationColorNameVermilion = @"orange";
ConversationColorName const ConversationColorNameBurlap = @"brown"; ConversationColorName const ConversationColorNameBurlap = @"brown";
@ -194,6 +199,9 @@ ConversationColorName const kConversationColorName_Default = ConversationColorNa
- (BOOL)isNoteToSelf - (BOOL)isNoteToSelf
{ {
if (!IsNoteToSelfEnabled()) {
return NO;
}
return (!self.isGroupThread && self.contactIdentifier != nil && return (!self.isGroupThread && self.contactIdentifier != nil &&
[self.contactIdentifier isEqualToString:self.tsAccountManager.localNumber]); [self.contactIdentifier isEqualToString:self.tsAccountManager.localNumber]);
} }

@ -171,11 +171,12 @@ public class FullTextSearchFinder: NSObject {
let recipientId = contactThread.contactIdentifier() let recipientId = contactThread.contactIdentifier()
var result = recipientIndexer.index(recipientId, transaction: transaction) var result = recipientIndexer.index(recipientId, transaction: transaction)
if let localNumber = tsAccountManager.storedOrCachedLocalNumber(transaction) { if IsNoteToSelfEnabled(),
if localNumber == recipientId { let localNumber = tsAccountManager.storedOrCachedLocalNumber(transaction),
let noteToSelfLabel = NSLocalizedString("NOTE_TO_SELF", comment: "Label for 1:1 conversation with yourself.") localNumber == recipientId {
result += " \(noteToSelfLabel)"
} let noteToSelfLabel = NSLocalizedString("NOTE_TO_SELF", comment: "Label for 1:1 conversation with yourself.")
result += " \(noteToSelfLabel)"
} }
return result return result

Loading…
Cancel
Save