Simplify OWSPreferences access.

pull/1/head
Matthew Chen 7 years ago
parent 6007f8df6e
commit df7acfeed3

@ -627,7 +627,7 @@ static NSTimeInterval launchStartedAt;
// restart the app, so we check every activation for users who haven't yet registered. // restart the app, so we check every activation for users who haven't yet registered.
__unused AnyPromise *promise = __unused AnyPromise *promise =
[OWSSyncPushTokensJob runWithAccountManager:SignalApp.sharedApp.accountManager [OWSSyncPushTokensJob runWithAccountManager:SignalApp.sharedApp.accountManager
preferences:[Environment preferences]]; preferences:Environment.shared.preferences];
} }
if ([OWS2FAManager sharedManager].isDueForReminder) { if ([OWS2FAManager sharedManager].isDueForReminder) {
@ -1034,7 +1034,7 @@ static NSTimeInterval launchStartedAt;
// This should happen at any launch, background or foreground. // This should happen at any launch, background or foreground.
__unused AnyPromise *pushTokenpromise = __unused AnyPromise *pushTokenpromise =
[OWSSyncPushTokensJob runWithAccountManager:SignalApp.sharedApp.accountManager [OWSSyncPushTokensJob runWithAccountManager:SignalApp.sharedApp.accountManager
preferences:[Environment preferences]]; preferences:Environment.shared.preferences];
} }
[DeviceSleepManager.sharedInstance removeBlockWithBlockObject:self]; [DeviceSleepManager.sharedInstance removeBlockWithBlockObject:self];
@ -1048,7 +1048,7 @@ static NSTimeInterval launchStartedAt;
[[OWSMessageReceiver sharedInstance] handleAnyUnprocessedEnvelopesAsync]; [[OWSMessageReceiver sharedInstance] handleAnyUnprocessedEnvelopesAsync];
[[OWSBatchMessageProcessor sharedInstance] handleAnyUnprocessedEnvelopesAsync]; [[OWSBatchMessageProcessor sharedInstance] handleAnyUnprocessedEnvelopesAsync];
if (!Environment.preferences.hasGeneratedThumbnails) { if (!Environment.shared.preferences.hasGeneratedThumbnails) {
[OWSPrimaryStorage.sharedManager.newDatabaseConnection [OWSPrimaryStorage.sharedManager.newDatabaseConnection
asyncReadWithBlock:^(YapDatabaseReadTransaction *_Nonnull transaction) { asyncReadWithBlock:^(YapDatabaseReadTransaction *_Nonnull transaction) {
[TSAttachmentStream enumerateCollectionObjectsUsingBlock:^(id _Nonnull obj, BOOL *_Nonnull stop){ [TSAttachmentStream enumerateCollectionObjectsUsingBlock:^(id _Nonnull obj, BOOL *_Nonnull stop){
@ -1056,7 +1056,7 @@ static NSTimeInterval launchStartedAt;
}]; }];
} }
completionBlock:^{ completionBlock:^{
[Environment.preferences setHasGeneratedThumbnails:YES]; [Environment.shared.preferences setHasGeneratedThumbnails:YES];
}]; }];
} }

@ -128,7 +128,7 @@
[contents addSection:debugSection]; [contents addSection:debugSection];
OWSPreferences *preferences = [Environment preferences]; OWSPreferences *preferences = Environment.shared.preferences;
NSString *_Nullable pushToken = [preferences getPushToken]; NSString *_Nullable pushToken = [preferences getPushToken];
NSString *_Nullable voipToken = [preferences getVoipToken]; NSString *_Nullable voipToken = [preferences getVoipToken];
[debugSection [debugSection

@ -251,7 +251,7 @@ NS_ASSUME_NONNULL_BEGIN
- (void)syncPushTokens - (void)syncPushTokens
{ {
OWSSyncPushTokensJob *job = [[OWSSyncPushTokensJob alloc] initWithAccountManager:SignalApp.sharedApp.accountManager OWSSyncPushTokensJob *job = [[OWSSyncPushTokensJob alloc] initWithAccountManager:SignalApp.sharedApp.accountManager
preferences:[Environment preferences]]; preferences:Environment.shared.preferences];
job.uploadOnlyIfStale = NO; job.uploadOnlyIfStale = NO;
[job run] [job run]
.then(^{ .then(^{

@ -27,7 +27,7 @@
OWSTableSection *section = [OWSTableSection new]; OWSTableSection *section = [OWSTableSection new];
section.footerTitle = NSLocalizedString(@"NOTIFICATIONS_FOOTER_WARNING", nil); section.footerTitle = NSLocalizedString(@"NOTIFICATIONS_FOOTER_WARNING", nil);
OWSPreferences *prefs = [Environment preferences]; OWSPreferences *prefs = Environment.shared.preferences;
NotificationType selectedNotifType = [prefs notificationPreviewType]; NotificationType selectedNotifType = [prefs notificationPreviewType];
for (NSNumber *option in for (NSNumber *option in
@[ @(NotificationNamePreview), @(NotificationNameNoPreview), @(NotificationNoNameNoPreview) ]) { @[ @(NotificationNamePreview), @(NotificationNameNoPreview), @(NotificationNoNameNoPreview) ]) {
@ -53,7 +53,7 @@
- (void)setNotificationType:(NotificationType)notificationType - (void)setNotificationType:(NotificationType)notificationType
{ {
[Environment.preferences setNotificationPreviewType:notificationType]; [Environment.shared.preferences setNotificationPreviewType:notificationType];
// rebuild callUIAdapter since notification configuration changed. // rebuild callUIAdapter since notification configuration changed.
[SignalApp.sharedApp.callService createCallUIAdapter]; [SignalApp.sharedApp.callService createCallUIAdapter];

@ -35,7 +35,7 @@
__weak NotificationSettingsViewController *weakSelf = self; __weak NotificationSettingsViewController *weakSelf = self;
OWSPreferences *prefs = [Environment preferences]; OWSPreferences *prefs = Environment.shared.preferences;
// Sounds section. // Sounds section.
@ -83,7 +83,7 @@
- (void)didToggleSoundNotificationsSwitch:(UISwitch *)sender - (void)didToggleSoundNotificationsSwitch:(UISwitch *)sender
{ {
[Environment.preferences setSoundInForeground:sender.on]; [Environment.shared.preferences setSoundInForeground:sender.on];
} }
@end @end

@ -113,8 +113,9 @@ NS_ASSUME_NONNULL_BEGIN
OWSTableSection *screenSecuritySection = [OWSTableSection new]; OWSTableSection *screenSecuritySection = [OWSTableSection new];
screenSecuritySection.headerTitle = NSLocalizedString(@"SETTINGS_SECURITY_TITLE", @"Section header"); screenSecuritySection.headerTitle = NSLocalizedString(@"SETTINGS_SECURITY_TITLE", @"Section header");
screenSecuritySection.footerTitle = NSLocalizedString(@"SETTINGS_SCREEN_SECURITY_DETAIL", nil); screenSecuritySection.footerTitle = NSLocalizedString(@"SETTINGS_SCREEN_SECURITY_DETAIL", nil);
[screenSecuritySection addItem:[OWSTableItem switchItemWithText:NSLocalizedString(@"SETTINGS_SCREEN_SECURITY", @"") [screenSecuritySection
isOn:[Environment.preferences screenSecurityIsEnabled] addItem:[OWSTableItem switchItemWithText:NSLocalizedString(@"SETTINGS_SCREEN_SECURITY", @"")
isOn:[Environment.shared.preferences screenSecurityIsEnabled]
target:weakSelf target:weakSelf
selector:@selector(didToggleScreenSecuritySwitch:)]]; selector:@selector(didToggleScreenSecuritySwitch:)]];
[contents addSection:screenSecuritySection]; [contents addSection:screenSecuritySection];
@ -128,7 +129,7 @@ NS_ASSUME_NONNULL_BEGIN
[callingSection addItem:[OWSTableItem switchItemWithText:NSLocalizedString( [callingSection addItem:[OWSTableItem switchItemWithText:NSLocalizedString(
@"SETTINGS_CALLING_HIDES_IP_ADDRESS_PREFERENCE_TITLE", @"SETTINGS_CALLING_HIDES_IP_ADDRESS_PREFERENCE_TITLE",
@"Table cell label") @"Table cell label")
isOn:[Environment.preferences doCallsHideIPAddress] isOn:[Environment.shared.preferences doCallsHideIPAddress]
target:weakSelf target:weakSelf
selector:@selector(didToggleCallsHideIPAddressSwitch:)]]; selector:@selector(didToggleCallsHideIPAddressSwitch:)]];
[contents addSection:callingSection]; [contents addSection:callingSection];
@ -139,7 +140,7 @@ NS_ASSUME_NONNULL_BEGIN
addItem:[OWSTableItem switchItemWithText:NSLocalizedString( addItem:[OWSTableItem switchItemWithText:NSLocalizedString(
@"SETTINGS_PRIVACY_CALLKIT_SYSTEM_CALL_LOG_PREFERENCE_TITLE", @"SETTINGS_PRIVACY_CALLKIT_SYSTEM_CALL_LOG_PREFERENCE_TITLE",
@"Short table cell label") @"Short table cell label")
isOn:[Environment.preferences isSystemCallLogEnabled] isOn:[Environment.shared.preferences isSystemCallLogEnabled]
target:weakSelf target:weakSelf
selector:@selector(didToggleEnableSystemCallLogSwitch:)]]; selector:@selector(didToggleEnableSystemCallLogSwitch:)]];
callKitSection.footerTitle = NSLocalizedString( callKitSection.footerTitle = NSLocalizedString(
@ -151,14 +152,14 @@ NS_ASSUME_NONNULL_BEGIN
= NSLocalizedString(@"SETTINGS_SECTION_CALL_KIT_DESCRIPTION", @"Settings table section footer."); = NSLocalizedString(@"SETTINGS_SECTION_CALL_KIT_DESCRIPTION", @"Settings table section footer.");
[callKitSection addItem:[OWSTableItem switchItemWithText:NSLocalizedString(@"SETTINGS_PRIVACY_CALLKIT_TITLE", [callKitSection addItem:[OWSTableItem switchItemWithText:NSLocalizedString(@"SETTINGS_PRIVACY_CALLKIT_TITLE",
@"Short table cell label") @"Short table cell label")
isOn:[Environment.preferences isCallKitEnabled] isOn:[Environment.shared.preferences isCallKitEnabled]
target:weakSelf target:weakSelf
selector:@selector(didToggleEnableCallKitSwitch:)]]; selector:@selector(didToggleEnableCallKitSwitch:)]];
if (Environment.preferences.isCallKitEnabled) { if (Environment.shared.preferences.isCallKitEnabled) {
[callKitSection [callKitSection
addItem:[OWSTableItem switchItemWithText:NSLocalizedString(@"SETTINGS_PRIVACY_CALLKIT_PRIVACY_TITLE", addItem:[OWSTableItem switchItemWithText:NSLocalizedString(@"SETTINGS_PRIVACY_CALLKIT_PRIVACY_TITLE",
@"Label for 'CallKit privacy' preference") @"Label for 'CallKit privacy' preference")
isOn:![Environment.preferences isCallKitPrivacyEnabled] isOn:![Environment.shared.preferences isCallKitPrivacyEnabled]
target:weakSelf target:weakSelf
selector:@selector(didToggleEnableCallKitPrivacySwitch:)]]; selector:@selector(didToggleEnableCallKitPrivacySwitch:)]];
} }
@ -234,7 +235,7 @@ NS_ASSUME_NONNULL_BEGIN
{ {
BOOL enabled = sender.isOn; BOOL enabled = sender.isOn;
OWSLogInfo(@"toggled screen security: %@", enabled ? @"ON" : @"OFF"); OWSLogInfo(@"toggled screen security: %@", enabled ? @"ON" : @"OFF");
[Environment.preferences setScreenSecurity:enabled]; [Environment.shared.preferences setScreenSecurity:enabled];
} }
- (void)didToggleReadReceiptsSwitch:(UISwitch *)sender - (void)didToggleReadReceiptsSwitch:(UISwitch *)sender
@ -248,7 +249,7 @@ NS_ASSUME_NONNULL_BEGIN
{ {
BOOL enabled = sender.isOn; BOOL enabled = sender.isOn;
OWSLogInfo(@"toggled callsHideIPAddress: %@", enabled ? @"ON" : @"OFF"); OWSLogInfo(@"toggled callsHideIPAddress: %@", enabled ? @"ON" : @"OFF");
[Environment.preferences setDoCallsHideIPAddress:enabled]; [Environment.shared.preferences setDoCallsHideIPAddress:enabled];
} }
- (void)didToggleEnableSystemCallLogSwitch:(UISwitch *)sender - (void)didToggleEnableSystemCallLogSwitch:(UISwitch *)sender

@ -2796,10 +2796,10 @@ typedef enum : NSUInteger {
[self clearUnreadMessagesIndicator]; [self clearUnreadMessagesIndicator];
self.inputToolbar.quotedReply = nil; self.inputToolbar.quotedReply = nil;
if (!Environment.preferences.hasSentAMessage) { if (!Environment.shared.preferences.hasSentAMessage) {
[Environment.preferences setHasSentAMessage:YES]; [Environment.shared.preferences setHasSentAMessage:YES];
} }
if ([Environment.preferences soundInForeground]) { if ([Environment.shared.preferences soundInForeground]) {
SystemSoundID soundId = [OWSSounds systemSoundIDForSound:OWSSound_MessageSent quiet:YES]; SystemSoundID soundId = [OWSSounds systemSoundIDForSound:OWSSound_MessageSent quiet:YES];
AudioServicesPlaySystemSound(soundId); AudioServicesPlaySystemSound(soundId);
} }

@ -1435,7 +1435,7 @@ NSString *const kArchivedConversationsReuseIdentifier = @"kArchivedConversations
NSString *secondLine = @""; NSString *secondLine = @"";
if (self.homeViewMode == HomeViewMode_Inbox) { if (self.homeViewMode == HomeViewMode_Inbox) {
if ([Environment.preferences hasSentAMessage]) { if ([Environment.shared.preferences hasSentAMessage]) {
firstLine = NSLocalizedString( firstLine = NSLocalizedString(
@"EMPTY_INBOX_TITLE", @"Header text an existing user sees when viewing an empty inbox"); @"EMPTY_INBOX_TITLE", @"Header text an existing user sees when viewing an empty inbox");
secondLine = NSLocalizedString( secondLine = NSLocalizedString(
@ -1477,7 +1477,7 @@ NSString *const kArchivedConversationsReuseIdentifier = @"kArchivedConversations
// If the user hasn't sent a message, we don't want to ask them for a review yet. // If the user hasn't sent a message, we don't want to ask them for a review yet.
- (void)requestReviewIfAppropriate - (void)requestReviewIfAppropriate
{ {
if (self.hasEverAppeared && Environment.preferences.hasSentAMessage) { if (self.hasEverAppeared && Environment.shared.preferences.hasSentAMessage) {
OWSLogDebug(@"requesting review"); OWSLogDebug(@"requesting review");
if (@available(iOS 10, *)) { if (@available(iOS 10, *)) {
// In Debug this pops up *every* time, which is helpful, but annoying. // In Debug this pops up *every* time, which is helpful, but annoying.

@ -676,7 +676,7 @@ NS_ASSUME_NONNULL_BEGIN
- (void)hideBackgroundView - (void)hideBackgroundView
{ {
[[Environment preferences] setHasDeclinedNoContactsView:YES]; [Environment.shared.preferences setHasDeclinedNoContactsView:YES];
[self showContactAppropriateViews]; [self showContactAppropriateViews];
} }
@ -693,7 +693,7 @@ NS_ASSUME_NONNULL_BEGIN
{ {
if (self.contactsViewHelper.contactsManager.isSystemContactsAuthorized) { if (self.contactsViewHelper.contactsManager.isSystemContactsAuthorized) {
if (self.contactsViewHelper.hasUpdatedContactsAtLeastOnce && self.contactsViewHelper.signalAccounts.count < 1 if (self.contactsViewHelper.hasUpdatedContactsAtLeastOnce && self.contactsViewHelper.signalAccounts.count < 1
&& ![[Environment preferences] hasDeclinedNoContactsView]) { && ![Environment.shared.preferences hasDeclinedNoContactsView]) {
self.isNoContactsModeActive = YES; self.isNoContactsModeActive = YES;
} else { } else {
self.isNoContactsModeActive = NO; self.isNoContactsModeActive = NO;

@ -102,13 +102,13 @@ extension CallUIAdaptee {
adaptee = NonCallKitCallUIAdaptee(callService: callService, notificationsAdapter: notificationsAdapter) adaptee = NonCallKitCallUIAdaptee(callService: callService, notificationsAdapter: notificationsAdapter)
} else if #available(iOS 11, *) { } else if #available(iOS 11, *) {
Logger.info("choosing callkit adaptee for iOS11+") Logger.info("choosing callkit adaptee for iOS11+")
let showNames = Environment.preferences().notificationPreviewType() != .noNameNoPreview let showNames = Environment.shared.preferences.notificationPreviewType() != .noNameNoPreview
let useSystemCallLog = Environment.preferences().isSystemCallLogEnabled() let useSystemCallLog = Environment.shared.preferences.isSystemCallLogEnabled()
adaptee = CallKitCallUIAdaptee(callService: callService, contactsManager: contactsManager, notificationsAdapter: notificationsAdapter, showNamesOnCallScreen: showNames, useSystemCallLog: useSystemCallLog) adaptee = CallKitCallUIAdaptee(callService: callService, contactsManager: contactsManager, notificationsAdapter: notificationsAdapter, showNamesOnCallScreen: showNames, useSystemCallLog: useSystemCallLog)
} else if #available(iOS 10.0, *), Environment.shared.preferences.isCallKitEnabled() { } else if #available(iOS 10.0, *), Environment.shared.preferences.isCallKitEnabled() {
Logger.info("choosing callkit adaptee for iOS10") Logger.info("choosing callkit adaptee for iOS10")
let hideNames = Environment.preferences().isCallKitPrivacyEnabled() || Environment.preferences().notificationPreviewType() == .noNameNoPreview let hideNames = Environment.shared.preferences.isCallKitPrivacyEnabled() || Environment.shared.preferences.notificationPreviewType() == .noNameNoPreview
let showNames = !hideNames let showNames = !hideNames
// All CallKit calls use the system call log on iOS10 // All CallKit calls use the system call log on iOS10

@ -248,7 +248,7 @@
[[PushManager sharedManager] presentNotification:notification checkForCancel:NO]; [[PushManager sharedManager] presentNotification:notification checkForCancel:NO];
} else { } else {
if (shouldPlaySound && [Environment.preferences soundInForeground]) { if (shouldPlaySound && [Environment.shared.preferences soundInForeground]) {
OWSSound sound = [OWSSounds notificationSoundForThread:thread]; OWSSound sound = [OWSSounds notificationSoundForThread:thread];
SystemSoundID soundId = [OWSSounds systemSoundIDForSound:sound quiet:YES]; SystemSoundID soundId = [OWSSounds systemSoundIDForSound:sound quiet:YES];
// Vibrate, respect silent switch, respect "Alert" volume, not media volume. // Vibrate, respect silent switch, respect "Alert" volume, not media volume.
@ -282,7 +282,7 @@
[[PushManager sharedManager] presentNotification:notification checkForCancel:NO]; [[PushManager sharedManager] presentNotification:notification checkForCancel:NO];
} else { } else {
if (shouldPlaySound && [Environment.preferences soundInForeground]) { if (shouldPlaySound && [Environment.shared.preferences soundInForeground]) {
OWSSound sound = [OWSSounds globalNotificationSound]; OWSSound sound = [OWSSounds globalNotificationSound];
SystemSoundID soundId = [OWSSounds systemSoundIDForSound:sound quiet:YES]; SystemSoundID soundId = [OWSSounds systemSoundIDForSound:sound quiet:YES];
// Vibrate, respect silent switch, respect "Alert" volume, not media volume. // Vibrate, respect silent switch, respect "Alert" volume, not media volume.
@ -389,7 +389,7 @@
[[PushManager sharedManager] presentNotification:notification checkForCancel:YES]; [[PushManager sharedManager] presentNotification:notification checkForCancel:YES];
} else { } else {
if (shouldPlaySound && [Environment.preferences soundInForeground]) { if (shouldPlaySound && [Environment.shared.preferences soundInForeground]) {
OWSSound sound = [OWSSounds notificationSoundForThread:thread]; OWSSound sound = [OWSSounds notificationSoundForThread:thread];
SystemSoundID soundId = [OWSSounds systemSoundIDForSound:sound quiet:YES]; SystemSoundID soundId = [OWSSounds systemSoundIDForSound:sound quiet:YES];
// Vibrate, respect silent switch, respect "Alert" volume, not media volume. // Vibrate, respect silent switch, respect "Alert" volume, not media volume.

@ -236,7 +236,7 @@ NS_ASSUME_NONNULL_BEGIN
[OWSStorage resetAllStorage]; [OWSStorage resetAllStorage];
[OWSUserProfile resetProfileStorage]; [OWSUserProfile resetProfileStorage];
[Environment.preferences clear]; [Environment.shared.preferences clear];
[self clearAllNotifications]; [self clearAllNotifications];

@ -348,7 +348,7 @@ NS_ASSUME_NONNULL_BEGIN
return ScreenLockUIStateNone; return ScreenLockUIStateNone;
} }
if (Environment.preferences.screenSecurityIsEnabled) { if (Environment.shared.preferences.screenSecurityIsEnabled) {
OWSLogVerbose(@"desiredUIState: screen protection 4."); OWSLogVerbose(@"desiredUIState: screen protection 4.");
return ScreenLockUIStateScreenProtection; return ScreenLockUIStateScreenProtection;
} else { } else {

@ -6,6 +6,7 @@
#import "CodeVerificationViewController.h" #import "CodeVerificationViewController.h"
#import "OWSNavigationController.h" #import "OWSNavigationController.h"
#import <SignalMessaging/Environment.h> #import <SignalMessaging/Environment.h>
#import <SignalMessaging/OWSPreferences.h>
#import <SignalMessaging/SignalMessaging-Swift.h> #import <SignalMessaging/SignalMessaging-Swift.h>
#import <SignalServiceKit/TSAccountManager.h> #import <SignalServiceKit/TSAccountManager.h>

@ -34,6 +34,7 @@ FOUNDATION_EXPORT const unsigned char SignalMessagingVersionString[];
#import <SignalMessaging/OWSGroupAvatarBuilder.h> #import <SignalMessaging/OWSGroupAvatarBuilder.h>
#import <SignalMessaging/OWSMath.h> #import <SignalMessaging/OWSMath.h>
#import <SignalMessaging/OWSNavigationController.h> #import <SignalMessaging/OWSNavigationController.h>
#import <SignalMessaging/OWSPreferences.h>
#import <SignalMessaging/OWSProfileManager.h> #import <SignalMessaging/OWSProfileManager.h>
#import <SignalMessaging/OWSQuotedReplyModel.h> #import <SignalMessaging/OWSQuotedReplyModel.h>
#import <SignalMessaging/OWSSearchBar.h> #import <SignalMessaging/OWSSearchBar.h>

@ -100,7 +100,7 @@ import Foundation
return return
} }
if let iOSUpgradeNagDate = Environment.preferences().iOSUpgradeNagDate() { if let iOSUpgradeNagDate = Environment.shared.preferences.iOSUpgradeNagDate() {
// Nag no more than once every three days. // Nag no more than once every three days.
let kNagFrequencySeconds = 3 * kDayInterval let kNagFrequencySeconds = 3 * kDayInterval
guard fabs(iOSUpgradeNagDate.timeIntervalSinceNow) > kNagFrequencySeconds else { guard fabs(iOSUpgradeNagDate.timeIntervalSinceNow) > kNagFrequencySeconds else {
@ -108,7 +108,7 @@ import Foundation
} }
} }
Environment.preferences().setIOSUpgradeNagDate(Date()) Environment.shared.preferences.setIOSUpgradeNagDate(Date())
OWSAlerts.showAlert(title: NSLocalizedString("UPGRADE_IOS_ALERT_TITLE", OWSAlerts.showAlert(title: NSLocalizedString("UPGRADE_IOS_ALERT_TITLE",
comment: "Title for the alert indicating that user should upgrade iOS."), comment: "Title for the alert indicating that user should upgrade iOS."),

@ -2,7 +2,6 @@
// Copyright (c) 2018 Open Whisper Systems. All rights reserved. // Copyright (c) 2018 Open Whisper Systems. All rights reserved.
// //
#import "OWSPreferences.h"
#import <SignalServiceKit/TSStorageHeaders.h> #import <SignalServiceKit/TSStorageHeaders.h>
/** /**
@ -17,6 +16,7 @@
@class OWSContactsManager; @class OWSContactsManager;
@class OWSMessageSender; @class OWSMessageSender;
@class OWSNavigationController; @class OWSNavigationController;
@class OWSPreferences;
@class TSGroupThread; @class TSGroupThread;
@class TSNetworkManager; @class TSNetworkManager;
@class TSThread; @class TSThread;
@ -39,6 +39,4 @@
// Should only be called by tests. // Should only be called by tests.
+ (void)clearCurrentForTests; + (void)clearCurrentForTests;
+ (OWSPreferences *)preferences;
@end @end

@ -4,6 +4,7 @@
#import "Environment.h" #import "Environment.h"
#import "DebugLogger.h" #import "DebugLogger.h"
#import "OWSPreferences.h"
#import "SignalKeyingStorage.h" #import "SignalKeyingStorage.h"
#import <SignalServiceKit/AppContext.h> #import <SignalServiceKit/AppContext.h>
#import <SignalServiceKit/ContactsUpdater.h> #import <SignalServiceKit/ContactsUpdater.h>
@ -101,13 +102,6 @@ static Environment *sharedEnvironment = nil;
return _messageSender; return _messageSender;
} }
+ (OWSPreferences *)preferences
{
OWSAssertDebug(Environment.shared.preferences);
return Environment.shared.preferences;
}
// TODO: Convert to singleton? // TODO: Convert to singleton?
- (OWSPreferences *)preferences - (OWSPreferences *)preferences
{ {

@ -23,7 +23,7 @@ static NSString *const OWS108CallLoggingPreferenceId = @"108";
{ {
OWSAssertDebug(transaction); OWSAssertDebug(transaction);
[[Environment preferences] applyCallLoggingSettingsForLegacyUsersWithTransaction:transaction]; [Environment.shared.preferences applyCallLoggingSettingsForLegacyUsersWithTransaction:transaction];
} }
@end @end

Loading…
Cancel
Save