Skip to content

Commit

Permalink
Feature/development verifier (#123)
Browse files Browse the repository at this point in the history
* added debug menu

* debug levels

* DebugManager initial commit

- DebugManager created
- Added functions to generate Versions.txt and Readme.txt
- Error propagation added with Result

* Debug manager

* L1/L2 files generation added to DebugModeManager

* Zip archive method added

- Temp directory created for files

* Anonimization method added for payload

- Zip module added

* part of version 1.2.0

* part of version 1.2.0

* Refactored and DebugLevel check added

* no message

* Share button added

* Presentation logic added

* fixed UI

* Fixed draw methods

* Refactor of scannings

* Updated connection

* Minor fixes

* Fixes in cert viewer

* Separated certificate structure, added verifier

* Certificate separated for 3 objects

* Updated Settings UI

* Fixed UI Storyboards

* Worked with Errors. Start

* Added Error detectin, added Scan to storyboard

* Added Logger

* Added logs, refactoring

* Added loading to Home

* Refactored core and controllers

* Increased version num

* Refactored storages - begin

* minor

* Fixed productivity of validation

* Fixed Performance - continue

* Removed debug xib

* removed all xib files

* Fixed Validatation, Fixed perfomance and fixed All UI issues

* Added cancel state during validation

* Refactoring Verifier data

* Fixed bugs with limited validity

* Fixed app id

* fixed storyboard

* Fixed expand buttons

* refactored network calls

* Fix loading data at the app start

* Fixed Debug mode

* Fixed Debug mode II

* Added rerloading to the settings

* added Expired data time

* Fix freez

* Fixed Freezing on scaning screen

* Fixed shared button

* Removed FloatingPanel

* Fixed share button, improved loading

* Fixed Debug rule error

* Upgrade version num

* minor changes

* Added logger

* Fixed orientations

* Ordered app colors

* remove unnecessary import

* changes in res

* Added localization for existed strings

* Continue update localizations

* Update Verifier after Core clean up

* Added localization to Verifier

* Format strings fixed

Co-authored-by: Alexandr Chernyy <[email protected]>
Co-authored-by: Illia Vlasov <[email protected]>
Co-authored-by: Test <[email protected]>
Co-authored-by: ikhomiak <[email protected]>
  • Loading branch information
5 people authored Dec 1, 2021
1 parent e91130c commit 3d8ccd8
Show file tree
Hide file tree
Showing 79 changed files with 5,007 additions and 1,877 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -217,4 +217,5 @@ xcuserdata/
#


/Pods/
/Pods/
DGCAVerifier.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved
422 changes: 303 additions & 119 deletions DGCAVerifier.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
"repositoryURL": "https://github.com/Alamofire/Alamofire",
"state": {
"branch": null,
"revision": "f96b619bcb2383b43d898402283924b80e2c4bae",
"version": "5.4.3"
"revision": "d120af1e8638c7da36c8481fd61a66c0c08dc4fc",
"version": "5.4.4"
}
},
{
Expand All @@ -24,43 +24,25 @@
"repositoryURL": "https://github.com/eu-digital-green-certificates/dgc-certlogic-ios",
"state": {
"branch": "main",
"revision": "8b7f86a2aed4f2c60dd2c7c4f28eb129d9fe379d",
"revision": "5da95101196898090ef36e6189cb32f32b60ddc7",
"version": null
}
},
{
"package": "SwiftDGC",
"repositoryURL": "https://github.com/eu-digital-green-certificates/dgca-app-core-ios.git",
"state": {
"branch": "main",
"revision": "5463a6c6f7daed9b7cb3da7e0e61d6f0ee24a37e",
"version": null
}
},
{
"package": "FloatingPanel",
"repositoryURL": "https://github.com/SCENEE/FloatingPanel",
"state": {
"branch": null,
"revision": "b8fcb50874f50bb511173700f87b09344c568c6a",
"version": "2.4.0"
}
},
{
"package": "jsonlogic",
"repositoryURL": "https://github.com/eu-digital-green-certificates/json-logic-swift.git",
"state": {
"branch": null,
"revision": "6c04fa0ccfcd8424986aaf2fc61ea458b3979cf1",
"version": "1.1.6"
"revision": "e59a317e03491abe1f04c87b965a52abae243ddd",
"version": "1.1.8"
}
},
{
"package": "JSONSchema",
"repositoryURL": "https://github.com/eu-digital-green-certificates/JSONSchema.swift",
"state": {
"branch": "master",
"revision": "4809e8a105b3fd2818a08caf9e3cbcdd7d319af2",
"revision": "addef0a5c7ed181d877f1fdfde1e3fc1c6c28cfe",
"version": null
}
},
Expand All @@ -69,8 +51,8 @@
"repositoryURL": "https://github.com/kylef/PathKit.git",
"state": {
"branch": null,
"revision": "73f8e9dca9b7a3078cb79128217dc8f2e585a511",
"version": "1.0.0"
"revision": "3bfd2737b700b9a36565a8c94f4ad2b050a5e574",
"version": "1.0.1"
}
},
{
Expand All @@ -87,7 +69,7 @@
"repositoryURL": "https://github.com/eu-digital-green-certificates/SwiftCBOR",
"state": {
"branch": "master",
"revision": "b76024995f6909e4615f943c7a03268fd29778fc",
"revision": "0209a2d1a30b1b42334c4ad3f8bd221b977b2273",
"version": null
}
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//
/*-
* ---license-start
* eu-digital-green-certificates / dgca-verifier-app-ios
Expand All @@ -17,28 +18,35 @@
* limitations under the License.
* ---license-end
*/
//
// SelfSizedTableView.swift
//
// DebugCell.swift
// DGCAVerifier
//
// Created by Yannick Spreen on 4/20/21.
//
// https://dushyant37.medium.com/swift-4-recipe-self-sizing-table-view-2635ac3df8ab
//
//
// Created by Alexandr Chernyy on 02.09.2021.
//


import UIKit
import SwiftDGC

class SelfSizedTableView: UITableView {
var maxHeight: CGFloat = UIScreen.main.bounds.size.height
class DebugCell: UITableViewCell {

override func reloadData() {
super.reloadData()
self.invalidateIntrinsicContentSize()
self.layoutIfNeeded()
@IBOutlet weak var nameLabel: UILabel!
private var country: CountryModel? {
didSet {
setupView()
}
}

override var intrinsicContentSize: CGSize {
let height = min(contentSize.height, maxHeight)
return CGSize(width: contentSize.width, height: height)
func setupView() {
guard let nameLabel = nameLabel, let country = country else {
nameLabel.text = ""
return
}
nameLabel.text = country.name
}

func setCountry(countryModel: CountryModel) {
country = countryModel
}
}
95 changes: 95 additions & 0 deletions DGCAVerifier/Components/DebugCells/DebugRawCell.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
//
/*-
* ---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
*/
//
// DebugRawCell.swift
// DGCAVerifier
//
// Created by Alexandr Chernyy on 07.09.2021.
//


import UIKit
import SwiftDGC

protocol DebugRawSharing: AnyObject {
func userDidShare(text: String)
}

class DebugRawCell: UITableViewCell, UIContextMenuInteractionDelegate {
@IBOutlet fileprivate weak var rawLabel: UILabel!
weak var delegate: DebugRawSharing?

override func awakeFromNib() {
super.awakeFromNib()
if #available(iOS 13.0, *) {
let interaction = UIContextMenuInteraction(delegate: self)

rawLabel.isUserInteractionEnabled = true
rawLabel.addInteraction(interaction)
} else {
// Fallback on earlier versions
}
}

func setupCell(for _: DebugSectionModel, cert: HCert?) {
self.cert = cert
}

private var cert: HCert? {
didSet {
setupView()
}
}

private func setupView() {
guard let cert = cert else {
rawLabel.text = ""
return
}
rawLabel.text = cert.body.description
rawLabel.sizeToFit()
}

@objc @available(iOS 13.0, *)
func contextMenuInteraction(_ interaction: UIContextMenuInteraction,
configurationForMenuAtLocation location: CGPoint)
-> UIContextMenuConfiguration? {

let copy = UIAction(title: "Copy Raw Data",
image: UIImage(systemName: "doc.on.doc.fill")) { [unowned self] _ in

UIPasteboard.general.string = self.rawLabel.text
}

let share = UIAction(title: "Share Raw Data",
image: UIImage(systemName: "square.and.arrow.up.fill")) { [unowned self] _ in
self.delegate?.userDidShare(text: self.rawLabel.text ?? "")
}
if let txt = self.rawLabel.text, !txt.isEmpty {
return UIContextMenuConfiguration(identifier: nil, previewProvider: nil) { _ in
UIMenu(title: "Actions", children: [ copy, share ])
}
} else {
return nil
}
}

}
82 changes: 82 additions & 0 deletions DGCAVerifier/Components/DebugCells/DebugSectionCell.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
//
/*-
* ---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
*/
//
// DebugSectionCell.swift
// DGCAVerifier
//
// Created by Alexandr Chernyy on 07.09.2021.
//


import UIKit

typealias ExpandBlock = (_ debugSection: DebugSectionModel?) -> Void

class DebugSectionCell: UITableViewCell {
@IBOutlet fileprivate weak var nameLabel: UILabel!
@IBOutlet fileprivate weak var expandButton: UIButton!

var expandCallback: ExpandBlock?
private var debugSection: DebugSectionModel? {
didSet {
setupView()
}
}

func setupCell(for debugSection: DebugSectionModel) {
self.debugSection = debugSection
}

override func prepareForReuse() {
super.prepareForReuse()
debugSection = nil
}

@IBAction func expandAction(_ sender: Any) {
guard let debugSection = debugSection else { return }
debugSection.isExpanded = !debugSection.isExpanded
expandCallback?(debugSection)
if debugSection.isExpanded {
expandButton.setTitle("", for: .normal)
} else {
expandButton.setTitle("▶︎", for: .normal)
}
}

// MARK: Private methods
private func setupView() {
guard let debugSection = debugSection else {
clearView()
return
}
if debugSection.isExpanded {
expandButton.setTitle("", for: .normal)
} else {
expandButton.setTitle("▶︎", for: .normal)
}
nameLabel.text = debugSection.sectionType.rawValue
}

private func clearView() {
nameLabel.text = ""
expandButton.setTitle("", for: .normal)
}
}
Loading

0 comments on commit 3d8ccd8

Please sign in to comment.