Skip to content

Commit

Permalink
Merge pull request eu-digital-green-certificates#15 from eu-digital-g…
Browse files Browse the repository at this point in the history
…reen-certificates/feature/Display-Cert
  • Loading branch information
ascheibal authored Apr 21, 2021
2 parents e9e14a3 + e9288ec commit d693fff
Show file tree
Hide file tree
Showing 37 changed files with 1,673 additions and 142 deletions.
221 changes: 195 additions & 26 deletions PatientScannerDemo.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1,6 +1,42 @@
{
"object": {
"pins": [
{
"package": "FloatingPanel",
"repositoryURL": "https://github.com/SCENEE/FloatingPanel",
"state": {
"branch": null,
"revision": "16fea625be25d9a713630a4a43cbc0778740ebf4",
"version": "2.3.0"
}
},
{
"package": "JSONSchema",
"repositoryURL": "https://github.com/eu-digital-green-certificates/JSONSchema.swift",
"state": {
"branch": "master",
"revision": "adb480fe1c1e285c131bff465f641aebc986d736",
"version": null
}
},
{
"package": "PathKit",
"repositoryURL": "https://github.com/kylef/PathKit.git",
"state": {
"branch": null,
"revision": "73f8e9dca9b7a3078cb79128217dc8f2e585a511",
"version": "1.0.0"
}
},
{
"package": "Spectre",
"repositoryURL": "https://github.com/kylef/Spectre.git",
"state": {
"branch": null,
"revision": "f79d4ecbf8bc4e1579fbd86c3e1d652fb6876c53",
"version": "0.9.2"
}
},
{
"package": "SwiftCBOR",
"repositoryURL": "https://github.com/unrelentingtech/SwiftCBOR",
Expand All @@ -9,6 +45,15 @@
"revision": "668c26fc3373d5f1bccbaad7665ca6048797e324",
"version": "0.4.3"
}
},
{
"package": "SwiftyJSON",
"repositoryURL": "https://github.com/SwiftyJSON/SwiftyJSON",
"state": {
"branch": null,
"revision": "b3dcd7dbd0d488e1a7077cb33b00f2083e382f07",
"version": "5.0.1"
}
}
]
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,69 @@
<key>orderHint</key>
<integer>0</integer>
</dict>
<key>Playground (Playground) 1.xcscheme</key>
<dict>
<key>isShown</key>
<false/>
<key>orderHint</key>
<integer>5</integer>
</dict>
<key>Playground (Playground) 2.xcscheme</key>
<dict>
<key>isShown</key>
<false/>
<key>orderHint</key>
<integer>6</integer>
</dict>
<key>Playground (Playground).xcscheme</key>
<dict>
<key>isShown</key>
<false/>
<key>orderHint</key>
<integer>4</integer>
</dict>
<key>Spectre (Playground) 1.xcscheme</key>
<dict>
<key>isShown</key>
<false/>
<key>orderHint</key>
<integer>2</integer>
</dict>
<key>Spectre (Playground) 2.xcscheme</key>
<dict>
<key>isShown</key>
<false/>
<key>orderHint</key>
<integer>3</integer>
</dict>
<key>Spectre (Playground) 3.xcscheme</key>
<dict>
<key>isShown</key>
<false/>
<key>orderHint</key>
<integer>7</integer>
</dict>
<key>Spectre (Playground) 4.xcscheme</key>
<dict>
<key>isShown</key>
<false/>
<key>orderHint</key>
<integer>8</integer>
</dict>
<key>Spectre (Playground) 5.xcscheme</key>
<dict>
<key>isShown</key>
<false/>
<key>orderHint</key>
<integer>9</integer>
</dict>
<key>Spectre (Playground).xcscheme</key>
<dict>
<key>isShown</key>
<false/>
<key>orderHint</key>
<integer>1</integer>
</dict>
</dict>
</dict>
</plist>
73 changes: 0 additions & 73 deletions PatientScannerDemo/Base45.swift

This file was deleted.

21 changes: 21 additions & 0 deletions PatientScannerDemo/Components/FullFloatingPanelLayout.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
//
// FullFloatingPanelLayout.swift
// PatientScannerDemo
//
// Created by Yannick Spreen on 4/19/21.
//

import FloatingPanel

class FullFloatingPanelLayout: FloatingPanelLayout {
var position: FloatingPanelPosition = .bottom

var initialState: FloatingPanelState = .full

var anchors: [FloatingPanelState: FloatingPanelLayoutAnchoring] {
let top = FloatingPanelLayoutAnchor(absoluteInset: 16.0, edge: .top, referenceGuide: .safeArea)
return [
.full: top,
]
}
}
18 changes: 18 additions & 0 deletions PatientScannerDemo/Components/InfoCell.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
//
// InfoCell.swift
// PatientScannerDemo
//
// Created by Yannick Spreen on 4/20/21.
//

import UIKit

class InfoCell: UITableViewCell {
@IBOutlet weak var headerLabel: UILabel!
@IBOutlet weak var contentLabel: UILabel!

func draw(_ info: InfoSection) {
headerLabel?.text = info.header
contentLabel?.text = info.content
}
}
32 changes: 32 additions & 0 deletions PatientScannerDemo/Components/RoundedButton.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
//
// RoundedButton.swift
// PatientScannerDemo
//
// Created by Yannick Spreen on 4/19/21.
//

import Foundation
import UIKit

@IBDesignable
class RoundedButton: UIButton {
@IBInspectable var radius: CGFloat = 6.0 { didSet(v) { initialize() } }
@IBInspectable var padding: CGFloat = 4.0 { didSet(v) { initialize() } }

override init(frame: CGRect) {
super.init(frame: frame)

initialize()
}

required init?(coder: NSCoder) {
super.init(coder: coder)

initialize()
}

func initialize() {
layer.cornerRadius = radius
contentEdgeInsets = UIEdgeInsets(top: padding, left: padding, bottom: padding, right: padding)
}
}
25 changes: 25 additions & 0 deletions PatientScannerDemo/Components/SelfSizedTableView.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
//
// SelfSizedTableView.swift
// PatientScannerDemo
//
// Created by Yannick Spreen on 4/20/21.
//
// https://dushyant37.medium.com/swift-4-recipe-self-sizing-table-view-2635ac3df8ab
//

import UIKit

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

override func reloadData() {
super.reloadData()
self.invalidateIntrinsicContentSize()
self.layoutIfNeeded()
}

override var intrinsicContentSize: CGSize {
let height = min(contentSize.height, maxHeight)
return CGSize(width: contentSize.width, height: height)
}
}
34 changes: 34 additions & 0 deletions PatientScannerDemo/Extensions/Data+Base45.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
//
// Data+Base45.swift
// PatientScannerDemo
//
// Created by Yannick Spreen on 4/21/21.
//

import Foundation


extension Data {
public func toBase45()->String {
var o = String()
for i in stride(from:0, to:self.count, by: 2) {
if (self.count - i > 1) {
let x : Int = (Int(self[i])<<8) + Int(self[i+1])
let e : Int = x / (45*45)
let x2 : Int = x % (45*45)
let d : Int = x2 / 45
let c : Int = x2 % 45
o.append(BASE45_CHARSET[c])
o.append(BASE45_CHARSET[d])
o.append(BASE45_CHARSET[e])
} else {
let x2 : Int = Int(self[i])
let d : Int = x2 / 45
let c : Int = x2 % 45
o.append(BASE45_CHARSET[c])
o.append(BASE45_CHARSET[d])
}
}
return o
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,8 @@ extension Data {
}

var uint: [UInt8] { [UInt8](self) }
var hexString: String {
let format = "%02hhx"
return self.map { String(format: format, $0) }.joined()
}
}
Loading

0 comments on commit d693fff

Please sign in to comment.