From 98cfda5e282eb7a885eb67b531bb81b552c597f7 Mon Sep 17 00:00:00 2001 From: Yannick Spreen Date: Sun, 9 May 2021 17:33:48 +0200 Subject: [PATCH] Add swipe to delete. (#32) * Add swipe to delete. * Fix localization. --- DGCAWallet.xcodeproj/project.pbxproj | 16 ++- .../{ => en.lproj}/Localizable.strings | 5 +- DGCAWallet/ViewControllers/List.swift | 22 ++++ .../en.xcloc/Localized Contents/en.xliff | 100 ++++++++++++++++++ .../en.lproj/Localizable.strings | 45 ++++++++ 5 files changed, 183 insertions(+), 5 deletions(-) rename DGCAWallet/SupportingFiles/{ => en.lproj}/Localizable.strings (87%) create mode 100644 Localization/DGCAWallet/en.xcloc/Source Contents/DGCAWallet/SupportingFiles/en.lproj/Localizable.strings diff --git a/DGCAWallet.xcodeproj/project.pbxproj b/DGCAWallet.xcodeproj/project.pbxproj index 4857516..b28f19f 100644 --- a/DGCAWallet.xcodeproj/project.pbxproj +++ b/DGCAWallet.xcodeproj/project.pbxproj @@ -15,10 +15,10 @@ CE1D1EF6263597A2004C8919 /* LocalData.swift in Sources */ = {isa = PBXBuildFile; fileRef = CE1D1EF5263597A2004C8919 /* LocalData.swift */; }; CE1F155C2639F9E700736D48 /* SwiftyJSON in Frameworks */ = {isa = PBXBuildFile; productRef = CE1F155B2639F9E700736D48 /* SwiftyJSON */; }; CE260F56263DD1720083A200 /* WalletCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = CE260F55263DD1720083A200 /* WalletCell.swift */; }; - CE345FB826447A9F003B457E /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = CE345FB726447A9F003B457E /* Localizable.strings */; }; CE37B643263867D700DEE13D /* SecureBackground.swift in Sources */ = {isa = PBXBuildFile; fileRef = CE37B642263867D700DEE13D /* SecureBackground.swift */; }; CE56B5052639F48E00FB31B1 /* SwiftDGC in Frameworks */ = {isa = PBXBuildFile; productRef = CE56B5042639F48E00FB31B1 /* SwiftDGC */; }; CE56BC07264068110044FD3F /* GatewayConnection.swift in Sources */ = {isa = PBXBuildFile; fileRef = CE56BC06264068110044FD3F /* GatewayConnection.swift */; }; + CE6D4A44264835F100A5D33D /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = CE6D4A46264835F100A5D33D /* Localizable.strings */; }; CE8096D9263B07BB00A65AD6 /* UIColor.swift in Sources */ = {isa = PBXBuildFile; fileRef = CE8096D8263B07BB00A65AD6 /* UIColor.swift */; }; CE81533A263FF7EC0030D777 /* README.md in Resources */ = {isa = PBXBuildFile; fileRef = CE815339263FF7EC0030D777 /* README.md */; }; CE8912FB2634C6B900CB92AF /* Alamofire in Frameworks */ = {isa = PBXBuildFile; productRef = CE8912FA2634C6B900CB92AF /* Alamofire */; }; @@ -68,9 +68,9 @@ CE13CF22262DDF810070C80E /* RoundedButton.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RoundedButton.swift; sourceTree = ""; }; CE1D1EF5263597A2004C8919 /* LocalData.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LocalData.swift; sourceTree = ""; }; CE260F55263DD1720083A200 /* WalletCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WalletCell.swift; sourceTree = ""; }; - CE345FB726447A9F003B457E /* Localizable.strings */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; path = Localizable.strings; sourceTree = ""; }; CE37B642263867D700DEE13D /* SecureBackground.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SecureBackground.swift; sourceTree = ""; }; CE56BC06264068110044FD3F /* GatewayConnection.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GatewayConnection.swift; sourceTree = ""; }; + CE6D4A45264835F100A5D33D /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/Localizable.strings; sourceTree = ""; }; CE8096D8263B07BB00A65AD6 /* UIColor.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UIColor.swift; sourceTree = ""; }; CE815339263FF7EC0030D777 /* README.md */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = net.daringfireball.markdown; path = README.md; sourceTree = SOURCE_ROOT; }; CE891304263581D900CB92AF /* Home.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Home.swift; sourceTree = ""; }; @@ -197,7 +197,7 @@ CEA6D6ED261F8D2700715333 /* SceneDelegate.swift */, CEA6D6F4261F8D2900715333 /* Assets.xcassets */, CEA6D6F9261F8D2900715333 /* Info.plist */, - CE345FB726447A9F003B457E /* Localizable.strings */, + CE6D4A46264835F100A5D33D /* Localizable.strings */, ); path = SupportingFiles; sourceTree = ""; @@ -397,7 +397,7 @@ buildActionMask = 2147483647; files = ( CE13CF05262DCDCD0070C80E /* CertificateViewer.storyboard in Resources */, - CE345FB826447A9F003B457E /* Localizable.strings in Resources */, + CE6D4A44264835F100A5D33D /* Localizable.strings in Resources */, CEA6D6F8261F8D2900715333 /* LaunchScreen.storyboard in Resources */, CE81533A263FF7EC0030D777 /* README.md in Resources */, CEA6D6F5261F8D2900715333 /* Assets.xcassets in Resources */, @@ -504,6 +504,14 @@ /* End PBXTargetDependency section */ /* Begin PBXVariantGroup section */ + CE6D4A46264835F100A5D33D /* Localizable.strings */ = { + isa = PBXVariantGroup; + children = ( + CE6D4A45264835F100A5D33D /* en */, + ); + name = Localizable.strings; + sourceTree = ""; + }; CEA6D6F1261F8D2700715333 /* Main.storyboard */ = { isa = PBXVariantGroup; children = ( diff --git a/DGCAWallet/SupportingFiles/Localizable.strings b/DGCAWallet/SupportingFiles/en.lproj/Localizable.strings similarity index 87% rename from DGCAWallet/SupportingFiles/Localizable.strings rename to DGCAWallet/SupportingFiles/en.lproj/Localizable.strings index 30d3efa..a57196d 100644 --- a/DGCAWallet/SupportingFiles/Localizable.strings +++ b/DGCAWallet/SupportingFiles/en.lproj/Localizable.strings @@ -30,6 +30,7 @@ "btn.okay" = "Okay"; "btn.cancel" = "Cancel"; "btn.save" = "Save"; +"btn.confirm" = "Confirm"; "tan.confirm.title" = "Confirm TAN"; "tan.confirm.text" = "Please enter the TAN that was provided together with your certificate:"; "tan.confirm.placeholder" = "XYZ12345"; @@ -39,4 +40,6 @@ "tan.confirm.fail.text" = "Check the TAN and try again."; "tan.label" = "TAN: %@"; "auth.confirm" = "Confirm Identity"; -"auth.later" = "Try Later"; \ No newline at end of file +"auth.later" = "Try Later"; +"cert.delete.title" = "Delete Certificate"; +"cert.delete.body" = "Are you sure you want to delete this certificate? This action cannot be undone."; diff --git a/DGCAWallet/ViewControllers/List.swift b/DGCAWallet/ViewControllers/List.swift index 1f15337..47c2db9 100644 --- a/DGCAWallet/ViewControllers/List.swift +++ b/DGCAWallet/ViewControllers/List.swift @@ -154,6 +154,28 @@ extension ListVC: UITableViewDelegate { } presentViewer(for: cert, with: listElements[indexPath.row].storedTAN) } + + func tableView( + _ tableView: UITableView, + commit editingStyle: UITableViewCell.EditingStyle, + forRowAt indexPath: IndexPath + ) { + let cert = listElements[indexPath.row] + showAlert( + title: l10n("cert.delete.title"), + subtitle: l10n("cert.delete.body"), + actionTitle: l10n("btn.confirm"), + cancelTitle: l10n("btn.cancel") + ) { [weak self] in + if $0 { + LocalData.sharedInstance.certStrings.removeAll { + $0.date == cert.date + } + LocalData.sharedInstance.save() + self?.reloadTable() + } + } + } } extension ListVC: FloatingPanelControllerDelegate { diff --git a/Localization/DGCAWallet/en.xcloc/Localized Contents/en.xliff b/Localization/DGCAWallet/en.xcloc/Localized Contents/en.xliff index d18934f..58d223f 100644 --- a/Localization/DGCAWallet/en.xcloc/Localized Contents/en.xliff +++ b/Localization/DGCAWallet/en.xcloc/Localized Contents/en.xliff @@ -86,4 +86,104 @@ + +
+ +
+ + + Confirm Identity + Confirm Identity + + + + Try Later + Try Later + + + + Cancel + Cancel + + + + Confirm + Confirm + + + + Okay + Okay + + + + Save + Save + + + + Are you sure you want to delete this certificate? This action cannot be undone. + Are you sure you want to delete this certificate? This action cannot be undone. + + + + Delete Certificate + Delete Certificate + + + + Scanned %@ + Scanned %@ + + + + %d certs loaded. + %d certs loaded. + Localizable.strings + DGCAWallet + + Created by Yannick Spreen on 5/6/21. + + + Check the TAN and try again. + Check the TAN and try again. + + + + Failure + Failure + + + + XYZ12345 + XYZ12345 + + + + Certificate was saved to wallet! + Certificate was saved to wallet! + + + + Success + Success + + + + Please enter the TAN that was provided together with your certificate: + Please enter the TAN that was provided together with your certificate: + + + + Confirm TAN + Confirm TAN + + + + TAN: %@ + TAN: %@ + + + +
diff --git a/Localization/DGCAWallet/en.xcloc/Source Contents/DGCAWallet/SupportingFiles/en.lproj/Localizable.strings b/Localization/DGCAWallet/en.xcloc/Source Contents/DGCAWallet/SupportingFiles/en.lproj/Localizable.strings new file mode 100644 index 0000000..a57196d --- /dev/null +++ b/Localization/DGCAWallet/en.xcloc/Source Contents/DGCAWallet/SupportingFiles/en.lproj/Localizable.strings @@ -0,0 +1,45 @@ +/*- + * ---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 + */ +/* + Localizable.strings + DGCAWallet + + Created by Yannick Spreen on 5/6/21. + +*/ + +"log.certs-loaded" = "%d certs loaded."; +"list.cell.scanned-at" = "Scanned %@"; +"btn.okay" = "Okay"; +"btn.cancel" = "Cancel"; +"btn.save" = "Save"; +"btn.confirm" = "Confirm"; +"tan.confirm.title" = "Confirm TAN"; +"tan.confirm.text" = "Please enter the TAN that was provided together with your certificate:"; +"tan.confirm.placeholder" = "XYZ12345"; +"tan.confirm.success.title" = "Success"; +"tan.confirm.success.text" = "Certificate was saved to wallet!"; +"tan.confirm.fail.title" = "Failure"; +"tan.confirm.fail.text" = "Check the TAN and try again."; +"tan.label" = "TAN: %@"; +"auth.confirm" = "Confirm Identity"; +"auth.later" = "Try Later"; +"cert.delete.title" = "Delete Certificate"; +"cert.delete.body" = "Are you sure you want to delete this certificate? This action cannot be undone.";