Respond to CR.

// FREEBIE
pull/1/head
Matthew Chen 8 years ago
parent e1b32315de
commit 8b65246619

@ -21,7 +21,7 @@ NS_ASSUME_NONNULL_BEGIN
- (void)removeDevices:(NSSet *)set; - (void)removeDevices:(NSSet *)set;
@property (nonatomic, nullable) NSString *relay; @property (nonatomic, nullable) NSString *relay;
@property (nonatomic, retain) NSMutableOrderedSet *devices; @property (nonatomic) NSMutableOrderedSet *devices;
- (BOOL)supportsVoice; - (BOOL)supportsVoice;
// This property indicates support for both WebRTC audio and video calls. // This property indicates support for both WebRTC audio and video calls.

@ -23,7 +23,23 @@ NS_ASSUME_NONNULL_BEGIN
return self; return self;
} }
_devices = [NSMutableOrderedSet orderedSetWithObject:[NSNumber numberWithInt:1]]; OWSAssert([TSAccountManager localNumber].length > 0);
if ([[TSAccountManager localNumber] isEqualToString:textSecureIdentifier]) {
// Default to no devices.
//
// This instance represents our own account and is used for sending
// sync message to linked devices. We shouldn't have any linked devices
// yet when we create the "self" SignalRecipient, and we don't need to
// send sync messages to the primary - we ARE the primary.
_devices = [NSMutableOrderedSet new];
} else {
// Default to sending to just primary device.
//
// OWSMessageSender will correct this if it is wrong the next time
// we send a message to this recipient.
_devices = [NSMutableOrderedSet orderedSetWithObject:@(1)];
}
_relay = [relay isEqualToString:@""] ? nil : relay; _relay = [relay isEqualToString:@""] ? nil : relay;
return self; return self;

@ -978,16 +978,7 @@ NSString *const OWSMessageSenderRateLimitedException = @"RateLimitedException";
// of new secondary devices when this message send fails. // of new secondary devices when this message send fails.
DDLogWarn(@"%@ sync message has no device messages but account has secondary devices.", self.logTag); DDLogWarn(@"%@ sync message has no device messages but account has secondary devices.", self.logTag);
} else if (hasDeviceMessages) { } else if (hasDeviceMessages) {
for (NSDictionary *deviceMessage in deviceMessages) { OWSFail(@"%@ sync message has device messages for unknown secondary devices.", self.logTag);
NSNumber *_Nullable deviceId = deviceMessage[@"destinationDeviceId"];
if (deviceId && [deviceId isKindOfClass:[NSNumber class]] && [deviceId isEqualToNumber:@(1)]) {
DDLogWarn(@"%@ trying to sending sync message to primary device, presumably because user has just "
@"registered.",
self.logTag);
} else {
OWSFail(@"%@ sync message has device messages for unknown secondary devices.", self.logTag);
}
}
} else { } else {
// Account has secondary devices; proceed as usual. // Account has secondary devices; proceed as usual.
} }

Loading…
Cancel
Save