Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
140 changes: 127 additions & 13 deletions Covid.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

47 changes: 47 additions & 0 deletions Covid/AdditionalInfo/IdentityViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,13 @@ import SwiftyUserDefaults
final class IdentityViewController: ViewController {
@IBOutlet private var uploadDataView: UIView!

private var faceCaptureCoordinator: FaceCaptureCoordinator?

override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
uploadDataView.isHidden = Defaults.covidPass == nil
uploadDataView.layer.cornerRadius = 20
uploadDataView.layer.masksToBounds = true

navigationController?.navigationBar.isHidden = true
}
Expand All @@ -52,4 +56,47 @@ final class IdentityViewController: ViewController {
uploadDataView.layer.cornerRadius = 20
uploadDataView.layer.masksToBounds = true
}

@IBAction private func showCovidPass(_ sender: Any) {
showFaceVerification()
}

private func showCovidPass(in navigationController: UINavigationController) {
guard let viewController = UIStoryboard.controller(ofType: CovidPassViewController.self) else {
return
}

navigationController.pushViewController(viewController, animated: true)
}
}

// MARK: Border crossing
extension IdentityViewController {

private func showFaceVerification() {
faceCaptureCoordinator = FaceCaptureCoordinator(useCase: .borderCrossing)
let viewController = faceCaptureCoordinator!.startFaceCapture()
let navigationController = UINavigationController(rootViewController: viewController)
navigationController.modalPresentationStyle = .fullScreen
faceCaptureCoordinator?.navigationController = navigationController

faceCaptureCoordinator?.onAlert = { alertControler in
navigationController.present(alertControler, animated: true, completion: nil)
}
faceCaptureCoordinator?.onCoordinatorResolution = { [weak self ] result in

switch result {
case .success(let isSuccess):
if isSuccess {
self?.showCovidPass(in: navigationController)
return
}
case .failure:
break
}
navigationController.dismiss(animated: true, completion: nil)
}
present(navigationController, animated: true, completion: nil)
}

}
70 changes: 45 additions & 25 deletions Covid/AppDelegate.swift
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
/*-
* Copyright (c) 2020 Sygic
*
* Copyright (c) 2020 Sygic
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* copies or substantial portions of the Software.
*
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
*/
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
*/

//
// AppDelegate.swift
Expand All @@ -30,6 +30,7 @@

import UIKit
import SwiftyUserDefaults
import FirebaseDynamicLinks
import FirebaseCore
import FirebaseCrashlytics
import FirebaseAnalytics
Expand Down Expand Up @@ -145,6 +146,25 @@ final class AppDelegate: UIResponder, UIApplicationDelegate {
}
return nil
}

func application(_ application: UIApplication,
continue userActivity: NSUserActivity,
restorationHandler: @escaping ([UIUserActivityRestoring]?) -> Void) -> Bool {
let handled = DynamicLinks.dynamicLinks().handleUniversalLink(userActivity.webpageURL!) { [weak self] (dynamiclink, _) in
guard dynamiclink != nil,
let url = userActivity.webpageURL else {
return
}
self?.handleRandomCheckIfNeeded(for: url)
}

return handled
}

private func handleRandomCheckIfNeeded(for url: URL) {
guard url.absoluteString.contains("overenie") else { return }
NotificationCenter.default.post(name: .startRandomCheck, object: self)
}
}

extension AppDelegate: MessagingDelegate {
Expand All @@ -169,13 +189,13 @@ extension AppDelegate {
remoteConfig.configSettings = settings
remoteConfig.setDefaults(defaults)
remoteConfig.fetch { (status, error) -> Void in
if status == .success {
print("Config fetched!")
self.remoteConfig?.activate { _ in }
} else {
print("Config not fetched")
print("Error: \(error?.localizedDescription ?? "No error available.")")
}
if status == .success {
print("Config fetched!")
self.remoteConfig?.activate { _ in }
} else {
print("Config not fetched")
print("Error: \(error?.localizedDescription ?? "No error available.")")
}
}
}
}
Expand Down
Loading