COVIDSafe code from version 2.4 (#47)

This commit is contained in:
COVIDSafe Support 2021-03-18 14:16:35 +11:00 committed by covidsafe-support
parent e577a9e7aa
commit 1478088e19
40 changed files with 1125 additions and 657 deletions

View file

@ -13,21 +13,28 @@ class GetTempIdAPI: CovidSafeAuthenticatedAPI {
private static let apiVersion = 2
static func getTempId(completion: @escaping (String?, Int?, Swift.Error?, CovidSafeAPIError?) -> Void) {
guard isBusy == false else {
completion(nil ,nil ,nil, .UnknownError)
return
}
guard let apiHost = PlistHelper.getvalueFromInfoPlist(withKey: "API_Host", plistName: "CovidSafe-config") else {
return
}
guard let headers = try? authenticatedHeaders() else {
completion(nil, nil, nil, .TokenExpiredError)
return
}
let params = [
"version" : apiVersion
]
guard authenticatedHeaders.count > 0 else {
completion(nil, nil, nil, .TokenExpiredError)
return
}
CovidNetworking.shared.session.request("\(apiHost)/getTempId",
method: .get,
parameters: params,
headers: headers,
headers: authenticatedHeaders,
interceptor: CovidRequestRetrier(retries: 3)).validate().responseDecodable(of: TempIdResponse.self) { (response) in
switch response.result {
case .success: