Skip to content

Commit

Permalink
remove old code
Browse files Browse the repository at this point in the history
Signed-off-by: Marino Faggiana <[email protected]>
  • Loading branch information
marinofaggiana committed Jun 6, 2024
1 parent 2b2cc81 commit 42c713e
Show file tree
Hide file tree
Showing 36 changed files with 168 additions and 305 deletions.

This file was deleted.

24 changes: 0 additions & 24 deletions File Provider Extension/FileProviderExtension-Bridging-Header.h

This file was deleted.

1 change: 1 addition & 0 deletions File Provider Extension/FileProviderExtension.swift
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
//

import UIKit
import UniformTypeIdentifiers
import FileProvider
import NextcloudKit
import Alamofire
Expand Down
28 changes: 0 additions & 28 deletions Nextcloud.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,4 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//

#import "CCUtility.h"
#import "NCPushNotificationEncryption.h"
1 change: 0 additions & 1 deletion Share/Share-Bridging-Header.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,4 @@
//

#import "NCEndToEndEncryption.h"
#import "CCUtility.h"
#import "UIImage+animatedGIF.h"
1 change: 0 additions & 1 deletion Widget/Widget-Brinding-header.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,4 @@
// Use this file to import your target's public headers that you would like to expose to Swift.
//

#import "CCUtility.h"
#import "UIImage+animatedGIF.h"
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,3 @@
// Use this file to import your target's public headers that you would like to expose to Swift.
//

#import "CCUtility.h"
1 change: 1 addition & 0 deletions iOSClient/Data/NCManageDatabase+Avatar.swift
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
//

import Foundation
import UIKit
import RealmSwift
import NextcloudKit

Expand Down
2 changes: 2 additions & 0 deletions iOSClient/Data/NCManageDatabase+PhotoLibrary.swift
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
//

import Foundation
import UIKit
import Photos
import RealmSwift
import NextcloudKit

Expand Down
1 change: 1 addition & 0 deletions iOSClient/Extensions/PHAsset+Extension.swift
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@

import Foundation
import UIKit
import Photos

extension PHAsset {
var originalFilename: NSString {
Expand Down
4 changes: 2 additions & 2 deletions iOSClient/Main/Create cloud/NCCreateFormUploadDocuments.swift
Original file line number Diff line number Diff line change
Expand Up @@ -340,8 +340,8 @@ import XLForm
}

self.dismiss(animated: true, completion: {
let createFileName = (fileName as NSString).deletingPathExtension + "." + self.fileNameExtension
let metadata = NCManageDatabase.shared.createMetadata(account: self.appDelegate.account, user: self.appDelegate.user, userId: self.appDelegate.userId, fileName: createFileName, fileNameView: createFileName, ocId: UUID, serverUrl: self.serverUrl, urlBase: self.appDelegate.urlBase, url: url, contentType: "")
let newFileName = (fileName as NSString).deletingPathExtension + "." + self.fileNameExtension
let metadata = NCManageDatabase.shared.createMetadata(account: self.appDelegate.account, user: self.appDelegate.user, userId: self.appDelegate.userId, fileName: newFileName, fileNameView: newFileName, ocId: UUID, serverUrl: self.serverUrl, urlBase: self.appDelegate.urlBase, url: url, contentType: "")
if let viewController = self.controller?.currentViewController() {
NCViewer().view(viewController: viewController, metadata: metadata, metadatas: [metadata], imageIcon: nil)
}
Expand Down
30 changes: 14 additions & 16 deletions iOSClient/Main/Create cloud/Upload Assets/NCUploadAssetsModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -116,14 +116,13 @@ class NCUploadAssetsModel: NSObject, ObservableObject, NCCreateFormUploadConflic
NCKeychain().setFileNameType(key: NCGlobal.shared.keyFileNameType, prefix: addFilenametype)
NCKeychain().setFileNameMask(key: NCGlobal.shared.keyFileNameMask, mask: fileName)

preview = CCUtility.createFileName(
getOriginalFilenameForPreview() as String,
fileDate: creationDate,
fileType: asset.mediaType,
keyFileName: fileName.isEmptyOrNil ? nil : NCGlobal.shared.keyFileNameMask,
keyFileNameType: NCGlobal.shared.keyFileNameType,
keyFileNameOriginal: NCGlobal.shared.keyFileNameOriginal,
forcedNewFileName: false
preview = NCUtilityFileSystem().createFileName(getOriginalFilenameForPreview() as String,
fileDate: creationDate,
fileType: asset.mediaType,
keyFileName: fileName.isEmptyOrNil ? nil : NCGlobal.shared.keyFileNameMask,
keyFileNameType: NCGlobal.shared.keyFileNameType,
keyFileNameOriginal: NCGlobal.shared.keyFileNameOriginal,
forcedNewFileName: false
)

let trimmedPreview = preview.trimmingCharacters(in: .whitespacesAndNewlines)
Expand Down Expand Up @@ -223,14 +222,13 @@ class NCUploadAssetsModel: NSObject, ObservableObject, NCCreateFormUploadConflic
let creationDate = asset.creationDate ?? Date()
let ext = assetFileName.pathExtension.lowercased()

let fileName = previewStore.fileName.isEmpty
? CCUtility.createFileName(assetFileName as String,
fileDate: creationDate,
fileType: asset.mediaType,
keyFileName: NCGlobal.shared.keyFileNameMask,
keyFileNameType: NCGlobal.shared.keyFileNameType,
keyFileNameOriginal: NCGlobal.shared.keyFileNameOriginal,
forcedNewFileName: false)!
let fileName = previewStore.fileName.isEmpty ? utilityFileSystem.createFileName(assetFileName as String,
fileDate: creationDate,
fileType: asset.mediaType,
keyFileName: NCGlobal.shared.keyFileNameMask,
keyFileNameType: NCGlobal.shared.keyFileNameType,
keyFileNameOriginal: NCGlobal.shared.keyFileNameOriginal,
forcedNewFileName: false)
: (previewStore.fileName + "." + ext)

if previewStore.assetType == .livePhoto && NCKeychain().livePhoto && previewStore.data == nil {
Expand Down
8 changes: 7 additions & 1 deletion iOSClient/Main/NCActionCenter.swift
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,13 @@ class NCActionCenter: NSObject, UIDocumentInteractionControllerDelegate, NCSelec

func saveAsScan(metadata: tableMetadata, controller: NCMainTabBarController?) {
let fileNamePath = utilityFileSystem.getDirectoryProviderStorageOcId(metadata.ocId, fileNameView: metadata.fileNameView)
let fileNameDestination = CCUtility.createFileName("scan.png", fileDate: Date(), fileType: PHAssetMediaType.image, keyFileName: NCGlobal.shared.keyFileNameMask, keyFileNameType: NCGlobal.shared.keyFileNameType, keyFileNameOriginal: NCGlobal.shared.keyFileNameOriginal, forcedNewFileName: true)!
let fileNameDestination = utilityFileSystem.createFileName("scan.png",
fileDate: Date(),
fileType: PHAssetMediaType.image,
keyFileName: NCGlobal.shared.keyFileNameMask,
keyFileNameType: NCGlobal.shared.keyFileNameType,
keyFileNameOriginal: NCGlobal.shared.keyFileNameOriginal,
forcedNewFileName: true)
let fileNamePathDestination = utilityFileSystem.directoryScan + "/" + fileNameDestination

utilityFileSystem.copyFile(atPath: fileNamePath, toPath: fileNamePathDestination)
Expand Down
1 change: 1 addition & 0 deletions iOSClient/Main/NCDragDrop.swift
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
//

import UIKit
import UniformTypeIdentifiers
import NextcloudKit

class NCDragDrop: NSObject {
Expand Down
3 changes: 1 addition & 2 deletions iOSClient/Main/NCPickerViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,8 @@ class NCPhotosPickerViewController: NSObject {
if !assets.isEmpty {
let serverUrl = controller.currentServerUrl()
let view = NCUploadAssetsView(model: NCUploadAssetsModel(assets: assets, serverUrl: serverUrl, userBaseUrl: self.appDelegate, controller: controller))
let controller = UIHostingController(rootView: view)
DispatchQueue.main.asyncAfter(deadline: .now() + 0.4) {
controller.present(controller, animated: true, completion: nil)
controller.present(UIHostingController(rootView: view), animated: true, completion: nil)
}
}
}
Expand Down
1 change: 1 addition & 0 deletions iOSClient/Media/NCMedia+DragDrop.swift
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
//

import UIKit
import UniformTypeIdentifiers
import NextcloudKit

// MARK: - Drag
Expand Down
3 changes: 2 additions & 1 deletion iOSClient/Menu/UIViewController+Menu.swift
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,10 @@
//

import Foundation
import UIKit
import MessageUI
import SVGKit
import NextcloudKit
import UIKit

extension UIViewController {
fileprivate func handleProfileAction(_ action: NKHovercard.Action, for userId: String) {
Expand Down
1 change: 0 additions & 1 deletion iOSClient/More/CCManageAccount.m
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@

#import "CCManageAccount.h"
#import "NCBridgeSwift.h"
#import "CCUtility.h"

#define actionSheetCancellaAccount 1

Expand Down
1 change: 0 additions & 1 deletion iOSClient/Networking/E2EE/NCEndToEndEncryption.m
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@

#import "NCEndToEndEncryption.h"
#import "NCBridgeSwift.h"
#import "CCUtility.h"

#import <CommonCrypto/CommonDigest.h>
#import <CommonCrypto/CommonKeyDerivation.h>
Expand Down
8 changes: 7 additions & 1 deletion iOSClient/Networking/NCAutoUpload.swift
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,13 @@ class NCAutoUpload: NSObject {
let assetDate = asset.creationDate ?? Date()
let assetMediaType = asset.mediaType
var serverUrl: String = ""
let fileName = CCUtility.createFileName(asset.originalFilename as String, fileDate: assetDate, fileType: assetMediaType, keyFileName: NCGlobal.shared.keyFileNameAutoUploadMask, keyFileNameType: NCGlobal.shared.keyFileNameAutoUploadType, keyFileNameOriginal: NCGlobal.shared.keyFileNameOriginalAutoUpload, forcedNewFileName: false)!
let fileName = NCUtilityFileSystem().createFileName(asset.originalFilename as String,
fileDate: assetDate,
fileType: assetMediaType,
keyFileName: NCGlobal.shared.keyFileNameAutoUploadMask,
keyFileNameType: NCGlobal.shared.keyFileNameAutoUploadType,
keyFileNameOriginal: NCGlobal.shared.keyFileNameOriginalAutoUpload,
forcedNewFileName: false)

if account.autoUploadCreateSubfolder {
serverUrl = NCUtilityFileSystem().createGranularityPath(asset: asset, serverUrl: autoUploadPath)
Expand Down
1 change: 0 additions & 1 deletion iOSClient/Nextcloud-Bridging-Header.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,5 @@
#import "NCEndToEndEncryption.h"
#import "NYMnemonic.h"
#import "UIImage+animatedGIF.h"
#import "CCUtility.h"
#import "NCPushNotification.h"
#import "NCPushNotificationEncryption.h"
1 change: 0 additions & 1 deletion iOSClient/PushNotification/NCPushNotification.m
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
#import "NCPushNotification.h"
#import "NCPushNotificationEncryption.h"
#import "NCEndToEndEncryption.h"
#import "CCUtility.h"

@interface NCPushNotification ()
{
Expand Down
1 change: 0 additions & 1 deletion iOSClient/PushNotification/NCPushNotificationEncryption.m
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
#import <OpenSSL/OpenSSL.h>
#import <CommonCrypto/CommonDigest.h>
#import "NCEndToEndEncryption.h"
#import "CCUtility.h"

@implementation NCPushNotificationEncryption

Expand Down
16 changes: 9 additions & 7 deletions iOSClient/Scan document/NCDocumentCamera.swift
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
//

import Foundation
import UIKit
import Photos
import VisionKit

class NCDocumentCamera: NSObject, VNDocumentCameraViewControllerDelegate {
Expand All @@ -46,13 +48,13 @@ class NCDocumentCamera: NSObject, VNDocumentCameraViewControllerDelegate {
func documentCameraViewController(_ controller: VNDocumentCameraViewController, didFinishWith scan: VNDocumentCameraScan) {

for pageNumber in 0..<scan.pageCount {
let fileName = CCUtility.createFileName("scan.png",
fileDate: Date(),
fileType: PHAssetMediaType.image,
keyFileName: NCGlobal.shared.keyFileNameMask,
keyFileNameType: NCGlobal.shared.keyFileNameType,
keyFileNameOriginal: NCGlobal.shared.keyFileNameOriginal,
forcedNewFileName: true)!
let fileName = utilityFileSystem.createFileName("scan.png",
fileDate: Date(),
fileType: PHAssetMediaType.image,
keyFileName: NCGlobal.shared.keyFileNameMask,
keyFileNameType: NCGlobal.shared.keyFileNameType,
keyFileNameOriginal: NCGlobal.shared.keyFileNameOriginal,
forcedNewFileName: true)
let fileNamePath = utilityFileSystem.directoryScan + "/" + fileName
let image = scan.imageOfPage(at: pageNumber)
do {
Expand Down
16 changes: 6 additions & 10 deletions iOSClient/Scan document/NCScan.swift
Original file line number Diff line number Diff line change
Expand Up @@ -344,19 +344,15 @@ class NCScan: UIViewController, NCScanCellCellDelegate {
}

@objc func pasteImage() {

let pasteboard = UIPasteboard.general

if pasteboard.hasImages {

guard let image = pasteboard.image?.fixedOrientation() else { return }

let fileName = CCUtility.createFileName("scan.png", fileDate: Date(),
fileType: PHAssetMediaType.image,
keyFileName: NCGlobal.shared.keyFileNameMask,
keyFileNameType: NCGlobal.shared.keyFileNameType,
keyFileNameOriginal: NCGlobal.shared.keyFileNameOriginal,
forcedNewFileName: true)!
let fileName = utilityFileSystem.createFileName("scan.png", fileDate: Date(),
fileType: PHAssetMediaType.image,
keyFileName: NCGlobal.shared.keyFileNameMask,
keyFileNameType: NCGlobal.shared.keyFileNameType,
keyFileNameOriginal: NCGlobal.shared.keyFileNameOriginal,
forcedNewFileName: true)
let fileNamePath = utilityFileSystem.directoryScan + "/" + fileName

do {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
import Foundation
import NextcloudKit
import SwiftUI
import Combine
import Photos

/// A view model responsible for managing auto-upload file names.
class NCAutoUploadFileNamesModel: ObservableObject, ViewOnAppearHandling {
Expand Down Expand Up @@ -110,11 +110,23 @@ class NCAutoUploadFileNamesModel: ObservableObject, ViewOnAppearHandling {
// If the changed name is empty, set the filename mask to empty and generate a new filename
if valueRenameTrimming.isEmpty {
keychain.setFileNameMask(key: NCGlobal.shared.keyFileNameAutoUploadMask, mask: "")
returnString = CCUtility.createFileName("IMG_0001.JPG", fileDate: dateExample, fileType: PHAssetMediaType.image, keyFileName: nil, keyFileNameType: NCGlobal.shared.keyFileNameAutoUploadType, keyFileNameOriginal: NCGlobal.shared.keyFileNameOriginalAutoUpload, forcedNewFileName: false)
returnString = NCUtilityFileSystem().createFileName("IMG_0001.JPG",
fileDate: dateExample,
fileType: PHAssetMediaType.image,
keyFileName: nil,
keyFileNameType: NCGlobal.shared.keyFileNameAutoUploadType,
keyFileNameOriginal: NCGlobal.shared.keyFileNameOriginalAutoUpload,
forcedNewFileName: false)
} else {
// If there is a changed name, set the filename mask and generate a new filename
keychain.setFileNameMask(key: NCGlobal.shared.keyFileNameAutoUploadMask, mask: changedName)
returnString = CCUtility.createFileName("IMG_0001.JPG", fileDate: dateExample, fileType: PHAssetMediaType.image, keyFileName: NCGlobal.shared.keyFileNameAutoUploadMask, keyFileNameType: NCGlobal.shared.keyFileNameAutoUploadType, keyFileNameOriginal: NCGlobal.shared.keyFileNameOriginalAutoUpload, forcedNewFileName: false)
returnString = NCUtilityFileSystem().createFileName("IMG_0001.JPG",
fileDate: dateExample,
fileType: PHAssetMediaType.image,
keyFileName: NCGlobal.shared.keyFileNameAutoUploadMask,
keyFileNameType: NCGlobal.shared.keyFileNameAutoUploadType,
keyFileNameOriginal: NCGlobal.shared.keyFileNameOriginalAutoUpload,
forcedNewFileName: false)
}
}
return returnString
Expand Down
1 change: 1 addition & 0 deletions iOSClient/Settings/AutoUpload/NCAutoUploadModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
//

import Foundation
import Photos
import NextcloudKit

/// A model that allows the user to configure the `auto upload settings for Nextcloud`
Expand Down
1 change: 1 addition & 0 deletions iOSClient/Settings/NCKeychain.swift
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
//

import Foundation
import UIKit
import KeychainAccess

@objc class NCKeychain: NSObject {
Expand Down
Loading

0 comments on commit 42c713e

Please sign in to comment.