-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* part of importing functionalyti * added import functionality * fixed nfc screen * no message * Fixed fetch context Co-authored-by: Alexandr Chernyy <[email protected]>
- Loading branch information
1 parent
223c26d
commit 7c5e217
Showing
26 changed files
with
1,849 additions
and
71 deletions.
There are no files selected for viewing
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,10 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||
<plist version="1.0"> | ||
<dict> | ||
<key>com.apple.developer.nfc.readersession.formats</key> | ||
<array> | ||
<string>NDEF</string> | ||
</array> | ||
</dict> | ||
</plist> |
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,64 @@ | ||
// | ||
/*- | ||
* ---license-start | ||
* eu-digital-green-certificates / dgca-wallet-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 | ||
*/ | ||
// | ||
// ImageTableViewCell.swift | ||
// DGCAWallet | ||
// | ||
// Created by Alexandr Chernyy on 25.08.2021. | ||
// | ||
|
||
|
||
import UIKit | ||
|
||
final class ImageTableViewCell: UITableViewCell { | ||
|
||
@IBOutlet weak var imagePreviewView: UIImageView! | ||
@IBOutlet weak var nameLabel: UILabel! | ||
@IBOutlet weak var timeLabel: UILabel! | ||
|
||
private var savedImage: SavedImage? { | ||
didSet { | ||
setupView() | ||
} | ||
} | ||
|
||
override func awakeFromNib() { | ||
super.awakeFromNib() | ||
// Initialization code | ||
setupView() | ||
} | ||
|
||
public func setImage(image: SavedImage) { | ||
savedImage = image | ||
} | ||
|
||
private func setupView() { | ||
guard let savedImage = savedImage else { | ||
imagePreviewView.image = nil | ||
nameLabel.text = "" | ||
return | ||
} | ||
imagePreviewView.image = savedImage.image | ||
nameLabel.text = savedImage.fileName | ||
timeLabel.text = savedImage.dateString | ||
} | ||
|
||
} |
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,75 @@ | ||
// | ||
/*- | ||
* ---license-start | ||
* eu-digital-green-certificates / dgca-wallet-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 | ||
*/ | ||
// | ||
// PDFTableViewCell.swift | ||
// DGCAWallet | ||
// | ||
// Created by Alexandr Chernyy on 25.08.2021. | ||
// | ||
|
||
|
||
import UIKit | ||
import PDFKit | ||
|
||
class PDFTableViewCell: UITableViewCell { | ||
|
||
@IBOutlet weak var pdfView: UIView! | ||
@IBOutlet weak var nameLabel: UILabel! | ||
@IBOutlet weak var timeLabel: UILabel! | ||
|
||
private var savedPDF: SavedPDF? { | ||
didSet { | ||
setupView() | ||
} | ||
} | ||
private var pdfViewer: PDFView? | ||
|
||
override func awakeFromNib() { | ||
super.awakeFromNib() | ||
// Initialization code | ||
setupView() | ||
} | ||
|
||
public func setPDF(pdf: SavedPDF) { | ||
savedPDF = pdf | ||
} | ||
|
||
private func setupView() { | ||
guard let savedPDF = savedPDF else { | ||
nameLabel.text = "" | ||
return | ||
} | ||
if pdfViewer == nil { | ||
pdfViewer = PDFView(frame: pdfView.bounds) | ||
pdfViewer?.autoScales = true | ||
let scrollView = pdfViewer?.subviews[0] as? UIScrollView | ||
if scrollView != nil { | ||
scrollView!.isScrollEnabled = false | ||
} | ||
pdfView.addSubview(pdfViewer!) | ||
} | ||
if let document = savedPDF.pdf { | ||
pdfViewer!.document = document | ||
} | ||
nameLabel.text = savedPDF.fileName | ||
timeLabel.text = savedPDF.dateString | ||
} | ||
} |
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,11 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||
<plist version="1.0"> | ||
<dict> | ||
<key>com.apple.developer.nfc.readersession.formats</key> | ||
<array> | ||
<string>NDEF</string> | ||
<string>TAG</string> | ||
</array> | ||
</dict> | ||
</plist> |
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,38 @@ | ||
// | ||
/*- | ||
* ---license-start | ||
* eu-digital-green-certificates / dgca-wallet-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 | ||
*/ | ||
// | ||
// String+.swift | ||
// DGCAWallet | ||
// | ||
// Created by Alexandr Chernyy on 23.08.2021. | ||
// | ||
|
||
|
||
import Foundation | ||
import UIKit | ||
|
||
extension String { | ||
func convertBase64StringToImage () -> UIImage? { | ||
guard let imageData = Data.init(base64Encoded: self, options: .init(rawValue: 0)) else { return nil } | ||
let image = UIImage(data: imageData) | ||
return image | ||
} | ||
} |
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,53 @@ | ||
// | ||
/*- | ||
* ---license-start | ||
* eu-digital-green-certificates / dgca-wallet-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 | ||
*/ | ||
// | ||
// UIImage+.swift | ||
// DGCAWallet | ||
// | ||
// Created by Alexandr Chernyy on 20.08.2021. | ||
// | ||
|
||
|
||
import UIKit | ||
|
||
extension UIImage { | ||
func qrCodeString() -> String? { | ||
var qrAsString = "" | ||
guard let detector = CIDetector(ofType: CIDetectorTypeQRCode, | ||
context: nil, | ||
options: [CIDetectorAccuracy: CIDetectorAccuracyHigh]), | ||
let ciImage = CIImage(image: self), | ||
let features = detector.features(in: ciImage) as? [CIQRCodeFeature] else { | ||
return qrAsString | ||
} | ||
for feature in features { | ||
guard let indeedMessageString = feature.messageString else { | ||
continue | ||
} | ||
qrAsString += indeedMessageString | ||
} | ||
return qrAsString.isEmpty ? nil : qrAsString | ||
} | ||
|
||
func convertImageToBase64String () -> String { | ||
return self.jpegData(compressionQuality: 1)?.base64EncodedString() ?? "" | ||
} | ||
} |
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,75 @@ | ||
// | ||
/*- | ||
* ---license-start | ||
* eu-digital-green-certificates / dgca-wallet-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 | ||
*/ | ||
// | ||
// ImageDataStorage.swift | ||
// DGCAWallet | ||
// | ||
// Created by Alexandr Chernyy on 23.08.2021. | ||
// | ||
|
||
|
||
import Foundation | ||
import SwiftDGC | ||
|
||
struct ImageDataStorage: Codable { | ||
static var sharedInstance = ImageDataStorage() | ||
static let storage = SecureStorage<ImageDataStorage>(fileName: "images_secure") | ||
|
||
var images = [SavedImage]() | ||
|
||
mutating func add(savedImage: SavedImage) { | ||
let list = images | ||
if list.contains(where: { image in | ||
image.identifier == savedImage.identifier | ||
}) { | ||
return | ||
} | ||
images.append(savedImage) | ||
save() | ||
} | ||
|
||
public func save() { | ||
Self.storage.save(self) | ||
} | ||
|
||
public mutating func deleteImageWith(identifier: String) { | ||
self.images = self.images.filter { $0.identifier != identifier } | ||
save() | ||
} | ||
|
||
public func isImageExistWith(identifier: String) -> Bool { | ||
let list = images | ||
return list.contains(where: { image in | ||
image.identifier == identifier | ||
}) | ||
} | ||
static func initialize(completion: @escaping () -> Void) { | ||
storage.loadOverride(fallback: ImageDataStorage.sharedInstance) { success in | ||
guard let result = success else { | ||
return | ||
} | ||
let format = l10n("log.images") | ||
print(String.localizedStringWithFormat(format, result.images.count)) | ||
ImageDataStorage.sharedInstance = result | ||
completion() | ||
} | ||
} | ||
} |
Oops, something went wrong.