mirror of
https://github.com/AU-COVIDSafe/mobile-ios.git
synced 2025-05-20 12:15:17 +00:00
COVIDSafe code from version 2.4 (#47)
This commit is contained in:
parent
e577a9e7aa
commit
1478088e19
40 changed files with 1125 additions and 657 deletions
|
@ -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:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue