Tweak profile fetch auth behavior in unknown mode case.

pull/1/head
Matthew Chen 7 years ago
parent 36f39d9a30
commit 3f10ce7408

@ -135,10 +135,24 @@ public class ProfileFetcherJob: NSObject {
Logger.error("getProfile: \(recipientId)")
// If we are in unknown mode, try using a random UD access key
// in case they support unrestricted access.
switch self.udManager.unidentifiedAccessMode(forRecipientId: recipientId) {
case .unknown, .unrestricted:
case .unknown:
if let udAccessKey = udManager.udAccessKey(forRecipientId: recipientId) {
// If we are in unknown mode and have a profile key,
// try using the profile key.
return self.requestProfile(recipientId: recipientId,
udAccessKey: udAccessKey,
canFailoverUDAuth: true)
} else {
// If we are in unknown mode and don't have a profile key,
// try using a random UD access key in case they support
// unrestricted access.
let randomUDAccessKey = self.udManager.randomUDAccessKey()
return requestProfile(recipientId: recipientId,
udAccessKey: randomUDAccessKey,
canFailoverUDAuth: true)
}
case .unrestricted:
let randomUDAccessKey = self.udManager.randomUDAccessKey()
return requestProfile(recipientId: recipientId,
udAccessKey: randomUDAccessKey,

Loading…
Cancel
Save