Merge branch 'charlesmchen/noteToSelfFeatureFlag' into release/2.34.0

This commit is contained in:
Matthew Chen 2019-01-22 10:48:01 -05:00
commit 710b80e566
5 changed files with 23 additions and 12 deletions

View file

@ -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"
@ -140,7 +140,7 @@ const CGFloat kContactCellAvatarTextMargin = 12;
self.thread = [TSContactThread getThreadWithContactId:recipientId transaction:transaction];
}];
BOOL isNoteToSelf = [recipientId isEqualToString:self.tsAccountManager.localNumber];
BOOL isNoteToSelf = (IsNoteToSelfEnabled() && [recipientId isEqualToString:self.tsAccountManager.localNumber]);
if (isNoteToSelf) {
self.nameLabel.attributedText = [[NSAttributedString alloc]
initWithString:NSLocalizedString(@"NOTE_TO_SELF", @"Label for 1:1 conversation with yourself.")

View file

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

View file

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

View file

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

View file

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