-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* busines rules * fixed merge conflicts * added show errors for open result refactoring code * optimizing code * fixed issueCode for external parameter * Fixed context * done rule validation * fixed branch * fixed rules sorting * fixed rule sorting * added Filtering class from CertLogic * added hash value checking for downloaded data * fixed some issues * new version 1.1.6 Co-authored-by: Alexandr Chernyy <[email protected]>
- Loading branch information
1 parent
f043892
commit c29a0f2
Showing
25 changed files
with
1,435 additions
and
130 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
// | ||
/*- | ||
* ---license-start | ||
* eu-digital-green-certificates / dgca-verifier-app-ios | ||
* --- | ||
* Copyright (C) 2021 T-Systems International GmbH and all other contributors | ||
* --- | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
* ---license-end | ||
*/ | ||
// | ||
// InfoCellDropDown.swift | ||
// DGCAVerifier | ||
// | ||
// Created by Alexandr Chernyy on 06.07.2021. | ||
// | ||
import UIKit | ||
import SwiftDGC | ||
|
||
typealias DropDownBlock = (Bool) -> Void | ||
|
||
final class InfoCellDropDown: UITableViewCell { | ||
private enum Constants { | ||
static let iconCollapsed = "icon_collapsed" | ||
static let iconExpanded = "icon_expanded" | ||
} | ||
@IBOutlet private weak var headerLabel: UILabel! | ||
@IBOutlet private weak var contentLabel: UILabel! | ||
@IBOutlet private weak var dropDownButton: UIButton! | ||
private var dropDownBlock: DropDownBlock? | ||
private var info: InfoSection = InfoSection(header: "", content: "") { | ||
didSet { | ||
setupView() | ||
} | ||
} | ||
|
||
override func awakeFromNib() { | ||
super.awakeFromNib() | ||
clearView() | ||
} | ||
override func prepareForReuse() { | ||
super.prepareForReuse() | ||
|
||
clearView() | ||
} | ||
func setupCell(with info: InfoSection, dropDownBlock: @escaping DropDownBlock) { | ||
self.info = info | ||
self.dropDownBlock = dropDownBlock | ||
} | ||
private func setupView() { | ||
setDropDownIcon() | ||
headerLabel?.text = info.header | ||
contentLabel?.text = info.content | ||
let fontSize = contentLabel.font.pointSize | ||
let fontWeight = contentLabel.font.weight | ||
switch info.style { | ||
case .fixedWidthFont: | ||
if #available(iOS 13.0, *) { | ||
contentLabel.font = .monospacedSystemFont(ofSize: fontSize, weight: fontWeight) | ||
} else { | ||
contentLabel.font = .monospacedDigitSystemFont(ofSize: fontSize, weight: fontWeight) | ||
} | ||
default: | ||
contentLabel.font = .systemFont(ofSize: fontSize, weight: fontWeight) | ||
} | ||
} | ||
private func clearView() { | ||
headerLabel.text = "" | ||
contentLabel.text = "" | ||
} | ||
@IBAction func dropDownUpAction(_ sender: Any) { | ||
info.isExpanded = !info.isExpanded | ||
setDropDownIcon() | ||
dropDownBlock?(info.isExpanded) | ||
} | ||
private func setDropDownIcon() { | ||
if !info.isExpanded { | ||
dropDownButton.setImage(UIImage(named: Constants.iconCollapsed), for: .normal) | ||
} else { | ||
dropDownButton.setImage(UIImage(named: Constants.iconExpanded), for: .normal) | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
// | ||
/*- | ||
* ---license-start | ||
* eu-digital-green-certificates / dgca-verifier-app-ios | ||
* --- | ||
* Copyright (C) 2021 T-Systems International GmbH and all other contributors | ||
* --- | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
* ---license-end | ||
*/ | ||
// | ||
// RuleErrorTVC.swift | ||
// DGCAVerifier | ||
// | ||
// Created by Alexandr Chernyy on 05.07.2021. | ||
// | ||
|
||
import UIKit | ||
import SwiftDGC | ||
|
||
class RuleErrorTVC: UITableViewCell { | ||
|
||
@IBOutlet weak var ruleLabel: UILabel! | ||
@IBOutlet weak var ruleValueLabel: UILabel! | ||
@IBOutlet weak var currentLabel: UILabel! | ||
@IBOutlet weak var currentValueLabel: UILabel! | ||
@IBOutlet weak var resultLabel: UILabel! | ||
@IBOutlet weak var resultValueLabel: UILabel! | ||
@IBOutlet weak var failedLabel: UILabel! | ||
private var infoItem: InfoSection? { | ||
didSet { | ||
setupView() | ||
} | ||
} | ||
override func awakeFromNib() { | ||
super.awakeFromNib() | ||
setLabels() | ||
} | ||
|
||
override func prepareForReuse() { | ||
setLabels() | ||
} | ||
private func setLabels() { | ||
ruleLabel.text = l10n("rule") | ||
ruleValueLabel.text = "" | ||
currentLabel.text = l10n("current") | ||
currentValueLabel.text = "" | ||
resultLabel.text = l10n("result") | ||
resultValueLabel.text = "" | ||
} | ||
private func setupView() { | ||
guard let infoItem = infoItem else { return } | ||
ruleValueLabel.text = infoItem.header | ||
currentValueLabel.text = infoItem.content | ||
switch infoItem.ruleValidationResult { | ||
case .error: | ||
failedLabel.textColor = .red | ||
failedLabel.text = l10n("failed") | ||
case .passed: | ||
failedLabel.textColor = .green | ||
failedLabel.text = l10n("passed") | ||
case .open: | ||
failedLabel.textColor = .green | ||
failedLabel.text = l10n("open") | ||
} | ||
|
||
if let countryName = infoItem.countryName { | ||
switch infoItem.ruleValidationResult { | ||
case .error: | ||
resultValueLabel.text = String(format: l10n("failed_for_country"), countryName) | ||
case .passed: | ||
resultValueLabel.text = String(format: l10n("passed_for_country"), countryName) | ||
case .open: | ||
resultValueLabel.text = String(format: l10n("open_for_country"), countryName) | ||
} | ||
} else { | ||
switch infoItem.ruleValidationResult { | ||
case .error: | ||
resultValueLabel.text = l10n("failed") | ||
case .passed: | ||
resultValueLabel.text = l10n("passed") | ||
case .open: | ||
resultValueLabel.text = l10n("open") | ||
} | ||
} | ||
} | ||
public func setupCell(with info: InfoSection) { | ||
self.infoItem = info | ||
} | ||
} |
Oops, something went wrong.