Skip to content

Commit

Permalink
Merge pull request #67 from Cidaas/verification_v2
Browse files Browse the repository at this point in the history
verification fixes
  • Loading branch information
cidaas-samples authored Aug 1, 2019
2 parents dc753f6 + 88fad7e commit 9613307
Show file tree
Hide file tree
Showing 7 changed files with 311 additions and 163 deletions.
1 change: 1 addition & 0 deletions Cidaas.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -38,5 +38,6 @@ Pod::Spec.new do |s|

s.subspec 'V2_Verification' do |verification|
verification.source_files = 'Cidaas/Classes/V2/Verification/**/*'
verification.dependency 'Cidaas/Core'
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,31 @@ public class ErrorResponseDataEntity : Codable {
}
}

public class EnrollResponseMetaData : Codable {

// properties
public var comment: String = ""
public var number_images_needed: Int32 = 0
public var number_images_uploaded: Int32 = 0

public var number_voices_needed: Int32 = 0
public var number_voices_uploaded: Int32 = 0

// Constructors
public init() {

}

public required init(from decoder: Decoder) throws {
let container = try decoder.container(keyedBy: CodingKeys.self)
self.comment = try container.decodeIfPresent(String.self, forKey: .comment) ?? ""
self.number_images_needed = try container.decodeIfPresent(Int32.self, forKey: .number_images_needed) ?? 0
self.number_images_uploaded = try container.decodeIfPresent(Int32.self, forKey: .number_images_uploaded) ?? 0
self.number_voices_needed = try container.decodeIfPresent(Int32.self, forKey: .number_voices_needed) ?? 0
self.number_voices_uploaded = try container.decodeIfPresent(Int32.self, forKey: .number_voices_uploaded) ?? 0
}
}

public class MetadataInfo:Codable {

public var meta: EnrollResponseMetaData = EnrollResponseMetaData()
Expand Down
2 changes: 0 additions & 2 deletions Cidaas/Classes/Core/Views/Cidaas.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@ public class Cidaas {
// shared instance
public static var shared : Cidaas = Cidaas()

public static var verification: Verification = Verification()

// private local variables
var requestId : String = ""
var loginURLString : String = ""
Expand Down
25 changes: 0 additions & 25 deletions Cidaas/Classes/V2/Verification/Models/EnrollResponse.swift
Original file line number Diff line number Diff line change
Expand Up @@ -42,28 +42,3 @@ public class EnrollResponseData: Codable {
self.enrolled = try container.decodeIfPresent(Bool.self, forKey: .enrolled) ?? false
}
}

public class EnrollResponseMetaData : Codable {

// properties
public var comment: String = ""
public var number_images_needed: Int32 = 0
public var number_images_uploaded: Int32 = 0

public var number_voices_needed: Int32 = 0
public var number_voices_uploaded: Int32 = 0

// Constructors
public init() {

}

public required init(from decoder: Decoder) throws {
let container = try decoder.container(keyedBy: CodingKeys.self)
self.comment = try container.decodeIfPresent(String.self, forKey: .comment) ?? ""
self.number_images_needed = try container.decodeIfPresent(Int32.self, forKey: .number_images_needed) ?? 0
self.number_images_uploaded = try container.decodeIfPresent(Int32.self, forKey: .number_images_uploaded) ?? 0
self.number_voices_needed = try container.decodeIfPresent(Int32.self, forKey: .number_voices_needed) ?? 0
self.number_voices_uploaded = try container.decodeIfPresent(Int32.self, forKey: .number_voices_uploaded) ?? 0
}
}
4 changes: 3 additions & 1 deletion Cidaas/Classes/V2/Verification/Views/Verification.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@

import Foundation

public class Verification {
public class CidaasVerification {

public static var shared: CidaasVerification = CidaasVerification()

public init() {}

Expand Down
4 changes: 2 additions & 2 deletions Example/Cidaas/ViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ class ViewController: UIViewController, WKNavigationDelegate, CidaasLoaderDelega

cidaas.setFCMToken(sub: "", fcmToken: "eoR95tONqJQ:APA91bFRxFaVD1ZXUw_ThJ_3YoFxw97fgoYhlU0fXBP5arZ7IZ6-FNVPogbTw_-mEK8abV8Pl50-fcIitYwZAK8JN9IHdd8yL-pWpIV-C9l3MY-jHlZ9ITocjO3Z220NaqoY3twt2WU7")

Cidaas.verification.configure(configureRequest: setupRequest) {
CidaasVerification.shared.configure(configureRequest: setupRequest) {
switch $0 {
case .success(let successResponse):
print(successResponse.data.sub)
Expand All @@ -81,7 +81,7 @@ class ViewController: UIViewController, WKNavigationDelegate, CidaasLoaderDelega

cidaas.setFCMToken(sub: "", fcmToken: "eoR95tONqJQ:APA91bFRxFaVD1ZXUw_ThJ_3YoFxw97fgoYhlU0fXBP5arZ7IZ6-FNVPogbTw_-mEK8abV8Pl50-fcIitYwZAK8JN9IHdd8yL-pWpIV-C9l3MY-jHlZ9ITocjO3Z220NaqoY3twt2WU7")

Cidaas.verification.login(loginRequest: loginRequest) {
CidaasVerification.shared.login(loginRequest: loginRequest) {
switch $0 {
case .success(let successResponse):
print(successResponse.data.sub)
Expand Down
Loading

0 comments on commit 9613307

Please sign in to comment.