123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462 |
- //
- // CCManageHelp.m
- // Nextcloud
- //
- // Created by Marino Faggiana on 06/11/15.
- // Copyright (c) 2015 Marino Faggiana. All rights reserved.
- //
- // Author Marino Faggiana <marino.faggiana@nextcloud.com>
- //
- // This program is free software: you can redistribute it and/or modify
- // it under the terms of the GNU General Public License as published by
- // the Free Software Foundation, either version 3 of the License, or
- // (at your option) any later version.
- //
- // This program is distributed in the hope that it will be useful,
- // but WITHOUT ANY WARRANTY; without even the implied warranty of
- // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- // GNU General Public License for more details.
- //
- // You should have received a copy of the GNU General Public License
- // along with this program. If not, see <http://www.gnu.org/licenses/>.
- //
- #import "CCAdvanced.h"
- #import "CCUtility.h"
- #import "NSNotificationCenter+MainThread.h"
- #import <KTVHTTPCache/KTVHTTPCache.h>
- #import "NCBridgeSwift.h"
- @interface CCAdvanced ()
- {
- AppDelegate *appDelegate;
- }
- @end
- @implementation CCAdvanced
- - (void)initializeForm
- {
- XLFormDescriptor *form = [XLFormDescriptor formDescriptor];
- XLFormSectionDescriptor *section;
- XLFormRowDescriptor *row;
-
- // Section HIDDEN FILES -------------------------------------------------
- section = [XLFormSectionDescriptor formSection];
- [form addFormSection:section];
-
- row = [XLFormRowDescriptor formRowDescriptorWithTag:@"showHiddenFiles" rowType:XLFormRowDescriptorTypeBooleanSwitch title:NSLocalizedString(@"_show_hidden_files_", nil)];
- row.cellConfigAtConfigure[@"backgroundColor"] = NCBrandColor.shared.secondarySystemGroupedBackground;
- if ([CCUtility getShowHiddenFiles]) row.value = @"1";
- else row.value = @"0";
- [row.cellConfig setObject:[UIFont systemFontOfSize:15.0] forKey:@"textLabel.font"];
- [row.cellConfig setObject:NCBrandColor.shared.label forKey:@"textLabel.textColor"];
- [section addFormRow:row];
-
- // Format Compatibility + Live Photo
-
- section = [XLFormSectionDescriptor formSection];
- [form addFormSection:section];
- section.footerTitle = [NSString stringWithFormat:@"%@\n%@", NSLocalizedString(@"_format_compatibility_footer_", nil), NSLocalizedString(@"_upload_mov_livephoto_footer_", nil)];
- row = [XLFormRowDescriptor formRowDescriptorWithTag:@"formatCompatibility" rowType:XLFormRowDescriptorTypeBooleanSwitch title:NSLocalizedString(@"_format_compatibility_", nil)];
- row.cellConfigAtConfigure[@"backgroundColor"] = NCBrandColor.shared.secondarySystemGroupedBackground;
- if ([CCUtility getFormatCompatibility]) row.value = @"1";
- else row.value = @"0";
- [row.cellConfig setObject:[UIFont systemFontOfSize:15.0] forKey:@"textLabel.font"];
- [row.cellConfig setObject:NCBrandColor.shared.label forKey:@"textLabel.textColor"];
- [section addFormRow:row];
-
- row = [XLFormRowDescriptor formRowDescriptorWithTag:@"livePhoto" rowType:XLFormRowDescriptorTypeBooleanSwitch title:NSLocalizedString(@"_upload_mov_livephoto_", nil)];
- row.cellConfigAtConfigure[@"backgroundColor"] = NCBrandColor.shared.secondarySystemGroupedBackground;
- if ([CCUtility getLivePhoto]) row.value = @"1";
- else row.value = @"0";
- [row.cellConfig setObject:[UIFont systemFontOfSize:15.0] forKey:@"textLabel.font"];
- [row.cellConfig setObject:NCBrandColor.shared.label forKey:@"textLabel.textColor"];
- [section addFormRow:row];
-
- // Disable Local Cache After Upload
-
- section = [XLFormSectionDescriptor formSection];
- [form addFormSection:section];
- section.footerTitle = NSLocalizedString(@"_disableLocalCacheAfterUpload_footer_", nil);
-
- row = [XLFormRowDescriptor formRowDescriptorWithTag:@"disableLocalCacheAfterUpload" rowType:XLFormRowDescriptorTypeBooleanSwitch title:NSLocalizedString(@"_disableLocalCacheAfterUpload_", nil)];
- row.cellConfigAtConfigure[@"backgroundColor"] = NCBrandColor.shared.secondarySystemGroupedBackground;
- if ([CCUtility getDisableLocalCacheAfterUpload]) row.value = @"1";
- else row.value = @"0";
- [row.cellConfig setObject:[UIFont systemFontOfSize:15.0] forKey:@"textLabel.font"];
- [row.cellConfig setObject:NCBrandColor.shared.label forKey:@"textLabel.textColor"];
- [section addFormRow:row];
-
- // Automatic download image
-
- section = [XLFormSectionDescriptor formSection];
- [form addFormSection:section];
- section.footerTitle = NSLocalizedString(@"_automatic_Download_Image_footer_", nil);
-
- row = [XLFormRowDescriptor formRowDescriptorWithTag:@"automaticDownloadImage" rowType:XLFormRowDescriptorTypeBooleanSwitch title:NSLocalizedString(@"_automatic_Download_Image_", nil)];
- row.cellConfigAtConfigure[@"backgroundColor"] = NCBrandColor.shared.secondarySystemGroupedBackground;
- if ([CCUtility getAutomaticDownloadImage]) row.value = @"1";
- else row.value = @"0";
- [row.cellConfig setObject:[UIFont systemFontOfSize:15.0] forKey:@"textLabel.font"];
- [row.cellConfig setObject:NCBrandColor.shared.label forKey:@"textLabel.textColor"];
- [section addFormRow:row];
-
- // Section : Files App --------------------------------------------------------------
-
- if (![NCBrandOptions shared].disable_openin_file) {
-
- section = [XLFormSectionDescriptor formSection];
- [form addFormSection:section];
- section.footerTitle = NSLocalizedString(@"_disable_files_app_footer_", nil);
- // Disable Files App
- row = [XLFormRowDescriptor formRowDescriptorWithTag:@"disablefilesapp" rowType:XLFormRowDescriptorTypeBooleanSwitch title:NSLocalizedString(@"_disable_files_app_", nil)];
- row.cellConfigAtConfigure[@"backgroundColor"] = NCBrandColor.shared.secondarySystemGroupedBackground;
- if ([CCUtility getDisableFilesApp]) row.value = @"1";
- else row.value = @"0";
- [row.cellConfig setObject:[UIFont systemFontOfSize:15.0] forKey:@"textLabel.font"];
- [row.cellConfig setObject:NCBrandColor.shared.label forKey:@"textLabel.textColor"];
- [section addFormRow:row];
- }
-
- // Section : Chunk --------------------------------------------------------------
- section = [XLFormSectionDescriptor formSection];
- [form addFormSection:section];
- section.footerTitle = NSLocalizedString(@"_chunk_footer_title_", nil);
-
- row = [XLFormRowDescriptor formRowDescriptorWithTag:@"chunk" rowType:XLFormRowDescriptorTypeStepCounter title:NSLocalizedString(@"_chunk_size_mb_", nil)];
- row.cellConfigAtConfigure[@"backgroundColor"] = NCBrandColor.shared.secondarySystemGroupedBackground;
- row.value = [NSString stringWithFormat:@"%ld", CCUtility.getChunkSize];
- [row.cellConfig setObject:[UIFont systemFontOfSize:15.0] forKey:@"textLabel.font"];
- [row.cellConfig setObject:NCBrandColor.shared.label forKey:@"textLabel.textColor"];
- [row.cellConfigAtConfigure setObject:@YES forKey:@"stepControl.wraps"];
- [row.cellConfigAtConfigure setObject:@1 forKey:@"stepControl.stepValue"];
- [row.cellConfigAtConfigure setObject:@0 forKey:@"stepControl.minimumValue"];
- [row.cellConfigAtConfigure setObject:@100 forKey:@"stepControl.maximumValue"];
- [section addFormRow:row];
- // Section : Privacy --------------------------------------------------------------
- if (!NCBrandOptions.shared.disable_crash_service) {
-
- section = [XLFormSectionDescriptor formSectionWithTitle:NSLocalizedString(@"_privacy_", nil)];
- [form addFormSection:section];
- section.footerTitle = NSLocalizedString(@"_privacy_footer_", nil);
-
- row = [XLFormRowDescriptor formRowDescriptorWithTag:@"crashservice" rowType:XLFormRowDescriptorTypeBooleanSwitch title:NSLocalizedString(@"_crashservice_title_", nil)];
- row.cellConfigAtConfigure[@"backgroundColor"] = NCBrandColor.shared.secondarySystemGroupedBackground;
- [row.cellConfig setObject:[UIFont systemFontOfSize:15.0] forKey:@"textLabel.font"];
- [row.cellConfig setObject:NCBrandColor.shared.label forKey:@"textLabel.textColor"];
- [row.cellConfig setObject:[[UIImage imageNamed:@"crashservice"] imageWithColor:NCBrandColor.shared.gray size:25] forKey:@"imageView.image"];
- if ([CCUtility getDisableCrashservice]) row.value = @"1";
- else row.value = @"0";
- [section addFormRow:row];
- }
-
- // Section DIAGNOSTICS -------------------------------------------------
- section = [XLFormSectionDescriptor formSectionWithTitle:NSLocalizedString(@"_diagnostics_", nil)];
- [form addFormSection:section];
-
- if ([[NSFileManager defaultManager] fileExistsAtPath:NCCommunicationCommon.shared.filenamePathLog]) {
-
- row = [XLFormRowDescriptor formRowDescriptorWithTag:@"log" rowType:XLFormRowDescriptorTypeButton title:NSLocalizedString(@"_view_log_", nil)];
- row.cellConfigAtConfigure[@"backgroundColor"] = NCBrandColor.shared.secondarySystemGroupedBackground;
- [row.cellConfig setObject:@(NSTextAlignmentLeft) forKey:@"textLabel.textAlignment"];
- [row.cellConfig setObject:NCBrandColor.shared.label forKey:@"textLabel.textColor"];
- [row.cellConfig setObject:[UIFont systemFontOfSize:15.0] forKey:@"textLabel.font"];
- [row.cellConfig setObject:[[UIImage imageNamed:@"log"] imageWithColor:NCBrandColor.shared.gray size:25] forKey:@"imageView.image"];
- row.action.formBlock = ^(XLFormRowDescriptor * sender) {
-
- [self deselectFormRow:sender];
-
- NCViewerQuickLook *viewerQuickLook = [NCViewerQuickLook new];
- [viewerQuickLook quickLookWithUrl:[NSURL fileURLWithPath:NCCommunicationCommon.shared.filenamePathLog]];
- };
- [section addFormRow:row];
-
- row = [XLFormRowDescriptor formRowDescriptorWithTag:@"clearlog" rowType:XLFormRowDescriptorTypeButton title:NSLocalizedString(@"_clear_log_", nil)];
- row.cellConfigAtConfigure[@"backgroundColor"] = NCBrandColor.shared.secondarySystemGroupedBackground;
- [row.cellConfig setObject:@(NSTextAlignmentLeft) forKey:@"textLabel.textAlignment"];
- [row.cellConfig setObject:NCBrandColor.shared.label forKey:@"textLabel.textColor"];
- [row.cellConfig setObject:[UIFont systemFontOfSize:15.0] forKey:@"textLabel.font"];
- [row.cellConfig setObject:[[UIImage imageNamed:@"clear"] imageWithColor:NCBrandColor.shared.gray size:25] forKey:@"imageView.image"];
- row.action.formBlock = ^(XLFormRowDescriptor * sender) {
-
- [self deselectFormRow:sender];
- [[NCCommunicationCommon shared] clearFileLog];
-
- NSInteger logLevel = [CCUtility getLogLevel];
- BOOL isSimulatorOrTestFlight = [[NCUtility shared] isSimulatorOrTestFlight];
- NSString *versionNextcloudiOS = [NSString stringWithFormat:[NCBrandOptions shared].textCopyrightNextcloudiOS, NCUtility.shared.getVersionApp];
- if (isSimulatorOrTestFlight) {
- [[NCCommunicationCommon shared] writeLog:[NSString stringWithFormat:@"Clear log with level %lu %@ (Simulator / TestFlight)", (unsigned long)logLevel, versionNextcloudiOS]];
- } else {
- [[NCCommunicationCommon shared] writeLog:[NSString stringWithFormat:@"Clear log with level %lu %@", (unsigned long)logLevel, versionNextcloudiOS]];
- }
- };
- [section addFormRow:row];
-
- row = [XLFormRowDescriptor formRowDescriptorWithTag:@"logLevel" rowType:XLFormRowDescriptorTypeSlider title:NSLocalizedString(@"_level_log_", nil)];
- row.cellConfigAtConfigure[@"backgroundColor"] = NCBrandColor.shared.secondarySystemGroupedBackground;
- [row.cellConfig setObject:@(NSTextAlignmentCenter) forKey:@"textLabel.textAlignment"];
- [row.cellConfig setObject:NCBrandColor.shared.label forKey:@"textLabel.textColor"];
- [row.cellConfig setObject:[UIFont systemFontOfSize:15.0] forKey:@"textLabel.font"];
- NSInteger logLevel = [CCUtility getLogLevel];
- row.value = @(logLevel);
- [row.cellConfigAtConfigure setObject:@(2) forKey:@"slider.maximumValue"];
- [row.cellConfigAtConfigure setObject:@(0) forKey:@"slider.minimumValue"];
- [row.cellConfigAtConfigure setObject:@(2) forKey:@"steps"];
- [section addFormRow:row];
- }
-
- row = [XLFormRowDescriptor formRowDescriptorWithTag:@"capabilities" rowType:XLFormRowDescriptorTypeButton title:NSLocalizedString(@"_capabilities_", nil)];
- row.cellConfigAtConfigure[@"backgroundColor"] = NCBrandColor.shared.secondarySystemGroupedBackground;
- [row.cellConfig setObject:@(NSTextAlignmentLeft) forKey:@"textLabel.textAlignment"];
- [row.cellConfig setObject:NCBrandColor.shared.label forKey:@"textLabel.textColor"];
- [row.cellConfig setObject:[UIFont systemFontOfSize:15.0] forKey:@"textLabel.font"];
- [row.cellConfig setObject:[[UIImage imageNamed:@"capabilities"] imageWithColor:NCBrandColor.shared.gray size:25] forKey:@"imageView.image"];
- row.action.formBlock = ^(XLFormRowDescriptor * sender) {
-
- [self deselectFormRow:sender];
-
- NCCapabilitiesViewController *capabilities = [[UIStoryboard storyboardWithName:@"NCCapabilitiesViewController" bundle:nil] instantiateInitialViewController];
- [self presentViewController:capabilities animated:YES completion:nil];
- };
- [section addFormRow:row];
- // Section CLEAR CACHE -------------------------------------------------
-
- section = [XLFormSectionDescriptor formSection];
- [form addFormSection:section];
- section.footerTitle = NSLocalizedString(@"_clear_cache_footer_", nil);
- // Clear cache
- row = [XLFormRowDescriptor formRowDescriptorWithTag:@"azzeracache" rowType:XLFormRowDescriptorTypeButton title:NSLocalizedString(@"_clear_cache_", nil)];
- row.cellConfigAtConfigure[@"backgroundColor"] = NCBrandColor.shared.secondarySystemGroupedBackground;
- [row.cellConfig setObject:[UIFont systemFontOfSize:15.0] forKey:@"textLabel.font"];
- [row.cellConfig setObject:NCBrandColor.shared.label forKey:@"textLabel.textColor"];
- [row.cellConfig setObject:@(NSTextAlignmentLeft) forKey:@"textLabel.textAlignment"];
- [row.cellConfig setObject:[[UIImage imageNamed:@"trash"] imageWithColor:NCBrandColor.shared.gray size:25] forKey:@"imageView.image"];
- row.action.formSelector = @selector(clearCacheRequest:);
- [section addFormRow:row];
- // Section EXIT --------------------------------------------------------
-
- section = [XLFormSectionDescriptor formSection];
- [form addFormSection:section];
- section.footerTitle = NSLocalizedString(@"_exit_footer_", nil);
-
- // Exit
- row = [XLFormRowDescriptor formRowDescriptorWithTag:@"esci" rowType:XLFormRowDescriptorTypeButton title:NSLocalizedString(@"_exit_", nil)];
- row.cellConfigAtConfigure[@"backgroundColor"] = NCBrandColor.shared.secondarySystemGroupedBackground;
- [row.cellConfig setObject:@(NSTextAlignmentLeft) forKey:@"textLabel.textAlignment"];
- [row.cellConfig setObject:[UIColor redColor] forKey:@"textLabel.textColor"];
- [row.cellConfig setObject:[UIFont systemFontOfSize:15.0] forKey:@"textLabel.font"];
- [row.cellConfig setObject:[[UIImage imageNamed:@"xmark"] imageWithColor:[UIColor redColor] size:25] forKey:@"imageView.image"];
- row.action.formSelector = @selector(exitNextcloud:);
- [section addFormRow:row];
- self.tableView.showsVerticalScrollIndicator = NO;
- self.form = form;
- }
- // MARK: - View Life Cycle
- - (void)viewDidLoad
- {
- [super viewDidLoad];
-
- self.title = NSLocalizedString(@"_advanced_", nil);
- appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
- self.view.backgroundColor = NCBrandColor.shared.systemGroupedBackground;
-
- self.tableView.backgroundColor = NCBrandColor.shared.systemGroupedBackground;
-
- [self initializeForm];
- }
- - (void)viewWillAppear:(BOOL)animated
- {
- [super viewWillAppear:animated];
-
- appDelegate.activeViewController = self;
- }
- #pragma mark -
- - (void)formRowDescriptorValueHasChanged:(XLFormRowDescriptor *)rowDescriptor oldValue:(id)oldValue newValue:(id)newValue
- {
- [super formRowDescriptorValueHasChanged:rowDescriptor oldValue:oldValue newValue:newValue];
-
- if ([rowDescriptor.tag isEqualToString:@"showHiddenFiles"]) {
-
- [CCUtility setShowHiddenFiles:[[rowDescriptor.value valueData] boolValue]];
- }
-
- if ([rowDescriptor.tag isEqualToString:@"formatCompatibility"]) {
-
- [CCUtility setFormatCompatibility:[[rowDescriptor.value valueData] boolValue]];
- }
-
- if ([rowDescriptor.tag isEqualToString:@"livePhoto"]) {
-
- [CCUtility setLivePhoto:[[rowDescriptor.value valueData] boolValue]];
- }
-
- if ([rowDescriptor.tag isEqualToString:@"disableLocalCacheAfterUpload"]) {
-
- [CCUtility setDisableLocalCacheAfterUpload:[[rowDescriptor.value valueData] boolValue]];
- }
-
- if ([rowDescriptor.tag isEqualToString:@"automaticDownloadImage"]) {
-
- [CCUtility setAutomaticDownloadImage:[[rowDescriptor.value valueData] boolValue]];
- }
-
- if ([rowDescriptor.tag isEqualToString:@"disablefilesapp"]) {
-
- [CCUtility setDisableFilesApp:[[rowDescriptor.value valueData] boolValue]];
- }
-
- if ([rowDescriptor.tag isEqualToString:@"crashservice"]) {
-
- [CCUtility setDisableCrashservice:[[rowDescriptor.value valueData] boolValue]];
-
- UIAlertController *alertController = [UIAlertController alertControllerWithTitle:NSLocalizedString(@"_crashservice_title_", nil) message:NSLocalizedString(@"_crashservice_alert_", nil) preferredStyle:UIAlertControllerStyleAlert];
- UIAlertAction *okAction = [UIAlertAction actionWithTitle:NSLocalizedString(@"_ok_", nil) style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) {
- exit(0);
- }];
-
- [alertController addAction:okAction];
- [self presentViewController:alertController animated:YES completion:nil];
- }
-
- if ([rowDescriptor.tag isEqualToString:@"logLevel"]) {
-
- NSInteger levelLog = [[rowDescriptor.value valueData] intValue];
- [CCUtility setLogLevel:levelLog];
- [[NCCommunicationCommon shared] setLevelLog:levelLog];
- }
-
- if ([rowDescriptor.tag isEqualToString:@"chunk"]) {
-
- NSInteger chunkSize = [[rowDescriptor.value valueData] intValue];
- [CCUtility setChunkSize:chunkSize];
- }
- }
- #pragma mark - Clear Cache
- - (void)clearCache
- {
- [[NCNetworking shared] cancelAllTransferWithAccount:appDelegate.account completion:^{ }];
- [[NCOperationQueue shared] cancelAllQueue];
- [[NCNetworking shared] cancelAllTask];
-
- [[NSURLCache sharedURLCache] setMemoryCapacity:0];
- [[NSURLCache sharedURLCache] setDiskCapacity:0];
- [KTVHTTPCache cacheDeleteAllCaches];
-
- [[NCManageDatabase shared] clearDatabaseWithAccount:appDelegate.account removeAccount:false];
-
- [CCUtility removeGroupDirectoryProviderStorage];
- [CCUtility removeGroupLibraryDirectory];
-
- [CCUtility removeDocumentsDirectory];
- [CCUtility removeTemporaryDirectory];
-
- [CCUtility createDirectoryStandard];
- [[NCAutoUpload shared] alignPhotoLibraryWithViewController:self];
- // Inizialized home
- [[NSNotificationCenter defaultCenter] postNotificationOnMainThreadName:NCGlobal.shared.notificationCenterInitialize object:nil userInfo:nil];
-
- // Clear Media
- [appDelegate.activeMedia reloadDataSource];
-
- dispatch_after(dispatch_time(DISPATCH_TIME_NOW, 1 * NSEC_PER_SEC), dispatch_get_main_queue(), ^(void) {
- [[NCUtility shared] stopActivityIndicator];
- });
- }
- - (void)clearCacheRequest:(XLFormRowDescriptor *)sender
- {
- [self deselectFormRow:sender];
-
- UIAlertController *alertController = [UIAlertController alertControllerWithTitle:@"" message:NSLocalizedString(@"_want_delete_cache_", nil) preferredStyle:UIAlertControllerStyleActionSheet];
-
- [alertController addAction: [UIAlertAction actionWithTitle:NSLocalizedString(@"_yes_", nil) style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) {
- [[NCUtility shared] startActivityIndicatorWithBackgroundView:nil blurEffect:true bottom:0 style: UIActivityIndicatorViewStyleWhiteLarge];
- dispatch_after(dispatch_time(DISPATCH_TIME_NOW, 1 * NSEC_PER_SEC), dispatch_get_main_queue(), ^(void) {
- [self clearCache];
- });
- }]];
-
- [alertController addAction: [UIAlertAction actionWithTitle:NSLocalizedString(@"_cancel_", nil) style:UIAlertActionStyleCancel handler:^(UIAlertAction *action) {
- }]];
-
- alertController.popoverPresentationController.sourceView = self.view;
- NSIndexPath *indexPath = [self.form indexPathOfFormRow:sender];
- CGRect cellRect = [self.tableView rectForRowAtIndexPath:indexPath];
- alertController.popoverPresentationController.sourceRect = CGRectOffset(cellRect, -self.tableView.contentOffset.x, -self.tableView.contentOffset.y);
-
- [self presentViewController:alertController animated:YES completion:nil];
- }
- #pragma mark - Exit Nextcloud
- - (void)exitNextcloud:(XLFormRowDescriptor *)sender
- {
- [self deselectFormRow:sender];
-
- UIAlertController *alertController = [UIAlertController alertControllerWithTitle:@"" message:NSLocalizedString(@"_want_exit_", nil) preferredStyle:UIAlertControllerStyleActionSheet];
-
- [alertController addAction: [UIAlertAction actionWithTitle:NSLocalizedString(@"_ok_", nil) style:UIAlertActionStyleDestructive handler:^(UIAlertAction *action) {
-
- [[NSURLCache sharedURLCache] setMemoryCapacity:0];
- [[NSURLCache sharedURLCache] setDiskCapacity:0];
- [KTVHTTPCache cacheDeleteAllCaches];
- [CCUtility removeGroupDirectoryProviderStorage];
- [CCUtility removeGroupApplicationSupport];
-
- [CCUtility removeDocumentsDirectory];
- [CCUtility removeTemporaryDirectory];
-
- [CCUtility deleteAllChainStore];
-
- [[NCManageDatabase shared] removeDB];
-
- exit(0);
- }]];
-
- [alertController addAction: [UIAlertAction actionWithTitle:NSLocalizedString(@"_cancel_", nil) style:UIAlertActionStyleCancel handler:^(UIAlertAction *action) {
- }]];
-
- alertController.popoverPresentationController.sourceView = self.view;
- NSIndexPath *indexPath = [self.form indexPathOfFormRow:sender];
- CGRect cellRect = [self.tableView rectForRowAtIndexPath:indexPath];
- alertController.popoverPresentationController.sourceRect = CGRectOffset(cellRect, -self.tableView.contentOffset.x, -self.tableView.contentOffset.y);
-
- [self presentViewController:alertController animated:YES completion:nil];
- }
- #pragma mark -
- - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
-
- if (indexPath.section == 7 && indexPath.row == 2) {
- return 80;
- } else {
- return NCGlobal.shared.heightCellSettings;
- }
- }
- @end
|