CCManageCameraUpload.m 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505
  1. //
  2. // CCManageCameraUpload.m
  3. // Crypto Cloud Technology Nextcloud
  4. //
  5. // Created by Marino Faggiana on 01/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 "CCManageCameraUpload.h"
  24. #import "AppDelegate.h"
  25. @implementation CCManageCameraUpload
  26. // From Settings
  27. - (id)initWithCoder:(NSCoder *)aDecoder
  28. {
  29. if (self = [super initWithCoder:aDecoder]) {
  30. [self initializeForm];
  31. }
  32. return self;
  33. }
  34. // From Photos
  35. - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
  36. {
  37. self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
  38. if (self) {
  39. UIBarButtonItem *doneButton = [[UIBarButtonItem alloc ] initWithBarButtonSystemItem:UIBarButtonSystemItemDone target:self action:@selector(done:)];
  40. self.navigationItem.rightBarButtonItem = doneButton;
  41. [self initializeForm];
  42. }
  43. return self;
  44. }
  45. - (void)initializeForm
  46. {
  47. XLFormDescriptor *form ;
  48. XLFormSectionDescriptor *section;
  49. XLFormRowDescriptor *row;
  50. form = [XLFormDescriptor formDescriptorWithTitle:NSLocalizedString(@"_uploading_from_camera_", nil)];
  51. // Camera Upload
  52. section = [XLFormSectionDescriptor formSection];
  53. [form addFormSection:section];
  54. section.footerTitle = NSLocalizedString(@"_photo_folder_photocamera_", nil);
  55. row = [XLFormRowDescriptor formRowDescriptorWithTag:@"cameraupload" rowType:XLFormRowDescriptorTypeBooleanSwitch title:NSLocalizedString(@"_upload_camera_", nil)];
  56. if ([CCCoreData getCameraUploadActiveAccount:app.activeAccount]) row.value = @1;
  57. else row.value = @0;
  58. [row.cellConfig setObject:[UIFont systemFontOfSize:15.0]forKey:@"textLabel.font"];
  59. [section addFormRow:row];
  60. // Camera Upload Photo
  61. section = [XLFormSectionDescriptor formSection];
  62. [form addFormSection:section];
  63. row = [XLFormRowDescriptor formRowDescriptorWithTag:@"camerauploadphoto" rowType:XLFormRowDescriptorTypeBooleanSwitch title:NSLocalizedString(@"_upload_foto_camera_", nil)];
  64. row.hidden = [NSString stringWithFormat:@"$%@==0", @"cameraupload"];
  65. if ([CCCoreData getCameraUploadPhotoActiveAccount:app.activeAccount]) row.value = @1;
  66. else row.value = @0;
  67. [row.cellConfig setObject:[UIFont systemFontOfSize:15.0]forKey:@"textLabel.font"];
  68. [section addFormRow:row];
  69. row = [XLFormRowDescriptor formRowDescriptorWithTag:@"camerauploadcryptatedphoto" rowType:XLFormRowDescriptorTypeBooleanSwitch title:NSLocalizedString(@"_upload_encry_camup_", nil)];
  70. row.hidden = [NSString stringWithFormat:@"$%@==0", @"cameraupload"];
  71. if ([CCCoreData getCameraUploadCryptatedPhotoActiveAccount:app.activeAccount] == YES) row.value = @1;
  72. else row.value = @0;
  73. [row.cellConfig setObject:[UIFont systemFontOfSize:15.0]forKey:@"textLabel.font"];
  74. [section addFormRow:row];
  75. row = [XLFormRowDescriptor formRowDescriptorWithTag:@"camerauploadwwanphoto" rowType:XLFormRowDescriptorTypeBooleanSwitch title:NSLocalizedString(@"_wifi_only_", nil)];
  76. row.hidden = [NSString stringWithFormat:@"$%@==0", @"cameraupload"];
  77. if ([CCCoreData getCameraUploadWWanPhotoActiveAccount:app.activeAccount] == YES) row.value = @1;
  78. else row.value = @0;
  79. [row.cellConfig setObject:[UIFont systemFontOfSize:15.0]forKey:@"textLabel.font"];
  80. [section addFormRow:row];
  81. // Camera Upload Video
  82. section = [XLFormSectionDescriptor formSection];
  83. [form addFormSection:section];
  84. row = [XLFormRowDescriptor formRowDescriptorWithTag:@"camerauploadvideo" rowType:XLFormRowDescriptorTypeBooleanSwitch title:NSLocalizedString(@"_upload_video_camera_", nil)];
  85. row.hidden = [NSString stringWithFormat:@"$%@==0", @"cameraupload"];
  86. if ([CCCoreData getCameraUploadVideoActiveAccount:app.activeAccount]) row.value = @1;
  87. else row.value = @0;
  88. [row.cellConfig setObject:[UIFont systemFontOfSize:15.0]forKey:@"textLabel.font"];
  89. [section addFormRow:row];
  90. row = [XLFormRowDescriptor formRowDescriptorWithTag:@"camerauploadcryptatedvideo" rowType:XLFormRowDescriptorTypeBooleanSwitch title:NSLocalizedString(@"_upload_encry_camup_", nil)];
  91. row.hidden = [NSString stringWithFormat:@"$%@==0", @"cameraupload"];
  92. if ([CCCoreData getCameraUploadCryptatedVideoActiveAccount:app.activeAccount] == YES) row.value = @1;
  93. else row.value = @0;
  94. [row.cellConfig setObject:[UIFont systemFontOfSize:15.0]forKey:@"textLabel.font"];
  95. [section addFormRow:row];
  96. row = [XLFormRowDescriptor formRowDescriptorWithTag:@"camerauploadwwanvideo" rowType:XLFormRowDescriptorTypeBooleanSwitch title:NSLocalizedString(@"_wifi_only_", nil)];
  97. row.hidden = [NSString stringWithFormat:@"$%@==0", @"cameraupload"];
  98. if ([CCCoreData getCameraUploadWWanVideoActiveAccount:app.activeAccount] == YES) row.value = @1;
  99. else row.value = @0;
  100. [row.cellConfig setObject:[UIFont systemFontOfSize:15.0]forKey:@"textLabel.font"];
  101. [section addFormRow:row];
  102. // Camera Upload Background
  103. section = [XLFormSectionDescriptor formSection];
  104. [form addFormSection:section];
  105. row = [XLFormRowDescriptor formRowDescriptorWithTag:@"camerauploadbackground" rowType:XLFormRowDescriptorTypeBooleanSwitch title:NSLocalizedString(@"_upload_camera_background_", nil)];
  106. row.hidden = [NSString stringWithFormat:@"$%@==0", @"cameraupload"];
  107. if ([CCCoreData getCameraUploadBackgroundActiveAccount:app.activeAccount]) row.value = @1;
  108. else row.value = @0;
  109. [row.cellConfig setObject:[UIFont systemFontOfSize:15.0]forKey:@"textLabel.font"];
  110. [section addFormRow:row];
  111. // Camera Upload All Photo
  112. section = [XLFormSectionDescriptor formSection];
  113. [form addFormSection:section];
  114. NSString *title = NSLocalizedString(@"_upload_camera_fullphotos_", nil);
  115. row = [XLFormRowDescriptor formRowDescriptorWithTag:@"camerauploadallphotos" rowType:XLFormRowDescriptorTypeBooleanSwitch title:title];
  116. row.hidden = [NSString stringWithFormat:@"$%@==0", @"cameraupload"];
  117. row.value = 0;
  118. if ([CCCoreData getCameraUploadFullPhotosActiveAccount:app.activeAccount]) row.value = @1;
  119. else row.value = @0;
  120. [row.cellConfig setObject:[UIFont systemFontOfSize:15.0]forKey:@"textLabel.font"];
  121. [section addFormRow:row];
  122. // Camera Upload save album
  123. section = [XLFormSectionDescriptor formSection];
  124. [form addFormSection:section];
  125. row = [XLFormRowDescriptor formRowDescriptorWithTag:@"camerauploadsavealbum" rowType:XLFormRowDescriptorTypeBooleanSwitch title:NSLocalizedString(@"_upload_camera_save_album_", nil)];
  126. row.hidden = [NSString stringWithFormat:@"$%@==0", @"cameraupload"];
  127. if ([CCCoreData getCameraUploadSaveAlbumActiveAccount:app.activeAccount]) row.value = @1;
  128. else row.value = @0;
  129. [row.cellConfig setObject:[UIFont systemFontOfSize:15.0]forKey:@"textLabel.font"];
  130. [section addFormRow:row];
  131. // Camera Upload create subfolder
  132. section = [XLFormSectionDescriptor formSection];
  133. [form addFormSection:section];
  134. row = [XLFormRowDescriptor formRowDescriptorWithTag:@"camerauploadcreatesubfolder" rowType:XLFormRowDescriptorTypeBooleanSwitch title:NSLocalizedString(@"_upload_camera_create_subfolder_", nil)];
  135. row.hidden = [NSString stringWithFormat:@"$%@==0", @"cameraupload"];
  136. if ([CCCoreData getCameraUploadSaveAlbumActiveAccount:app.activeAccount]) row.value = @1;
  137. else row.value = @0;
  138. [row.cellConfig setObject:[UIFont systemFontOfSize:15.0]forKey:@"textLabel.font"];
  139. [section addFormRow:row];
  140. // end
  141. section = [XLFormSectionDescriptor formSection];
  142. [form addFormSection:section];
  143. self.form = form;
  144. }
  145. // Apparirà
  146. - (void)viewWillAppear:(BOOL)animated
  147. {
  148. [super viewWillAppear:animated];
  149. // Color
  150. [CCAspect aspectNavigationControllerBar:self.navigationController.navigationBar hidden:NO];
  151. [CCAspect aspectTabBar:self.tabBarController.tabBar hidden:NO];
  152. //
  153. [self reloadForm];
  154. }
  155. -(void)formRowDescriptorValueHasChanged:(XLFormRowDescriptor *)rowDescriptor oldValue:(id)oldValue newValue:(id)newValue
  156. {
  157. [super formRowDescriptorValueHasChanged:rowDescriptor oldValue:oldValue newValue:newValue];
  158. if ([rowDescriptor.tag isEqualToString:@"cameraupload"]) {
  159. if ([[rowDescriptor.value valueData] boolValue] == YES) {
  160. /*** NEXTCLOUD OWNCLOUD ***/
  161. // Create Folder cameraUpload
  162. if (([app.typeCloud isEqualToString:typeCloudOwnCloud] || [app.typeCloud isEqualToString:typeCloudNextcloud]) && app.activeMain)
  163. [app.activeMain createFolderCameraUpload];
  164. [CCCoreData setCameraUpload:YES activeAccount:app.activeAccount];
  165. // Default
  166. [CCCoreData setCameraUploadFolderName:nil activeAccount:app.activeAccount];
  167. [CCCoreData setCameraUploadFolderPath:nil activeUrl:app.activeUrl typeCloud:app.typeCloud activeAccount:app.activeAccount];
  168. // verifichiamo che almeno uno dei servizi (foto video) siano attivi, in caso contrario attiviamo le foto
  169. if ([CCCoreData getCameraUploadPhotoActiveAccount:app.activeAccount] == NO && [CCCoreData getCameraUploadVideoActiveAccount:app.activeAccount] == NO)
  170. [CCCoreData setCameraUploadPhoto:YES activeAccount:app.activeAccount];
  171. // Settings date
  172. if([CCCoreData getCameraUploadPhotoActiveAccount:app.activeAccount])
  173. [CCCoreData setCameraUploadDatePhoto:[NSDate date]];
  174. if([CCCoreData getCameraUploadVideoActiveAccount:app.activeAccount])
  175. [CCCoreData setCameraUploadDateVideo:[NSDate date]];
  176. } else {
  177. [CCCoreData setCameraUpload:NO activeAccount:app.activeAccount];
  178. [CCCoreData setCameraUploadFullPhotosActiveAccount:NO activeAccount:app.activeAccount];
  179. [CCCoreData setCameraUploadDatePhoto:NULL];
  180. [CCCoreData setCameraUploadDateVideo:NULL];
  181. // remove
  182. [app dropAutomaticUploadWithSelector:selectorUploadAutomatic];
  183. [app dropAutomaticUploadWithSelector:selectorUploadAutomaticAll];
  184. }
  185. // Initialize Camera Upload
  186. [[NSNotificationCenter defaultCenter] postNotificationName:@"initStateCameraUpload" object:nil];
  187. [self reloadForm];
  188. }
  189. if ([rowDescriptor.tag isEqualToString:@"camerauploadbackground"]) {
  190. if ([[rowDescriptor.value valueData] boolValue] == YES) {
  191. BOOL isLocationIsEnabled = NO;
  192. if (app.activePhotosCameraUpload)
  193. [app.activePhotosCameraUpload checkIfLocationIsEnabled];
  194. if(isLocationIsEnabled == YES) {
  195. UIAlertView * alertView = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"_cameraupload_background_title_", nil) message:[CCUtility localizableBrand:@"_cameraupload_background_msg_" table:nil] delegate:nil cancelButtonTitle:nil otherButtonTitles:NSLocalizedString(@"_ok_", nil), nil];
  196. [alertView show];
  197. [CCCoreData setCameraUploadBackground:YES activeAccount:app.activeAccount];
  198. } else {
  199. [self reloadForm];
  200. }
  201. } else {
  202. [CCCoreData setCameraUploadBackground:NO activeAccount:app.activeAccount];
  203. [[CCManageLocation sharedSingleton] stopSignificantChangeUpdates];
  204. }
  205. }
  206. if ([rowDescriptor.tag isEqualToString:@"camerauploadallphotos"]) {
  207. if ([[rowDescriptor.value valueData] boolValue] == YES) {
  208. [[NSNotificationCenter defaultCenter] postNotificationName:@"setupCameraUploadFull" object:nil];
  209. [CCCoreData setCameraUploadFullPhotosActiveAccount:YES activeAccount:app.activeAccount];
  210. } else {
  211. [app dropAutomaticUploadWithSelector:selectorUploadAutomaticAll];
  212. [CCCoreData setCameraUploadFullPhotosActiveAccount:NO activeAccount:app.activeAccount];
  213. }
  214. }
  215. if ([rowDescriptor.tag isEqualToString:@"camerauploadphoto"]) {
  216. if ([[rowDescriptor.value valueData] boolValue] == YES) {
  217. [CCCoreData setCameraUploadDatePhoto:[NSDate date]];
  218. } else {
  219. [CCCoreData setCameraUploadDatePhoto:NULL];
  220. }
  221. [CCCoreData setCameraUploadPhoto:[[rowDescriptor.value valueData] boolValue] activeAccount:app.activeAccount];
  222. }
  223. if ([rowDescriptor.tag isEqualToString:@"camerauploadcryptatedphoto"]) {
  224. [CCCoreData setCameraUploadCryptatedPhoto:[[rowDescriptor.value valueData] boolValue] activeAccount:app.activeAccount];
  225. }
  226. if ([rowDescriptor.tag isEqualToString:@"camerauploadwwanphoto"]) {
  227. [CCCoreData setCameraUploadWWanPhoto:[[rowDescriptor.value valueData] boolValue] activeAccount:app.activeAccount];
  228. }
  229. if ([rowDescriptor.tag isEqualToString:@"camerauploadvideo"]) {
  230. if ([[rowDescriptor.value valueData] boolValue] == YES) {
  231. [CCCoreData setCameraUploadDateVideo:[NSDate date]];
  232. } else {
  233. [CCCoreData setCameraUploadDateVideo:NULL];
  234. }
  235. [CCCoreData setCameraUploadVideo:[[rowDescriptor.value valueData] boolValue] activeAccount:app.activeAccount];
  236. }
  237. if ([rowDescriptor.tag isEqualToString:@"camerauploadcryptatedvideo"]) {
  238. [CCCoreData setCameraUploadCryptatedVideo:[[rowDescriptor.value valueData] boolValue] activeAccount:app.activeAccount];
  239. }
  240. if ([rowDescriptor.tag isEqualToString:@"camerauploadwwanvideo"]) {
  241. [CCCoreData setCameraUploadWWanVideo:[[rowDescriptor.value valueData] boolValue] activeAccount:app.activeAccount];
  242. }
  243. if ([rowDescriptor.tag isEqualToString:@"camerauploadsavealbum"]) {
  244. [CCCoreData setCameraUploadSaveAlbum:[[rowDescriptor.value valueData] boolValue] activeAccount:app.activeAccount];
  245. }
  246. if ([rowDescriptor.tag isEqualToString:@"camerauploadcreatesubfolder"]) {
  247. [CCCoreData setCameraUploadCreateSubfolderActiveAccount:[[rowDescriptor.value valueData] boolValue] activeAccount:app.activeAccount];
  248. }
  249. }
  250. - (void)done:(XLFormRowDescriptor *)sender
  251. {
  252. [self dismissViewControllerAnimated:YES completion:nil];
  253. }
  254. - (void)reloadForm
  255. {
  256. self.form.delegate = nil;
  257. XLFormRowDescriptor *rowCameraupload = [self.form formRowWithTag:@"cameraupload"];
  258. XLFormRowDescriptor *rowCamerauploadphoto = [self.form formRowWithTag:@"camerauploadphoto"];
  259. XLFormRowDescriptor *rowCamerauploadcryptatedphoto = [self.form formRowWithTag:@"camerauploadcryptatedphoto"];
  260. XLFormRowDescriptor *rowCamerauploadwwanphoto = [self.form formRowWithTag:@"camerauploadwwanphoto"];
  261. XLFormRowDescriptor *rowCamerauploadvideo = [self.form formRowWithTag:@"camerauploadvideo"];
  262. XLFormRowDescriptor *rowCamerauploadcryptatedvideo = [self.form formRowWithTag:@"camerauploadcryptatedvideo"];
  263. XLFormRowDescriptor *rowCamerauploadwwanvideo = [self.form formRowWithTag:@"camerauploadwwanvideo"];
  264. XLFormRowDescriptor *rowCamerauploadBackground = [self.form formRowWithTag:@"camerauploadbackground"];
  265. XLFormRowDescriptor *rowCamerauploadAllPhotos = [self.form formRowWithTag:@"camerauploadallphotos"];
  266. XLFormRowDescriptor *rowCamerauploadSaveAlbum = [self.form formRowWithTag:@"camerauploadsavealbum"];
  267. XLFormRowDescriptor *rowCamerauploadCreateSubfolder = [self.form formRowWithTag:@"camerauploadcreatesubfolder"];
  268. // - STATUS ---------------------
  269. if ([CCCoreData getCameraUploadActiveAccount:app.activeAccount])
  270. [rowCameraupload setValue:@1]; else [rowCameraupload setValue:@0];
  271. if ([CCCoreData getCameraUploadPhotoActiveAccount:app.activeAccount])
  272. [rowCamerauploadphoto setValue:@1]; else [rowCamerauploadphoto setValue:@0];
  273. if ([CCCoreData getCameraUploadCryptatedPhotoActiveAccount:app.activeAccount])
  274. [rowCamerauploadcryptatedphoto setValue:@1]; else [rowCamerauploadcryptatedphoto setValue:@0];
  275. if ([CCCoreData getCameraUploadWWanPhotoActiveAccount:app.activeAccount])
  276. [rowCamerauploadwwanphoto setValue:@1]; else [rowCamerauploadwwanphoto setValue:@0];
  277. if ([CCCoreData getCameraUploadVideoActiveAccount:app.activeAccount])
  278. [rowCamerauploadvideo setValue:@1]; else [rowCamerauploadvideo setValue:@0];
  279. if ([CCCoreData getCameraUploadCryptatedVideoActiveAccount:app.activeAccount])
  280. [rowCamerauploadcryptatedvideo setValue:@1]; else [rowCamerauploadcryptatedvideo setValue:@0];
  281. if ([CCCoreData getCameraUploadWWanVideoActiveAccount:app.activeAccount])
  282. [rowCamerauploadwwanvideo setValue:@1]; else [rowCamerauploadwwanvideo setValue:@0];
  283. if ([CCCoreData getCameraUploadBackgroundActiveAccount:app.activeAccount])
  284. [rowCamerauploadBackground setValue:@1]; else [rowCamerauploadBackground setValue:@0];
  285. if ([CCCoreData getCameraUploadFullPhotosActiveAccount:app.activeAccount])
  286. [rowCamerauploadAllPhotos setValue:@1]; else [rowCamerauploadAllPhotos setValue:@0];
  287. if ([CCCoreData getCameraUploadSaveAlbumActiveAccount:app.activeAccount])
  288. [rowCamerauploadSaveAlbum setValue:@1]; else [rowCamerauploadSaveAlbum setValue:@0];
  289. if ([CCCoreData getCameraUploadCreateSubfolderActiveAccount:app.activeAccount])
  290. [rowCamerauploadCreateSubfolder setValue:@1]; else [rowCamerauploadCreateSubfolder setValue:@0];
  291. // - HIDDEN ---------------------
  292. rowCamerauploadphoto.hidden = [NSString stringWithFormat:@"$%@==0", @"cameraupload"];
  293. rowCamerauploadcryptatedphoto.hidden = [NSString stringWithFormat:@"$%@==0", @"cameraupload"];
  294. rowCamerauploadwwanphoto.hidden = [NSString stringWithFormat:@"$%@==0", @"cameraupload"];
  295. rowCamerauploadvideo.hidden = [NSString stringWithFormat:@"$%@==0", @"cameraupload"];
  296. rowCamerauploadcryptatedvideo.hidden = [NSString stringWithFormat:@"$%@==0", @"cameraupload"];
  297. rowCamerauploadwwanvideo.hidden = [NSString stringWithFormat:@"$%@==0", @"cameraupload"];
  298. rowCamerauploadBackground.hidden = [NSString stringWithFormat:@"$%@==0", @"cameraupload"];
  299. rowCamerauploadAllPhotos.hidden = [NSString stringWithFormat:@"$%@==0", @"cameraupload"];
  300. rowCamerauploadSaveAlbum.hidden = [NSString stringWithFormat:@"$%@==0", @"cameraupload"];
  301. rowCamerauploadCreateSubfolder.hidden = [NSString stringWithFormat:@"$%@==0", @"cameraupload"];
  302. // ----------------------
  303. [self.tableView reloadData];
  304. self.form.delegate = self;
  305. }
  306. - (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section
  307. {
  308. NSString *sectionName;
  309. switch (section)
  310. {
  311. case 0:
  312. sectionName = NSLocalizedString(@"_uploading_from_camera_", nil);
  313. break;
  314. case 1:
  315. if ([CCCoreData getCameraUploadActiveAccount:app.activeAccount]) sectionName = NSLocalizedString(@"_upload_automatic_photos_", nil);
  316. else sectionName = @"";
  317. break;
  318. case 2:
  319. if ([CCCoreData getCameraUploadActiveAccount:app.activeAccount]) sectionName = NSLocalizedString(@"_upload_automatic_videos_", nil);
  320. else sectionName = @"";
  321. break;
  322. case 3:
  323. if ([CCCoreData getCameraUploadActiveAccount:app.activeAccount]) sectionName = NSLocalizedString(@"_upload_camera_background_", nil);
  324. else sectionName = @"";
  325. break;
  326. case 4:
  327. if ([CCCoreData getCameraUploadActiveAccount:app.activeAccount]) sectionName = [NSLocalizedString(@"_upload_camera_fullphotos_", nil) stringByAppendingString:@" (beta)"];
  328. else sectionName = @"";
  329. break;
  330. case 5:
  331. if ([CCCoreData getCameraUploadActiveAccount:app.activeAccount]) sectionName = NSLocalizedString(@"_upload_camera_save_album_", nil);
  332. else sectionName = @"";
  333. break;
  334. case 6:
  335. if ([CCCoreData getCameraUploadActiveAccount:app.activeAccount]) sectionName = NSLocalizedString(@"_upload_camera_create_subfolder_", nil);
  336. else sectionName = @"";
  337. break;
  338. }
  339. return sectionName;
  340. }
  341. - (NSString *)tableView:(UITableView *)tableView titleForFooterInSection:(NSInteger)section
  342. {
  343. NSString *sectionName;
  344. switch (section)
  345. {
  346. case 0:
  347. sectionName = [CCUtility localizableBrand:@"_photo_folder_photocamera_" table:nil];
  348. break;
  349. case 2:
  350. if ([CCCoreData getCameraUploadActiveAccount:app.activeAccount]) sectionName = [CCUtility localizableBrand:@"_upload_automatic_videos_footer_" table:nil ];
  351. else sectionName = @"";
  352. break;
  353. case 3:
  354. if ([CCCoreData getCameraUploadActiveAccount:app.activeAccount]) sectionName = [CCUtility localizableBrand:@"_photo_folder_background_" table:nil];
  355. else sectionName = @"";
  356. break;
  357. case 4:
  358. if ([CCCoreData getCameraUploadActiveAccount:app.activeAccount]) sectionName = [CCUtility localizableBrand:@"_upload_camera_fullphotos_footer_" table:nil];
  359. else sectionName = @"";
  360. break;
  361. case 5:
  362. if ([CCCoreData getCameraUploadActiveAccount:app.activeAccount]) sectionName = [CCUtility localizableBrand:@"_upload_camera_save_album_footer_" table:nil];
  363. else sectionName = @"";
  364. break;
  365. case 6:
  366. if ([CCCoreData getCameraUploadActiveAccount:app.activeAccount]) sectionName = [CCUtility localizableBrand:@"_upload_camera_create_subfolder_footer_" table:nil];
  367. else sectionName = @"";
  368. break;
  369. }
  370. return sectionName;
  371. }
  372. @end