CCSettings.m 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466
  1. //
  2. // CCSettings.m
  3. // Nextcloud
  4. //
  5. // Created by Marino Faggiana on 24/11/14.
  6. // Copyright (c) 2014 Marino Faggiana. All rights reserved.
  7. //
  8. // Author Marino Faggiana <marino.faggiana@nextcloud.com>
  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 "CCSettings.h"
  24. #import "AppDelegate.h"
  25. #import "CCMain.h"
  26. #import "OCCapabilities.h"
  27. #import "CCSynchronize.h"
  28. #import "CCAdvanced.h"
  29. #import "CCManageAccount.h"
  30. #import "NCManageEndToEndEncryption.h"
  31. #import "NCBridgeSwift.h"
  32. #import <TOPasscodeViewController/TOPasscodeViewController.h>
  33. #define alertViewEsci 1
  34. #define alertViewAzzeraCache 2
  35. @interface CCSettings () <TOPasscodeSettingsViewControllerDelegate, TOPasscodeViewControllerDelegate>
  36. {
  37. AppDelegate *appDelegate;
  38. TOPasscodeViewController *passcodeViewController;
  39. TOPasscodeSettingsViewController *passcodeSettingsViewController;
  40. }
  41. @end
  42. @implementation CCSettings
  43. - (void)initializeForm
  44. {
  45. XLFormDescriptor *form = [XLFormDescriptor formDescriptor];
  46. XLFormSectionDescriptor *section;
  47. XLFormRowDescriptor *row;
  48. NSInteger serverVersionMajor = [[NCManageDatabase sharedInstance] getCapabilitiesServerIntWithAccount:appDelegate.activeAccount elements:NCElementsJSON.shared.capabilitiesVersionMajor];
  49. form.rowNavigationOptions = XLFormRowNavigationOptionNone;
  50. // Section AUTO UPLOAD OF CAMERA IMAGES ----------------------------
  51. section = [XLFormSectionDescriptor formSection];
  52. [form addFormSection:section];
  53. row = [XLFormRowDescriptor formRowDescriptorWithTag:@"autoUpload" rowType:XLFormRowDescriptorTypeButton title:NSLocalizedString(@"_settings_autoupload_", nil)];
  54. row.cellConfigAtConfigure[@"backgroundColor"] = NCBrandColor.sharedInstance.backgroundCell;
  55. [row.cellConfig setObject:[UIFont systemFontOfSize:15.0] forKey:@"textLabel.font"];
  56. [row.cellConfig setObject:NCBrandColor.sharedInstance.textView forKey:@"textLabel.textColor"];
  57. [row.cellConfig setObject:[CCGraphics changeThemingColorImage:[UIImage imageNamed:@"autoUpload"] width:50 height:50 color:NCBrandColor.sharedInstance.icon] forKey:@"imageView.image"];
  58. row.action.viewControllerClass = [CCManageAutoUpload class];
  59. [section addFormRow:row];
  60. // Section FOLDERS FAVORITES OFFLINE ------------------------------------
  61. section = [XLFormSectionDescriptor formSection];
  62. [form addFormSection:section];
  63. row = [XLFormRowDescriptor formRowDescriptorWithTag:@"favoriteoffline" rowType:XLFormRowDescriptorTypeBooleanSwitch title:NSLocalizedString(@"_favorite_offline_", nil)];
  64. row.cellConfigAtConfigure[@"backgroundColor"] = NCBrandColor.sharedInstance.backgroundCell;
  65. [row.cellConfig setObject:[CCGraphics changeThemingColorImage:[UIImage imageNamed:@"favorite"] width:50 height:50 color:NCBrandColor.sharedInstance.icon] forKey:@"imageView.image"];
  66. [row.cellConfig setObject:[UIFont systemFontOfSize:15.0] forKey:@"textLabel.font"];
  67. [row.cellConfig setObject:NCBrandColor.sharedInstance.textView forKey:@"textLabel.textColor"];
  68. [section addFormRow:row];
  69. // Section : LOCK --------------------------------------------------------------
  70. section = [XLFormSectionDescriptor formSectionWithTitle:NSLocalizedString(@"_lock_", nil)];
  71. [form addFormSection:section];
  72. // Lock active YES/NO
  73. row = [XLFormRowDescriptor formRowDescriptorWithTag:@"bloccopasscode" rowType:XLFormRowDescriptorTypeButton title:NSLocalizedString(@"_lock_not_active_", nil)];
  74. row.cellConfigAtConfigure[@"backgroundColor"] = NCBrandColor.sharedInstance.backgroundCell;
  75. [row.cellConfig setObject:[CCGraphics changeThemingColorImage:[UIImage imageNamed:@"settingsPasscodeNO"] multiplier:2 color:NCBrandColor.sharedInstance.icon] forKey:@"imageView.image"];
  76. [row.cellConfig setObject:[UIFont systemFontOfSize:15.0] forKey:@"textLabel.font"];
  77. [row.cellConfig setObject:NCBrandColor.sharedInstance.textView forKey:@"textLabel.textColor"];
  78. [row.cellConfig setObject:@(NSTextAlignmentLeft) forKey:@"textLabel.textAlignment"];
  79. //[row.cellConfig setObject:@(UITableViewCellAccessoryDisclosureIndicator) forKey:@"accessoryType"];
  80. row.action.formSelector = @selector(passcode:);
  81. [section addFormRow:row];
  82. // Lock no screen
  83. row = [XLFormRowDescriptor formRowDescriptorWithTag:@"notPasscodeAtStart" rowType:XLFormRowDescriptorTypeBooleanSwitch title:NSLocalizedString(@"_lock_protection_no_screen_", nil)];
  84. row.cellConfigAtConfigure[@"backgroundColor"] = NCBrandColor.sharedInstance.backgroundCell;
  85. [row.cellConfig setObject:[UIFont systemFontOfSize:15.0] forKey:@"textLabel.font"];
  86. [row.cellConfig setObject:NCBrandColor.sharedInstance.textView forKey:@"textLabel.textColor"];
  87. [section addFormRow:row];
  88. // Section : Screen --------------------------------------------------------------
  89. section = [XLFormSectionDescriptor formSectionWithTitle:NSLocalizedString(@"_screen_", nil)];
  90. [form addFormSection:section];
  91. // Dark Mode
  92. if (@available(iOS 13.0, *)) {
  93. row = [XLFormRowDescriptor formRowDescriptorWithTag:@"darkModeDetect" rowType:XLFormRowDescriptorTypeBooleanSwitch title:NSLocalizedString(@"_dark_mode_detect_", nil)];
  94. row.cellConfigAtConfigure[@"backgroundColor"] = NCBrandColor.sharedInstance.backgroundCell;
  95. [row.cellConfig setObject:[CCGraphics changeThemingColorImage:[UIImage imageNamed:@"darkModeDetect"] width:50 height:50 color:NCBrandColor.sharedInstance.icon] forKey:@"imageView.image"];
  96. [row.cellConfig setObject:[UIFont systemFontOfSize:15.0] forKey:@"textLabel.font"];
  97. [row.cellConfig setObject:NCBrandColor.sharedInstance.textView forKey:@"textLabel.textColor"];
  98. if ([CCUtility getDarkModeDetect]) row.value = @1;
  99. else row.value = @0;
  100. [section addFormRow:row];
  101. } else {
  102. row = [XLFormRowDescriptor formRowDescriptorWithTag:@"darkMode" rowType:XLFormRowDescriptorTypeBooleanSwitch title:NSLocalizedString(@"_dark_mode_", nil)];
  103. row.cellConfigAtConfigure[@"backgroundColor"] = NCBrandColor.sharedInstance.backgroundCell;
  104. [row.cellConfig setObject:[CCGraphics changeThemingColorImage:[UIImage imageNamed:@"themeLightDark"] width:50 height:50 color:NCBrandColor.sharedInstance.icon] forKey:@"imageView.image"];
  105. [row.cellConfig setObject:[UIFont systemFontOfSize:15.0] forKey:@"textLabel.font"];
  106. [row.cellConfig setObject:NCBrandColor.sharedInstance.textView forKey:@"textLabel.textColor"];
  107. if ([CCUtility getDarkMode]) row.value = @1;
  108. else row.value = @0;
  109. [section addFormRow:row];
  110. }
  111. // Section : E2EEncryption From Nextcloud 19 --------------------------------------------------------------
  112. if (serverVersionMajor >= k_nextcloud_version_19_0) {
  113. section = [XLFormSectionDescriptor formSectionWithTitle:NSLocalizedString(@"_e2e_settings_title_", nil)];
  114. [form addFormSection:section];
  115. // EndToEnd Encryption
  116. NSString *title = [NSString stringWithFormat:@"%@ (%@)",NSLocalizedString(@"_e2e_settings_", nil), NSLocalizedString(@"_experimental_", nil)];
  117. row = [XLFormRowDescriptor formRowDescriptorWithTag:@"e2eEncryption" rowType:XLFormRowDescriptorTypeButton title:title];
  118. row.cellConfigAtConfigure[@"backgroundColor"] = NCBrandColor.sharedInstance.backgroundCell;
  119. [row.cellConfig setObject:[UIFont systemFontOfSize:15.0] forKey:@"textLabel.font"];
  120. [row.cellConfig setObject:NCBrandColor.sharedInstance.textView forKey:@"textLabel.textColor"];
  121. [row.cellConfig setObject:[CCGraphics changeThemingColorImage:[UIImage imageNamed:@"lock"] width:50 height:50 color:NCBrandColor.sharedInstance.icon] forKey:@"imageView.image"];
  122. row.action.viewControllerClass = [NCManageEndToEndEncryption class];
  123. [section addFormRow:row];
  124. }
  125. // Section Advanced -------------------------------------------------
  126. section = [XLFormSectionDescriptor formSection];
  127. [form addFormSection:section];
  128. // Advanced
  129. row = [XLFormRowDescriptor formRowDescriptorWithTag:@"advanced" rowType:XLFormRowDescriptorTypeButton title:NSLocalizedString(@"_advanced_", nil)];
  130. row.cellConfigAtConfigure[@"backgroundColor"] = NCBrandColor.sharedInstance.backgroundCell;
  131. [row.cellConfig setObject:[UIFont systemFontOfSize:15.0] forKey:@"textLabel.font"];
  132. [row.cellConfig setObject:NCBrandColor.sharedInstance.textView forKey:@"textLabel.textColor"];
  133. [row.cellConfig setObject:[CCGraphics changeThemingColorImage:[UIImage imageNamed:@"settings"] width:50 height:50 color:NCBrandColor.sharedInstance.icon] forKey:@"imageView.image"];
  134. row.action.viewControllerClass = [CCAdvanced class];
  135. [section addFormRow:row];
  136. // Section : INFORMATION ------------------------------------------------
  137. section = [XLFormSectionDescriptor formSectionWithTitle:NSLocalizedString(@"_information_", nil)];
  138. [form addFormSection:section];
  139. // Acknowledgements
  140. row = [XLFormRowDescriptor formRowDescriptorWithTag:@"buttonLeftAligned" rowType:XLFormRowDescriptorTypeButton title:NSLocalizedString(@"_acknowledgements_", nil)];
  141. row.cellConfigAtConfigure[@"backgroundColor"] = NCBrandColor.sharedInstance.backgroundCell;
  142. [row.cellConfig setObject:[UIFont systemFontOfSize:15.0] forKey:@"textLabel.font"];
  143. [row.cellConfig setObject:@(NSTextAlignmentLeft) forKey:@"textLabel.textAlignment"];
  144. [row.cellConfig setObject:NCBrandColor.sharedInstance.textView forKey:@"textLabel.textColor"];
  145. [row.cellConfig setObject:[CCGraphics changeThemingColorImage:[UIImage imageNamed:@"acknowledgements"] width:50 height:50 color:NCBrandColor.sharedInstance.icon] forKey:@"imageView.image"];
  146. row.action.formBlock = ^(XLFormRowDescriptor * sender){
  147. [self performSegueWithIdentifier:@"AcknowledgementsSegue" sender:sender];
  148. [self deselectFormRow:sender];
  149. };
  150. [section addFormRow:row];
  151. self.tableView.showsVerticalScrollIndicator = NO;
  152. self.form = form;
  153. }
  154. - (void)viewDidLoad
  155. {
  156. [super viewDidLoad];
  157. self.title = NSLocalizedString(@"_settings_", nil);
  158. appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
  159. [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(changeTheming) name:k_notificationCenter_changeTheming object:nil];
  160. [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(applicationDidEnterBackground) name:k_notificationCenter_applicationDidEnterBackground object:nil];
  161. [self changeTheming];
  162. }
  163. - (void)changeTheming
  164. {
  165. [appDelegate changeTheming:self tableView:self.tableView collectionView:nil form:true];
  166. [self initializeForm];
  167. [self reloadForm];
  168. }
  169. - (void)applicationDidEnterBackground
  170. {
  171. if (passcodeViewController.view.window != nil) {
  172. [passcodeViewController dismissViewControllerAnimated:true completion:nil];
  173. }
  174. if (passcodeSettingsViewController.view.window != nil) {
  175. [passcodeSettingsViewController dismissViewControllerAnimated:true completion:nil];
  176. }
  177. }
  178. #pragma --------------------------------------------------------------------------------------------
  179. #pragma mark === Chiamate dal Form ===
  180. #pragma --------------------------------------------------------------------------------------------
  181. - (void)reloadForm
  182. {
  183. self.form.delegate = nil;
  184. // ------------------------------------------------------------------
  185. XLFormRowDescriptor *rowBloccoPasscode = [self.form formRowWithTag:@"bloccopasscode"];
  186. XLFormRowDescriptor *rowNotPasscodeAtStart = [self.form formRowWithTag:@"notPasscodeAtStart"];
  187. XLFormRowDescriptor *rowFavoriteOffline = [self.form formRowWithTag:@"favoriteoffline"];
  188. XLFormRowDescriptor *rowDarkModeDetect = [self.form formRowWithTag:@"darkModeDetect"];
  189. XLFormRowDescriptor *rowDarkMode = [self.form formRowWithTag:@"darkMode"];
  190. // ------------------------------------------------------------------
  191. if ([[CCUtility getPasscode] length]) {
  192. rowBloccoPasscode.title = NSLocalizedString(@"_lock_active_", nil);
  193. [rowBloccoPasscode.cellConfig setObject:[CCGraphics changeThemingColorImage:[UIImage imageNamed:@"settingsPasscodeYES"] multiplier:2 color:NCBrandColor.sharedInstance.icon] forKey:@"imageView.image"];
  194. } else {
  195. rowBloccoPasscode.title = NSLocalizedString(@"_lock_not_active_", nil);
  196. [rowBloccoPasscode.cellConfig setObject:[CCGraphics changeThemingColorImage:[UIImage imageNamed:@"settingsPasscodeNO"] multiplier:2 color:NCBrandColor.sharedInstance.icon] forKey:@"imageView.image"];
  197. }
  198. if ([CCUtility getNotPasscodeAtStart]) [rowNotPasscodeAtStart setValue:@1]; else [rowNotPasscodeAtStart setValue:@0];
  199. if ([CCUtility getFavoriteOffline]) [rowFavoriteOffline setValue:@1]; else [rowFavoriteOffline setValue:@0];
  200. if ([CCUtility getDarkModeDetect]) [rowDarkModeDetect setValue:@1]; else [rowDarkModeDetect setValue:@0];
  201. if ([CCUtility getDarkMode]) [rowDarkMode setValue:@1]; else [rowDarkMode setValue:@0];
  202. // -----------------------------------------------------------------
  203. [self.tableView reloadData];
  204. self.form.delegate = self;
  205. }
  206. - (void)formRowDescriptorValueHasChanged:(XLFormRowDescriptor *)rowDescriptor oldValue:(id)oldValue newValue:(id)newValue
  207. {
  208. [super formRowDescriptorValueHasChanged:rowDescriptor oldValue:oldValue newValue:newValue];
  209. if ([rowDescriptor.tag isEqualToString:@"notPasscodeAtStart"]) {
  210. if ([[rowDescriptor.value valueData] boolValue] == YES) {
  211. [CCUtility setNotPasscodeAtStart:true];
  212. } else {
  213. [CCUtility setNotPasscodeAtStart:false];
  214. }
  215. }
  216. if ([rowDescriptor.tag isEqualToString:@"favoriteoffline"]) {
  217. if ([[rowDescriptor.value valueData] boolValue] == YES) {
  218. UIAlertController *alertController = [UIAlertController alertControllerWithTitle:@"" message:NSLocalizedString(@"_continue_request_", nil) preferredStyle:UIAlertControllerStyleActionSheet];
  219. [alertController addAction: [UIAlertAction actionWithTitle:NSLocalizedString(@"_ok_", nil) style:UIAlertActionStyleDestructive handler:^(UIAlertAction *action) {
  220. [CCUtility setFavoriteOffline:true];
  221. [appDelegate.activeFavorites listingFavorites];
  222. }]];
  223. [alertController addAction: [UIAlertAction actionWithTitle:NSLocalizedString(@"_cancel_", nil) style:UIAlertActionStyleCancel handler:^(UIAlertAction *action) {
  224. [self reloadForm];
  225. }]];
  226. alertController.popoverPresentationController.sourceView = self.view;
  227. NSIndexPath *indexPath = [self.form indexPathOfFormRow:rowDescriptor];
  228. CGRect cellRect = [self.tableView rectForRowAtIndexPath:indexPath];
  229. alertController.popoverPresentationController.sourceRect = CGRectOffset(cellRect, -self.tableView.contentOffset.x, -self.tableView.contentOffset.y);
  230. [self presentViewController:alertController animated:YES completion:nil];
  231. } else {
  232. [CCUtility setFavoriteOffline:false];
  233. }
  234. }
  235. if ([rowDescriptor.tag isEqualToString:@"darkMode"]) {
  236. if ([[rowDescriptor.value valueData] boolValue] == YES) {
  237. [CCUtility setDarkMode:true];
  238. } else {
  239. [CCUtility setDarkMode:false];
  240. }
  241. [[NSNotificationCenter defaultCenter] postNotificationOnMainThreadName:k_notificationCenter_changeTheming object:nil];
  242. }
  243. if ([rowDescriptor.tag isEqualToString:@"darkModeDetect"]) {
  244. if ([[rowDescriptor.value valueData] boolValue] == YES) {
  245. [CCUtility setDarkModeDetect:true];
  246. // detect Dark Mode
  247. if (@available(iOS 12.0, *)) {
  248. appDelegate.preferredUserInterfaceStyle = self.traitCollection.userInterfaceStyle;
  249. if (appDelegate.preferredUserInterfaceStyle == UIUserInterfaceStyleDark) {
  250. [CCUtility setDarkMode:YES];
  251. } else {
  252. [CCUtility setDarkMode:NO];
  253. }
  254. }
  255. } else {
  256. [CCUtility setDarkModeDetect:false];
  257. [CCUtility setDarkMode:false];
  258. }
  259. [[NSNotificationCenter defaultCenter] postNotificationOnMainThreadName:k_notificationCenter_changeTheming object:nil];
  260. }
  261. }
  262. #pragma mark - Passcode -
  263. - (void)didPerformBiometricValidationRequestInPasscodeViewController:(TOPasscodeViewController *)passcodeViewController
  264. {
  265. [[LAContext new] evaluatePolicy:LAPolicyDeviceOwnerAuthenticationWithBiometrics localizedReason:[[NCBrandOptions sharedInstance] brand] reply:^(BOOL success, NSError * _Nullable error) {
  266. if (success) {
  267. dispatch_after(dispatch_time(DISPATCH_TIME_NOW, 0.5 * NSEC_PER_SEC), dispatch_get_main_queue(), ^(void) {
  268. [CCUtility setPasscode:@""];
  269. [passcodeViewController dismissViewControllerAnimated:YES completion:nil];
  270. [self reloadForm];
  271. });
  272. }
  273. }];
  274. }
  275. - (void)passcodeSettingsViewController:(TOPasscodeSettingsViewController *)passcodeSettingsViewController didChangeToNewPasscode:(NSString *)passcode ofType:(TOPasscodeType)type
  276. {
  277. [CCUtility setPasscode:passcode];
  278. [passcodeSettingsViewController dismissViewControllerAnimated:YES completion:nil];
  279. [self reloadForm];
  280. }
  281. - (void)didTapCancelInPasscodeViewController:(TOPasscodeViewController *)passcodeViewController
  282. {
  283. [passcodeViewController dismissViewControllerAnimated:YES completion:nil];
  284. }
  285. - (BOOL)passcodeViewController:(TOPasscodeViewController *)passcodeViewController isCorrectCode:(NSString *)code
  286. {
  287. if ([code isEqualToString:[CCUtility getPasscode]]) {
  288. [CCUtility setPasscode:@""];
  289. [self reloadForm];
  290. return YES;
  291. }
  292. return NO;
  293. }
  294. - (void)passcode:(XLFormRowDescriptor *)sender
  295. {
  296. LAContext *laContext = [LAContext new];
  297. NSError *error;
  298. [self deselectFormRow:sender];
  299. if ([[CCUtility getPasscode] length] == 0) {
  300. passcodeSettingsViewController = [[TOPasscodeSettingsViewController alloc] init];
  301. if (@available(iOS 13.0, *)) {
  302. if ([[UITraitCollection currentTraitCollection] userInterfaceStyle] == UIUserInterfaceStyleDark) {
  303. passcodeSettingsViewController.style = TOPasscodeSettingsViewStyleDark;
  304. }
  305. }
  306. passcodeSettingsViewController.hideOptionsButton = YES;
  307. passcodeSettingsViewController.requireCurrentPasscode = NO;
  308. passcodeSettingsViewController.passcodeType = TOPasscodeTypeSixDigits;
  309. passcodeSettingsViewController.delegate = self;
  310. [self presentViewController:passcodeSettingsViewController animated:YES completion:nil];
  311. } else {
  312. passcodeViewController = [[TOPasscodeViewController alloc] initWithStyle:TOPasscodeViewStyleTranslucentLight passcodeType:TOPasscodeTypeSixDigits];
  313. if (@available(iOS 13.0, *)) {
  314. if ([[UITraitCollection currentTraitCollection] userInterfaceStyle] == UIUserInterfaceStyleDark) {
  315. passcodeViewController.style = TOPasscodeViewStyleTranslucentDark;
  316. }
  317. }
  318. passcodeViewController.allowCancel = true;
  319. passcodeViewController.delegate = self;
  320. passcodeViewController.keypadButtonShowLettering = false;
  321. if ([laContext canEvaluatePolicy:LAPolicyDeviceOwnerAuthenticationWithBiometrics error:&error]) {
  322. if (error == NULL) {
  323. if (laContext.biometryType == LABiometryTypeFaceID) {
  324. passcodeViewController.biometryType = TOPasscodeBiometryTypeFaceID;
  325. passcodeViewController.allowBiometricValidation = true;
  326. passcodeViewController.automaticallyPromptForBiometricValidation = true;
  327. } else if (laContext.biometryType == LABiometryTypeTouchID) {
  328. passcodeViewController.biometryType = TOPasscodeBiometryTypeTouchID;
  329. passcodeViewController.allowBiometricValidation = true;
  330. passcodeViewController.automaticallyPromptForBiometricValidation = true;
  331. } else {
  332. NSLog(@"No Biometric support");
  333. }
  334. }
  335. }
  336. [self presentViewController:passcodeViewController animated:YES completion:nil];
  337. }
  338. }
  339. #pragma --------------------------------------------------------------------------------------------
  340. #pragma mark === Table View ===
  341. #pragma --------------------------------------------------------------------------------------------
  342. - (NSString *)tableView:(UITableView *)tableView titleForFooterInSection:(NSInteger)section
  343. {
  344. NSString *sectionName;
  345. switch (section)
  346. {
  347. case 1: {
  348. sectionName = NSLocalizedString(@"_favorite_offline_footer_", nil);
  349. }
  350. break;
  351. case 2: {
  352. sectionName = NSLocalizedString(@"_lock_protection_no_screen_footer_", nil);
  353. }
  354. break;
  355. case 5: {
  356. NSString *versionServer = [[NCManageDatabase sharedInstance] getCapabilitiesServerStringWithAccount:appDelegate.activeAccount elements:NCElementsJSON.shared.capabilitiesVersionString];
  357. NSString *themingName = [[NCManageDatabase sharedInstance] getCapabilitiesServerStringWithAccount:appDelegate.activeAccount elements:NCElementsJSON.shared.capabilitiesThemingName];
  358. NSString *themingSlogan = [[NCManageDatabase sharedInstance] getCapabilitiesServerStringWithAccount:appDelegate.activeAccount elements:NCElementsJSON.shared.capabilitiesThemingSlogan];
  359. NSString *versionApp = [NSString stringWithFormat:@"%@.%@", [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleShortVersionString"], [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleVersion"]];
  360. NSString *versionNextcloud = [NSString stringWithFormat:[NCBrandOptions sharedInstance].textCopyrightNextcloudServer, versionServer];
  361. NSString *versionNextcloudiOS = [NSString stringWithFormat:[NCBrandOptions sharedInstance].textCopyrightNextcloudiOS, versionApp];
  362. NSString *nameSlogan = [NSString stringWithFormat:@"%@ - %@", themingName, themingSlogan];
  363. sectionName = [NSString stringWithFormat:@"%@\n\n%@\n%@", versionNextcloudiOS, versionNextcloud, nameSlogan];
  364. }
  365. break;
  366. }
  367. return sectionName;
  368. }
  369. @end