CCManageOptimizations.m 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. //
  2. // CCManageOptimizations.m
  3. // Crypto Cloud Technology Nextcloud
  4. //
  5. // Created by Marino Faggiana on 22/09/15.
  6. // Copyright (c) 2014 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 "CCManageOptimizations.h"
  24. #import "CCUtility.h"
  25. @implementation CCManageOptimizations
  26. - (id)initWithCoder:(NSCoder *)aDecoder
  27. {
  28. self = [super initWithCoder:aDecoder];
  29. if (self) {
  30. [self initializeForm];
  31. }
  32. return self;
  33. }
  34. - (void)initializeForm
  35. {
  36. XLFormDescriptor *form ;
  37. XLFormSectionDescriptor *section;
  38. XLFormRowDescriptor *row;
  39. form = [XLFormDescriptor formDescriptorWithTitle:NSLocalizedString(@"_optimizations_", nil)];
  40. section = [XLFormSectionDescriptor formSectionWithTitle:NSLocalizedString(@"_optimized_photos_", nil)];
  41. [form addFormSection:section];
  42. section.footerTitle = NSLocalizedString(@"_optimized_photos_how_", nil);
  43. row = [XLFormRowDescriptor formRowDescriptorWithTag:@"optimizedphoto" rowType:XLFormRowDescriptorTypeBooleanSwitch title:NSLocalizedString(@"_optimized_photos_", nil)];
  44. if ([CCUtility getOptimizedPhoto]) row.value = @"1";
  45. else row.value = @"0";
  46. [row.cellConfig setObject:[UIFont systemFontOfSize:15.0]forKey:@"textLabel.font"];
  47. [section addFormRow:row];
  48. section = [XLFormSectionDescriptor formSectionWithTitle:NSLocalizedString(@"_upload_del_photos_", nil)];
  49. [form addFormSection:section];
  50. section.footerTitle = [CCUtility localizableBrand:@"_upload_del_photos_how_" table:nil];
  51. row = [XLFormRowDescriptor formRowDescriptorWithTag:@"uploadremovephoto" rowType:XLFormRowDescriptorTypeBooleanSwitch title:NSLocalizedString(@"_upload_del_photos_", nil)];
  52. if ([CCUtility getUploadAndRemovePhoto]) row.value = @"1";
  53. else row.value = @"0";
  54. [row.cellConfig setObject:[UIFont systemFontOfSize:15.0]forKey:@"textLabel.font"];
  55. [section addFormRow:row];
  56. section = [XLFormSectionDescriptor formSection];
  57. [form addFormSection:section];
  58. self.form = form;
  59. }
  60. // Apparirà
  61. - (void)viewWillAppear:(BOOL)animated
  62. {
  63. [super viewWillAppear:animated];
  64. // Color
  65. [CCAspect aspectNavigationControllerBar:self.navigationController.navigationBar hidden:NO];
  66. [CCAspect aspectTabBar:self.tabBarController.tabBar hidden:NO];
  67. }
  68. -(void)formRowDescriptorValueHasChanged:(XLFormRowDescriptor *)rowDescriptor oldValue:(id)oldValue newValue:(id)newValue
  69. {
  70. [super formRowDescriptorValueHasChanged:rowDescriptor oldValue:oldValue newValue:newValue];
  71. if ([rowDescriptor.tag isEqualToString:@"optimizedphoto"]) {
  72. if ([[rowDescriptor.value valueData] boolValue] == YES) {
  73. [CCUtility setOptimizedPhoto:YES];
  74. } else {
  75. [CCUtility setOptimizedPhoto:NO];
  76. }
  77. }
  78. if ([rowDescriptor.tag isEqualToString:@"uploadremovephoto"]) {
  79. if ([[rowDescriptor.value valueData] boolValue] == YES) {
  80. [CCUtility setUploadAndRemovePhoto:YES];
  81. } else {
  82. [CCUtility setUploadAndRemovePhoto:NO];
  83. }
  84. }
  85. }
  86. @end