mirror of
https://github.com/oxen-io/session-ios.git
synced 2023-12-13 21:30:14 +01:00
Add feature flag for 'note to self'.
This commit is contained in:
parent
7f1c6a84c9
commit
7878c0fac8
5 changed files with 23 additions and 12 deletions
|
@ -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.")
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -6,6 +6,8 @@
|
|||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
BOOL IsNoteToSelfEnabled(void);
|
||||
|
||||
@class OWSDisappearingMessagesConfiguration;
|
||||
@class TSInteraction;
|
||||
@class TSInvalidIdentityKeyReceivingErrorMessage;
|
||||
|
|
|
@ -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]);
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue