Signal-iOS/SignalMessaging/utils/OWSPreferences.h
Harry 6556f389c7
Rotate APNS tokens automatically when the NSE fails to receive notifications
* Allow using a transaction for checking APNS token

* Add APNSRotationStore

* add APNSRotationStoreTest

* Rotate APNS tokens in SyncPushTokensJob

* Mark NSE as having processed messages for token rotation

* Check for APNS token rotations after flushing incoming message queue

* pr comments

* Simplify APNS rotation conditions: we mark APNS as working when getting a push in either the NSE or the main app, and rotate if we missed a message since then.

* Mark APNS tokens as working if we ever get a push. Don't rotate known-good tokens.

* Added logging

* add remote flags to control behavior

* pr comments

* fix bad merge

* invert kill switch

* PR nit comments

* Avoid write transactions on the SyncPushTokensJob hot path

* Initial PR feedback, more to come

* Change of strategy: rotate if we have new messages to process on app startup

* PR comments

* use null for calltype column on incoming message rows
2022-12-19 11:10:15 -08:00

115 lines
3.4 KiB
Objective-C

//
// Copyright 2014 Signal Messenger, LLC
// SPDX-License-Identifier: AGPL-3.0-only
//
NS_ASSUME_NONNULL_BEGIN
/**
* The users privacy preference for what kind of content to show in lock screen notifications.
*/
typedef NS_CLOSED_ENUM(NSUInteger, NotificationType) {
NotificationNoNameNoPreview = 0,
NotificationNameNoPreview = 1,
NotificationNamePreview = 2,
};
NSString *NSStringForNotificationType(NotificationType value);
// Used when migrating logging to NSUserDefaults.
extern NSString *const OWSPreferencesSignalDatabaseCollection;
extern NSString *const OWSPreferencesKeyEnableDebugLog;
extern NSString *const OWSPreferencesCallLoggingDidChangeNotification;
@class SDSAnyReadTransaction;
@class SDSAnyWriteTransaction;
@class SDSKeyValueStore;
@interface OWSPreferences : NSObject
@property (nonatomic, readonly) SDSKeyValueStore *keyValueStore;
#pragma mark - Helpers
- (void)removeAllValues;
#pragma mark - Specific Preferences
+ (BOOL)isAudibleErrorLoggingEnabled;
+ (void)setIsAudibleErrorLoggingEnabled:(BOOL)value;
+ (BOOL)isLoggingEnabled;
+ (void)setIsLoggingEnabled:(BOOL)value;
- (BOOL)screenSecurityIsEnabled;
- (void)setScreenSecurity:(BOOL)value;
- (NotificationType)notificationPreviewType;
- (void)setNotificationPreviewType:(NotificationType)type;
- (NSString *)nameForNotificationPreviewType:(NotificationType)notificationType;
- (BOOL)soundInForeground;
- (void)setSoundInForeground:(BOOL)value;
- (BOOL)hasDeclinedNoContactsView;
- (void)setHasDeclinedNoContactsView:(BOOL)value;
- (void)setIOSUpgradeNagDate:(NSDate *)value;
- (nullable NSDate *)iOSUpgradeNagDate;
- (BOOL)hasGeneratedThumbnails;
- (void)setHasGeneratedThumbnails:(BOOL)value;
- (BOOL)shouldShowUnidentifiedDeliveryIndicators;
- (BOOL)shouldShowUnidentifiedDeliveryIndicatorsWithTransaction:(SDSAnyReadTransaction *)transaction
NS_SWIFT_NAME(shouldShowUnidentifiedDeliveryIndicators(transaction:));
- (void)setShouldShowUnidentifiedDeliveryIndicatorsAndSendSyncMessage:(BOOL)value;
- (void)setShouldShowUnidentifiedDeliveryIndicators:(BOOL)value transaction:(SDSAnyWriteTransaction *)transaction;
- (BOOL)shouldNotifyOfNewAccountsWithTransaction:(SDSAnyReadTransaction *)transaction
NS_SWIFT_NAME(shouldNotifyOfNewAccounts(transaction:));
- (void)setShouldNotifyOfNewAccounts:(BOOL)newValue
transaction:(SDSAnyWriteTransaction *)transaction
NS_SWIFT_NAME(shouldNotifyOfNewAccounts(_:transaction:));
@property (nonatomic, readonly) CGFloat cachedDeviceScale;
- (BOOL)wasViewOnceTooltipShown;
- (void)setWasViewOnceTooltipShown;
- (BOOL)wasGroupCallTooltipShown;
- (void)incrementGroupCallTooltipShownCount;
- (void)setWasGroupCallTooltipShown;
- (BOOL)wasBlurTooltipShown;
- (void)setWasBlurTooltipShown;
- (BOOL)wasDeleteForEveryoneConfirmationShown;
- (void)setWasDeleteForEveryoneConfirmationShown;
#pragma mark Callkit
- (BOOL)isSystemCallLogEnabled;
- (void)setIsSystemCallLogEnabled:(BOOL)value;
#pragma mark direct call connectivity (non-TURN)
- (BOOL)doCallsHideIPAddress;
- (void)setDoCallsHideIPAddress:(BOOL)value;
#pragma mark - Push Tokens
- (void)setPushToken:(NSString *)value;
- (nullable NSString *)getPushToken;
- (nullable NSString *)getPushToken:(SDSAnyReadTransaction *)transaction;
- (void)setVoipToken:(nullable NSString *)value;
- (nullable NSString *)getVoipToken;
- (void)unsetRecordedAPNSTokens;
@end
NS_ASSUME_NONNULL_END