NCEntoToEndInterface.swift 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. //
  2. // NCEntoToEndInterface.swift
  3. // Nextcloud
  4. //
  5. // Created by Marino Faggiana on 03/04/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 Foundation
  24. class NCEntoToEndInterface : NSObject {
  25. let appDelegate = UIApplication.shared.delegate as! AppDelegate
  26. override init() {
  27. }
  28. // --------------------------------------------------------------------------------------------
  29. // MARK: Mark/Delete Encrypted Folder
  30. // --------------------------------------------------------------------------------------------
  31. @objc func markEndToEndFolderEncryptedSuccess(_ metadataNet: CCMetadataNet) {
  32. }
  33. @objc func markEndToEndFolderEncryptedFailure(_ metadataNet: CCMetadataNet, message: NSString, errorCode: NSInteger)
  34. {
  35. // Unauthorized
  36. if (errorCode == kOCErrorServerUnauthorized) {
  37. appDelegate.openLoginView(appDelegate.activeMain, loginType: loginModifyPasswordUser)
  38. }
  39. if (errorCode != kOCErrorServerUnauthorized) {
  40. appDelegate.messageNotification("_error_", description: message as String!, visible: true, delay: TimeInterval(k_dismissAfterSecond), type: TWMessageBarMessageType.error, errorCode: errorCode)
  41. }
  42. }
  43. @objc func markEndToEndFolderEncrypted(_ metadata: tableMetadata) {
  44. let metadataNet: CCMetadataNet = CCMetadataNet.init(account: appDelegate.activeAccount)
  45. metadataNet.action = actionMarkEndToEndFolderEncrypted;
  46. metadataNet.fileID = metadata.fileID;
  47. appDelegate.addNetworkingOperationQueue(appDelegate.netQueue, delegate: self, metadataNet: metadataNet)
  48. }
  49. @objc func deleteEndToEndFolderEncryptedSuccess(_ metadataNet: CCMetadataNet) {
  50. }
  51. @objc func deleteEndToEndFolderEncryptedFailure(_ metadataNet: CCMetadataNet, message: NSString, errorCode: NSInteger)
  52. {
  53. // Unauthorized
  54. if (errorCode == kOCErrorServerUnauthorized) {
  55. appDelegate.openLoginView(appDelegate.activeMain, loginType: loginModifyPasswordUser)
  56. }
  57. if (errorCode != kOCErrorServerUnauthorized) {
  58. appDelegate.messageNotification("_error_", description: message as String!, visible: true, delay: TimeInterval(k_dismissAfterSecond), type: TWMessageBarMessageType.error, errorCode: errorCode)
  59. }
  60. }
  61. @objc func deleteEndToEndFolderEncrypted(_ metadata: tableMetadata) {
  62. let metadataNet: CCMetadataNet = CCMetadataNet.init(account: appDelegate.activeAccount)
  63. metadataNet.action = actionDeleteEndToEndFolderEncrypted;
  64. metadataNet.fileID = metadata.fileID;
  65. appDelegate.addNetworkingOperationQueue(appDelegate.netQueue, delegate: self, metadataNet: metadataNet)
  66. }
  67. }