From cfa97b5160a14986c25ded9d950151c0feabdb3c Mon Sep 17 00:00:00 2001 From: Yannick Spreen Date: Sun, 16 May 2021 21:10:01 +0200 Subject: [PATCH] Add privacy links. (#75) --- DGCAVerifier.xcodeproj/project.pbxproj | 6 +- DGCAVerifier/Components/AppVersionCell.swift | 40 --------- .../Base.lproj/Settings.storyboard | 88 +++++++++++++++++-- DGCAVerifier/ViewControllers/Settings.swift | 50 +++++++++-- 4 files changed, 126 insertions(+), 58 deletions(-) delete mode 100644 DGCAVerifier/Components/AppVersionCell.swift diff --git a/DGCAVerifier.xcodeproj/project.pbxproj b/DGCAVerifier.xcodeproj/project.pbxproj index 0c937fa..5ff24e5 100644 --- a/DGCAVerifier.xcodeproj/project.pbxproj +++ b/DGCAVerifier.xcodeproj/project.pbxproj @@ -17,7 +17,6 @@ CE345FAF264466AA003B457E /* CertificateViewer.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = CE345FB1264466AA003B457E /* CertificateViewer.storyboard */; }; CE345FB426446817003B457E /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = CE345FB626446817003B457E /* Localizable.strings */; }; CE37B643263867D700DEE13D /* SecureBackground.swift in Sources */ = {isa = PBXBuildFile; fileRef = CE37B642263867D700DEE13D /* SecureBackground.swift */; }; - CE41B7E226445092005013C4 /* AppVersionCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = CE41B7E126445092005013C4 /* AppVersionCell.swift */; }; CE56B5052639F48E00FB31B1 /* SwiftDGC in Frameworks */ = {isa = PBXBuildFile; productRef = CE56B5042639F48E00FB31B1 /* SwiftDGC */; }; CE59D1B626428D78004EBDD6 /* Settings.swift in Sources */ = {isa = PBXBuildFile; fileRef = CE59D1B526428D78004EBDD6 /* Settings.swift */; }; CE8096D9263B07BB00A65AD6 /* UIColor.swift in Sources */ = {isa = PBXBuildFile; fileRef = CE8096D8263B07BB00A65AD6 /* UIColor.swift */; }; @@ -67,7 +66,6 @@ CE345FB0264466AA003B457E /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/CertificateViewer.storyboard; sourceTree = ""; }; CE345FB526446817003B457E /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/Localizable.strings; sourceTree = ""; }; CE37B642263867D700DEE13D /* SecureBackground.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SecureBackground.swift; sourceTree = ""; }; - CE41B7E126445092005013C4 /* AppVersionCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppVersionCell.swift; sourceTree = ""; }; CE59D1B526428D78004EBDD6 /* Settings.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Settings.swift; sourceTree = ""; }; CE8096D8263B07BB00A65AD6 /* UIColor.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UIColor.swift; sourceTree = ""; }; CE81533B263FF8FE0030D777 /* README.md */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = net.daringfireball.markdown; path = README.md; sourceTree = SOURCE_ROOT; }; @@ -90,7 +88,7 @@ CEA6D709261F8D2900715333 /* DGCAVerifierUITests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = DGCAVerifierUITests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; CEA6D70D261F8D2900715333 /* DGCAVerifierUITests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DGCAVerifierUITests.swift; sourceTree = ""; }; CEA6D70F261F8D2900715333 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; - CEC7FEE0264C819D005561BA /* context.jsonc */ = {isa = PBXFileReference; lastKnownFileType = file; path = context.jsonc; sourceTree = SOURCE_ROOT; }; + CEC7FEE0264C819D005561BA /* context.jsonc */ = {isa = PBXFileReference; lastKnownFileType = text; path = context.jsonc; sourceTree = SOURCE_ROOT; }; CED2725F26398683003D47A9 /* UIFont.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UIFont.swift; sourceTree = ""; }; CEDCA7972639E6E700FCB83E /* SwiftDGC */ = {isa = PBXFileReference; lastKnownFileType = folder; name = SwiftDGC; path = "../dgca-app-core-ios"; sourceTree = ""; }; CEDCA79B2639E77800FCB83E /* Package.resolved */ = {isa = PBXFileReference; lastKnownFileType = text; name = Package.resolved; path = DGCAVerifier.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved; sourceTree = SOURCE_ROOT; }; @@ -172,7 +170,6 @@ CE13CF0E262DD0D80070C80E /* FullFloatingPanelLayout.swift */, CE13CF22262DDF810070C80E /* RoundedButton.swift */, CEA1556A262F784E0024B7AC /* SelfSizedTableView.swift */, - CE41B7E126445092005013C4 /* AppVersionCell.swift */, CEA1556F262F79DE0024B7AC /* InfoCell.swift */, ); path = Components; @@ -445,7 +442,6 @@ CE13CF0F262DD0D80070C80E /* FullFloatingPanelLayout.swift in Sources */, CEA1556B262F784E0024B7AC /* SelfSizedTableView.swift in Sources */, CE8096D9263B07BB00A65AD6 /* UIColor.swift in Sources */, - CE41B7E226445092005013C4 /* AppVersionCell.swift in Sources */, CE1D1EF6263597A2004C8919 /* LocalData.swift in Sources */, CED2726026398683003D47A9 /* UIFont.swift in Sources */, CEA6D6F0261F8D2700715333 /* Scan.swift in Sources */, diff --git a/DGCAVerifier/Components/AppVersionCell.swift b/DGCAVerifier/Components/AppVersionCell.swift deleted file mode 100644 index edebe86..0000000 --- a/DGCAVerifier/Components/AppVersionCell.swift +++ /dev/null @@ -1,40 +0,0 @@ -/*- - * ---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 - */ -// -// InfoCell.swift -// DGCAVerifier -// -// Created by Yannick Spreen on 4/20/21. -// - -import UIKit -import SwiftDGC - -class AppVersionCell: UITableViewCell { - @IBOutlet weak var versionLabel: UILabel! - - override func layoutSubviews() { - super.layoutSubviews() - - let version = Bundle.main.infoDictionary?["CFBundleShortVersionString"] as? String - let format = l10n("app-version") - versionLabel.text = String(format: format, version ?? "?") - } -} diff --git a/DGCAVerifier/Storyboards/Base.lproj/Settings.storyboard b/DGCAVerifier/Storyboards/Base.lproj/Settings.storyboard index f6664cd..7f56575 100644 --- a/DGCAVerifier/Storyboards/Base.lproj/Settings.storyboard +++ b/DGCAVerifier/Storyboards/Base.lproj/Settings.storyboard @@ -13,15 +13,91 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + @@ -57,8 +133,8 @@ - - + + @@ -82,8 +158,8 @@ - - + + diff --git a/DGCAVerifier/ViewControllers/Settings.swift b/DGCAVerifier/ViewControllers/Settings.swift index 3229797..889ed8b 100644 --- a/DGCAVerifier/ViewControllers/Settings.swift +++ b/DGCAVerifier/ViewControllers/Settings.swift @@ -52,6 +52,7 @@ class SettingsTableVC: UITableViewController { let format = l10n("settings.last-updated") return [ + "", String(format: format, LocalData.sharedInstance.lastFetch.dateTimeString), "", "" @@ -60,7 +61,7 @@ class SettingsTableVC: UITableViewController { override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { let cell = super.tableView(tableView, cellForRowAt: indexPath) - if indexPath.section == 1 { + if indexPath.section == 2 { cell.alpha = loading ? 1 : 0 cell.contentView.alpha = loading ? 1 : 0 } @@ -68,16 +69,51 @@ class SettingsTableVC: UITableViewController { } override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { - loading = true tableView.deselectRow(at: indexPath, animated: true) - tableView.reloadData() - GatewayConnection.update { - DispatchQueue.main.async { [weak self] in - self?.loading = false - self?.tableView.reloadData() + if indexPath.section == 0 { + switch indexPath.row { + case 0: + openPrivacyDoc() + case 1: + openEuCertDoc() + case 2: + openGitHubSource() + default: + return } } + if indexPath.section == 1 { + loading = true + tableView.reloadData() + return GatewayConnection.update { + DispatchQueue.main.async { [weak self] in + self?.loading = false + self?.tableView.reloadData() + } + } + } + } + + func openPrivacyDoc() { + let link = LocalData.sharedInstance.versionedConfig["privacyUrl"].string ?? "" + openUrl(link) + } + + func openEuCertDoc() { + let link = "https://ec.europa.eu/health/ehealth/covid-19_en" + openUrl(link) + } + + func openGitHubSource() { + let link = "https://github.com/eu-digital-green-certificates" + openUrl(link) + } + + func openUrl(_ string: String!) { + if let url = URL(string: string) { + UIApplication.shared.open(url) + } } @IBAction