зеркало из https://github.com/nextcloud/ios.git
Swiftlint
Signed-off-by: Milen Pivchev <milen.pivchev@gmail.com>
This commit is contained in:
Родитель
fbbe644b80
Коммит
2b163536c3
214
.swiftlint.yml
214
.swiftlint.yml
|
@ -46,112 +46,112 @@ excluded:
|
|||
|
||||
# iOS Files Quarantine
|
||||
|
||||
- Brand/NCBrand.swift
|
||||
- File Provider Extension/FileProviderData.swift
|
||||
- File Provider Extension/FileProviderDomain.swift
|
||||
- File Provider Extension/FileProviderEnumerator.swift
|
||||
- File Provider Extension/FileProviderExtension+Actions.swift
|
||||
- File Provider Extension/FileProviderExtension+Thumbnail.swift
|
||||
- File Provider Extension/FileProviderExtension.swift
|
||||
- File Provider Extension/FileProviderUtility.swift
|
||||
- Notification Service Extension/NotificationService.swift
|
||||
- Widget/Widget.swift
|
||||
- Widget/Dashboard/DashboardData.swift
|
||||
- Widget/Dashboard/DashboardWidgetView.swift
|
||||
- Widget/Files/FilesData.swift
|
||||
- Widget/Files/FilesWidgetView.swift
|
||||
- Widget/Lockscreen/LockscreenData.swift
|
||||
- Widget/Lockscreen/LockscreenWidgetView.swift
|
||||
- Widget/Lockscreen/LockscreenWidgetProvider.swift
|
||||
- iOSClient/GUI
|
||||
- iOSClient/ExternalResources
|
||||
- iOSClient/Activity/NCActivity.swift
|
||||
- iOSClient/Activity/NCActivityTableViewCell.swift
|
||||
- iOSClient/AppDelegate.swift
|
||||
- iOSClient/BackgroundImageColor/NCBackgroundImageColor.swift
|
||||
- iOSClient/BrowserWeb/NCBrowserWeb.swift
|
||||
- iOSClient/Diagnostics/NCCapabilitiesViewController.swift
|
||||
- iOSClient/EmptyView/NCEmptyDataSet.swift
|
||||
- iOSClient/Extensions/UIColor+Extensions.swift
|
||||
- iOSClient/Extensions/UIImage+Extensions.swift
|
||||
- iOSClient/FileViewInFolder/NCFileViewInFolder.swift
|
||||
- iOSClient/Login/NCAppConfigView.swift
|
||||
- iOSClient/Login/NCLogin.swift
|
||||
- iOSClient/Login/NCLoginWeb.swift
|
||||
- iOSClient/Main/Account Request/NCAccountRequest.swift
|
||||
- iOSClient/Main/AudioRecorder/NCAudioRecorderViewController.swift
|
||||
- iOSClient/Main/Collection Common/NCCollectionViewCommon.swift
|
||||
- iOSClient/Main/Collection Common/NCGridCell.swift
|
||||
- iOSClient/Main/Collection Common/NCListCell.swift
|
||||
- iOSClient/Main/Create cloud/NCCreateFormUploadAssets.swift
|
||||
- iOSClient/Main/Create cloud/NCCreateFormUploadConflict.swift
|
||||
- iOSClient/Main/Create cloud/NCCreateFormUploadConflictCell.swift
|
||||
- iOSClient/Main/Create cloud/NCCreateFormUploadDocuments.swift
|
||||
- iOSClient/Main/Create cloud/NCCreateFormUploadScanDocument.swift
|
||||
- iOSClient/Main/Create cloud/NCCreateFormUploadVoiceNote.swift
|
||||
- iOSClient/Main/Create cloud/NCCreateMenuAdd.swift
|
||||
- iOSClient/Main/NCFunctionCenter.swift
|
||||
- iOSClient/Main/NCMainTabBar.swift
|
||||
- iOSClient/Main/NCPickerViewController.swift
|
||||
- iOSClient/Main/Section Header Footer/NCSectionHeaderFooter.swift
|
||||
- iOSClient/Media/Cell/NCGridMediaCell.swift
|
||||
- iOSClient/Media/NCMedia.swift
|
||||
- iOSClient/Menu/AppDelegate+Menu.swift
|
||||
- iOSClient/Menu/NCCollectionViewCommon+Menu.swift
|
||||
- iOSClient/Menu/NCLoginWeb+Menu.swift
|
||||
- iOSClient/Menu/NCMedia+Menu.swift
|
||||
- iOSClient/Menu/NCSortMenu.swift
|
||||
- iOSClient/Menu/NCViewer+Menu.swift
|
||||
- iOSClient/More/NCMore.swift
|
||||
- iOSClient/NCGlobal.swift
|
||||
- iOSClient/Networking/NCAutoUpload.swift
|
||||
- iOSClient/Networking/NCNetworking.swift
|
||||
- iOSClient/Networking/NCNetworkingCheckRemoteUser.swift
|
||||
- iOSClient/Networking/NCNetworkingChunkedUpload.swift
|
||||
- iOSClient/Networking/E2EE/NCNetworkingE2EE.swift
|
||||
- iOSClient/Networking/E2EE/NCNetworkingE2EEUpload.swift
|
||||
- iOSClient/Networking/E2EE/NCNetworkingE2EEDelete.swift
|
||||
- iOSClient/Networking/E2EE/NCNetworkingE2EERename.swift
|
||||
- iOSClient/Networking/E2EE/NCNetworkingE2EECreateFolder.swift
|
||||
- iOSClient/Networking/NCNetworkingProcessUpload.swift
|
||||
- iOSClient/Networking/NCOperationQueue.swift
|
||||
- iOSClient/Networking/NCService.swift
|
||||
- iOSClient/Networking/NCConfigServer.swift
|
||||
- iOSClient/Notification/NCNotification.swift
|
||||
- iOSClient/Recent/NCRecent.swift
|
||||
- iOSClient/Rename file/NCRenameFile.swift
|
||||
- iOSClient/RichWorkspace/NCRichWorkspaceCommon.swift
|
||||
- iOSClient/RichWorkspace/NCViewerRichWorkspace.swift
|
||||
- iOSClient/ScanDocument/ScanCollectionView.swift
|
||||
- iOSClient/Security/NCEndToEndMetadata.swift
|
||||
- iOSClient/Security/NCViewCertificateDetails.swift
|
||||
- iOSClient/Select/NCSelect.swift
|
||||
- iOSClient/Settings/NCEndToEndInitialize.swift
|
||||
- iOSClient/Settings/NCManageAutoUploadFileName.swift
|
||||
- iOSClient/Settings/NCManageE2EE.swift
|
||||
- iOSClient/Share/NCShareCommon.swift
|
||||
- iOSClient/Share/NCShareNetworking.swift
|
||||
- iOSClient/Shares/NCShares.swift
|
||||
- iOSClient/Transfers/NCTransferCell.swift
|
||||
- iOSClient/Transfers/NCTransfers.swift
|
||||
- iOSClient/UserStatus/NCUserStatus.swift
|
||||
- iOSClient/Utility/NCAskAuthorization.swift
|
||||
- iOSClient/Utility/NCContentPresenter.swift
|
||||
- iOSClient/Utility/NCLivePhoto.swift
|
||||
- iOSClient/Utility/NCPopupViewController.swift
|
||||
- iOSClient/Utility/NCStoreReview.swift
|
||||
- iOSClient/Utility/NCUtility.swift
|
||||
- iOSClient/Utility/NCUtilityFileSystem.swift
|
||||
- iOSClient/Utility/NCUtilityGUI.swift
|
||||
- iOSClient/Viewer/NCViewer.swift
|
||||
- iOSClient/Viewer/NCViewerMedia/NCPlayer/NCPlayer.swift
|
||||
- iOSClient/Viewer/NCViewerMedia/NCPlayer/NCPlayerToolBar.swift
|
||||
- iOSClient/Viewer/NCViewerMedia/NCViewerMedia.swift
|
||||
- iOSClient/Viewer/NCViewerMedia/NCViewerMediaPage.swift
|
||||
- iOSClient/Viewer/NCViewerNextcloudText/NCViewerNextcloudText.swift
|
||||
- iOSClient/Viewer/NCViewerPDF/NCViewerPDF.swift
|
||||
- iOSClient/Viewer/NCViewerPDF/NCViewerPDFSearch.swift
|
||||
- iOSClient/Viewer/NCViewerProviderContextMenu.swift
|
||||
- iOSClient/Viewer/NCViewerRichdocument/NCViewerRichdocument.swift
|
||||
# - Brand/NCBrand.swift
|
||||
# - File Provider Extension/FileProviderData.swift
|
||||
# - File Provider Extension/FileProviderDomain.swift
|
||||
# - File Provider Extension/FileProviderEnumerator.swift
|
||||
# - File Provider Extension/FileProviderExtension+Actions.swift
|
||||
# - File Provider Extension/FileProviderExtension+Thumbnail.swift
|
||||
# - File Provider Extension/FileProviderExtension.swift
|
||||
# - File Provider Extension/FileProviderUtility.swift
|
||||
# - Notification Service Extension/NotificationService.swift
|
||||
# - Widget/Widget.swift
|
||||
# - Widget/Dashboard/DashboardData.swift
|
||||
# - Widget/Dashboard/DashboardWidgetView.swift
|
||||
# - Widget/Files/FilesData.swift
|
||||
# - Widget/Files/FilesWidgetView.swift
|
||||
# - Widget/Lockscreen/LockscreenData.swift
|
||||
# - Widget/Lockscreen/LockscreenWidgetView.swift
|
||||
# - Widget/Lockscreen/LockscreenWidgetProvider.swift
|
||||
# - iOSClient/GUI
|
||||
# - iOSClient/ExternalResources
|
||||
# - iOSClient/Activity/NCActivity.swift
|
||||
# - iOSClient/Activity/NCActivityTableViewCell.swift
|
||||
# - iOSClient/AppDelegate.swift
|
||||
# - iOSClient/BackgroundImageColor/NCBackgroundImageColor.swift
|
||||
# - iOSClient/BrowserWeb/NCBrowserWeb.swift
|
||||
# - iOSClient/Diagnostics/NCCapabilitiesViewController.swift
|
||||
# - iOSClient/EmptyView/NCEmptyDataSet.swift
|
||||
# - iOSClient/Extensions/UIColor+Extensions.swift
|
||||
# - iOSClient/Extensions/UIImage+Extensions.swift
|
||||
# - iOSClient/FileViewInFolder/NCFileViewInFolder.swift
|
||||
# - iOSClient/Login/NCAppConfigView.swift
|
||||
# - iOSClient/Login/NCLogin.swift
|
||||
# - iOSClient/Login/NCLoginWeb.swift
|
||||
# - iOSClient/Main/Account Request/NCAccountRequest.swift
|
||||
# - iOSClient/Main/AudioRecorder/NCAudioRecorderViewController.swift
|
||||
# - iOSClient/Main/Collection Common/NCCollectionViewCommon.swift
|
||||
# - iOSClient/Main/Collection Common/NCGridCell.swift
|
||||
# - iOSClient/Main/Collection Common/NCListCell.swift
|
||||
# - iOSClient/Main/Create cloud/NCCreateFormUploadAssets.swift
|
||||
# - iOSClient/Main/Create cloud/NCCreateFormUploadConflict.swift
|
||||
# - iOSClient/Main/Create cloud/NCCreateFormUploadConflictCell.swift
|
||||
# - iOSClient/Main/Create cloud/NCCreateFormUploadDocuments.swift
|
||||
# - iOSClient/Main/Create cloud/NCCreateFormUploadScanDocument.swift
|
||||
# - iOSClient/Main/Create cloud/NCCreateFormUploadVoiceNote.swift
|
||||
# - iOSClient/Main/Create cloud/NCCreateMenuAdd.swift
|
||||
# - iOSClient/Main/NCFunctionCenter.swift
|
||||
# - iOSClient/Main/NCMainTabBar.swift
|
||||
# - iOSClient/Main/NCPickerViewController.swift
|
||||
# - iOSClient/Main/Section Header Footer/NCSectionHeaderFooter.swift
|
||||
# - iOSClient/Media/Cell/NCGridMediaCell.swift
|
||||
# - iOSClient/Media/NCMedia.swift
|
||||
# - iOSClient/Menu/AppDelegate+Menu.swift
|
||||
# - iOSClient/Menu/NCCollectionViewCommon+Menu.swift
|
||||
# - iOSClient/Menu/NCLoginWeb+Menu.swift
|
||||
# - iOSClient/Menu/NCMedia+Menu.swift
|
||||
# - iOSClient/Menu/NCSortMenu.swift
|
||||
# - iOSClient/Menu/NCViewer+Menu.swift
|
||||
# - iOSClient/More/NCMore.swift
|
||||
# - iOSClient/NCGlobal.swift
|
||||
# - iOSClient/Networking/NCAutoUpload.swift
|
||||
# - iOSClient/Networking/NCNetworking.swift
|
||||
# - iOSClient/Networking/NCNetworkingCheckRemoteUser.swift
|
||||
# - iOSClient/Networking/NCNetworkingChunkedUpload.swift
|
||||
# - iOSClient/Networking/E2EE/NCNetworkingE2EE.swift
|
||||
# - iOSClient/Networking/E2EE/NCNetworkingE2EEUpload.swift
|
||||
# - iOSClient/Networking/E2EE/NCNetworkingE2EEDelete.swift
|
||||
# - iOSClient/Networking/E2EE/NCNetworkingE2EERename.swift
|
||||
# - iOSClient/Networking/E2EE/NCNetworkingE2EECreateFolder.swift
|
||||
# - iOSClient/Networking/NCNetworkingProcessUpload.swift
|
||||
# - iOSClient/Networking/NCOperationQueue.swift
|
||||
# - iOSClient/Networking/NCService.swift
|
||||
# - iOSClient/Networking/NCConfigServer.swift
|
||||
# - iOSClient/Notification/NCNotification.swift
|
||||
# - iOSClient/Recent/NCRecent.swift
|
||||
# - iOSClient/Rename file/NCRenameFile.swift
|
||||
# - iOSClient/RichWorkspace/NCRichWorkspaceCommon.swift
|
||||
# - iOSClient/RichWorkspace/NCViewerRichWorkspace.swift
|
||||
# - iOSClient/ScanDocument/ScanCollectionView.swift
|
||||
# - iOSClient/Security/NCEndToEndMetadata.swift
|
||||
# - iOSClient/Security/NCViewCertificateDetails.swift
|
||||
# - iOSClient/Select/NCSelect.swift
|
||||
# - iOSClient/Settings/NCEndToEndInitialize.swift
|
||||
# - iOSClient/Settings/NCManageAutoUploadFileName.swift
|
||||
# - iOSClient/Settings/NCManageE2EE.swift
|
||||
# - iOSClient/Share/NCShareCommon.swift
|
||||
# - iOSClient/Share/NCShareNetworking.swift
|
||||
# - iOSClient/Shares/NCShares.swift
|
||||
# - iOSClient/Transfers/NCTransferCell.swift
|
||||
# - iOSClient/Transfers/NCTransfers.swift
|
||||
# - iOSClient/UserStatus/NCUserStatus.swift
|
||||
# - iOSClient/Utility/NCAskAuthorization.swift
|
||||
# - iOSClient/Utility/NCContentPresenter.swift
|
||||
# - iOSClient/Utility/NCLivePhoto.swift
|
||||
# - iOSClient/Utility/NCPopupViewController.swift
|
||||
# - iOSClient/Utility/NCStoreReview.swift
|
||||
# - iOSClient/Utility/NCUtility.swift
|
||||
# - iOSClient/Utility/NCUtilityFileSystem.swift
|
||||
# - iOSClient/Utility/NCUtilityGUI.swift
|
||||
# - iOSClient/Viewer/NCViewer.swift
|
||||
# - iOSClient/Viewer/NCViewerMedia/NCPlayer/NCPlayer.swift
|
||||
# - iOSClient/Viewer/NCViewerMedia/NCPlayer/NCPlayerToolBar.swift
|
||||
# - iOSClient/Viewer/NCViewerMedia/NCViewerMedia.swift
|
||||
# - iOSClient/Viewer/NCViewerMedia/NCViewerMediaPage.swift
|
||||
# - iOSClient/Viewer/NCViewerNextcloudText/NCViewerNextcloudText.swift
|
||||
# - iOSClient/Viewer/NCViewerPDF/NCViewerPDF.swift
|
||||
# - iOSClient/Viewer/NCViewerPDF/NCViewerPDFSearch.swift
|
||||
# - iOSClient/Viewer/NCViewerProviderContextMenu.swift
|
||||
# - iOSClient/Viewer/NCViewerRichdocument/NCViewerRichdocument.swift
|
||||
|
||||
reporter: "xcode"
|
||||
|
|
|
@ -58,30 +58,30 @@ import UIKit
|
|||
@objc public var userAgent: String = "Nextcloud-iOS" // Don't touch me !!
|
||||
|
||||
// BRAND ONLY
|
||||
@objc public var use_login_web_personalized: Bool = false // Don't touch me !!
|
||||
@objc public var use_AppConfig: Bool = false // Don't touch me !!
|
||||
@objc public var use_GroupApps: Bool = true // Don't touch me !!
|
||||
@objc public var use_login_web_personalized: Bool = false // Don't touch me !!
|
||||
@objc public var use_AppConfig: Bool = false // Don't touch me !!
|
||||
@objc public var use_GroupApps: Bool = true // Don't touch me !!
|
||||
|
||||
// Options
|
||||
@objc public var use_default_auto_upload: Bool = false
|
||||
@objc public var use_themingColor: Bool = true
|
||||
@objc public var use_themingLogo: Bool = false
|
||||
@objc public var use_storeLocalAutoUploadAll: Bool = false
|
||||
@objc public var use_loginflowv2: Bool = false // Don't touch me !!
|
||||
@objc public var use_default_auto_upload: Bool = false
|
||||
@objc public var use_themingColor: Bool = true
|
||||
@objc public var use_themingLogo: Bool = false
|
||||
@objc public var use_storeLocalAutoUploadAll: Bool = false
|
||||
@objc public var use_loginflowv2: Bool = false // Don't touch me !!
|
||||
|
||||
@objc public var disable_intro: Bool = false
|
||||
@objc public var disable_request_login_url: Bool = false
|
||||
@objc public var disable_multiaccount: Bool = false
|
||||
@objc public var disable_manage_account: Bool = false
|
||||
@objc public var disable_more_external_site: Bool = false
|
||||
@objc public var disable_openin_file: Bool = false // Don't touch me !!
|
||||
@objc public var disable_crash_service: Bool = false
|
||||
@objc public var disable_log: Bool = false
|
||||
@objc public var disable_mobileconfig: Bool = false
|
||||
@objc public var disable_intro: Bool = false
|
||||
@objc public var disable_request_login_url: Bool = false
|
||||
@objc public var disable_multiaccount: Bool = false
|
||||
@objc public var disable_manage_account: Bool = false
|
||||
@objc public var disable_more_external_site: Bool = false
|
||||
@objc public var disable_openin_file: Bool = false // Don't touch me !!
|
||||
@objc public var disable_crash_service: Bool = false
|
||||
@objc public var disable_log: Bool = false
|
||||
@objc public var disable_mobileconfig: Bool = false
|
||||
@objc public var disable_show_more_nextcloud_apps_in_settings: Bool = false
|
||||
|
||||
// Internal option behaviour
|
||||
@objc public var cleanUpDay: Int = 0 // Set default "Delete, in the cache, all files older than" possible days value are: 0, 1, 7, 30, 90, 180, 365
|
||||
@objc public var cleanUpDay: Int = 0 // Set default "Delete, in the cache, all files older than" possible days value are: 0, 1, 7, 30, 90, 180, 365
|
||||
|
||||
// Info Paging
|
||||
enum NCInfoPagingTab: Int, CaseIterable {
|
||||
|
@ -93,10 +93,10 @@ import UIKit
|
|||
if folderBrandAutoUpload != "" {
|
||||
folderDefaultAutoUpload = folderBrandAutoUpload
|
||||
}
|
||||
|
||||
|
||||
// wrapper AppConfig
|
||||
if let configurationManaged = UserDefaults.standard.dictionary(forKey: "com.apple.configuration.managed"), use_AppConfig {
|
||||
|
||||
|
||||
if let str = configurationManaged[NCGlobal.shared.configuration_brand] as? String {
|
||||
brand = str
|
||||
}
|
||||
|
@ -173,15 +173,15 @@ class NCBrandColor: NSObject {
|
|||
}
|
||||
|
||||
// Color
|
||||
@objc public let customer: UIColor = UIColor(red: 0.0/255.0, green: 130.0/255.0, blue: 201.0/255.0, alpha: 1.0) // BLU NC : #0082c9
|
||||
@objc public let customer: UIColor = UIColor(red: 0.0 / 255.0, green: 130.0 / 255.0, blue: 201.0 / 255.0, alpha: 1.0) // BLU NC : #0082c9
|
||||
@objc public var customerText: UIColor = .white
|
||||
|
||||
@objc public var brand: UIColor // don't touch me
|
||||
@objc public var brandElement: UIColor // don't touch me
|
||||
@objc public var brandText: UIColor // don't touch me
|
||||
|
||||
@objc public let nextcloud: UIColor = UIColor(red: 0.0/255.0, green: 130.0/255.0, blue: 201.0/255.0, alpha: 1.0)
|
||||
@objc public let yellowFavorite: UIColor = UIColor(red: 248.0/255.0, green: 205.0/255.0, blue: 70.0/255.0, alpha: 1.0)
|
||||
@objc public let nextcloud: UIColor = UIColor(red: 0.0 / 255.0, green: 130.0 / 255.0, blue: 201.0 / 255.0, alpha: 1.0)
|
||||
@objc public let yellowFavorite: UIColor = UIColor(red: 248.0 / 255.0, green: 205.0 / 255.0, blue: 70.0 / 255.0, alpha: 1.0)
|
||||
|
||||
public var userColors: [CGColor] = []
|
||||
public var themingColor: String = ""
|
||||
|
@ -225,7 +225,7 @@ class NCBrandColor: NSObject {
|
|||
cacheImages.folderGroup = UIImage(named: "folder_group")!.image(color: brandElement, size: folderWidth)
|
||||
cacheImages.folderExternal = UIImage(named: "folder_external")!.image(color: brandElement, size: folderWidth)
|
||||
cacheImages.folderAutomaticUpload = UIImage(named: "folderAutomaticUpload")!.image(color: brandElement, size: folderWidth)
|
||||
cacheImages.folder = UIImage(named: "folder")!.image(color: brandElement, size: folderWidth)
|
||||
cacheImages.folder = UIImage(named: "folder")!.image(color: brandElement, size: folderWidth)
|
||||
|
||||
cacheImages.checkedYes = NCUtility.shared.loadImage(named: "checkmark.circle.fill", color: .systemBlue)
|
||||
cacheImages.checkedNo = NCUtility.shared.loadImage(named: "circle", color: .systemGray)
|
||||
|
@ -316,7 +316,7 @@ class NCBrandColor: NSObject {
|
|||
brand = customer
|
||||
brandText = customerText
|
||||
}
|
||||
|
||||
|
||||
createImagesThemingColor()
|
||||
#if !EXTENSION
|
||||
NotificationCenter.default.postOnMainThread(name: NCGlobal.shared.notificationCenterChangeTheming)
|
||||
|
@ -353,9 +353,9 @@ class NCBrandColor: NSObject {
|
|||
3 colors \* 6 will result in 18 generated colors
|
||||
*/
|
||||
func generateColors(steps: Int = 6) -> [CGColor] {
|
||||
let red = UIColor(red: 182/255, green: 70/255, blue: 157/255, alpha: 1).cgColor
|
||||
let yellow = UIColor(red: 221/255, green: 203/255, blue: 85/255, alpha: 1).cgColor
|
||||
let blue = UIColor(red: 0/255, green: 130/255, blue: 201/255, alpha: 1).cgColor
|
||||
let red = UIColor(red: 182 / 255, green: 70 / 255, blue: 157 / 255, alpha: 1).cgColor
|
||||
let yellow = UIColor(red: 221 / 255, green: 203 / 255, blue: 85 / 255, alpha: 1).cgColor
|
||||
let blue = UIColor(red: 0 / 255, green: 130 / 255, blue: 201 / 255, alpha: 1).cgColor
|
||||
|
||||
let palette1 = mixPalette(steps: steps, color1: red, color2: yellow)
|
||||
let palette2 = mixPalette(steps: steps, color1: yellow, color2: blue)
|
||||
|
|
|
@ -43,7 +43,7 @@ class FileProviderDomain: NSObject {
|
|||
for account in accounts {
|
||||
guard let urlBase = NSURL(string: account.urlBase) else { continue }
|
||||
guard let host = urlBase.host else { continue }
|
||||
let accountDomain = account.userId + " (" + host + ")"
|
||||
let accountDomain = account.userId + " (" + host + ")"
|
||||
if domain == accountDomain {
|
||||
domainFound = true
|
||||
break
|
||||
|
@ -64,7 +64,7 @@ class FileProviderDomain: NSObject {
|
|||
var domainFound = false
|
||||
guard let urlBase = NSURL(string: account.urlBase) else { continue }
|
||||
guard let host = urlBase.host else { continue }
|
||||
let accountDomain = account.userId + " (" + host + ")"
|
||||
let accountDomain = account.userId + " (" + host + ")"
|
||||
for domain in domains {
|
||||
if domain == accountDomain {
|
||||
domainFound = true
|
||||
|
|
|
@ -37,11 +37,11 @@ extension FileProviderExtension {
|
|||
let directoryName = NCUtilityFileSystem.shared.createFileName(directoryName, serverUrl: tableDirectory.serverUrl, account: fileProviderData.shared.account)
|
||||
let serverUrlFileName = tableDirectory.serverUrl + "/" + directoryName
|
||||
|
||||
NextcloudKit.shared.createFolder(serverUrlFileName: serverUrlFileName) { account, ocId, _, error in
|
||||
NextcloudKit.shared.createFolder(serverUrlFileName: serverUrlFileName) { _, ocId, _, error in
|
||||
|
||||
if error == .success {
|
||||
|
||||
NextcloudKit.shared.readFileOrFolder(serverUrlFileName: serverUrlFileName, depth: "0", showHiddenFiles: CCUtility.getShowHiddenFiles()) { account, files, _, error in
|
||||
NextcloudKit.shared.readFileOrFolder(serverUrlFileName: serverUrlFileName, depth: "0", showHiddenFiles: CCUtility.getShowHiddenFiles()) { _, files, _, error in
|
||||
|
||||
if error == .success && files.count > 0 {
|
||||
|
||||
|
|
|
@ -79,9 +79,9 @@ class FileProviderExtension: NSFileProviderExtension, NCNetworkingDelegate {
|
|||
if fileProviderData.shared.setupAccount(domain: domain, providerExtension: self) == nil {
|
||||
throw NSError(domain: NSFileProviderErrorDomain, code: NSFileProviderError.notAuthenticated.rawValue, userInfo: [:])
|
||||
} else if let passcode = CCUtility.getPasscode(), !passcode.isEmpty, CCUtility.isPasscodeAtStartEnabled() {
|
||||
throw NSError(domain: NSFileProviderErrorDomain, code: NSFileProviderError.notAuthenticated.rawValue, userInfo: ["code" : NSNumber(value: NCGlobal.shared.errorUnauthorizedFilesPasscode)])
|
||||
throw NSError(domain: NSFileProviderErrorDomain, code: NSFileProviderError.notAuthenticated.rawValue, userInfo: ["code": NSNumber(value: NCGlobal.shared.errorUnauthorizedFilesPasscode)])
|
||||
} else if CCUtility.getDisableFilesApp() || NCBrandOptions.shared.disable_openin_file {
|
||||
throw NSError(domain: NSFileProviderErrorDomain, code: NSFileProviderError.notAuthenticated.rawValue, userInfo: ["code" : NSNumber(value: NCGlobal.shared.errorDisableFilesApp)])
|
||||
throw NSError(domain: NSFileProviderErrorDomain, code: NSFileProviderError.notAuthenticated.rawValue, userInfo: ["code": NSNumber(value: NCGlobal.shared.errorDisableFilesApp)])
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -46,7 +46,7 @@ class NotificationService: UNNotificationServiceExtension {
|
|||
if var json = try JSONSerialization.jsonObject(with: data) as? [String: AnyObject],
|
||||
let subject = json["subject"] as? String {
|
||||
bestAttemptContent.body = subject
|
||||
if let pref = UserDefaults.init(suiteName: NCBrandOptions.shared.capabilitiesGroups) {
|
||||
if let pref = UserDefaults(suiteName: NCBrandOptions.shared.capabilitiesGroups) {
|
||||
json["account"] = tableAccount.account as AnyObject
|
||||
pref.set(json, forKey: "NOTIFICATION_DATA")
|
||||
pref.synchronize()
|
||||
|
@ -65,7 +65,7 @@ class NotificationService: UNNotificationServiceExtension {
|
|||
override func serviceExtensionTimeWillExpire() {
|
||||
// Called just before the extension will be terminated by the system.
|
||||
// Use this as an opportunity to deliver your "best attempt" at modified content, otherwise the original push payload will be used.
|
||||
if let contentHandler = contentHandler, let bestAttemptContent = bestAttemptContent {
|
||||
if let contentHandler = contentHandler, let bestAttemptContent = bestAttemptContent {
|
||||
bestAttemptContent.title = ""
|
||||
bestAttemptContent.body = "Nextcloud notification"
|
||||
contentHandler(bestAttemptContent)
|
||||
|
|
|
@ -71,7 +71,7 @@ let dashboardDatasTest: [DashboardData] = [
|
|||
]
|
||||
|
||||
func getDashboardItems(displaySize: CGSize, withButton: Bool) -> Int {
|
||||
|
||||
|
||||
if withButton {
|
||||
let height = Int((displaySize.height - 85) / 50)
|
||||
return height
|
||||
|
@ -81,7 +81,7 @@ func getDashboardItems(displaySize: CGSize, withButton: Bool) -> Int {
|
|||
}
|
||||
}
|
||||
|
||||
func convertDataToImage(data: Data?, size:CGSize, fileNameToWrite: String?) -> UIImage? {
|
||||
func convertDataToImage(data: Data?, size: CGSize, fileNameToWrite: String?) -> UIImage? {
|
||||
|
||||
guard let data = data else { return nil }
|
||||
var imageData: UIImage?
|
||||
|
@ -134,7 +134,7 @@ func getDashboardDataEntry(configuration: DashboardIntent?, isPreview: Bool, dis
|
|||
guard NCGlobal.shared.capabilityServerVersionMajor >= NCGlobal.shared.nextcloudVersion25 else {
|
||||
return completion(DashboardDataEntry(date: Date(), datas: datasPlaceholder, dashboard: nil, buttons: nil, isPlaceholder: true, isEmpty: false, titleImage: UIImage(named: "widget")!, title: "Dashboard", footerImage: "xmark.icloud", footerText: NSLocalizedString("_widget_available_nc25_", comment: "")))
|
||||
}
|
||||
|
||||
|
||||
// NETWORKING
|
||||
let password = CCUtility.getPassword(account.account)!
|
||||
NextcloudKit.shared.setup(
|
||||
|
@ -161,7 +161,7 @@ func getDashboardDataEntry(configuration: DashboardIntent?, isPreview: Bool, dis
|
|||
} else {
|
||||
NextcloudKit.shared.nkCommonInstance.writeLog("[INFO] Start \(NCBrandOptions.shared.brand) dashboard widget session with level \(levelLog) " + versionNextcloudiOS)
|
||||
}
|
||||
|
||||
|
||||
let (tableDashboard, tableButton) = NCManageDatabase.shared.getDashboardWidget(account: account.account, id: id)
|
||||
let existsButton = (tableButton?.isEmpty ?? true) ? false : true
|
||||
let title = tableDashboard?.title ?? id
|
||||
|
@ -215,7 +215,7 @@ func getDashboardDataEntry(configuration: DashboardIntent?, isPreview: Bool, dis
|
|||
if let item = CCUtility.value(forKey: "fileId", fromQueryItems: queryItems) {
|
||||
iconFileName = item
|
||||
} else if pathComponents.contains("avatar") {
|
||||
iconFileName = pathComponents[pathComponents.count-2]
|
||||
iconFileName = pathComponents[pathComponents.count - 2]
|
||||
imageAvatar = true
|
||||
} else if pathComponents.contains("getCalendarDotSvg") {
|
||||
imageColorized = true
|
||||
|
@ -257,7 +257,7 @@ func getDashboardDataEntry(configuration: DashboardIntent?, isPreview: Bool, dis
|
|||
}
|
||||
|
||||
let alias = (account.alias.isEmpty) ? "" : (" (" + account.alias + ")")
|
||||
let footerText = "Dashboard " + NSLocalizedString("_of_", comment: "") + " " + account.displayName + alias
|
||||
let footerText = "Dashboard " + NSLocalizedString("_of_", comment: "") + " " + account.displayName + alias
|
||||
|
||||
if error != .success {
|
||||
completion(DashboardDataEntry(date: Date(), datas: datasPlaceholder, dashboard: tableDashboard, buttons: buttons, isPlaceholder: true, isEmpty: false, titleImage: titleImage, title: title, footerImage: "xmark.icloud", footerText: error.errorDescription))
|
||||
|
|
|
@ -27,9 +27,9 @@ import WidgetKit
|
|||
struct DashboardWidgetView: View {
|
||||
|
||||
var entry: DashboardDataEntry
|
||||
|
||||
|
||||
var body: some View {
|
||||
|
||||
|
||||
GeometryReader { geo in
|
||||
|
||||
if entry.isEmpty {
|
||||
|
@ -49,14 +49,14 @@ struct DashboardWidgetView: View {
|
|||
|
||||
ZStack(alignment: .topLeading) {
|
||||
|
||||
HStack() {
|
||||
HStack {
|
||||
|
||||
Image(uiImage: entry.titleImage)
|
||||
.renderingMode(.template)
|
||||
.resizable()
|
||||
.scaledToFill()
|
||||
.frame(width: 20, height: 20)
|
||||
|
||||
|
||||
Text(entry.title)
|
||||
.font(.system(size: 15))
|
||||
.fontWeight(.bold)
|
||||
|
@ -160,8 +160,8 @@ struct DashboardWidgetView: View {
|
|||
let brandTextColor = Color(NCBrandColor.shared.brandText)
|
||||
|
||||
ForEach(buttons, id: \.index) { element in
|
||||
Link(destination: URL(string: element.link)! , label: {
|
||||
|
||||
Link(destination: URL(string: element.link)!, label: {
|
||||
|
||||
Text(element.text)
|
||||
.font(.system(size: 15))
|
||||
.padding(7)
|
||||
|
@ -174,7 +174,7 @@ struct DashboardWidgetView: View {
|
|||
}
|
||||
.frame(width: geo.size.width - 10, height: geo.size.height - 25, alignment: .bottomTrailing)
|
||||
}
|
||||
|
||||
|
||||
HStack {
|
||||
|
||||
Image(systemName: entry.footerImage)
|
||||
|
|
|
@ -79,7 +79,7 @@ func getTitleFilesWidget(account: tableAccount?) -> String {
|
|||
}
|
||||
|
||||
func getFilesItems(displaySize: CGSize) -> Int {
|
||||
|
||||
|
||||
let height = Int((displaySize.height - 100) / 50)
|
||||
return height
|
||||
}
|
||||
|
@ -205,7 +205,7 @@ func getFilesDataEntry(configuration: AccountIntent?, isPreview: Bool, displaySi
|
|||
} else {
|
||||
NextcloudKit.shared.nkCommonInstance.writeLog("[INFO] Start \(NCBrandOptions.shared.brand) widget session with level \(levelLog) " + versionNextcloudiOS)
|
||||
}
|
||||
|
||||
|
||||
let options = NKRequestOptions(timeout: 90, queue: NextcloudKit.shared.nkCommonInstance.backgroundQueue)
|
||||
NextcloudKit.shared.searchBodyRequest(serverUrl: account.urlBase, requestBody: requestBody, showHiddenFiles: CCUtility.getShowHiddenFiles(), options: options) { _, files, data, error in
|
||||
Task {
|
||||
|
@ -249,13 +249,13 @@ func getFilesDataEntry(configuration: AccountIntent?, isPreview: Bool, displaySi
|
|||
let metadata = NCManageDatabase.shared.convertFileToMetadata(file, isDirectoryE2EE: isDirectoryE2EE)
|
||||
|
||||
// DATA
|
||||
let data = FilesData.init(id: metadata.ocId, image: imageRecent, title: metadata.fileNameView, subTitle: subTitle, url: url)
|
||||
let data = FilesData(id: metadata.ocId, image: imageRecent, title: metadata.fileNameView, subTitle: subTitle, url: url)
|
||||
datas.append(data)
|
||||
if datas.count == filesItems { break}
|
||||
}
|
||||
|
||||
let alias = (account.alias.isEmpty) ? "" : (" (" + account.alias + ")")
|
||||
let footerText = "Files " + NSLocalizedString("_of_", comment: "") + " " + account.displayName + alias
|
||||
let footerText = "Files " + NSLocalizedString("_of_", comment: "") + " " + account.displayName + alias
|
||||
|
||||
if error != .success {
|
||||
completion(FilesDataEntry(date: Date(), datas: datasPlaceholder, isPlaceholder: true, isEmpty: false, userId: account.userId, url: account.urlBase, tile: title, footerImage: "xmark.icloud", footerText: error.errorDescription))
|
||||
|
|
|
@ -25,7 +25,7 @@ import SwiftUI
|
|||
import WidgetKit
|
||||
|
||||
struct FilesWidgetView: View {
|
||||
|
||||
|
||||
var entry: FilesDataEntry
|
||||
|
||||
var body: some View {
|
||||
|
@ -55,9 +55,9 @@ struct FilesWidgetView: View {
|
|||
}
|
||||
|
||||
ZStack(alignment: .topLeading) {
|
||||
|
||||
HStack() {
|
||||
|
||||
|
||||
HStack {
|
||||
|
||||
Text(entry.tile)
|
||||
.font(.system(size: 12))
|
||||
.fontWeight(.bold)
|
||||
|
@ -172,7 +172,7 @@ struct FilesWidgetView: View {
|
|||
.scaledToFit()
|
||||
.frame(width: 15, height: 15)
|
||||
.foregroundColor(entry.isPlaceholder ? Color(.systemGray4) : Color(NCBrandColor.shared.brand))
|
||||
|
||||
|
||||
Text(entry.footerText)
|
||||
.font(.caption2)
|
||||
.lineLimit(1)
|
||||
|
|
|
@ -172,7 +172,7 @@ extension NCActivity: UITableViewDelegate {
|
|||
label.textAlignment = .center
|
||||
label.layer.cornerRadius = 11
|
||||
label.layer.masksToBounds = true
|
||||
label.layer.backgroundColor = UIColor(red: 152.0/255.0, green: 167.0/255.0, blue: 181.0/255.0, alpha: 0.8).cgColor
|
||||
label.layer.backgroundColor = UIColor(red: 152.0 / 255.0, green: 167.0 / 255.0, blue: 181.0 / 255.0, alpha: 0.8).cgColor
|
||||
let widthFrame = label.intrinsicContentSize.width + 30
|
||||
let xFrame = tableView.bounds.width / 2 - widthFrame / 2
|
||||
label.frame = CGRect(x: xFrame, y: 10, width: widthFrame, height: 22)
|
||||
|
@ -408,7 +408,7 @@ extension NCActivity {
|
|||
guard showComments, let metadata = metadata else { return }
|
||||
disptachGroup?.enter()
|
||||
|
||||
NextcloudKit.shared.getComments(fileId: metadata.fileId) { account, comments, data, error in
|
||||
NextcloudKit.shared.getComments(fileId: metadata.fileId) { _, comments, _, error in
|
||||
if error == .success, let comments = comments {
|
||||
NCManageDatabase.shared.addComments(comments, account: metadata.account, objectId: metadata.fileId)
|
||||
} else if error.errorCode != NCGlobal.shared.errorResourceNotFound {
|
||||
|
@ -437,7 +437,7 @@ extension NCActivity {
|
|||
limit: 1,
|
||||
objectId: nil,
|
||||
objectType: objectType,
|
||||
previews: true) { account, _, activityFirstKnown, activityLastGiven, data, error in
|
||||
previews: true) { account, _, activityFirstKnown, activityLastGiven, _, error in
|
||||
defer { disptachGroup.leave() }
|
||||
|
||||
let largestActivityId = max(activityFirstKnown, activityLastGiven)
|
||||
|
@ -464,7 +464,7 @@ extension NCActivity {
|
|||
limit: min(limit, 200),
|
||||
objectId: metadata?.fileId,
|
||||
objectType: objectType,
|
||||
previews: true) { account, activities, activityFirstKnown, activityLastGiven, data, error in
|
||||
previews: true) { account, activities, activityFirstKnown, activityLastGiven, _, error in
|
||||
defer { disptachGroup.leave() }
|
||||
guard error == .success,
|
||||
account == self.appDelegate.account,
|
||||
|
|
|
@ -188,7 +188,7 @@ extension NCActivityTableViewCell: UICollectionViewDataSource {
|
|||
if let activitySubjectRich = NCManageDatabase.shared.getActivitySubjectRich(account: activityPreview.account, idActivity: idActivity, id: fileId) {
|
||||
|
||||
let fileNamePath = CCUtility.getDirectoryUserData() + "/" + activitySubjectRich.name
|
||||
|
||||
|
||||
if FileManager.default.fileExists(atPath: fileNamePath), let image = UIImage(contentsOfFile: fileNamePath) {
|
||||
cell.imageView.image = image
|
||||
} else {
|
||||
|
|
|
@ -48,10 +48,10 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD
|
|||
var mainTabBar: NCMainTabBar?
|
||||
var activeMetadata: tableMetadata?
|
||||
|
||||
let listFilesVC = ThreadSafeDictionary<String,NCFiles>()
|
||||
let listFavoriteVC = ThreadSafeDictionary<String,NCFavorite>()
|
||||
let listOfflineVC = ThreadSafeDictionary<String,NCOffline>()
|
||||
let listGroupfoldersVC = ThreadSafeDictionary<String,NCGroupfolders>()
|
||||
let listFilesVC = ThreadSafeDictionary<String, NCFiles>()
|
||||
let listFavoriteVC = ThreadSafeDictionary<String, NCFavorite>()
|
||||
let listOfflineVC = ThreadSafeDictionary<String, NCOffline>()
|
||||
let listGroupfoldersVC = ThreadSafeDictionary<String, NCGroupfolders>()
|
||||
|
||||
var disableSharesView: Bool = false
|
||||
var documentPickerViewController: NCDocumentPickerViewController?
|
||||
|
@ -166,7 +166,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD
|
|||
} else {
|
||||
if !CCUtility.getIntro() {
|
||||
if let viewController = UIStoryboard(name: "NCIntro", bundle: nil).instantiateInitialViewController() {
|
||||
let navigationController = NCLoginNavigationController.init(rootViewController: viewController)
|
||||
let navigationController = NCLoginNavigationController(rootViewController: viewController)
|
||||
window?.rootViewController = navigationController
|
||||
window?.makeKeyAndVisible()
|
||||
}
|
||||
|
@ -190,7 +190,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD
|
|||
|
||||
NCSettingsBundleHelper.setVersionAndBuildNumber()
|
||||
NCSettingsBundleHelper.checkAndExecuteSettings(delay: 0.5)
|
||||
|
||||
|
||||
// START OBSERVE/TIMER UPLOAD PROCESS
|
||||
NCNetworkingProcessUpload.shared.observeTableMetadata()
|
||||
NCNetworkingProcessUpload.shared.startTimer()
|
||||
|
@ -229,7 +229,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD
|
|||
|
||||
// Request TouchID, FaceID
|
||||
enableTouchFaceID()
|
||||
|
||||
|
||||
NotificationCenter.default.postOnMainThread(name: NCGlobal.shared.notificationCenterRichdocumentGrabFocus)
|
||||
NotificationCenter.default.postOnMainThread(name: NCGlobal.shared.notificationCenterReloadDataSourceNetwork, second: 2)
|
||||
}
|
||||
|
@ -368,7 +368,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD
|
|||
|
||||
func handleRefreshTask(_ task: BGTask) {
|
||||
scheduleAppRefresh()
|
||||
|
||||
|
||||
guard !account.isEmpty else {
|
||||
task.setTaskCompleted(success: true)
|
||||
return
|
||||
|
@ -387,7 +387,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD
|
|||
|
||||
func handleProcessingTask(_ task: BGTask) {
|
||||
scheduleAppProcessing()
|
||||
|
||||
|
||||
guard !account.isEmpty else {
|
||||
task.setTaskCompleted(success: true)
|
||||
return
|
||||
|
@ -415,7 +415,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD
|
|||
|
||||
func userNotificationCenter(_ center: UNUserNotificationCenter, didReceive response: UNNotificationResponse, withCompletionHandler completionHandler: @escaping () -> Void) {
|
||||
|
||||
if let pref = UserDefaults.init(suiteName: NCBrandOptions.shared.capabilitiesGroups),
|
||||
if let pref = UserDefaults(suiteName: NCBrandOptions.shared.capabilitiesGroups),
|
||||
let data = pref.object(forKey: "NOTIFICATION_DATA") as? [String: AnyObject] {
|
||||
nextcloudPushNotificationAction(data: data)
|
||||
pref.set(nil, forKey: "NOTIFICATION_DATA")
|
||||
|
@ -532,7 +532,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD
|
|||
|
||||
if contextViewController == nil {
|
||||
if let viewController = viewController {
|
||||
let navigationController = NCLoginNavigationController.init(rootViewController: viewController)
|
||||
let navigationController = NCLoginNavigationController(rootViewController: viewController)
|
||||
navigationController.navigationBar.barStyle = .black
|
||||
navigationController.navigationBar.tintColor = NCBrandColor.shared.customerText
|
||||
navigationController.navigationBar.barTintColor = NCBrandColor.shared.customer
|
||||
|
@ -546,7 +546,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD
|
|||
}
|
||||
} else {
|
||||
if let viewController = viewController, let contextViewController = contextViewController {
|
||||
let navigationController = NCLoginNavigationController.init(rootViewController: viewController)
|
||||
let navigationController = NCLoginNavigationController(rootViewController: viewController)
|
||||
navigationController.modalPresentationStyle = .fullScreen
|
||||
navigationController.navigationBar.barStyle = .black
|
||||
navigationController.navigationBar.tintColor = NCBrandColor.shared.customerText
|
||||
|
@ -556,7 +556,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@objc func startTimerErrorNetworking() {
|
||||
timerErrorNetworking = Timer.scheduledTimer(timeInterval: 3, target: self, selector: #selector(checkErrorNetworking), userInfo: nil, repeats: true)
|
||||
}
|
||||
|
@ -566,7 +566,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD
|
|||
openLogin(viewController: window?.rootViewController, selector: NCGlobal.shared.introLogin, openLoginWeb: true)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
func trustCertificateError(host: String) {
|
||||
|
||||
guard let currentHost = URL(string: self.urlBase)?.host,
|
||||
|
@ -584,13 +584,13 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD
|
|||
|
||||
let alertController = UIAlertController(title: title, message: NSLocalizedString("_server_is_trusted_", comment: ""), preferredStyle: .alert)
|
||||
|
||||
alertController.addAction(UIAlertAction(title: NSLocalizedString("_yes_", comment: ""), style: .default, handler: { action in
|
||||
alertController.addAction(UIAlertAction(title: NSLocalizedString("_yes_", comment: ""), style: .default, handler: { _ in
|
||||
NCNetworking.shared.writeCertificate(host: host)
|
||||
}))
|
||||
|
||||
alertController.addAction(UIAlertAction(title: NSLocalizedString("_no_", comment: ""), style: .default, handler: { action in }))
|
||||
alertController.addAction(UIAlertAction(title: NSLocalizedString("_no_", comment: ""), style: .default, handler: { _ in }))
|
||||
|
||||
alertController.addAction(UIAlertAction(title: NSLocalizedString("_certificate_details_", comment: ""), style: .default, handler: { action in
|
||||
alertController.addAction(UIAlertAction(title: NSLocalizedString("_certificate_details_", comment: ""), style: .default, handler: { _ in
|
||||
if let navigationController = UIStoryboard(name: "NCViewCertificateDetails", bundle: nil).instantiateInitialViewController() as? UINavigationController {
|
||||
let viewController = navigationController.topViewController as! NCViewCertificateDetails
|
||||
viewController.delegate = self
|
||||
|
@ -611,7 +611,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD
|
|||
@objc func settingAccount(_ account: String, urlBase: String, user: String, userId: String, password: String, initialize: Bool = true) {
|
||||
|
||||
let accountTestBackup = self.account + "/" + self.userId
|
||||
let accountTest = account + "/" + userId
|
||||
let accountTest = account + "/" + userId
|
||||
|
||||
self.account = account
|
||||
self.urlBase = urlBase
|
||||
|
@ -640,13 +640,13 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD
|
|||
if let account = NCManageDatabase.shared.getAccount(predicate: NSPredicate(format: "account == %@", account)) {
|
||||
NCPushNotification.shared().unsubscribingNextcloudServerPushNotification(account.account, urlBase: account.urlBase, user: account.user, withSubscribing: false)
|
||||
}
|
||||
|
||||
|
||||
let results = NCManageDatabase.shared.getTableLocalFiles(predicate: NSPredicate(format: "account == %@", account), sorted: "ocId", ascending: false)
|
||||
for result in results {
|
||||
CCUtility.removeFile(atPath: CCUtility.getDirectoryProviderStorageOcId(result.ocId))
|
||||
}
|
||||
NCManageDatabase.shared.clearDatabase(account: account, removeAccount: true)
|
||||
|
||||
|
||||
CCUtility.clearAllKeysEnd(toEnd: account)
|
||||
CCUtility.clearAllKeysPushNotification(account)
|
||||
CCUtility.setPassword(account, password: nil)
|
||||
|
@ -704,7 +704,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD
|
|||
func accountRequestChangeAccount(account: String) {
|
||||
changeAccount(account)
|
||||
}
|
||||
|
||||
|
||||
func requestAccount() {
|
||||
|
||||
if isPasscodePresented() { return }
|
||||
|
@ -713,7 +713,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD
|
|||
let accounts = NCManageDatabase.shared.getAllAccount()
|
||||
|
||||
if accounts.count > 1 {
|
||||
|
||||
|
||||
if let vcAccountRequest = UIStoryboard(name: "NCAccountRequest", bundle: nil).instantiateInitialViewController() as? NCAccountRequest {
|
||||
|
||||
vcAccountRequest.activeAccount = NCManageDatabase.shared.getActiveAccount()
|
||||
|
@ -723,15 +723,15 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD
|
|||
vcAccountRequest.dismissDidEnterBackground = false
|
||||
vcAccountRequest.delegate = self
|
||||
|
||||
let screenHeighMax = UIScreen.main.bounds.height - (UIScreen.main.bounds.height/5)
|
||||
let screenHeighMax = UIScreen.main.bounds.height - (UIScreen.main.bounds.height / 5)
|
||||
let numberCell = accounts.count
|
||||
let height = min(CGFloat(numberCell * Int(vcAccountRequest.heightCell) + 45), screenHeighMax)
|
||||
|
||||
let popup = NCPopupViewController(contentController: vcAccountRequest, popupWidth: 300, popupHeight: height+20)
|
||||
let popup = NCPopupViewController(contentController: vcAccountRequest, popupWidth: 300, popupHeight: height + 20)
|
||||
popup.backgroundAlpha = 0.8
|
||||
|
||||
window?.rootViewController?.present(popup, animated: true)
|
||||
|
||||
|
||||
vcAccountRequest.startTimer()
|
||||
}
|
||||
}
|
||||
|
@ -739,7 +739,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD
|
|||
|
||||
// MARK: - Passcode
|
||||
|
||||
func presentPasscode(completion: @escaping () -> ()) {
|
||||
func presentPasscode(completion: @escaping () -> Void) {
|
||||
|
||||
let laContext = LAContext()
|
||||
var error: NSError?
|
||||
|
@ -757,9 +757,9 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD
|
|||
passcodeViewController.keypadButtonShowLettering = false
|
||||
if CCUtility.getEnableTouchFaceID() && laContext.canEvaluatePolicy(.deviceOwnerAuthenticationWithBiometrics, error: &error) {
|
||||
if error == nil {
|
||||
if laContext.biometryType == .faceID {
|
||||
if laContext.biometryType == .faceID {
|
||||
passcodeViewController.biometryType = .faceID
|
||||
} else if laContext.biometryType == .touchID {
|
||||
} else if laContext.biometryType == .touchID {
|
||||
passcodeViewController.biometryType = .touchID
|
||||
}
|
||||
passcodeViewController.allowBiometricValidation = true
|
||||
|
@ -785,7 +785,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD
|
|||
else { return }
|
||||
|
||||
DispatchQueue.main.asyncAfter(deadline: .now() + 0.5) {
|
||||
LAContext().evaluatePolicy(.deviceOwnerAuthenticationWithBiometrics, localizedReason: NCBrandOptions.shared.brand) { (success, error) in
|
||||
LAContext().evaluatePolicy(.deviceOwnerAuthenticationWithBiometrics, localizedReason: NCBrandOptions.shared.brand) { success, _ in
|
||||
if success {
|
||||
DispatchQueue.main.async {
|
||||
passcodeViewController.dismiss(animated: true) {
|
||||
|
@ -884,24 +884,22 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD
|
|||
return false
|
||||
}
|
||||
|
||||
|
||||
switch actionScheme {
|
||||
case NCGlobal.shared.actionUploadAsset:
|
||||
|
||||
NCAskAuthorization.shared.askAuthorizationPhotoLibrary(viewController: rootViewController) { hasPermission in
|
||||
if hasPermission {
|
||||
NCPhotosPickerViewController.init(viewController: rootViewController, maxSelectedAssets: 0, singleSelectedMode: false)
|
||||
if hasPermission {NCPhotosPickerViewController(viewController: rootViewController, maxSelectedAssets: 0, singleSelectedMode: false)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
case NCGlobal.shared.actionScanDocument:
|
||||
|
||||
NCDocumentCamera.shared.openScannerDocument(viewController: rootViewController)
|
||||
|
||||
case NCGlobal.shared.actionTextDocument:
|
||||
|
||||
|
||||
guard let navigationController = UIStoryboard(name: "NCCreateFormUploadDocuments", bundle: nil).instantiateInitialViewController(), let directEditingCreators = NCManageDatabase.shared.getDirectEditingCreators(account: account), let directEditingCreator = directEditingCreators.first(where: { $0.editor == NCGlobal.shared.editorText}) else { return false }
|
||||
|
||||
|
||||
navigationController.modalPresentationStyle = UIModalPresentationStyle.formSheet
|
||||
|
||||
let viewController = (navigationController as! UINavigationController).topViewController as! NCCreateFormUploadDocuments
|
||||
|
@ -912,9 +910,9 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD
|
|||
viewController.titleForm = NSLocalizedString("_create_nextcloudtext_document_", comment: "")
|
||||
|
||||
rootViewController.present(navigationController, animated: true, completion: nil)
|
||||
|
||||
|
||||
case NCGlobal.shared.actionVoiceMemo:
|
||||
|
||||
|
||||
NCAskAuthorization.shared.askAuthorizationAudioRecord(viewController: rootViewController) { hasPermission in
|
||||
if hasPermission {
|
||||
let fileName = CCUtility.createFileNameDate(NSLocalizedString("_voice_memo_filename_", comment: ""), extension: "m4a")!
|
||||
|
|
|
@ -94,7 +94,7 @@ class NCBrowserWeb: UIViewController {
|
|||
|
||||
request.addValue("true", forHTTPHeaderField: "OCS-APIRequest")
|
||||
request.addValue(language, forHTTPHeaderField: "Accept-Language")
|
||||
|
||||
|
||||
webView.customUserAgent = CCUtility.getUserAgent()
|
||||
webView.load(request)
|
||||
}
|
||||
|
|
|
@ -45,7 +45,6 @@ class NCEmptyDataSet: NSObject {
|
|||
private var centerXAnchor: NSLayoutConstraint?
|
||||
private var centerYAnchor: NSLayoutConstraint?
|
||||
|
||||
|
||||
init(view: UIView, offset: CGFloat = 0, delegate: NCEmptyDataSetDelegate?) {
|
||||
super.init()
|
||||
|
||||
|
|
|
@ -49,4 +49,3 @@ extension UIDeviceOrientation {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -153,7 +153,7 @@ class NCLogin: UIViewController, UITextFieldDelegate, NCLoginQRCodeDelegate {
|
|||
if self.shareAccounts != nil, let image = UIImage(systemName: "person.badge.plus")?.withTintColor(.white, renderingMode: .alwaysOriginal), let backgroundColor = NCBrandColor.shared.brandElement.lighter(by: 10) {
|
||||
let title = String(format: NSLocalizedString("_apps_nextcloud_detect_", comment: ""), NCBrandOptions.shared.brand)
|
||||
let description = String(format: NSLocalizedString("_add_existing_account_", comment: ""), NCBrandOptions.shared.brand)
|
||||
NCContentPresenter.shared.alertAction(image: image, contentModeImage: .scaleAspectFit, sizeImage: CGSize(width: 45, height: 45),backgroundColor: backgroundColor, textColor: textColor, title: title, description: description, textCancelButton: "_cancel_", textOkButton: "_ok_", attributes: EKAttributes.topFloat) { identifier in
|
||||
NCContentPresenter.shared.alertAction(image: image, contentModeImage: .scaleAspectFit, sizeImage: CGSize(width: 45, height: 45), backgroundColor: backgroundColor, textColor: textColor, title: title, description: description, textCancelButton: "_cancel_", textOkButton: "_ok_", attributes: EKAttributes.topFloat) { identifier in
|
||||
if identifier == "ok" {
|
||||
self.openShareAccountsViewController()
|
||||
}
|
||||
|
@ -244,11 +244,11 @@ class NCLogin: UIViewController, UITextFieldDelegate, NCLoginQRCodeDelegate {
|
|||
vc.dismissDidEnterBackground = false
|
||||
vc.delegate = self
|
||||
|
||||
let screenHeighMax = UIScreen.main.bounds.height - (UIScreen.main.bounds.height/5)
|
||||
let screenHeighMax = UIScreen.main.bounds.height - (UIScreen.main.bounds.height / 5)
|
||||
let numberCell = shareAccounts.count
|
||||
let height = min(CGFloat(numberCell * Int(vc.heightCell) + 45), screenHeighMax)
|
||||
|
||||
let popup = NCPopupViewController(contentController: vc, popupWidth: 300, popupHeight: height+20)
|
||||
let popup = NCPopupViewController(contentController: vc, popupWidth: 300, popupHeight: height + 20)
|
||||
|
||||
self.present(popup, animated: true)
|
||||
}
|
||||
|
@ -269,7 +269,7 @@ class NCLogin: UIViewController, UITextFieldDelegate, NCLoginQRCodeDelegate {
|
|||
NCNetworking.shared.writeCertificate(host: host)
|
||||
}
|
||||
|
||||
NextcloudKit.shared.getLoginFlowV2(serverUrl: url) { token, endpoint, login, data, error in
|
||||
NextcloudKit.shared.getLoginFlowV2(serverUrl: url) { token, endpoint, login, _, error in
|
||||
|
||||
self.loginButton.isEnabled = true
|
||||
|
||||
|
@ -393,7 +393,7 @@ class NCLogin: UIViewController, UITextFieldDelegate, NCLoginQRCodeDelegate {
|
|||
if NCManageDatabase.shared.getAccounts() == nil {
|
||||
NCUtility.shared.removeAllSettings()
|
||||
}
|
||||
|
||||
|
||||
NCManageDatabase.shared.deleteAccount(account)
|
||||
NCManageDatabase.shared.addAccount(account, urlBase: url, user: user, password: password)
|
||||
|
||||
|
|
|
@ -34,7 +34,7 @@ class NCLoginWeb: UIViewController {
|
|||
|
||||
var urlBase = ""
|
||||
var user: String?
|
||||
|
||||
|
||||
var configServerUrl: String?
|
||||
var configUsername: String?
|
||||
var configPassword: String?
|
||||
|
@ -55,7 +55,7 @@ class NCLoginWeb: UIViewController {
|
|||
// load AppConfig
|
||||
if (NCBrandOptions.shared.disable_multiaccount == false) || (NCBrandOptions.shared.disable_multiaccount == true && accountCount == 0) {
|
||||
if let configurationManaged = UserDefaults.standard.dictionary(forKey: "com.apple.configuration.managed"), NCBrandOptions.shared.use_AppConfig {
|
||||
|
||||
|
||||
if let serverUrl = configurationManaged[NCGlobal.shared.configuration_serverUrl] as? String {
|
||||
self.configServerUrl = serverUrl
|
||||
}
|
||||
|
@ -104,7 +104,7 @@ class NCLoginWeb: UIViewController {
|
|||
urlBase = serverUrl
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ADD end point for Web Flow
|
||||
if urlBase != NCBrandOptions.shared.linkloginPreferredProviders {
|
||||
if loginFlowV2Available {
|
||||
|
@ -179,10 +179,10 @@ class NCLoginWeb: UIViewController {
|
|||
|
||||
webView.load(request)
|
||||
}
|
||||
|
||||
|
||||
func getAppPassword(serverUrl: String, username: String, password: String) {
|
||||
|
||||
NextcloudKit.shared.getAppPassword(serverUrl: serverUrl, username: username, password: password) { token, data, error in
|
||||
|
||||
NextcloudKit.shared.getAppPassword(serverUrl: serverUrl, username: username, password: password) { token, _, error in
|
||||
if error == .success, let password = token {
|
||||
self.createAccount(server: serverUrl, username: username, password: password)
|
||||
} else {
|
||||
|
@ -283,7 +283,7 @@ extension NCLoginWeb: WKNavigationDelegate {
|
|||
|
||||
if loginFlowV2Available {
|
||||
DispatchQueue.main.asyncAfter(deadline: .now() + 1) {
|
||||
NextcloudKit.shared.getLoginFlowV2Poll(token: self.loginFlowV2Token, endpoint: self.loginFlowV2Endpoint) { server, loginName, appPassword, data, error in
|
||||
NextcloudKit.shared.getLoginFlowV2Poll(token: self.loginFlowV2Token, endpoint: self.loginFlowV2Endpoint) { server, loginName, appPassword, _, error in
|
||||
if error == .success && server != nil && loginName != nil && appPassword != nil {
|
||||
self.createAccount(server: server!, username: loginName!, password: appPassword!)
|
||||
}
|
||||
|
@ -310,7 +310,7 @@ extension NCLoginWeb: WKNavigationDelegate {
|
|||
if NCManageDatabase.shared.getAccounts() == nil {
|
||||
NCUtility.shared.removeAllSettings()
|
||||
}
|
||||
|
||||
|
||||
// Add new account
|
||||
NCManageDatabase.shared.deleteAccount(account)
|
||||
NCManageDatabase.shared.addAccount(account, urlBase: urlBase, user: username, password: password)
|
||||
|
|
|
@ -143,7 +143,7 @@ class NCAudioRecorderViewController: UIViewController, NCAudioRecorderDelegate {
|
|||
|
||||
voiceRecordHUD.update(CGFloat(rate))
|
||||
voiceRecordHUD.fillColor = UIColor.green
|
||||
|
||||
|
||||
let formatter = DateComponentsFormatter()
|
||||
formatter.allowedUnits = [.second]
|
||||
formatter.unitsStyle = .full
|
||||
|
|
|
@ -74,7 +74,7 @@ class NCCollectionViewCommon: UIViewController, UIGestureRecognizerDelegate, UIS
|
|||
internal var enableSearchBar: Bool = false
|
||||
internal var headerMenuTransferView = false
|
||||
internal var headerMenuButtonsView: Bool = true
|
||||
internal var headerRichWorkspaceDisable:Bool = false
|
||||
internal var headerRichWorkspaceDisable: Bool = false
|
||||
internal var emptyImage: UIImage?
|
||||
internal var emptyTitle: String = ""
|
||||
internal var emptyDescription: String = ""
|
||||
|
@ -215,7 +215,7 @@ class NCCollectionViewCommon: UIViewController, UIGestureRecognizerDelegate, UIS
|
|||
reloadDataSourceNetwork()
|
||||
}
|
||||
|
||||
//FIXME: iPAD PDF landscape mode iOS 16
|
||||
// FIXME: iPAD PDF landscape mode iOS 16
|
||||
DispatchQueue.main.async {
|
||||
self.collectionView?.collectionViewLayout.invalidateLayout()
|
||||
}
|
||||
|
@ -270,7 +270,7 @@ class NCCollectionViewCommon: UIViewController, UIGestureRecognizerDelegate, UIS
|
|||
self.collectionView?.collectionViewLayout.invalidateLayout()
|
||||
self.collectionView?.reloadData()
|
||||
self.tipView?.dismiss()
|
||||
|
||||
|
||||
coordinator.animate(alongsideTransition: nil) { _ in
|
||||
self.showTip()
|
||||
}
|
||||
|
@ -397,7 +397,7 @@ class NCCollectionViewCommon: UIViewController, UIGestureRecognizerDelegate, UIS
|
|||
let account = userInfo["account"] as? String,
|
||||
account == appDelegate.account
|
||||
else { return }
|
||||
|
||||
|
||||
if isSearchingMode {
|
||||
reloadDataSourceNetwork()
|
||||
} else {
|
||||
|
@ -419,7 +419,7 @@ class NCCollectionViewCommon: UIViewController, UIGestureRecognizerDelegate, UIS
|
|||
|
||||
if e2ee {
|
||||
reloadDataSourceNetwork(isForced: true)
|
||||
} else if let metadata = NCManageDatabase.shared.getMetadataFromOcId(ocId) {
|
||||
} else if let metadata = NCManageDatabase.shared.getMetadataFromOcId(ocId) {
|
||||
reloadDataSource()
|
||||
if withPush {
|
||||
pushMetadata(metadata)
|
||||
|
@ -626,55 +626,55 @@ class NCCollectionViewCommon: UIViewController, UIGestureRecognizerDelegate, UIS
|
|||
navigationItem.title = titleCurrentFolder
|
||||
|
||||
guard layoutKey == NCGlobal.shared.layoutViewFiles else { return }
|
||||
|
||||
|
||||
// PROFILE BUTTON
|
||||
|
||||
|
||||
let activeAccount = NCManageDatabase.shared.getActiveAccount()
|
||||
|
||||
let image = NCUtility.shared.loadUserImage(
|
||||
for: appDelegate.user,
|
||||
displayName: activeAccount?.displayName,
|
||||
userBaseUrl: appDelegate)
|
||||
|
||||
|
||||
let button = UIButton(type: .custom)
|
||||
button.setImage(image, for: .normal)
|
||||
|
||||
|
||||
if serverUrl == NCUtilityFileSystem.shared.getHomeServer(urlBase: appDelegate.urlBase, userId: appDelegate.userId) {
|
||||
|
||||
|
||||
var titleButton = " "
|
||||
|
||||
|
||||
if getNavigationTitle() == activeAccount?.alias {
|
||||
titleButton = ""
|
||||
} else {
|
||||
titleButton += activeAccount?.displayName ?? ""
|
||||
}
|
||||
|
||||
|
||||
button.setTitle(titleButton, for: .normal)
|
||||
button.setTitleColor(.systemBlue, for: .normal)
|
||||
}
|
||||
|
||||
|
||||
button.semanticContentAttribute = .forceLeftToRight
|
||||
button.sizeToFit()
|
||||
button.action(for: .touchUpInside) { _ in
|
||||
|
||||
|
||||
let accounts = NCManageDatabase.shared.getAllAccountOrderAlias()
|
||||
if accounts.count > 0 && !NCBrandOptions.shared.disable_multiaccount && !NCBrandOptions.shared.disable_manage_account {
|
||||
|
||||
|
||||
if let vcAccountRequest = UIStoryboard(name: "NCAccountRequest", bundle: nil).instantiateInitialViewController() as? NCAccountRequest {
|
||||
|
||||
|
||||
vcAccountRequest.activeAccount = NCManageDatabase.shared.getActiveAccount()
|
||||
vcAccountRequest.accounts = accounts
|
||||
vcAccountRequest.enableTimerProgress = false
|
||||
vcAccountRequest.enableAddAccount = true
|
||||
vcAccountRequest.delegate = self
|
||||
vcAccountRequest.dismissDidEnterBackground = true
|
||||
|
||||
let screenHeighMax = UIScreen.main.bounds.height - (UIScreen.main.bounds.height/5)
|
||||
|
||||
let screenHeighMax = UIScreen.main.bounds.height - (UIScreen.main.bounds.height / 5)
|
||||
let numberCell = accounts.count + 1
|
||||
let height = min(CGFloat(numberCell * Int(vcAccountRequest.heightCell) + 45), screenHeighMax)
|
||||
|
||||
|
||||
let popup = NCPopupViewController(contentController: vcAccountRequest, popupWidth: 300, popupHeight: height)
|
||||
|
||||
|
||||
self.present(popup, animated: true)
|
||||
}
|
||||
|
||||
|
@ -786,12 +786,12 @@ class NCCollectionViewCommon: UIViewController, UIGestureRecognizerDelegate, UIS
|
|||
func accountRequestAddAccount() {
|
||||
appDelegate.openLogin(viewController: self, selector: NCGlobal.shared.introLogin, openLoginWeb: false)
|
||||
}
|
||||
|
||||
|
||||
func tapButtonSwitch(_ sender: Any) {
|
||||
|
||||
|
||||
guard isTransitioning == false else { return }
|
||||
isTransitioning = true
|
||||
|
||||
|
||||
if layoutForView?.layout == NCGlobal.shared.layoutGrid {
|
||||
|
||||
// list layout
|
||||
|
@ -865,7 +865,7 @@ class NCCollectionViewCommon: UIViewController, UIGestureRecognizerDelegate, UIS
|
|||
viewerRichWorkspace.richWorkspaceText = richWorkspaceText ?? ""
|
||||
viewerRichWorkspace.serverUrl = serverUrl
|
||||
viewerRichWorkspace.delegate = self
|
||||
|
||||
|
||||
navigationController.modalPresentationStyle = .fullScreen
|
||||
self.present(navigationController, animated: true, completion: nil)
|
||||
}
|
||||
|
@ -981,11 +981,11 @@ class NCCollectionViewCommon: UIViewController, UIGestureRecognizerDelegate, UIS
|
|||
self.collectionView.reloadData()
|
||||
|
||||
if NCGlobal.shared.capabilityServerVersionMajor >= NCGlobal.shared.nextcloudVersion20 {
|
||||
NCNetworking.shared.unifiedSearchFiles(userBaseUrl: appDelegate, literal: literalSearch) { account, searchProviders in
|
||||
NCNetworking.shared.unifiedSearchFiles(userBaseUrl: appDelegate, literal: literalSearch) { _, searchProviders in
|
||||
self.providers = searchProviders
|
||||
self.searchResults = []
|
||||
self.dataSource = NCDataSource(
|
||||
metadatas: [] ,
|
||||
metadatas: [],
|
||||
account: self.appDelegate.account,
|
||||
sort: self.layoutForView?.sort,
|
||||
ascending: self.layoutForView?.ascending,
|
||||
|
@ -994,10 +994,10 @@ class NCCollectionViewCommon: UIViewController, UIGestureRecognizerDelegate, UIS
|
|||
filterLivePhoto: true,
|
||||
providers: self.providers,
|
||||
searchResults: self.searchResults)
|
||||
} update: { account, id, searchResult, metadatas in
|
||||
guard let metadatas = metadatas, metadatas.count > 0, self.isSearchingMode , let searchResult = searchResult else { return }
|
||||
} update: { _, _, searchResult, metadatas in
|
||||
guard let metadatas = metadatas, metadatas.count > 0, self.isSearchingMode, let searchResult = searchResult else { return }
|
||||
NCOperationQueue.shared.unifiedSearchAddSection(collectionViewCommon: self, metadatas: metadatas, searchResult: searchResult)
|
||||
} completion: { account, error in
|
||||
} completion: { _, _ in
|
||||
self.refreshControl.endRefreshing()
|
||||
self.isReloadDataSourceNetworkInProgress = false
|
||||
self.collectionView.reloadData()
|
||||
|
@ -1032,7 +1032,7 @@ class NCCollectionViewCommon: UIViewController, UIGestureRecognizerDelegate, UIS
|
|||
metadataForSection.unifiedSearchInProgress = true
|
||||
self.collectionView?.reloadData()
|
||||
|
||||
NCNetworking.shared.unifiedSearchFilesProvider(userBaseUrl: appDelegate, id: lastSearchResult.id, term: term, limit: 5, cursor: cursor) { account, searchResult, metadatas, error in
|
||||
NCNetworking.shared.unifiedSearchFilesProvider(userBaseUrl: appDelegate, id: lastSearchResult.id, term: term, limit: 5, cursor: cursor) { _, searchResult, metadatas, error in
|
||||
if error != .success {
|
||||
NCContentPresenter.shared.showError(error: error)
|
||||
}
|
||||
|
@ -1051,7 +1051,7 @@ class NCCollectionViewCommon: UIViewController, UIGestureRecognizerDelegate, UIS
|
|||
|
||||
var tableDirectory: tableDirectory?
|
||||
|
||||
NCNetworking.shared.readFile(serverUrlFileName: serverUrl) { (account, metadataFolder, error) in
|
||||
NCNetworking.shared.readFile(serverUrlFileName: serverUrl) { account, metadataFolder, error in
|
||||
guard error == .success else {
|
||||
completion(nil, nil, nil, nil, error)
|
||||
return
|
||||
|
@ -1061,7 +1061,7 @@ class NCCollectionViewCommon: UIViewController, UIGestureRecognizerDelegate, UIS
|
|||
tableDirectory = NCManageDatabase.shared.setDirectory(serverUrl: self.serverUrl, richWorkspace: metadataFolder.richWorkspace, account: account)
|
||||
}
|
||||
if isForced || tableDirectory?.etag != metadataFolder?.etag || metadataFolder?.e2eEncrypted ?? false {
|
||||
NCNetworking.shared.readFolder(serverUrl: self.serverUrl, account: self.appDelegate.account) { account, metadataFolder, metadatas, metadatasUpdate, _, metadatasDelete, error in
|
||||
NCNetworking.shared.readFolder(serverUrl: self.serverUrl, account: self.appDelegate.account) { _, metadataFolder, metadatas, metadatasUpdate, _, metadatasDelete, error in
|
||||
guard error == .success else {
|
||||
completion(tableDirectory, nil, nil, nil, error)
|
||||
return
|
||||
|
@ -1069,7 +1069,7 @@ class NCCollectionViewCommon: UIViewController, UIGestureRecognizerDelegate, UIS
|
|||
self.metadataFolder = metadataFolder
|
||||
// E2EE
|
||||
if let metadataFolder = metadataFolder, metadataFolder.e2eEncrypted, CCUtility.isEnd(toEndEnabled: self.appDelegate.account) {
|
||||
NextcloudKit.shared.getE2EEMetadata(fileId: metadataFolder.ocId, e2eToken: nil) { account, e2eMetadata, signature, data, error in
|
||||
NextcloudKit.shared.getE2EEMetadata(fileId: metadataFolder.ocId, e2eToken: nil) { _, e2eMetadata, signature, _, error in
|
||||
if error == .success, let e2eMetadata = e2eMetadata {
|
||||
let error = NCEndToEndMetadata().decodeMetadata(e2eMetadata, signature: signature, serverUrl: self.serverUrl, account: self.appDelegate.account, urlBase: self.appDelegate.urlBase, userId: self.appDelegate.userId, ownerId: metadataFolder.ownerId)
|
||||
if error == .success {
|
||||
|
@ -1291,9 +1291,9 @@ extension NCCollectionViewCommon: UICollectionViewDelegate {
|
|||
if metadata.directory {
|
||||
|
||||
pushMetadata(metadata)
|
||||
|
||||
|
||||
} else {
|
||||
|
||||
|
||||
let imageIcon = UIImage(contentsOfFile: CCUtility.getDirectoryProviderStorageIconOcId(metadata.ocId, etag: metadata.etag))
|
||||
|
||||
if !metadata.isDirectoryE2EE && (metadata.isImage || metadata.isAudioOrVideo) {
|
||||
|
@ -1421,7 +1421,7 @@ extension NCCollectionViewCommon: UICollectionViewDataSource {
|
|||
}
|
||||
|
||||
func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
|
||||
|
||||
|
||||
let numberItems = dataSource.numberOfItemsInSection(section)
|
||||
emptyDataSet?.numberOfItemsInSection(numberItems, section: section)
|
||||
return numberItems
|
||||
|
@ -1512,7 +1512,7 @@ extension NCCollectionViewCommon: UICollectionViewDataSource {
|
|||
metadata.shareType.contains(3) ?
|
||||
(cell.filePreviewImageView?.image = NCBrandColor.cacheImages.folderPublic) :
|
||||
(cell.filePreviewImageView?.image = NCBrandColor.cacheImages.folderSharedWithMe)
|
||||
} else if !metadata.shareType.isEmpty && metadata.shareType.contains(3) {
|
||||
} else if !metadata.shareType.isEmpty && metadata.shareType.contains(3) {
|
||||
cell.filePreviewImageView?.image = NCBrandColor.cacheImages.folderPublic
|
||||
} else if metadata.mountType == "group" {
|
||||
cell.filePreviewImageView?.image = NCBrandColor.cacheImages.folderGroup
|
||||
|
@ -1649,8 +1649,8 @@ extension NCCollectionViewCommon: UICollectionViewDataSource {
|
|||
// Color string find in search
|
||||
if isSearchingMode, let literalSearch = self.literalSearch, let title = cell.fileTitleLabel?.text {
|
||||
let longestWordRange = (title.lowercased() as NSString).range(of: literalSearch)
|
||||
let attributedString = NSMutableAttributedString(string: title, attributes: [NSAttributedString.Key.font : UIFont.systemFont(ofSize: 15)])
|
||||
attributedString.setAttributes([NSAttributedString.Key.font : UIFont.boldSystemFont(ofSize: 15), NSAttributedString.Key.foregroundColor : UIColor.systemBlue], range: longestWordRange)
|
||||
let attributedString = NSMutableAttributedString(string: title, attributes: [NSAttributedString.Key.font: UIFont.systemFont(ofSize: 15)])
|
||||
attributedString.setAttributes([NSAttributedString.Key.font: UIFont.boldSystemFont(ofSize: 15), NSAttributedString.Key.foregroundColor: UIColor.systemBlue], range: longestWordRange)
|
||||
cell.fileTitleLabel?.attributedText = attributedString
|
||||
}
|
||||
|
||||
|
@ -1745,7 +1745,6 @@ extension NCCollectionViewCommon: UICollectionViewDataSource {
|
|||
footer.buttonIsHidden(true)
|
||||
footer.hideActivityIndicatorSection()
|
||||
|
||||
|
||||
if isSearchingMode {
|
||||
if sections > 1 && section != sections - 1 {
|
||||
footer.separatorIsHidden(false)
|
||||
|
@ -1801,7 +1800,7 @@ extension NCCollectionViewCommon: UICollectionViewDelegateFlowLayout {
|
|||
return size
|
||||
}
|
||||
|
||||
func getHeaderHeight(section:Int) -> (heightHeaderCommands: CGFloat, heightHeaderRichWorkspace: CGFloat, heightHeaderSection: CGFloat) {
|
||||
func getHeaderHeight(section: Int) -> (heightHeaderCommands: CGFloat, heightHeaderRichWorkspace: CGFloat, heightHeaderSection: CGFloat) {
|
||||
|
||||
var headerRichWorkspace: CGFloat = 0
|
||||
|
||||
|
|
|
@ -148,7 +148,7 @@ class NCGridCell: UICollectionViewCell, UIGestureRecognizerDelegate, NCCellProto
|
|||
|
||||
fileprivate func setA11yActions() {
|
||||
let moreName = namedButtonMore == NCGlobal.shared.buttonMoreStop ? "_cancel_" : "_more_"
|
||||
|
||||
|
||||
self.accessibilityCustomActions = [
|
||||
UIAccessibilityCustomAction(
|
||||
name: NSLocalizedString(moreName, comment: ""),
|
||||
|
@ -156,7 +156,7 @@ class NCGridCell: UICollectionViewCell, UIGestureRecognizerDelegate, NCCellProto
|
|||
selector: #selector(touchUpInsideMore))
|
||||
]
|
||||
}
|
||||
|
||||
|
||||
func setButtonMore(named: String, image: UIImage) {
|
||||
namedButtonMore = named
|
||||
buttonMore.setImage(image, for: .normal)
|
||||
|
|
|
@ -157,7 +157,7 @@ class NCListCell: UICollectionViewCell, UIGestureRecognizerDelegate, NCCellProto
|
|||
override func snapshotView(afterScreenUpdates afterUpdates: Bool) -> UIView? {
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
@IBAction func touchUpInsideShare(_ sender: Any) {
|
||||
delegate?.tapShareListItem(with: objectId, indexPath: indexPath, sender: sender)
|
||||
}
|
||||
|
@ -197,7 +197,7 @@ class NCListCell: UICollectionViewCell, UIGestureRecognizerDelegate, NCCellProto
|
|||
titleTrailingConstraint.constant = 90
|
||||
infoTrailingConstraint.constant = 90
|
||||
}
|
||||
|
||||
|
||||
func setButtonMore(named: String, image: UIImage) {
|
||||
namedButtonMore = named
|
||||
imageMore.image = image
|
||||
|
@ -292,7 +292,7 @@ class NCListCell: UICollectionViewCell, UIGestureRecognizerDelegate, NCCellProto
|
|||
tag0.text = tag
|
||||
if tags.count > 1 {
|
||||
tag1.isHidden = false
|
||||
tag1.text = "+\(tags.count-1)"
|
||||
tag1.text = "+\(tags.count - 1)"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -58,7 +58,7 @@ class NCCreateFormUploadConflict: UIViewController {
|
|||
|
||||
var metadatasConflictNewFiles: [String] = []
|
||||
var metadatasConflictAlreadyExistingFiles: [String] = []
|
||||
let fileNamesPath = ThreadSafeDictionary<String,String>()
|
||||
let fileNamesPath = ThreadSafeDictionary<String, String>()
|
||||
var blurView: UIVisualEffectView!
|
||||
|
||||
// MARK: - View Life Cycle
|
||||
|
@ -311,8 +311,8 @@ extension NCCreateFormUploadConflict: UITableViewDataSource {
|
|||
cell.backgroundColor = tableView.backgroundColor
|
||||
cell.switchNewFile.onTintColor = NCBrandColor.shared.brand
|
||||
cell.switchAlreadyExistingFile.onTintColor = NCBrandColor.shared.brand
|
||||
|
||||
let metadataNewFile = tableMetadata.init(value: metadatasUploadInConflict[indexPath.row])
|
||||
|
||||
let metadataNewFile = tableMetadata.init(value: metadatasUploadInConflict[indexPath.row])
|
||||
|
||||
cell.ocId = metadataNewFile.ocId
|
||||
cell.delegate = self
|
||||
|
@ -324,7 +324,7 @@ extension NCCreateFormUploadConflict: UITableViewDataSource {
|
|||
|
||||
guard let metadataAlreadyExists = NCManageDatabase.shared.getMetadataConflict(account: metadataNewFile.account, serverUrl: metadataNewFile.serverUrl, fileNameView: metadataNewFile.fileNameView) else { return UITableViewCell() }
|
||||
if FileManager().fileExists(atPath: CCUtility.getDirectoryProviderStorageIconOcId(metadataAlreadyExists.ocId, etag: metadataAlreadyExists.etag)) {
|
||||
cell.imageAlreadyExistingFile.image = UIImage(contentsOfFile: CCUtility.getDirectoryProviderStorageIconOcId(metadataAlreadyExists.ocId, etag: metadataAlreadyExists.etag))
|
||||
cell.imageAlreadyExistingFile.image = UIImage(contentsOfFile: CCUtility.getDirectoryProviderStorageIconOcId(metadataAlreadyExists.ocId, etag: metadataAlreadyExists.etag))
|
||||
} else if FileManager().fileExists(atPath: CCUtility.getDirectoryProviderStorageOcId(metadataAlreadyExists.ocId, fileNameView: metadataAlreadyExists.fileNameView)) && metadataAlreadyExists.contentType == "application/pdf" {
|
||||
|
||||
let url = URL(fileURLWithPath: CCUtility.getDirectoryProviderStorageOcId(metadataAlreadyExists.ocId, fileNameView: metadataAlreadyExists.fileNameView))
|
||||
|
@ -388,7 +388,7 @@ extension NCCreateFormUploadConflict: UITableViewDataSource {
|
|||
|
||||
// PREVIEW
|
||||
let cameraRoll = NCCameraRoll()
|
||||
cameraRoll.extractImageVideoFromAssetLocalIdentifier(metadata: metadataNewFile, modifyMetadataForUpload: false, viewController: self, hud: JGProgressHUD()) { metadata, fileNamePath, error in
|
||||
cameraRoll.extractImageVideoFromAssetLocalIdentifier(metadata: metadataNewFile, modifyMetadataForUpload: false, viewController: self, hud: JGProgressHUD()) { _, fileNamePath, error in
|
||||
if !error {
|
||||
self.fileNamesPath[metadataNewFile.fileNameView] = fileNamePath!
|
||||
do {
|
||||
|
@ -413,7 +413,7 @@ extension NCCreateFormUploadConflict: UITableViewDataSource {
|
|||
} else if FileManager().fileExists(atPath: filePathNewFile) {
|
||||
|
||||
do {
|
||||
if metadataNewFile.classFile == NKCommon.TypeClassFile.image.rawValue {
|
||||
if metadataNewFile.classFile == NKCommon.TypeClassFile.image.rawValue {
|
||||
// preserver memory especially for very large files in Share extension
|
||||
if let image = UIImage.downsample(imageAt: URL(fileURLWithPath: filePathNewFile), to: cell.imageNewFile.frame.size) {
|
||||
cell.imageNewFile.image = image
|
||||
|
@ -521,7 +521,6 @@ struct UploadConflictView: UIViewControllerRepresentable {
|
|||
var metadatasUploadInConflict: [tableMetadata]
|
||||
var metadatasNOConflict: [tableMetadata]
|
||||
|
||||
|
||||
func makeUIViewController(context: Context) -> UIViewControllerType {
|
||||
|
||||
let storyboard = UIStoryboard(name: "NCCreateFormUploadConflict", bundle: nil)
|
||||
|
|
|
@ -83,8 +83,6 @@ import XLForm
|
|||
getTemplate()
|
||||
}
|
||||
|
||||
|
||||
|
||||
// MARK: - Tableview (XLForm)
|
||||
|
||||
func initializeForm() {
|
||||
|
@ -105,7 +103,7 @@ import XLForm
|
|||
row.value = fileNameFolder
|
||||
row.cellConfig["backgroundColor"] = tableView.backgroundColor
|
||||
|
||||
row.cellConfig["imageView.image"] = UIImage(named: "folder")!.image(color: NCBrandColor.shared.brandElement, size: 25)
|
||||
row.cellConfig["imageView.image"] = UIImage(named: "folder")!.image(color: NCBrandColor.shared.brandElement, size: 25)
|
||||
|
||||
row.cellConfig["textLabel.textAlignment"] = NSTextAlignment.right.rawValue
|
||||
row.cellConfig["textLabel.font"] = UIFont.systemFont(ofSize: 15.0)
|
||||
|
@ -133,8 +131,8 @@ import XLForm
|
|||
section.addFormRow(row)
|
||||
|
||||
self.form = form
|
||||
//tableView.reloadData()
|
||||
//collectionView.reloadData()
|
||||
// tableView.reloadData()
|
||||
// collectionView.reloadData()
|
||||
}
|
||||
|
||||
override func tableView(_ tableView: UITableView, willDisplayHeaderView view: UIView, forSection section: Int) {
|
||||
|
@ -224,7 +222,7 @@ import XLForm
|
|||
fileNameFolder = (serverUrl as NSString).lastPathComponent
|
||||
}
|
||||
|
||||
let buttonDestinationFolder: XLFormRowDescriptor = self.form.formRow(withTag: "ButtonDestinationFolder")!
|
||||
let buttonDestinationFolder: XLFormRowDescriptor = self.form.formRow(withTag: "ButtonDestinationFolder")!
|
||||
buttonDestinationFolder.title = fileNameFolder
|
||||
|
||||
self.tableView.reloadData()
|
||||
|
@ -251,7 +249,7 @@ import XLForm
|
|||
}
|
||||
templateIdentifier = selectTemplate.identifier
|
||||
|
||||
let rowFileName: XLFormRowDescriptor = self.form.formRow(withTag: "fileName")!
|
||||
let rowFileName: XLFormRowDescriptor = self.form.formRow(withTag: "fileName")!
|
||||
guard var fileNameForm = rowFileName.value else {
|
||||
return
|
||||
}
|
||||
|
@ -260,7 +258,7 @@ import XLForm
|
|||
return
|
||||
} else {
|
||||
|
||||
//Trim whitespaces after checks above
|
||||
// Trim whitespaces after checks above
|
||||
fileNameForm = (fileNameForm as! String).trimmingCharacters(in: .whitespacesAndNewlines)
|
||||
|
||||
let result = NextcloudKit.shared.nkCommonInstance.getInternalType(fileName: fileNameForm as! String, mimeType: "", directory: false)
|
||||
|
@ -314,7 +312,7 @@ import XLForm
|
|||
UUID = "TEMP" + UUID.replacingOccurrences(of: "-", with: "")
|
||||
|
||||
if self.editorId == NCGlobal.shared.editorText || self.editorId == NCGlobal.shared.editorOnlyoffice {
|
||||
|
||||
|
||||
var options = NKRequestOptions()
|
||||
if self.editorId == NCGlobal.shared.editorOnlyoffice {
|
||||
options = NKRequestOptions(customUserAgent: NCUtility.shared.getCustomUserAgentOnlyOffice())
|
||||
|
@ -322,7 +320,7 @@ import XLForm
|
|||
options = NKRequestOptions(customUserAgent: NCUtility.shared.getCustomUserAgentNCText())
|
||||
}
|
||||
|
||||
NextcloudKit.shared.NCTextCreateFile(fileNamePath: fileNamePath, editorId: editorId, creatorId: creatorId, templateId: templateIdentifier, options: options) { account, url, data, error in
|
||||
NextcloudKit.shared.NCTextCreateFile(fileNamePath: fileNamePath, editorId: editorId, creatorId: creatorId, templateId: templateIdentifier, options: options) { account, url, _, error in
|
||||
guard error == .success, account == self.appDelegate.account, let url = url else {
|
||||
self.navigationItem.rightBarButtonItem?.isEnabled = true
|
||||
NCContentPresenter.shared.showError(error: error)
|
||||
|
@ -330,7 +328,7 @@ import XLForm
|
|||
}
|
||||
|
||||
var results = NextcloudKit.shared.nkCommonInstance.getInternalType(fileName: fileName, mimeType: "", directory: false)
|
||||
//FIXME: iOS 12.0,* don't detect UTI text/markdown, text/x-markdown
|
||||
// FIXME: iOS 12.0,* don't detect UTI text/markdown, text/x-markdown
|
||||
if results.mimeType.isEmpty {
|
||||
results.mimeType = "text/x-markdown"
|
||||
}
|
||||
|
@ -346,7 +344,7 @@ import XLForm
|
|||
|
||||
if self.editorId == NCGlobal.shared.editorCollabora {
|
||||
|
||||
NextcloudKit.shared.createRichdocuments(path: fileNamePath, templateId: templateIdentifier) { account, url, data, error in
|
||||
NextcloudKit.shared.createRichdocuments(path: fileNamePath, templateId: templateIdentifier) { account, url, _, error in
|
||||
guard error == .success, account == self.appDelegate.account, let url = url else {
|
||||
self.navigationItem.rightBarButtonItem?.isEnabled = true
|
||||
NCContentPresenter.shared.showError(error: error)
|
||||
|
@ -385,7 +383,7 @@ import XLForm
|
|||
options = NKRequestOptions(customUserAgent: NCUtility.shared.getCustomUserAgentNCText())
|
||||
}
|
||||
|
||||
NextcloudKit.shared.NCTextGetListOfTemplates(options: options) { account, templates, data, error in
|
||||
NextcloudKit.shared.NCTextGetListOfTemplates(options: options) { account, templates, _, error in
|
||||
|
||||
self.indicator.stopAnimating()
|
||||
|
||||
|
@ -442,7 +440,7 @@ import XLForm
|
|||
|
||||
if self.editorId == NCGlobal.shared.editorCollabora {
|
||||
|
||||
NextcloudKit.shared.getTemplatesRichdocuments(typeTemplate: typeTemplate) { account, templates, data, error in
|
||||
NextcloudKit.shared.getTemplatesRichdocuments(typeTemplate: typeTemplate) { account, templates, _, error in
|
||||
|
||||
self.indicator.stopAnimating()
|
||||
|
||||
|
|
|
@ -67,7 +67,7 @@ class NCCreateFormUploadVoiceNote: XLFormViewController, NCSelectDelegate, AVAud
|
|||
// Progress view
|
||||
progressView.progress = 0
|
||||
progressView.progressTintColor = .green
|
||||
progressView.trackTintColor = UIColor(red: 247.0/255.0, green: 247.0/255.0, blue: 247.0/255.0, alpha: 1.0)
|
||||
progressView.trackTintColor = UIColor(red: 247.0 / 255.0, green: 247.0 / 255.0, blue: 247.0 / 255.0, alpha: 1.0)
|
||||
|
||||
labelTimer.textColor = .label
|
||||
labelDuration.textColor = .label
|
||||
|
@ -131,7 +131,7 @@ class NCCreateFormUploadVoiceNote: XLFormViewController, NCSelectDelegate, AVAud
|
|||
row.action.formSelector = #selector(changeDestinationFolder(_:))
|
||||
row.cellConfig["backgroundColor"] = cellBackgoundColor
|
||||
|
||||
row.cellConfig["imageView.image"] = UIImage(named: "folder")!.image(color: NCBrandColor.shared.brandElement, size: 25)
|
||||
row.cellConfig["imageView.image"] = UIImage(named: "folder")!.image(color: NCBrandColor.shared.brandElement, size: 25)
|
||||
|
||||
row.cellConfig["textLabel.textAlignment"] = NSTextAlignment.right.rawValue
|
||||
row.cellConfig["textLabel.font"] = UIFont.systemFont(ofSize: 15.0)
|
||||
|
@ -203,7 +203,7 @@ class NCCreateFormUploadVoiceNote: XLFormViewController, NCSelectDelegate, AVAud
|
|||
}
|
||||
|
||||
// Update
|
||||
let row: XLFormRowDescriptor = self.form.formRow(withTag: "ButtonDestinationFolder")!
|
||||
let row: XLFormRowDescriptor = self.form.formRow(withTag: "ButtonDestinationFolder")!
|
||||
row.title = self.titleServerUrl
|
||||
self.updateFormRow(row)
|
||||
}
|
||||
|
@ -211,7 +211,7 @@ class NCCreateFormUploadVoiceNote: XLFormViewController, NCSelectDelegate, AVAud
|
|||
|
||||
@objc func save() {
|
||||
|
||||
let rowFileName: XLFormRowDescriptor = self.form.formRow(withTag: "fileName")!
|
||||
let rowFileName: XLFormRowDescriptor = self.form.formRow(withTag: "fileName")!
|
||||
guard let name = rowFileName.value else {
|
||||
return
|
||||
}
|
||||
|
@ -234,7 +234,7 @@ class NCCreateFormUploadVoiceNote: XLFormViewController, NCSelectDelegate, AVAud
|
|||
if NCManageDatabase.shared.getMetadataConflict(account: appDelegate.account, serverUrl: serverUrl, fileNameView: fileNameSave) != nil {
|
||||
|
||||
guard let conflict = UIStoryboard(name: "NCCreateFormUploadConflict", bundle: nil).instantiateInitialViewController() as? NCCreateFormUploadConflict else { return }
|
||||
|
||||
|
||||
conflict.textLabelDetailNewFile = NSLocalizedString("_now_", comment: "")
|
||||
conflict.serverUrl = serverUrl
|
||||
conflict.metadatasUploadInConflict = [metadataForUpload]
|
||||
|
@ -291,7 +291,7 @@ class NCCreateFormUploadVoiceNote: XLFormViewController, NCSelectDelegate, AVAud
|
|||
// MARK: Player - Timer
|
||||
|
||||
func updateTimerUI() {
|
||||
labelTimer.text = String().formatSecondsToString(counterSecondPlayer)
|
||||
labelTimer.text = String().formatSecondsToString(counterSecondPlayer)
|
||||
labelDuration.text = String().formatSecondsToString(durationPlayer)
|
||||
progressView.progress = Float(counterSecondPlayer / durationPlayer)
|
||||
}
|
||||
|
|
|
@ -177,7 +177,7 @@ class NCMainTabBar: UITabBar {
|
|||
}
|
||||
|
||||
let centerButtonHeight: CGFloat = 57
|
||||
let centerButton = UIButton(frame: CGRect(x: (self.bounds.width / 2)-(centerButtonHeight/2), y: centerButtonY, width: centerButtonHeight, height: centerButtonHeight))
|
||||
let centerButton = UIButton(frame: CGRect(x: (self.bounds.width / 2) - (centerButtonHeight / 2), y: centerButtonY, width: centerButtonHeight, height: centerButtonHeight))
|
||||
|
||||
centerButton.setTitle("", for: .normal)
|
||||
centerButton.setImage(UIImage(named: "tabBarPlus")?.image(color: .white, size: 100), for: .normal)
|
||||
|
|
|
@ -33,7 +33,7 @@ class NCGridMediaCell: UICollectionViewCell, NCCellProtocol {
|
|||
private var objectId: String = ""
|
||||
private var user: String = ""
|
||||
var indexPath = IndexPath()
|
||||
|
||||
|
||||
var date: Date?
|
||||
|
||||
var filePreviewImageView: UIImageView? {
|
||||
|
|
|
@ -134,10 +134,10 @@ class NCMedia: UIViewController, NCEmptyDataSetDelegate, NCSelectDelegate {
|
|||
|
||||
override func viewDidAppear(_ animated: Bool) {
|
||||
super.viewDidAppear(animated)
|
||||
|
||||
|
||||
mediaCommandTitle()
|
||||
}
|
||||
|
||||
|
||||
override func viewWillDisappear(_ animated: Bool) {
|
||||
super.viewWillDisappear(animated)
|
||||
|
||||
|
@ -325,7 +325,7 @@ extension NCMedia: UICollectionViewDelegate {
|
|||
selectOcId.append(metadata.ocId)
|
||||
selectIndexPath.append(indexPath)
|
||||
}
|
||||
if indexPath.section < collectionView.numberOfSections && indexPath.row < collectionView.numberOfItems(inSection: indexPath.section) {
|
||||
if indexPath.section < collectionView.numberOfSections && indexPath.row < collectionView.numberOfItems(inSection: indexPath.section) {
|
||||
collectionView.reloadItems(at: [indexPath])
|
||||
}
|
||||
} else {
|
||||
|
@ -477,11 +477,11 @@ extension NCMedia {
|
|||
|
||||
switch CCUtility.getMediaSortDate() {
|
||||
case "date":
|
||||
self.metadatas = self.metadatas.sorted(by: {($0.date as Date) > ($1.date as Date)} )
|
||||
self.metadatas = self.metadatas.sorted(by: {($0.date as Date) > ($1.date as Date)})
|
||||
case "creationDate":
|
||||
self.metadatas = self.metadatas.sorted(by: {($0.creationDate as Date) > ($1.creationDate as Date)} )
|
||||
self.metadatas = self.metadatas.sorted(by: {($0.creationDate as Date) > ($1.creationDate as Date)})
|
||||
case "uploadDate":
|
||||
self.metadatas = self.metadatas.sorted(by: {($0.uploadDate as Date) > ($1.uploadDate as Date)} )
|
||||
self.metadatas = self.metadatas.sorted(by: {($0.uploadDate as Date) > ($1.uploadDate as Date)})
|
||||
default:
|
||||
break
|
||||
}
|
||||
|
@ -553,8 +553,8 @@ extension NCMedia {
|
|||
}
|
||||
|
||||
let options = NKRequestOptions(timeout: 300, queue: NextcloudKit.shared.nkCommonInstance.backgroundQueue)
|
||||
|
||||
NextcloudKit.shared.searchMedia(path: mediaPath, lessDate: lessDate, greaterDate: greaterDate, elementDate: "d:getlastmodified/", limit: limit, showHiddenFiles: CCUtility.getShowHiddenFiles(), options: options) { account, files, data, error in
|
||||
|
||||
NextcloudKit.shared.searchMedia(path: mediaPath, lessDate: lessDate, greaterDate: greaterDate, elementDate: "d:getlastmodified/", limit: limit, showHiddenFiles: CCUtility.getShowHiddenFiles(), options: options) { account, files, _, error in
|
||||
|
||||
self.oldInProgress = false
|
||||
DispatchQueue.main.async {
|
||||
|
@ -636,8 +636,8 @@ extension NCMedia {
|
|||
reloadDataThenPerform {
|
||||
|
||||
let options = NKRequestOptions(timeout: 300, queue: NextcloudKit.shared.nkCommonInstance.backgroundQueue)
|
||||
|
||||
NextcloudKit.shared.searchMedia(path: self.mediaPath, lessDate: lessDate, greaterDate: greaterDate, elementDate: "d:getlastmodified/", limit: limit, showHiddenFiles: CCUtility.getShowHiddenFiles(), options: options) { account, files, data, error in
|
||||
|
||||
NextcloudKit.shared.searchMedia(path: self.mediaPath, lessDate: lessDate, greaterDate: greaterDate, elementDate: "d:getlastmodified/", limit: limit, showHiddenFiles: CCUtility.getShowHiddenFiles(), options: options) { account, files, _, error in
|
||||
|
||||
self.newInProgress = false
|
||||
DispatchQueue.main.async {
|
||||
|
@ -670,7 +670,7 @@ extension NCMedia: UIScrollViewDelegate {
|
|||
|
||||
func scrollViewDidScroll(_ scrollView: UIScrollView) {
|
||||
|
||||
if lastContentOffsetY == 0 || lastContentOffsetY + cellHeigth/2 <= scrollView.contentOffset.y || lastContentOffsetY - cellHeigth/2 >= scrollView.contentOffset.y {
|
||||
if lastContentOffsetY == 0 || lastContentOffsetY + cellHeigth / 2 <= scrollView.contentOffset.y || lastContentOffsetY - cellHeigth / 2 >= scrollView.contentOffset.y {
|
||||
|
||||
mediaCommandTitle()
|
||||
lastContentOffsetY = scrollView.contentOffset.y
|
||||
|
|
|
@ -42,8 +42,7 @@ extension AppDelegate {
|
|||
NCMenuAction(
|
||||
title: NSLocalizedString("_upload_photos_videos_", comment: ""), icon: UIImage(named: "file_photo")!.image(color: UIColor.systemGray, size: 50), action: { _ in
|
||||
NCAskAuthorization.shared.askAuthorizationPhotoLibrary(viewController: viewController) { hasPermission in
|
||||
if hasPermission {
|
||||
NCPhotosPickerViewController.init(viewController: viewController, maxSelectedAssets: 0, singleSelectedMode: false)
|
||||
if hasPermission {NCPhotosPickerViewController(viewController: viewController, maxSelectedAssets: 0, singleSelectedMode: false)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -130,7 +130,7 @@ extension NCCollectionViewCommon {
|
|||
title: NSLocalizedString("_view_in_folder_", comment: ""),
|
||||
icon: NCUtility.shared.loadImage(named: "questionmark.folder"),
|
||||
order: 21,
|
||||
action: { menuAction in
|
||||
action: { _ in
|
||||
NCActionCenter.shared.openFileViewInFolder(serverUrl: metadata.serverUrl, fileNameBlink: metadata.fileName, fileNameOpen: nil)
|
||||
}
|
||||
)
|
||||
|
@ -175,7 +175,7 @@ extension NCCollectionViewCommon {
|
|||
icon: NCUtility.shared.loadImage(named: "lock"),
|
||||
order: 30,
|
||||
action: { _ in
|
||||
NextcloudKit.shared.markE2EEFolder(fileId: metadata.fileId, delete: true) { account, error in
|
||||
NextcloudKit.shared.markE2EEFolder(fileId: metadata.fileId, delete: true) { _, error in
|
||||
if error == .success {
|
||||
NCManageDatabase.shared.deleteE2eEncryption(predicate: NSPredicate(format: "account == %@ AND serverUrl == %@", self.appDelegate.account, serverUrl))
|
||||
NCManageDatabase.shared.setDirectory(serverUrl: serverUrl, serverUrlTo: nil, etag: nil, ocId: nil, fileId: nil, encrypted: false, richWorkspace: nil, account: metadata.account)
|
||||
|
@ -336,7 +336,7 @@ extension NCCollectionViewCommon {
|
|||
if metadata.isCopyableInPasteboard {
|
||||
actions.append(.copyAction(selectOcId: [metadata.ocId], hudView: self.view, order: 140))
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// MODIFY WITH QUICK LOOK
|
||||
//
|
||||
|
@ -346,7 +346,7 @@ extension NCCollectionViewCommon {
|
|||
title: NSLocalizedString("_modify_", comment: ""),
|
||||
icon: NCUtility.shared.loadImage(named: "pencil.tip.crop.circle"),
|
||||
order: 150,
|
||||
action: { menuAction in
|
||||
action: { _ in
|
||||
if CCUtility.fileProviderStorageExists(metadata) {
|
||||
NotificationCenter.default.postOnMainThread(name: NCGlobal.shared.notificationCenterDownloadedFile, userInfo: ["ocId": metadata.ocId, "selector": NCGlobal.shared.selectorLoadFileQuickLook, "error": NKError(), "account": metadata.account])
|
||||
} else {
|
||||
|
@ -377,7 +377,7 @@ extension NCCollectionViewCommon {
|
|||
)
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// DELETE
|
||||
//
|
||||
|
|
|
@ -105,7 +105,7 @@ extension NCMedia {
|
|||
title: NSLocalizedString("_play_from_files_", comment: ""),
|
||||
icon: NCUtility.shared.loadImage(named: "play.circle"),
|
||||
action: { _ in
|
||||
if let tabBarController = self.appDelegate.window?.rootViewController as? UITabBarController {
|
||||
if let tabBarController = self.appDelegate.window?.rootViewController as? UITabBarController {
|
||||
self.documentPickerViewController = NCDocumentPickerViewController(tabBarController: tabBarController, isViewerMedia: true, allowsMultipleSelection: false, viewController: self)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -30,7 +30,7 @@ extension NCViewer {
|
|||
func toggleMenu(viewController: UIViewController, metadata: tableMetadata, webView: Bool, imageIcon: UIImage?, indexPath: IndexPath = IndexPath()) {
|
||||
|
||||
guard let metadata = NCManageDatabase.shared.getMetadataFromOcId(metadata.ocId) else { return }
|
||||
|
||||
|
||||
var actions = [NCMenuAction]()
|
||||
var titleFavorite = NSLocalizedString("_add_favorites_", comment: "")
|
||||
if metadata.favorite { titleFavorite = NSLocalizedString("_remove_favorites_", comment: "") }
|
||||
|
@ -60,7 +60,7 @@ extension NCViewer {
|
|||
NCMenuAction(
|
||||
title: NSLocalizedString("_view_in_folder_", comment: ""),
|
||||
icon: NCUtility.shared.loadImage(named: "questionmark.folder"),
|
||||
action: { menuAction in
|
||||
action: { _ in
|
||||
NCActionCenter.shared.openFileViewInFolder(serverUrl: metadata.serverUrl, fileNameBlink: metadata.fileName, fileNameOpen: nil)
|
||||
}
|
||||
)
|
||||
|
@ -119,7 +119,7 @@ extension NCViewer {
|
|||
)
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// CONVERSION VIDEO TO MPEG4 (MFFF Lib)
|
||||
//
|
||||
|
|
|
@ -83,7 +83,7 @@ class NCMore: UIViewController, UITableViewDelegate, UITableViewDataSource {
|
|||
super.viewWillAppear(animated)
|
||||
|
||||
navigationController?.setGroupAppearance()
|
||||
|
||||
|
||||
appDelegate.activeViewController = self
|
||||
loadItems()
|
||||
tableView.reloadData()
|
||||
|
@ -305,7 +305,7 @@ class NCMore: UIViewController, UITableViewDelegate, UITableViewDataSource {
|
|||
func numberOfSections(in tableView: UITableView) -> Int {
|
||||
return sections.count
|
||||
}
|
||||
|
||||
|
||||
func tableView(_ tableView: UITableView, heightForHeaderInSection index: Int) -> CGFloat {
|
||||
let section = sections[index]
|
||||
|
||||
|
@ -358,7 +358,7 @@ class NCMore: UIViewController, UITableViewDelegate, UITableViewDataSource {
|
|||
cell.status.tapToScroll = false
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
cell.layer.maskedCorners = [.layerMaxXMinYCorner, .layerMinXMinYCorner, .layerMaxXMaxYCorner, .layerMinXMaxYCorner]
|
||||
|
||||
return cell
|
||||
|
@ -384,7 +384,7 @@ class NCMore: UIViewController, UITableViewDelegate, UITableViewDataSource {
|
|||
|
||||
cell.removeCornerRadius()
|
||||
let rows = tableView.numberOfRows(inSection: indexPath.section)
|
||||
|
||||
|
||||
if indexPath.row == 0 {
|
||||
cell.applyCornerRadius()
|
||||
if indexPath.row == rows - 1 {
|
||||
|
|
|
@ -100,7 +100,7 @@ class NCGlobal: NSObject {
|
|||
|
||||
// Nextcloud unsupported
|
||||
//
|
||||
let nextcloud_unsupported_version: Int = 16
|
||||
let nextcloud_unsupported_version: Int = 16
|
||||
|
||||
// Intro selector
|
||||
//
|
||||
|
@ -109,7 +109,7 @@ class NCGlobal: NSObject {
|
|||
|
||||
// Varie size GUI
|
||||
//
|
||||
@objc let heightCellSettings: CGFloat = 50
|
||||
@objc let heightCellSettings: CGFloat = 50
|
||||
|
||||
// Avatar & Preview size
|
||||
//
|
||||
|
@ -189,11 +189,11 @@ class NCGlobal: NSObject {
|
|||
|
||||
// Rich Workspace
|
||||
//
|
||||
let fileNameRichWorkspace = "Readme.md"
|
||||
let fileNameRichWorkspace = "Readme.md"
|
||||
|
||||
// Extension
|
||||
//
|
||||
@objc let extensionPreview = "ico"
|
||||
@objc let extensionPreview = "ico"
|
||||
|
||||
// ContentPresenter
|
||||
//
|
||||
|
@ -265,7 +265,7 @@ class NCGlobal: NSObject {
|
|||
@objc let permissionDefaultFileRemoteShareNoSupportShareOption: Int = 3
|
||||
@objc let permissionDefaultFolderRemoteShareNoSupportShareOption: Int = 15
|
||||
// ATTRIBUTES
|
||||
@objc let permissionDownloadShare: Int = 0
|
||||
@objc let permissionDownloadShare: Int = 0
|
||||
|
||||
// Filename Mask and Type
|
||||
//
|
||||
|
@ -319,7 +319,7 @@ class NCGlobal: NSObject {
|
|||
|
||||
// Hidden files included in the read
|
||||
//
|
||||
let includeHiddenFiles: [String] = [".LivePhoto"]
|
||||
let includeHiddenFiles: [String] = [".LivePhoto"]
|
||||
|
||||
// Auto upload subfolder granularity
|
||||
//
|
||||
|
@ -373,7 +373,7 @@ class NCGlobal: NSObject {
|
|||
let notificationCenterDownloadedThumbnail = "DownloadedThumbnail" // userInfo: ocId
|
||||
|
||||
let notificationCenterOpenMediaDetail = "openMediaDetail" // userInfo: ocId
|
||||
|
||||
|
||||
let notificationCenterDismissScanDocument = "dismissScanDocument"
|
||||
let notificationCenterDismissUploadAssets = "dismissUploadAssets"
|
||||
|
||||
|
@ -386,7 +386,7 @@ class NCGlobal: NSObject {
|
|||
let tipNCCollectionViewCommonAccountRequest = "tipnccollectionviewcommonaccountrequest"
|
||||
let tipNCScanAddImage = "tipncscanaddimage"
|
||||
let tipNCViewerMediaDetailView = "tipncviewermediadetailview"
|
||||
|
||||
|
||||
// ACTION
|
||||
//
|
||||
let actionNoAction = "no-action"
|
||||
|
@ -394,7 +394,7 @@ class NCGlobal: NSObject {
|
|||
let actionScanDocument = "add-scan-document"
|
||||
let actionTextDocument = "create-text-document"
|
||||
let actionVoiceMemo = "create-voice-memo"
|
||||
|
||||
|
||||
// WIDGET ACTION
|
||||
//
|
||||
let widgetActionNoAction = "nextcloud://open-action?action=no-action"
|
||||
|
@ -402,7 +402,7 @@ class NCGlobal: NSObject {
|
|||
let widgetActionScanDocument = "nextcloud://open-action?action=add-scan-document"
|
||||
let widgetActionTextDocument = "nextcloud://open-action?action=create-text-document"
|
||||
let widgetActionVoiceMemo = "nextcloud://open-action?action=create-voice-memo"
|
||||
|
||||
|
||||
// APPCONFIG
|
||||
//
|
||||
let configuration_brand = "brand"
|
||||
|
@ -411,7 +411,7 @@ class NCGlobal: NSObject {
|
|||
let configuration_username = "username"
|
||||
let configuration_password = "password"
|
||||
let configuration_apppassword = "apppassword"
|
||||
|
||||
|
||||
let configuration_disable_intro = "disable_intro"
|
||||
let configuration_disable_multiaccount = "disable_multiaccount"
|
||||
let configuration_disable_crash_service = "disable_crash_service"
|
||||
|
@ -424,7 +424,7 @@ class NCGlobal: NSObject {
|
|||
//
|
||||
var capabilityServerVersionMajor: Int = 0
|
||||
@objc var capabilityServerVersion: String = ""
|
||||
|
||||
|
||||
var capabilityFileSharingApiEnabled: Bool = false
|
||||
var capabilityFileSharingPubPasswdEnforced: Bool = false
|
||||
var capabilityFileSharingPubExpireDateEnforced: Bool = false
|
||||
|
@ -464,5 +464,5 @@ class NCGlobal: NSObject {
|
|||
let moreAppsUrl = "https://www.apple.com/us/search/nextcloud?src=globalnav"
|
||||
|
||||
// SNAPSHOT PREVIEW
|
||||
let defaultSnapshotConfiguration = "DefaultPreviewConfiguration"
|
||||
let defaultSnapshotConfiguration = "DefaultPreviewConfiguration"
|
||||
}
|
||||
|
|
|
@ -92,7 +92,7 @@ class NCNetworkingE2EE: NSObject {
|
|||
return (directory.fileId, lockE2EEFolderResults.e2eToken, lockE2EEFolderResults.error)
|
||||
}
|
||||
|
||||
func unlock(account: String, serverUrl: String) async -> () {
|
||||
func unlock(account: String, serverUrl: String) async {
|
||||
|
||||
guard let tableLock = NCManageDatabase.shared.getE2ETokenLock(account: account, serverUrl: serverUrl) else {
|
||||
return
|
||||
|
|
|
@ -47,7 +47,7 @@ class NCNetworkingE2EECreateFolder: NSObject {
|
|||
error = readFileOrFolderResults.error
|
||||
if error == .success, let file = readFileOrFolderResults.files.first {
|
||||
|
||||
// MARK AS E2EE
|
||||
// MARK: AS E2EE
|
||||
let markE2EEFolderResults = await NextcloudKit.shared.markE2EEFolder(fileId: file.fileId, delete: false)
|
||||
if markE2EEFolderResults.error != .success { return markE2EEFolderResults.error }
|
||||
|
||||
|
@ -112,7 +112,7 @@ class NCNetworkingE2EECreateFolder: NSObject {
|
|||
|
||||
// ** Unlock **
|
||||
await NCNetworkingE2EE.shared.unlock(account: account, serverUrl: serverUrl)
|
||||
|
||||
|
||||
if error == .success, let ocId = ocId {
|
||||
NotificationCenter.default.postOnMainThread(name: NCGlobal.shared.notificationCenterCreateFolder, userInfo: ["ocId": ocId, "serverUrl": serverUrl, "account": account, "e2ee": true, "withPush": withPush])
|
||||
}
|
||||
|
@ -157,7 +157,7 @@ class NCNetworkingE2EECreateFolder: NSObject {
|
|||
guard resultsEncode.error == .success, let e2eMetadata = resultsEncode.metadata else { return resultsEncode.error }
|
||||
|
||||
// send metadata
|
||||
let putE2EEMetadataResults = await NextcloudKit.shared.putE2EEMetadata(fileId: fileIdLock, e2eToken: e2eToken, e2eMetadata: e2eMetadata, signature: resultsEncode.signature, method: method)
|
||||
let putE2EEMetadataResults = await NextcloudKit.shared.putE2EEMetadata(fileId: fileIdLock, e2eToken: e2eToken, e2eMetadata: e2eMetadata, signature: resultsEncode.signature, method: method)
|
||||
return putE2EEMetadataResults.error
|
||||
}
|
||||
|
||||
|
@ -176,7 +176,7 @@ class NCNetworkingE2EECreateFolder: NSObject {
|
|||
|
||||
let resultsEncode = NCEndToEndMetadata().encodeMetadata(account: account, serverUrl: serverUrl, userId: userId)
|
||||
guard resultsEncode.error == .success, let e2eMetadata = resultsEncode.metadata else { return resultsEncode.error }
|
||||
|
||||
|
||||
let putE2EEMetadataResults = await NextcloudKit.shared.putE2EEMetadata(fileId: fileId, e2eToken: lockResults.e2eToken!, e2eMetadata: e2eMetadata, signature: resultsEncode.signature, method: "POST")
|
||||
let error = putE2EEMetadataResults.error
|
||||
|
||||
|
|
|
@ -84,7 +84,7 @@ class NCNetworkingE2EERename: NSObject {
|
|||
|
||||
// ** Unlock **
|
||||
await NCNetworkingE2EE.shared.unlock(account: metadata.account, serverUrl: metadata.serverUrl)
|
||||
|
||||
|
||||
if error == .success {
|
||||
NotificationCenter.default.postOnMainThread(name: NCGlobal.shared.notificationCenterRenameFile, userInfo: ["ocId": metadata.ocId, "account": metadata.account, "indexPath": indexPath])
|
||||
}
|
||||
|
|
|
@ -57,9 +57,9 @@ class NCNetworkingE2EEUpload: NSObject {
|
|||
metadata.sessionError = ""
|
||||
guard let result = NCManageDatabase.shared.addMetadata(metadata) else {
|
||||
return NKError(errorCode: NCGlobal.shared.errorUnexpectedResponseFromDB, errorDescription: NSLocalizedString("_e2e_error_", comment: ""))
|
||||
|
||||
|
||||
}
|
||||
guard let directory = NCManageDatabase.shared.getTableDirectory(predicate: NSPredicate(format: "account == %@ AND serverUrl == %@", metadata.account, metadata.serverUrl)) else {
|
||||
guard let directory = NCManageDatabase.shared.getTableDirectory(predicate: NSPredicate(format: "account == %@ AND serverUrl == %@", metadata.account, metadata.serverUrl)) else {
|
||||
return NKError(errorCode: NCGlobal.shared.errorUnexpectedResponseFromDB, errorDescription: NSLocalizedString("_e2e_error_", comment: ""))
|
||||
}
|
||||
metadata = result
|
||||
|
@ -167,11 +167,11 @@ class NCNetworkingE2EEUpload: NSObject {
|
|||
|
||||
// send metadata
|
||||
let putE2EEMetadataResults = await NextcloudKit.shared.putE2EEMetadata(fileId: fileId, e2eToken: e2eToken, e2eMetadata: e2eMetadata, signature: resultsEncode.signature, method: method)
|
||||
|
||||
|
||||
return putE2EEMetadataResults.error
|
||||
}
|
||||
|
||||
private func sendFile(metadata: tableMetadata, e2eToken: String, uploadE2EEDelegate: uploadE2EEDelegate? = nil) async -> (ocId: String?, etag: String?, date: NSDate? ,afError: AFError?, error: NKError) {
|
||||
private func sendFile(metadata: tableMetadata, e2eToken: String, uploadE2EEDelegate: uploadE2EEDelegate? = nil) async -> (ocId: String?, etag: String?, date: NSDate?, afError: AFError?, error: NKError) {
|
||||
|
||||
if metadata.chunk > 0 {
|
||||
|
||||
|
@ -180,8 +180,8 @@ class NCNetworkingE2EEUpload: NSObject {
|
|||
uploadE2EEDelegate?.start()
|
||||
} progressHandler: { totalBytesExpected, totalBytes, fractionCompleted in
|
||||
uploadE2EEDelegate?.uploadE2EEProgress(totalBytesExpected, totalBytes, fractionCompleted)
|
||||
} completion: { account, file, afError, error in
|
||||
continuation.resume(returning: (ocId: file?.ocId, etag: file?.etag, date: file?.date ,afError: afError, error: error))
|
||||
} completion: { _, file, afError, error in
|
||||
continuation.resume(returning: (ocId: file?.ocId, etag: file?.etag, date: file?.date, afError: afError, error: error))
|
||||
}
|
||||
})
|
||||
|
||||
|
@ -193,8 +193,8 @@ class NCNetworkingE2EEUpload: NSObject {
|
|||
uploadE2EEDelegate?.start()
|
||||
} progressHandler: { totalBytesExpected, totalBytes, fractionCompleted in
|
||||
uploadE2EEDelegate?.uploadE2EEProgress(totalBytesExpected, totalBytes, fractionCompleted)
|
||||
} completion: { account, ocId, etag, date, size, allHeaderFields, afError, error in
|
||||
continuation.resume(returning: (ocId: ocId, etag: etag, date: date ,afError: afError, error: error))
|
||||
} completion: { _, ocId, etag, date, _, _, afError, error in
|
||||
continuation.resume(returning: (ocId: ocId, etag: etag, date: date, afError: afError, error: error))
|
||||
}
|
||||
})
|
||||
}
|
||||
|
|
|
@ -139,13 +139,11 @@ class NCAutoUpload: NSObject {
|
|||
}
|
||||
|
||||
if account.autoUploadCreateSubfolder {
|
||||
if (autoUploadSubfolderGranularity == NCGlobal.shared.subfolderGranularityYearly) {
|
||||
if autoUploadSubfolderGranularity == NCGlobal.shared.subfolderGranularityYearly {
|
||||
serverUrl = autoUploadPath + "/" + year
|
||||
}
|
||||
else if (autoUploadSubfolderGranularity == NCGlobal.shared.subfolderGranularityDaily) {
|
||||
} else if autoUploadSubfolderGranularity == NCGlobal.shared.subfolderGranularityDaily {
|
||||
serverUrl = autoUploadPath + "/" + year + "/" + month + "/" + day
|
||||
}
|
||||
else { // Month Granularity is default
|
||||
} else { // Month Granularity is default
|
||||
serverUrl = autoUploadPath + "/" + year + "/" + month
|
||||
}
|
||||
} else {
|
||||
|
@ -159,7 +157,7 @@ class NCAutoUpload: NSObject {
|
|||
if ext == "HEIC" && CCUtility.getFormatCompatibility() {
|
||||
fileNameSearchMetadata = (fileNameSearchMetadata as NSString).deletingPathExtension + ".jpg"
|
||||
}
|
||||
|
||||
|
||||
if NCManageDatabase.shared.getMetadata(predicate: NSPredicate(format: "account == %@ AND serverUrl == %@ AND fileNameView == %@", account.account, serverUrl, fileNameSearchMetadata)) != nil {
|
||||
if selector == NCGlobal.shared.selectorUploadAutoUpload {
|
||||
NCManageDatabase.shared.addPhotoLibrary([asset], account: account.account)
|
||||
|
|
|
@ -39,7 +39,7 @@ import NextcloudKit
|
|||
var urlRequest = URLRequest(url: url)
|
||||
urlRequest.headers = NextcloudKit.shared.nkCommonInstance.getStandardHeaders()
|
||||
|
||||
let dataTask = defaultSession.dataTask(with: urlRequest) { (data, response, error) in
|
||||
let dataTask = defaultSession.dataTask(with: urlRequest) { data, _, error in
|
||||
if let error = error {
|
||||
NCContentPresenter.shared.showInfo(error: NKError(error: error))
|
||||
} else if let data = data {
|
||||
|
@ -103,7 +103,7 @@ import NextcloudKit
|
|||
// MARK: - Private functions
|
||||
|
||||
private func setupHandlers() {
|
||||
localServer?["/install"] = { request in
|
||||
localServer?["/install"] = { _ in
|
||||
switch self.serverState {
|
||||
case .Stopped:
|
||||
return .notFound()
|
||||
|
|
|
@ -54,16 +54,16 @@ class NCNetworking: NSObject, NKCommonDelegate {
|
|||
|
||||
var lastReachability: Bool = true
|
||||
var networkReachability: NKCommon.TypeReachability?
|
||||
let downloadRequest = ThreadSafeDictionary<String,DownloadRequest>()
|
||||
let uploadRequest = ThreadSafeDictionary<String,UploadRequest>()
|
||||
let uploadMetadataInBackground = ThreadSafeDictionary<String,tableMetadata>()
|
||||
let downloadRequest = ThreadSafeDictionary<String, DownloadRequest>()
|
||||
let uploadRequest = ThreadSafeDictionary<String, UploadRequest>()
|
||||
let uploadMetadataInBackground = ThreadSafeDictionary<String, tableMetadata>()
|
||||
var transferInForegorund: TransferInForegorund?
|
||||
|
||||
lazy var nkBackground: NKBackground = {
|
||||
let nckb = NKBackground(nkCommonInstance: NextcloudKit.shared.nkCommonInstance)
|
||||
return nckb
|
||||
}()
|
||||
|
||||
|
||||
public let sessionMaximumConnectionsPerHost = 5
|
||||
public let sessionIdentifierBackground: String = "com.nextcloud.session.upload.background"
|
||||
public let sessionIdentifierBackgroundWWan: String = "com.nextcloud.session.upload.backgroundWWan"
|
||||
|
@ -181,15 +181,15 @@ class NCNetworking: NSObject, NKCommonDelegate {
|
|||
|
||||
// extarct certificate txt
|
||||
saveX509Certificate(certificate, host: host, directoryCertificate: directoryCertificate)
|
||||
|
||||
let isServerTrusted = SecTrustEvaluateWithError(serverTrust, nil)
|
||||
|
||||
let isServerTrusted = SecTrustEvaluateWithError(serverTrust, nil)
|
||||
let certificateCopyData = SecCertificateCopyData(certificate)
|
||||
let data = CFDataGetBytePtr(certificateCopyData);
|
||||
let size = CFDataGetLength(certificateCopyData);
|
||||
let data = CFDataGetBytePtr(certificateCopyData)
|
||||
let size = CFDataGetLength(certificateCopyData)
|
||||
let certificateData = NSData(bytes: data, length: size)
|
||||
|
||||
|
||||
certificateData.write(toFile: directoryCertificate + "/" + host + ".tmp", atomically: true)
|
||||
|
||||
|
||||
if isServerTrusted {
|
||||
isTrusted = true
|
||||
} else if let certificateDataSaved = NSData(contentsOfFile: certificateSavedPath), certificateData.isEqual(to: certificateDataSaved as Data) {
|
||||
|
@ -221,9 +221,9 @@ class NCNetworking: NSObject, NKCommonDelegate {
|
|||
NextcloudKit.shared.nkCommonInstance.writeLog("[ERROR] Write certificare error")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
func saveX509Certificate(_ certificate: SecCertificate, host: String, directoryCertificate: String) {
|
||||
|
||||
|
||||
let certNamePathTXT = directoryCertificate + "/" + host + ".txt"
|
||||
let data: CFData = SecCertificateCopyData(certificate)
|
||||
let mem = BIO_new_mem_buf(CFDataGetBytePtr(data), Int32(CFDataGetLength(data)))
|
||||
|
@ -292,7 +292,7 @@ class NCNetworking: NSObject, NKCommonDelegate {
|
|||
}
|
||||
}
|
||||
|
||||
@objc func cancelAllTask() {
|
||||
func cancelAllTask() {
|
||||
NextcloudKit.shared.getSessionManager().getAllTasks { tasks in
|
||||
for task in tasks {
|
||||
task.cancel()
|
||||
|
@ -335,7 +335,7 @@ class NCNetworking: NSObject, NKCommonDelegate {
|
|||
}
|
||||
|
||||
func download(metadata: tableMetadata, selector: String, notificationCenterProgressTask: Bool = true,
|
||||
requestHandler: @escaping (_ request: DownloadRequest) -> () = { _ in },
|
||||
requestHandler: @escaping (_ request: DownloadRequest) -> Void = { _ in },
|
||||
progressHandler: @escaping (_ progress: Progress) -> Void = { _ in },
|
||||
completion: @escaping (_ afError: AFError?, _ error: NKError) -> Void) {
|
||||
|
||||
|
@ -353,24 +353,24 @@ class NCNetworking: NSObject, NKCommonDelegate {
|
|||
NextcloudKit.shared.download(serverUrlFileName: serverUrlFileName, fileNameLocalPath: fileNameLocalPath, queue: NextcloudKit.shared.nkCommonInstance.backgroundQueue, requestHandler: { request in
|
||||
|
||||
requestHandler(request)
|
||||
|
||||
|
||||
self.downloadRequest[fileNameLocalPath] = request
|
||||
|
||||
NCManageDatabase.shared.setMetadataSession(ocId: metadata.ocId, status: NCGlobal.shared.metadataStatusDownloading)
|
||||
NotificationCenter.default.postOnMainThread(name: NCGlobal.shared.notificationCenterDownloadStartFile, userInfo: ["ocId":metadata.ocId, "serverUrl": metadata.serverUrl, "account": metadata.account])
|
||||
|
||||
}, taskHandler: { (_) in
|
||||
|
||||
}, progressHandler: { (progress) in
|
||||
|
||||
NotificationCenter.default.postOnMainThread(name: NCGlobal.shared.notificationCenterDownloadStartFile, userInfo: ["ocId": metadata.ocId, "serverUrl": metadata.serverUrl, "account": metadata.account])
|
||||
|
||||
}, taskHandler: { _ in
|
||||
|
||||
}, progressHandler: { progress in
|
||||
|
||||
if notificationCenterProgressTask {
|
||||
NotificationCenter.default.postOnMainThread(name: NCGlobal.shared.notificationCenterProgressTask, object: nil, userInfo: ["account": metadata.account, "ocId": metadata.ocId, "fileName": metadata.fileName, "serverUrl": metadata.serverUrl, "status": NSNumber(value: NCGlobal.shared.metadataStatusInDownload), "progress": NSNumber(value: progress.fractionCompleted), "totalBytes": NSNumber(value: progress.totalUnitCount), "totalBytesExpected": NSNumber(value: progress.completedUnitCount)])
|
||||
}
|
||||
progressHandler(progress)
|
||||
|
||||
}) { (account, etag, date, _, allHeaderFields, afError, error) in
|
||||
|
||||
self.downloadRequest.removeValue(forKey:fileNameLocalPath)
|
||||
}) { _, etag, _, _, _, afError, error in
|
||||
|
||||
self.downloadRequest.removeValue(forKey: fileNameLocalPath)
|
||||
|
||||
if afError?.isExplicitlyCancelledError ?? false {
|
||||
|
||||
|
@ -402,9 +402,9 @@ class NCNetworking: NSObject, NKCommonDelegate {
|
|||
|
||||
func upload(metadata: tableMetadata,
|
||||
uploadE2EEDelegate: uploadE2EEDelegate? = nil,
|
||||
start: @escaping () -> () = { },
|
||||
progressHandler: @escaping (_ totalBytesExpected: Int64, _ totalBytes: Int64, _ fractionCompleted: Double) -> () = { _, _, _ in },
|
||||
completion: @escaping (_ error: NKError) -> () = { error in }) {
|
||||
start: @escaping () -> Void = { },
|
||||
progressHandler: @escaping (_ totalBytesExpected: Int64, _ totalBytes: Int64, _ fractionCompleted: Double) -> Void = { _, _, _ in },
|
||||
completion: @escaping (_ error: NKError) -> Void = { _ in }) {
|
||||
|
||||
let metadata = tableMetadata.init(value: metadata)
|
||||
NextcloudKit.shared.nkCommonInstance.writeLog("[INFO] Upload file \(metadata.fileNameView) with Identifier \(metadata.assetLocalIdentifier) with size \(metadata.size) [CHUNK \(metadata.chunk), E2EE \(metadata.isDirectoryE2EE)]")
|
||||
|
@ -422,7 +422,7 @@ class NCNetworking: NSObject, NKCommonDelegate {
|
|||
}
|
||||
} else if metadata.session == NextcloudKit.shared.nkCommonInstance.sessionIdentifierUpload {
|
||||
let fileNameLocalPath = CCUtility.getDirectoryProviderStorageOcId(metadata.ocId, fileNameView: metadata.fileNameView)!
|
||||
uploadFile(metadata: metadata, fileNameLocalPath:fileNameLocalPath, start: start, progressHandler: progressHandler) { _, _, _, _, _, _, _, error in
|
||||
uploadFile(metadata: metadata, fileNameLocalPath: fileNameLocalPath, start: start, progressHandler: progressHandler) { _, _, _, _, _, _, _, error in
|
||||
completion(error)
|
||||
}
|
||||
} else {
|
||||
|
@ -436,9 +436,9 @@ class NCNetworking: NSObject, NKCommonDelegate {
|
|||
fileNameLocalPath: String,
|
||||
withUploadComplete: Bool = true,
|
||||
addCustomHeaders: [String: String]? = nil,
|
||||
start: @escaping () -> () = { },
|
||||
progressHandler: @escaping (_ totalBytesExpected: Int64, _ totalBytes: Int64, _ fractionCompleted: Double) -> () = { _, _, _ in },
|
||||
completion: @escaping (_ account: String, _ ocId: String?, _ etag: String?, _ date: NSDate?, _ size: Int64, _ allHeaderFields: [AnyHashable : Any]?, _ afError: AFError?, _ error: NKError) -> Void) {
|
||||
start: @escaping () -> Void = { },
|
||||
progressHandler: @escaping (_ totalBytesExpected: Int64, _ totalBytes: Int64, _ fractionCompleted: Double) -> Void = { _, _, _ in },
|
||||
completion: @escaping (_ account: String, _ ocId: String?, _ etag: String?, _ date: NSDate?, _ size: Int64, _ allHeaderFields: [AnyHashable: Any]?, _ afError: AFError?, _ error: NKError) -> Void) {
|
||||
|
||||
let serverUrlFileName = metadata.serverUrl + "/" + metadata.fileName
|
||||
var uploadTask: URLSessionTask?
|
||||
|
@ -484,8 +484,8 @@ class NCNetworking: NSObject, NKCommonDelegate {
|
|||
func uploadChunkFile(metadata: tableMetadata,
|
||||
withUploadComplete: Bool = true,
|
||||
addCustomHeaders: [String: String] = [:],
|
||||
start: @escaping () -> () = { },
|
||||
progressHandler: @escaping (_ totalBytesExpected: Int64, _ totalBytes: Int64, _ fractionCompleted: Double) -> () = { _, _, _ in },
|
||||
start: @escaping () -> Void = { },
|
||||
progressHandler: @escaping (_ totalBytesExpected: Int64, _ totalBytes: Int64, _ fractionCompleted: Double) -> Void = { _, _, _ in },
|
||||
completion: @escaping (_ account: String, _ file: NKFile?, _ afError: AFError?, _ error: NKError) -> Void) {
|
||||
|
||||
let directory = CCUtility.getDirectoryProviderStorageOcId(metadata.ocId)!
|
||||
|
@ -545,7 +545,7 @@ class NCNetworking: NSObject, NKCommonDelegate {
|
|||
|
||||
NCManageDatabase.shared.deleteChunk(account: metadata.account, ocId: metadata.ocId, fileChunk: fileChunk, directory: directory)
|
||||
|
||||
} completion: { account, filesChunk, file, afError, error in
|
||||
} completion: { account, _, file, afError, error in
|
||||
|
||||
self.uploadRequest.removeValue(forKey: fileNameLocalPath)
|
||||
|
||||
|
@ -586,7 +586,7 @@ class NCNetworking: NSObject, NKCommonDelegate {
|
|||
}
|
||||
|
||||
private func uploadFileInBackground(metadata: tableMetadata,
|
||||
start: @escaping () -> () = { },
|
||||
start: @escaping () -> Void = { },
|
||||
completion: @escaping (_ error: NKError) -> Void) {
|
||||
|
||||
var session: URLSession?
|
||||
|
@ -688,13 +688,13 @@ class NCNetworking: NSObject, NKCommonDelegate {
|
|||
DispatchQueue.main.async {
|
||||
let newFileName = NCUtilityFileSystem.shared.createFileName(metadata.fileName, serverUrl: metadata.serverUrl, account: metadata.account)
|
||||
let alertController = UIAlertController(title: error.errorDescription, message: NSLocalizedString("_change_upload_filename_", comment: ""), preferredStyle: .alert)
|
||||
alertController.addAction(UIAlertAction(title: String(format: NSLocalizedString("_save_file_as_", comment: ""), newFileName), style: .default, handler: { action in
|
||||
alertController.addAction(UIAlertAction(title: String(format: NSLocalizedString("_save_file_as_", comment: ""), newFileName), style: .default, handler: { _ in
|
||||
let atpath = CCUtility.getDirectoryProviderStorageOcId(metadata.ocId) + "/" + metadata.fileName
|
||||
let toPath = CCUtility.getDirectoryProviderStorageOcId(metadata.ocId) + "/" + newFileName
|
||||
NCUtilityFileSystem.shared.moveFile(atPath: atpath, toPath: toPath)
|
||||
NCManageDatabase.shared.setMetadataSession(ocId: metadata.ocId, newFileName: newFileName, session: nil, sessionError: "", sessionTaskIdentifier: 0, status: NCGlobal.shared.metadataStatusWaitUpload)
|
||||
}))
|
||||
alertController.addAction(UIAlertAction(title: NSLocalizedString("_discard_changes_", comment: ""), style: .destructive, handler: { action in
|
||||
alertController.addAction(UIAlertAction(title: NSLocalizedString("_discard_changes_", comment: ""), style: .destructive, handler: { _ in
|
||||
CCUtility.removeFile(atPath: CCUtility.getDirectoryProviderStorageOcId(metadata.ocId))
|
||||
NCManageDatabase.shared.deleteMetadata(predicate: NSPredicate(format: "ocId == %@", metadata.ocId))
|
||||
NotificationCenter.default.postOnMainThread(name: NCGlobal.shared.notificationCenterUploadCancelFile, userInfo: ["ocId": metadata.ocId, "serverUrl": metadata.serverUrl, "account": metadata.account])
|
||||
|
@ -713,7 +713,7 @@ class NCNetworking: NSObject, NKCommonDelegate {
|
|||
|
||||
// Update Badge
|
||||
let counterBadge = NCManageDatabase.shared.getMetadatas(predicate: NSPredicate(format: "status == %d OR status == %d OR status == %d", NCGlobal.shared.metadataStatusWaitUpload, NCGlobal.shared.metadataStatusInUpload, NCGlobal.shared.metadataStatusUploading))
|
||||
NotificationCenter.default.postOnMainThread(name: NCGlobal.shared.notificationCenterUpdateBadgeNumber, userInfo: ["counter":counterBadge.count])
|
||||
NotificationCenter.default.postOnMainThread(name: NCGlobal.shared.notificationCenterUpdateBadgeNumber, userInfo: ["counter": counterBadge.count])
|
||||
|
||||
self.uploadMetadataInBackground.removeValue(forKey: fileName + serverUrl)
|
||||
self.delegate?.uploadComplete?(fileName: fileName, serverUrl: serverUrl, ocId: ocId, etag: etag, date: date, size: size, description: description, task: task, error: error)
|
||||
|
@ -726,10 +726,10 @@ class NCNetworking: NSObject, NKCommonDelegate {
|
|||
var metadata: tableMetadata?
|
||||
let description: String = task.taskDescription ?? ""
|
||||
|
||||
if let metadataTmp = self.uploadMetadataInBackground[fileName+serverUrl] {
|
||||
if let metadataTmp = self.uploadMetadataInBackground[fileName + serverUrl] {
|
||||
metadata = metadataTmp
|
||||
} else if let metadataTmp = NCManageDatabase.shared.getMetadataFromOcId(description) {
|
||||
self.uploadMetadataInBackground[fileName+serverUrl] = metadataTmp
|
||||
self.uploadMetadataInBackground[fileName + serverUrl] = metadataTmp
|
||||
metadata = metadataTmp
|
||||
}
|
||||
|
||||
|
@ -768,14 +768,12 @@ class NCNetworking: NSObject, NKCommonDelegate {
|
|||
})
|
||||
}
|
||||
|
||||
|
||||
|
||||
// MARK: - Transfer (Download Upload)
|
||||
|
||||
@objc func cancelTransferMetadata(_ metadata: tableMetadata, completion: @escaping () -> Void) {
|
||||
func cancelTransferMetadata(_ metadata: tableMetadata, completion: @escaping () -> Void) {
|
||||
|
||||
let metadata = tableMetadata.init(value: metadata)
|
||||
|
||||
|
||||
if metadata.session.count == 0 {
|
||||
NCManageDatabase.shared.deleteMetadata(predicate: NSPredicate(format: "ocId == %@", metadata.ocId))
|
||||
return completion()
|
||||
|
@ -834,7 +832,7 @@ class NCNetworking: NSObject, NKCommonDelegate {
|
|||
}
|
||||
}
|
||||
|
||||
@objc func cancelAllTransfer(account: String, completion: @escaping () -> Void) {
|
||||
func cancelAllTransfer(account: String, completion: @escaping () -> Void) {
|
||||
|
||||
NCManageDatabase.shared.deleteMetadata(predicate: NSPredicate(format: "status == %d OR status == %d", account, NCGlobal.shared.metadataStatusWaitUpload, NCGlobal.shared.metadataStatusUploadError))
|
||||
|
||||
|
@ -881,11 +879,11 @@ class NCNetworking: NSObject, NKCommonDelegate {
|
|||
|
||||
// MARK: - WebDav Read file, folder
|
||||
|
||||
@objc func readFolder(serverUrl: String, account: String, completion: @escaping (_ account: String, _ metadataFolder: tableMetadata?, _ metadatas: [tableMetadata]?, _ metadatasUpdate: [tableMetadata]?, _ metadatasLocalUpdate: [tableMetadata]?, _ metadatasDelete: [tableMetadata]?, _ error: NKError) -> Void) {
|
||||
func readFolder(serverUrl: String, account: String, completion: @escaping (_ account: String, _ metadataFolder: tableMetadata?, _ metadatas: [tableMetadata]?, _ metadatasUpdate: [tableMetadata]?, _ metadatasLocalUpdate: [tableMetadata]?, _ metadatasDelete: [tableMetadata]?, _ error: NKError) -> Void) {
|
||||
|
||||
let options = NKRequestOptions(queue: NextcloudKit.shared.nkCommonInstance.backgroundQueue)
|
||||
|
||||
NextcloudKit.shared.readFileOrFolder(serverUrlFileName: serverUrl, depth: "1", showHiddenFiles: CCUtility.getShowHiddenFiles(), includeHiddenFiles: NCGlobal.shared.includeHiddenFiles ,options: options) { account, files, _, error in
|
||||
|
||||
NextcloudKit.shared.readFileOrFolder(serverUrlFileName: serverUrl, depth: "1", showHiddenFiles: CCUtility.getShowHiddenFiles(), includeHiddenFiles: NCGlobal.shared.includeHiddenFiles, options: options) { account, files, _, error in
|
||||
guard error == .success else {
|
||||
completion(account, nil, nil, nil, nil, nil, error)
|
||||
return
|
||||
|
@ -968,15 +966,15 @@ class NCNetworking: NSObject, NKCommonDelegate {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
//MARK: - Search
|
||||
|
||||
|
||||
// MARK: - Search
|
||||
|
||||
/// WebDAV search
|
||||
func searchFiles(urlBase: NCUserBaseUrl, literal: String, completion: @escaping (_ metadatas: [tableMetadata]?, _ error: NKError) -> ()) {
|
||||
func searchFiles(urlBase: NCUserBaseUrl, literal: String, completion: @escaping (_ metadatas: [tableMetadata]?, _ error: NKError) -> Void) {
|
||||
|
||||
let options = NKRequestOptions(queue: NextcloudKit.shared.nkCommonInstance.backgroundQueue)
|
||||
|
||||
NextcloudKit.shared.searchLiteral(serverUrl: urlBase.urlBase, depth: "infinity", literal: literal, showHiddenFiles: CCUtility.getShowHiddenFiles(), options: options) { (account, files, data, error) in
|
||||
NextcloudKit.shared.searchLiteral(serverUrl: urlBase.urlBase, depth: "infinity", literal: literal, showHiddenFiles: CCUtility.getShowHiddenFiles(), options: options) { account, files, _, error in
|
||||
guard error == .success else {
|
||||
return completion(nil, error)
|
||||
}
|
||||
|
@ -998,7 +996,7 @@ class NCNetworking: NSObject, NKCommonDelegate {
|
|||
|
||||
/// Unified Search (NC>=20)
|
||||
///
|
||||
func unifiedSearchFiles(userBaseUrl: NCUserBaseUrl, literal: String, providers: @escaping (_ accout: String, _ searchProviders: [NKSearchProvider]?) -> Void, update: @escaping (_ account: String, _ id: String, NKSearchResult?, [tableMetadata]?) -> Void, completion: @escaping (_ account: String, _ error: NKError) -> ()) {
|
||||
func unifiedSearchFiles(userBaseUrl: NCUserBaseUrl, literal: String, providers: @escaping (_ accout: String, _ searchProviders: [NKSearchProvider]?) -> Void, update: @escaping (_ account: String, _ id: String, NKSearchResult?, [tableMetadata]?) -> Void, completion: @escaping (_ account: String, _ error: NKError) -> Void) {
|
||||
|
||||
let dispatchGroup = DispatchGroup()
|
||||
dispatchGroup.enter()
|
||||
|
@ -1006,7 +1004,7 @@ class NCNetworking: NSObject, NKCommonDelegate {
|
|||
completion(userBaseUrl.account, NKError())
|
||||
}
|
||||
|
||||
NextcloudKit.shared.unifiedSearch(term: literal, timeout: 30, timeoutProvider: 90) { provider in
|
||||
NextcloudKit.shared.unifiedSearch(term: literal, timeout: 30, timeoutProvider: 90) { _ in
|
||||
// example filter
|
||||
// ["calendar", "files", "fulltextsearch"].contains(provider.id)
|
||||
return true
|
||||
|
@ -1016,7 +1014,7 @@ class NCNetworking: NSObject, NKCommonDelegate {
|
|||
}
|
||||
} providers: { account, searchProviders in
|
||||
providers(account, searchProviders)
|
||||
} update: { account, partialResult, provider, error in
|
||||
} update: { account, partialResult, provider, _ in
|
||||
guard let partialResult = partialResult else { return }
|
||||
var metadatas: [tableMetadata] = []
|
||||
|
||||
|
@ -1028,7 +1026,7 @@ class NCNetworking: NSObject, NKCommonDelegate {
|
|||
metadatas.append(metadata)
|
||||
} else if let filePath = entry.filePath {
|
||||
let semaphore = DispatchSemaphore(value: 0)
|
||||
self.loadMetadata(userBaseUrl: userBaseUrl, filePath: filePath, dispatchGroup: dispatchGroup) { account, metadata, error in
|
||||
self.loadMetadata(userBaseUrl: userBaseUrl, filePath: filePath, dispatchGroup: dispatchGroup) { _, metadata, _ in
|
||||
metadatas.append(metadata)
|
||||
semaphore.signal()
|
||||
}
|
||||
|
@ -1050,7 +1048,7 @@ class NCNetworking: NSObject, NKCommonDelegate {
|
|||
metadatas.append(metadata)
|
||||
} else {
|
||||
let semaphore = DispatchSemaphore(value: 0)
|
||||
self.loadMetadata(userBaseUrl: userBaseUrl, filePath: dir + filename, dispatchGroup: dispatchGroup) { account, metadata, error in
|
||||
self.loadMetadata(userBaseUrl: userBaseUrl, filePath: dir + filename, dispatchGroup: dispatchGroup) { _, metadata, _ in
|
||||
metadatas.append(metadata)
|
||||
semaphore.signal()
|
||||
}
|
||||
|
@ -1064,17 +1062,17 @@ class NCNetworking: NSObject, NKCommonDelegate {
|
|||
})
|
||||
}
|
||||
update(account, provider.id, partialResult, metadatas)
|
||||
} completion: { account, data, error in
|
||||
} completion: { _, _, _ in
|
||||
self.requestsUnifiedSearch.removeAll()
|
||||
dispatchGroup.leave()
|
||||
}
|
||||
}
|
||||
|
||||
func unifiedSearchFilesProvider(userBaseUrl: NCUserBaseUrl, id: String, term: String, limit: Int, cursor: Int, completion: @escaping (_ account: String, _ searchResult: NKSearchResult?, _ metadatas: [tableMetadata]?, _ error: NKError) -> ()) {
|
||||
func unifiedSearchFilesProvider(userBaseUrl: NCUserBaseUrl, id: String, term: String, limit: Int, cursor: Int, completion: @escaping (_ account: String, _ searchResult: NKSearchResult?, _ metadatas: [tableMetadata]?, _ error: NKError) -> Void) {
|
||||
|
||||
var metadatas: [tableMetadata] = []
|
||||
|
||||
let request = NextcloudKit.shared.searchProvider(id, account: userBaseUrl.account, term: term, limit: limit, cursor: cursor, timeout: 60) { account, searchResult, data, error in
|
||||
let request = NextcloudKit.shared.searchProvider(id, account: userBaseUrl.account, term: term, limit: limit, cursor: cursor, timeout: 60) { account, searchResult, _, error in
|
||||
guard let searchResult = searchResult else {
|
||||
completion(account, nil, metadatas, error)
|
||||
return
|
||||
|
@ -1087,7 +1085,7 @@ class NCNetworking: NSObject, NKCommonDelegate {
|
|||
metadatas.append(metadata)
|
||||
} else if let filePath = entry.filePath {
|
||||
let semaphore = DispatchSemaphore(value: 0)
|
||||
self.loadMetadata(userBaseUrl: userBaseUrl, filePath: filePath, dispatchGroup: nil) { account, metadata, error in
|
||||
self.loadMetadata(userBaseUrl: userBaseUrl, filePath: filePath, dispatchGroup: nil) { _, metadata, _ in
|
||||
metadatas.append(metadata)
|
||||
semaphore.signal()
|
||||
}
|
||||
|
@ -1105,7 +1103,7 @@ class NCNetworking: NSObject, NKCommonDelegate {
|
|||
metadatas.append(metadata)
|
||||
} else {
|
||||
let semaphore = DispatchSemaphore(value: 0)
|
||||
self.loadMetadata(userBaseUrl: userBaseUrl, filePath: dir + filename, dispatchGroup: nil) { account, metadata, error in
|
||||
self.loadMetadata(userBaseUrl: userBaseUrl, filePath: dir + filename, dispatchGroup: nil) { _, metadata, _ in
|
||||
metadatas.append(metadata)
|
||||
semaphore.signal()
|
||||
}
|
||||
|
@ -1147,11 +1145,11 @@ class NCNetworking: NSObject, NKCommonDelegate {
|
|||
|
||||
// MARK: - WebDav Create Folder
|
||||
|
||||
func createFolder(fileName: String, serverUrl: String, account: String, urlBase: String, userId: String, overwrite: Bool = false, withPush:Bool, completion: @escaping (_ error: NKError) -> Void) {
|
||||
func createFolder(fileName: String, serverUrl: String, account: String, urlBase: String, userId: String, overwrite: Bool = false, withPush: Bool, completion: @escaping (_ error: NKError) -> Void) {
|
||||
|
||||
let isDirectoryEncrypted = NCUtility.shared.isDirectoryE2EE(account: account, urlBase: urlBase, userId: userId, serverUrl: serverUrl)
|
||||
let fileName = fileName.trimmingCharacters(in: .whitespacesAndNewlines)
|
||||
|
||||
|
||||
if isDirectoryEncrypted {
|
||||
#if !EXTENSION
|
||||
Task {
|
||||
|
@ -1164,7 +1162,7 @@ class NCNetworking: NSObject, NKCommonDelegate {
|
|||
}
|
||||
}
|
||||
|
||||
private func createFolderPlain(fileName: String, serverUrl: String, account: String, urlBase: String, overwrite: Bool, withPush:Bool, completion: @escaping (_ error: NKError) -> Void) {
|
||||
private func createFolderPlain(fileName: String, serverUrl: String, account: String, urlBase: String, overwrite: Bool, withPush: Bool, completion: @escaping (_ error: NKError) -> Void) {
|
||||
|
||||
var fileNameFolder = CCUtility.removeForbiddenCharactersServer(fileName)!
|
||||
|
||||
|
@ -1176,7 +1174,7 @@ class NCNetworking: NSObject, NKCommonDelegate {
|
|||
}
|
||||
let fileNameFolderUrl = serverUrl + "/" + fileNameFolder
|
||||
|
||||
NextcloudKit.shared.createFolder(serverUrlFileName: fileNameFolderUrl) { account, ocId, _, error in
|
||||
NextcloudKit.shared.createFolder(serverUrlFileName: fileNameFolderUrl) { account, _, _, error in
|
||||
guard error == .success else {
|
||||
if error.errorCode == NCGlobal.shared.errordMethodNotSupported && overwrite {
|
||||
completion(NKError())
|
||||
|
@ -1186,7 +1184,7 @@ class NCNetworking: NSObject, NKCommonDelegate {
|
|||
return
|
||||
}
|
||||
|
||||
self.readFile(serverUrlFileName: fileNameFolderUrl) { (account, metadataFolder, error) in
|
||||
self.readFile(serverUrlFileName: fileNameFolderUrl) { account, metadataFolder, error in
|
||||
|
||||
if error == .success {
|
||||
if let metadata = metadataFolder {
|
||||
|
@ -1202,13 +1200,13 @@ class NCNetworking: NSObject, NKCommonDelegate {
|
|||
}
|
||||
}
|
||||
|
||||
func createFolder(assets: [PHAsset], selector: String, useSubFolder: Bool, account: String, urlBase: String, userId: String, withPush:Bool) -> Bool {
|
||||
func createFolder(assets: [PHAsset], selector: String, useSubFolder: Bool, account: String, urlBase: String, userId: String, withPush: Bool) -> Bool {
|
||||
|
||||
let autoUploadPath = NCManageDatabase.shared.getAccountAutoUploadPath(urlBase: urlBase, userId: userId, account: account)
|
||||
let serverUrlBase = NCManageDatabase.shared.getAccountAutoUploadDirectory(urlBase: urlBase, userId: userId, account: account)
|
||||
let fileNameBase = NCManageDatabase.shared.getAccountAutoUploadFileName()
|
||||
let fileNameBase = NCManageDatabase.shared.getAccountAutoUploadFileName()
|
||||
let autoUploadSubfolderGranularity = NCManageDatabase.shared.getAccountAutoUploadSubfolderGranularity()
|
||||
|
||||
|
||||
func createFolder(fileName: String, serverUrl: String) -> Bool {
|
||||
var result: Bool = false
|
||||
let semaphore = DispatchSemaphore(value: 0)
|
||||
|
@ -1397,10 +1395,10 @@ class NCNetworking: NSObject, NKCommonDelegate {
|
|||
}
|
||||
|
||||
func listingFavoritescompletion(selector: String, completion: @escaping (_ account: String, _ metadatas: [tableMetadata]?, _ error: NKError) -> Void) {
|
||||
|
||||
|
||||
let options = NKRequestOptions(queue: NextcloudKit.shared.nkCommonInstance.backgroundQueue)
|
||||
|
||||
NextcloudKit.shared.listingFavorites(showHiddenFiles: CCUtility.getShowHiddenFiles(), options: options) { account, files, data, error in
|
||||
NextcloudKit.shared.listingFavorites(showHiddenFiles: CCUtility.getShowHiddenFiles(), options: options) { account, files, _, error in
|
||||
guard error == .success else {
|
||||
completion(account, nil, error)
|
||||
return
|
||||
|
@ -1423,14 +1421,14 @@ class NCNetworking: NSObject, NKCommonDelegate {
|
|||
// MARK: - Lock Files
|
||||
|
||||
func lockUnlockFile(_ metadata: tableMetadata, shoulLock: Bool) {
|
||||
NextcloudKit.shared.lockUnlockFile(serverUrlFileName: metadata.serverUrl + "/" + metadata.fileName, shouldLock: shoulLock) { account, error in
|
||||
NextcloudKit.shared.lockUnlockFile(serverUrlFileName: metadata.serverUrl + "/" + metadata.fileName, shouldLock: shoulLock) { _, error in
|
||||
// 0: lock was successful; 412: lock did not change, no error, refresh
|
||||
guard error == .success || error.errorCode == NCGlobal.shared.errorPreconditionFailed else {
|
||||
let error = NKError(errorCode: error.errorCode, errorDescription: "_files_lock_error_")
|
||||
NCContentPresenter.shared.messageNotification(metadata.fileName, error: error, delay: NCGlobal.shared.dismissAfterSecond, type: NCContentPresenter.messageType.error, priority: .max)
|
||||
return
|
||||
}
|
||||
NCNetworking.shared.readFile(serverUrlFileName: metadata.serverUrl + "/" + metadata.fileName) { account, metadata, error in
|
||||
NCNetworking.shared.readFile(serverUrlFileName: metadata.serverUrl + "/" + metadata.fileName) { _, metadata, error in
|
||||
guard error == .success, let metadata = metadata else { return }
|
||||
NCManageDatabase.shared.addMetadata(metadata)
|
||||
NotificationCenter.default.postOnMainThread(name: NCGlobal.shared.notificationCenterReloadDataSource)
|
||||
|
@ -1495,7 +1493,7 @@ class NCNetworking: NSObject, NKCommonDelegate {
|
|||
let fileNameToPath = metadata.serverUrl + "/" + fileNameNew
|
||||
let ocId = metadata.ocId
|
||||
|
||||
NextcloudKit.shared.moveFileOrFolder(serverUrlFileNameSource: fileNamePath, serverUrlFileNameDestination: fileNameToPath, overwrite: false) { account, error in
|
||||
NextcloudKit.shared.moveFileOrFolder(serverUrlFileNameSource: fileNamePath, serverUrlFileNameDestination: fileNameToPath, overwrite: false) { _, error in
|
||||
|
||||
if error == .success {
|
||||
|
||||
|
@ -1545,7 +1543,7 @@ class NCNetworking: NSObject, NKCommonDelegate {
|
|||
|
||||
// MARK: - WebDav Move
|
||||
|
||||
@objc func moveMetadata(_ metadata: tableMetadata, serverUrlTo: String, overwrite: Bool) async -> (NKError) {
|
||||
func moveMetadata(_ metadata: tableMetadata, serverUrlTo: String, overwrite: Bool) async -> (NKError) {
|
||||
|
||||
if let metadataLive = NCManageDatabase.shared.getMetadataLivePhoto(metadata: metadata) {
|
||||
let error = await moveMetadataPlain(metadataLive, serverUrlTo: serverUrlTo, overwrite: overwrite)
|
||||
|
@ -1621,7 +1619,7 @@ class NCNetworking: NSObject, NKCommonDelegate {
|
|||
} else if CCUtility.fileProviderStorageExists(metadata) {
|
||||
completition(URL(fileURLWithPath: CCUtility.getDirectoryProviderStorageOcId(metadata.ocId, fileNameView: metadata.fileNameView)), false, .success)
|
||||
} else {
|
||||
NextcloudKit.shared.getDirectDownload(fileId: metadata.fileId) { account, url, data, error in
|
||||
NextcloudKit.shared.getDirectDownload(fileId: metadata.fileId) { _, url, _, error in
|
||||
if error == .success && url != nil {
|
||||
if let url = URL(string: url!) {
|
||||
completition(url, false, error)
|
||||
|
@ -1639,7 +1637,7 @@ class NCNetworking: NSObject, NKCommonDelegate {
|
|||
|
||||
func getPreview(url: URL,
|
||||
options: NKRequestOptions = NKRequestOptions()) async -> (account: String, data: Data?, error: NKError) {
|
||||
|
||||
|
||||
await withUnsafeContinuation({ continuation in
|
||||
NextcloudKit.shared.getPreview(url: url, options: options) { account, data, error in
|
||||
continuation.resume(returning: (account: account, data: data, error: error))
|
||||
|
|
|
@ -46,7 +46,7 @@ class NCNetworkingCheckRemoteUser {
|
|||
return
|
||||
}
|
||||
|
||||
NextcloudKit.shared.getRemoteWipeStatus(serverUrl: tableAccount.urlBase, token: token) { account, wipe, data, error in
|
||||
NextcloudKit.shared.getRemoteWipeStatus(serverUrl: tableAccount.urlBase, token: token) { account, wipe, _, error in
|
||||
|
||||
let appDelegate = UIApplication.shared.delegate as! AppDelegate
|
||||
if wipe {
|
||||
|
@ -70,7 +70,7 @@ class NCNetworkingCheckRemoteUser {
|
|||
|
||||
} else if CCUtility.getPassword(account) != "" {
|
||||
|
||||
if UIApplication.shared.applicationState == .active && NextcloudKit.shared.isNetworkReachable() {
|
||||
if UIApplication.shared.applicationState == .active && NextcloudKit.shared.isNetworkReachable() {
|
||||
let description = String.localizedStringWithFormat(NSLocalizedString("_error_check_remote_user_", comment: ""), tableAccount.user, tableAccount.urlBase)
|
||||
let error = NKError(errorCode: error.errorCode, errorDescription: description)
|
||||
NCContentPresenter.shared.showError(error: error, priority: .max)
|
||||
|
|
|
@ -47,7 +47,7 @@ class NCNetworkingProcessUpload: NSObject {
|
|||
case .initial:
|
||||
print("Initial")
|
||||
case .update(_, let deletions, let insertions, let modifications):
|
||||
if (deletions.count > 0 || insertions.count > 0 || modifications.count > 0) {
|
||||
if deletions.count > 0 || insertions.count > 0 || modifications.count > 0 {
|
||||
self?.invalidateObserveTableMetadata()
|
||||
self?.start(completition: { items in
|
||||
print("[LOG] PROCESS-UPLOAD-OBSERVE \(items)")
|
||||
|
@ -112,7 +112,7 @@ class NCNetworkingProcessUpload: NSObject {
|
|||
|
||||
// Update Badge
|
||||
let counterBadge = NCManageDatabase.shared.getMetadatas(predicate: NSPredicate(format: "account == %@ AND (status == %d OR status == %d OR status == %d)", self.appDelegate.account, NCGlobal.shared.metadataStatusWaitUpload, NCGlobal.shared.metadataStatusInUpload, NCGlobal.shared.metadataStatusUploading))
|
||||
NotificationCenter.default.postOnMainThread(name: NCGlobal.shared.notificationCenterUpdateBadgeNumber, userInfo: ["counter":counterBadge.count])
|
||||
NotificationCenter.default.postOnMainThread(name: NCGlobal.shared.notificationCenterUpdateBadgeNumber, userInfo: ["counter": counterBadge.count])
|
||||
|
||||
// ** TEST ONLY ONE **
|
||||
// E2EE
|
||||
|
@ -328,4 +328,3 @@ class NCNetworkingProcessUpload: NSObject {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -181,7 +181,7 @@ import NextcloudKit
|
|||
// MARK: - Unified Search
|
||||
|
||||
func unifiedSearchAddSection(collectionViewCommon: NCCollectionViewCommon, metadatas: [tableMetadata], searchResult: NKSearchResult) {
|
||||
unifiedSearchQueue.addOperation(NCOperationUnifiedSearch.init(collectionViewCommon: collectionViewCommon, metadatas: metadatas, searchResult: searchResult))
|
||||
unifiedSearchQueue.addOperation(NCOperationUnifiedSearch(collectionViewCommon: collectionViewCommon, metadatas: metadatas, searchResult: searchResult))
|
||||
}
|
||||
|
||||
func unifiedSearchCancelAll() {
|
||||
|
@ -481,7 +481,7 @@ class NCOperationDownloadAvatar: ConcurrentOperation {
|
|||
if isCancelled {
|
||||
self.finish()
|
||||
} else {
|
||||
|
||||
|
||||
let options = NKRequestOptions(queue: NextcloudKit.shared.nkCommonInstance.backgroundQueue)
|
||||
|
||||
NextcloudKit.shared.downloadAvatar(user: user, fileNameLocalPath: fileNameLocalPath, sizeImage: NCGlobal.shared.avatarSize, avatarSizeRounded: NCGlobal.shared.avatarSizeRounded, etag: self.etag, options: options) { _, imageAvatar, _, etag, error in
|
||||
|
|
|
@ -102,11 +102,11 @@ class NCService: NSObject {
|
|||
let error = NKError(errorCode: NCGlobal.shared.errorInternalError, errorDescription: "_warning_owncloud_")
|
||||
NCContentPresenter.shared.showWarning(error: error, priority: .max)
|
||||
return (false, nil)
|
||||
} else if serverInfo.versionMajor <= NCGlobal.shared.nextcloud_unsupported_version {
|
||||
} else if serverInfo.versionMajor <= NCGlobal.shared.nextcloud_unsupported_version {
|
||||
let error = NKError(errorCode: NCGlobal.shared.errorInternalError, errorDescription: "_warning_unsupported_")
|
||||
NCContentPresenter.shared.showWarning(error: error, priority: .max)
|
||||
}
|
||||
case .failure(_):
|
||||
case .failure:
|
||||
return(false, nil)
|
||||
}
|
||||
|
||||
|
@ -172,7 +172,7 @@ class NCService: NSObject {
|
|||
}
|
||||
|
||||
data.printJson()
|
||||
|
||||
|
||||
NCManageDatabase.shared.addCapabilitiesJSon(data, account: account)
|
||||
NCManageDatabase.shared.setCapabilities(account: account, data: data)
|
||||
|
||||
|
@ -196,7 +196,7 @@ class NCService: NSObject {
|
|||
// Text direct editor detail
|
||||
if NCGlobal.shared.capabilityServerVersionMajor >= NCGlobal.shared.nextcloudVersion18 {
|
||||
let options = NKRequestOptions(queue: NextcloudKit.shared.nkCommonInstance.backgroundQueue)
|
||||
NextcloudKit.shared.NCTextObtainEditorDetails(options: options) { account, editors, creators, data, error in
|
||||
NextcloudKit.shared.NCTextObtainEditorDetails(options: options) { account, editors, creators, _, error in
|
||||
if error == .success && account == self.appDelegate.account {
|
||||
NCManageDatabase.shared.addDirectEditing(account: account, editors: editors, creators: creators)
|
||||
}
|
||||
|
@ -205,7 +205,7 @@ class NCService: NSObject {
|
|||
|
||||
// External file Server
|
||||
if NCGlobal.shared.capabilityExternalSites {
|
||||
NextcloudKit.shared.getExternalSite(options: options) { account, externalSites, data, error in
|
||||
NextcloudKit.shared.getExternalSite(options: options) { account, externalSites, _, error in
|
||||
if error == .success && account == self.appDelegate.account {
|
||||
NCManageDatabase.shared.deleteExternalSites(account: account)
|
||||
for externalSite in externalSites {
|
||||
|
@ -219,7 +219,7 @@ class NCService: NSObject {
|
|||
|
||||
// User Status
|
||||
if NCGlobal.shared.capabilityUserStatusEnabled {
|
||||
NextcloudKit.shared.getUserStatus(options: options) { account, clearAt, icon, message, messageId, messageIsPredefined, status, statusIsUserDefined, userId, data, error in
|
||||
NextcloudKit.shared.getUserStatus(options: options) { account, clearAt, icon, message, messageId, messageIsPredefined, status, statusIsUserDefined, userId, _, error in
|
||||
if error == .success && account == self.appDelegate.account && userId == self.appDelegate.userId {
|
||||
NCManageDatabase.shared.setAccountUserStatus(userStatusClearAt: clearAt, userStatusIcon: icon, userStatusMessage: message, userStatusMessageId: messageId, userStatusMessageIsPredefined: messageIsPredefined, userStatusStatus: status, userStatusStatusIsUserDefined: statusIsUserDefined, account: account)
|
||||
}
|
||||
|
@ -244,7 +244,7 @@ class NCService: NSObject {
|
|||
|
||||
private func requestDashboardWidget() {
|
||||
|
||||
@Sendable func convertDataToImage(data: Data?, size:CGSize, fileNameToWrite: String?) {
|
||||
@Sendable func convertDataToImage(data: Data?, size: CGSize, fileNameToWrite: String?) {
|
||||
|
||||
guard let data = data else { return }
|
||||
var imageData: UIImage?
|
||||
|
@ -266,10 +266,10 @@ class NCService: NSObject {
|
|||
}
|
||||
|
||||
let options = NKRequestOptions(queue: NextcloudKit.shared.nkCommonInstance.backgroundQueue)
|
||||
|
||||
|
||||
NextcloudKit.shared.getDashboardWidget(options: options) { account, dashboardWidgets, data, error in
|
||||
Task {
|
||||
if error == .success, let dashboardWidgets = dashboardWidgets {
|
||||
if error == .success, let dashboardWidgets = dashboardWidgets {
|
||||
NCManageDatabase.shared.addDashboardWidget(account: account, dashboardWidgets: dashboardWidgets)
|
||||
for widget in dashboardWidgets {
|
||||
if let url = URL(string: widget.iconUrl), let fileName = widget.iconClass {
|
||||
|
|
|
@ -152,10 +152,10 @@ class NCNotification: UITableViewController, NCNotificationCellDelegate, NCEmpty
|
|||
let user = json["user"]?["id"].stringValue {
|
||||
cell.avatar.isHidden = false
|
||||
cell.avatarLeadingMargin.constant = 50
|
||||
|
||||
|
||||
let fileName = appDelegate.userBaseUrl + "-" + user + ".png"
|
||||
let fileNameLocalPath = String(CCUtility.getDirectoryUserData()) + "/" + fileName
|
||||
|
||||
|
||||
if let image = UIImage(contentsOfFile: fileNameLocalPath) {
|
||||
cell.avatar.image = image
|
||||
} else if !FileManager.default.fileExists(atPath: fileNameLocalPath) {
|
||||
|
@ -221,7 +221,7 @@ class NCNotification: UITableViewController, NCNotificationCellDelegate, NCEmpty
|
|||
|
||||
for action in jsonActions {
|
||||
|
||||
let label = action["label"].stringValue
|
||||
let label = action["label"].stringValue
|
||||
let primary = action["primary"].boolValue
|
||||
|
||||
if primary {
|
||||
|
@ -250,10 +250,10 @@ class NCNotification: UITableViewController, NCNotificationCellDelegate, NCEmpty
|
|||
|
||||
func tapRemove(with notification: NKNotifications) {
|
||||
|
||||
NextcloudKit.shared.setNotification(serverUrl: nil, idNotification: notification.idNotification , method: "DELETE") { (account, error) in
|
||||
NextcloudKit.shared.setNotification(serverUrl: nil, idNotification: notification.idNotification, method: "DELETE") { account, error in
|
||||
if error == .success && account == self.appDelegate.account {
|
||||
if let index = self.notifications
|
||||
.firstIndex(where: { $0.idNotification == notification.idNotification }) {
|
||||
.firstIndex(where: { $0.idNotification == notification.idNotification }) {
|
||||
self.notifications.remove(at: index)
|
||||
}
|
||||
self.tableView.reloadData()
|
||||
|
@ -282,7 +282,7 @@ class NCNotification: UITableViewController, NCNotificationCellDelegate, NCEmpty
|
|||
return
|
||||
}
|
||||
|
||||
NextcloudKit.shared.setNotification(serverUrl: serverUrl, idNotification: 0, method: method) { (account, error) in
|
||||
NextcloudKit.shared.setNotification(serverUrl: serverUrl, idNotification: 0, method: method) { account, error in
|
||||
if error == .success && account == self.appDelegate.account {
|
||||
if let index = self.notifications.firstIndex(where: { $0.idNotification == notification.idNotification }) {
|
||||
self.notifications.remove(at: index)
|
||||
|
@ -312,7 +312,7 @@ class NCNotification: UITableViewController, NCNotificationCellDelegate, NCEmpty
|
|||
isReloadDataSourceNetworkInProgress = true
|
||||
self.tableView.reloadData()
|
||||
|
||||
NextcloudKit.shared.getNotifications { account, notifications, data, error in
|
||||
NextcloudKit.shared.getNotifications { account, notifications, _, error in
|
||||
if error == .success && account == self.appDelegate.account {
|
||||
self.notifications.removeAll()
|
||||
let sortedListOfNotifications = (notifications! as NSArray).sortedArray(using: [NSSortDescriptor(key: "date", ascending: false)])
|
||||
|
@ -353,7 +353,6 @@ class NCNotificationCell: UITableViewCell, NCCellProtocol {
|
|||
weak var delegate: NCNotificationCellDelegate?
|
||||
var notification: NKNotifications?
|
||||
|
||||
|
||||
var indexPath: IndexPath {
|
||||
get { return index }
|
||||
set { index = newValue }
|
||||
|
|
|
@ -142,14 +142,14 @@ class NCRecent: NCCollectionViewCommon {
|
|||
dateFormatter.locale = Locale(identifier: "en_US_POSIX")
|
||||
dateFormatter.dateFormat = "yyyy-MM-dd'T'HH:mm:ssZZZZZ"
|
||||
let lessDateString = dateFormatter.string(from: Date())
|
||||
let requestBody = String(format: requestBodyRecent, "/files/"+appDelegate.userId, lessDateString)
|
||||
let requestBody = String(format: requestBodyRecent, "/files/" + appDelegate.userId, lessDateString)
|
||||
|
||||
isReloadDataSourceNetworkInProgress = true
|
||||
collectionView?.reloadData()
|
||||
|
||||
let options = NKRequestOptions(queue: NextcloudKit.shared.nkCommonInstance.backgroundQueue)
|
||||
|
||||
NextcloudKit.shared.searchBodyRequest(serverUrl: appDelegate.urlBase, requestBody: requestBody, showHiddenFiles: CCUtility.getShowHiddenFiles(), options: options) { account, files, data, error in
|
||||
NextcloudKit.shared.searchBodyRequest(serverUrl: appDelegate.urlBase, requestBody: requestBody, showHiddenFiles: CCUtility.getShowHiddenFiles(), options: options) { account, files, _, error in
|
||||
|
||||
if error == .success {
|
||||
NCManageDatabase.shared.convertFilesToMetadatas(files, useMetadataFolder: false) { _, metadatasFolder, metadatas in
|
||||
|
|
|
@ -41,7 +41,7 @@ import NextcloudKit
|
|||
NCActivityIndicator.shared.start(backgroundView: viewController.view)
|
||||
|
||||
let fileNamePath = CCUtility.returnFileNamePath(fromFileName: NCGlobal.shared.fileNameRichWorkspace, serverUrl: serverUrl, urlBase: appDelegate.urlBase, userId: appDelegate.userId, account: appDelegate.account)!
|
||||
NextcloudKit.shared.NCTextCreateFile(fileNamePath: fileNamePath, editorId: directEditingCreator.editor, creatorId: directEditingCreator.identifier, templateId: "") { account, url, data, error in
|
||||
NextcloudKit.shared.NCTextCreateFile(fileNamePath: fileNamePath, editorId: directEditingCreator.editor, creatorId: directEditingCreator.identifier, templateId: "") { account, url, _, error in
|
||||
|
||||
NCActivityIndicator.shared.stop()
|
||||
|
||||
|
@ -76,7 +76,7 @@ import NextcloudKit
|
|||
NCActivityIndicator.shared.start(backgroundView: viewController.view)
|
||||
|
||||
let fileNamePath = CCUtility.returnFileNamePath(fromFileName: metadata.fileName, serverUrl: metadata.serverUrl, urlBase: appDelegate.urlBase, userId: appDelegate.userId, account: appDelegate.account)!
|
||||
NextcloudKit.shared.NCTextOpenFile(fileNamePath: fileNamePath, editor: "text") { account, url, data, error in
|
||||
NextcloudKit.shared.NCTextOpenFile(fileNamePath: fileNamePath, editor: "text") { account, url, _, error in
|
||||
|
||||
NCActivityIndicator.shared.stop()
|
||||
|
||||
|
|
|
@ -61,7 +61,7 @@ import MarkdownKit
|
|||
override func viewWillAppear(_ animated: Bool) {
|
||||
super.viewWillAppear(animated)
|
||||
|
||||
NCNetworking.shared.readFile(serverUrlFileName: serverUrl) { (account, metadata, error) in
|
||||
NCNetworking.shared.readFile(serverUrlFileName: serverUrl) { account, metadata, error in
|
||||
|
||||
if error == .success && account == self.appDelegate.account {
|
||||
guard let metadata = metadata else { return }
|
||||
|
|
|
@ -298,7 +298,7 @@ extension NCSelect: UICollectionViewDataSource {
|
|||
// Thumbnail
|
||||
if !metadata.directory {
|
||||
if FileManager().fileExists(atPath: CCUtility.getDirectoryProviderStorageIconOcId(metadata.ocId, etag: metadata.etag)) {
|
||||
(cell as! NCCellProtocol).filePreviewImageView?.image = UIImage(contentsOfFile: CCUtility.getDirectoryProviderStorageIconOcId(metadata.ocId, etag: metadata.etag))
|
||||
(cell as! NCCellProtocol).filePreviewImageView?.image = UIImage(contentsOfFile: CCUtility.getDirectoryProviderStorageIconOcId(metadata.ocId, etag: metadata.etag))
|
||||
} else {
|
||||
NCOperationQueue.shared.downloadThumbnail(metadata: metadata, placeholder: true, cell: cell, view: collectionView)
|
||||
}
|
||||
|
@ -463,13 +463,13 @@ extension NCSelect: UICollectionViewDataSource {
|
|||
|
||||
extension NCSelect: UICollectionViewDelegateFlowLayout {
|
||||
|
||||
func getHeaderHeight(section:Int) -> (heightHeaderCommands: CGFloat, heightHeaderRichWorkspace: CGFloat, heightHeaderSection: CGFloat) {
|
||||
func getHeaderHeight(section: Int) -> (heightHeaderCommands: CGFloat, heightHeaderRichWorkspace: CGFloat, heightHeaderSection: CGFloat) {
|
||||
|
||||
var headerRichWorkspace: CGFloat = 0
|
||||
|
||||
if let richWorkspaceText = richWorkspaceText {
|
||||
let trimmed = richWorkspaceText.trimmingCharacters(in: .whitespaces)
|
||||
if trimmed.count > 0 {
|
||||
if trimmed.count > 0 {
|
||||
headerRichWorkspace = UIScreen.main.bounds.size.height / 6
|
||||
}
|
||||
}
|
||||
|
@ -702,5 +702,3 @@ struct SelectView: UIViewControllerRepresentable {
|
|||
Coordinator(self)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -87,7 +87,7 @@ class NCEndToEndInitialize: NSObject {
|
|||
return
|
||||
}
|
||||
|
||||
NextcloudKit.shared.signE2EECertificate(certificate: csr) { account, certificate, data, error in
|
||||
NextcloudKit.shared.signE2EECertificate(certificate: csr) { account, certificate, _, error in
|
||||
|
||||
if error == .success && account == self.appDelegate.account {
|
||||
|
||||
|
@ -137,7 +137,7 @@ class NCEndToEndInitialize: NSObject {
|
|||
func getPrivateKeyCipher() {
|
||||
|
||||
// Request PrivateKey chiper to Server
|
||||
NextcloudKit.shared.getE2EEPrivateKey { account, privateKeyChiper, data, error in
|
||||
NextcloudKit.shared.getE2EEPrivateKey { account, privateKeyChiper, _, error in
|
||||
|
||||
if error == .success && account == self.appDelegate.account {
|
||||
|
||||
|
@ -169,7 +169,7 @@ class NCEndToEndInitialize: NSObject {
|
|||
CCUtility.setEndToEndPassphrase(self.appDelegate.account, passphrase: passphrase)
|
||||
|
||||
// request server publicKey
|
||||
NextcloudKit.shared.getE2EEPublicKey { account, publicKey, data, error in
|
||||
NextcloudKit.shared.getE2EEPublicKey { account, publicKey, _, error in
|
||||
|
||||
if error == .success && account == self.appDelegate.account {
|
||||
|
||||
|
@ -272,7 +272,7 @@ class NCEndToEndInitialize: NSObject {
|
|||
// privateKeyChiper
|
||||
print(privateKeyChiper)
|
||||
|
||||
NextcloudKit.shared.storeE2EEPrivateKey(privateKey: privateKeyChiper) { account, privateKey, data, error in
|
||||
NextcloudKit.shared.storeE2EEPrivateKey(privateKey: privateKeyChiper) { account, _, _, error in
|
||||
|
||||
if error == .success && account == self.appDelegate.account {
|
||||
|
||||
|
@ -280,7 +280,7 @@ class NCEndToEndInitialize: NSObject {
|
|||
CCUtility.setEndToEndPassphrase(account, passphrase: e2ePassphrase)
|
||||
|
||||
// request server publicKey
|
||||
NextcloudKit.shared.getE2EEPublicKey { account, publicKey, data, error in
|
||||
NextcloudKit.shared.getE2EEPublicKey { account, publicKey, _, error in
|
||||
|
||||
if error == .success && account == self.appDelegate.account {
|
||||
|
||||
|
|
|
@ -132,7 +132,7 @@ class NCManageAutoUploadFileName: XLFormViewController {
|
|||
self.form.delegate = nil
|
||||
|
||||
let maskFileName: XLFormRowDescriptor = self.form.formRow(withTag: "maskFileName")!
|
||||
let previewFileName: XLFormRowDescriptor = self.form.formRow(withTag: "previewFileName")!
|
||||
let previewFileName: XLFormRowDescriptor = self.form.formRow(withTag: "previewFileName")!
|
||||
previewFileName.value = self.previewFileName(valueRename: maskFileName.value as? String)
|
||||
|
||||
self.tableView.reloadData()
|
||||
|
@ -161,7 +161,7 @@ class NCManageAutoUploadFileName: XLFormViewController {
|
|||
|
||||
self.form.delegate = self
|
||||
|
||||
let previewFileName: XLFormRowDescriptor = self.form.formRow(withTag: "previewFileName")!
|
||||
let previewFileName: XLFormRowDescriptor = self.form.formRow(withTag: "previewFileName")!
|
||||
previewFileName.value = self.previewFileName(valueRename: formRow.value as? String)
|
||||
|
||||
// reload cell
|
||||
|
|
|
@ -82,10 +82,10 @@ class NCManageE2EE: NSObject, ObservableObject, NCEndToEndInitializeDelegate, TO
|
|||
passcodeViewController.keypadButtonShowLettering = false
|
||||
if CCUtility.getEnableTouchFaceID() && laContext.canEvaluatePolicy(.deviceOwnerAuthenticationWithBiometrics, error: &error) {
|
||||
if error == nil {
|
||||
if laContext.biometryType == .faceID {
|
||||
if laContext.biometryType == .faceID {
|
||||
passcodeViewController.biometryType = .faceID
|
||||
passcodeViewController.allowBiometricValidation = true
|
||||
} else if laContext.biometryType == .touchID {
|
||||
} else if laContext.biometryType == .touchID {
|
||||
passcodeViewController.biometryType = .touchID
|
||||
}
|
||||
passcodeViewController.allowBiometricValidation = true
|
||||
|
@ -107,19 +107,19 @@ class NCManageE2EE: NSObject, ObservableObject, NCEndToEndInitializeDelegate, TO
|
|||
print("[LOG]Passphrase: " + e2ePassphrase)
|
||||
let message = "\n" + NSLocalizedString("_e2e_settings_the_passphrase_is_", comment: "") + "\n\n\n" + e2ePassphrase
|
||||
let alertController = UIAlertController(title: NSLocalizedString("_info_", comment: ""), message: message, preferredStyle: .alert)
|
||||
alertController.addAction(UIAlertAction(title: NSLocalizedString("_ok_", comment: ""), style: .default, handler: { action in }))
|
||||
alertController.addAction(UIAlertAction(title: NSLocalizedString("_copy_passphrase_", comment: ""), style: .default, handler: { action in
|
||||
alertController.addAction(UIAlertAction(title: NSLocalizedString("_ok_", comment: ""), style: .default, handler: { _ in }))
|
||||
alertController.addAction(UIAlertAction(title: NSLocalizedString("_copy_passphrase_", comment: ""), style: .default, handler: { _ in
|
||||
UIPasteboard.general.string = e2ePassphrase
|
||||
}))
|
||||
appDelegate.window?.rootViewController?.present(alertController, animated: true)
|
||||
}
|
||||
case "removeLocallyEncryption":
|
||||
let alertController = UIAlertController(title: NSLocalizedString("_e2e_settings_remove_", comment: ""), message: NSLocalizedString("_e2e_settings_remove_message_", comment: ""), preferredStyle: .alert)
|
||||
alertController.addAction(UIAlertAction(title: NSLocalizedString("_remove_", comment: ""), style: .default, handler: { action in
|
||||
alertController.addAction(UIAlertAction(title: NSLocalizedString("_remove_", comment: ""), style: .default, handler: { _ in
|
||||
CCUtility.clearAllKeysEnd(toEnd: self.appDelegate.account)
|
||||
self.isEndToEndEnabled = CCUtility.isEnd(toEndEnabled: self.appDelegate.account)
|
||||
}))
|
||||
alertController.addAction(UIAlertAction(title: NSLocalizedString("_cancel_", comment: ""), style: .default, handler: { action in }))
|
||||
alertController.addAction(UIAlertAction(title: NSLocalizedString("_cancel_", comment: ""), style: .default, handler: { _ in }))
|
||||
appDelegate.window?.rootViewController?.present(alertController, animated: true)
|
||||
default:
|
||||
break
|
||||
|
@ -140,7 +140,7 @@ class NCManageE2EE: NSObject, ObservableObject, NCEndToEndInitializeDelegate, TO
|
|||
|
||||
func didPerformBiometricValidationRequest(in passcodeViewController: TOPasscodeViewController) {
|
||||
|
||||
LAContext().evaluatePolicy(.deviceOwnerAuthenticationWithBiometrics, localizedReason: NCBrandOptions.shared.brand) { (success, error) in
|
||||
LAContext().evaluatePolicy(.deviceOwnerAuthenticationWithBiometrics, localizedReason: NCBrandOptions.shared.brand) { success, _ in
|
||||
if success {
|
||||
DispatchQueue.main.asyncAfter(deadline: .now() + 0.3) {
|
||||
passcodeViewController.dismiss(animated: true)
|
||||
|
@ -230,7 +230,7 @@ struct NCViewE2EE: View {
|
|||
|
||||
List {
|
||||
|
||||
Section(header: Text(""), footer:Text(manageE2EE.statusOfService + "\n\n" + "End-to-End Encryption " + NCGlobal.shared.capabilityE2EEApiVersion)) {
|
||||
Section(header: Text(""), footer: Text(manageE2EE.statusOfService + "\n\n" + "End-to-End Encryption " + NCGlobal.shared.capabilityE2EEApiVersion)) {
|
||||
HStack {
|
||||
Label {
|
||||
Text(NSLocalizedString("_e2e_settings_start_", comment: ""))
|
||||
|
@ -281,7 +281,7 @@ struct DeleteCerificateSection: View {
|
|||
}
|
||||
.contentShape(Rectangle())
|
||||
.onTapGesture {
|
||||
NextcloudKit.shared.deleteE2EECertificate { account, error in
|
||||
NextcloudKit.shared.deleteE2EECertificate { _, error in
|
||||
if error == .success {
|
||||
NCContentPresenter.shared.messageNotification("E2E delete certificate", error: error, delay: NCGlobal.shared.dismissAfterSecond, type: .success)
|
||||
} else {
|
||||
|
@ -303,7 +303,7 @@ struct DeleteCerificateSection: View {
|
|||
}
|
||||
.contentShape(Rectangle())
|
||||
.onTapGesture {
|
||||
NextcloudKit.shared.deleteE2EEPrivateKey { account, error in
|
||||
NextcloudKit.shared.deleteE2EEPrivateKey { _, error in
|
||||
if error == .success {
|
||||
NCContentPresenter.shared.messageNotification("E2E delete privateKey", error: error, delay: NCGlobal.shared.dismissAfterSecond, type: .success)
|
||||
} else {
|
||||
|
@ -336,7 +336,7 @@ struct NCViewE2EETest: View {
|
|||
|
||||
VStack {
|
||||
List {
|
||||
Section(header:SectionView(height: 50, text: "Section Header View")) {
|
||||
Section(header: SectionView(height: 50, text: "Section Header View")) {
|
||||
Label {
|
||||
Text(NSLocalizedString("_e2e_settings_activated_", comment: ""))
|
||||
} icon: {
|
||||
|
@ -347,7 +347,7 @@ struct NCViewE2EETest: View {
|
|||
.foregroundColor(.green)
|
||||
}
|
||||
}
|
||||
Section(header:SectionView(text: "Section Header View 42")) {
|
||||
Section(header: SectionView(text: "Section Header View 42")) {
|
||||
Label {
|
||||
Text(NSLocalizedString("_e2e_settings_activated_", comment: ""))
|
||||
} icon: {
|
||||
|
|
|
@ -44,11 +44,11 @@ class NCShareCommon: NSObject {
|
|||
|
||||
let size: CGFloat = 200
|
||||
|
||||
let bottomImage = UIImage(named: "circle_fill")!.image(color: colorCircle, size: size/2)
|
||||
let topImage = UIImage(named: imageName)!.image(color: .white, size: size/2)
|
||||
let bottomImage = UIImage(named: "circle_fill")!.image(color: colorCircle, size: size / 2)
|
||||
let topImage = UIImage(named: imageName)!.image(color: .white, size: size / 2)
|
||||
UIGraphicsBeginImageContextWithOptions(CGSize(width: size, height: size), false, UIScreen.main.scale)
|
||||
bottomImage.draw(in: CGRect(origin: CGPoint.zero, size: CGSize(width: size, height: size)))
|
||||
topImage.draw(in: CGRect(origin: CGPoint(x: size/4, y: size/4), size: CGSize(width: size/2, height: size/2)))
|
||||
topImage.draw(in: CGRect(origin: CGPoint(x: size / 4, y: size / 4), size: CGSize(width: size / 2, height: size / 2)))
|
||||
let image = UIGraphicsGetImageFromCurrentImageContext()
|
||||
UIGraphicsEndImageContext()
|
||||
|
||||
|
|
|
@ -48,12 +48,12 @@ class NCShareNetworking: NSObject {
|
|||
let filenamePath = CCUtility.returnFileNamePath(fromFileName: metadata.fileName, serverUrl: metadata.serverUrl, urlBase: metadata.urlBase, userId: metadata.userId, account: metadata.account)!
|
||||
let parameter = NKShareParameter(path: filenamePath)
|
||||
|
||||
NextcloudKit.shared.readShares(parameters: parameter) { account, shares, data, error in
|
||||
NextcloudKit.shared.readShares(parameters: parameter) { account, shares, _, error in
|
||||
if error == .success, let shares = shares {
|
||||
NCManageDatabase.shared.deleteTableShare(account: account)
|
||||
let home = NCUtilityFileSystem.shared.getHomeServer(urlBase: self.metadata.urlBase, userId: self.metadata.userId)
|
||||
NCManageDatabase.shared.addShare(account: self.metadata.account, home:home, shares: shares)
|
||||
NextcloudKit.shared.getGroupfolders() { account, results, data, error in
|
||||
NCManageDatabase.shared.addShare(account: self.metadata.account, home: home, shares: shares)
|
||||
NextcloudKit.shared.getGroupfolders { account, results, _, error in
|
||||
if showLoadingIndicator {
|
||||
NCActivityIndicator.shared.stop()
|
||||
}
|
||||
|
@ -83,7 +83,7 @@ class NCShareNetworking: NSObject {
|
|||
NCActivityIndicator.shared.start(backgroundView: view)
|
||||
let filenamePath = CCUtility.returnFileNamePath(fromFileName: metadata.fileName, serverUrl: metadata.serverUrl, urlBase: metadata.urlBase, userId: metadata.userId, account: metadata.account)!
|
||||
|
||||
NextcloudKit.shared.createShare(path: filenamePath, shareType: option.shareType, shareWith: option.shareWith, password: option.password, note: option.note, permissions: option.permissions, attributes: option.attributes) { (account, share, data, error) in
|
||||
NextcloudKit.shared.createShare(path: filenamePath, shareType: option.shareType, shareWith: option.shareWith, password: option.password, note: option.note, permissions: option.permissions, attributes: option.attributes) { _, share, _, error in
|
||||
NCActivityIndicator.shared.stop()
|
||||
if error == .success, let share = share {
|
||||
option.idShare = share.idShare
|
||||
|
@ -114,7 +114,7 @@ class NCShareNetworking: NSObject {
|
|||
|
||||
func updateShare(option: NCTableShareable) {
|
||||
NCActivityIndicator.shared.start(backgroundView: view)
|
||||
NextcloudKit.shared.updateShare(idShare: option.idShare, password: option.password, expireDate: option.expDateString, permissions: option.permissions, note: option.note, label: option.label, hideDownload: option.hideDownload, attributes: option.attributes) { account, share, data, error in
|
||||
NextcloudKit.shared.updateShare(idShare: option.idShare, password: option.password, expireDate: option.expDateString, permissions: option.permissions, note: option.note, label: option.label, hideDownload: option.hideDownload, attributes: option.attributes) { _, share, _, error in
|
||||
NCActivityIndicator.shared.stop()
|
||||
if error == .success, let share = share {
|
||||
let home = NCUtilityFileSystem.shared.getHomeServer(urlBase: self.metadata.urlBase, userId: self.metadata.userId)
|
||||
|
@ -129,7 +129,7 @@ class NCShareNetworking: NSObject {
|
|||
|
||||
func getSharees(searchString: String) {
|
||||
NCActivityIndicator.shared.start(backgroundView: view)
|
||||
NextcloudKit.shared.searchSharees(search: searchString) { _, sharees, data, error in
|
||||
NextcloudKit.shared.searchSharees(search: searchString) { _, sharees, _, error in
|
||||
NCActivityIndicator.shared.stop()
|
||||
if error == .success {
|
||||
self.delegate?.getSharees(sharees: sharees)
|
||||
|
|
|
@ -92,7 +92,7 @@ class NCShares: NCCollectionViewCommon {
|
|||
isReloadDataSourceNetworkInProgress = true
|
||||
collectionView?.reloadData()
|
||||
|
||||
NextcloudKit.shared.readShares(parameters: NKShareParameter()) { account, shares, data, error in
|
||||
NextcloudKit.shared.readShares(parameters: NKShareParameter()) { account, shares, _, error in
|
||||
|
||||
self.refreshControl.endRefreshing()
|
||||
self.isReloadDataSourceNetworkInProgress = false
|
||||
|
|
|
@ -39,7 +39,7 @@ class NCTransferCell: UICollectionViewCell, UIGestureRecognizerDelegate, NCCellP
|
|||
private var objectId = ""
|
||||
private var user = ""
|
||||
var indexPath = IndexPath()
|
||||
|
||||
|
||||
weak var delegate: NCTransferCellDelegate?
|
||||
var namedButtonMore = ""
|
||||
|
||||
|
@ -71,7 +71,7 @@ class NCTransferCell: UICollectionViewCell, UIGestureRecognizerDelegate, NCCellP
|
|||
get { return imageMore }
|
||||
set { imageMore = newValue }
|
||||
}
|
||||
|
||||
|
||||
override func awakeFromNib() {
|
||||
super.awakeFromNib()
|
||||
|
||||
|
|
|
@ -170,7 +170,7 @@ class NCUserStatus: UIViewController {
|
|||
override func viewWillDisappear(_ animated: Bool) {
|
||||
super.viewWillDisappear(animated)
|
||||
|
||||
NextcloudKit.shared.getUserStatus { account, clearAt, icon, message, messageId, messageIsPredefined, status, statusIsUserDefined, _, data, error in
|
||||
NextcloudKit.shared.getUserStatus { account, clearAt, icon, message, messageId, messageIsPredefined, status, statusIsUserDefined, _, _, error in
|
||||
|
||||
if error == .success {
|
||||
|
||||
|
@ -335,7 +335,7 @@ class NCUserStatus: UIViewController {
|
|||
|
||||
func getStatus() {
|
||||
|
||||
NextcloudKit.shared.getUserStatus { _, clearAt, icon, message, _, _, status, _, _, data, error in
|
||||
NextcloudKit.shared.getUserStatus { _, clearAt, icon, message, _, _, status, _, _, _, error in
|
||||
|
||||
if error == .success || error.errorCode == NCGlobal.shared.errorResourceNotFound {
|
||||
|
||||
|
@ -368,7 +368,7 @@ class NCUserStatus: UIViewController {
|
|||
print("No status")
|
||||
}
|
||||
|
||||
NextcloudKit.shared.getUserStatusPredefinedStatuses { _, userStatuses, data, error in
|
||||
NextcloudKit.shared.getUserStatusPredefinedStatuses { _, userStatuses, _, error in
|
||||
|
||||
if error == .success {
|
||||
|
||||
|
|
|
@ -101,8 +101,7 @@ class NCContentPresenter: NSObject {
|
|||
func messageNotification(_ title: String, error: NKError, delay: TimeInterval, type: messageType, priority: EKAttributes.Precedence.Priority = .normal, dropEnqueuedEntries: Bool = false) {
|
||||
|
||||
// No notification message for:
|
||||
if error.errorCode == NSURLErrorCancelled || error.errorCode == NCGlobal.shared.errorRequestExplicityCancelled { return }
|
||||
else if error == .success && type == messageType.error { return }
|
||||
if error.errorCode == NSURLErrorCancelled || error.errorCode == NCGlobal.shared.errorRequestExplicityCancelled { return } else if error == .success && type == messageType.error { return }
|
||||
|
||||
DispatchQueue.main.async {
|
||||
switch error.errorCode {
|
||||
|
@ -113,7 +112,7 @@ class NCContentPresenter: NSObject {
|
|||
var responseMessage = ""
|
||||
if let data = error.responseData {
|
||||
do {
|
||||
if let json = try JSONSerialization.jsonObject(with: data, options: .mutableContainers) as? [String:Any],
|
||||
if let json = try JSONSerialization.jsonObject(with: data, options: .mutableContainers) as? [String: Any],
|
||||
let message = json["message"] as? String {
|
||||
responseMessage = "\n\n" + message
|
||||
}
|
||||
|
@ -201,7 +200,7 @@ class NCContentPresenter: NSObject {
|
|||
}
|
||||
|
||||
let okButton = EKProperty.ButtonContent(
|
||||
label: EKProperty.LabelContent(text: NSLocalizedString(textOkButton, comment: ""),style: EKProperty.LabelStyle(font: MainFont.medium.with(size: 16), color: EKColor(textColor))),
|
||||
label: EKProperty.LabelContent(text: NSLocalizedString(textOkButton, comment: ""), style: EKProperty.LabelStyle(font: MainFont.medium.with(size: 16), color: EKColor(textColor))),
|
||||
backgroundColor: .clear,
|
||||
highlightedBackgroundColor: EKColor(UIColor.lightGray),
|
||||
displayMode: EKAttributes.DisplayMode.inferred,
|
||||
|
@ -217,7 +216,6 @@ class NCContentPresenter: NSObject {
|
|||
SwiftEntryKit.display(entry: contentView, using: buttonAttributes)
|
||||
}
|
||||
|
||||
|
||||
// MARK: - Note Message
|
||||
|
||||
func noteTop(text: String, image: UIImage?, color: UIColor? = nil, type: messageType? = nil, delay: TimeInterval, priority: EKAttributes.Precedence.Priority = .normal, dropEnqueuedEntries: Bool = false) {
|
||||
|
|
|
@ -257,7 +257,7 @@ class NCLivePhoto {
|
|||
while videoWriterInput.isReadyForMoreMediaData {
|
||||
if let sampleBuffer = videoReaderOutput.copyNextSampleBuffer() {
|
||||
currentFrameCount += 1
|
||||
let percent: CGFloat = CGFloat(currentFrameCount)/CGFloat(frameCount)
|
||||
let percent: CGFloat = CGFloat(currentFrameCount) / CGFloat(frameCount)
|
||||
progress(percent)
|
||||
if !videoWriterInput.append(sampleBuffer) {
|
||||
print("Cannot write: \(String(describing: self.assetWriter?.error?.localizedDescription))")
|
||||
|
@ -299,7 +299,7 @@ class NCLivePhoto {
|
|||
|
||||
private func metadataForAssetID(_ assetIdentifier: String) -> AVMetadataItem {
|
||||
let item = AVMutableMetadataItem()
|
||||
let keyContentIdentifier = "com.apple.quicktime.content.identifier"
|
||||
let keyContentIdentifier = "com.apple.quicktime.content.identifier"
|
||||
let keySpaceQuickTimeMetadata = "mdta"
|
||||
item.key = keyContentIdentifier as (NSCopying & NSObjectProtocol)?
|
||||
item.keySpace = AVMetadataKeySpace(rawValue: keySpaceQuickTimeMetadata)
|
||||
|
|
|
@ -41,37 +41,37 @@ class NCUtility: NSObject {
|
|||
|
||||
#if !EXTENSION
|
||||
func convertSVGtoPNGWriteToUserData(svgUrlString: String, fileName: String? = nil, width: CGFloat? = nil, rewrite: Bool, account: String, id: Int? = nil, completion: @escaping (_ imageNamePath: String?, _ id: Int?) -> Void) {
|
||||
|
||||
|
||||
var fileNamePNG = ""
|
||||
|
||||
|
||||
guard let svgUrlString = svgUrlString.addingPercentEncoding(withAllowedCharacters: .urlQueryAllowed),
|
||||
let iconURL = URL(string: svgUrlString) else {
|
||||
return completion(nil, id)
|
||||
}
|
||||
|
||||
|
||||
if let fileName = fileName {
|
||||
fileNamePNG = fileName
|
||||
} else {
|
||||
fileNamePNG = iconURL.deletingPathExtension().lastPathComponent + ".png"
|
||||
}
|
||||
|
||||
|
||||
let imageNamePath = CCUtility.getDirectoryUserData() + "/" + fileNamePNG
|
||||
|
||||
|
||||
if !FileManager.default.fileExists(atPath: imageNamePath) || rewrite == true {
|
||||
|
||||
|
||||
NextcloudKit.shared.downloadContent(serverUrl: iconURL.absoluteString) { _, data, error in
|
||||
|
||||
|
||||
if error == .success && data != nil {
|
||||
|
||||
|
||||
if let image = UIImage(data: data!) {
|
||||
|
||||
|
||||
var newImage: UIImage = image
|
||||
|
||||
|
||||
if width != nil {
|
||||
|
||||
|
||||
let ratio = image.size.height / image.size.width
|
||||
let newSize = CGSize(width: width!, height: width! * ratio)
|
||||
|
||||
|
||||
let renderFormat = UIGraphicsImageRendererFormat.default()
|
||||
renderFormat.opaque = false
|
||||
let renderer = UIGraphicsImageRenderer(size: CGSize(width: newSize.width, height: newSize.height), format: renderFormat)
|
||||
|
@ -80,108 +80,108 @@ class NCUtility: NSObject {
|
|||
image.draw(in: CGRect(x: 0, y: 0, width: newSize.width, height: newSize.height))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
guard let pngImageData = newImage.pngData() else {
|
||||
return completion(nil, id)
|
||||
}
|
||||
|
||||
|
||||
try? pngImageData.write(to: URL(fileURLWithPath: imageNamePath))
|
||||
|
||||
|
||||
return completion(imageNamePath, id)
|
||||
|
||||
|
||||
} else {
|
||||
|
||||
|
||||
guard let svgImage: SVGKImage = SVGKImage(data: data) else {
|
||||
return completion(nil, id)
|
||||
}
|
||||
|
||||
|
||||
if width != nil {
|
||||
let scale = svgImage.size.height / svgImage.size.width
|
||||
svgImage.size = CGSize(width: width!, height: width! * scale)
|
||||
}
|
||||
|
||||
|
||||
guard let image: UIImage = svgImage.uiImage else {
|
||||
return completion(nil, id)
|
||||
}
|
||||
guard let pngImageData = image.pngData() else {
|
||||
return completion(nil, id)
|
||||
}
|
||||
|
||||
|
||||
try? pngImageData.write(to: URL(fileURLWithPath: imageNamePath))
|
||||
|
||||
|
||||
return completion(imageNamePath, id)
|
||||
}
|
||||
} else {
|
||||
return completion(nil, id)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
} else {
|
||||
return completion(imageNamePath, id)
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
@objc func isSimulatorOrTestFlight() -> Bool {
|
||||
guard let path = Bundle.main.appStoreReceiptURL?.path else {
|
||||
return false
|
||||
}
|
||||
return path.contains("CoreSimulator") || path.contains("sandboxReceipt")
|
||||
}
|
||||
|
||||
|
||||
@objc func isSimulator() -> Bool {
|
||||
guard let path = Bundle.main.appStoreReceiptURL?.path else {
|
||||
return false
|
||||
}
|
||||
return path.contains("CoreSimulator")
|
||||
}
|
||||
|
||||
|
||||
@objc func isRichDocument(_ metadata: tableMetadata) -> Bool {
|
||||
|
||||
|
||||
guard let mimeType = CCUtility.getMimeType(metadata.fileNameView) else {
|
||||
return false
|
||||
}
|
||||
|
||||
|
||||
// contentype
|
||||
for richdocumentMimetype: String in NCGlobal.shared.capabilityRichdocumentsMimetypes {
|
||||
if richdocumentMimetype.contains(metadata.contentType) || metadata.contentType == "text/plain" {
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// mimetype
|
||||
if NCGlobal.shared.capabilityRichdocumentsMimetypes.count > 0 && mimeType.components(separatedBy: ".").count > 2 {
|
||||
|
||||
|
||||
let mimeTypeArray = mimeType.components(separatedBy: ".")
|
||||
let mimeType = mimeTypeArray[mimeTypeArray.count - 2] + "." + mimeTypeArray[mimeTypeArray.count - 1]
|
||||
|
||||
|
||||
for richdocumentMimetype: String in NCGlobal.shared.capabilityRichdocumentsMimetypes {
|
||||
if richdocumentMimetype.contains(mimeType) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
|
||||
@objc func isDirectEditing(account: String, contentType: String) -> [String] {
|
||||
|
||||
|
||||
var editor: [String] = []
|
||||
|
||||
|
||||
guard let results = NCManageDatabase.shared.getDirectEditingEditors(account: account) else {
|
||||
return editor
|
||||
}
|
||||
|
||||
|
||||
for result: tableDirectEditingEditors in results {
|
||||
for mimetype in result.mimetypes {
|
||||
if mimetype == contentType {
|
||||
editor.append(result.editor)
|
||||
}
|
||||
|
||||
|
||||
// HARDCODE
|
||||
// https://github.com/nextcloud/text/issues/913
|
||||
|
||||
|
||||
if mimetype == "text/markdown" && contentType == "text/x-markdown" {
|
||||
editor.append(result.editor)
|
||||
}
|
||||
|
@ -195,37 +195,37 @@ class NCUtility: NSObject {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// HARDCODE
|
||||
// if editor.count == 0 {
|
||||
// editor.append(NCGlobal.shared.editorText)
|
||||
// }
|
||||
|
||||
|
||||
return Array(Set(editor))
|
||||
}
|
||||
|
||||
|
||||
#if !EXTENSION
|
||||
@objc func removeAllSettings() {
|
||||
|
||||
|
||||
URLCache.shared.memoryCapacity = 0
|
||||
URLCache.shared.diskCapacity = 0
|
||||
|
||||
|
||||
NCManageDatabase.shared.clearDatabase(account: nil, removeAccount: true)
|
||||
|
||||
|
||||
CCUtility.removeGroupDirectoryProviderStorage()
|
||||
CCUtility.removeGroupLibraryDirectory()
|
||||
|
||||
|
||||
CCUtility.removeDocumentsDirectory()
|
||||
CCUtility.removeTemporaryDirectory()
|
||||
|
||||
|
||||
CCUtility.createDirectoryStandard()
|
||||
|
||||
|
||||
CCUtility.deleteAllChainStore()
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
@objc func permissionsContainsString(_ metadataPermissions: String, permissions: String) -> Bool {
|
||||
|
||||
|
||||
for char in permissions {
|
||||
if metadataPermissions.contains(char) == false {
|
||||
return false
|
||||
|
@ -233,7 +233,7 @@ class NCUtility: NSObject {
|
|||
}
|
||||
return true
|
||||
}
|
||||
|
||||
|
||||
@objc func getCustomUserAgentNCText() -> String {
|
||||
let userAgent: String = CCUtility.getUserAgent()
|
||||
if UIDevice.current.userInterfaceIdiom == .phone {
|
||||
|
@ -246,9 +246,9 @@ class NCUtility: NSObject {
|
|||
return userAgent
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@objc func getCustomUserAgentOnlyOffice() -> String {
|
||||
|
||||
|
||||
let appVersion = Bundle.main.object(forInfoDictionaryKey: "CFBundleShortVersionString")!
|
||||
if UIDevice.current.userInterfaceIdiom == .pad {
|
||||
return "Mozilla/5.0 (iPad) Nextcloud-iOS/\(appVersion)"
|
||||
|
@ -256,50 +256,50 @@ class NCUtility: NSObject {
|
|||
return "Mozilla/5.0 (iPhone) Mobile Nextcloud-iOS/\(appVersion)"
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@objc func pdfThumbnail(url: URL, width: CGFloat = 240) -> UIImage? {
|
||||
|
||||
|
||||
guard let data = try? Data(contentsOf: url), let page = PDFDocument(data: data)?.page(at: 0) else {
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
let pageSize = page.bounds(for: .mediaBox)
|
||||
let pdfScale = width / pageSize.width
|
||||
|
||||
|
||||
// Apply if you're displaying the thumbnail on screen
|
||||
let scale = UIScreen.main.scale * pdfScale
|
||||
let screenSize = CGSize(width: pageSize.width * scale, height: pageSize.height * scale)
|
||||
|
||||
|
||||
return page.thumbnail(of: screenSize, for: .mediaBox)
|
||||
}
|
||||
|
||||
|
||||
@objc func isQuickLookDisplayable(metadata: tableMetadata) -> Bool {
|
||||
return true
|
||||
}
|
||||
|
||||
|
||||
@objc func ocIdToFileId(ocId: String?) -> String? {
|
||||
|
||||
|
||||
guard let ocId = ocId else { return nil }
|
||||
|
||||
|
||||
let items = ocId.components(separatedBy: "oc")
|
||||
if items.count < 2 { return nil }
|
||||
guard let intFileId = Int(items[0]) else { return nil }
|
||||
return String(intFileId)
|
||||
}
|
||||
|
||||
|
||||
func getUserStatus(userIcon: String?, userStatus: String?, userMessage: String?) -> (onlineStatus: UIImage?, statusMessage: String, descriptionMessage: String) {
|
||||
|
||||
|
||||
var onlineStatus: UIImage?
|
||||
var statusMessage: String = ""
|
||||
var descriptionMessage: String = ""
|
||||
var messageUserDefined: String = ""
|
||||
|
||||
|
||||
if userStatus?.lowercased() == "online" {
|
||||
onlineStatus = UIImage(named: "circle_fill")!.image(color: UIColor(red: 103.0/255.0, green: 176.0/255.0, blue: 134.0/255.0, alpha: 1.0), size: 50)
|
||||
onlineStatus = UIImage(named: "circle_fill")!.image(color: UIColor(red: 103.0 / 255.0, green: 176.0 / 255.0, blue: 134.0 / 255.0, alpha: 1.0), size: 50)
|
||||
messageUserDefined = NSLocalizedString("_online_", comment: "")
|
||||
}
|
||||
if userStatus?.lowercased() == "away" {
|
||||
onlineStatus = UIImage(named: "userStatusAway")!.image(color: UIColor(red: 233.0/255.0, green: 166.0/255.0, blue: 75.0/255.0, alpha: 1.0), size: 50)
|
||||
onlineStatus = UIImage(named: "userStatusAway")!.image(color: UIColor(red: 233.0 / 255.0, green: 166.0 / 255.0, blue: 75.0 / 255.0, alpha: 1.0), size: 50)
|
||||
messageUserDefined = NSLocalizedString("_away_", comment: "")
|
||||
}
|
||||
if userStatus?.lowercased() == "dnd" {
|
||||
|
@ -312,7 +312,7 @@ class NCUtility: NSObject {
|
|||
messageUserDefined = NSLocalizedString("_invisible_", comment: "")
|
||||
descriptionMessage = NSLocalizedString("_invisible_description_", comment: "")
|
||||
}
|
||||
|
||||
|
||||
if let userIcon = userIcon {
|
||||
statusMessage = userIcon + " "
|
||||
}
|
||||
|
@ -323,18 +323,18 @@ class NCUtility: NSObject {
|
|||
if statusMessage == "" {
|
||||
statusMessage = messageUserDefined
|
||||
}
|
||||
|
||||
|
||||
return(onlineStatus, statusMessage, descriptionMessage)
|
||||
}
|
||||
|
||||
|
||||
func imageFromVideo(url: URL, at time: TimeInterval) -> UIImage? {
|
||||
|
||||
|
||||
let asset = AVURLAsset(url: url)
|
||||
let assetIG = AVAssetImageGenerator(asset: asset)
|
||||
|
||||
|
||||
assetIG.appliesPreferredTrackTransform = true
|
||||
assetIG.apertureMode = AVAssetImageGenerator.ApertureMode.encodedPixels
|
||||
|
||||
|
||||
let cmTime = CMTime(seconds: time, preferredTimescale: 60)
|
||||
let thumbnailImageRef: CGImage
|
||||
do {
|
||||
|
@ -343,19 +343,19 @@ class NCUtility: NSObject {
|
|||
print("Error: \(error)")
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
return UIImage(cgImage: thumbnailImageRef)
|
||||
}
|
||||
|
||||
|
||||
func imageFromVideo(url: URL, at time: TimeInterval, completion: @escaping (UIImage?) -> Void) {
|
||||
DispatchQueue.global().async {
|
||||
|
||||
|
||||
let asset = AVURLAsset(url: url)
|
||||
let assetIG = AVAssetImageGenerator(asset: asset)
|
||||
|
||||
|
||||
assetIG.appliesPreferredTrackTransform = true
|
||||
assetIG.apertureMode = AVAssetImageGenerator.ApertureMode.encodedPixels
|
||||
|
||||
|
||||
let cmTime = CMTime(seconds: time, preferredTimescale: 60)
|
||||
let thumbnailImageRef: CGImage
|
||||
do {
|
||||
|
@ -364,46 +364,46 @@ class NCUtility: NSObject {
|
|||
print("Error: \(error)")
|
||||
return completion(nil)
|
||||
}
|
||||
|
||||
|
||||
DispatchQueue.main.async {
|
||||
completion(UIImage(cgImage: thumbnailImageRef))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
func createImageFrom(fileNameView: String, ocId: String, etag: String, classFile: String) {
|
||||
|
||||
|
||||
var originalImage, scaleImagePreview, scaleImageIcon: UIImage?
|
||||
|
||||
|
||||
let fileNamePath = CCUtility.getDirectoryProviderStorageOcId(ocId, fileNameView: fileNameView)!
|
||||
let fileNamePathPreview = CCUtility.getDirectoryProviderStoragePreviewOcId(ocId, etag: etag)!
|
||||
let fileNamePathIcon = CCUtility.getDirectoryProviderStorageIconOcId(ocId, etag: etag)!
|
||||
|
||||
|
||||
if CCUtility.fileProviderStorageSize(ocId, fileNameView: fileNameView) > 0 && FileManager().fileExists(atPath: fileNamePathPreview) && FileManager().fileExists(atPath: fileNamePathIcon) { return }
|
||||
if classFile != NKCommon.TypeClassFile.image.rawValue && classFile != NKCommon.TypeClassFile.video.rawValue { return }
|
||||
|
||||
|
||||
if classFile == NKCommon.TypeClassFile.image.rawValue {
|
||||
|
||||
|
||||
originalImage = UIImage(contentsOfFile: fileNamePath)
|
||||
|
||||
|
||||
scaleImagePreview = originalImage?.resizeImage(size: CGSize(width: NCGlobal.shared.sizePreview, height: NCGlobal.shared.sizePreview))
|
||||
scaleImageIcon = originalImage?.resizeImage(size: CGSize(width: NCGlobal.shared.sizeIcon, height: NCGlobal.shared.sizeIcon))
|
||||
|
||||
|
||||
try? scaleImagePreview?.jpegData(compressionQuality: 0.7)?.write(to: URL(fileURLWithPath: fileNamePathPreview))
|
||||
try? scaleImageIcon?.jpegData(compressionQuality: 0.7)?.write(to: URL(fileURLWithPath: fileNamePathIcon))
|
||||
|
||||
|
||||
} else if classFile == NKCommon.TypeClassFile.video.rawValue {
|
||||
|
||||
let videoPath = NSTemporaryDirectory()+"tempvideo.mp4"
|
||||
|
||||
let videoPath = NSTemporaryDirectory() + "tempvideo.mp4"
|
||||
NCUtilityFileSystem.shared.linkItem(atPath: fileNamePath, toPath: videoPath)
|
||||
|
||||
|
||||
originalImage = imageFromVideo(url: URL(fileURLWithPath: videoPath), at: 0)
|
||||
|
||||
|
||||
try? originalImage?.jpegData(compressionQuality: 0.7)?.write(to: URL(fileURLWithPath: fileNamePathPreview))
|
||||
try? originalImage?.jpegData(compressionQuality: 0.7)?.write(to: URL(fileURLWithPath: fileNamePathIcon))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@objc func getVersionApp(withBuild: Bool = true) -> String {
|
||||
if let dictionary = Bundle.main.infoDictionary {
|
||||
if let version = dictionary["CFBundleShortVersionString"], let build = dictionary["CFBundleVersion"] {
|
||||
|
@ -416,11 +416,11 @@ class NCUtility: NSObject {
|
|||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
|
||||
func loadImage(named imageName: String, color: UIColor = UIColor.systemGray, size: CGFloat = 50, symbolConfiguration: Any? = nil, renderingMode: UIImage.RenderingMode = .alwaysOriginal) -> UIImage {
|
||||
|
||||
|
||||
var image: UIImage?
|
||||
|
||||
|
||||
// see https://stackoverflow.com/questions/71764255
|
||||
let sfSymbolName = imageName.replacingOccurrences(of: "_", with: ".")
|
||||
if let symbolConfiguration = symbolConfiguration {
|
||||
|
@ -434,15 +434,15 @@ class NCUtility: NSObject {
|
|||
if let image = image {
|
||||
return image
|
||||
}
|
||||
|
||||
|
||||
return UIImage(named: "file")!.image(color: color, size: size)
|
||||
}
|
||||
|
||||
|
||||
@objc func loadUserImage(for user: String, displayName: String?, userBaseUrl: NCUserBaseUrl) -> UIImage {
|
||||
|
||||
|
||||
let fileName = userBaseUrl.userBaseUrl + "-" + user + ".png"
|
||||
let localFilePath = String(CCUtility.getDirectoryUserData()) + "/" + fileName
|
||||
|
||||
|
||||
if let localImage = UIImage(contentsOfFile: localFilePath) {
|
||||
return createAvatar(image: localImage, size: 30)
|
||||
} else if let loadedAvatar = NCManageDatabase.shared.getImageAvatarLoaded(fileName: fileName) {
|
||||
|
@ -451,27 +451,27 @@ class NCUtility: NSObject {
|
|||
return avatarImg
|
||||
} else { return getDefaultUserIcon() }
|
||||
}
|
||||
|
||||
|
||||
func getDefaultUserIcon() -> UIImage {
|
||||
|
||||
|
||||
let config = UIImage.SymbolConfiguration(pointSize: 30)
|
||||
return NCUtility.shared.loadImage(named: "person.crop.circle", symbolConfiguration: config)
|
||||
}
|
||||
|
||||
|
||||
@objc func createAvatar(image: UIImage, size: CGFloat) -> UIImage {
|
||||
|
||||
|
||||
var avatarImage = image
|
||||
let rect = CGRect(x: 0, y: 0, width: size, height: size)
|
||||
|
||||
|
||||
UIGraphicsBeginImageContextWithOptions(rect.size, false, 3.0)
|
||||
UIBezierPath(roundedRect: rect, cornerRadius: rect.size.height).addClip()
|
||||
avatarImage.draw(in: rect)
|
||||
avatarImage = UIGraphicsGetImageFromCurrentImageContext() ?? image
|
||||
UIGraphicsEndImageContext()
|
||||
|
||||
|
||||
return avatarImage
|
||||
}
|
||||
|
||||
|
||||
func createAvatar(displayName: String, size: CGFloat) -> UIImage? {
|
||||
guard let initials = displayName.uppercaseInitials else {
|
||||
return nil
|
||||
|
@ -479,7 +479,7 @@ class NCUtility: NSObject {
|
|||
let userColor = NCGlobal.shared.usernameToColor(displayName)
|
||||
let rect = CGRect(x: 0, y: 0, width: size, height: size)
|
||||
var avatarImage: UIImage?
|
||||
|
||||
|
||||
UIGraphicsBeginImageContextWithOptions(rect.size, false, 3.0)
|
||||
let context = UIGraphicsGetCurrentContext()
|
||||
UIBezierPath(roundedRect: rect, cornerRadius: rect.size.height).addClip()
|
||||
|
@ -494,16 +494,16 @@ class NCUtility: NSObject {
|
|||
withAttributes: [NSAttributedString.Key.paragraphStyle: textStyle])
|
||||
avatarImage = UIGraphicsGetImageFromCurrentImageContext()
|
||||
UIGraphicsEndImageContext()
|
||||
|
||||
|
||||
return avatarImage
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
Facebook's comparison algorithm:
|
||||
*/
|
||||
|
||||
|
||||
func compare(tolerance: Float, expected: Data, observed: Data) throws -> Bool {
|
||||
|
||||
|
||||
enum customError: Error {
|
||||
case unableToGetUIImageFromData
|
||||
case unableToGetCGImageFromData
|
||||
|
@ -511,7 +511,7 @@ class NCUtility: NSObject {
|
|||
case imagesHasDifferentSizes
|
||||
case unableToInitializeContext
|
||||
}
|
||||
|
||||
|
||||
guard let expectedUIImage = UIImage(data: expected), let observedUIImage = UIImage(data: observed) else {
|
||||
throw customError.unableToGetUIImageFromData
|
||||
}
|
||||
|
@ -526,17 +526,17 @@ class NCUtility: NSObject {
|
|||
}
|
||||
let imageSize = CGSize(width: expectedCGImage.width, height: expectedCGImage.height)
|
||||
let numberOfPixels = Int(imageSize.width * imageSize.height)
|
||||
|
||||
|
||||
// Checking that our `UInt32` buffer has same number of bytes as image has.
|
||||
let bytesPerRow = min(expectedCGImage.bytesPerRow, observedCGImage.bytesPerRow)
|
||||
assert(MemoryLayout<UInt32>.stride == bytesPerRow / Int(imageSize.width))
|
||||
|
||||
|
||||
let expectedPixels = UnsafeMutablePointer<UInt32>.allocate(capacity: numberOfPixels)
|
||||
let observedPixels = UnsafeMutablePointer<UInt32>.allocate(capacity: numberOfPixels)
|
||||
|
||||
|
||||
let expectedPixelsRaw = UnsafeMutableRawPointer(expectedPixels)
|
||||
let observedPixelsRaw = UnsafeMutableRawPointer(observedPixels)
|
||||
|
||||
|
||||
let bitmapInfo = CGBitmapInfo(rawValue: CGImageAlphaInfo.premultipliedLast.rawValue)
|
||||
guard let expectedContext = CGContext(data: expectedPixelsRaw, width: Int(imageSize.width), height: Int(imageSize.height),
|
||||
bitsPerComponent: expectedCGImage.bitsPerComponent, bytesPerRow: bytesPerRow,
|
||||
|
@ -552,13 +552,13 @@ class NCUtility: NSObject {
|
|||
observedPixels.deallocate()
|
||||
throw customError.unableToInitializeContext
|
||||
}
|
||||
|
||||
|
||||
expectedContext.draw(expectedCGImage, in: CGRect(origin: .zero, size: imageSize))
|
||||
observedContext.draw(observedCGImage, in: CGRect(origin: .zero, size: imageSize))
|
||||
|
||||
|
||||
let expectedBuffer = UnsafeBufferPointer(start: expectedPixels, count: numberOfPixels)
|
||||
let observedBuffer = UnsafeBufferPointer(start: observedPixels, count: numberOfPixels)
|
||||
|
||||
|
||||
var isEqual = true
|
||||
if tolerance == 0 {
|
||||
isEqual = expectedBuffer.elementsEqual(observedBuffer)
|
||||
|
@ -575,50 +575,50 @@ class NCUtility: NSObject {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
expectedPixels.deallocate()
|
||||
observedPixels.deallocate()
|
||||
|
||||
|
||||
return isEqual
|
||||
}
|
||||
|
||||
|
||||
func stringFromTime(_ time: CMTime) -> String {
|
||||
|
||||
|
||||
let interval = Int(CMTimeGetSeconds(time))
|
||||
|
||||
|
||||
let seconds = interval % 60
|
||||
let minutes = (interval / 60) % 60
|
||||
let hours = (interval / 3600)
|
||||
|
||||
|
||||
if hours > 0 {
|
||||
return String(format: "%02d:%02d:%02d", hours, minutes, seconds)
|
||||
} else {
|
||||
return String(format: "%02d:%02d", minutes, seconds)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
func colorNavigationController(_ navigationController: UINavigationController?, backgroundColor: UIColor, titleColor: UIColor, tintColor: UIColor?, withoutShadow: Bool) {
|
||||
|
||||
|
||||
let appearance = UINavigationBarAppearance()
|
||||
appearance.titleTextAttributes = [.foregroundColor: titleColor]
|
||||
appearance.largeTitleTextAttributes = [.foregroundColor: titleColor]
|
||||
|
||||
|
||||
if withoutShadow {
|
||||
appearance.shadowColor = .clear
|
||||
appearance.shadowImage = UIImage()
|
||||
}
|
||||
|
||||
|
||||
if let tintColor = tintColor {
|
||||
navigationController?.navigationBar.tintColor = tintColor
|
||||
}
|
||||
|
||||
|
||||
navigationController?.view.backgroundColor = backgroundColor
|
||||
navigationController?.navigationBar.barTintColor = titleColor
|
||||
navigationController?.navigationBar.standardAppearance = appearance
|
||||
navigationController?.navigationBar.compactAppearance = appearance
|
||||
navigationController?.navigationBar.scrollEdgeAppearance = appearance
|
||||
}
|
||||
|
||||
|
||||
func getEncondingDataType(data: Data) -> String.Encoding? {
|
||||
if let _ = String(data: data, encoding: .utf8) {
|
||||
return .utf8
|
||||
|
@ -688,18 +688,18 @@ class NCUtility: NSObject {
|
|||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
func SYSTEM_VERSION_LESS_THAN(version: String) -> Bool {
|
||||
return UIDevice.current.systemVersion.compare(version,
|
||||
options: NSString.CompareOptions.numeric) == ComparisonResult.orderedAscending
|
||||
}
|
||||
|
||||
|
||||
func getAvatarFromIconUrl(metadata: tableMetadata) -> String? {
|
||||
|
||||
|
||||
var ownerId: String?
|
||||
if metadata.iconUrl.contains("http") && metadata.iconUrl.contains("avatar") {
|
||||
let splitIconUrl = metadata.iconUrl.components(separatedBy: "/")
|
||||
var found:Bool = false
|
||||
var found: Bool = false
|
||||
for item in splitIconUrl {
|
||||
if found {
|
||||
ownerId = item
|
||||
|
@ -710,21 +710,21 @@ class NCUtility: NSObject {
|
|||
}
|
||||
return ownerId
|
||||
}
|
||||
|
||||
|
||||
// https://stackoverflow.com/questions/25471114/how-to-validate-an-e-mail-address-in-swift
|
||||
func isValidEmail(_ email: String) -> Bool {
|
||||
|
||||
|
||||
let emailRegEx = "[A-Z0-9a-z._%+-]+@[A-Za-z0-9.-]+\\.[A-Za-z]{2,64}"
|
||||
let emailPred = NSPredicate(format:"SELF MATCHES %@", emailRegEx)
|
||||
let emailPred = NSPredicate(format: "SELF MATCHES %@", emailRegEx)
|
||||
return emailPred.evaluate(with: email)
|
||||
}
|
||||
|
||||
|
||||
func createFilePreviewImage(ocId: String, etag: String, fileNameView: String, classFile: String, status: Int, createPreviewMedia: Bool) -> UIImage? {
|
||||
|
||||
|
||||
var imagePreview: UIImage?
|
||||
let filePath = CCUtility.getDirectoryProviderStorageOcId(ocId, fileNameView: fileNameView)!
|
||||
let iconImagePath = CCUtility.getDirectoryProviderStorageIconOcId(ocId, etag: etag)!
|
||||
|
||||
|
||||
if FileManager().fileExists(atPath: iconImagePath) {
|
||||
imagePreview = UIImage(contentsOfFile: iconImagePath)
|
||||
} else if !createPreviewMedia {
|
||||
|
@ -732,22 +732,22 @@ class NCUtility: NSObject {
|
|||
} else if createPreviewMedia && status >= NCGlobal.shared.metadataStatusNormal && classFile == NKCommon.TypeClassFile.image.rawValue && FileManager().fileExists(atPath: filePath) {
|
||||
if let image = UIImage(contentsOfFile: filePath), let image = image.resizeImage(size: CGSize(width: NCGlobal.shared.sizeIcon, height: NCGlobal.shared.sizeIcon)), let data = image.jpegData(compressionQuality: 0.5) {
|
||||
do {
|
||||
try data.write(to: URL.init(fileURLWithPath: iconImagePath), options: .atomic)
|
||||
try data.write(to: URL(fileURLWithPath: iconImagePath), options: .atomic)
|
||||
imagePreview = image
|
||||
} catch { }
|
||||
}
|
||||
} else if createPreviewMedia && status >= NCGlobal.shared.metadataStatusNormal && classFile == NKCommon.TypeClassFile.video.rawValue && FileManager().fileExists(atPath: filePath) {
|
||||
if let image = NCUtility.shared.imageFromVideo(url: URL(fileURLWithPath: filePath), at: 0), let image = image.resizeImage(size: CGSize(width: NCGlobal.shared.sizeIcon, height: NCGlobal.shared.sizeIcon)), let data = image.jpegData(compressionQuality: 0.5) {
|
||||
do {
|
||||
try data.write(to: URL.init(fileURLWithPath: iconImagePath), options: .atomic)
|
||||
try data.write(to: URL(fileURLWithPath: iconImagePath), options: .atomic)
|
||||
imagePreview = image
|
||||
} catch { }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return imagePreview
|
||||
}
|
||||
|
||||
|
||||
func isDirectoryE2EE(serverUrl: String, userBase: NCUserBaseUrl) -> Bool {
|
||||
return isDirectoryE2EE(account: userBase.account, urlBase: userBase.urlBase, userId: userBase.userId, serverUrl: serverUrl)
|
||||
}
|
||||
|
@ -767,7 +767,7 @@ class NCUtility: NSObject {
|
|||
func isDirectoryE2EETop(account: String, serverUrl: String) -> Bool {
|
||||
|
||||
guard var serverUrl = serverUrl.addingPercentEncoding(withAllowedCharacters: .urlQueryAllowed) else { return false }
|
||||
|
||||
|
||||
if let url = URL(string: serverUrl)?.deletingLastPathComponent(),
|
||||
let serverUrl = String(url.absoluteString.dropLast()).removingPercentEncoding {
|
||||
if let directory = NCManageDatabase.shared.getTableDirectory(account: account, serverUrl: serverUrl) {
|
||||
|
@ -799,11 +799,11 @@ class NCUtility: NSObject {
|
|||
}
|
||||
|
||||
func createViewImageAndText(image: UIImage, title: String? = nil) -> UIView {
|
||||
|
||||
|
||||
let imageView = UIImageView()
|
||||
let titleView = UIView()
|
||||
let label = UILabel()
|
||||
|
||||
|
||||
if let title = title {
|
||||
label.text = title + " "
|
||||
} else {
|
||||
|
@ -812,15 +812,15 @@ class NCUtility: NSObject {
|
|||
label.sizeToFit()
|
||||
label.center = titleView.center
|
||||
label.textAlignment = NSTextAlignment.center
|
||||
|
||||
|
||||
imageView.image = image
|
||||
|
||||
|
||||
let imageAspect = (imageView.image?.size.width ?? 0) / (imageView.image?.size.height ?? 0)
|
||||
let imageX = label.frame.origin.x - label.frame.size.height * imageAspect
|
||||
let imageY = label.frame.origin.y
|
||||
let imageWidth = label.frame.size.height * imageAspect
|
||||
let imageHeight = label.frame.size.height
|
||||
|
||||
|
||||
if title != nil {
|
||||
imageView.frame = CGRect(x: imageX, y: imageY, width: imageWidth, height: imageHeight)
|
||||
titleView.addSubview(label)
|
||||
|
@ -828,10 +828,10 @@ class NCUtility: NSObject {
|
|||
imageView.frame = CGRect(x: imageX / 2, y: imageY, width: imageWidth, height: imageHeight)
|
||||
}
|
||||
imageView.contentMode = UIView.ContentMode.scaleAspectFit
|
||||
|
||||
|
||||
titleView.addSubview(imageView)
|
||||
titleView.sizeToFit()
|
||||
|
||||
|
||||
return titleView
|
||||
}
|
||||
|
||||
|
@ -842,12 +842,10 @@ class NCUtility: NSObject {
|
|||
geocoder.reverseGeocodeLocation(llocation) { placemarks, error in
|
||||
if error == nil, let placemark = placemarks?.first {
|
||||
let locationComponents: [String] = [placemark.name, placemark.locality, placemark.country]
|
||||
.compactMap{$0}
|
||||
.compactMap {$0}
|
||||
|
||||
completion(locationComponents.joined(separator: ", "))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -172,7 +172,7 @@ class NCUtilityFileSystem: NSObject {
|
|||
if home == serverUrlPath {
|
||||
return serverUrlPath
|
||||
}
|
||||
|
||||
|
||||
if let serverUrlPath = serverUrlPath.urlEncoded, let url = URL(string: serverUrlPath) {
|
||||
if let path = url.deletingLastPathComponent().absoluteString.removingPercentEncoding {
|
||||
if path.last == "/" {
|
||||
|
@ -205,8 +205,8 @@ class NCUtilityFileSystem: NSObject {
|
|||
resultFileName = name + " " + "1" + "." + ext
|
||||
}
|
||||
} else {
|
||||
let space = characters[characters.count-2]
|
||||
let numChar = characters[characters.count-1]
|
||||
let space = characters[characters.count - 2]
|
||||
let numChar = characters[characters.count - 1]
|
||||
var num = Int(String(numChar))
|
||||
if space == " " && num != nil {
|
||||
name = String(name.dropLast())
|
||||
|
@ -256,7 +256,7 @@ class NCUtilityFileSystem: NSObject {
|
|||
|
||||
if days == 0 { return}
|
||||
|
||||
let minimumDate = Date().addingTimeInterval(-days*24*60*60)
|
||||
let minimumDate = Date().addingTimeInterval(-days * 24 * 60 * 60)
|
||||
let url = URL(fileURLWithPath: directory)
|
||||
var offlineDir: [String] = []
|
||||
var offlineFiles: [String] = []
|
||||
|
|
|
@ -117,7 +117,7 @@ class NCViewer: NSObject {
|
|||
if metadata.url == "" {
|
||||
|
||||
NCActivityIndicator.shared.start(backgroundView: viewController.view)
|
||||
NextcloudKit.shared.createUrlRichdocuments(fileID: metadata.fileId) { account, url, data, error in
|
||||
NextcloudKit.shared.createUrlRichdocuments(fileID: metadata.fileId) { account, url, _, error in
|
||||
|
||||
NCActivityIndicator.shared.stop()
|
||||
|
||||
|
@ -182,7 +182,7 @@ class NCViewer: NSObject {
|
|||
}
|
||||
|
||||
NCActivityIndicator.shared.start(backgroundView: viewController.view)
|
||||
NextcloudKit.shared.NCTextOpenFile(fileNamePath: fileNamePath, editor: editor, options: options) { account, url, data, error in
|
||||
NextcloudKit.shared.NCTextOpenFile(fileNamePath: fileNamePath, editor: editor, options: options) { account, url, _, error in
|
||||
|
||||
NCActivityIndicator.shared.stop()
|
||||
|
||||
|
|
|
@ -137,7 +137,7 @@ class NCPlayerToolBar: UIView {
|
|||
}
|
||||
|
||||
playerButtonView.isHidden = true
|
||||
|
||||
|
||||
playButton.setImage(NCUtility.shared.loadImage(named: "play.fill", color: .white, symbolConfiguration: UIImage.SymbolConfiguration(pointSize: pointSize)), for: .normal)
|
||||
|
||||
playbackSlider.value = position
|
||||
|
@ -481,7 +481,7 @@ extension NCPlayerToolBar: NCSelectDelegate {
|
|||
}, taskHandler: { _ in
|
||||
}, progressHandler: { progress in
|
||||
self.hud.progress = Float(progress.fractionCompleted)
|
||||
}) { account, _, _, _, _, _, error in
|
||||
}) { _, _, _, _, _, _, error in
|
||||
self.hud.dismiss()
|
||||
if error == .success {
|
||||
self.addPlaybackSlave(type: type, metadata: metadata)
|
||||
|
|
|
@ -181,7 +181,7 @@ class NCViewerMedia: UIViewController {
|
|||
downloadRequest = request
|
||||
} progressHandler: { progress in
|
||||
hud.progress = Float(progress.fractionCompleted)
|
||||
} completion: { afError, error in
|
||||
} completion: { _, error in
|
||||
if error == .success {
|
||||
hud.dismiss()
|
||||
if CCUtility.fileProviderStorageExists(self.metadata) {
|
||||
|
@ -250,7 +250,7 @@ class NCViewerMedia: UIViewController {
|
|||
self.openDetail()
|
||||
}
|
||||
}
|
||||
}, completion: { context in
|
||||
}, completion: { _ in
|
||||
self.showTip()
|
||||
if self.metadata.isVideo {
|
||||
self.imageVideoContainer.isHidden = false
|
||||
|
|
|
@ -186,7 +186,7 @@ class NCViewerMediaPage: UIViewController {
|
|||
}
|
||||
|
||||
func getViewerMedia(index: Int, metadata: tableMetadata) -> NCViewerMedia {
|
||||
|
||||
|
||||
let viewerMedia = UIStoryboard(name: "NCViewerMediaPage", bundle: nil).instantiateViewController(withIdentifier: "NCViewerMedia") as! NCViewerMedia
|
||||
viewerMedia.index = index
|
||||
viewerMedia.metadata = metadata
|
||||
|
@ -678,5 +678,3 @@ extension NCViewerMediaPage: NCViewerMediaViewDelegate {
|
|||
imageDetailNavigationItem.image = UIImage(systemName: "info.circle")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -53,7 +53,7 @@ class NCViewerNextcloudText: UIViewController, WKNavigationDelegate, WKScriptMes
|
|||
config.websiteDataStore = WKWebsiteDataStore.nonPersistent()
|
||||
let contentController = config.userContentController
|
||||
contentController.add(self, name: "DirectEditingMobileInterface")
|
||||
//FIXME: ONLYOFFICE Due to the WK Shared Workers issue the editors cannot be opened on the devices with iOS 16.1.
|
||||
// FIXME: ONLYOFFICE Due to the WK Shared Workers issue the editors cannot be opened on the devices with iOS 16.1.
|
||||
if editor == NCGlobal.shared.editorOnlyoffice {
|
||||
let dropSharedWorkersScript = WKUserScript(source: "delete window.SharedWorker;", injectionTime: WKUserScriptInjectionTime.atDocumentStart, forMainFrameOnly: false)
|
||||
config.userContentController.addUserScript(dropSharedWorkersScript)
|
||||
|
|
|
@ -280,10 +280,10 @@ class NCViewerPDF: UIViewController, NCViewerPDFSearchDelegate {
|
|||
|
||||
tipView?.dismiss()
|
||||
|
||||
coordinator.animate(alongsideTransition: { context in
|
||||
coordinator.animate(alongsideTransition: { _ in
|
||||
self.pdfThumbnailScrollViewTrailingAnchor?.constant = self.thumbnailViewWidth + (self.window?.safeAreaInsets.right ?? 0)
|
||||
self.pdfThumbnailScrollView.isHidden = true
|
||||
}, completion: { context in
|
||||
}, completion: { _ in
|
||||
self.pdfView.autoScales = true
|
||||
})
|
||||
}
|
||||
|
@ -384,7 +384,6 @@ class NCViewerPDF: UIViewController, NCViewerPDFSearchDelegate {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
@objc func renameFile(_ notification: NSNotification) {
|
||||
|
||||
guard let userInfo = notification.userInfo as NSDictionary?,
|
||||
|
@ -481,7 +480,6 @@ class NCViewerPDF: UIViewController, NCViewerPDFSearchDelegate {
|
|||
OpenPdfThumbnail()
|
||||
}
|
||||
|
||||
|
||||
// MARK: - OPEN / CLOSE Thumbnail
|
||||
|
||||
func OpenPdfThumbnail() {
|
||||
|
@ -533,7 +531,7 @@ class NCViewerPDF: UIViewController, NCViewerPDFSearchDelegate {
|
|||
guard let totalPages = pdfView.document?.pageCount else { return }
|
||||
|
||||
let visibleRect = CGRect(x: pdfThumbnailScrollView.contentOffset.x, y: pdfThumbnailScrollView.contentOffset.y, width: pdfThumbnailScrollView.bounds.size.width, height: pdfThumbnailScrollView.bounds.size.height)
|
||||
let centerPoint = CGPoint(x: visibleRect.size.width/2, y: visibleRect.size.height/2)
|
||||
let centerPoint = CGPoint(x: visibleRect.size.width / 2, y: visibleRect.size.height / 2)
|
||||
let currentPageY = CGFloat(curPage) * thumbnailViewHeight + CGFloat(curPage) * thumbnailPadding
|
||||
var gotoY = currentPageY - centerPoint.y
|
||||
|
||||
|
|
|
@ -91,7 +91,7 @@ class NCViewerPDFSearch: UITableViewController, UISearchBarDelegate, PDFDocument
|
|||
|
||||
let nsRange = NSString(string: extendSelection.string!).range(of: pdfSelection.string!, options: String.CompareOptions.caseInsensitive)
|
||||
if nsRange.location != NSNotFound {
|
||||
let attributedSubString = NSAttributedString(string: NSString(string: extendSelection.string!).substring(with: nsRange), attributes: [NSAttributedString.Key.font: UIFont.boldSystemFont(ofSize: 17), NSAttributedString.Key.foregroundColor : UIColor.systemBlue])
|
||||
let attributedSubString = NSAttributedString(string: NSString(string: extendSelection.string!).substring(with: nsRange), attributes: [NSAttributedString.Key.font: UIFont.boldSystemFont(ofSize: 17), NSAttributedString.Key.foregroundColor: UIColor.systemBlue])
|
||||
let attributedString = NSMutableAttributedString(string: extendSelection.string!)
|
||||
attributedString.replaceCharacters(in: nsRange, with: attributedSubString)
|
||||
cell.searchResultTextLabel.attributedText = attributedString
|
||||
|
|
|
@ -51,10 +51,10 @@ class NCViewerProviderContextMenu: UIViewController {
|
|||
|
||||
if metadata.directory {
|
||||
|
||||
var imageFolder = UIImage(named: "folder")!.image(color: NCBrandColor.shared.brandElement, size: sizeIcon*2)
|
||||
var imageFolder = UIImage(named: "folder")!.image(color: NCBrandColor.shared.brandElement, size: sizeIcon * 2)
|
||||
|
||||
if let image = self.image {
|
||||
imageFolder = image.image(color: NCBrandColor.shared.brandElement, size: sizeIcon*2)
|
||||
imageFolder = image.image(color: NCBrandColor.shared.brandElement, size: sizeIcon * 2)
|
||||
}
|
||||
|
||||
imageView.image = imageFolder.colorizeFolder(metadata: metadata)
|
||||
|
@ -63,7 +63,7 @@ class NCViewerProviderContextMenu: UIViewController {
|
|||
} else {
|
||||
|
||||
// ICON
|
||||
if let image = UIImage(named: metadata.iconName)?.resizeImage(size: CGSize(width: sizeIcon*2, height: sizeIcon*2)) {
|
||||
if let image = UIImage(named: metadata.iconName)?.resizeImage(size: CGSize(width: sizeIcon * 2, height: sizeIcon * 2)) {
|
||||
|
||||
imageView.image = image
|
||||
imageView.frame = resize(CGSize(width: sizeIcon, height: sizeIcon))
|
||||
|
@ -239,7 +239,7 @@ class NCViewerProviderContextMenu: UIViewController {
|
|||
|
||||
private func viewVideo(metadata: tableMetadata) {
|
||||
|
||||
NCNetworking.shared.getVideoUrl(metadata: metadata) { url, autoplay, _ in
|
||||
NCNetworking.shared.getVideoUrl(metadata: metadata) { url, _, _ in
|
||||
if let url = url, let userAgent = CCUtility.getUserAgent() {
|
||||
self.player.media = VLCMedia(url: url)
|
||||
self.player.delegate = self
|
||||
|
|
|
@ -194,7 +194,7 @@ class NCViewerRichdocument: UIViewController, WKNavigationDelegate, WKScriptMess
|
|||
self.present(browserWebVC, animated: true)
|
||||
|
||||
return
|
||||
|
||||
|
||||
} else {
|
||||
|
||||
// TYPE PRINT - DOWNLOAD
|
||||
|
@ -207,7 +207,7 @@ class NCViewerRichdocument: UIViewController, WKNavigationDelegate, WKScriptMess
|
|||
|
||||
}, progressHandler: { _ in
|
||||
|
||||
}, completionHandler: { account, _, _, _, allHeaderFields, afError, error in
|
||||
}, completionHandler: { account, _, _, _, allHeaderFields, _, error in
|
||||
|
||||
NCActivityIndicator.shared.stop()
|
||||
|
||||
|
@ -292,7 +292,7 @@ class NCViewerRichdocument: UIViewController, WKNavigationDelegate, WKScriptMess
|
|||
|
||||
let path = CCUtility.returnFileNamePath(fromFileName: metadata!.fileName, serverUrl: serverUrl!, urlBase: appDelegate.urlBase, userId: appDelegate.userId, account: metadata!.account)!
|
||||
|
||||
NextcloudKit.shared.createAssetRichdocuments(path: path) { account, url, data, error in
|
||||
NextcloudKit.shared.createAssetRichdocuments(path: path) { account, url, _, error in
|
||||
if error == .success && account == self.appDelegate.account {
|
||||
let functionJS = "OCA.RichDocuments.documentsMain.postAsset('\(metadata!.fileNameView)', '\(url!)')"
|
||||
self.webView.evaluateJavaScript(functionJS, completionHandler: { _, _ in })
|
||||
|
@ -309,7 +309,7 @@ class NCViewerRichdocument: UIViewController, WKNavigationDelegate, WKScriptMess
|
|||
|
||||
let path = CCUtility.returnFileNamePath(fromFileName: metadata!.fileName, serverUrl: serverUrl!, urlBase: appDelegate.urlBase, userId: appDelegate.userId, account: metadata!.account)!
|
||||
|
||||
NextcloudKit.shared.createAssetRichdocuments(path: path) { account, url, data, error in
|
||||
NextcloudKit.shared.createAssetRichdocuments(path: path) { account, url, _, error in
|
||||
if error == .success && account == self.appDelegate.account {
|
||||
let functionJS = "OCA.RichDocuments.documentsMain.postAsset('\(metadata.fileNameView)', '\(url!)')"
|
||||
self.webView.evaluateJavaScript(functionJS, completionHandler: { _, _ in })
|
||||
|
|
Загрузка…
Ссылка в новой задаче