Skip to content
This repository has been archived by the owner on Dec 30, 2022. It is now read-only.

Commit

Permalink
feat: eu dgc implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
sebaker88 authored Jun 9, 2021
1 parent 3c266e8 commit cfb1bc8
Show file tree
Hide file tree
Showing 68 changed files with 6,834 additions and 62 deletions.
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ version: 2.1
# Shared settings
settings:
xcode: &xcode_version
xcode: "11.7.0"
xcode: "12.5.0"

# Custom commands
commands:
Expand Down
86 changes: 84 additions & 2 deletions App/Application/AppNavigation.swift
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,11 @@ enum Screen: String, CaseIterable {
case home
case fixActiveService
case suggestions
case greenCertificate
case generateGreenCertificate
case greenCertificateVaccineDetail
case greenCertificateRecoveryDetail
case greenCertificateTestDetail

// settings
case settings
Expand Down Expand Up @@ -89,6 +94,9 @@ extension AppDelegate {

case .chooseDataUploadMode:
mainViewController = HomeNC(store: self.store)

case .greenCertificate:
mainViewController = HomeNC(store: self.store)

default:
AppLogger.fatalError("Root screen not handled: \(rootScreen.rawValue)")
Expand Down Expand Up @@ -131,7 +139,7 @@ extension WelcomeVC: RoutableWithConfiguration {
let localState = context as? PermissionTutorialLS ?? AppLogger.fatalError("Invalid context")
return PermissionTutorialVC(store: self.store, localState: localState)
},

.hide(Screen.permissionTutorial): .dismissModally(behaviour: .hard),
.hide(Screen.privacy): .dismissModally(behaviour: .hard)
]
Expand Down Expand Up @@ -373,6 +381,11 @@ extension HomeVC: RoutableWithConfiguration {

return FixActiveService(with: self.store, navigationContext: navigationContext)
},
.show(Screen.confirmation): .presentModally { context in
let localState = context as? ConfirmationLS ?? AppLogger.fatalError("Invalid context")
return ConfirmationVC(store: self.store, localState: localState)
},


.hide(Screen.fixActiveService): .dismissModally(behaviour: .hard)
]
Expand Down Expand Up @@ -503,10 +516,33 @@ extension HomeNC: RoutableWithConfiguration {
.show(Screen.chooseDataUploadMode): .push { _ in
return ChooseDataUploadModeVC(store: self.store, localState: ChooseDataUploadModeLS())
},


.show(Screen.greenCertificate): .push { _ in
return GreenCertificateVC(store: self.store, localState: GreenCertificateLS())
},
.show(Screen.greenCertificateVaccineDetail): .presentModally { context in
let ls = context as? GreenCertificateVaccineDetailLS ?? AppLogger.fatalError("invalid context")
return GreenCertificateVaccineDetailVC(store: self.store, localState: ls)
},
.show(Screen.greenCertificateRecoveryDetail): .presentModally { context in
let ls = context as? GreenCertificateRecoveryDetailLS ?? AppLogger.fatalError("invalid context")
return GreenCertificateRecoveryDetailVC(store: self.store, localState: ls)
},
.show(Screen.greenCertificateTestDetail): .presentModally { context in
let ls = context as? GreenCertificateTestDetailLS ?? AppLogger.fatalError("invalid context")
return GreenCertificateTestDetailVC(store: self.store, localState: ls)
},
.show(Screen.generateGreenCertificate): .push { _ in
return GenerateGreenCertificateVC(store: self.store, localState: GenerateGreenCertificateLS())
},
.hide(Screen.uploadData): .pop,
.hide(Screen.chooseDataUploadMode): .pop,
.hide(Screen.uploadDataAutonomous): .pop,
.hide(Screen.greenCertificate): .pop,
.hide(Screen.generateGreenCertificate): .pop,
.hide(Screen.greenCertificateVaccineDetail): .dismissModally(behaviour: .hard),
.hide(Screen.greenCertificateRecoveryDetail): .dismissModally(behaviour: .hard),
.hide(Screen.greenCertificateTestDetail): .dismissModally(behaviour: .hard),

]
}
Expand Down Expand Up @@ -542,6 +578,52 @@ extension ChooseDataUploadModeVC: RoutableWithConfiguration {
}
}

extension GreenCertificateVC: RoutableWithConfiguration {
var routeIdentifier: RouteElementIdentifier {
return Screen.greenCertificate.rawValue
}

var navigationConfiguration: [NavigationRequest: NavigationInstruction] {
return [:]
}
}
extension GenerateGreenCertificateVC: RoutableWithConfiguration {
var routeIdentifier: RouteElementIdentifier {
return Screen.generateGreenCertificate.rawValue
}

var navigationConfiguration: [NavigationRequest: NavigationInstruction] {
return [:]
}
}
extension GreenCertificateVaccineDetailVC: RoutableWithConfiguration {
var routeIdentifier: RouteElementIdentifier {
return Screen.greenCertificateVaccineDetail.rawValue
}

var navigationConfiguration: [NavigationRequest: NavigationInstruction] {
return [:]
}
}
extension GreenCertificateRecoveryDetailVC: RoutableWithConfiguration {
var routeIdentifier: RouteElementIdentifier {
return Screen.greenCertificateRecoveryDetail.rawValue
}

var navigationConfiguration: [NavigationRequest: NavigationInstruction] {
return [:]
}
}
extension GreenCertificateTestDetailVC: RoutableWithConfiguration {
var routeIdentifier: RouteElementIdentifier {
return Screen.greenCertificateTestDetail.rawValue
}

var navigationConfiguration: [NavigationRequest: NavigationInstruction] {
return [:]
}
}

extension ConfirmUploadVC: RoutableWithConfiguration {
var routeIdentifier: RouteElementIdentifier {
return Screen.confirmUpload.rawValue
Expand Down
26 changes: 26 additions & 0 deletions App/Logic/CovidStatusLogic.swift
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,32 @@ extension Logic.CovidStatus {
Logic.CovidStatus.RiskNotificationID.contactReminder.rawValue,
Logic.CovidStatus.PositiveNotificationID.updateStatus.rawValue
]
/// Updates the user Green Certificate
struct UpdateGreenCertificate: AppStateUpdater {
let newGreenCertificate: GreenCertificate

func updateState(_ state: inout AppState) {
if let dgcs = state.user.greenCertificates {
if dgcs.filter({ $0.id == newGreenCertificate.id }).count == 0 {
state.user.greenCertificates?.append(newGreenCertificate)
}
}
else{
state.user.greenCertificates = [newGreenCertificate]
}
}
}
/// Delete the user Green Certificate
struct DeleteGreenCertificate: AppStateUpdater {

let id: String

func updateState(_ state: inout AppState) {
if let dgcs = state.user.greenCertificates {
state.user.greenCertificates = dgcs.filter({ $0.id != id })
}
}
}
}

// MARK: Neutral Logic
Expand Down
Loading

0 comments on commit cfb1bc8

Please sign in to comment.