diff --git a/enzevalos_iphone.xcodeproj/project.pbxproj b/enzevalos_iphone.xcodeproj/project.pbxproj index 5cf2b396c2a850739611d30610dcceccf2fcdc8a..c343b2e737e27cecd925888087c4be67c0967d00 100644 --- a/enzevalos_iphone.xcodeproj/project.pbxproj +++ b/enzevalos_iphone.xcodeproj/project.pbxproj @@ -45,6 +45,10 @@ 474994022261E4E6000F8DA5 /* SimpleSendIcon.swift in Sources */ = {isa = PBXBuildFile; fileRef = 474994012261E4E6000F8DA5 /* SimpleSendIcon.swift */; }; 4751C6EE233CA583006B2A4D /* DateExtension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4751C6ED233CA583006B2A4D /* DateExtension.swift */; }; 4751C6F82343B37C006B2A4D /* Onboarding.Video.Click.Eng.m4v in Resources */ = {isa = PBXBuildFile; fileRef = 4751C6F72343B377006B2A4D /* Onboarding.Video.Click.Eng.m4v */; }; + 4751C6FA23449699006B2A4D /* CryptoManagementViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4751C6F923449699006B2A4D /* CryptoManagementViewController.swift */; }; + 4751C6FC2344C8D1006B2A4D /* KeyTableViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4751C6FB2344C8D1006B2A4D /* KeyTableViewController.swift */; }; + 4751C7002344D37C006B2A4D /* SecretKey+CoreDataClass.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4751C6FE2344D37C006B2A4D /* SecretKey+CoreDataClass.swift */; }; + 4751C7012344D37C006B2A4D /* SecretKey+CoreDataProperties.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4751C6FF2344D37C006B2A4D /* SecretKey+CoreDataProperties.swift */; }; 4756DE0E20402F8E00452288 /* invitationTextCensor.html in Resources */ = {isa = PBXBuildFile; fileRef = 4756DE0D20402F8E00452288 /* invitationTextCensor.html */; }; 475B00331F7B9565006CDD41 /* SwiftPGP.swift in Sources */ = {isa = PBXBuildFile; fileRef = 475B00301F7B9565006CDD41 /* SwiftPGP.swift */; }; 475B00341F7B9565006CDD41 /* Cryptography.swift in Sources */ = {isa = PBXBuildFile; fileRef = 475B00311F7B9565006CDD41 /* Cryptography.swift */; }; @@ -292,6 +296,11 @@ 4751C6ED233CA583006B2A4D /* DateExtension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DateExtension.swift; sourceTree = "<group>"; }; 4751C6F0233CE1E4006B2A4D /* enzevalos_iphone 7.xcdatamodel */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcdatamodel; path = "enzevalos_iphone 7.xcdatamodel"; sourceTree = "<group>"; }; 4751C6F72343B377006B2A4D /* Onboarding.Video.Click.Eng.m4v */ = {isa = PBXFileReference; lastKnownFileType = file; path = Onboarding.Video.Click.Eng.m4v; sourceTree = "<group>"; }; + 4751C6F923449699006B2A4D /* CryptoManagementViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CryptoManagementViewController.swift; sourceTree = "<group>"; }; + 4751C6FB2344C8D1006B2A4D /* KeyTableViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KeyTableViewController.swift; sourceTree = "<group>"; }; + 4751C6FD2344D169006B2A4D /* enzevalos_iphone 8.xcdatamodel */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcdatamodel; path = "enzevalos_iphone 8.xcdatamodel"; sourceTree = "<group>"; }; + 4751C6FE2344D37C006B2A4D /* SecretKey+CoreDataClass.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "SecretKey+CoreDataClass.swift"; sourceTree = "<group>"; }; + 4751C6FF2344D37C006B2A4D /* SecretKey+CoreDataProperties.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "SecretKey+CoreDataProperties.swift"; sourceTree = "<group>"; }; 4756DE0D20402F8E00452288 /* invitationTextCensor.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; name = invitationTextCensor.html; path = Invitation/invitationTextCensor.html; sourceTree = "<group>"; }; 475B00301F7B9565006CDD41 /* SwiftPGP.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SwiftPGP.swift; sourceTree = "<group>"; }; 475B00311F7B9565006CDD41 /* Cryptography.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Cryptography.swift; sourceTree = "<group>"; }; @@ -699,6 +708,8 @@ 47B91AC01EC0C1CF000AE3EE /* coredata */ = { isa = PBXGroup; children = ( + 4751C6FE2344D37C006B2A4D /* SecretKey+CoreDataClass.swift */, + 4751C6FF2344D37C006B2A4D /* SecretKey+CoreDataProperties.swift */, 47F7923E203492E3005E7DB6 /* KeyRecord+CoreDataClass.swift */, 47F7923F203492E3005E7DB6 /* KeyRecord+CoreDataProperties.swift */, 475B00401F7BB6D6006CDD41 /* PersistentKey+CoreDataClass.swift */, @@ -1036,6 +1047,7 @@ A1D5076D1E80254D00B68B38 /* keyView */ = { isa = PBXGroup; children = ( + 4751C6F923449699006B2A4D /* CryptoManagementViewController.swift */, A1D5076E1E80257A00B68B38 /* KeyViewController.swift */, 477670C3228453FB00043604 /* ButtonCell.xib */, 477670C5228454F700043604 /* ButtonCell.swift */, @@ -1043,6 +1055,7 @@ 47E7376F22845F3A00972401 /* KeyViews.storyboard */, 47E737732284610E00972401 /* KeyCell.xib */, 47E737752284632F00972401 /* KeyCell.swift */, + 4751C6FB2344C8D1006B2A4D /* KeyTableViewController.swift */, ); name = keyView; sourceTree = "<group>"; @@ -1483,6 +1496,7 @@ A1F8541021E8A60800614514 /* IntroSecretViewController.swift in Sources */, A1ACDD0921EB9C4C00A059D0 /* IntroInputViewController.swift in Sources */, 476916A0216B86A100491527 /* PersistentMail +CoreDataClass.swift in Sources */, + 4751C7002344D37C006B2A4D /* SecretKey+CoreDataClass.swift in Sources */, A1AEBA5921E808CB00C84E59 /* IntroYesNoViewController.swift in Sources */, A1EB05941D956931008659C1 /* InboxCellDelegator.swift in Sources */, 8428A85D1F436A05007649A5 /* Badges.swift in Sources */, @@ -1490,6 +1504,7 @@ 472F39811E1E5347009260FB /* Mail_Address+CoreDataClass.swift in Sources */, A1EB05821D95685B008659C1 /* CollectionDataDelegate.swift in Sources */, 47A5D6E22294BF3B0084F81D /* TempKey.swift in Sources */, + 4751C7012344D37C006B2A4D /* SecretKey+CoreDataProperties.swift in Sources */, 47D1302B1F7CEE6D007B14DF /* DebugSettings.swift in Sources */, A1EB05801D956851008659C1 /* SendViewController.swift in Sources */, 479C649B21F45DAF00A01071 /* PasswordToggleVisibilityView.swift in Sources */, @@ -1538,6 +1553,7 @@ F119D2901E364B59001D732A /* AnimatedSendIcon.swift in Sources */, 4707096D1F8F9F4900657F41 /* ExportViewController.swift in Sources */, F12060801DA540FE00F6EF37 /* RefreshControlExtension.swift in Sources */, + 4751C6FC2344C8D1006B2A4D /* KeyTableViewController.swift in Sources */, A13526811D955BDF00D3BFE1 /* enzevalos_iphone.xcdatamodeld in Sources */, 472F39821E1E5347009260FB /* Mail_Address+CoreDataProperties.swift in Sources */, 477548E221F77466000B22A8 /* SecurityIndicator.swift in Sources */, @@ -1596,6 +1612,7 @@ F12041FB1DA3FBF7002E4940 /* ListViewController.swift in Sources */, F18B445E1E7044B70080C041 /* FlipTransition.swift in Sources */, 472F397E1E1D0B0B009260FB /* EnzevalosContact+CoreDataProperties.swift in Sources */, + 4751C6FA23449699006B2A4D /* CryptoManagementViewController.swift in Sources */, 478154AC21FF6A9600A931EC /* Mailbot.swift in Sources */, 8428A86E1F436A1E007649A5 /* BadgeCase.swift in Sources */, A1B49E5D21E54CBF00ED86FC /* IntroContactTableViewController.swift in Sources */, @@ -2079,6 +2096,7 @@ A135267F1D955BDF00D3BFE1 /* enzevalos_iphone.xcdatamodeld */ = { isa = XCVersionGroup; children = ( + 4751C6FD2344D169006B2A4D /* enzevalos_iphone 8.xcdatamodel */, 4751C6F0233CE1E4006B2A4D /* enzevalos_iphone 7.xcdatamodel */, A1909719220F887D00FA7B2A /* enzevalos_iphone 6.xcdatamodel */, A15D2D0B21F4CF13007AF2F4 /* enzevalos_iphone 5.xcdatamodel */, @@ -2087,7 +2105,7 @@ 47B2318A1F0D458100961B28 /* enzevalos_iphone 2.xcdatamodel */, A13526801D955BDF00D3BFE1 /* enzevalos_iphone.xcdatamodel */, ); - currentVersion = 4751C6F0233CE1E4006B2A4D /* enzevalos_iphone 7.xcdatamodel */; + currentVersion = 4751C6FD2344D169006B2A4D /* enzevalos_iphone 8.xcdatamodel */; path = enzevalos_iphone.xcdatamodeld; sourceTree = "<group>"; versionGroupType = wrapper.xcdatamodel; diff --git a/enzevalos_iphone/CryptoManagementViewController.swift b/enzevalos_iphone/CryptoManagementViewController.swift new file mode 100644 index 0000000000000000000000000000000000000000..957ef087c97d40242cc00ae7fe024f390b487d21 --- /dev/null +++ b/enzevalos_iphone/CryptoManagementViewController.swift @@ -0,0 +1,147 @@ +// +// CryptoManagementViewController.swift +// enzevalos_iphone +// +// Created by Oliver Wiese on 02.10.19. +// Copyright © 2019 fu-berlin. All rights reserved. +// + +import UIKit + +class CryptoManagementViewController: UITableViewController { + enum Cells { + case Info, YourID, OtherID + + var name: String { + get { + switch self { + case .Info: + return "InfoField" + case .YourID: + return "YourID" + case .OtherID: + return "OtherID" + } + } + } + var text: String { + get { + switch self { + case .Info: + return "Here you can organize and manage your and others cryptographic idenities." + case .YourID: + return "YourID" + case .OtherID: + return "OtherID" + } + } + } + } + + override func viewDidLoad() { + super.viewDidLoad() + self.title = NSLocalizedString("Management.Crypto.Title", comment: "") + + // Uncomment the following line to preserve selection between presentations + // self.clearsSelectionOnViewWillAppear = false + + // Uncomment the following line to display an Edit button in the navigation bar for this view controller. + // self.navigationItem.rightBarButtonItem = self.editButtonItem + } + + // MARK: - Table view data source + + override func numberOfSections(in tableView: UITableView) -> Int { + return 1 + } + + override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { + return 3 + } + + + override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { + if indexPath.row == 0 { + return infoCell(cellForRowAt: indexPath) + } + else if indexPath.row == 1 { + return yourIDCell(cellForRowAt: indexPath) + } + else { + return otherIDCell(cellForRowAt: indexPath) + } + } + + + private func infoCell(cellForRowAt indexPath: IndexPath) -> UITableViewCell { + return simpleCell(type: .Info, cellForRowAt: indexPath) + } + + private func yourIDCell(cellForRowAt indexPath: IndexPath) -> UITableViewCell { + return simpleCell(type: .YourID, cellForRowAt: indexPath) + } + + private func otherIDCell(cellForRowAt indexPath: IndexPath) -> UITableViewCell { + let cell = simpleCell(type: Cells.OtherID, cellForRowAt: indexPath) + return cell + } + + private func simpleCell(type: Cells, cellForRowAt indexPath: IndexPath) -> UITableViewCell { + let cell = tableView.dequeueReusableCell(withIdentifier: type.name, for: indexPath) + + cell.detailTextLabel?.text = type.text + + return cell + } + + /* + // Override to support conditional editing of the table view. + override func tableView(_ tableView: UITableView, canEditRowAt indexPath: IndexPath) -> Bool { + // Return false if you do not want the specified item to be editable. + return true + } + */ + + + /* + // Override to support editing the table view. + override func tableView(_ tableView: UITableView, commit editingStyle: UITableViewCell.EditingStyle, forRowAt indexPath: IndexPath) { + if editingStyle == .delete { + // Delete the row from the data source + tableView.deleteRows(at: [indexPath], with: .fade) + } else if editingStyle == .insert { + // Create a new instance of the appropriate class, insert it into the array, and add a new row to the table view + } + } + */ + + /* + // Override to support rearranging the table view. + override func tableView(_ tableView: UITableView, moveRowAt fromIndexPath: IndexPath, to: IndexPath) { + + } + */ + + /* + // Override to support conditional rearranging of the table view. + override func tableView(_ tableView: UITableView, canMoveRowAt indexPath: IndexPath) -> Bool { + // Return false if you do not want the item to be re-orderable. + return true + } + */ + + + // MARK: - Navigation + + // In a storyboard-based application, you will often want to do a little preparation before navigation + override func prepare(for segue: UIStoryboardSegue, sender: Any?) { + // Get the new view controller using segue.destination. + // Pass the selected object to the new view controller. + if segue.identifier == "showOtherID2" || segue.identifier == "showOtherID" { + let destinationViewController = segue.destination as! KeyTableViewController + destinationViewController.showYourIDs = false + } + } + + +} diff --git a/enzevalos_iphone/KeyTableViewController.swift b/enzevalos_iphone/KeyTableViewController.swift new file mode 100644 index 0000000000000000000000000000000000000000..20f50f5d05b87951c0973fe6d052e49bc7740cf9 --- /dev/null +++ b/enzevalos_iphone/KeyTableViewController.swift @@ -0,0 +1,126 @@ +// +// KeyTableViewController.swift +// enzevalos_iphone +// +// Created by Oliver Wiese on 02.10.19. +// Copyright © 2019 fu-berlin. All rights reserved. +// + +import UIKit + +class KeyTableViewController: UITableViewController { + + var showYourIDs = true + var keys: [DisplayKey] = [] + var currentPrefKeyRow = IndexPath() + + var prefKeyID: String? { + get { + if showYourIDs { + return DataHandler.handler.prefSecretKey()?.keyID + } else { + return nil + } + } + } + + override func viewDidLoad() { + super.viewDidLoad() + if showYourIDs { + keys = DataHandler.handler.findSecretKeys() + } + else { + keys = DataHandler.handler.findPublicKeys() + } + + + // Uncomment the following line to preserve selection between presentations + // self.clearsSelectionOnViewWillAppear = false + + // Uncomment the following line to display an Edit button in the navigation bar for this view controller. + // self.navigationItem.rightBarButtonItem = self.editButtonItem + } + + // MARK: - Table view data source + + override func numberOfSections(in tableView: UITableView) -> Int { + return 1 + } + + override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { + // #warning Incomplete implementation, return the number of rows + return keys.count + } + + + override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { + var cell: KeyCell + + if let tmpCell = tableView.dequeueReusableCell(withIdentifier: "KeyCell") as? KeyCell { + cell = tmpCell + } else { + tableView.register(UINib.init(nibName: "KeyCell", bundle: nil), forCellReuseIdentifier: "KeyCell") + cell = tableView.dequeueReusableCell(withIdentifier: "KeyCell") as! KeyCell + } + let item = keys[indexPath.row] + cell.idLabel.text = item.keyID + cell.dateLabel.text = item.importDate.description + cell.dateName.text = NSLocalizedString("SecretKeyCell.date", comment: "date") + cell.originLabel.isHidden = true + cell.orignName.text = NSLocalizedString("SecretKeyCell.origin", comment: "origin") + cell.orignName.isHidden = true + if let prefID = prefKeyID, prefID == item.keyID { + currentPrefKeyRow = indexPath + cell.prefIcon.image = NoSecIconStyleKit.imageOfFavorite + cell.prefIcon.isHidden = false + } + return cell + } + + + /* + // Override to support conditional editing of the table view. + override func tableView(_ tableView: UITableView, canEditRowAt indexPath: IndexPath) -> Bool { + // Return false if you do not want the specified item to be editable. + return true + } + */ + + /* + // Override to support editing the table view. + override func tableView(_ tableView: UITableView, commit editingStyle: UITableViewCell.EditingStyle, forRowAt indexPath: IndexPath) { + if editingStyle == .delete { + // Delete the row from the data source + tableView.deleteRows(at: [indexPath], with: .fade) + } else if editingStyle == .insert { + // Create a new instance of the appropriate class, insert it into the array, and add a new row to the table view + } + } + */ + + /* + // Override to support rearranging the table view. + override func tableView(_ tableView: UITableView, moveRowAt fromIndexPath: IndexPath, to: IndexPath) { + + } + */ + + /* + // Override to support conditional rearranging of the table view. + override func tableView(_ tableView: UITableView, canMoveRowAt indexPath: IndexPath) -> Bool { + // Return false if you do not want the item to be re-orderable. + return true + } + */ + + /* + // MARK: - Navigation + + // In a storyboard-based application, you will often want to do a little preparation before navigation + override func prepare(for segue: UIStoryboardSegue, sender: Any?) { + // Get the new view controller using segue.destination. + // Pass the selected object to the new view controller. + } + */ + +} diff --git a/enzevalos_iphone/de.lproj/Localizable.strings b/enzevalos_iphone/de.lproj/Localizable.strings index a7c306ea7d7c8292fce402bd66911612a8a927dd..9d3571482bb81a63db990d3a06c2c4ecdfa5182e 100644 --- a/enzevalos_iphone/de.lproj/Localizable.strings +++ b/enzevalos_iphone/de.lproj/Localizable.strings @@ -301,3 +301,4 @@ "Time.Day.One" = "ein Tag"; "Time.Day.Multiple" = "%@ Tage"; "Time.Day.Today" = "heute"; +"Management.Crypto.Title" = "Management"; diff --git a/enzevalos_iphone/en.lproj/Localizable.strings b/enzevalos_iphone/en.lproj/Localizable.strings index 734693f9ceafd68e4a276e1edbaa846d601d7982..aeef80f33908ab72d40539bd7bc34c00c8567b15 100644 --- a/enzevalos_iphone/en.lproj/Localizable.strings +++ b/enzevalos_iphone/en.lproj/Localizable.strings @@ -270,3 +270,4 @@ "Time.Day.One" = "one day"; "Time.Day.Multiple" = "%@ days"; "Time.Day.Today" = "today"; +"Management.Crypto.Title" = "Management";