Skip to content

Commit

Permalink
Cleaning old code (#2941)
Browse files Browse the repository at this point in the history
* coding

Signed-off-by: Marino Faggiana <[email protected]>

* cleaning

Signed-off-by: Marino Faggiana <[email protected]>

* cleaning

Signed-off-by: Marino Faggiana <[email protected]>

* update

Signed-off-by: Marino Faggiana <[email protected]>

* cleaning

Signed-off-by: Marino Faggiana <[email protected]>

* fix

Signed-off-by: Marino Faggiana <[email protected]>

* coding

Signed-off-by: Marino Faggiana <[email protected]>

* cleaning

Signed-off-by: Marino Faggiana <[email protected]>

* cleaning

Signed-off-by: Marino Faggiana <[email protected]>

* cleaning

Signed-off-by: Marino Faggiana <[email protected]>

* coding

Signed-off-by: Marino Faggiana <[email protected]>

* cleaning

Signed-off-by: Marino Faggiana <[email protected]>

---------

Signed-off-by: Marino Faggiana <[email protected]>
  • Loading branch information
marinofaggiana authored Jun 6, 2024
1 parent f3762b0 commit b325796
Show file tree
Hide file tree
Showing 45 changed files with 376 additions and 486 deletions.
2 changes: 1 addition & 1 deletion .swiftlint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ disabled_rules:
- shorthand_operator
- type_name
- void_function_in_ternary

- switch_case_alignment
excluded:
- Carthage
- Pods
Expand Down
3 changes: 1 addition & 2 deletions File Provider Extension/FileProviderExtension.swift
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,7 @@ class FileProviderExtension: NSFileProviderExtension {
// - for a directory, instantiate an enumerator of its subitems
// - for a file, instantiate an enumerator that observes changes to the file
let item = try self.item(for: containerItemIdentifier)

if item.typeIdentifier == kUTTypeFolder as String {
if item.contentType == UTType.folder {
maybeEnumerator = FileProviderEnumerator(enumeratedItemIdentifier: containerItemIdentifier)
} else {
maybeEnumerator = FileProviderEnumerator(enumeratedItemIdentifier: containerItemIdentifier)
Expand Down
22 changes: 17 additions & 5 deletions Nextcloud.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,13 @@
F72429362AFE39860040AEF3 /* NCLivePhoto.swift in Sources */ = {isa = PBXBuildFile; fileRef = F70968A324212C4E00ED60E5 /* NCLivePhoto.swift */; };
F72429372AFE39980040AEF3 /* NCLivePhoto.swift in Sources */ = {isa = PBXBuildFile; fileRef = F70968A324212C4E00ED60E5 /* NCLivePhoto.swift */; };
F72429382AFE39A80040AEF3 /* NCLivePhoto.swift in Sources */ = {isa = PBXBuildFile; fileRef = F70968A324212C4E00ED60E5 /* NCLivePhoto.swift */; };
F724377B2C10B83E00C7C68D /* NCPermissions.swift in Sources */ = {isa = PBXBuildFile; fileRef = F724377A2C10B83E00C7C68D /* NCPermissions.swift */; };
F724377C2C10B92200C7C68D /* NCPermissions.swift in Sources */ = {isa = PBXBuildFile; fileRef = F724377A2C10B83E00C7C68D /* NCPermissions.swift */; };
F724377D2C10B92300C7C68D /* NCPermissions.swift in Sources */ = {isa = PBXBuildFile; fileRef = F724377A2C10B83E00C7C68D /* NCPermissions.swift */; };
F724377E2C10B92300C7C68D /* NCPermissions.swift in Sources */ = {isa = PBXBuildFile; fileRef = F724377A2C10B83E00C7C68D /* NCPermissions.swift */; };
F724377F2C10B92400C7C68D /* NCPermissions.swift in Sources */ = {isa = PBXBuildFile; fileRef = F724377A2C10B83E00C7C68D /* NCPermissions.swift */; };
F72437802C10B92400C7C68D /* NCPermissions.swift in Sources */ = {isa = PBXBuildFile; fileRef = F724377A2C10B83E00C7C68D /* NCPermissions.swift */; };
F72437812C10B92500C7C68D /* NCPermissions.swift in Sources */ = {isa = PBXBuildFile; fileRef = F724377A2C10B83E00C7C68D /* NCPermissions.swift */; };
F7245924289BB50C00474787 /* ThreadSafeDictionary.swift in Sources */ = {isa = PBXBuildFile; fileRef = F7245923289BB50B00474787 /* ThreadSafeDictionary.swift */; };
F7245925289BB59100474787 /* ThreadSafeDictionary.swift in Sources */ = {isa = PBXBuildFile; fileRef = F7245923289BB50B00474787 /* ThreadSafeDictionary.swift */; };
F7245926289BB59300474787 /* ThreadSafeDictionary.swift in Sources */ = {isa = PBXBuildFile; fileRef = F7245923289BB50B00474787 /* ThreadSafeDictionary.swift */; };
Expand Down Expand Up @@ -856,7 +863,6 @@
F7F4F10A27ECDBDB008676F9 /* Inconsolata-ExtraBold.ttf in Resources */ = {isa = PBXBuildFile; fileRef = F7F4F10227ECDBDB008676F9 /* Inconsolata-ExtraBold.ttf */; };
F7F4F10B27ECDBDB008676F9 /* Inconsolata-Light.ttf in Resources */ = {isa = PBXBuildFile; fileRef = F7F4F10327ECDBDB008676F9 /* Inconsolata-Light.ttf */; };
F7F4F10C27ECDBDB008676F9 /* Inconsolata-Regular.ttf in Resources */ = {isa = PBXBuildFile; fileRef = F7F4F10427ECDBDB008676F9 /* Inconsolata-Regular.ttf */; };
F7F4F11027ECDC4A008676F9 /* UIDevice+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = F7F4F10F27ECDC4A008676F9 /* UIDevice+Extension.swift */; };
F7F4F11227ECDC52008676F9 /* UIFont+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = F7F4F11127ECDC52008676F9 /* UIFont+Extension.swift */; };
F7F623B52A5EF4D30022D3D4 /* Gzip in Frameworks */ = {isa = PBXBuildFile; productRef = F7F623B42A5EF4D30022D3D4 /* Gzip */; };
F7F623B72A5EFA0C0022D3D4 /* Gzip in Frameworks */ = {isa = PBXBuildFile; productRef = F7F623B62A5EFA0C0022D3D4 /* Gzip */; };
Expand Down Expand Up @@ -1248,6 +1254,7 @@
F723985B253C95CE00257F49 /* NCViewerRichdocument.storyboard */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; path = NCViewerRichdocument.storyboard; sourceTree = "<group>"; };
F723B3DC22FC6D1C00301EFE /* NCShareCommentsCell.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = NCShareCommentsCell.xib; sourceTree = "<group>"; };
F72408322B8A27C900F128E2 /* NCMedia+Command.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "NCMedia+Command.swift"; sourceTree = "<group>"; };
F724377A2C10B83E00C7C68D /* NCPermissions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NCPermissions.swift; sourceTree = "<group>"; };
F7245923289BB50B00474787 /* ThreadSafeDictionary.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ThreadSafeDictionary.swift; sourceTree = "<group>"; };
F7267A81225DFCE100D6DB7D /* AFNetworking.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AFNetworking.framework; path = Carthage/Build/iOS/AFNetworking.framework; sourceTree = "<group>"; };
F72685E827C78E490019EF5E /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = "<group>"; };
Expand Down Expand Up @@ -1676,7 +1683,6 @@
F7F4F10227ECDBDB008676F9 /* Inconsolata-ExtraBold.ttf */ = {isa = PBXFileReference; lastKnownFileType = file; path = "Inconsolata-ExtraBold.ttf"; sourceTree = "<group>"; };
F7F4F10327ECDBDB008676F9 /* Inconsolata-Light.ttf */ = {isa = PBXFileReference; lastKnownFileType = file; path = "Inconsolata-Light.ttf"; sourceTree = "<group>"; };
F7F4F10427ECDBDB008676F9 /* Inconsolata-Regular.ttf */ = {isa = PBXFileReference; lastKnownFileType = file; path = "Inconsolata-Regular.ttf"; sourceTree = "<group>"; };
F7F4F10F27ECDC4A008676F9 /* UIDevice+Extension.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "UIDevice+Extension.swift"; sourceTree = "<group>"; };
F7F4F11127ECDC52008676F9 /* UIFont+Extension.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "UIFont+Extension.swift"; sourceTree = "<group>"; };
F7F67BB81A24D27800EE80DA /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = "<group>"; };
F7F878AD1FB9E3B900599E4F /* NCEndToEndMetadata.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NCEndToEndMetadata.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -2130,6 +2136,7 @@
isa = PBXGroup;
children = (
AF93471327E235EB002537EE /* Advanced */,
F724377A2C10B83E00C7C68D /* NCPermissions.swift */,
F700510022DF63AC003A3356 /* NCShare.storyboard */,
F700510422DF6A89003A3356 /* NCShare.swift */,
AFCE353827E5DE0400FEA6C2 /* NCShare+Helper.swift */,
Expand Down Expand Up @@ -2587,7 +2594,6 @@
AF7E504D27A2D8FF00B5E4AF /* UIBarButton+Extension.swift */,
F70CEF5523E9C7E50007035B /* UIColor+Extension.swift */,
F79B645F26CA661600838ACA /* UIControl+Extension.swift */,
F7F4F10F27ECDC4A008676F9 /* UIDevice+Extension.swift */,
F7F4F11127ECDC52008676F9 /* UIFont+Extension.swift */,
F713FEFE2472764000214AF6 /* UIImage+animatedGIF.h */,
F713FEFF2472764100214AF6 /* UIImage+animatedGIF.m */,
Expand Down Expand Up @@ -2684,6 +2690,7 @@
F7BFFA991A24D7BB0044ED85 /* Utility */ = {
isa = PBXGroup;
children = (
F702F2FC25EE5D2C008F8E80 /* NYMnemonic */,
F7053E3C1C639DF500741EA5 /* CCUtility.h */,
F7053E3D1C639DF500741EA5 /* CCUtility.m */,
F76D364528A4F8BF00214537 /* NCActivityIndicator.swift */,
Expand All @@ -2699,7 +2706,6 @@
F359D8662A7D03420023F405 /* NCUtility+Exif.swift */,
AF93474B27E34120002537EE /* NCUtility+Image.swift */,
F74AF3A3247FB6AE00AC767B /* NCUtilityFileSystem.swift */,
F702F2FC25EE5D2C008F8E80 /* NYMnemonic */,
AF36077027BFA4E8001A243D /* ParallelWorker.swift */,
F71F6D062B6A6A5E00F1EB15 /* ThreadSafeArray.swift */,
F7245923289BB50B00474787 /* ThreadSafeDictionary.swift */,
Expand Down Expand Up @@ -3798,6 +3804,7 @@
2C1D5D7623E2DE3300334ABB /* NCManageDatabase.swift in Sources */,
F7864AD22A78FE73004870E0 /* NCManageDatabase+LocalFile.swift in Sources */,
F314F1142A30E2DE00BC7FAB /* View+Extension.swift in Sources */,
F724377D2C10B92300C7C68D /* NCPermissions.swift in Sources */,
F7D68FD028CB9051009139F3 /* NCManageDatabase+DashboardWidget.swift in Sources */,
F343A4C12A1E734600DDA874 /* Optional+Extension.swift in Sources */,
F7245927289BB59300474787 /* ThreadSafeDictionary.swift in Sources */,
Expand Down Expand Up @@ -3913,6 +3920,7 @@
F757CC8729E7F88B00F31428 /* NCManageDatabase+Groupfolders.swift in Sources */,
F7B769AD2B7A0B2000C1AAEB /* NCManageDatabase+Metadata+Session.swift in Sources */,
F73EF7BC2B0224AB0087E6E9 /* NCManageDatabase+ExternalSites.swift in Sources */,
F724377E2C10B92300C7C68D /* NCPermissions.swift in Sources */,
F73EF7B42B0224350087E6E9 /* NCManageDatabase+DirectEditing.swift in Sources */,
F7490E8229882C80009DCE94 /* NCManageDatabase+E2EE.swift in Sources */,
F7490E7829882C28009DCE94 /* NCUtility.swift in Sources */,
Expand Down Expand Up @@ -3974,6 +3982,7 @@
AF22B218277D196700DAB0CC /* NCShareExtension+Files.swift in Sources */,
F702F2D025EE5B5C008F8E80 /* NCGlobal.swift in Sources */,
F343A4BE2A1E734600DDA874 /* Optional+Extension.swift in Sources */,
F72437802C10B92400C7C68D /* NCPermissions.swift in Sources */,
F7EDE4DB262D7BA200414FE6 /* NCCellProtocol.swift in Sources */,
F72944F62A8424F800246839 /* NCEndToEndMetadataV1.swift in Sources */,
F7EDE4D1262D7B8400414FE6 /* NCDataSource.swift in Sources */,
Expand Down Expand Up @@ -4070,6 +4079,7 @@
F783030628B4C51E00B84583 /* String+Extension.swift in Sources */,
F763D29E2A249C4500A3C901 /* NCManageDatabase+Capabilities.swift in Sources */,
F711A4DD2AF92CAE00095DD8 /* NCUtility+Date.swift in Sources */,
F724377C2C10B92200C7C68D /* NCPermissions.swift in Sources */,
F36E64FB2B9733F10085ABB5 /* UIView+Extension.swift in Sources */,
F77ED59328C9CEA000E24ED0 /* ToolbarWidgetProvider.swift in Sources */,
F72A17D828B221E300F3F159 /* DashboardWidgetView.swift in Sources */,
Expand Down Expand Up @@ -4119,6 +4129,7 @@
F7817D0229802D7700FFBC65 /* NCViewCertificateDetails.swift in Sources */,
F7434B3820E2400600417916 /* NCBrand.swift in Sources */,
F7327E332B73A86700A462C7 /* NCNetworking+WebDAV.swift in Sources */,
F724377F2C10B92400C7C68D /* NCPermissions.swift in Sources */,
F785EE9E2461A09900B3F945 /* NCNetworking.swift in Sources */,
F749B655297B0F2400087535 /* NCManageDatabase+Avatar.swift in Sources */,
F7327E382B73AEDE00A462C7 /* NCNetworking+LivePhoto.swift in Sources */,
Expand Down Expand Up @@ -4262,6 +4273,7 @@
F72D1007210B6882009C96B7 /* NCPushNotificationEncryption.m in Sources */,
F76882362C0DD1E7001CF441 /* NCAcknowledgementsView.swift in Sources */,
F785EE9D246196DF00B3F945 /* NCNetworkingE2EE.swift in Sources */,
F724377B2C10B83E00C7C68D /* NCPermissions.swift in Sources */,
F76673ED22C901F6007ED366 /* FileProviderDomain.swift in Sources */,
F794E13D2BBBFF2E003693D7 /* NCMainTabBarController.swift in Sources */,
F7CBC1252BAC8B0000EC1D55 /* NCSectionHeaderEmptyData.swift in Sources */,
Expand Down Expand Up @@ -4411,7 +4423,6 @@
F7581D1A25EFDA61004DC699 /* NCLoginWeb+Menu.swift in Sources */,
F76882272C0DD1E7001CF441 /* NCManageE2EEView.swift in Sources */,
F7864ACC2A78FE73004870E0 /* NCManageDatabase+LocalFile.swift in Sources */,
F7F4F11027ECDC4A008676F9 /* UIDevice+Extension.swift in Sources */,
F7327E302B73A86700A462C7 /* NCNetworking+WebDAV.swift in Sources */,
F79FFB262A97C24A0055EEA4 /* NCNetworkingE2EEMarkFolder.swift in Sources */,
F70D8D8124A4A9BF000A5756 /* NCNetworkingProcess.swift in Sources */,
Expand Down Expand Up @@ -4445,6 +4456,7 @@
F7C9B91F2B582F550064EA91 /* NCManageDatabase+SecurityGuard.swift in Sources */,
F7A8D74528F1828E008BBE1C /* CCUtility.m in Sources */,
F75DD767290ABB25002EB562 /* Intent.intentdefinition in Sources */,
F72437812C10B92500C7C68D /* NCPermissions.swift in Sources */,
F749B64C297B0CBB00087535 /* NCManageDatabase+Share.swift in Sources */,
F7A8D73F28F181EF008BBE1C /* NCGlobal.swift in Sources */,
F74B6D972A7E239A00F03C5F /* NCManageDatabase+Chunk.swift in Sources */,
Expand Down
5 changes: 3 additions & 2 deletions Share/NCShareExtension+DataSource.swift
Original file line number Diff line number Diff line change
Expand Up @@ -136,9 +136,10 @@ extension NCShareExtension: UICollectionViewDataSource {
func setupDirectoryCell(_ cell: NCListCell, indexPath: IndexPath, with metadata: tableMetadata) {
var isShare = false
var isMounted = false
let permissions = NCPermissions()
if let metadataFolder = metadataFolder {
isShare = metadata.permissions.contains(NCGlobal.shared.permissionShared) && !metadataFolder.permissions.contains(NCGlobal.shared.permissionShared)
isMounted = metadata.permissions.contains(NCGlobal.shared.permissionMounted) && !metadataFolder.permissions.contains(NCGlobal.shared.permissionMounted)
isShare = metadata.permissions.contains(permissions.permissionShared) && !metadataFolder.permissions.contains(permissions.permissionShared)
isMounted = metadata.permissions.contains(permissions.permissionMounted) && !metadataFolder.permissions.contains(permissions.permissionMounted)
}

if metadata.e2eEncrypted {
Expand Down
2 changes: 1 addition & 1 deletion Share/NCShareExtension+Files.swift
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,6 @@ class NCFilesExtensionHandler {
extension NSItemProvider {
var typeIdentifier: String {
if hasItemConformingToTypeIdentifier("public.url") { return "public.url" } else
if hasItemConformingToTypeIdentifier(kUTTypeItem as String) { return kUTTypeItem as String } else { return "" }
if hasItemConformingToTypeIdentifier(UTType.item.identifier as String) { return UTType.item.identifier as String } else { return "" }
}
}
4 changes: 2 additions & 2 deletions iOSClient/Data/NCManageDatabase+Directory.swift
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,8 @@ extension NCManageDatabase {
DispatchQueue.main.async {
let windowScenes = UIApplication.shared.connectedScenes.compactMap { $0 as? UIWindowScene }
for windowScene in windowScenes {
if let mainTabBarController = windowScene.keyWindow?.rootViewController as? NCMainTabBarController {
mainTabBarController.filesServerUrl.removeValue(forKey: serverUrl)
if let controller = windowScene.keyWindow?.rootViewController as? NCMainTabBarController {
controller.filesServerUrl.removeValue(forKey: serverUrl)
}
}
}
Expand Down
11 changes: 6 additions & 5 deletions iOSClient/Data/NCManageDatabase+Metadata.swift
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ extension tableMetadata {
}

var isDocumentViewableOnly: Bool {
sharePermissionsCollaborationServices == NCGlobal.shared.permissionReadShare && classFile == NKCommon.TypeClassFile.document.rawValue
sharePermissionsCollaborationServices == NCPermissions().permissionReadShare && classFile == NKCommon.TypeClassFile.document.rawValue
}

var isAudioOrVideo: Bool {
Expand Down Expand Up @@ -991,18 +991,19 @@ extension NCManageDatabase {
}

func isMetadataShareOrMounted(metadata: tableMetadata, metadataFolder: tableMetadata?) -> Bool {
let permissions = NCPermissions()
var isShare = false
var isMounted = false

if metadataFolder != nil {

isShare = metadata.permissions.contains(NCGlobal.shared.permissionShared) && !metadataFolder!.permissions.contains(NCGlobal.shared.permissionShared)
isMounted = metadata.permissions.contains(NCGlobal.shared.permissionMounted) && !metadataFolder!.permissions.contains(NCGlobal.shared.permissionMounted)
isShare = metadata.permissions.contains(permissions.permissionShared) && !metadataFolder!.permissions.contains(permissions.permissionShared)
isMounted = metadata.permissions.contains(permissions.permissionMounted) && !metadataFolder!.permissions.contains(permissions.permissionMounted)

} else if let directory = NCManageDatabase.shared.getTableDirectory(predicate: NSPredicate(format: "account == %@ AND serverUrl == %@", metadata.account, metadata.serverUrl)) {

isShare = metadata.permissions.contains(NCGlobal.shared.permissionShared) && !directory.permissions.contains(NCGlobal.shared.permissionShared)
isMounted = metadata.permissions.contains(NCGlobal.shared.permissionMounted) && !directory.permissions.contains(NCGlobal.shared.permissionMounted)
isShare = metadata.permissions.contains(permissions.permissionShared) && !directory.permissions.contains(permissions.permissionShared)
isMounted = metadata.permissions.contains(permissions.permissionMounted) && !directory.permissions.contains(permissions.permissionMounted)
}

if isShare || isMounted {
Expand Down
52 changes: 0 additions & 52 deletions iOSClient/Extensions/UIDevice+Extension.swift

This file was deleted.

10 changes: 5 additions & 5 deletions iOSClient/Login/NCLogin.swift
Original file line number Diff line number Diff line change
Expand Up @@ -402,13 +402,13 @@ class NCLogin: UIViewController, UITextFieldDelegate, NCLoginQRCodeDelegate {
if window?.rootViewController is NCMainTabBarController {
self.dismiss(animated: true)
} else {
if let mainTabBarController = UIStoryboard(name: "Main", bundle: nil).instantiateInitialViewController() as? NCMainTabBarController {
mainTabBarController.modalPresentationStyle = .fullScreen
mainTabBarController.view.alpha = 0
window?.rootViewController = mainTabBarController
if let controller = UIStoryboard(name: "Main", bundle: nil).instantiateInitialViewController() as? NCMainTabBarController {
controller.modalPresentationStyle = .fullScreen
controller.view.alpha = 0
window?.rootViewController = controller
window?.makeKeyAndVisible()
UIView.animate(withDuration: 0.5) {
mainTabBarController.view.alpha = 1
controller.view.alpha = 1
}
}
}
Expand Down
Loading

0 comments on commit b325796

Please sign in to comment.