|
@@ -46,34 +46,6 @@
|
|
|
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(changeTheming) name:@"changeTheming" object:nil];
|
|
|
|
|
|
form = [XLFormDescriptor formDescriptorWithTitle:NSLocalizedString(@"_advanced_", nil)];
|
|
|
-
|
|
|
- // Section ACTIVITY -------------------------------------------------
|
|
|
-
|
|
|
- section = [XLFormSectionDescriptor formSectionWithTitle:NSLocalizedString(@"_activity_", nil)];
|
|
|
- [form addFormSection:section];
|
|
|
-
|
|
|
- row = [XLFormRowDescriptor formRowDescriptorWithTag:@"activityVerboseHigh" rowType:XLFormRowDescriptorTypeBooleanSwitch title:NSLocalizedString(@"_help_activity_verbose_", nil)];
|
|
|
- [row.cellConfig setObject:[UIFont systemFontOfSize:15.0]forKey:@"textLabel.font"];
|
|
|
- [row.cellConfig setObject:[CCGraphics changeThemingColorImage:[UIImage imageNamed:@"activityHigh"] multiplier:2 color:[NCBrandColor sharedInstance].icon] forKey:@"imageView.image"];
|
|
|
- if ([CCUtility getActivityVerboseHigh]) row.value = @"1";
|
|
|
- else row.value = @"0";
|
|
|
- [section addFormRow:row];
|
|
|
-
|
|
|
- row = [XLFormRowDescriptor formRowDescriptorWithTag:@"sendMailActivity" rowType:XLFormRowDescriptorTypeButton title:NSLocalizedString(@"_help_activity_mail_", nil)];
|
|
|
- [row.cellConfig setObject:@(NSTextAlignmentLeft) forKey:@"textLabel.textAlignment"];
|
|
|
- [row.cellConfig setObject:[UIColor blackColor] forKey:@"textLabel.textColor"];
|
|
|
- [row.cellConfig setObject:[UIFont systemFontOfSize:15.0]forKey:@"textLabel.font"];
|
|
|
- [row.cellConfig setObject:[CCGraphics changeThemingColorImage:[UIImage imageNamed:@"mail"] multiplier:2 color:[NCBrandColor sharedInstance].icon] forKey:@"imageView.image"];
|
|
|
- row.action.formSelector = @selector(sendMail:);
|
|
|
- [section addFormRow:row];
|
|
|
-
|
|
|
- row = [XLFormRowDescriptor formRowDescriptorWithTag:@"clearActivityLog" rowType:XLFormRowDescriptorTypeButton title:NSLocalizedString(@"_help_activity_clear_", nil)];
|
|
|
- [row.cellConfig setObject:[UIFont systemFontOfSize:15.0]forKey:@"textLabel.font"];
|
|
|
- [row.cellConfig setObject:[UIColor blackColor] forKey:@"textLabel.textColor"];
|
|
|
- [row.cellConfig setObject:@(NSTextAlignmentLeft) forKey:@"textLabel.textAlignment"];
|
|
|
- [row.cellConfig setObject:[CCGraphics changeThemingColorImage:[UIImage imageNamed:@"delete"] multiplier:2 color:[NCBrandColor sharedInstance].icon] forKey:@"imageView.image"];
|
|
|
- row.action.formSelector = @selector(clearActivity:);
|
|
|
- [section addFormRow:row];
|
|
|
|
|
|
// Section HIDDEN FILES -------------------------------------------------
|
|
|
|
|
@@ -165,8 +137,6 @@
|
|
|
// Color
|
|
|
[appDelegate aspectNavigationControllerBar:self.navigationController.navigationBar online:[appDelegate.reachability isReachable] hidden:NO];
|
|
|
[appDelegate aspectTabBar:self.tabBarController.tabBar hidden:NO];
|
|
|
-
|
|
|
- //[self recalculateSize];
|
|
|
}
|
|
|
|
|
|
- (void)changeTheming
|
|
@@ -179,14 +149,6 @@
|
|
|
{
|
|
|
[super formRowDescriptorValueHasChanged:rowDescriptor oldValue:oldValue newValue:newValue];
|
|
|
|
|
|
- if ([rowDescriptor.tag isEqualToString:@"activityVerboseHigh"]) {
|
|
|
-
|
|
|
- [CCUtility setActivityVerboseHigh:[[rowDescriptor.value valueData] boolValue]];
|
|
|
-
|
|
|
- // Clear Date read Activity for force reload datasource
|
|
|
- //appDelegate.activeActivity.storeDateFirstActivity = nil;
|
|
|
- }
|
|
|
-
|
|
|
if ([rowDescriptor.tag isEqualToString:@"showHiddenFiles"]) {
|
|
|
|
|
|
[CCUtility setShowHiddenFiles:[[rowDescriptor.value valueData] boolValue]];
|
|
@@ -206,118 +168,6 @@
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-#pragma --------------------------------------------------------------------------------------------
|
|
|
-#pragma mark === Mail ===
|
|
|
-#pragma --------------------------------------------------------------------------------------------
|
|
|
-
|
|
|
-- (void) mailComposeController:(MFMailComposeViewController *)vc didFinishWithResult:(MFMailComposeResult)result error:(NSError *)error
|
|
|
-{
|
|
|
- switch (result)
|
|
|
- {
|
|
|
- case MFMailComposeResultCancelled:
|
|
|
- [appDelegate messageNotification:@"_info_" description:@"_mail_deleted_" visible:YES delay:k_dismissAfterSecond type:TWMessageBarMessageTypeSuccess errorCode: error.code];
|
|
|
- break;
|
|
|
- case MFMailComposeResultSaved:
|
|
|
- [appDelegate messageNotification:@"_info_" description:@"_mail_saved_" visible:YES delay:k_dismissAfterSecond type:TWMessageBarMessageTypeSuccess errorCode: error.code];
|
|
|
- break;
|
|
|
- case MFMailComposeResultSent:
|
|
|
- [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]];
|
|
|
- [appDelegate messageNotification:@"_error_" description:msg visible:YES delay:k_dismissAfterSecond type:TWMessageBarMessageTypeError errorCode: error.code];
|
|
|
- }
|
|
|
- break;
|
|
|
- default:
|
|
|
- break;
|
|
|
- }
|
|
|
-
|
|
|
- // Close the Mail Interface
|
|
|
- [self dismissViewControllerAnimated:YES completion:NULL];
|
|
|
-}
|
|
|
-
|
|
|
-- (void)sendMail:(XLFormRowDescriptor *)sender
|
|
|
-{
|
|
|
- [self deselectFormRow:sender];
|
|
|
-
|
|
|
- // Email Subject
|
|
|
- NSString *emailTitle = NSLocalizedString(@"_information_req_", nil);
|
|
|
- // Email Content
|
|
|
- NSString *messageBody;
|
|
|
- // File Attachment
|
|
|
- NSString *fileAttachment = @"";
|
|
|
- // Email Recipents
|
|
|
- NSArray *toRecipents;
|
|
|
-
|
|
|
- NSArray *activities = [[NCManageDatabase sharedInstance] getActivityWithPredicate:[NSPredicate predicateWithFormat:@"account == %@", appDelegate.activeAccount]];
|
|
|
-
|
|
|
- if ([activities count] == 0) {
|
|
|
-
|
|
|
- [appDelegate messageNotification:@"_info_" description:@"No activity found" visible:YES delay:k_dismissAfterSecond type:TWMessageBarMessageTypeInfo errorCode:0];
|
|
|
- return;
|
|
|
- }
|
|
|
-
|
|
|
- for (tableActivity *activity in activities) {
|
|
|
-
|
|
|
- NSString *date, *type, *actionFile, *note;
|
|
|
-
|
|
|
- date = [[NSDateFormatter localizedStringFromDate:activity.date dateStyle:NSDateFormatterShortStyle timeStyle:NSDateFormatterMediumStyle] stringByPaddingToLength:22 withString:@" " startingAtIndex:0];
|
|
|
-
|
|
|
- if ([activity.type isEqual: k_activityTypeInfo]) type = @"Info ";
|
|
|
- if ([activity.type isEqual: k_activityTypeSuccess]) type = @"Success";
|
|
|
- if ([activity.type isEqual: k_activityTypeFailure]) type = @"Failure";
|
|
|
-
|
|
|
- actionFile = [[NSString stringWithFormat:@"%@ %@", activity.action, activity.app] stringByPaddingToLength:100 withString:@" " startingAtIndex:0];
|
|
|
-
|
|
|
- if (activity.idActivity == 0) note = [NSString stringWithFormat:@"%@ Selector: %@", activity.note, activity.selector];
|
|
|
- else note = activity.note;
|
|
|
- note = [note stringByPaddingToLength:200 withString:@" " startingAtIndex:0];
|
|
|
-
|
|
|
- fileAttachment = [fileAttachment stringByAppendingString:[NSString stringWithFormat:@"| %@ | %@ | %@ | %@ |\n", date, type, actionFile, note]];
|
|
|
- }
|
|
|
-
|
|
|
- messageBody = [NSString stringWithFormat:@"\n\n\n%@ Version %@ (%@)", [NCBrandOptions sharedInstance].brand, [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleShortVersionString"], [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleVersion"]];
|
|
|
-
|
|
|
- NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
|
|
|
- NSString *documentsDirectory = [paths objectAtIndex:0];
|
|
|
- NSError *error;
|
|
|
-
|
|
|
- // fix CCAdvanced.m line 276 2.17.2 (00005)
|
|
|
- if ([fileAttachment writeToFile:[documentsDirectory stringByAppendingPathComponent:@"activity.txt"] atomically:YES encoding:NSUTF8StringEncoding error:&error] && [MFMailComposeViewController canSendMail]) {
|
|
|
-
|
|
|
- toRecipents = [NSArray arrayWithObject:[NCBrandOptions sharedInstance].mailMe];
|
|
|
-
|
|
|
- MFMailComposeViewController *mc = [[MFMailComposeViewController alloc] init];
|
|
|
- mc.mailComposeDelegate = self;
|
|
|
- [mc setSubject:emailTitle];
|
|
|
- [mc setMessageBody:messageBody isHTML:NO];
|
|
|
- [mc setToRecipients:toRecipents];
|
|
|
-
|
|
|
- NSData *noteData = [NSData dataWithContentsOfFile:[documentsDirectory stringByAppendingPathComponent:@"activity.txt"]];
|
|
|
- [mc addAttachmentData:noteData mimeType:@"text/plain" fileName:@"activity.txt"];
|
|
|
-
|
|
|
- // Present mail view controller on screen
|
|
|
- [self presentViewController:mc animated:YES completion:NULL];
|
|
|
-
|
|
|
- } else {
|
|
|
-
|
|
|
- [appDelegate messageNotification:@"_error_" description:@"Impossible create file body" visible:YES delay:k_dismissAfterSecond type:TWMessageBarMessageTypeError errorCode:k_CCErrorInternalError];
|
|
|
- }
|
|
|
-}
|
|
|
-
|
|
|
-#pragma --------------------------------------------------------------------------------------------
|
|
|
-#pragma mark === Clear Activity ===
|
|
|
-#pragma --------------------------------------------------------------------------------------------
|
|
|
-
|
|
|
-- (void)clearActivity:(XLFormRowDescriptor *)sender
|
|
|
-{
|
|
|
- [self deselectFormRow:sender];
|
|
|
-
|
|
|
- [[NCManageDatabase sharedInstance] clearTable:[tableActivity class] account:appDelegate.activeAccount];
|
|
|
-
|
|
|
- //[appDelegate.activeActivity reloadDatasource];
|
|
|
-}
|
|
|
-
|
|
|
#pragma --------------------------------------------------------------------------------------------
|
|
|
#pragma mark === Clear Cache ===
|
|
|
#pragma --------------------------------------------------------------------------------------------
|
|
@@ -503,24 +353,4 @@
|
|
|
[[NSFileManager defaultManager] removeItemAtPath:[NSString stringWithFormat:@"%@/%@", dirIniziale, file] error:nil];
|
|
|
}
|
|
|
|
|
|
-- (NSNumber *)getUserDirectorySize
|
|
|
-{
|
|
|
- NSURL *directoryURL = [CCUtility getDirectoryGroup];
|
|
|
- unsigned long long count = 0;
|
|
|
- NSNumber *value = nil;
|
|
|
-
|
|
|
- if (! directoryURL) return 0;
|
|
|
-
|
|
|
- // Get dimension Document
|
|
|
- for (NSURL *url in [[NSFileManager defaultManager] enumeratorAtURL:directoryURL includingPropertiesForKeys:@[NSURLFileSizeKey] options:0 errorHandler:NULL]) {
|
|
|
- if ([url getResourceValue:&value forKey:NSURLFileSizeKey error:nil]) {
|
|
|
- count += [value longLongValue];
|
|
|
- } else {
|
|
|
- return nil;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- return @(count);
|
|
|
-}
|
|
|
-
|
|
|
@end
|