From c68090864630e8a368211a19aed238236a856c99 Mon Sep 17 00:00:00 2001 From: Michael Kirk Date: Wed, 10 Oct 2018 12:04:40 -0600 Subject: [PATCH 1/3] add toggle for unrestricted access --- .../PrivacySettingsTableViewController.m | 30 +++++++++++++++++++ Signal/translations/bin/auto-genstrings | 3 +- .../translations/en.lproj/Localizable.strings | 9 ++++++ 3 files changed, 41 insertions(+), 1 deletion(-) diff --git a/Signal/src/ViewControllers/AppSettings/PrivacySettingsTableViewController.m b/Signal/src/ViewControllers/AppSettings/PrivacySettingsTableViewController.m index 73dd715da..42c3dc42e 100644 --- a/Signal/src/ViewControllers/AppSettings/PrivacySettingsTableViewController.m +++ b/Signal/src/ViewControllers/AppSettings/PrivacySettingsTableViewController.m @@ -12,6 +12,7 @@ #import #import #import +#import NS_ASSUME_NONNULL_BEGIN @@ -48,6 +49,13 @@ NS_ASSUME_NONNULL_BEGIN [[NSNotificationCenter defaultCenter] removeObserver:self]; } +#pragma mark - Dependencies + +- (id)udManager +{ + return SSKEnvironment.shared.udManager; +} + #pragma mark - Table Contents - (void)updateTableContents @@ -193,6 +201,22 @@ NS_ASSUME_NONNULL_BEGIN }]]; [contents addSection:historyLogsSection]; + OWSTableSection *unidentifiedDeliverySection = [OWSTableSection new]; + unidentifiedDeliverySection.headerTitle + = NSLocalizedString(@"SETTINGS_UNIDENTIFIED_DELIVERY_SECTION_TITLE", @"table section label"); + + unidentifiedDeliverySection.footerTitle + = NSLocalizedString(@"SETTINGS_UNIDENTIFIED_DELIVERY_SECTION_FOOTER", @"table section footer"); + + OWSTableItem *unrestrictedAccessItem = [OWSTableItem + switchItemWithText:NSLocalizedString(@"SETTINGS_UNIDENTIFIED_DELIVERY_UNRESTRICTED_ACCESS", @"switch label") + isOn:weakSelf.udManager.shouldAllowUnrestrictedAccessLocal + target:weakSelf + selector:@selector(didToggleUDUnrestrictedAccessSwitch:)]; + [unidentifiedDeliverySection addItem:unrestrictedAccessItem]; + + [contents addSection:unidentifiedDeliverySection]; + self.contents = contents; } @@ -282,6 +306,12 @@ NS_ASSUME_NONNULL_BEGIN [SignalApp.sharedApp.callService createCallUIAdapter]; } +- (void)didToggleUDUnrestrictedAccessSwitch:(UISwitch *)sender +{ + OWSLogInfo(@"toggled to: %@", (sender.isOn ? @"ON" : @"OFF")); + [self.udManager setShouldAllowUnrestrictedAccessLocal:sender.isOn]; +} + - (void)show2FASettings { OWSLogInfo(@""); diff --git a/Signal/translations/bin/auto-genstrings b/Signal/translations/bin/auto-genstrings index ba15e625c..0362566cd 100755 --- a/Signal/translations/bin/auto-genstrings +++ b/Signal/translations/bin/auto-genstrings @@ -9,8 +9,9 @@ cd $REPO_ROOT SSK_DIR="./SignalServiceKit/src" SAE_DIR="./SignalShareExtension" SM_DIR="./SignalMessaging" +SCK_DIR="../SignalCoreKit" -TARGETS="Signal/src ${SSK_DIR} ${SAE_DIR} ${SM_DIR}" +TARGETS="Signal/src ${SSK_DIR} ${SAE_DIR} ${SM_DIR} ${SCK_DIR}" TMP="$(mktemp -d)" STRINGFILE="Signal/translations/en.lproj/Localizable.strings" diff --git a/Signal/translations/en.lproj/Localizable.strings b/Signal/translations/en.lproj/Localizable.strings index 63bb79e2c..c9b956f01 100644 --- a/Signal/translations/en.lproj/Localizable.strings +++ b/Signal/translations/en.lproj/Localizable.strings @@ -2093,6 +2093,15 @@ /* Title for the 'two factor auth' section of the privacy settings. */ "SETTINGS_TWO_FACTOR_AUTH_TITLE" = "Registration Lock"; +/* table section footer */ +"SETTINGS_UNIDENTIFIED_DELIVERY_SECTION_FOOTER" = "Normally, only users you've shared your profile with can contact you without identifying themselves to the Signal service. Unrestricted Access means *anyone* will be able to contact you without identifying themselves to the Signal service."; + +/* table section label */ +"SETTINGS_UNIDENTIFIED_DELIVERY_SECTION_TITLE" = "Unidentified Delivery"; + +/* switch label */ +"SETTINGS_UNIDENTIFIED_DELIVERY_UNRESTRICTED_ACCESS" = "Unrestricted Access"; + /* No comment provided by engineer. */ "SETTINGS_VERSION" = "Version"; From 221ce513f1800ecc50cba95b2f5a3676a4d43732 Mon Sep 17 00:00:00 2001 From: Michael Kirk Date: Wed, 10 Oct 2018 17:17:01 -0600 Subject: [PATCH 2/3] extract dependencies, no change in behavior --- .../PrivacySettingsTableViewController.m | 34 +++++++++++-------- .../MessageDetailViewController.swift | 19 ++++++----- 2 files changed, 29 insertions(+), 24 deletions(-) diff --git a/Signal/src/ViewControllers/AppSettings/PrivacySettingsTableViewController.m b/Signal/src/ViewControllers/AppSettings/PrivacySettingsTableViewController.m index 42c3dc42e..4d5b15cb7 100644 --- a/Signal/src/ViewControllers/AppSettings/PrivacySettingsTableViewController.m +++ b/Signal/src/ViewControllers/AppSettings/PrivacySettingsTableViewController.m @@ -56,6 +56,11 @@ NS_ASSUME_NONNULL_BEGIN return SSKEnvironment.shared.udManager; } +- (OWSPreferences *)preferences +{ + return Environment.shared.preferences; +} + #pragma mark - Table Contents - (void)updateTableContents @@ -121,11 +126,10 @@ NS_ASSUME_NONNULL_BEGIN OWSTableSection *screenSecuritySection = [OWSTableSection new]; screenSecuritySection.headerTitle = NSLocalizedString(@"SETTINGS_SECURITY_TITLE", @"Section header"); screenSecuritySection.footerTitle = NSLocalizedString(@"SETTINGS_SCREEN_SECURITY_DETAIL", nil); - [screenSecuritySection - addItem:[OWSTableItem switchItemWithText:NSLocalizedString(@"SETTINGS_SCREEN_SECURITY", @"") - isOn:[Environment.shared.preferences screenSecurityIsEnabled] - target:weakSelf - selector:@selector(didToggleScreenSecuritySwitch:)]]; + [screenSecuritySection addItem:[OWSTableItem switchItemWithText:NSLocalizedString(@"SETTINGS_SCREEN_SECURITY", @"") + isOn:[self.preferences screenSecurityIsEnabled] + target:weakSelf + selector:@selector(didToggleScreenSecuritySwitch:)]]; [contents addSection:screenSecuritySection]; // Allow calls to connect directly vs. using TURN exclusively @@ -137,7 +141,7 @@ NS_ASSUME_NONNULL_BEGIN [callingSection addItem:[OWSTableItem switchItemWithText:NSLocalizedString( @"SETTINGS_CALLING_HIDES_IP_ADDRESS_PREFERENCE_TITLE", @"Table cell label") - isOn:[Environment.shared.preferences doCallsHideIPAddress] + isOn:[self.preferences doCallsHideIPAddress] target:weakSelf selector:@selector(didToggleCallsHideIPAddressSwitch:)]]; [contents addSection:callingSection]; @@ -148,7 +152,7 @@ NS_ASSUME_NONNULL_BEGIN addItem:[OWSTableItem switchItemWithText:NSLocalizedString( @"SETTINGS_PRIVACY_CALLKIT_SYSTEM_CALL_LOG_PREFERENCE_TITLE", @"Short table cell label") - isOn:[Environment.shared.preferences isSystemCallLogEnabled] + isOn:[self.preferences isSystemCallLogEnabled] target:weakSelf selector:@selector(didToggleEnableSystemCallLogSwitch:)]]; callKitSection.footerTitle = NSLocalizedString( @@ -160,14 +164,14 @@ NS_ASSUME_NONNULL_BEGIN = NSLocalizedString(@"SETTINGS_SECTION_CALL_KIT_DESCRIPTION", @"Settings table section footer."); [callKitSection addItem:[OWSTableItem switchItemWithText:NSLocalizedString(@"SETTINGS_PRIVACY_CALLKIT_TITLE", @"Short table cell label") - isOn:[Environment.shared.preferences isCallKitEnabled] + isOn:[self.preferences isCallKitEnabled] target:weakSelf selector:@selector(didToggleEnableCallKitSwitch:)]]; - if (Environment.shared.preferences.isCallKitEnabled) { + if (self.preferences.isCallKitEnabled) { [callKitSection addItem:[OWSTableItem switchItemWithText:NSLocalizedString(@"SETTINGS_PRIVACY_CALLKIT_PRIVACY_TITLE", @"Label for 'CallKit privacy' preference") - isOn:![Environment.shared.preferences isCallKitPrivacyEnabled] + isOn:![self.preferences isCallKitPrivacyEnabled] target:weakSelf selector:@selector(didToggleEnableCallKitPrivacySwitch:)]]; } @@ -259,7 +263,7 @@ NS_ASSUME_NONNULL_BEGIN { BOOL enabled = sender.isOn; OWSLogInfo(@"toggled screen security: %@", enabled ? @"ON" : @"OFF"); - [Environment.shared.preferences setScreenSecurity:enabled]; + [self.preferences setScreenSecurity:enabled]; } - (void)didToggleReadReceiptsSwitch:(UISwitch *)sender @@ -273,13 +277,13 @@ NS_ASSUME_NONNULL_BEGIN { BOOL enabled = sender.isOn; OWSLogInfo(@"toggled callsHideIPAddress: %@", enabled ? @"ON" : @"OFF"); - [Environment.shared.preferences setDoCallsHideIPAddress:enabled]; + [self.preferences setDoCallsHideIPAddress:enabled]; } - (void)didToggleEnableSystemCallLogSwitch:(UISwitch *)sender { OWSLogInfo(@"user toggled call kit preference: %@", (sender.isOn ? @"ON" : @"OFF")); - [Environment.shared.preferences setIsSystemCallLogEnabled:sender.isOn]; + [self.preferences setIsSystemCallLogEnabled:sender.isOn]; // rebuild callUIAdapter since CallKit configuration changed. [SignalApp.sharedApp.callService createCallUIAdapter]; @@ -288,7 +292,7 @@ NS_ASSUME_NONNULL_BEGIN - (void)didToggleEnableCallKitSwitch:(UISwitch *)sender { OWSLogInfo(@"user toggled call kit preference: %@", (sender.isOn ? @"ON" : @"OFF")); - [Environment.shared.preferences setIsCallKitEnabled:sender.isOn]; + [self.preferences setIsCallKitEnabled:sender.isOn]; // rebuild callUIAdapter since CallKit vs not changed. [SignalApp.sharedApp.callService createCallUIAdapter]; @@ -300,7 +304,7 @@ NS_ASSUME_NONNULL_BEGIN - (void)didToggleEnableCallKitPrivacySwitch:(UISwitch *)sender { OWSLogInfo(@"user toggled call kit privacy preference: %@", (sender.isOn ? @"ON" : @"OFF")); - [Environment.shared.preferences setIsCallKitPrivacyEnabled:!sender.isOn]; + [self.preferences setIsCallKitPrivacyEnabled:!sender.isOn]; // rebuild callUIAdapter since CallKit configuration changed. [SignalApp.sharedApp.callService createCallUIAdapter]; diff --git a/Signal/src/ViewControllers/MessageDetailViewController.swift b/Signal/src/ViewControllers/MessageDetailViewController.swift index 8495b353c..1ebd70cfa 100644 --- a/Signal/src/ViewControllers/MessageDetailViewController.swift +++ b/Signal/src/ViewControllers/MessageDetailViewController.swift @@ -16,8 +16,6 @@ class MessageDetailViewController: OWSViewController, MediaGalleryDataSourceDele // MARK: Properties - let contactsManager: OWSContactsManager - let uiDatabaseConnection: YapDatabaseConnection var bubbleView: UIView? @@ -41,7 +39,13 @@ class MessageDetailViewController: OWSViewController, MediaGalleryDataSourceDele var conversationStyle: ConversationStyle - private var contactShareViewHelper: ContactShareViewHelper + private var contactShareViewHelper: ContactShareViewHelper! + + // MARK: Dependencies + + var contactsManager: OWSContactsManager { + return Environment.shared.contactsManager + } // MARK: Initializers @@ -52,23 +56,21 @@ class MessageDetailViewController: OWSViewController, MediaGalleryDataSourceDele @objc required init(viewItem: ConversationViewItem, message: TSMessage, thread: TSThread, mode: MessageMetadataViewMode) { - self.contactsManager = Environment.shared.contactsManager self.viewItem = viewItem self.message = message self.mode = mode self.uiDatabaseConnection = OWSPrimaryStorage.shared().newDatabaseConnection() - self.contactShareViewHelper = ContactShareViewHelper(contactsManager: contactsManager) self.conversationStyle = ConversationStyle(thread: thread) super.init(nibName: nil, bundle: nil) - - contactShareViewHelper.delegate = self } // MARK: View Lifecycle override func viewDidLoad() { super.viewDidLoad() + self.contactShareViewHelper = ContactShareViewHelper(contactsManager: contactsManager) + contactShareViewHelper.delegate = self self.uiDatabaseConnection.beginLongLivedReadTransaction() updateDBConnectionAndMessageToLatest() @@ -191,7 +193,6 @@ class MessageDetailViewController: OWSViewController, MediaGalleryDataSourceDele } var rows = [UIView]() - let contactsManager = Environment.shared.contactsManager! // Content rows += contentRows() @@ -291,7 +292,7 @@ class MessageDetailViewController: OWSViewController, MediaGalleryDataSourceDele sentRow.addGestureRecognizer(UILongPressGestureRecognizer(target: self, action: #selector(didLongPressSent))) rows.append(sentRow) - if message as? TSIncomingMessage != nil { + if message is TSIncomingMessage { rows.append(valueRow(name: NSLocalizedString("MESSAGE_METADATA_VIEW_RECEIVED_DATE_TIME", comment: "Label for the 'received date & time' field of the 'message metadata' view."), value: DateUtil.formatPastTimestampRelativeToNow(message.timestampForSorting()))) From 1544f8db46a1dd4044de2bd75811034dbca5b4c4 Mon Sep 17 00:00:00 2001 From: Michael Kirk Date: Wed, 10 Oct 2018 17:17:42 -0600 Subject: [PATCH 3/3] Optionally show UD status in message details --- .../PrivacySettingsTableViewController.m | 30 +++++++++++++++---- .../MessageDetailViewController.swift | 21 +++++++++++-- .../translations/en.lproj/Localizable.strings | 14 ++++++--- SignalMessaging/categories/String+OWS.swift | 4 +++ SignalMessaging/utils/OWSPreferences.h | 3 ++ SignalMessaging/utils/OWSPreferences.m | 13 ++++++++ 6 files changed, 73 insertions(+), 12 deletions(-) diff --git a/Signal/src/ViewControllers/AppSettings/PrivacySettingsTableViewController.m b/Signal/src/ViewControllers/AppSettings/PrivacySettingsTableViewController.m index 4d5b15cb7..b711f64c6 100644 --- a/Signal/src/ViewControllers/AppSettings/PrivacySettingsTableViewController.m +++ b/Signal/src/ViewControllers/AppSettings/PrivacySettingsTableViewController.m @@ -205,21 +205,33 @@ NS_ASSUME_NONNULL_BEGIN }]]; [contents addSection:historyLogsSection]; - OWSTableSection *unidentifiedDeliverySection = [OWSTableSection new]; - unidentifiedDeliverySection.headerTitle + OWSTableSection *unidentifiedDeliveryIndicatorsSection = [OWSTableSection new]; + unidentifiedDeliveryIndicatorsSection.headerTitle = NSLocalizedString(@"SETTINGS_UNIDENTIFIED_DELIVERY_SECTION_TITLE", @"table section label"); - unidentifiedDeliverySection.footerTitle - = NSLocalizedString(@"SETTINGS_UNIDENTIFIED_DELIVERY_SECTION_FOOTER", @"table section footer"); + unidentifiedDeliveryIndicatorsSection.footerTitle + = NSLocalizedString(@"SETTINGS_UNIDENTIFIED_DELIVERY_SHOW_INDICATORS_FOOTER", @"table section footer"); + OWSTableItem *showUDIndicatorsItem = [OWSTableItem + switchItemWithText:NSLocalizedString(@"SETTINGS_UNIDENTIFIED_DELIVERY_SHOW_INDICATORS", @"switch label") + isOn:weakSelf.preferences.shouldShowUnidentifiedDeliveryIndicators + target:weakSelf + selector:@selector(didToggleUDShowIndicatorsSwitch:)]; + [unidentifiedDeliveryIndicatorsSection addItem:showUDIndicatorsItem]; + + OWSTableSection *unidentifiedDeliveryUnrestrictedSection = [OWSTableSection new]; OWSTableItem *unrestrictedAccessItem = [OWSTableItem switchItemWithText:NSLocalizedString(@"SETTINGS_UNIDENTIFIED_DELIVERY_UNRESTRICTED_ACCESS", @"switch label") isOn:weakSelf.udManager.shouldAllowUnrestrictedAccessLocal target:weakSelf selector:@selector(didToggleUDUnrestrictedAccessSwitch:)]; - [unidentifiedDeliverySection addItem:unrestrictedAccessItem]; + [unidentifiedDeliveryUnrestrictedSection addItem:unrestrictedAccessItem]; - [contents addSection:unidentifiedDeliverySection]; + unidentifiedDeliveryUnrestrictedSection.footerTitle + = NSLocalizedString(@"SETTINGS_UNIDENTIFIED_DELIVERY_UNRESTRICTED_ACCESS_FOOTER", @"table section footer"); + + [contents addSection:unidentifiedDeliveryIndicatorsSection]; + [contents addSection:unidentifiedDeliveryUnrestrictedSection]; self.contents = contents; } @@ -316,6 +328,12 @@ NS_ASSUME_NONNULL_BEGIN [self.udManager setShouldAllowUnrestrictedAccessLocal:sender.isOn]; } +- (void)didToggleUDShowIndicatorsSwitch:(UISwitch *)sender +{ + OWSLogInfo(@"toggled to: %@", (sender.isOn ? @"ON" : @"OFF")); + [self.preferences setShouldShowUnidentifiedDeliveryIndicators:sender.isOn]; +} + - (void)show2FASettings { OWSLogInfo(@""); diff --git a/Signal/src/ViewControllers/MessageDetailViewController.swift b/Signal/src/ViewControllers/MessageDetailViewController.swift index 1ebd70cfa..9254379b3 100644 --- a/Signal/src/ViewControllers/MessageDetailViewController.swift +++ b/Signal/src/ViewControllers/MessageDetailViewController.swift @@ -37,12 +37,20 @@ class MessageDetailViewController: OWSViewController, MediaGalleryDataSourceDele var attachmentStream: TSAttachmentStream? var messageBody: String? + lazy var shouldShowUD: Bool = { + return self.preferences.shouldShowUnidentifiedDeliveryIndicators() + }() + var conversationStyle: ConversationStyle private var contactShareViewHelper: ContactShareViewHelper! // MARK: Dependencies + var preferences: OWSPreferences { + return Environment.shared.preferences + } + var contactsManager: OWSContactsManager { return Environment.shared.contactsManager } @@ -259,7 +267,12 @@ class MessageDetailViewController: OWSViewController, MediaGalleryDataSourceDele // context of a table view. let cellView = ContactCellView() // We use the "short" status message to avoid being redundant with the section title. - cellView.accessoryMessage = shortStatusMessage + if self.shouldShowUD, recipientState.wasSentByUD { + // TODO once design is complete, replace stand-in emoji + cellView.accessoryMessage = shortStatusMessage.rtlSafeAppend(" ").rtlSafeAppend("💌") + } else { + cellView.accessoryMessage = shortStatusMessage + } cellView.configure(withRecipientId: recipientId, contactsManager: self.contactsManager) let wrapper = UIView() @@ -285,9 +298,13 @@ class MessageDetailViewController: OWSViewController, MediaGalleryDataSourceDele } } + var sentText = DateUtil.formatPastTimestampRelativeToNow(message.timestamp) + if self.shouldShowUD, let incomingMessage = message as? TSIncomingMessage, incomingMessage.wasReceivedByUD { + sentText = sentText.rtlSafeAppend(" ").rtlSafeAppend("💌") + } let sentRow = valueRow(name: NSLocalizedString("MESSAGE_METADATA_VIEW_SENT_DATE_TIME", comment: "Label for the 'sent date & time' field of the 'message metadata' view."), - value: DateUtil.formatPastTimestampRelativeToNow(message.timestamp)) + value: sentText) sentRow.isUserInteractionEnabled = true sentRow.addGestureRecognizer(UILongPressGestureRecognizer(target: self, action: #selector(didLongPressSent))) rows.append(sentRow) diff --git a/Signal/translations/en.lproj/Localizable.strings b/Signal/translations/en.lproj/Localizable.strings index c9b956f01..0ab9b11c6 100644 --- a/Signal/translations/en.lproj/Localizable.strings +++ b/Signal/translations/en.lproj/Localizable.strings @@ -2093,14 +2093,20 @@ /* Title for the 'two factor auth' section of the privacy settings. */ "SETTINGS_TWO_FACTOR_AUTH_TITLE" = "Registration Lock"; -/* table section footer */ -"SETTINGS_UNIDENTIFIED_DELIVERY_SECTION_FOOTER" = "Normally, only users you've shared your profile with can contact you without identifying themselves to the Signal service. Unrestricted Access means *anyone* will be able to contact you without identifying themselves to the Signal service."; - /* table section label */ "SETTINGS_UNIDENTIFIED_DELIVERY_SECTION_TITLE" = "Unidentified Delivery"; /* switch label */ -"SETTINGS_UNIDENTIFIED_DELIVERY_UNRESTRICTED_ACCESS" = "Unrestricted Access"; +"SETTINGS_UNIDENTIFIED_DELIVERY_SHOW_INDICATORS" = "Display Indicators"; + +/* table section footer */ +"SETTINGS_UNIDENTIFIED_DELIVERY_SHOW_INDICATORS_FOOTER" = "Show a status icon when you select \"More Info\" on messages that were sent using unidentified delivery."; + +/* switch label */ +"SETTINGS_UNIDENTIFIED_DELIVERY_UNRESTRICTED_ACCESS" = "Allow from Anyone"; + +/* table section footer */ +"SETTINGS_UNIDENTIFIED_DELIVERY_UNRESTRICTED_ACCESS_FOOTER" = "Enable unidentified delivery for incoming messages from non-contacts and people with whom you have not shared your profile."; /* No comment provided by engineer. */ "SETTINGS_VERSION" = "Version"; diff --git a/SignalMessaging/categories/String+OWS.swift b/SignalMessaging/categories/String+OWS.swift index 01f093e2b..5c5830beb 100644 --- a/SignalMessaging/categories/String+OWS.swift +++ b/SignalMessaging/categories/String+OWS.swift @@ -10,6 +10,10 @@ public extension String { return self.trimmingCharacters(in: .whitespacesAndNewlines) } + func rtlSafeAppend(_ string: String) -> String { + return (self as NSString).rtlSafeAppend(string) + } + // Truncates string to be less than or equal to byteCount, while ensuring we never truncate partial characters for multibyte characters. func truncated(toByteCount byteCount: UInt) -> String? { var lowerBoundCharCount = 0 diff --git a/SignalMessaging/utils/OWSPreferences.h b/SignalMessaging/utils/OWSPreferences.h index e11f8cff4..5bb5c7b3d 100644 --- a/SignalMessaging/utils/OWSPreferences.h +++ b/SignalMessaging/utils/OWSPreferences.h @@ -58,6 +58,9 @@ extern NSString *const OWSPreferencesCallLoggingDidChangeNotification; - (BOOL)hasGeneratedThumbnails; - (void)setHasGeneratedThumbnails:(BOOL)value; +- (BOOL)shouldShowUnidentifiedDeliveryIndicators; +- (void)setShouldShowUnidentifiedDeliveryIndicators:(BOOL)value; + #pragma mark Callkit - (BOOL)isSystemCallLogEnabled; diff --git a/SignalMessaging/utils/OWSPreferences.m b/SignalMessaging/utils/OWSPreferences.m index 3ebd9c08a..303be9e58 100644 --- a/SignalMessaging/utils/OWSPreferences.m +++ b/SignalMessaging/utils/OWSPreferences.m @@ -27,6 +27,8 @@ NSString *const OWSPreferencesKeyCallKitPrivacyEnabled = @"CallKitPrivacyEnabled NSString *const OWSPreferencesKeyCallsHideIPAddress = @"CallsHideIPAddress"; NSString *const OWSPreferencesKeyHasDeclinedNoContactsView = @"hasDeclinedNoContactsView"; NSString *const OWSPreferencesKeyHasGeneratedThumbnails = @"OWSPreferencesKeyHasGeneratedThumbnails"; +NSString *const OWSPreferencesKeyShouldShowUnidentifiedDeliveryIndicators + = @"OWSPreferencesKeyShouldShowUnidentifiedDeliveryIndicators"; NSString *const OWSPreferencesKeyIOSUpgradeNagDate = @"iOSUpgradeNagDate"; NSString *const OWSPreferencesKey_IsReadyForAppExtensions = @"isReadyForAppExtensions_5"; NSString *const OWSPreferencesKeySystemCallLogEnabled = @"OWSPreferencesKeySystemCallLogEnabled"; @@ -188,6 +190,17 @@ NSString *const OWSPreferencesKeySystemCallLogEnabled = @"OWSPreferencesKeySyste return [self tryGetValueForKey:OWSPreferencesKeyIOSUpgradeNagDate]; } +- (BOOL)shouldShowUnidentifiedDeliveryIndicators +{ + NSNumber *preference = [self tryGetValueForKey:OWSPreferencesKeyShouldShowUnidentifiedDeliveryIndicators]; + return preference ? [preference boolValue] : NO; +} + +- (void)setShouldShowUnidentifiedDeliveryIndicators:(BOOL)value +{ + [self setValueForKey:OWSPreferencesKeyShouldShowUnidentifiedDeliveryIndicators toValue:@(value)]; +} + #pragma mark - Calling #pragma mark CallKit