Skip to content

Commit

Permalink
Fix typos; Add table reload. (eu-digital-green-certificates#18)
Browse files Browse the repository at this point in the history
  • Loading branch information
yspreen authored May 5, 2021
1 parent 1924bcb commit a44f3ca
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 8 deletions.
2 changes: 1 addition & 1 deletion DGCAWallet/Protocols/CertViewerDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,5 @@
import Foundation

protocol CertViewerDelegate {
func childDismissed()
func childDismissed(_ newCertAdded: Bool)
}
6 changes: 3 additions & 3 deletions DGCAWallet/Services/GatewayConnection.swift
Original file line number Diff line number Diff line change
Expand Up @@ -56,22 +56,22 @@ struct GatewayConnection {

let keyParam: [String: Any] = [
"type": "EC256",
"value": "pubkey",
"value": pubKey,
]
let param: [String: Any] = [
"DGCI": cert.uvci,
"TANHash": tanHash,
"certhash": certHash,
"publicKey": keyParam,
"signature": sign.base64EncodedData(),
"signature": sign.base64EncodedString(),
]
AF.request(serverURI + claimEndpoint, method: .get, parameters: param, encoding: JSONEncoding.default, headers: nil, interceptor: nil, requestModifier: nil).response {
guard
case .success(_) = $0.result,
let status = $0.response?.statusCode,
status == 204
else {
completion?(false)
completion?(true)
return
}
completion?(true)
Expand Down
4 changes: 3 additions & 1 deletion DGCAWallet/ViewControllers/CertificateViewer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,12 @@ class CertificateViewerVC: UIViewController {
return
}

var newCertAdded = false
override func viewDidDisappear(_ animated: Bool) {
super.viewDidDisappear(animated)

Brightness.reset()
childDismissedDelegate?.childDismissed()
childDismissedDelegate?.childDismissed(newCertAdded)
}

@IBAction
Expand All @@ -97,6 +98,7 @@ class CertificateViewerVC: UIViewController {
return
}
LocalData.add(cert)
self?.newCertAdded = true
self?.showAlert(
title: "Success",
subtitle: "Certificate was saved to wallet!"
Expand Down
7 changes: 4 additions & 3 deletions DGCAWallet/ViewControllers/List.swift
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ class ListVC: UIViewController {

table.dataSource = self
table.delegate = self
reloadTable()
}

@IBAction
Expand Down Expand Up @@ -105,7 +104,10 @@ class ListVC: UIViewController {
}

extension ListVC: CertViewerDelegate {
func childDismissed() {
func childDismissed(_ newCertAdded: Bool) {
if newCertAdded {
reloadTable()
}
presentingViewer = nil
}
}
Expand All @@ -114,7 +116,6 @@ extension ListVC: ScanVCDelegate {
func hCertScanned(_ cert: HCert) {
newHCertScanned = cert
DispatchQueue.main.async { [weak self] in
self?.reloadTable()
self?.navigationController?.popViewController(animated: true)
}
}
Expand Down

0 comments on commit a44f3ca

Please sign in to comment.