|
@@ -27,7 +27,9 @@
|
|
|
#import "NCBridgeSwift.h"
|
|
|
|
|
|
@interface CCAdvanced ()
|
|
|
-
|
|
|
+{
|
|
|
+ AppDelegate *appDelegate;
|
|
|
+}
|
|
|
@end
|
|
|
|
|
|
@implementation CCAdvanced
|
|
@@ -150,6 +152,8 @@
|
|
|
{
|
|
|
[super viewDidLoad];
|
|
|
|
|
|
+ appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
|
|
|
+
|
|
|
_hud = [[CCHud alloc] initWithView:[[[UIApplication sharedApplication] delegate] window]];
|
|
|
}
|
|
|
|
|
@@ -162,8 +166,8 @@
|
|
|
self.tableView.showsVerticalScrollIndicator = NO;
|
|
|
|
|
|
// Color
|
|
|
- [app aspectNavigationControllerBar:self.navigationController.navigationBar online:[app.reachability isReachable] hidden:NO];
|
|
|
- [app aspectTabBar:self.tabBarController.tabBar hidden:NO];
|
|
|
+ [appDelegate aspectNavigationControllerBar:self.navigationController.navigationBar online:[appDelegate.reachability isReachable] hidden:NO];
|
|
|
+ [appDelegate aspectTabBar:self.tabBarController.tabBar hidden:NO];
|
|
|
|
|
|
[self recalculateSize];
|
|
|
}
|
|
@@ -171,7 +175,7 @@
|
|
|
- (void)changeTheming
|
|
|
{
|
|
|
if (self.isViewLoaded && self.view.window)
|
|
|
- [app changeTheming:self];
|
|
|
+ [appDelegate changeTheming:self];
|
|
|
}
|
|
|
|
|
|
- (void)formRowDescriptorValueHasChanged:(XLFormRowDescriptor *)rowDescriptor oldValue:(id)oldValue newValue:(id)newValue
|
|
@@ -183,7 +187,7 @@
|
|
|
[CCUtility setActivityVerboseHigh:[[rowDescriptor.value valueData] boolValue]];
|
|
|
|
|
|
// Clear Date read Activity for force reload datasource
|
|
|
- app.activeActivity.storeDateFirstActivity = nil;
|
|
|
+ appDelegate.activeActivity.storeDateFirstActivity = nil;
|
|
|
}
|
|
|
|
|
|
if ([rowDescriptor.tag isEqualToString:@"optimizedphoto"]) {
|
|
@@ -219,17 +223,17 @@
|
|
|
switch (result)
|
|
|
{
|
|
|
case MFMailComposeResultCancelled:
|
|
|
- [app messageNotification:@"_info_" description:@"_mail_deleted_" visible:YES delay:k_dismissAfterSecond type:TWMessageBarMessageTypeSuccess errorCode: error.code];
|
|
|
+ [appDelegate messageNotification:@"_info_" description:@"_mail_deleted_" visible:YES delay:k_dismissAfterSecond type:TWMessageBarMessageTypeSuccess errorCode: error.code];
|
|
|
break;
|
|
|
case MFMailComposeResultSaved:
|
|
|
- [app messageNotification:@"_info_" description:@"_mail_saved_" visible:YES delay:k_dismissAfterSecond type:TWMessageBarMessageTypeSuccess errorCode: error.code];
|
|
|
+ [appDelegate messageNotification:@"_info_" description:@"_mail_saved_" visible:YES delay:k_dismissAfterSecond type:TWMessageBarMessageTypeSuccess errorCode: error.code];
|
|
|
break;
|
|
|
case MFMailComposeResultSent:
|
|
|
- [app messageNotification:@"_info_" description:@"_mail_sent_" visible:YES delay:k_dismissAfterSecond type:TWMessageBarMessageTypeSuccess errorCode: error.code];
|
|
|
+ [appDelegate messageNotification:@"_info_" description:@"_mail_sent_" visible:YES delay:k_dismissAfterSecond type:TWMessageBarMessageTypeSuccess errorCode: error.code];
|
|
|
break;
|
|
|
case MFMailComposeResultFailed: {
|
|
|
NSString *msg = [NSString stringWithFormat:NSLocalizedString(@"_mail_failure_", nil), [error localizedDescription]];
|
|
|
- [app messageNotification:@"_error_" description:msg visible:YES delay:k_dismissAfterSecond type:TWMessageBarMessageTypeError errorCode: error.code];
|
|
|
+ [appDelegate messageNotification:@"_error_" description:msg visible:YES delay:k_dismissAfterSecond type:TWMessageBarMessageTypeError errorCode: error.code];
|
|
|
}
|
|
|
break;
|
|
|
default:
|
|
@@ -253,11 +257,11 @@
|
|
|
// Email Recipents
|
|
|
NSArray *toRecipents;
|
|
|
|
|
|
- NSArray *activities = [[NCManageDatabase sharedInstance] getActivityWithPredicate:[NSPredicate predicateWithFormat:@"account = %@", app.activeAccount]];
|
|
|
+ NSArray *activities = [[NCManageDatabase sharedInstance] getActivityWithPredicate:[NSPredicate predicateWithFormat:@"account = %@", appDelegate.activeAccount]];
|
|
|
|
|
|
if ([activities count] == 0) {
|
|
|
|
|
|
- [app messageNotification:@"_info_" description:@"No activity found" visible:YES delay:k_dismissAfterSecond type:TWMessageBarMessageTypeInfo errorCode:0];
|
|
|
+ [appDelegate messageNotification:@"_info_" description:@"No activity found" visible:YES delay:k_dismissAfterSecond type:TWMessageBarMessageTypeInfo errorCode:0];
|
|
|
return;
|
|
|
}
|
|
|
|
|
@@ -305,7 +309,7 @@
|
|
|
|
|
|
} else {
|
|
|
|
|
|
- [app messageNotification:@"_error_" description:@"Impossible create file body" visible:YES delay:k_dismissAfterSecond type:TWMessageBarMessageTypeError errorCode:0];
|
|
|
+ [appDelegate messageNotification:@"_error_" description:@"Impossible create file body" visible:YES delay:k_dismissAfterSecond type:TWMessageBarMessageTypeError errorCode:0];
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -317,9 +321,9 @@
|
|
|
{
|
|
|
[self deselectFormRow:sender];
|
|
|
|
|
|
- [[NCManageDatabase sharedInstance] clearTable:[tableActivity class] account:app.activeAccount];
|
|
|
+ [[NCManageDatabase sharedInstance] clearTable:[tableActivity class] account:appDelegate.activeAccount];
|
|
|
|
|
|
- [app.activeActivity reloadDatasource];
|
|
|
+ [appDelegate.activeActivity reloadDatasource];
|
|
|
}
|
|
|
|
|
|
#pragma --------------------------------------------------------------------------------------------
|
|
@@ -328,36 +332,36 @@
|
|
|
|
|
|
- (void)removeAllFiles:(BOOL)removeIco
|
|
|
{
|
|
|
- [app maintenanceMode:YES];
|
|
|
+ [appDelegate maintenanceMode:YES];
|
|
|
|
|
|
[self.hud visibleHudTitle:NSLocalizedString(@"_remove_cache_", nil) mode:MBProgressHUDModeIndeterminate color:nil];
|
|
|
|
|
|
- [[NCManageDatabase sharedInstance] clearTable:[tableQueueDownload class] account:app.activeAccount];
|
|
|
- [[NCManageDatabase sharedInstance] clearTable:[tableQueueUpload class] account:app.activeAccount];
|
|
|
+ [[NCManageDatabase sharedInstance] clearTable:[tableQueueDownload class] account:appDelegate.activeAccount];
|
|
|
+ [[NCManageDatabase sharedInstance] clearTable:[tableQueueUpload class] account:appDelegate.activeAccount];
|
|
|
|
|
|
- [app.netQueue cancelAllOperations];
|
|
|
+ [appDelegate.netQueue cancelAllOperations];
|
|
|
|
|
|
- [[CCNetworking sharedNetworking] settingSessionsDownload:YES upload:YES taskStatus:k_taskStatusCancel activeAccount:app.activeAccount activeUser:app.activeUser activeUrl:app.activeUrl];
|
|
|
+ [[CCNetworking sharedNetworking] settingSessionsDownload:YES upload:YES taskStatus:k_taskStatusCancel activeAccount:appDelegate.activeAccount activeUser:appDelegate.activeUser activeUrl:appDelegate.activeUrl];
|
|
|
|
|
|
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, 5 * NSEC_PER_SEC),dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
|
|
|
|
|
|
[[NSURLCache sharedURLCache] setMemoryCapacity:0];
|
|
|
[[NSURLCache sharedURLCache] setDiskCapacity:0];
|
|
|
|
|
|
- [[NCManageDatabase sharedInstance] clearTable:[tableActivity class] account:app.activeAccount];
|
|
|
- [[NCManageDatabase sharedInstance] clearTable:[tableCapabilities class] account:app.activeAccount];
|
|
|
- [[NCManageDatabase sharedInstance] clearTable:[tableDirectory class] account:app.activeAccount];
|
|
|
- [[NCManageDatabase sharedInstance] clearTable:[tableE2eEncryption class] account:app.activeAccount];
|
|
|
- [[NCManageDatabase sharedInstance] clearTable:[tableExternalSites class] account:app.activeAccount];
|
|
|
+ [[NCManageDatabase sharedInstance] clearTable:[tableActivity class] account:appDelegate.activeAccount];
|
|
|
+ [[NCManageDatabase sharedInstance] clearTable:[tableCapabilities class] account:appDelegate.activeAccount];
|
|
|
+ [[NCManageDatabase sharedInstance] clearTable:[tableDirectory class] account:appDelegate.activeAccount];
|
|
|
+ [[NCManageDatabase sharedInstance] clearTable:[tableE2eEncryption class] account:appDelegate.activeAccount];
|
|
|
+ [[NCManageDatabase sharedInstance] clearTable:[tableExternalSites class] account:appDelegate.activeAccount];
|
|
|
[[NCManageDatabase sharedInstance] clearTable:[tableGPS class] account:nil];
|
|
|
- [[NCManageDatabase sharedInstance] clearTable:[tableLocalFile class] account:app.activeAccount];
|
|
|
- [[NCManageDatabase sharedInstance] clearTable:[tableMetadata class] account:app.activeAccount];
|
|
|
- [[NCManageDatabase sharedInstance] clearTable:[tablePhotoLibrary class] account:app.activeAccount];
|
|
|
- [[NCManageDatabase sharedInstance] clearTable:[tableShare class] account:app.activeAccount];
|
|
|
+ [[NCManageDatabase sharedInstance] clearTable:[tableLocalFile class] account:appDelegate.activeAccount];
|
|
|
+ [[NCManageDatabase sharedInstance] clearTable:[tableMetadata class] account:appDelegate.activeAccount];
|
|
|
+ [[NCManageDatabase sharedInstance] clearTable:[tablePhotoLibrary class] account:appDelegate.activeAccount];
|
|
|
+ [[NCManageDatabase sharedInstance] clearTable:[tableShare class] account:appDelegate.activeAccount];
|
|
|
|
|
|
[[NCAutoUpload sharedInstance] alignPhotoLibrary];
|
|
|
|
|
|
- [self emptyUserDirectoryUser:app.activeUser url:app.activeUrl removeIco:removeIco];
|
|
|
+ [self emptyUserDirectoryUser:appDelegate.activeUser url:appDelegate.activeUrl removeIco:removeIco];
|
|
|
|
|
|
[self emptyLocalDirectory];
|
|
|
|
|
@@ -367,7 +371,7 @@
|
|
|
|
|
|
[self recalculateSize];
|
|
|
|
|
|
- [app maintenanceMode:NO];
|
|
|
+ [appDelegate maintenanceMode:NO];
|
|
|
|
|
|
dispatch_async(dispatch_get_main_queue(), ^{
|
|
|
// Close HUD
|
|
@@ -462,8 +466,8 @@
|
|
|
|
|
|
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, 0.01 * NSEC_PER_SEC), dispatch_get_main_queue(), ^(void) {
|
|
|
|
|
|
- [app.netQueue cancelAllOperations];
|
|
|
- [[CCNetworking sharedNetworking] settingSessionsDownload:YES upload:YES taskStatus:k_taskStatusCancel activeAccount:app.activeAccount activeUser:app.activeUser activeUrl:app.activeUrl];
|
|
|
+ [appDelegate.netQueue cancelAllOperations];
|
|
|
+ [[CCNetworking sharedNetworking] settingSessionsDownload:YES upload:YES taskStatus:k_taskStatusCancel activeAccount:appDelegate.activeAccount activeUser:appDelegate.activeUser activeUrl:appDelegate.activeUrl];
|
|
|
|
|
|
[[NSURLCache sharedURLCache] setMemoryCapacity:0];
|
|
|
[[NSURLCache sharedURLCache] setDiskCapacity:0];
|
|
@@ -584,7 +588,7 @@
|
|
|
|
|
|
- (NSNumber *)getUserDirectorySize
|
|
|
{
|
|
|
- NSString *directoryUser = [CCUtility getDirectoryActiveUser:app.activeUser activeUrl:app.activeUrl];
|
|
|
+ NSString *directoryUser = [CCUtility getDirectoryActiveUser:appDelegate.activeUser activeUrl:appDelegate.activeUrl];
|
|
|
NSURL *directoryURL = [NSURL fileURLWithPath:directoryUser];
|
|
|
unsigned long long count = 0;
|
|
|
NSNumber *value = nil;
|