From 1f0893f78b183863fdbb38ce70385cb0f05b1424 Mon Sep 17 00:00:00 2001 From: "Bernd.Rederlechner@t-systems.com" Date: Wed, 31 Jan 2024 10:02:05 +0100 Subject: [PATCH 01/19] Add custom build for debugging merge --- .github/workflows/nmc-custom-client.yml | 37 +++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 .github/workflows/nmc-custom-client.yml diff --git a/.github/workflows/nmc-custom-client.yml b/.github/workflows/nmc-custom-client.yml new file mode 100644 index 0000000000..71ce2a4f46 --- /dev/null +++ b/.github/workflows/nmc-custom-client.yml @@ -0,0 +1,37 @@ +### +# SPDX-License-Identifier: AGPL-3.0 +# +# Author: Bernd rederlechner +# +# Builds a stable release package based on a release assembly +# customisation-- +# +# As soon as a package is deployed to production, the tag and the branch +# MUST STAY FOR 2 years and not deleted. +# +# Release packages, tags and customisation branches not delivered to production should +# be deleted asap a newer release is available. +# + +name: MCLOUD custom client merge + +on: + workflow_dispatch: + inputs: + branch: + type: choice + description: Custom build from base branch + options: + - master + - stable-4.9.7 + # - v3.0.8 + default: master + +jobs: + assemble-custom: + uses: nextmcloud/.github/.github/workflows/nmc-custom-client.yml@master + with: + trunk: 'master' + stable: ${{ inputs.branch }} + result: ${{ format('customisation-{0}-{1}', github.actor, inputs.branch) }} + secrets: inherit \ No newline at end of file From 9875840337c7037fda09a01eb3891b2521f8f78d Mon Sep 17 00:00:00 2001 From: "Bernd.Rederlechner@t-systems.com" Date: Mon, 12 Feb 2024 16:37:32 +0100 Subject: [PATCH 02/19] Add script for automatic backport PR creation --- .github/workflows/nmc-custom-stables.yml | 36 ++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 .github/workflows/nmc-custom-stables.yml diff --git a/.github/workflows/nmc-custom-stables.yml b/.github/workflows/nmc-custom-stables.yml new file mode 100644 index 0000000000..8062414c0f --- /dev/null +++ b/.github/workflows/nmc-custom-stables.yml @@ -0,0 +1,36 @@ +### +# SPDX-License-Identifier: AGPL-3.0 +# +# Author: Bernd rederlechner +# +# Builds a stable release package based on a release assembly +# customisation-- +# +# As soon as a package is deployed to production, the tag and the branch +# MUST STAY FOR 2 years and not deleted. +# +# Release packages, tags and customisation branches not delivered to production should +# be deleted asap a newer release is available. +# + +name: MCLOUD create stable backports + +on: + workflow_dispatch: + inputs: + branch: + type: choice + description: Custom build from base branch + options: + - stable-4.9.7 + - 4.9.6 + - 4.9.5 + default: stable-4.9.7 + +jobs: + backport-custom: + uses: nextmcloud/.github/.github/workflows/nmc-custom-stables.yml@master + with: + trunk: 'master' + stable: ${{ inputs.branch }} + secrets: inherit \ No newline at end of file From 65a11adb4b77abc7b82ba0ac34c309fd48ec9f84 Mon Sep 17 00:00:00 2001 From: TSI-amrutwaghmare <96108296+TSI-amrutwaghmare@users.noreply.github.com> Date: Fri, 29 Mar 2024 13:09:32 +0530 Subject: [PATCH 03/19] Update script for adding new stable branch --- .github/workflows/nmc-custom-stables.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/nmc-custom-stables.yml b/.github/workflows/nmc-custom-stables.yml index 8062414c0f..9058d719ed 100644 --- a/.github/workflows/nmc-custom-stables.yml +++ b/.github/workflows/nmc-custom-stables.yml @@ -22,10 +22,11 @@ on: type: choice description: Custom build from base branch options: + - stable-5.2.1 - stable-4.9.7 - 4.9.6 - 4.9.5 - default: stable-4.9.7 + default: stable-5.2.1 jobs: backport-custom: @@ -33,4 +34,4 @@ jobs: with: trunk: 'master' stable: ${{ inputs.branch }} - secrets: inherit \ No newline at end of file + secrets: inherit From 97b5319c96d2c23e5dd4868109c3198ed57a1775 Mon Sep 17 00:00:00 2001 From: TSI-amrutwaghmare <96108296+TSI-amrutwaghmare@users.noreply.github.com> Date: Mon, 15 Apr 2024 18:28:46 +0530 Subject: [PATCH 04/19] Update stable branch 5.2.7 --- .github/workflows/nmc-custom-stables.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/nmc-custom-stables.yml b/.github/workflows/nmc-custom-stables.yml index 9058d719ed..c1b444820d 100644 --- a/.github/workflows/nmc-custom-stables.yml +++ b/.github/workflows/nmc-custom-stables.yml @@ -22,11 +22,12 @@ on: type: choice description: Custom build from base branch options: + - stable-5.2.7 - stable-5.2.1 - stable-4.9.7 - 4.9.6 - 4.9.5 - default: stable-5.2.1 + default: stable-5.2.7 jobs: backport-custom: From 2bd55c70d6992bac005e679fc07cc21f77caa66e Mon Sep 17 00:00:00 2001 From: TSI-amrutwaghmare <96108296+TSI-amrutwaghmare@users.noreply.github.com> Date: Wed, 22 May 2024 12:27:39 +0530 Subject: [PATCH 05/19] Update new version 5.2.7 --- .github/workflows/nmc-custom-client.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/nmc-custom-client.yml b/.github/workflows/nmc-custom-client.yml index 71ce2a4f46..bffac0f70b 100644 --- a/.github/workflows/nmc-custom-client.yml +++ b/.github/workflows/nmc-custom-client.yml @@ -24,6 +24,8 @@ on: options: - master - stable-4.9.7 + - stable-5.2.1 + - stable-5.2.7 # - v3.0.8 default: master @@ -34,4 +36,4 @@ jobs: trunk: 'master' stable: ${{ inputs.branch }} result: ${{ format('customisation-{0}-{1}', github.actor, inputs.branch) }} - secrets: inherit \ No newline at end of file + secrets: inherit From cd32b739e41471e119428269f8931e80eae0403c Mon Sep 17 00:00:00 2001 From: TSI-amrutwaghmare <96108296+TSI-amrutwaghmare@users.noreply.github.com> Date: Fri, 26 Jul 2024 13:58:51 +0530 Subject: [PATCH 06/19] Update nmc-custom-client.yml --- .github/workflows/nmc-custom-client.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/nmc-custom-client.yml b/.github/workflows/nmc-custom-client.yml index bffac0f70b..42f6190758 100644 --- a/.github/workflows/nmc-custom-client.yml +++ b/.github/workflows/nmc-custom-client.yml @@ -26,6 +26,7 @@ on: - stable-4.9.7 - stable-5.2.1 - stable-5.2.7 + - stable-5.5.0 # - v3.0.8 default: master From 76a2a80ce8f70482e9f5ed5bcc02c632a955f4ab Mon Sep 17 00:00:00 2001 From: TSI-amrutwaghmare <96108296+TSI-amrutwaghmare@users.noreply.github.com> Date: Mon, 26 Aug 2024 12:07:07 +0530 Subject: [PATCH 07/19] Update nmc-custom-stables.yml Added new stable 5.5.4 --- .github/workflows/nmc-custom-stables.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/nmc-custom-stables.yml b/.github/workflows/nmc-custom-stables.yml index c1b444820d..aa1b6ca733 100644 --- a/.github/workflows/nmc-custom-stables.yml +++ b/.github/workflows/nmc-custom-stables.yml @@ -22,12 +22,13 @@ on: type: choice description: Custom build from base branch options: + - stable-5.5.4 - stable-5.2.7 - stable-5.2.1 - stable-4.9.7 - 4.9.6 - 4.9.5 - default: stable-5.2.7 + default: stable-5.5.4 jobs: backport-custom: From 7547844820fc0aa010ab6dddd43cfda568964c4c Mon Sep 17 00:00:00 2001 From: TSI-amrutwaghmare <96108296+TSI-amrutwaghmare@users.noreply.github.com> Date: Mon, 30 Sep 2024 14:41:09 +0530 Subject: [PATCH 08/19] Update nmc-custom-stables.yml for NC stable 5.5.5 --- .github/workflows/nmc-custom-stables.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/nmc-custom-stables.yml b/.github/workflows/nmc-custom-stables.yml index aa1b6ca733..a9c6fa2b9d 100644 --- a/.github/workflows/nmc-custom-stables.yml +++ b/.github/workflows/nmc-custom-stables.yml @@ -22,13 +22,14 @@ on: type: choice description: Custom build from base branch options: + - stable-5.5.5 - stable-5.5.4 - stable-5.2.7 - stable-5.2.1 - stable-4.9.7 - 4.9.6 - 4.9.5 - default: stable-5.5.4 + default: stable-5.5.5 jobs: backport-custom: From 479f2526af7564160797abe3479f6368d01fcadf Mon Sep 17 00:00:00 2001 From: TSI-amrutwaghmare <96108296+TSI-amrutwaghmare@users.noreply.github.com> Date: Mon, 30 Sep 2024 14:42:57 +0530 Subject: [PATCH 09/19] Update nmc-custom-client.yml for NC Stable 5.5.5 --- .github/workflows/nmc-custom-client.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/nmc-custom-client.yml b/.github/workflows/nmc-custom-client.yml index 42f6190758..1c140fefec 100644 --- a/.github/workflows/nmc-custom-client.yml +++ b/.github/workflows/nmc-custom-client.yml @@ -27,6 +27,7 @@ on: - stable-5.2.1 - stable-5.2.7 - stable-5.5.0 + - stable-5.5.5 # - v3.0.8 default: master From b60c1a157d50c2481e1f1aca9065208fb101f7d0 Mon Sep 17 00:00:00 2001 From: harshada-15-tsys Date: Mon, 18 Nov 2024 14:57:36 +0530 Subject: [PATCH 10/19] Update nmc-custom-stables.yml for stable-6.1.3 --- .github/workflows/nmc-custom-stables.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/nmc-custom-stables.yml b/.github/workflows/nmc-custom-stables.yml index a9c6fa2b9d..58cb823f28 100644 --- a/.github/workflows/nmc-custom-stables.yml +++ b/.github/workflows/nmc-custom-stables.yml @@ -22,6 +22,7 @@ on: type: choice description: Custom build from base branch options: + - stable-6.1.3 - stable-5.5.5 - stable-5.5.4 - stable-5.2.7 @@ -29,7 +30,7 @@ on: - stable-4.9.7 - 4.9.6 - 4.9.5 - default: stable-5.5.5 + default: stable-6.1.3 jobs: backport-custom: From cf8058e99faa76b85abe6857a3e3f9a0400ec712 Mon Sep 17 00:00:00 2001 From: harshada-15-tsys Date: Mon, 31 Mar 2025 14:56:50 +0530 Subject: [PATCH 11/19] Update nmc-custom-stables.yml Update nmc-custom-stables.yml for NC stable-6.2.7 --- .github/workflows/nmc-custom-stables.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/nmc-custom-stables.yml b/.github/workflows/nmc-custom-stables.yml index 58cb823f28..6494e6bb04 100644 --- a/.github/workflows/nmc-custom-stables.yml +++ b/.github/workflows/nmc-custom-stables.yml @@ -22,6 +22,7 @@ on: type: choice description: Custom build from base branch options: + - stable-6.2.7 - stable-6.1.3 - stable-5.5.5 - stable-5.5.4 @@ -30,7 +31,7 @@ on: - stable-4.9.7 - 4.9.6 - 4.9.5 - default: stable-6.1.3 + default: stable-6.2.7 jobs: backport-custom: From 5d31a329d6bd50fcb9c87fb93f198d0465fa00ba Mon Sep 17 00:00:00 2001 From: harshada-15-tsys Date: Mon, 31 Mar 2025 14:59:30 +0530 Subject: [PATCH 12/19] Update nmc-custom-client.yml Update nmc-custom-client.yml for NC Stable 6.2.7 --- .github/workflows/nmc-custom-client.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/nmc-custom-client.yml b/.github/workflows/nmc-custom-client.yml index 1c140fefec..d7f0c57da2 100644 --- a/.github/workflows/nmc-custom-client.yml +++ b/.github/workflows/nmc-custom-client.yml @@ -28,6 +28,8 @@ on: - stable-5.2.7 - stable-5.5.0 - stable-5.5.5 + - stable-6.1.3 + - stable-6.2.7 # - v3.0.8 default: master From 323764d256fd25d771bc14a84d962c9fca7e74c0 Mon Sep 17 00:00:00 2001 From: harshada-15-tsys Date: Wed, 16 Apr 2025 17:45:12 +0530 Subject: [PATCH 13/19] Update nmc-custom-stables.yml for NC stable-6.6.0 --- .github/workflows/nmc-custom-stables.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/nmc-custom-stables.yml b/.github/workflows/nmc-custom-stables.yml index 6494e6bb04..5ddb738302 100644 --- a/.github/workflows/nmc-custom-stables.yml +++ b/.github/workflows/nmc-custom-stables.yml @@ -22,6 +22,7 @@ on: type: choice description: Custom build from base branch options: + - stable-6.6.0 - stable-6.2.7 - stable-6.1.3 - stable-5.5.5 @@ -31,7 +32,7 @@ on: - stable-4.9.7 - 4.9.6 - 4.9.5 - default: stable-6.2.7 + default: stable-6.6.0 jobs: backport-custom: From 4e2a61cc477d92c66a3864869623080d42a7600d Mon Sep 17 00:00:00 2001 From: harshada-15-tsys Date: Thu, 17 Apr 2025 13:56:34 +0530 Subject: [PATCH 14/19] Update nmc-custom-stables.yml for NC Stable 6.5.0 --- .github/workflows/nmc-custom-stables.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/nmc-custom-stables.yml b/.github/workflows/nmc-custom-stables.yml index 5ddb738302..d418101a89 100644 --- a/.github/workflows/nmc-custom-stables.yml +++ b/.github/workflows/nmc-custom-stables.yml @@ -22,7 +22,7 @@ on: type: choice description: Custom build from base branch options: - - stable-6.6.0 + - stable-6.5.0 - stable-6.2.7 - stable-6.1.3 - stable-5.5.5 @@ -32,7 +32,7 @@ on: - stable-4.9.7 - 4.9.6 - 4.9.5 - default: stable-6.6.0 + default: stable-6.5.0 jobs: backport-custom: From b7c6e05c4b397d11130b82f13b959b3e1b43708c Mon Sep 17 00:00:00 2001 From: harshada-15-tsys Date: Thu, 17 Apr 2025 15:23:20 +0530 Subject: [PATCH 15/19] Update nmc-custom-stables.yml for NC stable-6.6.0 --- .github/workflows/nmc-custom-stables.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/nmc-custom-stables.yml b/.github/workflows/nmc-custom-stables.yml index d418101a89..ac0f14243f 100644 --- a/.github/workflows/nmc-custom-stables.yml +++ b/.github/workflows/nmc-custom-stables.yml @@ -22,6 +22,7 @@ on: type: choice description: Custom build from base branch options: + - stable-6.6.0 - stable-6.5.0 - stable-6.2.7 - stable-6.1.3 @@ -32,7 +33,7 @@ on: - stable-4.9.7 - 4.9.6 - 4.9.5 - default: stable-6.5.0 + default: stable-6.6.0 jobs: backport-custom: From 05c97be7b4c6499ce47044800b870d7a36c1a163 Mon Sep 17 00:00:00 2001 From: harshada-15-tsys Date: Wed, 4 Jun 2025 12:22:20 +0530 Subject: [PATCH 16/19] Update nmc-custom-stables.yml to stable-6.6.3 --- .github/workflows/nmc-custom-stables.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/nmc-custom-stables.yml b/.github/workflows/nmc-custom-stables.yml index ac0f14243f..241d7165ed 100644 --- a/.github/workflows/nmc-custom-stables.yml +++ b/.github/workflows/nmc-custom-stables.yml @@ -22,6 +22,7 @@ on: type: choice description: Custom build from base branch options: + - stable-6.6.3 - stable-6.6.0 - stable-6.5.0 - stable-6.2.7 @@ -33,7 +34,7 @@ on: - stable-4.9.7 - 4.9.6 - 4.9.5 - default: stable-6.6.0 + default: stable-6.6.3 jobs: backport-custom: From 8fd34eb5fd58dabf595a95a93f2d029a35767612 Mon Sep 17 00:00:00 2001 From: harshada-15-tsys Date: Wed, 4 Jun 2025 12:23:59 +0530 Subject: [PATCH 17/19] Update nmc-custom-client.yml to stable-6.6.3 --- .github/workflows/nmc-custom-client.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/nmc-custom-client.yml b/.github/workflows/nmc-custom-client.yml index d7f0c57da2..9c3e86c1bc 100644 --- a/.github/workflows/nmc-custom-client.yml +++ b/.github/workflows/nmc-custom-client.yml @@ -30,6 +30,8 @@ on: - stable-5.5.5 - stable-6.1.3 - stable-6.2.7 + - stable-6.6.0 + - stable-6.6.3 # - v3.0.8 default: master From 95fe3dc32ee628ce1ff576c478e7549a55171370 Mon Sep 17 00:00:00 2001 From: TSI-amrutwaghmare <96108296+TSI-amrutwaghmare@users.noreply.github.com> Date: Mon, 20 Nov 2023 15:56:10 +0530 Subject: [PATCH 18/19] NMC 1931 - Auto upload customisation and unit test --- .../NextcloudUnitTests/AudioUploadTests.swift | 52 ++ iOSClient/Settings/CCManageAutoUpload.m | 497 ++++++++++++++++++ .../Settings/NCManageAutoUploadFileName.swift | 232 ++++++++ 3 files changed, 781 insertions(+) create mode 100644 Tests/NextcloudUnitTests/AudioUploadTests.swift create mode 100644 iOSClient/Settings/CCManageAutoUpload.m create mode 100644 iOSClient/Settings/NCManageAutoUploadFileName.swift diff --git a/Tests/NextcloudUnitTests/AudioUploadTests.swift b/Tests/NextcloudUnitTests/AudioUploadTests.swift new file mode 100644 index 0000000000..2ea01a8085 --- /dev/null +++ b/Tests/NextcloudUnitTests/AudioUploadTests.swift @@ -0,0 +1,52 @@ +// +// AudioUploadTests.swift +// NextcloudTests +// +// Created by A200020526 on 13/06/23. +// Copyright © 2023 Marino Faggiana. All rights reserved. +// + +import XCTest +@testable import Nextcloud + +final class AudioUploadTests: XCTestCase { + var viewController:NCAudioRecorderViewController? + + override func setUpWithError() throws { + // Put setup code here. This method is called before the invocation of each test method in the class. + // Step 1. Create an instance of UIStoryboard + let viewController = UIStoryboard(name: "NCAudioRecorderViewController", bundle: nil).instantiateInitialViewController() as? NCAudioRecorderViewController + // Step 3. Make the viewDidLoad() execute. + viewController?.loadViewIfNeeded() + } + + override func tearDownWithError() throws { + // Put teardown code here. This method is called after the invocation of each test method in the class. + viewController = nil + } + + func testExample() throws { + // This is an example of a functional test case. + // Use XCTAssert and related functions to verify your tests produce the correct results. + // Any test you write for XCTest can be annotated as throws and async. + // Mark your test throws to produce an unexpected failure when your test encounters an uncaught error. + // Mark your test async to allow awaiting for asynchronous code to complete. Check the results with assertions afterwards. + } + + func testPerformanceExample() throws { + // This is an example of a performance test case. + self.measure { + // Put the code you want to measure the time of here. + } + } + + func testAudioMeterUpdateAfterDb(){ + viewController?.audioMeterDidUpdate(0.5) + XCTAssertNotNil(!(viewController?.durationLabel.text?.isEmpty ?? false)) + } + + func testStartRecorder(){ + viewController?.startStop() + XCTAssertEqual(viewController?.recording.state, nil, "Test start audio recorder") + } +} diff --git a/iOSClient/Settings/CCManageAutoUpload.m b/iOSClient/Settings/CCManageAutoUpload.m new file mode 100644 index 0000000000..a90fc3d21a --- /dev/null +++ b/iOSClient/Settings/CCManageAutoUpload.m @@ -0,0 +1,497 @@ +// +// CCManageAutoUpload.m +// Nextcloud +// +// Created by Marino Faggiana on 01/09/15. +// Copyright (c) 2015 Marino Faggiana. All rights reserved. +// +// Author Marino Faggiana +// +// 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 . +// + +#import +#import "CCManageAutoUpload.h" +#import "CCUtility.h" +#import "NCBridgeSwift.h" + +@interface CCManageAutoUpload () +{ + AppDelegate *appDelegate; +} +@end + +@implementation CCManageAutoUpload + +- (void)initializeForm +{ + XLFormDescriptor *form = [XLFormDescriptor formDescriptor]; + XLFormSectionDescriptor *section; + XLFormRowDescriptor *row; + + tableAccount *activeAccount = [[NCManageDatabase shared] getActiveAccount]; + + // Auto Upload + + section = [XLFormSectionDescriptor formSection]; + [form addFormSection:section]; + section.footerTitle = NSLocalizedString(@"_autoupload_description_", nil); + + row = [XLFormRowDescriptor formRowDescriptorWithTag:@"autoUpload" rowType:XLFormRowDescriptorTypeBooleanSwitch title:NSLocalizedString(@"_autoupload_", nil)]; + row.cellConfigAtConfigure[@"backgroundColor"] = UIColor.secondarySystemGroupedBackgroundColor; + if (activeAccount.autoUpload) row.value = @1; + else row.value = @0; + [row.cellConfig setObject:[UIFont systemFontOfSize:15.0] forKey:@"textLabel.font"]; + [row.cellConfig setObject:UIColor.labelColor forKey:@"textLabel.textColor"]; + row.cellConfig[@"switchControl.onTintColor"] = NCBrandColor.shared.brand; + [section addFormRow:row]; + + // Auto Upload Directory + + section = [XLFormSectionDescriptor formSection]; + [form addFormSection:section]; + + row = [XLFormRowDescriptor formRowDescriptorWithTag:@"autoUploadDirectory" rowType:XLFormRowDescriptorTypeButton title:NSLocalizedString(@"_autoupload_select_folder_", nil)]; + row.cellConfigAtConfigure[@"backgroundColor"] = UIColor.secondarySystemGroupedBackgroundColor; + row.hidden = [NSString stringWithFormat:@"$%@==0", @"autoUpload"]; + [row.cellConfig setObject:[[UIImage imageNamed:@"foldersOnTop"] imageWithColor:NCBrandColor.shared.iconColor size:25] forKey:@"imageView.image"]; + [row.cellConfig setObject:[UIFont systemFontOfSize:15.0] forKey:@"textLabel.font"]; + [row.cellConfig setObject:UIColor.labelColor forKey:@"textLabel.textColor"]; + [row.cellConfig setObject:@(NSTextAlignmentLeft) forKey:@"textLabel.textAlignment"]; + //[row.cellConfig setObject:@(UITableViewCellAccessoryDisclosureIndicator) forKey:@"accessoryType"]; + row.action.formSelector = @selector(selectAutomaticUploadFolder); + [section addFormRow:row]; + + // Auto Upload Photo + + section = [XLFormSectionDescriptor formSection]; + [form addFormSection:section]; + + row = [XLFormRowDescriptor formRowDescriptorWithTag:@"autoUploadImage" rowType:XLFormRowDescriptorTypeBooleanSwitch title:NSLocalizedString(@"_autoupload_photos_", nil)]; + row.cellConfigAtConfigure[@"backgroundColor"] = UIColor.secondarySystemGroupedBackgroundColor; + row.hidden = [NSString stringWithFormat:@"$%@==0", @"autoUpload"]; + if (activeAccount.autoUploadImage) row.value = @1; + else row.value = @0; + [row.cellConfig setObject:[UIFont systemFontOfSize:15.0] forKey:@"textLabel.font"]; + [row.cellConfig setObject:UIColor.labelColor forKey:@"textLabel.textColor"]; + row.cellConfig[@"switchControl.onTintColor"] = NCBrandColor.shared.brand; + [section addFormRow:row]; + + row = [XLFormRowDescriptor formRowDescriptorWithTag:@"autoUploadWWAnPhoto" rowType:XLFormRowDescriptorTypeBooleanSwitch title:NSLocalizedString(@"_wifi_only_", nil)]; + row.cellConfigAtConfigure[@"backgroundColor"] = UIColor.secondarySystemGroupedBackgroundColor; + row.hidden = [NSString stringWithFormat:@"$%@==0", @"autoUpload"]; + if (activeAccount.autoUploadWWAnPhoto) row.value = @1; + else row.value = @0; + [row.cellConfig setObject:[UIFont systemFontOfSize:15.0] forKey:@"textLabel.font"]; + [row.cellConfig setObject:UIColor.labelColor forKey:@"textLabel.textColor"]; + row.cellConfig[@"switchControl.onTintColor"] = NCBrandColor.shared.brand; + [section addFormRow:row]; + + // Auto Upload Video + + section = [XLFormSectionDescriptor formSection]; + [form addFormSection:section]; + + row = [XLFormRowDescriptor formRowDescriptorWithTag:@"autoUploadVideo" rowType:XLFormRowDescriptorTypeBooleanSwitch title:NSLocalizedString(@"_autoupload_videos_", nil)]; + row.cellConfigAtConfigure[@"backgroundColor"] = UIColor.secondarySystemGroupedBackgroundColor; + row.hidden = [NSString stringWithFormat:@"$%@==0", @"autoUpload"]; + if (activeAccount.autoUploadVideo) row.value = @1; + else row.value = @0; + [row.cellConfig setObject:[UIFont systemFontOfSize:15.0] forKey:@"textLabel.font"]; + [row.cellConfig setObject:UIColor.labelColor forKey:@"textLabel.textColor"]; + row.cellConfig[@"switchControl.onTintColor"] = NCBrandColor.shared.brand; + [section addFormRow:row]; + + row = [XLFormRowDescriptor formRowDescriptorWithTag:@"autoUploadWWAnVideo" rowType:XLFormRowDescriptorTypeBooleanSwitch title:NSLocalizedString(@"_wifi_only_", nil)]; + row.cellConfigAtConfigure[@"backgroundColor"] = UIColor.secondarySystemGroupedBackgroundColor; + row.hidden = [NSString stringWithFormat:@"$%@==0", @"autoUpload"]; + if (activeAccount.autoUploadWWAnVideo) row.value = @1; + else row.value = @0; + [row.cellConfig setObject:[UIFont systemFontOfSize:15.0] forKey:@"textLabel.font"]; + [row.cellConfig setObject:UIColor.labelColor forKey:@"textLabel.textColor"]; + row.cellConfig[@"switchControl.onTintColor"] = NCBrandColor.shared.brand; + [section addFormRow:row]; + + // Delete asset remove photo camera roll + section = [XLFormSectionDescriptor formSection]; + [form addFormSection:section]; + + row = [XLFormRowDescriptor formRowDescriptorWithTag:@"removePhotoCameraRoll" rowType:XLFormRowDescriptorTypeBooleanSwitch title:NSLocalizedString(@"_remove_photo_CameraRoll_", nil)]; + row.cellConfigAtConfigure[@"backgroundColor"] = UIColor.secondarySystemGroupedBackgroundColor; + row.hidden = [NSString stringWithFormat:@"$%@==0", @"autoUpload"]; + if ([[[NCKeychain alloc] init] removePhotoCameraRoll]) row.value = @"1"; + else row.value = @0; + [row.cellConfig setObject:[UIFont systemFontOfSize:15.0] forKey:@"textLabel.font"]; + [row.cellConfig setObject:UIColor.labelColor forKey:@"textLabel.textColor"]; + row.cellConfig[@"switchControl.onTintColor"] = NCBrandColor.shared.brand; + [section addFormRow:row]; + + // Auto Upload Full + section = [XLFormSectionDescriptor formSection]; + [form addFormSection:section]; + + NSString *title = NSLocalizedString(@"_autoupload_fullphotos_", nil); + row = [XLFormRowDescriptor formRowDescriptorWithTag:@"autoUploadFull" rowType:XLFormRowDescriptorTypeBooleanSwitch title:title]; + row.cellConfigAtConfigure[@"backgroundColor"] = UIColor.secondarySystemGroupedBackgroundColor; + row.hidden = [NSString stringWithFormat:@"$%@==0", @"autoUpload"]; + row.value = 0; + if (activeAccount.autoUploadFull) row.value = @1; + else row.value = @0; + [row.cellConfig setObject:[UIFont systemFontOfSize:15.0] forKey:@"textLabel.font"]; + [row.cellConfig setObject:UIColor.labelColor forKey:@"textLabel.textColor"]; + row.cellConfig[@"switchControl.onTintColor"] = NCBrandColor.shared.brand; + [section addFormRow:row]; + + // Auto Upload create subfolder + + section = [XLFormSectionDescriptor formSection]; + [form addFormSection:section]; + + row = [XLFormRowDescriptor formRowDescriptorWithTag:@"autoUploadCreateSubfolder" rowType:XLFormRowDescriptorTypeBooleanSwitch title:NSLocalizedString(@"_autoupload_create_subfolder_", nil)]; + row.cellConfigAtConfigure[@"backgroundColor"] = UIColor.secondarySystemGroupedBackgroundColor; + row.hidden = [NSString stringWithFormat:@"$%@==0", @"autoUpload"]; + if (activeAccount.autoUploadCreateSubfolder) row.value = @1; + else row.value = @0; + [row.cellConfig setObject:[UIFont systemFontOfSize:15.0] forKey:@"textLabel.font"]; + [row.cellConfig setObject:UIColor.labelColor forKey:@"textLabel.textColor"]; + row.cellConfig[@"switchControl.onTintColor"] = NCBrandColor.shared.brand; + [section addFormRow:row]; + + row = [XLFormRowDescriptor formRowDescriptorWithTag:@"autoUploadSubfolderGranularity" rowType:XLFormRowDescriptorTypeSelectorPush title:NSLocalizedString(@"_autoupload_subfolder_granularity_", nil)]; + row.cellConfigAtConfigure[@"backgroundColor"] = UIColor.secondarySystemGroupedBackgroundColor; + row.hidden = [NSString stringWithFormat:@"$%@==0", @"autoUpload"]; + row.cellConfigForSelector[@"tintColor"] = NCBrandColor.shared.customer; + row.selectorOptions = @[ + [XLFormOptionsObject formOptionsObjectWithValue:@(NCGlobal.shared.subfolderGranularityYearly) displayText:NSLocalizedString(@"_yearly_", nil)], + [XLFormOptionsObject formOptionsObjectWithValue:@(NCGlobal.shared.subfolderGranularityMonthly) displayText:NSLocalizedString(@"_monthly_", nil)], + [XLFormOptionsObject formOptionsObjectWithValue:@(NCGlobal.shared.subfolderGranularityDaily) displayText:NSLocalizedString(@"_daily_", nil)] + ]; + row.value = row.selectorOptions[activeAccount.autoUploadSubfolderGranularity]; + row.required = true; + [row.cellConfig setObject:[UIFont systemFontOfSize:15.0] forKey:@"textLabel.font"]; + [row.cellConfig setObject:UIColor.labelColor forKey:@"textLabel.textColor"]; + [section addFormRow:row]; + + // Auto Upload file name + + section = [XLFormSectionDescriptor formSection]; + [form addFormSection:section]; + + row = [XLFormRowDescriptor formRowDescriptorWithTag:@"autoUploadFileName" rowType:XLFormRowDescriptorTypeButton title:NSLocalizedString(@"_autoupload_filenamemask_", nil)]; + row.cellConfigAtConfigure[@"backgroundColor"] = UIColor.secondarySystemGroupedBackgroundColor; + [row.cellConfig setObject:[UIFont systemFontOfSize:15.0] forKey:@"textLabel.font"]; + [row.cellConfig setObject:UIColor.labelColor forKey:@"textLabel.textColor"]; + row.action.viewControllerClass = [NCManageAutoUploadFileName class]; + [section addFormRow:row]; + + // end + + section = [XLFormSectionDescriptor formSection]; + [form addFormSection:section]; + + self.tableView.showsVerticalScrollIndicator = NO; + self.form = form; +} + +// MARK: - View Life Cycle + +- (void)viewDidLoad +{ + [super viewDidLoad]; + + self.title = NSLocalizedString(@"_settings_autoupload_", nil); + appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate]; + self.view.backgroundColor = UIColor.systemGroupedBackgroundColor; + + self.tableView.backgroundColor = UIColor.systemGroupedBackgroundColor; + + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(changeUser) name:NCGlobal.shared.notificationCenterChangeUser object:nil]; + + [self initializeForm]; + [self reloadForm]; +} + +- (void)viewWillAppear:(BOOL)animated +{ + [super viewWillAppear:animated]; + + appDelegate.activeViewController = self; + [[[NCAskAuthorization alloc] init] askAuthorizationPhotoLibraryWithViewController:self completion:^(BOOL status) { }]; +} + +- (void)changeUser +{ + // [[self navigationController] popViewControllerAnimated:YES]; + [self initializeForm]; + [self reloadForm]; +} + +#pragma mark - NotificationCenter + + +#pragma mark - + +-(void)formRowDescriptorValueHasChanged:(XLFormRowDescriptor *)rowDescriptor oldValue:(id)oldValue newValue:(id)newValue +{ + [super formRowDescriptorValueHasChanged:rowDescriptor oldValue:oldValue newValue:newValue]; + + tableAccount *activeAccount = [[NCManageDatabase shared] getActiveAccount]; + + if ([rowDescriptor.tag isEqualToString:@"autoUpload"]) { + + if ([[rowDescriptor.value valueData] boolValue] == YES) { + + [[NCManageDatabase shared] setAccountAutoUploadProperty:@"autoUpload" state:YES]; + + // Default + [[NCManageDatabase shared] setAccountAutoUploadFileName:nil]; + [[NCManageDatabase shared] setAccountAutoUploadDirectory:nil urlBase:appDelegate.urlBase userId:appDelegate.userId account:appDelegate.account]; + + // verifichiamo che almeno uno dei servizi (foto video) siano attivi, in caso contrario attiviamo le foto + if (activeAccount.autoUploadImage == NO && activeAccount.autoUploadVideo == NO) { + [[NCManageDatabase shared] setAccountAutoUploadProperty:@"autoUploadImage" state:YES]; + [[NCManageDatabase shared] setAccountAutoUploadProperty:@"autoUploadVideo" state:YES]; + } + + [[NCAutoUpload shared] alignPhotoLibraryWithViewController:self]; + + } else { + + [[NCManageDatabase shared] setAccountAutoUploadProperty:@"autoUpload" state:NO]; + [[NCManageDatabase shared] setAccountAutoUploadProperty:@"autoUploadFull" state:NO]; + + // remove + [[NCManageDatabase shared] clearMetadatasUploadWithAccount:appDelegate.account]; + } + + [self reloadForm]; + } + + if ([rowDescriptor.tag isEqualToString:@"removePhotoCameraRoll"]) { + + [[NCKeychain alloc] init].removePhotoCameraRoll = [[rowDescriptor.value valueData] boolValue]; + } + + if ([rowDescriptor.tag isEqualToString:@"autoUploadFull"]) { + + if ([[rowDescriptor.value valueData] boolValue] == YES) { + + [[NCAutoUpload shared] autoUploadFullPhotosWithViewController:self log:@"Auto upload full"]; + [[NCManageDatabase shared] setAccountAutoUploadProperty:@"autoUploadFull" state:YES]; + + } else { + + [[NCManageDatabase shared] clearMetadatasUploadWithAccount:appDelegate.account]; + [[NCManageDatabase shared] setAccountAutoUploadProperty:@"autoUploadFull" state:NO]; + } + } + + if ([rowDescriptor.tag isEqualToString:@"autoUploadImage"]) { + + [[NCManageDatabase shared] setAccountAutoUploadProperty:@"autoUploadImage" state:[[rowDescriptor.value valueData] boolValue]]; + + if ([[rowDescriptor.value valueData] boolValue] == YES) { + [[NCAutoUpload shared] alignPhotoLibraryWithViewController:self]; + } + } + + if ([rowDescriptor.tag isEqualToString:@"autoUploadWWAnPhoto"]) { + + [[NCManageDatabase shared] setAccountAutoUploadProperty:@"autoUploadWWAnPhoto" state:[[rowDescriptor.value valueData] boolValue]]; + } + + if ([rowDescriptor.tag isEqualToString:@"autoUploadVideo"]) { + + [[NCManageDatabase shared] setAccountAutoUploadProperty:@"autoUploadVideo" state:[[rowDescriptor.value valueData] boolValue]]; + + if ([[rowDescriptor.value valueData] boolValue] == YES){ + [[NCAutoUpload shared] alignPhotoLibraryWithViewController:self]; + } + } + + if ([rowDescriptor.tag isEqualToString:@"autoUploadWWAnVideo"]) { + + [[NCManageDatabase shared] setAccountAutoUploadProperty:@"autoUploadWWAnVideo" state:[[rowDescriptor.value valueData] boolValue]]; + } + + if ([rowDescriptor.tag isEqualToString:@"autoUploadCreateSubfolder"]) { + + [[NCManageDatabase shared] setAccountAutoUploadProperty:@"autoUploadCreateSubfolder" state:[[rowDescriptor.value valueData] boolValue]]; + } + + if ([rowDescriptor.tag isEqualToString:@"autoUploadSubfolderGranularity"]) { + + [[NCManageDatabase shared] setAccountAutoUploadGranularity:@"autoUploadSubfolderGranularity" state:[[rowDescriptor.value valueData] integerValue]]; + } +} + +- (void)done:(XLFormRowDescriptor *)sender +{ + [self dismissViewControllerAnimated:YES completion:nil]; +} + +- (void)reloadForm +{ + self.form.delegate = nil; + + XLFormRowDescriptor *rowAutoUpload = [self.form formRowWithTag:@"autoUpload"]; + + XLFormRowDescriptor *rowAutoUploadImage = [self.form formRowWithTag:@"autoUploadImage"]; + XLFormRowDescriptor *rowAutoUploadWWAnPhoto = [self.form formRowWithTag:@"autoUploadWWAnPhoto"]; + + XLFormRowDescriptor *rowAutoUploadVideo = [self.form formRowWithTag:@"autoUploadVideo"]; + XLFormRowDescriptor *rowAutoUploadWWAnVideo = [self.form formRowWithTag:@"autoUploadWWAnVideo"]; + XLFormRowDescriptor *rowRemovePhotoCameraRoll = [self.form formRowWithTag:@"removePhotoCameraRoll"]; + XLFormRowDescriptor *rowAutoUploadFull = [self.form formRowWithTag:@"autoUploadFull"]; + + XLFormRowDescriptor *rowAutoUploadCreateSubfolder = [self.form formRowWithTag:@"autoUploadCreateSubfolder"]; + + XLFormRowDescriptor *rowAutoUploadSubfolderGranularity = [self.form formRowWithTag:@"autoUploadSubfolderGranularity"]; + + XLFormRowDescriptor *rowAutoUploadFileName = [self.form formRowWithTag:@"autoUploadFileName"]; + + // - STATUS --------------------- + tableAccount *activeAccount = [[NCManageDatabase shared] getActiveAccount]; + + if (activeAccount.autoUpload) + [rowAutoUpload setValue:@1]; else [rowAutoUpload setValue:@0]; + + if (activeAccount.autoUploadImage) + [rowAutoUploadImage setValue:@1]; else [rowAutoUploadImage setValue:@0]; + + if (activeAccount.autoUploadWWAnPhoto) + [rowAutoUploadWWAnPhoto setValue:@1]; else [rowAutoUploadWWAnPhoto setValue:@0]; + + if ([[[NCKeychain alloc] init] removePhotoCameraRoll]) + [rowRemovePhotoCameraRoll setValue:@1]; else [rowRemovePhotoCameraRoll setValue:@0]; + + if (activeAccount.autoUploadVideo) + [rowAutoUploadVideo setValue:@1]; else [rowAutoUploadVideo setValue:@0]; + + if (activeAccount.autoUploadWWAnVideo) + [rowAutoUploadWWAnVideo setValue:@1]; else [rowAutoUploadWWAnVideo setValue:@0]; + + if (activeAccount.autoUploadFull) + [rowAutoUploadFull setValue:@1]; else [rowAutoUploadFull setValue:@0]; + + if (activeAccount.autoUploadCreateSubfolder) + [rowAutoUploadCreateSubfolder setValue:@1]; else [rowAutoUploadCreateSubfolder setValue:@0]; + + [rowAutoUploadSubfolderGranularity setValue:rowAutoUploadSubfolderGranularity.selectorOptions[activeAccount.autoUploadSubfolderGranularity]]; + + // - HIDDEN -------------------------------------------------------------------------- + + rowAutoUploadImage.hidden = [NSString stringWithFormat:@"$%@==0", @"autoUpload"]; + rowAutoUploadWWAnPhoto.hidden = [NSString stringWithFormat:@"$%@==0", @"autoUpload"]; + + rowAutoUploadVideo.hidden = [NSString stringWithFormat:@"$%@==0", @"autoUpload"]; + rowAutoUploadWWAnVideo.hidden = [NSString stringWithFormat:@"$%@==0", @"autoUpload"]; + rowRemovePhotoCameraRoll.hidden = [NSString stringWithFormat:@"$%@==0", @"autoUpload"]; + rowAutoUploadFull.hidden = [NSString stringWithFormat:@"$%@==0", @"autoUpload"]; + + rowAutoUploadCreateSubfolder.hidden = [NSString stringWithFormat:@"$%@==0", @"autoUpload"]; + + rowAutoUploadSubfolderGranularity.hidden = [NSString stringWithFormat:@"$%@==0", @"autoUpload"]; + + rowAutoUploadFileName.hidden = [NSString stringWithFormat:@"$%@==0", @"autoUpload"]; + + // ----------------------------------------------------------------------------------- + + [self.tableView reloadData]; + + self.form.delegate = self; +} + +- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath { + return NCGlobal.shared.heightCellSettings; +} + +- (NSString *)tableView:(UITableView *)tableView titleForFooterInSection:(NSInteger)section +{ + tableAccount *activeAccount = [[NCManageDatabase shared] getActiveAccount]; + NSString *sectionName; + NSString *autoUploadPath = [NSString stringWithFormat:@"%@/%@", [[NCManageDatabase shared] getAccountAutoUploadDirectoryWithUrlBase:appDelegate.urlBase userId:appDelegate.userId account:appDelegate.account], [[NCManageDatabase shared] getAccountAutoUploadFileName]]; + + switch (section) + { + case 0: + sectionName = NSLocalizedString(@"_autoupload_description_", nil); + break; + case 1: + if (activeAccount.autoUpload) sectionName = [NSString stringWithFormat:@"%@: %@", NSLocalizedString(@"_autoupload_current_folder_", nil), [self returnPathfromServerUrl:autoUploadPath urlBase:appDelegate.urlBase userId:appDelegate.userId account:appDelegate.account]]; + else sectionName = @""; + break; + case 4: + if (activeAccount.autoUpload) sectionName = NSLocalizedString(@"_remove_photo_CameraRoll_desc_", nil); + else sectionName = @""; + break; + case 5: + if (activeAccount.autoUpload) sectionName = NSLocalizedString(@"_autoupload_description_background_", nil); + else sectionName = @""; + break; + case 6: + if (activeAccount.autoUpload) sectionName = NSLocalizedString(@"_autoupload_create_subfolder_footer_", nil); + else sectionName = @""; + break; + case 7: + if (activeAccount.autoUpload) sectionName = NSLocalizedString(@"_autoupload_filenamemask_footer_", nil); + else sectionName = @""; + break; + } + return sectionName; +} + +- (void)dismissSelectWithServerUrl:(NSString * _Nullable)serverUrl metadata:(tableMetadata * _Nullable)metadata type:(NSString * _Nonnull)type items:(NSArray * _Nonnull)items overwrite:(BOOL)overwrite copy:(BOOL)copy move:(BOOL)move +{ + if (serverUrl != nil) { + + NSString* home = [[[NCUtilityFileSystem alloc] init] getHomeServerWithUrlBase:appDelegate.urlBase userId:appDelegate.userId]; + if ([serverUrl isEqualToString:home]) { + NKError *error = [[NKError alloc] initWithErrorCode:NCGlobal.shared.errorInternalError errorDescription:@"_autoupload_error_select_folder_" responseData:nil]; + [[[NCContentPresenter alloc] init] messageNotification:@"_error_" error:error delay:[[NCGlobal shared] dismissAfterSecond] type:messageTypeError afterDelay:0]; + return; + } + + // Settings new folder Automatatic upload + [[NCManageDatabase shared] setAccountAutoUploadFileName:serverUrl.lastPathComponent]; + NSString *path = [[[NCUtilityFileSystem alloc] init] deleteLastPathWithServerUrlPath:serverUrl home:home]; + if (path != nil) { + [[NCManageDatabase shared] setAccountAutoUploadDirectory:path urlBase:appDelegate.urlBase userId:appDelegate.userId account:appDelegate.account]; + } + // Reload + [self.tableView reloadData]; + } +} + +- (void)selectAutomaticUploadFolder + { + UINavigationController *navigationController = [[UIStoryboard storyboardWithName:@"NCSelect" bundle:nil] instantiateInitialViewController]; + NCSelect *viewController = (NCSelect *)navigationController.topViewController; + + viewController.delegate = self; + viewController.typeOfCommandView = 1; + + [self presentViewController:navigationController animated:YES completion:^{ + [self.tableView reloadData]; + }]; + } + +- (NSString *)returnPathfromServerUrl:(NSString *)serverUrl urlBase:(NSString *)urlBase userId:(NSString *)userId account:(NSString *)account +{ + NSString *homeServer = [[[NCUtilityFileSystem alloc] init] getHomeServerWithUrlBase:urlBase userId:userId]; + NSString *path = [serverUrl stringByReplacingOccurrencesOfString:homeServer withString:@""]; + return path; +} + +@end diff --git a/iOSClient/Settings/NCManageAutoUploadFileName.swift b/iOSClient/Settings/NCManageAutoUploadFileName.swift new file mode 100644 index 0000000000..3f95d12119 --- /dev/null +++ b/iOSClient/Settings/NCManageAutoUploadFileName.swift @@ -0,0 +1,232 @@ +// +// NCManageAutoUploadFileName.swift +// Nextcloud +// +// Created by Marino Faggiana on 19/07/17. +// Copyright (c) 2017 Marino Faggiana. All rights reserved. +// +// Author Marino Faggiana +// +// 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 . +// + +import UIKit +import Photos +import NextcloudKit + +class NCManageAutoUploadFileName: XLFormViewController { + + let appDelegate = (UIApplication.shared.delegate as? AppDelegate)! + let dateExample = Date() + + func initializeForm() { + + let form: XLFormDescriptor = XLFormDescriptor() as XLFormDescriptor + form.rowNavigationOptions = XLFormRowNavigationOptions.stopDisableRow + + var section: XLFormSectionDescriptor + var row: XLFormRowDescriptor + + // Section Mode filename + + section = XLFormSectionDescriptor.formSection(withTitle: NSLocalizedString("_mode_filename_", comment: "")) + form.addFormSection(section) + + // Maintain the original fileName + + row = XLFormRowDescriptor(tag: "maintainOriginalFileName", rowType: XLFormRowDescriptorTypeBooleanSwitch, title: NSLocalizedString("_maintain_original_filename_", comment: "")) + row.value = NCKeychain().getOriginalFileName(key: NCGlobal.shared.keyFileNameOriginalAutoUpload) + row.cellConfig["switchControl.onTintColor"] = NCBrandColor.shared.brand; + row.cellConfig["backgroundColor"] = UIColor.secondarySystemGroupedBackground + + row.cellConfig["textLabel.font"] = UIFont.systemFont(ofSize: 15.0) + row.cellConfig["textLabel.textColor"] = UIColor.label + + section.addFormRow(row) + + // Add File Name Type + + row = XLFormRowDescriptor(tag: "addFileNameType", rowType: XLFormRowDescriptorTypeBooleanSwitch, title: NSLocalizedString("_add_filenametype_", comment: "")) + row.value = NCKeychain().getFileNameType(key: NCGlobal.shared.keyFileNameAutoUploadType) + row.hidden = "$\("maintainOriginalFileName") == 1" + row.cellConfig["backgroundColor"] = UIColor.secondarySystemGroupedBackground + row.cellConfig["switchControl.onTintColor"] = NCBrandColor.shared.brand; + + row.cellConfig["textLabel.font"] = UIFont.systemFont(ofSize: 15.0) + row.cellConfig["textLabel.textColor"] = UIColor.label + + section.addFormRow(row) + + // Section: Rename File Name + + section = XLFormSectionDescriptor.formSection(withTitle: NSLocalizedString("_filename_", comment: "")) + form.addFormSection(section) + + row = XLFormRowDescriptor(tag: "maskFileName", rowType: XLFormRowDescriptorTypeText, title: (NSLocalizedString("_filename_", comment: ""))) + + let fileNameMask: String = NCKeychain().getFileNameMask(key: NCGlobal.shared.keyFileNameAutoUploadMask) + if !fileNameMask.isEmpty { + row.cellConfig["textField.text"] = fileNameMask + row.value = fileNameMask + }else{ + let placeholderText = CCUtility.createFileName("IMG_0001.JPG", fileDate: dateExample, fileType: PHAssetMediaType.image, keyFileName: nil, keyFileNameType: NCGlobal.shared.keyFileNameAutoUploadType, keyFileNameOriginal: NCGlobal.shared.keyFileNameOriginalAutoUpload, forcedNewFileName: false) + row.cellConfig["textField.text"] = placeholderText + row.value = "" + } + row.hidden = "$\("maintainOriginalFileName") == 1" + row.cellConfig["backgroundColor"] = UIColor.secondarySystemGroupedBackground + + row.cellConfig["textLabel.font"] = UIFont.systemFont(ofSize: 15.0) + row.cellConfig["textLabel.textColor"] = UIColor.label + + row.cellConfig["textField.textAlignment"] = NSTextAlignment.left.rawValue + row.cellConfig["textField.font"] = UIFont.systemFont(ofSize: 15.0) + row.cellConfig["textField.textColor"] = UIColor.label + + section.addFormRow(row) + + // Section: Preview File Name + + row = XLFormRowDescriptor(tag: "previewFileName", rowType: XLFormRowDescriptorTypeTextView, title: "") + row.height = 180 + row.disabled = true + row.cellConfig["backgroundColor"] = UIColor.secondarySystemGroupedBackground + + row.cellConfig["textView.backgroundColor"] = UIColor.secondarySystemGroupedBackground + row.cellConfig["textView.font"] = UIFont.systemFont(ofSize: 14.0) + row.cellConfig["textView.textColor"] = UIColor.label + + section.addFormRow(row) + + self.tableView.separatorStyle = UITableViewCell.SeparatorStyle.none + self.form = form + } + + // MARK: - View Life Cycle + + override func viewDidLoad() { + super.viewDidLoad() + + self.title = NSLocalizedString("_mode_filename_", comment: "") + view.backgroundColor = .systemGroupedBackground + + tableView.backgroundColor = .systemGroupedBackground + + initializeForm() + reloadForm() + } + + override func viewDidAppear(_ animated: Bool) { + super.viewDidAppear(animated) + appDelegate.activeViewController = self + } + + // MARK: XLForm + + func reloadForm() { + + self.form.delegate = nil + + let maskFileName: XLFormRowDescriptor = self.form.formRow(withTag: "maskFileName")! + let previewFileName: XLFormRowDescriptor = self.form.formRow(withTag: "previewFileName")! + previewFileName.value = self.previewFileName(valueRename: maskFileName.value as? String) + let placeholderText = CCUtility.createFileName("IMG_0001.JPG", fileDate: dateExample, fileType: PHAssetMediaType.image, keyFileName: nil, keyFileNameType: NCGlobal.shared.keyFileNameAutoUploadType, keyFileNameOriginal: NCGlobal.shared.keyFileNameOriginalAutoUpload, forcedNewFileName: false) + let fileNameMask : String = NCKeychain().getFileNameMask(key: NCGlobal.shared.keyFileNameAutoUploadMask) + if fileNameMask.count > 0 { + maskFileName.cellConfig["textField.text"] = fileNameMask + }else { + maskFileName.cellConfig["textField.text"] = placeholderText + } + self.tableView.reloadData() + self.form.delegate = self + } + + override func formRowDescriptorValueHasChanged(_ formRow: XLFormRowDescriptor!, oldValue: Any!, newValue: Any!) { + + super.formRowDescriptorValueHasChanged(formRow, oldValue: oldValue, newValue: newValue) + + if formRow.tag == "addFileNameType" { + NCKeychain().setFileNameType(key: NCGlobal.shared.keyFileNameAutoUploadType, prefix: (formRow.value! as AnyObject).boolValue) + self.reloadForm() + } else if formRow.tag == "maintainOriginalFileName" { + NCKeychain().setOriginalFileName(key: NCGlobal.shared.keyFileNameOriginalAutoUpload, value: (formRow.value! as AnyObject).boolValue) + self.reloadForm() + } else if formRow.tag == "maskFileName" { + + let fileName = formRow.value as? String + + self.form.delegate = nil + + if let fileName = fileName { + formRow.value = NCUtility().removeForbiddenCharacters(fileName) + } + + self.form.delegate = self + + let previewFileName: XLFormRowDescriptor = self.form.formRow(withTag: "previewFileName")! + previewFileName.value = self.previewFileName(valueRename: formRow.value as? String) + + // reload cell + if fileName != nil { + + if newValue as? String != formRow.value as? String { + + self.reloadFormRow(formRow) + + let errorDescription = String(format: NSLocalizedString("_forbidden_characters_", comment: ""), NCGlobal.shared.forbiddenCharacters.joined(separator: " ")) + let error = NKError(errorCode: NCGlobal.shared.errorConflict, errorDescription: errorDescription) + NCContentPresenter().showInfo(error: error) + } + } + + self.reloadFormRow(previewFileName) + } + } + + // MARK: - Utility + + func previewFileName(valueRename: String?) -> String { + + var returnString: String = "" + + if NCKeychain().getOriginalFileName(key: NCGlobal.shared.keyFileNameOriginalAutoUpload) { + + return (NSLocalizedString("_filename_", comment: "") + ": IMG_0001.JPG") + + } else if let valueRename = valueRename { + + let valueRenameTrimming = valueRename.trimmingCharacters(in: CharacterSet.whitespacesAndNewlines) + + if valueRenameTrimming.isEmpty { + + NCKeychain().setFileNameMask(key: NCGlobal.shared.keyFileNameAutoUploadMask, mask: "") + returnString = CCUtility.createFileName("IMG_0001.JPG", fileDate: dateExample, fileType: PHAssetMediaType.image, keyFileName: nil, keyFileNameType: NCGlobal.shared.keyFileNameAutoUploadType, keyFileNameOriginal: NCGlobal.shared.keyFileNameOriginalAutoUpload, forcedNewFileName: false) + + } else { + + self.form.delegate = nil + NCKeychain().setFileNameMask(key: NCGlobal.shared.keyFileNameAutoUploadMask, mask: valueRename) + self.form.delegate = self + + returnString = CCUtility.createFileName("IMG_0001.JPG", fileDate: dateExample, fileType: PHAssetMediaType.image, keyFileName: NCGlobal.shared.keyFileNameAutoUploadMask, keyFileNameType: NCGlobal.shared.keyFileNameAutoUploadType, keyFileNameOriginal: NCGlobal.shared.keyFileNameOriginalAutoUpload, forcedNewFileName: false) + } + } else { + + NCKeychain().setFileNameMask(key: NCGlobal.shared.keyFileNameAutoUploadMask, mask: "") + returnString = CCUtility.createFileName("IMG_0001.JPG", fileDate: dateExample, fileType: PHAssetMediaType.image, keyFileName: nil, keyFileNameType: NCGlobal.shared.keyFileNameAutoUploadType, keyFileNameOriginal: NCGlobal.shared.keyFileNameOriginalAutoUpload, forcedNewFileName: false) + } + + return String(format: NSLocalizedString("_preview_filename_", comment: ""), "MM,MMM,DD,YY,YYYY and HH,hh,mm,ss,ampm") + ":" + "\n\n" + returnString + } +} From cbd5823013e07989c37ec0e4153a121dce507326 Mon Sep 17 00:00:00 2001 From: harshada-15-tsys Date: Fri, 11 Apr 2025 12:01:42 +0530 Subject: [PATCH 19/19] NMC 1931 - Auto upload customisation and unit test changes --- Nextcloud.xcodeproj/project.pbxproj | 18 +++++++++++++ iOSClient/Settings/CCManageAutoUpload.h | 28 ++++++++++++++++++++ iOSClient/Settings/CCManageAutoUpload.m | 35 ++++++++++++++++--------- 3 files changed, 68 insertions(+), 13 deletions(-) create mode 100644 iOSClient/Settings/CCManageAutoUpload.h diff --git a/Nextcloud.xcodeproj/project.pbxproj b/Nextcloud.xcodeproj/project.pbxproj index f29ee1a115..8963d3d711 100644 --- a/Nextcloud.xcodeproj/project.pbxproj +++ b/Nextcloud.xcodeproj/project.pbxproj @@ -92,6 +92,11 @@ AFCE353527E4ED5900FEA6C2 /* DateFormatter+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = AFCE353427E4ED5900FEA6C2 /* DateFormatter+Extension.swift */; }; AFCE353727E4ED7B00FEA6C2 /* NCShareCells.swift in Sources */ = {isa = PBXBuildFile; fileRef = AFCE353627E4ED7B00FEA6C2 /* NCShareCells.swift */; }; AFCE353927E5DE0500FEA6C2 /* Shareable.swift in Sources */ = {isa = PBXBuildFile; fileRef = AFCE353827E5DE0400FEA6C2 /* Shareable.swift */; }; + AFCE353927E5DE0500FEA6C2 /* NCShare+Helper.swift in Sources */ = {isa = PBXBuildFile; fileRef = AFCE353827E5DE0400FEA6C2 /* NCShare+Helper.swift */; }; + B52FAEA12DA8ED40001AB1BD /* AudioUploadTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = B52FAEA02DA8ED40001AB1BD /* AudioUploadTests.swift */; }; + B52FAEA42DA8EE60001AB1BD /* NCManageAutoUploadFileName.swift in Sources */ = {isa = PBXBuildFile; fileRef = B52FAEA32DA8EE60001AB1BD /* NCManageAutoUploadFileName.swift */; }; + B52FAEA82DA8EE99001AB1BD /* CCManageAutoUpload.m in Sources */ = {isa = PBXBuildFile; fileRef = B52FAEA72DA8EE99001AB1BD /* CCManageAutoUpload.m */; }; + C04E2F232A17BB4D001BAD85 /* FilesIntegrationTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C04E2F222A17BB4D001BAD85 /* FilesIntegrationTests.swift */; }; D575039F27146F93008DC9DC /* String+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = F7A0D1342591FBC5008F8A13 /* String+Extension.swift */; }; D5B6AA7827200C7200D49C24 /* NCActivityTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = D5B6AA7727200C7200D49C24 /* NCActivityTableViewCell.swift */; }; F310B1EF2BA862F1001C42F5 /* NCViewerMedia+VisionKit.swift in Sources */ = {isa = PBXBuildFile; fileRef = F310B1EE2BA862F1001C42F5 /* NCViewerMedia+VisionKit.swift */; }; @@ -1329,6 +1334,11 @@ AFCE353427E4ED5900FEA6C2 /* DateFormatter+Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "DateFormatter+Extension.swift"; sourceTree = ""; }; AFCE353627E4ED7B00FEA6C2 /* NCShareCells.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NCShareCells.swift; sourceTree = ""; }; AFCE353827E5DE0400FEA6C2 /* Shareable.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Shareable.swift; sourceTree = ""; }; + AFCE353827E5DE0400FEA6C2 /* NCShare+Helper.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "NCShare+Helper.swift"; sourceTree = ""; }; + B52FAEA02DA8ED40001AB1BD /* AudioUploadTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AudioUploadTests.swift; sourceTree = ""; }; + B52FAEA32DA8EE60001AB1BD /* NCManageAutoUploadFileName.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NCManageAutoUploadFileName.swift; sourceTree = ""; }; + B52FAEA62DA8EE99001AB1BD /* CCManageAutoUpload.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CCManageAutoUpload.h; sourceTree = ""; }; + B52FAEA72DA8EE99001AB1BD /* CCManageAutoUpload.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = CCManageAutoUpload.m; sourceTree = ""; }; C0046CDA2A17B98400D87C9D /* NextcloudUITests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = NextcloudUITests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; C04E2F202A17BB4D001BAD85 /* NextcloudIntegrationTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = NextcloudIntegrationTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; D5B6AA7727200C7200D49C24 /* NCActivityTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NCActivityTableViewCell.swift; sourceTree = ""; }; @@ -2117,6 +2127,8 @@ isa = PBXGroup; children = ( AA52EB452D42AC5A0089C348 /* Placeholder.swift */, + B52FAEA02DA8ED40001AB1BD /* AudioUploadTests.swift */, + AF8ED1FB2757821000B8DBC4 /* NextcloudUnitTests.swift */, ); path = NextcloudUnitTests; sourceTree = ""; @@ -2590,6 +2602,9 @@ F76882042C0DD1E7001CF441 /* Settings */ = { isa = PBXGroup; children = ( + B52FAEA62DA8EE99001AB1BD /* CCManageAutoUpload.h */, + B52FAEA72DA8EE99001AB1BD /* CCManageAutoUpload.m */, + B52FAEA32DA8EE60001AB1BD /* NCManageAutoUploadFileName.swift */, F768820B2C0DD1E7001CF441 /* Settings */, F76882162C0DD1E7001CF441 /* AutoUpload */, F389C9F32CEE381E00049762 /* SelectAlbum */, @@ -4142,6 +4157,7 @@ files = ( AA52EB472D42AC9E0089C348 /* Placeholder.swift in Sources */, F372087D2BAB4C0F006B5430 /* TestConstants.swift in Sources */, + B52FAEA12DA8ED40001AB1BD /* AudioUploadTests.swift in Sources */, F78E2D6C29AF02DB0024D4F3 /* Database.swift in Sources */, F7817CFE29801A3500FFBC65 /* Data+Extension.swift in Sources */, ); @@ -4652,6 +4668,7 @@ F700510522DF6A89003A3356 /* NCShare.swift in Sources */, F72D1007210B6882009C96B7 /* NCPushNotificationEncryption.m in Sources */, F76882362C0DD1E7001CF441 /* NCAcknowledgementsView.swift in Sources */, + B52FAEA82DA8EE99001AB1BD /* CCManageAutoUpload.m in Sources */, F785EE9D246196DF00B3F945 /* NCNetworkingE2EE.swift in Sources */, F724377B2C10B83E00C7C68D /* NCPermissions.swift in Sources */, F794E13D2BBBFF2E003693D7 /* NCMainTabBarController.swift in Sources */, @@ -4839,6 +4856,7 @@ AA8E041D2D300FDE00E7E89C /* NCShareNetworkingDelegate.swift in Sources */, F78E2D6529AF02DB0024D4F3 /* Database.swift in Sources */, F70CEF5623E9C7E50007035B /* UIColor+Extension.swift in Sources */, + B52FAEA42DA8EE60001AB1BD /* NCManageAutoUploadFileName.swift in Sources */, F76882242C0DD1E7001CF441 /* NCSettingsAdvancedView.swift in Sources */, F785129C2D7989B30087DDD0 /* NCNetworking+TermsOfService.swift in Sources */, F77C3F5B2D9BF8CD00F3C471 /* UITabBar+Extension.swift in Sources */, diff --git a/iOSClient/Settings/CCManageAutoUpload.h b/iOSClient/Settings/CCManageAutoUpload.h new file mode 100644 index 0000000000..1e6b701cfc --- /dev/null +++ b/iOSClient/Settings/CCManageAutoUpload.h @@ -0,0 +1,28 @@ +// +// CCManageAutoUpload.h +// Nextcloud +// +// Created by Marino Faggiana on 01/09/15. +// Copyright (c) 2015 Marino Faggiana. All rights reserved. +// +// Author Marino Faggiana +// +// 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 . +// + +#import + +@interface CCManageAutoUpload : XLFormViewController + +@end diff --git a/iOSClient/Settings/CCManageAutoUpload.m b/iOSClient/Settings/CCManageAutoUpload.m index a90fc3d21a..c4b06dd0b1 100644 --- a/iOSClient/Settings/CCManageAutoUpload.m +++ b/iOSClient/Settings/CCManageAutoUpload.m @@ -25,10 +25,13 @@ #import "CCManageAutoUpload.h" #import "CCUtility.h" #import "NCBridgeSwift.h" +#import "AdjustHelper.h" @interface CCManageAutoUpload () { AppDelegate *appDelegate; + AdjustHelper *adjust; + TealiumHelper *tealium; } @end @@ -40,7 +43,7 @@ - (void)initializeForm XLFormSectionDescriptor *section; XLFormRowDescriptor *row; - tableAccount *activeAccount = [[NCManageDatabase shared] getActiveAccount]; + tableAccount *activeAccount = [[NCManageDatabase shared] getActiveTableAccount]; // Auto Upload @@ -66,6 +69,7 @@ - (void)initializeForm row.cellConfigAtConfigure[@"backgroundColor"] = UIColor.secondarySystemGroupedBackgroundColor; row.hidden = [NSString stringWithFormat:@"$%@==0", @"autoUpload"]; [row.cellConfig setObject:[[UIImage imageNamed:@"foldersOnTop"] imageWithColor:NCBrandColor.shared.iconColor size:25] forKey:@"imageView.image"]; + [row.cellConfig setObject:[[UIImage imageNamed:@"foldersOnTop"] imageWithColor:UIColor.systemGrayColor size:25] forKey:@"imageView.image"]; [row.cellConfig setObject:[UIFont systemFontOfSize:15.0] forKey:@"textLabel.font"]; [row.cellConfig setObject:UIColor.labelColor forKey:@"textLabel.textColor"]; [row.cellConfig setObject:@(NSTextAlignmentLeft) forKey:@"textLabel.textAlignment"]; @@ -214,6 +218,9 @@ - (void)viewDidLoad appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate]; self.view.backgroundColor = UIColor.systemGroupedBackgroundColor; + adjust = [[AdjustHelper alloc] init]; + [adjust configAdjust]; + tealium = [[TealiumHelper alloc] init]; self.tableView.backgroundColor = UIColor.systemGroupedBackgroundColor; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(changeUser) name:NCGlobal.shared.notificationCenterChangeUser object:nil]; @@ -227,7 +234,7 @@ - (void)viewWillAppear:(BOOL)animated [super viewWillAppear:animated]; appDelegate.activeViewController = self; - [[[NCAskAuthorization alloc] init] askAuthorizationPhotoLibraryWithViewController:self completion:^(BOOL status) { }]; + [[[NCAskAuthorization alloc] init] askAuthorizationPhotoLibraryWithController:self completion:^(BOOL status) { }]; } - (void)changeUser @@ -246,7 +253,7 @@ -(void)formRowDescriptorValueHasChanged:(XLFormRowDescriptor *)rowDescriptor old { [super formRowDescriptorValueHasChanged:rowDescriptor oldValue:oldValue newValue:newValue]; - tableAccount *activeAccount = [[NCManageDatabase shared] getActiveAccount]; + tableAccount *activeAccount = [[NCManageDatabase shared] getActiveTableAccount]; if ([rowDescriptor.tag isEqualToString:@"autoUpload"]) { @@ -264,8 +271,8 @@ -(void)formRowDescriptorValueHasChanged:(XLFormRowDescriptor *)rowDescriptor old [[NCManageDatabase shared] setAccountAutoUploadProperty:@"autoUploadVideo" state:YES]; } - [[NCAutoUpload shared] alignPhotoLibraryWithViewController:self]; - + [[NCAutoUpload shared] alignPhotoLibraryWithController:self account:appDelegate.account]; + } else { [[NCManageDatabase shared] setAccountAutoUploadProperty:@"autoUpload" state:NO]; @@ -287,7 +294,7 @@ -(void)formRowDescriptorValueHasChanged:(XLFormRowDescriptor *)rowDescriptor old if ([[rowDescriptor.value valueData] boolValue] == YES) { - [[NCAutoUpload shared] autoUploadFullPhotosWithViewController:self log:@"Auto upload full"]; + [[NCAutoUpload shared] autoUploadFullPhotosWithController:self log:@"Auto upload full" account:appDelegate.account]; [[NCManageDatabase shared] setAccountAutoUploadProperty:@"autoUploadFull" state:YES]; } else { @@ -302,7 +309,7 @@ -(void)formRowDescriptorValueHasChanged:(XLFormRowDescriptor *)rowDescriptor old [[NCManageDatabase shared] setAccountAutoUploadProperty:@"autoUploadImage" state:[[rowDescriptor.value valueData] boolValue]]; if ([[rowDescriptor.value valueData] boolValue] == YES) { - [[NCAutoUpload shared] alignPhotoLibraryWithViewController:self]; + [[NCAutoUpload shared] alignPhotoLibraryWithController:self account:appDelegate.account]; } } @@ -316,7 +323,7 @@ -(void)formRowDescriptorValueHasChanged:(XLFormRowDescriptor *)rowDescriptor old [[NCManageDatabase shared] setAccountAutoUploadProperty:@"autoUploadVideo" state:[[rowDescriptor.value valueData] boolValue]]; if ([[rowDescriptor.value valueData] boolValue] == YES){ - [[NCAutoUpload shared] alignPhotoLibraryWithViewController:self]; + [[NCAutoUpload shared] alignPhotoLibraryWithController:self account:appDelegate.account]; } } @@ -353,6 +360,7 @@ - (void)reloadForm XLFormRowDescriptor *rowAutoUploadVideo = [self.form formRowWithTag:@"autoUploadVideo"]; XLFormRowDescriptor *rowAutoUploadWWAnVideo = [self.form formRowWithTag:@"autoUploadWWAnVideo"]; XLFormRowDescriptor *rowRemovePhotoCameraRoll = [self.form formRowWithTag:@"removePhotoCameraRoll"]; + XLFormRowDescriptor *rowAutoUploadFull = [self.form formRowWithTag:@"autoUploadFull"]; XLFormRowDescriptor *rowAutoUploadCreateSubfolder = [self.form formRowWithTag:@"autoUploadCreateSubfolder"]; @@ -362,7 +370,7 @@ - (void)reloadForm XLFormRowDescriptor *rowAutoUploadFileName = [self.form formRowWithTag:@"autoUploadFileName"]; // - STATUS --------------------- - tableAccount *activeAccount = [[NCManageDatabase shared] getActiveAccount]; + tableAccount *activeAccount = [[NCManageDatabase shared] getActiveTableAccount]; if (activeAccount.autoUpload) [rowAutoUpload setValue:@1]; else [rowAutoUpload setValue:@0]; @@ -398,6 +406,7 @@ - (void)reloadForm rowAutoUploadVideo.hidden = [NSString stringWithFormat:@"$%@==0", @"autoUpload"]; rowAutoUploadWWAnVideo.hidden = [NSString stringWithFormat:@"$%@==0", @"autoUpload"]; rowRemovePhotoCameraRoll.hidden = [NSString stringWithFormat:@"$%@==0", @"autoUpload"]; + rowAutoUploadFull.hidden = [NSString stringWithFormat:@"$%@==0", @"autoUpload"]; rowAutoUploadCreateSubfolder.hidden = [NSString stringWithFormat:@"$%@==0", @"autoUpload"]; @@ -419,7 +428,7 @@ - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPa - (NSString *)tableView:(UITableView *)tableView titleForFooterInSection:(NSInteger)section { - tableAccount *activeAccount = [[NCManageDatabase shared] getActiveAccount]; + tableAccount *activeAccount = [[NCManageDatabase shared] getActiveTableAccount]; NSString *sectionName; NSString *autoUploadPath = [NSString stringWithFormat:@"%@/%@", [[NCManageDatabase shared] getAccountAutoUploadDirectoryWithUrlBase:appDelegate.urlBase userId:appDelegate.userId account:appDelegate.account], [[NCManageDatabase shared] getAccountAutoUploadFileName]]; @@ -445,7 +454,7 @@ - (NSString *)tableView:(UITableView *)tableView titleForFooterInSection:(NSInte else sectionName = @""; break; case 7: - if (activeAccount.autoUpload) sectionName = NSLocalizedString(@"_autoupload_filenamemask_footer_", nil); + if (activeAccount.autoUpload) sectionName = NSLocalizedString(@"_autoupload_fullphotos_footer_", nil); else sectionName = @""; break; } @@ -458,8 +467,8 @@ - (void)dismissSelectWithServerUrl:(NSString * _Nullable)serverUrl metadata:(tab NSString* home = [[[NCUtilityFileSystem alloc] init] getHomeServerWithUrlBase:appDelegate.urlBase userId:appDelegate.userId]; if ([serverUrl isEqualToString:home]) { - NKError *error = [[NKError alloc] initWithErrorCode:NCGlobal.shared.errorInternalError errorDescription:@"_autoupload_error_select_folder_" responseData:nil]; - [[[NCContentPresenter alloc] init] messageNotification:@"_error_" error:error delay:[[NCGlobal shared] dismissAfterSecond] type:messageTypeError afterDelay:0]; +// NKError *error = [[NKError alloc] initWithErrorCode:NCGlobal.shared.errorInternalError errorDescription:@"_autoupload_error_select_folder_"];// responseData:nil]; +// [[[NCContentPresenter alloc] init] messageNotification:@"_error_" error:error delay:[[NCGlobal shared] dismissAfterSecond] type:messageTypeError afterDelay:0]; return; }