mirror of
https://github.com/AU-COVIDSafe/mobile-ios.git
synced 2025-01-18 16:56:33 +00:00
COVIDSafe code from version 1.14 (#27)
This commit is contained in:
parent
3ea83834f5
commit
cf93ea43c0
29 changed files with 370 additions and 141 deletions
|
@ -333,7 +333,6 @@
|
|||
0BA617CD242E09B200E6C631 /* FeedbackViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FeedbackViewController.swift; sourceTree = "<group>"; };
|
||||
0BC141AB24305D9C00399FA8 /* NSMutableString + Extensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "NSMutableString + Extensions.swift"; sourceTree = "<group>"; };
|
||||
0BC141AD2430685800399FA8 /* UIColor + Extensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIColor + Extensions.swift"; sourceTree = "<group>"; };
|
||||
122AF4E79D17C983066C1CEB /* Pods-CovidSafe-staging.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-CovidSafe-staging.release.xcconfig"; path = "Target Support Files/Pods-CovidSafe-staging/Pods-CovidSafe-staging.release.xcconfig"; sourceTree = "<group>"; };
|
||||
1925EA5F4413AD52AC198894 /* Pods-CovidSafe.covid-production.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-CovidSafe.covid-production.xcconfig"; path = "Target Support Files/Pods-CovidSafe/Pods-CovidSafe.covid-production.xcconfig"; sourceTree = "<group>"; };
|
||||
1B86119024303EF200EA4B6B /* Question1ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Question1ViewController.swift; sourceTree = "<group>"; };
|
||||
1B86119224303F4A00EA4B6B /* Question2ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Question2ViewController.swift; sourceTree = "<group>"; };
|
||||
|
@ -342,7 +341,6 @@
|
|||
1B86119824303F9600EA4B6B /* Question2ErrorViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Question2ErrorViewController.swift; sourceTree = "<group>"; };
|
||||
1B86119A24303FA200EA4B6B /* Question3ErrorViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Question3ErrorViewController.swift; sourceTree = "<group>"; };
|
||||
1B86119C24303FC000EA4B6B /* QuestionUploadDataViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = QuestionUploadDataViewController.swift; sourceTree = "<group>"; };
|
||||
20A0AADA27329C83CFAB5A7C /* Pods-CovidSafe.covid-staging.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-CovidSafe.covid-staging.xcconfig"; path = "Target Support Files/Pods-CovidSafe/Pods-CovidSafe.covid-staging.xcconfig"; sourceTree = "<group>"; };
|
||||
2B916D8946F8A94E32E569C7 /* Pods-CovidSafe.covid-staging.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-CovidSafe.covid-staging.xcconfig"; path = "Target Support Files/Pods-CovidSafe/Pods-CovidSafe.covid-staging.xcconfig"; sourceTree = "<group>"; };
|
||||
30BE1CA923F108BA005DCE4F /* UploadFileData.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UploadFileData.swift; sourceTree = "<group>"; };
|
||||
30BE1CAE23F1349F005DCE4F /* EncounterRecord.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EncounterRecord.swift; sourceTree = "<group>"; };
|
||||
|
@ -350,12 +348,9 @@
|
|||
30BE1CB423F15D47005DCE4F /* OTPViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = OTPViewController.swift; sourceTree = "<group>"; };
|
||||
30E91BE823EFE514002D592A /* UploadDataVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UploadDataVC.swift; sourceTree = "<group>"; };
|
||||
30E91BEA23EFEA0B002D592A /* CodeInputView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CodeInputView.swift; sourceTree = "<group>"; };
|
||||
342FF717762F714E56F4412D /* Pods-CovidSafe.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-CovidSafe.release.xcconfig"; path = "Target Support Files/Pods-CovidSafe/Pods-CovidSafe.release.xcconfig"; sourceTree = "<group>"; };
|
||||
34E9EB96EA6E42A571E73C8E /* Pods_CovidSafe.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_CovidSafe.framework; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
39E21BD3842669F051A5D6D8 /* Pods-CovidSafe.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-CovidSafe.debug.xcconfig"; path = "Target Support Files/Pods-CovidSafe/Pods-CovidSafe.debug.xcconfig"; sourceTree = "<group>"; };
|
||||
3A403F07F3B7C5A94CBFC43D /* Pods-CovidSafe-staging.covid-staging.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-CovidSafe-staging.covid-staging.xcconfig"; path = "Target Support Files/Pods-CovidSafe-staging/Pods-CovidSafe-staging.covid-staging.xcconfig"; sourceTree = "<group>"; };
|
||||
46A5730925DA6B664DFE9546 /* Pods-CovidSafe-staging.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-CovidSafe-staging.debug.xcconfig"; path = "Target Support Files/Pods-CovidSafe-staging/Pods-CovidSafe-staging.debug.xcconfig"; sourceTree = "<group>"; };
|
||||
46D0C3F015CA753BB4D4787D /* Pods-CovidSafe-staging.covid-production.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-CovidSafe-staging.covid-production.xcconfig"; path = "Target Support Files/Pods-CovidSafe-staging/Pods-CovidSafe-staging.covid-production.xcconfig"; sourceTree = "<group>"; };
|
||||
49A22E09D113DF058C94C6E6 /* Pods-CovidSafe-staging.covid-staging.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-CovidSafe-staging.covid-staging.xcconfig"; path = "Target Support Files/Pods-CovidSafe-staging/Pods-CovidSafe-staging.covid-staging.xcconfig"; sourceTree = "<group>"; };
|
||||
5904A5C12462471A008C8012 /* EncounterV1toV2.xcmappingmodel */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcmappingmodel; path = EncounterV1toV2.xcmappingmodel; sourceTree = "<group>"; };
|
||||
5909E4AA245043C400D41C26 /* CovidPersistentContainer.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CovidPersistentContainer.swift; sourceTree = "<group>"; };
|
||||
|
@ -474,8 +469,6 @@
|
|||
5DD41D5223DD4CA400FD4AB0 /* PeripheralController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PeripheralController.swift; sourceTree = "<group>"; };
|
||||
5DD41D7823DE141700FD4AB0 /* Model.xcdatamodel */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcdatamodel; path = Model.xcdatamodel; sourceTree = "<group>"; };
|
||||
5DDB85EA23EE39C000B186BC /* Project Bluetrace.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = "Project Bluetrace.entitlements"; sourceTree = "<group>"; };
|
||||
679DE00E3E364DA756795844 /* Pods-CovidSafe.covid-production.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-CovidSafe.covid-production.xcconfig"; path = "Target Support Files/Pods-CovidSafe/Pods-CovidSafe.covid-production.xcconfig"; sourceTree = "<group>"; };
|
||||
6EBCA1AD6D10F8DF7BBDC660 /* Pods-CovidSafe.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-CovidSafe.debug.xcconfig"; path = "Target Support Files/Pods-CovidSafe/Pods-CovidSafe.debug.xcconfig"; sourceTree = "<group>"; };
|
||||
7F19B4DC23F565850071A11E /* PogoInstructionsViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PogoInstructionsViewController.swift; sourceTree = "<group>"; };
|
||||
7F2F0BA123EFFF75006D7404 /* OnboardingStep2ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OnboardingStep2ViewController.swift; sourceTree = "<group>"; };
|
||||
7F36305E23F7F81400CC6E1D /* PushNotificationConstants.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PushNotificationConstants.swift; sourceTree = "<group>"; };
|
||||
|
@ -522,7 +515,6 @@
|
|||
D8EB201A23FA722D001C60EC /* HelpNavController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HelpNavController.swift; sourceTree = "<group>"; };
|
||||
D8EB201C23FBE216001C60EC /* help_center_article_style.css */ = {isa = PBXFileReference; lastKnownFileType = text.css; path = help_center_article_style.css; sourceTree = "<group>"; };
|
||||
DC24373E23F51531007BDBDF /* covid-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "covid-Bridging-Header.h"; sourceTree = "<group>"; };
|
||||
E3B9CCF78D93EFF0EF2A0ADB /* Pods-CovidSafe-staging.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-CovidSafe-staging.debug.xcconfig"; path = "Target Support Files/Pods-CovidSafe-staging/Pods-CovidSafe-staging.debug.xcconfig"; sourceTree = "<group>"; };
|
||||
FB12C4C0242F047F007E893B /* RespondToAuthChallengeAPI.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RespondToAuthChallengeAPI.swift; sourceTree = "<group>"; };
|
||||
FB12C4C2242F0FE9007E893B /* GetTempIdAPI.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GetTempIdAPI.swift; sourceTree = "<group>"; };
|
||||
FB12C4C424304AF0007E893B /* OnboardingStep1aViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = OnboardingStep1aViewController.swift; sourceTree = "<group>"; };
|
||||
|
@ -954,14 +946,6 @@
|
|||
C1FDFBCD3FA29CDE38625AB0 /* Pods */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
20A0AADA27329C83CFAB5A7C /* Pods-CovidSafe.covid-staging.xcconfig */,
|
||||
679DE00E3E364DA756795844 /* Pods-CovidSafe.covid-production.xcconfig */,
|
||||
3A403F07F3B7C5A94CBFC43D /* Pods-CovidSafe-staging.covid-staging.xcconfig */,
|
||||
46D0C3F015CA753BB4D4787D /* Pods-CovidSafe-staging.covid-production.xcconfig */,
|
||||
6EBCA1AD6D10F8DF7BBDC660 /* Pods-CovidSafe.debug.xcconfig */,
|
||||
342FF717762F714E56F4412D /* Pods-CovidSafe.release.xcconfig */,
|
||||
E3B9CCF78D93EFF0EF2A0ADB /* Pods-CovidSafe-staging.debug.xcconfig */,
|
||||
122AF4E79D17C983066C1CEB /* Pods-CovidSafe-staging.release.xcconfig */,
|
||||
39E21BD3842669F051A5D6D8 /* Pods-CovidSafe.debug.xcconfig */,
|
||||
2B916D8946F8A94E32E569C7 /* Pods-CovidSafe.covid-staging.xcconfig */,
|
||||
03E2D9045555F5F013130375 /* Pods-CovidSafe.release.xcconfig */,
|
||||
|
@ -1643,7 +1627,7 @@
|
|||
CODE_SIGN_ENTITLEMENTS = "CovidSafe/Project Bluetrace.entitlements";
|
||||
CODE_SIGN_IDENTITY = "Apple Development";
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
CURRENT_PROJECT_VERSION = 80;
|
||||
CURRENT_PROJECT_VERSION = 83;
|
||||
DEVELOPMENT_TEAM = 45792XH5L8;
|
||||
INFOPLIST_FILE = "$(SRCROOT)/CovidSafe/Info.plist";
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
|
||||
|
@ -1651,7 +1635,7 @@
|
|||
"$(inherited)",
|
||||
"@executable_path/Frameworks",
|
||||
);
|
||||
MARKETING_VERSION = 1.13;
|
||||
MARKETING_VERSION = 1.14;
|
||||
ONLY_ACTIVE_ARCH = YES;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = au.gov.health.covidsafe;
|
||||
PRODUCT_NAME = COVIDSafe;
|
||||
|
@ -1727,7 +1711,7 @@
|
|||
CODE_SIGN_ENTITLEMENTS = "CovidSafe/Project Bluetrace.entitlements";
|
||||
CODE_SIGN_IDENTITY = "Apple Development";
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
CURRENT_PROJECT_VERSION = 80;
|
||||
CURRENT_PROJECT_VERSION = 83;
|
||||
DEVELOPMENT_TEAM = 45792XH5L8;
|
||||
INFOPLIST_FILE = "$(SRCROOT)/CovidSafe/Info.plist";
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
|
||||
|
@ -1735,7 +1719,7 @@
|
|||
"$(inherited)",
|
||||
"@executable_path/Frameworks",
|
||||
);
|
||||
MARKETING_VERSION = 1.13;
|
||||
MARKETING_VERSION = 1.14;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = au.gov.health.covidsafe;
|
||||
PRODUCT_NAME = COVIDSafe;
|
||||
PROVISIONING_PROFILE_SPECIFIER = "";
|
||||
|
@ -1755,7 +1739,7 @@
|
|||
CODE_SIGN_ENTITLEMENTS = "CovidSafe/Project Bluetrace.entitlements";
|
||||
CODE_SIGN_IDENTITY = "Apple Development";
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
CURRENT_PROJECT_VERSION = 80;
|
||||
CURRENT_PROJECT_VERSION = 83;
|
||||
DEVELOPMENT_TEAM = 45792XH5L8;
|
||||
INFOPLIST_FILE = "$(SRCROOT)/CovidSafe/Info.plist";
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
|
||||
|
@ -1763,7 +1747,7 @@
|
|||
"$(inherited)",
|
||||
"@executable_path/Frameworks",
|
||||
);
|
||||
MARKETING_VERSION = 1.13;
|
||||
MARKETING_VERSION = 1.14;
|
||||
ONLY_ACTIVE_ARCH = YES;
|
||||
OTHER_SWIFT_FLAGS = "$(inherited) -D COCOAPODS -D DEBUG";
|
||||
PRODUCT_BUNDLE_IDENTIFIER = au.gov.health.covidsafe;
|
||||
|
@ -1785,7 +1769,7 @@
|
|||
CODE_SIGN_ENTITLEMENTS = "CovidSafe/Project Bluetrace.entitlements";
|
||||
CODE_SIGN_IDENTITY = "Apple Development";
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
CURRENT_PROJECT_VERSION = 80;
|
||||
CURRENT_PROJECT_VERSION = 83;
|
||||
DEVELOPMENT_TEAM = 45792XH5L8;
|
||||
INFOPLIST_FILE = "$(SRCROOT)/CovidSafe/Info.plist";
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
|
||||
|
@ -1793,7 +1777,7 @@
|
|||
"$(inherited)",
|
||||
"@executable_path/Frameworks",
|
||||
);
|
||||
MARKETING_VERSION = 1.13;
|
||||
MARKETING_VERSION = 1.14;
|
||||
ONLY_ACTIVE_ARCH = YES;
|
||||
OTHER_SWIFT_FLAGS = "$(inherited) -D COCOAPODS -D DEBUG";
|
||||
PRODUCT_BUNDLE_IDENTIFIER = au.gov.health.covidsafe;
|
||||
|
@ -1815,7 +1799,7 @@
|
|||
CODE_SIGN_ENTITLEMENTS = "CovidSafe/Project Bluetrace.entitlements";
|
||||
CODE_SIGN_IDENTITY = "Apple Development";
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
CURRENT_PROJECT_VERSION = 80;
|
||||
CURRENT_PROJECT_VERSION = 83;
|
||||
DEVELOPMENT_TEAM = 45792XH5L8;
|
||||
INFOPLIST_FILE = "$(SRCROOT)/CovidSafe/Info.plist";
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
|
||||
|
@ -1823,7 +1807,7 @@
|
|||
"$(inherited)",
|
||||
"@executable_path/Frameworks",
|
||||
);
|
||||
MARKETING_VERSION = 1.13;
|
||||
MARKETING_VERSION = 1.14;
|
||||
OTHER_SWIFT_FLAGS = "$(inherited) -D COCOAPODS -D DEBUG";
|
||||
PRODUCT_BUNDLE_IDENTIFIER = au.gov.health.covidsafe;
|
||||
PRODUCT_MODULE_NAME = COVIDSafe;
|
||||
|
@ -1845,7 +1829,7 @@
|
|||
CODE_SIGN_ENTITLEMENTS = "CovidSafe/Project Bluetrace.entitlements";
|
||||
CODE_SIGN_IDENTITY = "Apple Development";
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
CURRENT_PROJECT_VERSION = 80;
|
||||
CURRENT_PROJECT_VERSION = 83;
|
||||
DEVELOPMENT_TEAM = 45792XH5L8;
|
||||
INFOPLIST_FILE = "$(SRCROOT)/CovidSafe/Info.plist";
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
|
||||
|
@ -1853,7 +1837,7 @@
|
|||
"$(inherited)",
|
||||
"@executable_path/Frameworks",
|
||||
);
|
||||
MARKETING_VERSION = 1.13;
|
||||
MARKETING_VERSION = 1.14;
|
||||
OTHER_SWIFT_FLAGS = "$(inherited) -D COCOAPODS -D DEBUG";
|
||||
PRODUCT_BUNDLE_IDENTIFIER = au.gov.health.covidsafe;
|
||||
PRODUCT_MODULE_NAME = COVIDSafe;
|
||||
|
@ -1993,7 +1977,7 @@
|
|||
CODE_SIGN_ENTITLEMENTS = "CovidSafe/Project Bluetrace.entitlements";
|
||||
CODE_SIGN_IDENTITY = "Apple Development";
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
CURRENT_PROJECT_VERSION = 80;
|
||||
CURRENT_PROJECT_VERSION = 83;
|
||||
DEVELOPMENT_TEAM = 45792XH5L8;
|
||||
INFOPLIST_FILE = "$(SRCROOT)/CovidSafe/Info.plist";
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
|
||||
|
@ -2001,7 +1985,7 @@
|
|||
"$(inherited)",
|
||||
"@executable_path/Frameworks",
|
||||
);
|
||||
MARKETING_VERSION = 1.13;
|
||||
MARKETING_VERSION = 1.14;
|
||||
ONLY_ACTIVE_ARCH = YES;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = au.gov.health.covidsafe;
|
||||
PRODUCT_NAME = COVIDSafe;
|
||||
|
@ -2021,7 +2005,7 @@
|
|||
CODE_SIGN_ENTITLEMENTS = "CovidSafe/Project Bluetrace.entitlements";
|
||||
CODE_SIGN_IDENTITY = "Apple Development";
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
CURRENT_PROJECT_VERSION = 80;
|
||||
CURRENT_PROJECT_VERSION = 83;
|
||||
DEVELOPMENT_TEAM = 45792XH5L8;
|
||||
INFOPLIST_FILE = "$(SRCROOT)/CovidSafe/Info.plist";
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
|
||||
|
@ -2029,7 +2013,7 @@
|
|||
"$(inherited)",
|
||||
"@executable_path/Frameworks",
|
||||
);
|
||||
MARKETING_VERSION = 1.13;
|
||||
MARKETING_VERSION = 1.14;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = au.gov.health.covidsafe;
|
||||
PRODUCT_NAME = COVIDSafe;
|
||||
PROVISIONING_PROFILE_SPECIFIER = "";
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
|
||||
import Foundation
|
||||
import Alamofire
|
||||
import KeychainSwift
|
||||
|
||||
final class CovidServerTrustManager: ServerTrustManager {
|
||||
override func serverTrustEvaluator(forHost host: String) throws -> ServerTrustEvaluating? {
|
||||
|
@ -45,3 +46,44 @@ enum APIError: Error {
|
|||
case ExpireSession
|
||||
case ServerError
|
||||
}
|
||||
|
||||
struct CovidSafeErrorResponse: Decodable {
|
||||
let message: String?
|
||||
}
|
||||
|
||||
enum CovidSafeAPIError: Error {
|
||||
case RequestError
|
||||
case ResponseError
|
||||
case ServerError
|
||||
case TokenExpiredError
|
||||
case UnknownError
|
||||
}
|
||||
|
||||
class CovidSafeAuthenticatedAPI {
|
||||
|
||||
static func authenticatedHeaders() throws -> HTTPHeaders? {
|
||||
let keychain = KeychainSwift()
|
||||
|
||||
guard let token = keychain.get("JWT_TOKEN") else {
|
||||
throw CovidSafeAPIError.TokenExpiredError
|
||||
}
|
||||
let headers: HTTPHeaders = [
|
||||
"Authorization": "Bearer \(token)"
|
||||
]
|
||||
return headers
|
||||
}
|
||||
|
||||
static func processUnauthorizedError(_ data: Data) -> CovidSafeAPIError {
|
||||
var errorType = CovidSafeAPIError.RequestError
|
||||
do {
|
||||
let errorResponse = try JSONDecoder().decode(CovidSafeErrorResponse.self, from: data)
|
||||
if errorResponse.message == "Unauthorized" {
|
||||
errorType = .TokenExpiredError
|
||||
}
|
||||
} catch {
|
||||
// unable to parse response
|
||||
errorType = .ResponseError
|
||||
}
|
||||
return errorType
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,25 +7,20 @@
|
|||
|
||||
import Foundation
|
||||
import Alamofire
|
||||
import KeychainSwift
|
||||
|
||||
class GetTempIdAPI {
|
||||
class GetTempIdAPI: CovidSafeAuthenticatedAPI {
|
||||
|
||||
private static let apiVersion = 2
|
||||
|
||||
static func getTempId(completion: @escaping (String?, Int?, Swift.Error?) -> Void) {
|
||||
let keychain = KeychainSwift()
|
||||
static func getTempId(completion: @escaping (String?, Int?, Swift.Error?, CovidSafeAPIError?) -> Void) {
|
||||
guard let apiHost = PlistHelper.getvalueFromInfoPlist(withKey: "API_Host", plistName: "CovidSafe-config") else {
|
||||
return
|
||||
}
|
||||
|
||||
guard let token = keychain.get("JWT_TOKEN") else {
|
||||
completion(nil, nil, nil)
|
||||
guard let headers = try? authenticatedHeaders() else {
|
||||
completion(nil, nil, nil, .TokenExpiredError)
|
||||
return
|
||||
}
|
||||
let headers: HTTPHeaders = [
|
||||
"Authorization": "Bearer \(token)"
|
||||
]
|
||||
let params = [
|
||||
"version" : apiVersion
|
||||
]
|
||||
|
@ -37,9 +32,17 @@ class GetTempIdAPI {
|
|||
switch response.result {
|
||||
case .success:
|
||||
guard let tempIdResponse = response.value else { return }
|
||||
completion(tempIdResponse.tempId, tempIdResponse.expiryTime, nil)
|
||||
completion(tempIdResponse.tempId, tempIdResponse.expiryTime, nil, nil)
|
||||
case let .failure(error):
|
||||
completion(nil, nil, error)
|
||||
guard let statusCode = response.response?.statusCode else {
|
||||
completion(nil, nil, error, .UnknownError)
|
||||
return
|
||||
}
|
||||
if statusCode == 401, let respData = response.data {
|
||||
completion(nil, nil, error, processUnauthorizedError(respData))
|
||||
return
|
||||
}
|
||||
completion(nil, nil, error, .ServerError)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,20 +7,19 @@
|
|||
|
||||
import Foundation
|
||||
import Alamofire
|
||||
import KeychainSwift
|
||||
|
||||
class MessageAPI {
|
||||
class MessageAPI: CovidSafeAuthenticatedAPI {
|
||||
|
||||
static let keyLastApiUpdate = "keyLastApiUpdate"
|
||||
static let keyLastVersionChecked = "keyLastVersionChecked"
|
||||
|
||||
static func getMessagesIfNeeded(completion: @escaping (MessageResponse?, MessageAPIError?) -> Void) {
|
||||
static func getMessagesIfNeeded(completion: @escaping (MessageResponse?, CovidSafeAPIError?) -> Void) {
|
||||
if shouldGetMessages() {
|
||||
getMessages(completion: completion)
|
||||
}
|
||||
}
|
||||
|
||||
static func getMessages(completion: @escaping (MessageResponse?, MessageAPIError?) -> Void) {
|
||||
static func getMessages(completion: @escaping (MessageResponse?, CovidSafeAPIError?) -> Void) {
|
||||
guard let token = UserDefaults.standard.string(forKey: "deviceTokenForAPN") else {
|
||||
completion(nil, .RequestError)
|
||||
return
|
||||
|
@ -82,20 +81,16 @@ class MessageAPI {
|
|||
}
|
||||
|
||||
private static func getMessages(msgRequest: MessageRequest,
|
||||
completion: @escaping (MessageResponse?, MessageAPIError?) -> Void) {
|
||||
let keychain = KeychainSwift()
|
||||
completion: @escaping (MessageResponse?, CovidSafeAPIError?) -> Void) {
|
||||
guard let apiHost = PlistHelper.getvalueFromInfoPlist(withKey: "API_Host", plistName: "CovidSafe-config") else {
|
||||
completion(nil, .RequestError)
|
||||
return
|
||||
}
|
||||
|
||||
guard let token = keychain.get("JWT_TOKEN") else {
|
||||
completion(nil, .RequestError)
|
||||
guard let headers = try? authenticatedHeaders() else {
|
||||
completion(nil, .TokenExpiredError)
|
||||
return
|
||||
}
|
||||
let headers: HTTPHeaders = [
|
||||
"Authorization": "Bearer \(token)"
|
||||
]
|
||||
|
||||
let preferredLanguages = Locale.preferredLanguages.count > 5 ? Locale.preferredLanguages[0...5].joined(separator: ",") : Locale.preferredLanguages.joined(separator: ",")
|
||||
|
||||
|
@ -138,11 +133,19 @@ class MessageAPI {
|
|||
completion(nil, .UnknownError)
|
||||
return
|
||||
}
|
||||
|
||||
if (statusCode == 200) {
|
||||
completion(nil, .ResponseError)
|
||||
return
|
||||
}
|
||||
|
||||
if statusCode == 401, let respData = response.data {
|
||||
completion(nil, processUnauthorizedError(respData))
|
||||
return
|
||||
}
|
||||
if (statusCode >= 400 && statusCode < 500) {
|
||||
completion(nil, .RequestError)
|
||||
return
|
||||
}
|
||||
completion(nil, .ServerError)
|
||||
}
|
||||
|
@ -183,10 +186,3 @@ struct Message: Decodable {
|
|||
case destination
|
||||
}
|
||||
}
|
||||
|
||||
enum MessageAPIError: Error {
|
||||
case RequestError
|
||||
case ResponseError
|
||||
case ServerError
|
||||
case UnknownError
|
||||
}
|
||||
|
|
|
@ -62,4 +62,5 @@ struct AuthResponse: Decodable {
|
|||
|
||||
protocol RegistrationHandler {
|
||||
var registrationInfo: RegistrationRequest? { get set }
|
||||
var reauthenticating: Bool { get set }
|
||||
}
|
||||
|
|
|
@ -7,26 +7,21 @@
|
|||
|
||||
import Foundation
|
||||
import Alamofire
|
||||
import KeychainSwift
|
||||
|
||||
class StatisticsAPI {
|
||||
class StatisticsAPI: CovidSafeAuthenticatedAPI {
|
||||
|
||||
static let keyCovidStatistics = "keyCovidStatistics"
|
||||
|
||||
static func getStatistics(completion: @escaping (StatisticsResponse?, MessageAPIError?) -> Void) {
|
||||
let keychain = KeychainSwift()
|
||||
static func getStatistics(completion: @escaping (StatisticsResponse?, CovidSafeAPIError?) -> Void) {
|
||||
guard let apiHost = PlistHelper.getvalueFromInfoPlist(withKey: "API_Host", plistName: "CovidSafe-config") else {
|
||||
completion(nil, .RequestError)
|
||||
return
|
||||
}
|
||||
|
||||
guard let token = keychain.get("JWT_TOKEN") else {
|
||||
completion(nil, .RequestError)
|
||||
guard let headers = try? authenticatedHeaders() else {
|
||||
completion(nil, .TokenExpiredError)
|
||||
return
|
||||
}
|
||||
let headers: HTTPHeaders = [
|
||||
"Authorization": "Bearer \(token)"
|
||||
]
|
||||
|
||||
CovidNetworking.shared.session.request("\(apiHost)/statistics",
|
||||
method: .get,
|
||||
|
@ -50,9 +45,17 @@ class StatisticsAPI {
|
|||
}
|
||||
if (statusCode == 200) {
|
||||
completion(lastStats, .ResponseError)
|
||||
return
|
||||
}
|
||||
|
||||
if statusCode == 401, let respData = response.data {
|
||||
completion(nil, processUnauthorizedError(respData))
|
||||
return
|
||||
}
|
||||
|
||||
if (statusCode >= 400 && statusCode < 500) {
|
||||
completion(lastStats, .RequestError)
|
||||
return
|
||||
}
|
||||
completion(lastStats, .ServerError)
|
||||
}
|
||||
|
|
|
@ -72,17 +72,15 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
|
|||
@objc
|
||||
func jwtExpired(_ notification: Notification) {
|
||||
DispatchQueue.main.async {
|
||||
guard let regVC = UIStoryboard(name: "Main", bundle: nil).instantiateViewController(withIdentifier: "onboardingStep3") as? PhoneNumberViewController else {
|
||||
guard let regVC = UIStoryboard(name: "Main", bundle: nil).instantiateViewController(withIdentifier: "personalDetails") as? PersonalDetailsViewController else {
|
||||
return
|
||||
}
|
||||
regVC.reauthenticating = true
|
||||
regVC.modalPresentationStyle = .overFullScreen
|
||||
regVC.modalTransitionStyle = .coverVertical
|
||||
let navigationController = UINavigationController(rootViewController: regVC)
|
||||
navigationController.setToolbarHidden(true, animated: false)
|
||||
if #available(iOS 13.0, *) {
|
||||
navigationController.isModalInPresentation = true
|
||||
}
|
||||
navigationController.isNavigationBarHidden = true
|
||||
navigationController.modalPresentationStyle = .overFullScreen
|
||||
navigationController.modalTransitionStyle = .coverVertical
|
||||
self.window?.topmostPresentedViewController?.present(navigationController, animated: true, completion: nil)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -37,9 +37,6 @@
|
|||
<fontDescription key="fontDescription" style="UICTFontTextStyleTitle1"/>
|
||||
<nil key="textColor"/>
|
||||
<nil key="highlightedColor"/>
|
||||
<userDefinedRuntimeAttributes>
|
||||
<userDefinedRuntimeAttribute type="string" keyPath="localizationKey" value="permission_success_headline"/>
|
||||
</userDefinedRuntimeAttributes>
|
||||
</label>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" usesAttributedText="YES" lineBreakMode="wordWrap" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="x1u-Qk-m74">
|
||||
<rect key="frame" x="32" y="311.66666666666669" width="350" height="64.666666666666686"/>
|
||||
|
@ -185,6 +182,7 @@
|
|||
<outlet property="pointOneLabel" destination="x1u-Qk-m74" id="MyD-Bn-oWp"/>
|
||||
<outlet property="pointThreeLabel" destination="04D-Hy-djY" id="aQ9-Fd-TYo"/>
|
||||
<outlet property="pointTwoLabel" destination="sHp-C7-xCZ" id="WXE-vT-GC5"/>
|
||||
<outlet property="titleLabel" destination="jCO-yx-Tur" id="9ed-Nc-Lbt"/>
|
||||
</connections>
|
||||
</viewController>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="SqF-IF-P8L" userLabel="First Responder" customClass="UIResponder" sceneMemberID="firstResponder"/>
|
||||
|
@ -194,7 +192,7 @@
|
|||
</connections>
|
||||
</tapGestureRecognizer>
|
||||
</objects>
|
||||
<point key="canvasLocation" x="-2980" y="3394"/>
|
||||
<point key="canvasLocation" x="-1630" y="2374"/>
|
||||
</scene>
|
||||
<!--Onboarding Step 1 View Controller-->
|
||||
<scene sceneID="26D-Zd-57d">
|
||||
|
@ -1088,6 +1086,7 @@ They will need to register using their own device and phone number so that COVID
|
|||
<outlet property="verifyButton" destination="lQY-RW-yBL" id="0Zf-Wz-kba"/>
|
||||
<outlet property="wrongNumberButton" destination="K7X-Ux-SAc" id="yCf-mF-ngh"/>
|
||||
<segue destination="eME-NJ-Fcz" kind="show" identifier="showAllowPermissionsFromOTPSegue" id="4eL-1Z-MtW"/>
|
||||
<segue destination="GaQ-f5-ei6" kind="show" identifier="showSuccessFromOTPSegue" id="dge-8I-Ehz"/>
|
||||
</connections>
|
||||
</viewController>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="0yd-3A-Qct" userLabel="First Responder" customClass="UIResponder" sceneMemberID="firstResponder"/>
|
||||
|
@ -2264,6 +2263,7 @@ See the COVIDSafe *privacy policy* for further details about your rights about y
|
|||
<inferredMetricsTieBreakers>
|
||||
<segue reference="bMl-IY-pjw"/>
|
||||
<segue reference="4eL-1Z-MtW"/>
|
||||
<segue reference="dge-8I-Ehz"/>
|
||||
</inferredMetricsTieBreakers>
|
||||
<resources>
|
||||
<image name="AppPermissions1" width="311" height="188"/>
|
||||
|
|
|
@ -74,7 +74,7 @@ class CovidStatisticsViewController: UITableViewController {
|
|||
|
||||
// MARK: Process data for the table
|
||||
|
||||
func setupData(statistics: StatisticsResponse?, errorType: MessageAPIError?, hasInternet: Bool) {
|
||||
func setupData(statistics: StatisticsResponse?, errorType: CovidSafeAPIError?, hasInternet: Bool) {
|
||||
showInternetError = false
|
||||
showError = false
|
||||
showRefresh = false
|
||||
|
@ -189,7 +189,7 @@ class CovidStatisticsViewController: UITableViewController {
|
|||
dateFormatter.timeStyle = .short
|
||||
headerView.dateLabelContainer.isHidden = false
|
||||
headerView.dateLabelDivider.isHidden = false
|
||||
headerView.dateLabel.text = "\(dateFormatter.string(from: updateDate)) AEST"
|
||||
headerView.dateLabel.text = "\(dateFormatter.string(from: updateDate))"
|
||||
} else {
|
||||
headerView.dateLabelContainer.isHidden = true
|
||||
headerView.dateLabelDivider.isHidden = true
|
||||
|
|
|
@ -46,10 +46,10 @@
|
|||
<rect key="frame" x="0.0" y="111" width="414" height="702"/>
|
||||
<subviews>
|
||||
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="eTh-XD-RKI" userLabel="ContentView">
|
||||
<rect key="frame" x="0.0" y="0.0" width="414" height="736.5"/>
|
||||
<rect key="frame" x="0.0" y="0.0" width="414" height="797.5"/>
|
||||
<subviews>
|
||||
<stackView opaque="NO" contentMode="scaleToFill" axis="vertical" spacing="8" translatesAutoresizingMaskIntoConstraints="NO" id="vW3-bA-wgt">
|
||||
<rect key="frame" x="0.0" y="0.0" width="414" height="736.5"/>
|
||||
<rect key="frame" x="0.0" y="0.0" width="414" height="797.5"/>
|
||||
<subviews>
|
||||
<view contentMode="scaleToFill" verticalCompressionResistancePriority="250" translatesAutoresizingMaskIntoConstraints="NO" id="T1Q-yS-0Qz">
|
||||
<rect key="frame" x="0.0" y="0.0" width="414" height="14.5"/>
|
||||
|
@ -498,6 +498,34 @@
|
|||
<constraint firstItem="vVm-e2-Qef" firstAttribute="leading" secondItem="lI5-dG-ihI" secondAttribute="leading" constant="16" id="tYZ-d5-vWt"/>
|
||||
</constraints>
|
||||
</view>
|
||||
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="TLN-pP-2n9">
|
||||
<rect key="frame" x="0.0" y="744.5" width="414" height="1"/>
|
||||
<color key="backgroundColor" white="0.33333333329999998" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="height" constant="1" id="lJS-eQ-wih"/>
|
||||
</constraints>
|
||||
</view>
|
||||
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="ipc-oI-MqM">
|
||||
<rect key="frame" x="0.0" y="753.5" width="414" height="44"/>
|
||||
<subviews>
|
||||
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="oyo-xa-V5o">
|
||||
<rect key="frame" x="16" y="0.0" width="194" height="44"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="height" constant="44" id="XBh-fU-uLK"/>
|
||||
</constraints>
|
||||
<state key="normal" title="Set reauthentication needed"/>
|
||||
<connections>
|
||||
<action selector="setReauthenticationNeeded:" destination="dhe-6o-fvJ" eventType="touchUpInside" id="Iwa-z0-GbI"/>
|
||||
</connections>
|
||||
</button>
|
||||
</subviews>
|
||||
<color key="backgroundColor" systemColor="systemBackgroundColor"/>
|
||||
<constraints>
|
||||
<constraint firstItem="oyo-xa-V5o" firstAttribute="top" secondItem="ipc-oI-MqM" secondAttribute="top" id="PfS-sc-Wfr"/>
|
||||
<constraint firstAttribute="bottom" secondItem="oyo-xa-V5o" secondAttribute="bottom" id="gjW-vL-8tw"/>
|
||||
<constraint firstItem="oyo-xa-V5o" firstAttribute="leading" secondItem="ipc-oI-MqM" secondAttribute="leading" constant="16" id="vJc-Uw-JWi"/>
|
||||
</constraints>
|
||||
</view>
|
||||
</subviews>
|
||||
</stackView>
|
||||
</subviews>
|
||||
|
|
|
@ -109,7 +109,7 @@ class EncounterMessageManager {
|
|||
|
||||
private func fetchTempIdFromApi(onComplete: ((Error?, (String, Date)?) -> Void)?) {
|
||||
DLog("Fetching tempId from API")
|
||||
GetTempIdAPI.getTempId { (tempId: String?, expiry: Int?, error: Error?) in
|
||||
GetTempIdAPI.getTempId { (tempId: String?, expiry: Int?, error: Error?, covidSafeError: CovidSafeAPIError?) in
|
||||
guard error == nil else {
|
||||
if let error = error as NSError? {
|
||||
let code = error.code
|
||||
|
@ -119,6 +119,13 @@ class EncounterMessageManager {
|
|||
} else {
|
||||
DLog("Cloud function error, unable to convert error to NSError.\(error!)")
|
||||
}
|
||||
|
||||
if covidSafeError == .TokenExpiredError {
|
||||
UserDefaults.standard.set(true, forKey: "ReauthenticationNeededKey")
|
||||
onComplete?(CovidSafeAPIError.TokenExpiredError, nil)
|
||||
return
|
||||
}
|
||||
|
||||
// if we have an existing tempid and expiry, use that
|
||||
if let msg = self.tempId, let exp = self.advertisementPayloadExpiry {
|
||||
onComplete?(nil, (msg, exp))
|
||||
|
|
|
@ -19,9 +19,13 @@
|
|||
<outlet property="covidActiveLabel" destination="rMJ-xf-l8j" id="LUF-bC-A7I"/>
|
||||
<outlet property="covidInactiveLabel" destination="uOm-Hj-Pyl" id="0f4-KJ-XRB"/>
|
||||
<outlet property="covidStatisticsContainer" destination="eZl-C5-gSv" id="37c-CV-VgS"/>
|
||||
<outlet property="covidStatisticsSection" destination="Aop-Ae-hRv" id="Qpd-Hv-uA8"/>
|
||||
<outlet property="inactiveAppSectionView" destination="784-Jf-kOX" id="J3m-Pu-697"/>
|
||||
<outlet property="inactiveSettingsContent" destination="AUW-C2-ven" id="NNP-o9-zkK"/>
|
||||
<outlet property="inactiveTokenExpiredView" destination="nxM-ji-ttb" id="vVC-KW-yek"/>
|
||||
<outlet property="pairingRequestsLabel" destination="EF2-ER-Q6h" id="Wx5-bg-Rp3"/>
|
||||
<outlet property="scrollView" destination="Lws-gT-pWp" id="pTG-Kh-B9T"/>
|
||||
<outlet property="shareView" destination="vs9-rS-UOM" id="eoj-sn-TkG"/>
|
||||
<outlet property="statisticsSectionHeight" destination="BpM-8d-yWh" id="gPp-kU-EAb"/>
|
||||
<outlet property="uploadDataContentLabel" destination="udc-5x-b89" id="qiw-l1-4ws"/>
|
||||
<outlet property="uploadDataTitleLabel" destination="LO0-2K-qsB" id="xOQ-Cm-GyE"/>
|
||||
|
@ -78,6 +82,11 @@
|
|||
<action selector="onPositiveButtonTapped:" destination="-1" id="SdI-H0-KO5"/>
|
||||
</connections>
|
||||
</tapGestureRecognizer>
|
||||
<tapGestureRecognizer id="xlt-MW-Dxl" userLabel="RegisterAgainTapped">
|
||||
<connections>
|
||||
<action selector="registerAgainTapped:" destination="-1" id="iT3-kG-Moh"/>
|
||||
</connections>
|
||||
</tapGestureRecognizer>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
|
||||
<view contentMode="scaleToFill" id="eRJ-sP-D5g">
|
||||
<rect key="frame" x="0.0" y="0.0" width="414" height="2166"/>
|
||||
|
@ -156,19 +165,19 @@
|
|||
</constraints>
|
||||
</view>
|
||||
<stackView opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" axis="vertical" translatesAutoresizingMaskIntoConstraints="NO" id="h36-8c-K2n">
|
||||
<rect key="frame" x="0.0" y="120" width="414" height="1461"/>
|
||||
<rect key="frame" x="0.0" y="120" width="414" height="1566.5"/>
|
||||
<subviews>
|
||||
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="bRs-XW-qzv" userLabel="StatusView">
|
||||
<rect key="frame" x="0.0" y="0.0" width="414" height="682.5"/>
|
||||
<rect key="frame" x="0.0" y="0.0" width="414" height="764"/>
|
||||
<subviews>
|
||||
<stackView opaque="NO" contentMode="scaleToFill" axis="vertical" translatesAutoresizingMaskIntoConstraints="NO" id="rcS-nL-IAO">
|
||||
<rect key="frame" x="0.0" y="0.0" width="414" height="658.5"/>
|
||||
<rect key="frame" x="0.0" y="0.0" width="414" height="752"/>
|
||||
<subviews>
|
||||
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="784-Jf-kOX" userLabel="InactiveView">
|
||||
<rect key="frame" x="0.0" y="0.0" width="414" height="458.5"/>
|
||||
<rect key="frame" x="0.0" y="0.0" width="414" height="552"/>
|
||||
<subviews>
|
||||
<stackView opaque="NO" contentMode="scaleToFill" axis="vertical" spacing="1" translatesAutoresizingMaskIntoConstraints="NO" id="xti-6W-zko" userLabel="Inactive Stack View">
|
||||
<rect key="frame" x="0.0" y="0.0" width="414" height="458.5"/>
|
||||
<rect key="frame" x="0.0" y="0.0" width="414" height="552"/>
|
||||
<subviews>
|
||||
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="4fe-SU-8Q6" userLabel="InActiveHeader">
|
||||
<rect key="frame" x="0.0" y="0.0" width="414" height="81"/>
|
||||
|
@ -201,10 +210,10 @@
|
|||
</constraints>
|
||||
</view>
|
||||
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="AUW-C2-ven" userLabel="App Permission Label View">
|
||||
<rect key="frame" x="0.0" y="82" width="414" height="192.5"/>
|
||||
<rect key="frame" x="0.0" y="82" width="414" height="204.5"/>
|
||||
<subviews>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" text="COVIDSafe won't work without the right settings. " textAlignment="natural" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontForContentSizeCategory="YES" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="f6I-eD-3rn">
|
||||
<rect key="frame" x="16" y="16" width="382" height="160.5"/>
|
||||
<rect key="frame" x="16" y="16" width="382" height="172.5"/>
|
||||
<fontDescription key="fontDescription" style="UICTFontTextStyleCallout"/>
|
||||
<nil key="textColor"/>
|
||||
<nil key="highlightedColor"/>
|
||||
|
@ -221,8 +230,71 @@
|
|||
<constraint firstItem="f6I-eD-3rn" firstAttribute="top" secondItem="AUW-C2-ven" secondAttribute="top" constant="16" id="uCJ-Kd-QuD"/>
|
||||
</constraints>
|
||||
</view>
|
||||
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="nxM-ji-ttb" userLabel="Token Expired View">
|
||||
<rect key="frame" x="0.0" y="287.5" width="414" height="80.5"/>
|
||||
<subviews>
|
||||
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="reL-DQ-aFx" userLabel="Token Expired Bar">
|
||||
<rect key="frame" x="0.0" y="0.0" width="414" height="80.5"/>
|
||||
<subviews>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Please register again" textAlignment="natural" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontForContentSizeCategory="YES" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="hQT-g2-g4k">
|
||||
<rect key="frame" x="16" y="16" width="181.5" height="25"/>
|
||||
<fontDescription key="fontDescription" style="UICTFontTextStyleTitle3"/>
|
||||
<color key="textColor" red="0.63921568630000003" green="0.098039215690000001" blue="0.098039215690000001" alpha="1" colorSpace="calibratedRGB"/>
|
||||
<nil key="highlightedColor"/>
|
||||
<userDefinedRuntimeAttributes>
|
||||
<userDefinedRuntimeAttribute type="string" keyPath="localizationKey" value="jwt_heading"/>
|
||||
</userDefinedRuntimeAttributes>
|
||||
</label>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="There is an issue with your registration details." textAlignment="natural" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontForContentSizeCategory="YES" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="fG1-LS-JxP">
|
||||
<rect key="frame" x="16" y="45" width="350" height="19.5"/>
|
||||
<accessibility key="accessibilityConfiguration">
|
||||
<bool key="isElement" value="NO"/>
|
||||
</accessibility>
|
||||
<fontDescription key="fontDescription" style="UICTFontTextStyleCallout"/>
|
||||
<color key="textColor" red="0.63921568630000003" green="0.098039215690000001" blue="0.098039215690000001" alpha="1" colorSpace="calibratedRGB"/>
|
||||
<nil key="highlightedColor"/>
|
||||
<userDefinedRuntimeAttributes>
|
||||
<userDefinedRuntimeAttribute type="string" keyPath="localizationKey" value="jwt_description"/>
|
||||
</userDefinedRuntimeAttributes>
|
||||
</label>
|
||||
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="chevron-right-red" highlightedImage="redcross" translatesAutoresizingMaskIntoConstraints="NO" id="Zoa-St-s4c">
|
||||
<rect key="frame" x="374" y="16" width="24" height="24"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="width" constant="24" id="5h3-EF-i7d"/>
|
||||
<constraint firstAttribute="height" constant="24" id="ls4-ff-eSW"/>
|
||||
</constraints>
|
||||
</imageView>
|
||||
</subviews>
|
||||
<color key="backgroundColor" systemColor="systemBackgroundColor"/>
|
||||
<constraints>
|
||||
<constraint firstItem="fG1-LS-JxP" firstAttribute="top" secondItem="hQT-g2-g4k" secondAttribute="bottom" constant="4" id="89M-oF-ErN"/>
|
||||
<constraint firstItem="hQT-g2-g4k" firstAttribute="top" secondItem="reL-DQ-aFx" secondAttribute="top" constant="16" id="C6Q-oy-HSQ"/>
|
||||
<constraint firstItem="Zoa-St-s4c" firstAttribute="top" secondItem="reL-DQ-aFx" secondAttribute="top" constant="16" id="JlK-GI-TLi"/>
|
||||
<constraint firstAttribute="bottom" secondItem="fG1-LS-JxP" secondAttribute="bottom" constant="16" id="QRA-JG-lDX"/>
|
||||
<constraint firstAttribute="trailing" secondItem="fG1-LS-JxP" secondAttribute="trailing" constant="48" id="Qd4-oi-rEZ"/>
|
||||
<constraint firstItem="Zoa-St-s4c" firstAttribute="leading" relation="greaterThanOrEqual" secondItem="hQT-g2-g4k" secondAttribute="trailing" constant="8" id="S07-8D-EuB"/>
|
||||
<constraint firstItem="hQT-g2-g4k" firstAttribute="leading" secondItem="reL-DQ-aFx" secondAttribute="leading" constant="16" id="gL5-qv-Vkj"/>
|
||||
<constraint firstItem="fG1-LS-JxP" firstAttribute="leading" secondItem="reL-DQ-aFx" secondAttribute="leading" constant="16" id="ocs-8s-kDK"/>
|
||||
<constraint firstAttribute="trailing" secondItem="Zoa-St-s4c" secondAttribute="trailing" constant="16" id="zMU-6u-Qdt"/>
|
||||
</constraints>
|
||||
<connections>
|
||||
<outletCollection property="gestureRecognizers" destination="xlt-MW-Dxl" appends="YES" id="huE-gQ-FJ1"/>
|
||||
</connections>
|
||||
</view>
|
||||
</subviews>
|
||||
<accessibility key="accessibilityConfiguration" label="Bluetooth permissions off">
|
||||
<accessibilityTraits key="traits" button="YES"/>
|
||||
<bool key="isElement" value="YES"/>
|
||||
</accessibility>
|
||||
<constraints>
|
||||
<constraint firstItem="reL-DQ-aFx" firstAttribute="leading" secondItem="nxM-ji-ttb" secondAttribute="leading" id="DNN-Va-LUA"/>
|
||||
<constraint firstItem="reL-DQ-aFx" firstAttribute="top" secondItem="nxM-ji-ttb" secondAttribute="top" id="Ima-na-Ido"/>
|
||||
<constraint firstAttribute="trailing" secondItem="reL-DQ-aFx" secondAttribute="trailing" id="lQ8-Y0-qyx"/>
|
||||
<constraint firstAttribute="bottom" secondItem="reL-DQ-aFx" secondAttribute="bottom" id="qeE-Hu-OAb"/>
|
||||
</constraints>
|
||||
</view>
|
||||
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="a5D-xk-n0n" userLabel="Bluetooth Permission Off Section">
|
||||
<rect key="frame" x="0.0" y="275.5" width="414" height="80.5"/>
|
||||
<rect key="frame" x="0.0" y="369" width="414" height="80.5"/>
|
||||
<subviews>
|
||||
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="ZoL-pC-0bR" userLabel="Bluetooth Permission Off Bar">
|
||||
<rect key="frame" x="0.0" y="0.0" width="414" height="80.5"/>
|
||||
|
@ -293,7 +365,7 @@
|
|||
</connections>
|
||||
</view>
|
||||
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="ers-f9-BFH" userLabel="Bluetooth Status Off Section">
|
||||
<rect key="frame" x="0.0" y="357" width="414" height="101.5"/>
|
||||
<rect key="frame" x="0.0" y="450.5" width="414" height="101.5"/>
|
||||
<subviews>
|
||||
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="p5d-dk-foR" userLabel="Bluetooth Status Bar Off">
|
||||
<rect key="frame" x="0.0" y="0.0" width="414" height="101.5"/>
|
||||
|
@ -371,7 +443,7 @@
|
|||
</constraints>
|
||||
</view>
|
||||
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="m1D-93-7sF" userLabel="ActiveView">
|
||||
<rect key="frame" x="0.0" y="458.5" width="414" height="200"/>
|
||||
<rect key="frame" x="0.0" y="552" width="414" height="200"/>
|
||||
<subviews>
|
||||
<stackView opaque="NO" contentMode="scaleToFill" axis="vertical" spacing="1" translatesAutoresizingMaskIntoConstraints="NO" id="981-Cd-Xm3" userLabel="Active Stack View">
|
||||
<rect key="frame" x="0.0" y="0.0" width="414" height="200"/>
|
||||
|
@ -483,27 +555,38 @@
|
|||
</stackView>
|
||||
</subviews>
|
||||
<constraints>
|
||||
<constraint firstAttribute="bottom" secondItem="rcS-nL-IAO" secondAttribute="bottom" constant="24" id="JPm-Iq-0ld"/>
|
||||
<constraint firstAttribute="bottom" secondItem="rcS-nL-IAO" secondAttribute="bottom" constant="12" id="JPm-Iq-0ld"/>
|
||||
<constraint firstItem="rcS-nL-IAO" firstAttribute="top" secondItem="bRs-XW-qzv" secondAttribute="top" id="O4a-lq-CQv"/>
|
||||
<constraint firstAttribute="trailing" secondItem="rcS-nL-IAO" secondAttribute="trailing" id="ecY-Dd-693"/>
|
||||
<constraint firstItem="rcS-nL-IAO" firstAttribute="leading" secondItem="bRs-XW-qzv" secondAttribute="leading" id="oHN-Ig-LSm"/>
|
||||
</constraints>
|
||||
</view>
|
||||
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="Aop-Ae-hRv" userLabel="StatisticsViewSection">
|
||||
<rect key="frame" x="0.0" y="764" width="414" height="124"/>
|
||||
<subviews>
|
||||
<view clipsSubviews="YES" contentMode="scaleToFill" verticalHuggingPriority="1" translatesAutoresizingMaskIntoConstraints="NO" id="eZl-C5-gSv" userLabel="StatisticsView">
|
||||
<rect key="frame" x="0.0" y="682.5" width="414" height="100"/>
|
||||
<rect key="frame" x="0.0" y="12" width="414" height="100"/>
|
||||
<color key="backgroundColor" systemColor="systemBackgroundColor"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="height" constant="100" id="BpM-8d-yWh"/>
|
||||
</constraints>
|
||||
</view>
|
||||
</subviews>
|
||||
<constraints>
|
||||
<constraint firstItem="eZl-C5-gSv" firstAttribute="leading" secondItem="Aop-Ae-hRv" secondAttribute="leading" id="6OA-I5-xlw"/>
|
||||
<constraint firstAttribute="bottom" secondItem="eZl-C5-gSv" secondAttribute="bottom" constant="12" id="TWw-7W-jqh"/>
|
||||
<constraint firstAttribute="trailing" secondItem="eZl-C5-gSv" secondAttribute="trailing" id="bQo-JX-udj"/>
|
||||
<constraint firstItem="eZl-C5-gSv" firstAttribute="top" secondItem="Aop-Ae-hRv" secondAttribute="top" constant="12" id="gSc-tN-WXE"/>
|
||||
</constraints>
|
||||
</view>
|
||||
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="9cE-NC-A20" userLabel="Help">
|
||||
<rect key="frame" x="0.0" y="782.5" width="414" height="153"/>
|
||||
<rect key="frame" x="0.0" y="888" width="414" height="153"/>
|
||||
<subviews>
|
||||
<view clipsSubviews="YES" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="co1-dK-1WU">
|
||||
<rect key="frame" x="0.0" y="24" width="414" height="117"/>
|
||||
<rect key="frame" x="0.0" y="12" width="414" height="129"/>
|
||||
<subviews>
|
||||
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="l5t-Qr-RVi" userLabel="Help topics">
|
||||
<rect key="frame" x="0.0" y="0.0" width="414" height="117"/>
|
||||
<rect key="frame" x="0.0" y="0.0" width="414" height="129"/>
|
||||
<subviews>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Help topics" textAlignment="natural" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" minimumScaleFactor="0.5" adjustsFontForContentSizeCategory="YES" translatesAutoresizingMaskIntoConstraints="NO" id="jVQ-W4-wBu">
|
||||
<rect key="frame" x="72" y="16" width="302" height="24"/>
|
||||
|
@ -529,7 +612,7 @@
|
|||
</constraints>
|
||||
</imageView>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="If you have issues or questions about the app." textAlignment="natural" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontForContentSizeCategory="YES" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="CPI-2b-Hmb">
|
||||
<rect key="frame" x="72" y="40" width="302" height="61"/>
|
||||
<rect key="frame" x="72" y="40" width="302" height="73"/>
|
||||
<accessibility key="accessibilityConfiguration">
|
||||
<accessibilityTraits key="traits" none="YES"/>
|
||||
<bool key="isElement" value="NO"/>
|
||||
|
@ -625,12 +708,12 @@
|
|||
<constraints>
|
||||
<constraint firstAttribute="bottom" secondItem="co1-dK-1WU" secondAttribute="bottom" constant="12" id="4w8-R7-BDK"/>
|
||||
<constraint firstItem="co1-dK-1WU" firstAttribute="leading" secondItem="9cE-NC-A20" secondAttribute="leading" id="ZyR-zR-Hzk"/>
|
||||
<constraint firstItem="co1-dK-1WU" firstAttribute="top" secondItem="9cE-NC-A20" secondAttribute="top" constant="24" id="gRj-Wk-s6U"/>
|
||||
<constraint firstItem="co1-dK-1WU" firstAttribute="top" secondItem="9cE-NC-A20" secondAttribute="top" constant="12" id="gRj-Wk-s6U"/>
|
||||
<constraint firstAttribute="trailing" secondItem="co1-dK-1WU" secondAttribute="trailing" id="jMu-zb-CUh"/>
|
||||
</constraints>
|
||||
</view>
|
||||
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="7cN-DY-lc3" userLabel="Change language">
|
||||
<rect key="frame" x="0.0" y="935.5" width="414" height="153"/>
|
||||
<rect key="frame" x="0.0" y="1041" width="414" height="153"/>
|
||||
<subviews>
|
||||
<view clipsSubviews="YES" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="bE9-gT-Hba">
|
||||
<rect key="frame" x="0.0" y="12" width="414" height="129"/>
|
||||
|
@ -763,7 +846,7 @@
|
|||
</constraints>
|
||||
</view>
|
||||
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="vs9-rS-UOM" userLabel="Share CovidSafe">
|
||||
<rect key="frame" x="0.0" y="1088.5" width="414" height="151"/>
|
||||
<rect key="frame" x="0.0" y="1194" width="414" height="151"/>
|
||||
<subviews>
|
||||
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="RCa-zU-3Vo">
|
||||
<rect key="frame" x="0.0" y="12" width="414" height="127"/>
|
||||
|
@ -874,7 +957,7 @@
|
|||
</constraints>
|
||||
</view>
|
||||
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="JSe-D6-hyV" userLabel="Upload Data">
|
||||
<rect key="frame" x="0.0" y="1239.5" width="414" height="165.5"/>
|
||||
<rect key="frame" x="0.0" y="1345" width="414" height="165.5"/>
|
||||
<subviews>
|
||||
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="8pS-Df-p0U">
|
||||
<rect key="frame" x="0.0" y="12" width="414" height="141.5"/>
|
||||
|
@ -994,7 +1077,7 @@
|
|||
</constraints>
|
||||
</view>
|
||||
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="eZ2-CQ-dtQ" userLabel="Version View">
|
||||
<rect key="frame" x="0.0" y="1405" width="414" height="56"/>
|
||||
<rect key="frame" x="0.0" y="1510.5" width="414" height="56"/>
|
||||
<subviews>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Version number:" textAlignment="center" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="O1w-Sl-OIH" userLabel="Version">
|
||||
<rect key="frame" x="16" y="12" width="382" height="20"/>
|
||||
|
@ -1046,6 +1129,7 @@
|
|||
<resources>
|
||||
<image name="ChevronRight" width="24" height="24"/>
|
||||
<image name="ShareApp" width="24" height="24"/>
|
||||
<image name="chevron-right-red" width="24" height="24"/>
|
||||
<image name="chevron-right-white" width="24" height="24"/>
|
||||
<image name="exclamation_red_white" width="24" height="24"/>
|
||||
<image name="exclamation_white_red" width="24" height="24"/>
|
||||
|
|
|
@ -6,9 +6,12 @@ import Reachability
|
|||
|
||||
class HomeViewController: UIViewController {
|
||||
private var observer: NSObjectProtocol?
|
||||
private let reauthenticationNeededKey = "ReauthenticationNeededKey"
|
||||
|
||||
@IBOutlet weak var bluetoothStatusOffView: UIView!
|
||||
@IBOutlet weak var bluetoothPermissionOffView: UIView!
|
||||
@IBOutlet weak var inactiveSettingsContent: UIView!
|
||||
@IBOutlet weak var inactiveTokenExpiredView: UIView!
|
||||
@IBOutlet weak var shareView: UIView!
|
||||
@IBOutlet weak var inactiveAppSectionView: UIView!
|
||||
@IBOutlet weak var activeAppSectionView: UIView!
|
||||
|
@ -24,6 +27,7 @@ class HomeViewController: UIViewController {
|
|||
@IBOutlet weak var appActiveSubtitleLabel: UILabel!
|
||||
@IBOutlet weak var uploadDataContentLabel: UILabel!
|
||||
@IBOutlet weak var uploadDataTitleLabel: UILabel!
|
||||
@IBOutlet weak var covidStatisticsSection: UIView!
|
||||
@IBOutlet weak var covidStatisticsContainer: UIView!
|
||||
@IBOutlet weak var contentStackView: UIStackView!
|
||||
@IBOutlet weak var statisticsSectionHeight: NSLayoutConstraint!
|
||||
|
@ -36,6 +40,11 @@ class HomeViewController: UIViewController {
|
|||
let covidStatisticsViewController: CovidStatisticsViewController = CovidStatisticsViewController(nibName: "CovidStatisticsView", bundle: nil)
|
||||
|
||||
var allPermissionOn = true
|
||||
|
||||
var registrationNeeded: Bool {
|
||||
return UserDefaults.standard.bool(forKey: reauthenticationNeededKey)
|
||||
}
|
||||
|
||||
var bluetoothStatusOn = true
|
||||
var bluetoothPermissionOn = true
|
||||
var pushNotificationOn = true
|
||||
|
@ -247,6 +256,9 @@ class HomeViewController: UIViewController {
|
|||
self?.toggleHeaderView()
|
||||
self?.toggleUploadView()
|
||||
self?.toggleUploadDateView()
|
||||
self?.toggleShareView()
|
||||
self?.toggleStatisticsView()
|
||||
self?.toggleRegistrationNeededView()
|
||||
}
|
||||
})
|
||||
}
|
||||
|
@ -323,20 +335,33 @@ class HomeViewController: UIViewController {
|
|||
}
|
||||
|
||||
fileprivate func toggleUploadView() {
|
||||
toggleViewVisibility(view: self.uploadView, isVisible: !self.didUploadData)
|
||||
toggleViewVisibility(view: self.uploadView, isVisible: !self.didUploadData && !self.registrationNeeded)
|
||||
}
|
||||
|
||||
fileprivate func toggleShareView() {
|
||||
toggleViewVisibility(view: shareView, isVisible: !registrationNeeded)
|
||||
}
|
||||
|
||||
fileprivate func toggleStatisticsView() {
|
||||
toggleViewVisibility(view: covidStatisticsSection, isVisible: !registrationNeeded)
|
||||
}
|
||||
|
||||
fileprivate func toggleHeaderView() {
|
||||
toggleViewVisibility(view: inactiveAppSectionView, isVisible: !self.allPermissionOn)
|
||||
toggleViewVisibility(view: inactiveAppSectionView, isVisible: !self.allPermissionOn || registrationNeeded)
|
||||
toggleViewVisibility(view: inactiveSettingsContent, isVisible: !self.allPermissionOn && !registrationNeeded)
|
||||
toggleViewVisibility(view: activeAppSectionView, isVisible: self.allPermissionOn)
|
||||
}
|
||||
|
||||
fileprivate func toggleBluetoothStatusView() {
|
||||
toggleViewVisibility(view: bluetoothStatusOffView, isVisible: self.bluetoothPermissionOn && !self.bluetoothStatusOn)
|
||||
toggleViewVisibility(view: bluetoothStatusOffView, isVisible: self.bluetoothPermissionOn && !self.bluetoothStatusOn && !registrationNeeded)
|
||||
}
|
||||
|
||||
fileprivate func toggleBluetoothPermissionStatusView() {
|
||||
toggleViewVisibility(view: bluetoothPermissionOffView, isVisible: !self.allPermissionOn && !self.bluetoothPermissionOn)
|
||||
toggleViewVisibility(view: bluetoothPermissionOffView, isVisible: !self.allPermissionOn && !self.bluetoothPermissionOn && !registrationNeeded)
|
||||
}
|
||||
|
||||
fileprivate func toggleRegistrationNeededView() {
|
||||
toggleViewVisibility(view: inactiveTokenExpiredView, isVisible: registrationNeeded)
|
||||
}
|
||||
|
||||
func attemptTurnOnBluetooth() {
|
||||
|
@ -387,12 +412,19 @@ class HomeViewController: UIViewController {
|
|||
present(disclaimerAlert, animated: true, completion: nil)
|
||||
}
|
||||
|
||||
// MARK: API calls
|
||||
func showTokenExpiredMessage() {
|
||||
UserDefaults.standard.set(true, forKey: reauthenticationNeededKey)
|
||||
toggleViews()
|
||||
}
|
||||
|
||||
// MARK: API calls
|
||||
func getMessagesFromServer(force: Bool = false, completion: @escaping () -> Void = {}) {
|
||||
let onMessagesDone: (MessageResponse?, Swift.Error?) -> Void = { (messageResponse, error) in
|
||||
let onMessagesDone: (MessageResponse?, CovidSafeAPIError?) -> Void = { (messageResponse, error) in
|
||||
if let error = error {
|
||||
DLog("Get messages error: \(error.localizedDescription)")
|
||||
if error == .TokenExpiredError {
|
||||
self.showTokenExpiredMessage()
|
||||
}
|
||||
completion()
|
||||
return
|
||||
}
|
||||
|
@ -426,8 +458,18 @@ class HomeViewController: UIViewController {
|
|||
if covidStatisticsViewController.showStatistics {
|
||||
self.covidStatisticsViewController.isLoading = true
|
||||
StatisticsAPI.getStatistics { (stats, error) in
|
||||
if error != nil {
|
||||
switch error {
|
||||
case .TokenExpiredError:
|
||||
self.showTokenExpiredMessage()
|
||||
default:
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
self.covidStatisticsViewController.isLoading = false
|
||||
self.covidStatisticsViewController.setupData(statistics: stats, errorType: error, hasInternet: self.isInternetReachable())
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -523,6 +565,19 @@ class HomeViewController: UIViewController {
|
|||
navigationController?.pushViewController(settingsVC, animated: true)
|
||||
}
|
||||
|
||||
@IBAction func registerAgainTapped(_ sender: Any) {
|
||||
guard let regVC = UIStoryboard(name: "Main", bundle: nil).instantiateViewController(withIdentifier: "personalDetails") as? PersonalDetailsViewController else {
|
||||
return
|
||||
}
|
||||
regVC.reauthenticating = true
|
||||
let navigationController = UINavigationController(rootViewController: regVC)
|
||||
navigationController.setToolbarHidden(true, animated: false)
|
||||
navigationController.isNavigationBarHidden = true
|
||||
navigationController.modalPresentationStyle = .fullScreen
|
||||
navigationController.modalTransitionStyle = .coverVertical
|
||||
present(navigationController, animated: true, completion: nil)
|
||||
}
|
||||
|
||||
@objc
|
||||
func appWillResignActive(_ notification: Notification) {
|
||||
self.lottieBluetoothView?.stop()
|
||||
|
|
|
@ -163,4 +163,9 @@ final class InfoViewController: UIViewController {
|
|||
@IBAction func resetDisclaimerUpdateMessage(_ sender: Any) {
|
||||
UserDefaults.standard.removeObject(forKey: "latestPolicyUpdateVersionShown")
|
||||
}
|
||||
|
||||
@IBAction func setReauthenticationNeeded(_ sender: Any) {
|
||||
let keychain = KeychainSwift()
|
||||
keychain.set("corruptedjwt", forKey: "JWT_TOKEN", withAccess: .accessibleAfterFirstUnlock)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -80,15 +80,12 @@ class OTPViewController: UIViewController, RegistrationHandler {
|
|||
let pinIssuesString = NSLocalizedString("ReceivePinIssue", comment: "Text for pin receive issues button")
|
||||
let pinIssuesText = NSAttributedString(string: pinIssuesString, attributes: buttonAtt)
|
||||
self.pinIssuesButton?.setAttributedTitle(pinIssuesText, for: .normal)
|
||||
if reauthenticating {
|
||||
stepCounterLabel.text = String.localizedStringWithFormat( "stepCounter".localizedString(), 2, 2)
|
||||
} else {
|
||||
|
||||
stepCounterLabel.text = String.localizedStringWithFormat( "stepCounter".localizedString(),
|
||||
3,
|
||||
UserDefaults.standard.bool(forKey: "allowedPermissions") ? 3 : 4
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
override func viewWillAppear(_ animated: Bool) {
|
||||
super.viewWillAppear(animated)
|
||||
|
@ -245,6 +242,7 @@ class OTPViewController: UIViewController, RegistrationHandler {
|
|||
let keychain = KeychainSwift()
|
||||
keychain.set(tokenToStore, forKey: "JWT_TOKEN", withAccess: .accessibleAfterFirstUnlock)
|
||||
UserDefaults.standard.set(true, forKey: "HasUpdatedKeychainAccess")
|
||||
UserDefaults.standard.set(false, forKey: "ReauthenticationNeededKey")
|
||||
result(.Success)
|
||||
}
|
||||
}
|
||||
|
@ -271,7 +269,8 @@ class OTPViewController: UIViewController, RegistrationHandler {
|
|||
}
|
||||
case .Success:
|
||||
if (self.reauthenticating) {
|
||||
self.dismiss(animated: true, completion: nil)
|
||||
viewController.performSegue(withIdentifier: "showSuccessFromOTPSegue", sender: self)
|
||||
// self.dismiss(animated: true, completion: nil)
|
||||
return
|
||||
}
|
||||
if !UserDefaults.standard.bool(forKey: "allowedPermissions") {
|
||||
|
@ -285,5 +284,11 @@ class OTPViewController: UIViewController, RegistrationHandler {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
|
||||
if let successVC = segue.destination as? OnboardingStep2bViewController {
|
||||
successVC.reauthenticating = true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -12,6 +12,9 @@ class OnboardingStep2bViewController: UIViewController {
|
|||
@IBOutlet weak var pointOneLabel: UILabel!
|
||||
@IBOutlet weak var pointTwoLabel: UILabel!
|
||||
@IBOutlet weak var pointThreeLabel: UILabel!
|
||||
@IBOutlet weak var titleLabel: UILabel!
|
||||
|
||||
var reauthenticating = false
|
||||
|
||||
override func viewDidLoad() {
|
||||
super.viewDidLoad()
|
||||
|
@ -21,6 +24,8 @@ class OnboardingStep2bViewController: UIViewController {
|
|||
.paragraphStyle: paragraphStyle,
|
||||
.font: UIFont.preferredFont(forTextStyle: .body)
|
||||
]
|
||||
let titleText = reauthenticating ? "jwt_success".localizedString(comment: "Title when JWT renewed") : "permission_success_headline".localizedString(comment: "Title when not refreshing JWT toek")
|
||||
titleLabel.text = titleText
|
||||
let pointOneText = NSAttributedString(string: NSLocalizedString("OS2b_Item1", comment: "Keep phone on you when you leave home"),
|
||||
attributes: labelAtt)
|
||||
pointOneLabel.attributedText = pointOneText
|
||||
|
@ -53,7 +58,11 @@ class OnboardingStep2bViewController: UIViewController {
|
|||
}
|
||||
|
||||
@IBAction func continueBtnTapped(_ sender: UIButton) {
|
||||
if reauthenticating {
|
||||
dismiss(animated: true, completion: nil)
|
||||
} else {
|
||||
let homeVC = HomeViewController(nibName: "HomeView", bundle: nil)
|
||||
self.navigationController?.setViewControllers([homeVC], animated: true)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -34,6 +34,7 @@ class PersonalDetailsViewController: UIViewController, UITextFieldDelegate, UIPi
|
|||
let ages = ["0 - 15", "16 - 29", "30 - 39", "40 - 49", "50 - 59", "60 - 69", "70 - 79", "80 - 89", "90+"]
|
||||
var initialLabelTextColour: UIColor?
|
||||
var initialTextFieldBorderColour: UIColor?
|
||||
var reauthenticating: Bool = false
|
||||
|
||||
override func viewDidLoad() {
|
||||
super.viewDidLoad()
|
||||
|
@ -323,8 +324,12 @@ class PersonalDetailsViewController: UIViewController, UITextFieldDelegate, UIPi
|
|||
}
|
||||
|
||||
@IBAction func onBackTapped(_ sender: UIButton) {
|
||||
if reauthenticating {
|
||||
dismiss(animated: true, completion: nil)
|
||||
} else {
|
||||
self.navigationController?.popViewController(animated: true)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@IBAction func continueOnTapped(_ sender: Any) {
|
||||
|
@ -382,6 +387,7 @@ class PersonalDetailsViewController: UIViewController, UITextFieldDelegate, UIPi
|
|||
if var vc = segue.destination as? RegistrationHandler {
|
||||
let regInfo = RegistrationRequest(fullName: fullName, postcode: postcode, age: age, isMinor: age < 16, phoneNumber: "")
|
||||
vc.registrationInfo = regInfo
|
||||
vc.reauthenticating = self.reauthenticating
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -78,20 +78,11 @@ class PhoneNumberViewController: UIViewController, UITextFieldDelegate, Registra
|
|||
initialTextFieldBorderColour = phoneNumberField.borderColor
|
||||
navigationController?.view.backgroundColor = UIColor.white
|
||||
|
||||
if reauthenticating {
|
||||
backButton.isHidden = true
|
||||
registrationInfo = RegistrationRequest(fullName: "", postcode: "", age: 20, isMinor: false, phoneNumber: "")
|
||||
stepCounterLabel.text = String.localizedStringWithFormat( "stepCounter".localizedString(),
|
||||
1,
|
||||
2
|
||||
)
|
||||
} else {
|
||||
stepCounterLabel.text = String.localizedStringWithFormat( "stepCounter".localizedString(),
|
||||
2,
|
||||
UserDefaults.standard.bool(forKey: "allowedPermissions") ? 3 : 4
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@IBAction func onBackTapped(_ sender: UIButton) {
|
||||
self.navigationController?.popViewController(animated: true)
|
||||
|
@ -160,7 +151,7 @@ class PhoneNumberViewController: UIViewController, UITextFieldDelegate, Registra
|
|||
}
|
||||
|
||||
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
|
||||
if let vc = segue.destination as? OTPViewController {
|
||||
if var vc = segue.destination as? RegistrationHandler {
|
||||
vc.reauthenticating = self.reauthenticating
|
||||
vc.registrationInfo = self.registrationInfo
|
||||
}
|
||||
|
|
|
@ -12,6 +12,8 @@ import SafariServices
|
|||
class UnderSixteenViewController: UIViewController, RegistrationHandler {
|
||||
|
||||
public var registrationInfo: RegistrationRequest?
|
||||
public var reauthenticating: Bool = false
|
||||
|
||||
@IBOutlet weak var stepCounterLabel: UILabel!
|
||||
|
||||
override func viewDidLoad() {
|
||||
|
|
|
@ -315,6 +315,7 @@
|
|||
"invalid_norfolk_island_phone_number_error_prompt" = "تتألف أرقام الهواتف المحمولة في جزيرة نورفولك من 5 إلى 6 أرقام.";
|
||||
"jwt_description" = "هناك مشكلة في تفاصيل التسجيل الخاصة بك.";
|
||||
"jwt_heading" = "يرجى التسجيل مرة أخرى";
|
||||
"jwt_success" = "";
|
||||
"loading_numbers" = "تحميل أحدث الأرقام";
|
||||
/* Splash Screen */
|
||||
"migration_in_progress" = "تحديث تطبيق COVIDSafe قيد الإنجاز. \n\nيُرجى التأكد من عدم إغلاق هاتفك إلى أن يتم اكتمال التحديث.";
|
||||
|
|
|
@ -315,6 +315,7 @@
|
|||
"invalid_norfolk_island_phone_number_error_prompt" = "Οι αριθμοί κινητής τηλεφωνίας στο νησί Νόρφολκ περιέχουν 5 έως 6 ψηφία.";
|
||||
"jwt_description" = "Υπάρχει ένα πρόβλημα με τα στοιχεία εγγραφής σας.";
|
||||
"jwt_heading" = "Παρακαλούμε εγγραφείτε ξανά";
|
||||
"jwt_success" = "";
|
||||
"loading_numbers" = "Φόρτωση τελευταίων αριθμών";
|
||||
/* Splash Screen */
|
||||
"migration_in_progress" = "Η ενημέρωση της COVIDSafe συνεχίζεται. \n\nΒεβαιωθείτε ότι το τηλέφωνό σας δεν είναι απενεργοποιημένο έως ότου ολοκληρωθεί η ενημέρωση.";
|
||||
|
|
|
@ -315,6 +315,7 @@
|
|||
"invalid_norfolk_island_phone_number_error_prompt" = "Mobile numbers in Norfolk Island contain 5 to 6 digits.";
|
||||
"jwt_description" = "There is an issue with your registration details.";
|
||||
"jwt_heading" = "Please register again";
|
||||
"jwt_success" = "Registration successfully renewed";
|
||||
"loading_numbers" = "Loading latest numbers";
|
||||
/* Splash Screen */
|
||||
"migration_in_progress" = " COVIDSafe update in progress. \n\n Please make sure you phone is not switched off until the update is complete.";
|
||||
|
|
|
@ -315,6 +315,7 @@
|
|||
"invalid_norfolk_island_phone_number_error_prompt" = "I numeri di cellulare nell'Isola di Norfolk contengono da 5 a 6 cifre.";
|
||||
"jwt_description" = "C'è un problema con i dati di registrazione.";
|
||||
"jwt_heading" = "Si prega di registrarsi di nuovo";
|
||||
"jwt_success" = "";
|
||||
"loading_numbers" = "Caricamento degli ultimi numeri";
|
||||
/* Splash Screen */
|
||||
"migration_in_progress" = "Aggiornamento COVIDSafe in corso. \n\nAssicurarsi che il cellulare non sia spento fino al completamento dell'aggiornamento.";
|
||||
|
|
|
@ -315,6 +315,7 @@
|
|||
"invalid_norfolk_island_phone_number_error_prompt" = "노퍽 섬의 휴대폰 번호는 5-6자리입니다.";
|
||||
"jwt_description" = "등록 세부 정보에 문제가 있습니다.";
|
||||
"jwt_heading" = "다시 등록하십시오";
|
||||
"jwt_success" = "";
|
||||
"loading_numbers" = "최신 번호 로드 중";
|
||||
/* Splash Screen */
|
||||
"migration_in_progress" = "COVIDSafe 업데이트 진행 중. \n\n업데이트가 완료될 때까지 휴대폰이 꺼지지 않도록 해주세요.";
|
||||
|
|
|
@ -315,6 +315,7 @@
|
|||
"invalid_norfolk_island_phone_number_error_prompt" = "ਨੋਰਫੋਕ ਆਈਲੈਂਡਜ਼ ਵਿਖੇ ਮੋਬਾਈਲ ਨੰਬਰਾਂ ਦੇ 5 ਤੋਂ 6 ਅੰਕ ਹੁੰਦੇ ਹਨ।";
|
||||
"jwt_description" = "ਤੁਹਾਡੇ ਪੰਜੀਕਰਨ (ਰਜ਼ਿਸਟ੍ਰੇਸ਼ਨ) ਦੇ ਵਿਸਥਾਰਾਂ ਵਿੱਚ ਕੋਈ ਸਮੱਸਿਆ ਹੈ।";
|
||||
"jwt_heading" = "ਕਿਰਪਾ ਕਰਕੇ ਦੁਬਾਰਾ ਰਜਿਸਟਰ ਕਰੋ";
|
||||
"jwt_success" = "";
|
||||
"loading_numbers" = "ਤਾਜ਼ਾ ਅੰਕੜੇ ਲੋਡ ਕੀਤੇ ਜਾ ਰਹੇ ਹਨ";
|
||||
/* Splash Screen */
|
||||
"migration_in_progress" = "COVIDSafe ਅੱਪਡੇਟ ਚੱਲ ਰਿਹਾ ਹੈ। \n\nਕਿਰਪਾ ਕਰਕੇ ਯਕੀਨੀ ਬਣਾਓ ਕਿ ਤੁਹਾਡਾ ਫ਼ੋਨ ਤਦ ਤੱਕ ਬੰਦ ਨਹੀਂ ਹੋਣਾ ਚਾਹੀਦਾ ਜਦ ਤੱਕ ਅੱਪਡੇਟ ਪੂਰਾ ਨਹੀਂ ਹੋ ਜਾਂਦਾ।";
|
||||
|
|
|
@ -315,6 +315,7 @@
|
|||
"invalid_norfolk_island_phone_number_error_prompt" = "Norfolk Adası'ndaki cep telefonu numaraları 5 ila 6 rakam içerir.";
|
||||
"jwt_description" = "Kayıt bilgilerinizle ilgili bir sorun var.";
|
||||
"jwt_heading" = "Lütfen tekrar kayıt olun";
|
||||
"jwt_success" = "";
|
||||
"loading_numbers" = "En son sayılar yükleniyor";
|
||||
/* Splash Screen */
|
||||
"migration_in_progress" = " COVIDSafe güncellemesi devam ediyor. \n\n Lütfen güncelleme tamamlanana kadar telefonunuzu kapatmayın.";
|
||||
|
|
|
@ -315,6 +315,7 @@
|
|||
"invalid_norfolk_island_phone_number_error_prompt" = "Số điện thoại di động ở Đảo Norfolk chứa từ 5 đến 6 chữ số.";
|
||||
"jwt_description" = "Có vấn đề với thông tin đăng ký của bạn.";
|
||||
"jwt_heading" = "Vui lòng đăng ký lại";
|
||||
"jwt_success" = "";
|
||||
"loading_numbers" = "Đang tải các số mới nhất";
|
||||
/* Splash Screen */
|
||||
"migration_in_progress" = "COVIDSafe trong tiến trình cập nhật. \n\nVui lòng đảm bảo điện thoại của bạn không bị tắt cho đến khi cập nhật hoàn tất.";
|
||||
|
|
|
@ -315,6 +315,7 @@
|
|||
"invalid_norfolk_island_phone_number_error_prompt" = "诺福克岛的手机号码包含5到6位数。";
|
||||
"jwt_description" = "您的注册信息存在问题。";
|
||||
"jwt_heading" = "请重新注册";
|
||||
"jwt_success" = "";
|
||||
"loading_numbers" = "正在加载最新统计数字";
|
||||
/* Splash Screen */
|
||||
"migration_in_progress" = "COVIDSafe正在更新。 \n\n请保持开机状态直至更新完成。";
|
||||
|
|
|
@ -315,6 +315,7 @@
|
|||
"invalid_norfolk_island_phone_number_error_prompt" = "諾福克島的手機號碼是個5至6位數字。";
|
||||
"jwt_description" = "你的註冊詳情存在問題。";
|
||||
"jwt_heading" = "請重新註冊。";
|
||||
"jwt_success" = "";
|
||||
"loading_numbers" = "正在載入最新統計數字";
|
||||
/* Splash Screen */
|
||||
"migration_in_progress" = "正在更新 COVIDSafe。\n\n請保持開機狀態直至更新完成為止。";
|
||||
|
|
Loading…
Reference in a new issue