Skip to content
Snippets Groups Projects
Commit 00f51a11 authored by Ahmed Shehata's avatar Ahmed Shehata
Browse files

Merge branch 'hotfix-stringified-verification' into 'development'

Hotfix stringified verification

See merge request elixxir/client-ios!5
parents 5fac939e e70c992e
No related branches found
No related tags found
2 merge requests!8Fixing failed verification due to wrong fact passed,!5Hotfix stringified verification
......@@ -70,11 +70,22 @@ extension Session {
let ud = client.userDiscovery!
guard let fact = contact.email ?? contact.phone else {
let hasEmail = contact.email != nil
let hasPhone = contact.phone != nil
guard hasEmail || hasPhone else {
ud.lookup(forUserId: contact.userId, resultClosure)
return
}
var fact: String
if hasEmail {
fact = "\(FactType.email.prefix)\(contact.email!)"
} else {
fact = "\(FactType.phone.prefix)\(contact.phone!)"
}
do {
try ud.search(fact: fact, resultClosure)
} catch {
......
......@@ -18,4 +18,17 @@ public enum FactType: Int {
return "Username"
}
}
public var prefix: String {
switch self {
case .email:
return "E"
case .nickname:
return "N"
case .phone:
return "P"
case .username:
return "U"
}
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment