Skip to content

Commit

Permalink
Add swipe to delete. (eu-digital-green-certificates#32)
Browse files Browse the repository at this point in the history
* Add swipe to delete.

* Fix localization.
  • Loading branch information
yspreen authored May 9, 2021
1 parent b1cc74d commit 98cfda5
Show file tree
Hide file tree
Showing 5 changed files with 183 additions and 5 deletions.
16 changes: 12 additions & 4 deletions DGCAWallet.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -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 */; };
Expand Down Expand Up @@ -68,9 +68,9 @@
CE13CF22262DDF810070C80E /* RoundedButton.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RoundedButton.swift; sourceTree = "<group>"; };
CE1D1EF5263597A2004C8919 /* LocalData.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LocalData.swift; sourceTree = "<group>"; };
CE260F55263DD1720083A200 /* WalletCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WalletCell.swift; sourceTree = "<group>"; };
CE345FB726447A9F003B457E /* Localizable.strings */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; path = Localizable.strings; sourceTree = "<group>"; };
CE37B642263867D700DEE13D /* SecureBackground.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SecureBackground.swift; sourceTree = "<group>"; };
CE56BC06264068110044FD3F /* GatewayConnection.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GatewayConnection.swift; sourceTree = "<group>"; };
CE6D4A45264835F100A5D33D /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/Localizable.strings; sourceTree = "<group>"; };
CE8096D8263B07BB00A65AD6 /* UIColor.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UIColor.swift; sourceTree = "<group>"; };
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 = "<group>"; };
Expand Down Expand Up @@ -197,7 +197,7 @@
CEA6D6ED261F8D2700715333 /* SceneDelegate.swift */,
CEA6D6F4261F8D2900715333 /* Assets.xcassets */,
CEA6D6F9261F8D2900715333 /* Info.plist */,
CE345FB726447A9F003B457E /* Localizable.strings */,
CE6D4A46264835F100A5D33D /* Localizable.strings */,
);
path = SupportingFiles;
sourceTree = "<group>";
Expand Down Expand Up @@ -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 */,
Expand Down Expand Up @@ -504,6 +504,14 @@
/* End PBXTargetDependency section */

/* Begin PBXVariantGroup section */
CE6D4A46264835F100A5D33D /* Localizable.strings */ = {
isa = PBXVariantGroup;
children = (
CE6D4A45264835F100A5D33D /* en */,
);
name = Localizable.strings;
sourceTree = "<group>";
};
CEA6D6F1261F8D2700715333 /* Main.storyboard */ = {
isa = PBXVariantGroup;
children = (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand All @@ -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";
"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.";
22 changes: 22 additions & 0 deletions DGCAWallet/ViewControllers/List.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
100 changes: 100 additions & 0 deletions Localization/DGCAWallet/en.xcloc/Localized Contents/en.xliff
Original file line number Diff line number Diff line change
Expand Up @@ -86,4 +86,104 @@
</trans-unit>
</body>
</file>
<file original="DGCAWallet/SupportingFiles/en.lproj/Localizable.strings" source-language="en" target-language="en" datatype="plaintext">
<header>
<tool tool-id="com.apple.dt.xcode" tool-name="Xcode" tool-version="12.5" build-num="12E262"/>
</header>
<body>
<trans-unit id="auth.confirm" xml:space="preserve">
<source>Confirm Identity</source>
<target>Confirm Identity</target>
<note/>
</trans-unit>
<trans-unit id="auth.later" xml:space="preserve">
<source>Try Later</source>
<target>Try Later</target>
<note/>
</trans-unit>
<trans-unit id="btn.cancel" xml:space="preserve">
<source>Cancel</source>
<target>Cancel</target>
<note/>
</trans-unit>
<trans-unit id="btn.confirm" xml:space="preserve">
<source>Confirm</source>
<target>Confirm</target>
<note/>
</trans-unit>
<trans-unit id="btn.okay" xml:space="preserve">
<source>Okay</source>
<target>Okay</target>
<note/>
</trans-unit>
<trans-unit id="btn.save" xml:space="preserve">
<source>Save</source>
<target>Save</target>
<note/>
</trans-unit>
<trans-unit id="cert.delete.body" xml:space="preserve">
<source>Are you sure you want to delete this certificate? This action cannot be undone.</source>
<target>Are you sure you want to delete this certificate? This action cannot be undone.</target>
<note/>
</trans-unit>
<trans-unit id="cert.delete.title" xml:space="preserve">
<source>Delete Certificate</source>
<target>Delete Certificate</target>
<note/>
</trans-unit>
<trans-unit id="list.cell.scanned-at" xml:space="preserve">
<source>Scanned %@</source>
<target>Scanned %@</target>
<note/>
</trans-unit>
<trans-unit id="log.certs-loaded" xml:space="preserve">
<source>%d certs loaded.</source>
<target>%d certs loaded.</target>
<note>Localizable.strings
DGCAWallet

Created by Yannick Spreen on 5/6/21.</note>
</trans-unit>
<trans-unit id="tan.confirm.fail.text" xml:space="preserve">
<source>Check the TAN and try again.</source>
<target>Check the TAN and try again.</target>
<note/>
</trans-unit>
<trans-unit id="tan.confirm.fail.title" xml:space="preserve">
<source>Failure</source>
<target>Failure</target>
<note/>
</trans-unit>
<trans-unit id="tan.confirm.placeholder" xml:space="preserve">
<source>XYZ12345</source>
<target>XYZ12345</target>
<note/>
</trans-unit>
<trans-unit id="tan.confirm.success.text" xml:space="preserve">
<source>Certificate was saved to wallet!</source>
<target>Certificate was saved to wallet!</target>
<note/>
</trans-unit>
<trans-unit id="tan.confirm.success.title" xml:space="preserve">
<source>Success</source>
<target>Success</target>
<note/>
</trans-unit>
<trans-unit id="tan.confirm.text" xml:space="preserve">
<source>Please enter the TAN that was provided together with your certificate:</source>
<target>Please enter the TAN that was provided together with your certificate:</target>
<note/>
</trans-unit>
<trans-unit id="tan.confirm.title" xml:space="preserve">
<source>Confirm TAN</source>
<target>Confirm TAN</target>
<note/>
</trans-unit>
<trans-unit id="tan.label" xml:space="preserve">
<source>TAN: %@</source>
<target>TAN: %@</target>
<note/>
</trans-unit>
</body>
</file>
</xliff>
Original file line number Diff line number Diff line change
@@ -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.";

0 comments on commit 98cfda5

Please sign in to comment.