From c68090864630e8a368211a19aed238236a856c99 Mon Sep 17 00:00:00 2001 From: Michael Kirk Date: Wed, 10 Oct 2018 12:04:40 -0600 Subject: [PATCH] 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";