NCManageEndToEndEncryption.m 3.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. //
  2. // NCManageEndToEndEncryption.m
  3. // Nextcloud
  4. //
  5. // Created by Marino Faggiana on 13/10/17.
  6. // Copyright © 2017 TWS. All rights reserved.
  7. //
  8. // Author Marino Faggiana <m.faggiana@twsweb.it>
  9. //
  10. // This program is free software: you can redistribute it and/or modify
  11. // it under the terms of the GNU General Public License as published by
  12. // the Free Software Foundation, either version 3 of the License, or
  13. // (at your option) any later version.
  14. //
  15. // This program is distributed in the hope that it will be useful,
  16. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  17. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  18. // GNU General Public License for more details.
  19. //
  20. // You should have received a copy of the GNU General Public License
  21. // along with this program. If not, see <http://www.gnu.org/licenses/>.
  22. //
  23. #import "NCManageEndToEndEncryption.h"
  24. #import "AppDelegate.h"
  25. #import "CCNetworking.h"
  26. @implementation NCManageEndToEndEncryption
  27. -(id)init
  28. {
  29. XLFormDescriptor *form ;
  30. XLFormSectionDescriptor *section;
  31. XLFormRowDescriptor *row;
  32. form = [XLFormDescriptor formDescriptorWithTitle:NSLocalizedString(@"_e2e_settings_encryption_", nil)];
  33. // Section DELETE KEYS -------------------------------------------------
  34. section = [XLFormSectionDescriptor formSectionWithTitle:NSLocalizedString(@"_e2e_settings_encryption_delete_keys_", nil)];
  35. [form addFormSection:section];
  36. // Delete publicKey
  37. row = [XLFormRowDescriptor formRowDescriptorWithTag:@"deletePublicKey" rowType:XLFormRowDescriptorTypeButton title:NSLocalizedString(@"_e2e_settings_encryption_delete_publicKey_", nil)];
  38. [row.cellConfig setObject:[UIFont systemFontOfSize:15.0]forKey:@"textLabel.font"];
  39. [row.cellConfig setObject:[UIColor blackColor] forKey:@"textLabel.textColor"];
  40. [row.cellConfig setObject:@(NSTextAlignmentLeft) forKey:@"textLabel.textAlignment"];
  41. row.action.formSelector = @selector(deletePublicKey:);
  42. [section addFormRow:row];
  43. // Delete privateKey
  44. row = [XLFormRowDescriptor formRowDescriptorWithTag:@"deletePrivateKey" rowType:XLFormRowDescriptorTypeButton title:NSLocalizedString(@"_e2e_settings_encryption_delete_privateKey_", nil)];
  45. [row.cellConfig setObject:[UIFont systemFontOfSize:15.0]forKey:@"textLabel.font"];
  46. [row.cellConfig setObject:[UIColor blackColor] forKey:@"textLabel.textColor"];
  47. [row.cellConfig setObject:@(NSTextAlignmentLeft) forKey:@"textLabel.textAlignment"];
  48. row.action.formSelector = @selector(deletePrivateKey:);
  49. [section addFormRow:row];
  50. return [super initWithForm:form];
  51. }
  52. - (void)deletePublicKey:(XLFormRowDescriptor *)sender
  53. {
  54. [self deselectFormRow:sender];
  55. CCMetadataNet *metadataNet = [[CCMetadataNet alloc] initWithAccount:app.activeAccount];
  56. metadataNet.action = actionDeleteEndToEndPublicKey;
  57. [app addNetworkingOperationQueue:app.netQueue delegate:app.activeMain metadataNet:metadataNet];
  58. }
  59. - (void)deletePrivateKey:(XLFormRowDescriptor *)sender
  60. {
  61. [self deselectFormRow:sender];
  62. CCMetadataNet *metadataNet = [[CCMetadataNet alloc] initWithAccount:app.activeAccount];
  63. metadataNet.action = actionDeleteEndToEndPrivateKey;
  64. [app addNetworkingOperationQueue:app.netQueue delegate:app.activeMain metadataNet:metadataNet];
  65. }
  66. @end