Rework Groups v2 & CDS feature flags.
This commit is contained in:
parent
74ac84d521
commit
fdd3c513ca
@ -149,7 +149,7 @@ public class AccountManager: NSObject {
|
||||
return firstly {
|
||||
self.registerForTextSecure(verificationCode: verificationCode, pin: pin, checkForAvailableTransfer: checkForAvailableTransfer)
|
||||
}.then { response -> Promise<Void> in
|
||||
assert(!FeatureFlags.allowUUIDOnlyContacts || response.uuid != nil)
|
||||
assert(!RemoteConfig.allowUUIDOnlyContacts || response.uuid != nil)
|
||||
self.tsAccountManager.uuidAwaitingVerification = response.uuid
|
||||
|
||||
self.databaseStorage.write { transaction in
|
||||
@ -469,7 +469,7 @@ public class AccountManager: NSObject {
|
||||
_ = self.ensureUuid().catch { error in
|
||||
// Until we're in a UUID-only world, don't require a
|
||||
// local UUID.
|
||||
if FeatureFlags.allowUUIDOnlyContacts {
|
||||
if RemoteConfig.allowUUIDOnlyContacts {
|
||||
owsFailDebug("error: \(error)")
|
||||
}
|
||||
Logger.warn("error: \(error)")
|
||||
|
||||
@ -53,7 +53,7 @@ public extension DebugUIMessages {
|
||||
|
||||
@objc
|
||||
class func receiveUUIDEnvelopeInNewThread() {
|
||||
assert(FeatureFlags.allowUUIDOnlyContacts)
|
||||
assert(RemoteConfig.allowUUIDOnlyContacts)
|
||||
|
||||
let senderClient = FakeSignalClient.generate(e164Identifier: nil)
|
||||
let localClient = LocalSignalClient()
|
||||
@ -74,7 +74,7 @@ public extension DebugUIMessages {
|
||||
|
||||
@objc
|
||||
class func createUUIDGroup() {
|
||||
assert(FeatureFlags.allowUUIDOnlyContacts)
|
||||
assert(RemoteConfig.allowUUIDOnlyContacts)
|
||||
|
||||
let uuidMembers = (0...3).map { _ in CommonGenerator.address(hasPhoneNumber: false) }
|
||||
let members = uuidMembers + [TSAccountManager.localAddress!]
|
||||
|
||||
@ -574,7 +574,7 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
}
|
||||
[recipientAddresses addObject:self.tsAccountManager.localAddress];
|
||||
|
||||
if (SSKFeatureFlags.allowUUIDOnlyContacts) {
|
||||
if (RemoteConfig.allowUUIDOnlyContacts) {
|
||||
for (int i = 0; i < 3; i++) {
|
||||
[recipientAddresses addObject:[[SignalServiceAddress alloc] initWithUuid:[NSUUID UUID] phoneNumber:nil]];
|
||||
}
|
||||
|
||||
@ -746,7 +746,7 @@ NSString *const kProfileView_LastPresentedDate = @"kProfileView_LastPresentedDat
|
||||
case ProfileViewMode_Registration:
|
||||
return false;
|
||||
case ProfileViewMode_AppSettings:
|
||||
return SSKFeatureFlags.usernames;
|
||||
return RemoteConfig.usernames;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -138,7 +138,7 @@ const NSUInteger kMinimumSearchLength = 2;
|
||||
UISearchBar *searchBar = [OWSSearchBar new];
|
||||
_searchBar = searchBar;
|
||||
searchBar.delegate = self;
|
||||
if (SSKFeatureFlags.usernames) {
|
||||
if (RemoteConfig.usernames) {
|
||||
searchBar.placeholder = NSLocalizedString(@"SEARCH_BY_NAME_OR_USERNAME_OR_NUMBER_PLACEHOLDER_TEXT",
|
||||
@"Placeholder text indicating the user can search for contacts by name, username, or phone number.");
|
||||
} else {
|
||||
@ -825,7 +825,7 @@ const NSUInteger kMinimumSearchLength = 2;
|
||||
}
|
||||
|
||||
// Username lookup
|
||||
if (SSKFeatureFlags.usernames) {
|
||||
if (RemoteConfig.usernames) {
|
||||
NSString *usernameMatch = self.searchText;
|
||||
NSString *_Nullable localUsername = self.profileManager.localUsername;
|
||||
|
||||
|
||||
@ -639,7 +639,7 @@ const NSString *kNSNotificationKey_WasLocallyInitiated = @"kNSNotificationKey_Wa
|
||||
if (localUUID) {
|
||||
[whitelistedUUIDS removeObject:localUUID];
|
||||
} else {
|
||||
if (SSKFeatureFlags.allowUUIDOnlyContacts) {
|
||||
if (RemoteConfig.allowUUIDOnlyContacts) {
|
||||
OWSFailDebug(@"Missing localUUID");
|
||||
}
|
||||
}
|
||||
|
||||
@ -498,7 +498,7 @@ NSString *const TSAccountManager_DeviceId = @"TSAccountManager_DeviceId";
|
||||
[self.keyValueStore setString:localNumber key:TSAccountManager_RegisteredNumberKey transaction:transaction];
|
||||
|
||||
if (localUuid == nil) {
|
||||
OWSAssert(!SSKFeatureFlags.allowUUIDOnlyContacts);
|
||||
OWSAssert(!RemoteConfig.allowUUIDOnlyContacts);
|
||||
} else {
|
||||
[self.keyValueStore setString:localUuid.UUIDString
|
||||
key:TSAccountManager_RegisteredUUIDKey
|
||||
|
||||
@ -114,7 +114,7 @@ NSUInteger const SignalAccountSchemaVersion = 1;
|
||||
}
|
||||
|
||||
OWSAssertDebug(recipientPhoneNumber != nil || recipientUUID != nil);
|
||||
OWSAssertDebug(recipientPhoneNumber != nil || SSKFeatureFlags.allowUUIDOnlyContacts);
|
||||
OWSAssertDebug(recipientPhoneNumber != nil || RemoteConfig.allowUUIDOnlyContacts);
|
||||
|
||||
_contact = contact;
|
||||
_contactAvatarHash = contactAvatarHash;
|
||||
|
||||
@ -273,7 +273,7 @@ public class SignalServiceAddress: NSObject, NSCopying, NSSecureCoding, Codable
|
||||
|
||||
@objc
|
||||
public var serviceIdentifier: String? {
|
||||
if FeatureFlags.allowUUIDOnlyContacts,
|
||||
if RemoteConfig.allowUUIDOnlyContacts,
|
||||
uuid != nil {
|
||||
guard let uuidString = uuidString else {
|
||||
owsFailDebug("uuidString was unexpectedly nil")
|
||||
|
||||
@ -498,7 +498,7 @@ NSString *const OWSRequestKey_AuthKey = @"AuthKey";
|
||||
+ (NSDictionary<NSString *, NSNumber *> *)deviceCapabilities
|
||||
{
|
||||
NSMutableDictionary<NSString *, NSNumber *> *capabilities = [NSMutableDictionary new];
|
||||
if (SSKFeatureFlags.uuidCapabilities) {
|
||||
if (RemoteConfig.uuidCapabilities) {
|
||||
capabilities[@"uuid"] = @(YES);
|
||||
}
|
||||
if (RemoteConfig.groupsV2GoodCitizen) {
|
||||
|
||||
@ -66,7 +66,7 @@ public class SignalServiceProfile: NSObject {
|
||||
if let value: Bool = try capabilities.optional(key: "uuid") {
|
||||
self.supportsUUID = value
|
||||
} else {
|
||||
if FeatureFlags.uuidCapabilities {
|
||||
if RemoteConfig.uuidCapabilities {
|
||||
owsFailDebug("Missing uuid capability.")
|
||||
}
|
||||
// The capability has been retired from the service.
|
||||
|
||||
@ -348,7 +348,7 @@ public class SSKProtoEnvelope: NSObject, Codable {
|
||||
let phoneNumber: String? = {
|
||||
guard hasSourceE164 else {
|
||||
// Shouldn’t happen in prod yet
|
||||
assert(FeatureFlags.allowUUIDOnlyContacts)
|
||||
assert(RemoteConfig.allowUUIDOnlyContacts)
|
||||
return nil
|
||||
}
|
||||
|
||||
@ -2658,7 +2658,7 @@ public class SSKProtoDataMessageQuote: NSObject, Codable {
|
||||
let phoneNumber: String? = {
|
||||
guard hasAuthorE164 else {
|
||||
// Shouldn’t happen in prod yet
|
||||
assert(FeatureFlags.allowUUIDOnlyContacts)
|
||||
assert(RemoteConfig.allowUUIDOnlyContacts)
|
||||
return nil
|
||||
}
|
||||
|
||||
@ -4814,7 +4814,7 @@ public class SSKProtoDataMessageReaction: NSObject, Codable {
|
||||
let phoneNumber: String? = {
|
||||
guard hasAuthorE164 else {
|
||||
// Shouldn’t happen in prod yet
|
||||
assert(FeatureFlags.allowUUIDOnlyContacts)
|
||||
assert(RemoteConfig.allowUUIDOnlyContacts)
|
||||
return nil
|
||||
}
|
||||
|
||||
@ -6329,7 +6329,7 @@ public class SSKProtoVerified: NSObject, Codable {
|
||||
let phoneNumber: String? = {
|
||||
guard hasDestinationE164 else {
|
||||
// Shouldn’t happen in prod yet
|
||||
assert(FeatureFlags.allowUUIDOnlyContacts)
|
||||
assert(RemoteConfig.allowUUIDOnlyContacts)
|
||||
return nil
|
||||
}
|
||||
|
||||
@ -6558,7 +6558,7 @@ public class SSKProtoSyncMessageSentUnidentifiedDeliveryStatus: NSObject, Codabl
|
||||
let phoneNumber: String? = {
|
||||
guard hasDestinationE164 else {
|
||||
// Shouldn’t happen in prod yet
|
||||
assert(FeatureFlags.allowUUIDOnlyContacts)
|
||||
assert(RemoteConfig.allowUUIDOnlyContacts)
|
||||
return nil
|
||||
}
|
||||
|
||||
@ -6854,7 +6854,7 @@ public class SSKProtoSyncMessageSent: NSObject, Codable {
|
||||
let phoneNumber: String? = {
|
||||
guard hasDestinationE164 else {
|
||||
// Shouldn’t happen in prod yet
|
||||
assert(FeatureFlags.allowUUIDOnlyContacts)
|
||||
assert(RemoteConfig.allowUUIDOnlyContacts)
|
||||
return nil
|
||||
}
|
||||
|
||||
@ -7730,7 +7730,7 @@ public class SSKProtoSyncMessageRead: NSObject, Codable {
|
||||
let phoneNumber: String? = {
|
||||
guard hasSenderE164 else {
|
||||
// Shouldn’t happen in prod yet
|
||||
assert(FeatureFlags.allowUUIDOnlyContacts)
|
||||
assert(RemoteConfig.allowUUIDOnlyContacts)
|
||||
return nil
|
||||
}
|
||||
|
||||
@ -8376,7 +8376,7 @@ public class SSKProtoSyncMessageViewOnceOpen: NSObject, Codable {
|
||||
let phoneNumber: String? = {
|
||||
guard hasSenderE164 else {
|
||||
// Shouldn’t happen in prod yet
|
||||
assert(FeatureFlags.allowUUIDOnlyContacts)
|
||||
assert(RemoteConfig.allowUUIDOnlyContacts)
|
||||
return nil
|
||||
}
|
||||
|
||||
@ -8984,7 +8984,7 @@ public class SSKProtoSyncMessageMessageRequestResponse: NSObject, Codable {
|
||||
let phoneNumber: String? = {
|
||||
guard hasThreadE164 else {
|
||||
// Shouldn’t happen in prod yet
|
||||
assert(FeatureFlags.allowUUIDOnlyContacts)
|
||||
assert(RemoteConfig.allowUUIDOnlyContacts)
|
||||
return nil
|
||||
}
|
||||
|
||||
@ -11059,7 +11059,7 @@ public class SSKProtoContactDetails: NSObject, Codable {
|
||||
let phoneNumber: String? = {
|
||||
guard hasContactE164 else {
|
||||
// Shouldn’t happen in prod yet
|
||||
assert(FeatureFlags.allowUUIDOnlyContacts)
|
||||
assert(RemoteConfig.allowUUIDOnlyContacts)
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
@ -1542,7 +1542,7 @@ public class StorageServiceProtoContactRecord: NSObject, Codable {
|
||||
let phoneNumber: String? = {
|
||||
guard hasServiceE164 else {
|
||||
// Shouldn’t happen in prod yet
|
||||
assert(FeatureFlags.allowUUIDOnlyContacts)
|
||||
assert(RemoteConfig.allowUUIDOnlyContacts)
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
@ -95,7 +95,7 @@ static uint32_t const OWSFingerprintDefaultHashIterations = 5200;
|
||||
|
||||
- (uint32_t)scannableFingerprintVersion
|
||||
{
|
||||
if (!SSKFeatureFlags.uuidSafetyNumbers) {
|
||||
if (!RemoteConfig.uuidSafetyNumbers) {
|
||||
return OWSFingerprintPreUUIDScannableFormatVersion;
|
||||
}
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
//
|
||||
// Copyright (c) 2019 Open Whisper Systems. All rights reserved.
|
||||
// Copyright (c) 2020 Open Whisper Systems. All rights reserved.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
@ -73,7 +73,7 @@ public extension SignalClient {
|
||||
}
|
||||
|
||||
var address: SignalServiceAddress {
|
||||
if FeatureFlags.allowUUIDOnlyContacts {
|
||||
if RemoteConfig.allowUUIDOnlyContacts {
|
||||
return SignalServiceAddress(uuid: uuid, phoneNumber: e164Identifier)
|
||||
} else {
|
||||
return SignalServiceAddress(phoneNumber: e164Identifier!)
|
||||
|
||||
@ -112,9 +112,6 @@ public class FeatureFlags: BaseFlags {
|
||||
return build.includes(.beta) ? .fail : .failDebug
|
||||
}
|
||||
|
||||
@objc
|
||||
public static let uuidCapabilities = groupsV2
|
||||
|
||||
@objc
|
||||
public static var storageModeDescription: String {
|
||||
return "\(storageMode)"
|
||||
@ -134,20 +131,13 @@ public class FeatureFlags: BaseFlags {
|
||||
@objc
|
||||
public static let strictYDBExtensions = build.includes(.beta)
|
||||
|
||||
@objc
|
||||
public static let allowUUIDOnlyContacts = groupsV2
|
||||
|
||||
@objc
|
||||
public static let uuidSafetyNumbers = allowUUIDOnlyContacts
|
||||
|
||||
@objc
|
||||
public static let phoneNumberPrivacy = false
|
||||
|
||||
@objc
|
||||
public static let complainAboutSlowDBWrites = true
|
||||
|
||||
@objc
|
||||
public static let usernames = allowUUIDOnlyContacts && build.includes(.dev)
|
||||
static let canUseUsernames = build.includes(.dev)
|
||||
|
||||
@objc
|
||||
public static var calling: Bool {
|
||||
|
||||
@ -64,7 +64,6 @@ public class RemoteConfig: BaseFlags {
|
||||
@objc
|
||||
public static var uuidSafetyNumbers: Bool {
|
||||
guard modernContactDiscovery else { return false }
|
||||
guard FeatureFlags.uuidSafetyNumbers else { return false }
|
||||
return isEnabled(.uuidSafetyNumbers)
|
||||
}
|
||||
|
||||
@ -111,6 +110,23 @@ public class RemoteConfig: BaseFlags {
|
||||
return isEnabled(.mentions)
|
||||
}
|
||||
|
||||
@objc
|
||||
public static var uuidCapabilities: Bool {
|
||||
modernContactDiscovery
|
||||
}
|
||||
|
||||
@objc
|
||||
public static var allowUUIDOnlyContacts: Bool {
|
||||
modernContactDiscovery
|
||||
}
|
||||
|
||||
@objc
|
||||
public static var usernames: Bool {
|
||||
modernContactDiscovery && FeatureFlags.canUseUsernames
|
||||
}
|
||||
|
||||
// MARK: -
|
||||
|
||||
private static func isEnabled(_ flag: Flags.SupportedIsEnabledFlags, defaultValue: Bool = false) -> Bool {
|
||||
guard let remoteConfig = SSKEnvironment.shared.remoteConfigManager.cachedConfig else {
|
||||
return defaultValue
|
||||
|
||||
@ -126,7 +126,7 @@ class MessageProcessingIntegrationTest: SSKBaseTestSwift {
|
||||
}
|
||||
|
||||
func test_contactMessage_UUIDEnvelope() {
|
||||
guard FeatureFlags.allowUUIDOnlyContacts else {
|
||||
guard RemoteConfig.allowUUIDOnlyContacts else {
|
||||
// This test is known to be failing.
|
||||
// It's intended as TDD for the upcoming UUID work.
|
||||
return
|
||||
|
||||
Loading…
Reference in New Issue
Block a user