diff --git a/Nextcloud.xcodeproj/project.pbxproj b/Nextcloud.xcodeproj/project.pbxproj index e7da10d9ae..4ebc94aa55 100644 --- a/Nextcloud.xcodeproj/project.pbxproj +++ b/Nextcloud.xcodeproj/project.pbxproj @@ -29,7 +29,7 @@ AF2D7C7E2742559100ADF566 /* NCShareUserCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = AF2D7C7D2742559100ADF566 /* NCShareUserCell.swift */; }; AF36077127BFA4E8001A243D /* ParallelWorker.swift in Sources */ = {isa = PBXBuildFile; fileRef = AF36077027BFA4E8001A243D /* ParallelWorker.swift */; }; AF3FDCC22796ECC300710F60 /* NCTrash+CollectionView.swift in Sources */ = {isa = PBXBuildFile; fileRef = AF3FDCC12796ECC300710F60 /* NCTrash+CollectionView.swift */; }; - AF3FDCC32796F3FB00710F60 /* NCTrashListCell+NCTrashCellProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = F78ACD4821903F850088454D /* NCTrashListCell+NCTrashCellProtocol.swift */; }; + AF3FDCC32796F3FB00710F60 /* NCTrashListCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = F78ACD4821903F850088454D /* NCTrashListCell.swift */; }; AF4BF614275629E20081CEEF /* NCManageDatabase+Account.swift in Sources */ = {isa = PBXBuildFile; fileRef = AF4BF613275629E20081CEEF /* NCManageDatabase+Account.swift */; }; AF4BF615275629E20081CEEF /* NCManageDatabase+Account.swift in Sources */ = {isa = PBXBuildFile; fileRef = AF4BF613275629E20081CEEF /* NCManageDatabase+Account.swift */; }; AF4BF616275629E20081CEEF /* NCManageDatabase+Account.swift in Sources */ = {isa = PBXBuildFile; fileRef = AF4BF613275629E20081CEEF /* NCManageDatabase+Account.swift */; }; @@ -47,7 +47,6 @@ AF730AF827834B1400B7520E /* NCShare+NCCellDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = AF730AF727834B1400B7520E /* NCShare+NCCellDelegate.swift */; }; AF730AFA27843E4C00B7520E /* NCShareExtension+NCDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = AF730AF927843E4C00B7520E /* NCShareExtension+NCDelegate.swift */; }; AF7E504E27A2D8FF00B5E4AF /* UIBarButton+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = AF7E504D27A2D8FF00B5E4AF /* UIBarButton+Extension.swift */; }; - AF7E505027A2D92300B5E4AF /* NCSelectableNavigationView.swift in Sources */ = {isa = PBXBuildFile; fileRef = AF7E504F27A2D92300B5E4AF /* NCSelectableNavigationView.swift */; }; AF817EF1274BC781009ED85B /* NCUserBaseUrl.swift in Sources */ = {isa = PBXBuildFile; fileRef = AF817EF0274BC781009ED85B /* NCUserBaseUrl.swift */; }; AF817EF2274BC781009ED85B /* NCUserBaseUrl.swift in Sources */ = {isa = PBXBuildFile; fileRef = AF817EF0274BC781009ED85B /* NCUserBaseUrl.swift */; }; AF817EF3274BC781009ED85B /* NCUserBaseUrl.swift in Sources */ = {isa = PBXBuildFile; fileRef = AF817EF0274BC781009ED85B /* NCUserBaseUrl.swift */; }; @@ -85,8 +84,6 @@ F31F69612A2F907800162F76 /* __Snapshots__ in Resources */ = {isa = PBXBuildFile; fileRef = F31F69602A2F907800162F76 /* __Snapshots__ */; }; F31F69642A2F929600162F76 /* PreviewSnapshots in Frameworks */ = {isa = PBXBuildFile; productRef = F31F69632A2F929600162F76 /* PreviewSnapshots */; }; F321DA8A2B71205A00DDA0E6 /* NCTrashSelectTabBar.swift in Sources */ = {isa = PBXBuildFile; fileRef = F321DA892B71205A00DDA0E6 /* NCTrashSelectTabBar.swift */; }; - F327FA432B8CC0B900E5B743 /* SwipeCellKit in Frameworks */ = {isa = PBXBuildFile; productRef = F327FA422B8CC0B900E5B743 /* SwipeCellKit */; }; - F327FA452B8CC36900E5B743 /* SwipeCellKit in Frameworks */ = {isa = PBXBuildFile; productRef = F327FA442B8CC36900E5B743 /* SwipeCellKit */; }; F32ED5062A2F254400EABA81 /* EnvVars.generated.swift in Sources */ = {isa = PBXBuildFile; fileRef = F30A96302A27AEBF00D7BCFE /* EnvVars.generated.swift */; }; F33AAF9A2A60394C006ECCBD /* NCMoreUserCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = F33AAF992A60394C006ECCBD /* NCMoreUserCell.xib */; }; F343A4B32A1E01FF00DDA874 /* PHAsset+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = F343A4B22A1E01FF00DDA874 /* PHAsset+Extension.swift */; }; @@ -111,7 +108,6 @@ F359D86C2A7D03420023F405 /* NCUtility+Exif.swift in Sources */ = {isa = PBXBuildFile; fileRef = F359D8662A7D03420023F405 /* NCUtility+Exif.swift */; }; F359D86D2A7D03420023F405 /* NCUtility+Exif.swift in Sources */ = {isa = PBXBuildFile; fileRef = F359D8662A7D03420023F405 /* NCUtility+Exif.swift */; }; F36E64F72B9245210085ABB5 /* NCCollectionViewCommon+SelectTabBarDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = F36E64F62B9245210085ABB5 /* NCCollectionViewCommon+SelectTabBarDelegate.swift */; }; - F36E64F92B92459B0085ABB5 /* NCCollectionViewCommon+SwipeCollectionViewCellDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = F36E64F82B92459B0085ABB5 /* NCCollectionViewCommon+SwipeCollectionViewCellDelegate.swift */; }; F36E64FA2B96236C0085ABB5 /* UIView+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = F7E41315294A19B300839300 /* UIView+Extension.swift */; }; F36E64FB2B9733F10085ABB5 /* UIView+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = F7E41315294A19B300839300 /* UIView+Extension.swift */; }; F36E64FC2B9733F20085ABB5 /* UIView+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = F7E41315294A19B300839300 /* UIView+Extension.swift */; }; @@ -625,7 +621,7 @@ F78ACD4221903CE00088454D /* NCListCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = F78ACD4121903CE00088454D /* NCListCell.swift */; }; F78ACD4421903CF20088454D /* NCListCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = F78ACD4321903CF20088454D /* NCListCell.xib */; }; F78ACD4621903D010088454D /* NCGridCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = F78ACD4521903D010088454D /* NCGridCell.xib */; }; - F78ACD4A21903F850088454D /* NCTrashListCell+NCTrashCellProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = F78ACD4821903F850088454D /* NCTrashListCell+NCTrashCellProtocol.swift */; }; + F78ACD4A21903F850088454D /* NCTrashListCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = F78ACD4821903F850088454D /* NCTrashListCell.swift */; }; F78ACD4B21903F850088454D /* NCTrashListCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = F78ACD4921903F850088454D /* NCTrashListCell.xib */; }; F78ACD52219046DC0088454D /* NCSectionHeaderMenu.swift in Sources */ = {isa = PBXBuildFile; fileRef = F78ACD51219046DC0088454D /* NCSectionHeaderMenu.swift */; }; F78ACD54219047D40088454D /* NCSectionFooter.xib in Resources */ = {isa = PBXBuildFile; fileRef = F78ACD53219047D40088454D /* NCSectionFooter.xib */; }; @@ -756,6 +752,8 @@ F7CB689A2541676B0050EC94 /* NCMore.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = F7CB68992541676B0050EC94 /* NCMore.storyboard */; }; F7CB68A0254169530050EC94 /* NCSettings.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = F7CB689F254169530050EC94 /* NCSettings.storyboard */; }; F7CBC31C24F78E79004D3812 /* NCSortMenu.swift in Sources */ = {isa = PBXBuildFile; fileRef = F7CBC31B24F78E79004D3812 /* NCSortMenu.swift */; }; + F7CEE6002BA9A5C9003EFD89 /* NCTrashGridCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = F7CEE5FE2BA9A5C9003EFD89 /* NCTrashGridCell.xib */; }; + F7CEE6012BA9A5C9003EFD89 /* NCTrashGridCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = F7CEE5FF2BA9A5C9003EFD89 /* NCTrashGridCell.swift */; }; F7D1612023CF19E30039EBBF /* NCViewerRichWorkspace.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = F7D1611F23CF19E30039EBBF /* NCViewerRichWorkspace.storyboard */; }; F7D56B1A2972405500FA46C4 /* Mantis in Frameworks */ = {isa = PBXBuildFile; productRef = F7D56B192972405500FA46C4 /* Mantis */; }; F7D57C8626317BDA00DE301D /* NCAccountRequest.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = F7CA212C25F1333200826ABB /* NCAccountRequest.storyboard */; }; @@ -768,6 +766,15 @@ F7D96FCC246ED7E200536D73 /* NCNetworkingCheckRemoteUser.swift in Sources */ = {isa = PBXBuildFile; fileRef = F7D96FCB246ED7E100536D73 /* NCNetworkingCheckRemoteUser.swift */; }; F7E0710128B13BB00001B882 /* DashboardData.swift in Sources */ = {isa = PBXBuildFile; fileRef = F7E0710028B13BB00001B882 /* DashboardData.swift */; }; F7E0CDCF265CE8610044854E /* NCUserStatus.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = F7E0CDCE265CE8610044854E /* NCUserStatus.storyboard */; }; + F7E402292BA85D1D007E5609 /* PrivacyInfo.xcprivacy in Resources */ = {isa = PBXBuildFile; fileRef = F7E402282BA85D1D007E5609 /* PrivacyInfo.xcprivacy */; }; + F7E4022A2BA85D1D007E5609 /* PrivacyInfo.xcprivacy in Resources */ = {isa = PBXBuildFile; fileRef = F7E402282BA85D1D007E5609 /* PrivacyInfo.xcprivacy */; }; + F7E4022B2BA85D1D007E5609 /* PrivacyInfo.xcprivacy in Resources */ = {isa = PBXBuildFile; fileRef = F7E402282BA85D1D007E5609 /* PrivacyInfo.xcprivacy */; }; + F7E4022C2BA85D1D007E5609 /* PrivacyInfo.xcprivacy in Resources */ = {isa = PBXBuildFile; fileRef = F7E402282BA85D1D007E5609 /* PrivacyInfo.xcprivacy */; }; + F7E4022D2BA85D1D007E5609 /* PrivacyInfo.xcprivacy in Resources */ = {isa = PBXBuildFile; fileRef = F7E402282BA85D1D007E5609 /* PrivacyInfo.xcprivacy */; }; + F7E4022E2BA85D1D007E5609 /* PrivacyInfo.xcprivacy in Resources */ = {isa = PBXBuildFile; fileRef = F7E402282BA85D1D007E5609 /* PrivacyInfo.xcprivacy */; }; + F7E4022F2BA85D1D007E5609 /* PrivacyInfo.xcprivacy in Resources */ = {isa = PBXBuildFile; fileRef = F7E402282BA85D1D007E5609 /* PrivacyInfo.xcprivacy */; }; + F7E402312BA891EB007E5609 /* NCTrash+SelectTabBarDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = F7E402302BA891EB007E5609 /* NCTrash+SelectTabBarDelegate.swift */; }; + F7E402332BA89551007E5609 /* NCTrash+Networking.swift in Sources */ = {isa = PBXBuildFile; fileRef = F7E402322BA89551007E5609 /* NCTrash+Networking.swift */; }; F7E41316294A19B300839300 /* UIView+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = F7E41315294A19B300839300 /* UIView+Extension.swift */; }; F7E4D9C422ED929B003675FD /* NCShareCommentsCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = F7E4D9C322ED929B003675FD /* NCShareCommentsCell.swift */; }; F7E7AEA52BA32C6500512E52 /* NCCollectionViewDownloadThumbnail.swift in Sources */ = {isa = PBXBuildFile; fileRef = F7E7AEA42BA32C6500512E52 /* NCCollectionViewDownloadThumbnail.swift */; }; @@ -945,7 +952,6 @@ AF730AF727834B1400B7520E /* NCShare+NCCellDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "NCShare+NCCellDelegate.swift"; sourceTree = ""; }; AF730AF927843E4C00B7520E /* NCShareExtension+NCDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "NCShareExtension+NCDelegate.swift"; sourceTree = ""; }; AF7E504D27A2D8FF00B5E4AF /* UIBarButton+Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIBarButton+Extension.swift"; sourceTree = ""; }; - AF7E504F27A2D92300B5E4AF /* NCSelectableNavigationView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NCSelectableNavigationView.swift; sourceTree = ""; }; AF817EF0274BC781009ED85B /* NCUserBaseUrl.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NCUserBaseUrl.swift; sourceTree = ""; }; AF8ED1F92757821000B8DBC4 /* NextcloudUnitTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = NextcloudUnitTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; AF8ED1FB2757821000B8DBC4 /* NextcloudUnitTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NextcloudUnitTests.swift; sourceTree = ""; }; @@ -983,7 +989,6 @@ F343A4BA2A1E734600DDA874 /* Optional+Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Optional+Extension.swift"; sourceTree = ""; }; F359D8662A7D03420023F405 /* NCUtility+Exif.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "NCUtility+Exif.swift"; sourceTree = ""; }; F36E64F62B9245210085ABB5 /* NCCollectionViewCommon+SelectTabBarDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "NCCollectionViewCommon+SelectTabBarDelegate.swift"; sourceTree = ""; }; - F36E64F82B92459B0085ABB5 /* NCCollectionViewCommon+SwipeCollectionViewCellDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "NCCollectionViewCommon+SwipeCollectionViewCellDelegate.swift"; sourceTree = ""; }; F38F71242B6BBDC300473CDC /* NCCollectionViewCommonSelectTabBar.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NCCollectionViewCommonSelectTabBar.swift; sourceTree = ""; }; F39298962A3B12CB00509762 /* BaseNCMoreCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BaseNCMoreCell.swift; sourceTree = ""; }; F3953BD62A6E87E000EE03F9 /* BaseIntegrationXCTestCase.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BaseIntegrationXCTestCase.swift; sourceTree = ""; }; @@ -1296,7 +1301,7 @@ F78ACD4121903CE00088454D /* NCListCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NCListCell.swift; sourceTree = ""; }; F78ACD4321903CF20088454D /* NCListCell.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = NCListCell.xib; sourceTree = ""; }; F78ACD4521903D010088454D /* NCGridCell.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = NCGridCell.xib; sourceTree = ""; }; - F78ACD4821903F850088454D /* NCTrashListCell+NCTrashCellProtocol.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "NCTrashListCell+NCTrashCellProtocol.swift"; sourceTree = ""; }; + F78ACD4821903F850088454D /* NCTrashListCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NCTrashListCell.swift; sourceTree = ""; }; F78ACD4921903F850088454D /* NCTrashListCell.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = NCTrashListCell.xib; sourceTree = ""; }; F78ACD51219046DC0088454D /* NCSectionHeaderMenu.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NCSectionHeaderMenu.swift; sourceTree = ""; }; F78ACD53219047D40088454D /* NCSectionFooter.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = NCSectionFooter.xib; sourceTree = ""; }; @@ -1477,6 +1482,8 @@ F7CC04E61F5AD50D00378CEF /* es */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = es; path = es.lproj/Localizable.strings; sourceTree = ""; }; F7CE8AFA1DC1F8D8009CAE48 /* Nextcloud.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Nextcloud.app; sourceTree = BUILT_PRODUCTS_DIR; }; F7CE8AFB1DC1F8D8009CAE48 /* Share.appex */ = {isa = PBXFileReference; explicitFileType = "wrapper.app-extension"; includeInIndex = 0; path = Share.appex; sourceTree = BUILT_PRODUCTS_DIR; }; + F7CEE5FE2BA9A5C9003EFD89 /* NCTrashGridCell.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = NCTrashGridCell.xib; sourceTree = ""; }; + F7CEE5FF2BA9A5C9003EFD89 /* NCTrashGridCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NCTrashGridCell.swift; sourceTree = ""; }; F7CF16A22A4D7C7A000FF107 /* NCMoreUserCell.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = NCMoreUserCell.xib; sourceTree = ""; }; F7D1611F23CF19E30039EBBF /* NCViewerRichWorkspace.storyboard */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; path = NCViewerRichWorkspace.storyboard; sourceTree = ""; }; F7D2C772246470CA008513AE /* XLForm.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = XLForm.framework; path = Carthage/Build/iOS/XLForm.framework; sourceTree = ""; }; @@ -1491,6 +1498,9 @@ F7DE9AB01F482FA5008DFE10 /* sv */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = sv; path = sv.lproj/Localizable.strings; sourceTree = ""; }; F7E0710028B13BB00001B882 /* DashboardData.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DashboardData.swift; sourceTree = ""; }; F7E0CDCE265CE8610044854E /* NCUserStatus.storyboard */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; path = NCUserStatus.storyboard; sourceTree = ""; }; + F7E402282BA85D1D007E5609 /* PrivacyInfo.xcprivacy */ = {isa = PBXFileReference; lastKnownFileType = text.xml; path = PrivacyInfo.xcprivacy; sourceTree = ""; }; + F7E402302BA891EB007E5609 /* NCTrash+SelectTabBarDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "NCTrash+SelectTabBarDelegate.swift"; sourceTree = ""; }; + F7E402322BA89551007E5609 /* NCTrash+Networking.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "NCTrash+Networking.swift"; sourceTree = ""; }; F7E41315294A19B300839300 /* UIView+Extension.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "UIView+Extension.swift"; sourceTree = ""; }; F7E45E6D21E75BF200579249 /* ja-JP */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "ja-JP"; path = "ja-JP.lproj/Localizable.strings"; sourceTree = ""; }; F7E4D9C322ED929B003675FD /* NCShareCommentsCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NCShareCommentsCell.swift; sourceTree = ""; }; @@ -1591,7 +1601,6 @@ F72AD70F28C24BA1006CB92D /* NextcloudKit in Frameworks */, F737DA992B7B864E0063BAFC /* TOPasscodeViewController.xcframework in Frameworks */, F72CD01227A7E92400E59476 /* JGProgressHUD in Frameworks */, - F327FA452B8CC36900E5B743 /* SwipeCellKit in Frameworks */, F77CB6A92AA08053000C3CA4 /* OpenSSL in Frameworks */, F760DE092AE66ED00027D78A /* KeychainAccess in Frameworks */, F73ADD2126554F8E0069EA0D /* SwiftEntryKit in Frameworks */, @@ -1655,7 +1664,6 @@ F70B86752642CE3B00ED5349 /* FirebaseCrashlytics in Frameworks */, F7A1050E29E587AF00FFD92B /* TagListView in Frameworks */, F76DA969277B77EA0082465B /* DropDown in Frameworks */, - F327FA432B8CC0B900E5B743 /* SwipeCellKit in Frameworks */, F7F623B52A5EF4D30022D3D4 /* Gzip in Frameworks */, F75EAED826D2552E00F4320E /* MarqueeLabel in Frameworks */, F710FC7A277B7D0000AA9FBF /* Realm in Frameworks */, @@ -2075,7 +2083,6 @@ children = ( F70D7C3525FFBF81002B9E34 /* NCCollectionViewCommon.swift */, F36E64F62B9245210085ABB5 /* NCCollectionViewCommon+SelectTabBarDelegate.swift */, - F36E64F82B92459B0085ABB5 /* NCCollectionViewCommon+SwipeCollectionViewCellDelegate.swift */, F38F71242B6BBDC300473CDC /* NCCollectionViewCommonSelectTabBar.swift */, F7E7AEA42BA32C6500512E52 /* NCCollectionViewDownloadThumbnail.swift */, F7E7AEA62BA32D0000512E52 /* NCCollectionViewUnifiedSearch.swift */, @@ -2083,7 +2090,6 @@ F78ACD4521903D010088454D /* NCGridCell.xib */, F78ACD4121903CE00088454D /* NCListCell.swift */, F78ACD4321903CF20088454D /* NCListCell.xib */, - AF7E504F27A2D92300B5E4AF /* NCSelectableNavigationView.swift */, ); path = "Collection Common"; sourceTree = ""; @@ -2185,7 +2191,9 @@ F78ACD4721903F850088454D /* Cell */ = { isa = PBXGroup; children = ( - F78ACD4821903F850088454D /* NCTrashListCell+NCTrashCellProtocol.swift */, + F7CEE5FF2BA9A5C9003EFD89 /* NCTrashGridCell.swift */, + F7CEE5FE2BA9A5C9003EFD89 /* NCTrashGridCell.xib */, + F78ACD4821903F850088454D /* NCTrashListCell.swift */, F78ACD4921903F850088454D /* NCTrashListCell.xib */, ); path = Cell; @@ -2209,6 +2217,8 @@ F78F74332163757000C2ADAD /* NCTrash.storyboard */, F78F74352163781100C2ADAD /* NCTrash.swift */, AF3FDCC12796ECC300710F60 /* NCTrash+CollectionView.swift */, + F7E402322BA89551007E5609 /* NCTrash+Networking.swift */, + F7E402302BA891EB007E5609 /* NCTrash+SelectTabBarDelegate.swift */, F321DA892B71205A00DDA0E6 /* NCTrashSelectTabBar.swift */, ); path = Trash; @@ -2634,6 +2644,7 @@ F702F2CC25EE5B4F008F8E80 /* AppDelegate.swift */, F76B649B2ADFFAED00014640 /* NCImageCache.swift */, F702F2CE25EE5B5C008F8E80 /* NCGlobal.swift */, + F7E402282BA85D1D007E5609 /* PrivacyInfo.xcprivacy */, F73CB5771ED46807005F2A5A /* NCBridgeSwift.h */, F70F96AF2874394B006C8379 /* Nextcloud-Bridging-Header.h */, F7F67BB81A24D27800EE80DA /* Images.xcassets */, @@ -2966,7 +2977,6 @@ F760DE082AE66ED00027D78A /* KeychainAccess */, F74C863C2AEFBFD9009A1D4A /* LRUCache */, F711A4EE2AF932B900095DD8 /* SVGKitSwift */, - F327FA442B8CC36900E5B743 /* SwipeCellKit */, ); productName = "Share Ext"; productReference = F7CE8AFB1DC1F8D8009CAE48 /* Share.appex */; @@ -3073,7 +3083,6 @@ F7F623B42A5EF4D30022D3D4 /* Gzip */, F76B649D2ADFFDEC00014640 /* LRUCache */, F760DE022AE66EA80027D78A /* KeychainAccess */, - F327FA422B8CC0B900E5B743 /* SwipeCellKit */, ); productName = "Crypto Cloud"; productReference = F7CE8AFA1DC1F8D8009CAE48 /* Nextcloud.app */; @@ -3250,7 +3259,6 @@ F7F623B32A5EF4D30022D3D4 /* XCRemoteSwiftPackageReference "GzipSwift" */, F76B649A2ADFFAD200014640 /* XCRemoteSwiftPackageReference "LRUCache" */, F760DE012AE66E860027D78A /* XCRemoteSwiftPackageReference "KeychainAccess" */, - F327FA412B8CC0B900E5B743 /* XCRemoteSwiftPackageReference "SwipeCellKit" */, ); productRefGroup = F7F67B9F1A24D27800EE80DA; projectDirPath = ""; @@ -3276,6 +3284,7 @@ isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( + F7E4022F2BA85D1D007E5609 /* PrivacyInfo.xcprivacy in Resources */, F746EC53273906C50052598D /* NCViewCertificateDetails.storyboard in Resources */, ); runOnlyForDeploymentPostprocessing = 0; @@ -3315,6 +3324,7 @@ files = ( F7490E8D29882F5B009DCE94 /* Custom.xcassets in Resources */, F7490E8E2988334A009DCE94 /* Localizable.strings in Resources */, + F7E4022E2BA85D1D007E5609 /* PrivacyInfo.xcprivacy in Resources */, F70716E92987F81500E72C1D /* MainInterface.storyboard in Resources */, ); runOnlyForDeploymentPostprocessing = 0; @@ -3326,6 +3336,7 @@ F714803B262EBE3900693E51 /* MainInterface.storyboard in Resources */, F7148054262ED51000693E51 /* NCListCell.xib in Resources */, F7D57C8626317BDA00DE301D /* NCAccountRequest.storyboard in Resources */, + F7E4022C2BA85D1D007E5609 /* PrivacyInfo.xcprivacy in Resources */, AF22B209277B4E4C00DAB0CC /* NCCreateFormUploadConflictCell.xib in Resources */, F7B398432A6A91D5007538D6 /* NCSectionHeaderMenu.xib in Resources */, F7148063262ED66200693E51 /* NCEmptyView.xib in Resources */, @@ -3346,6 +3357,7 @@ files = ( F7C7B25128B8B0C400E7115D /* Images.xcassets in Resources */, F7C7B25028B8AD4500E7115D /* Localizable.strings in Resources */, + F7E4022A2BA85D1D007E5609 /* PrivacyInfo.xcprivacy in Resources */, F7346E2328B0FEBA006CE2D2 /* Assets.xcassets in Resources */, ); runOnlyForDeploymentPostprocessing = 0; @@ -3354,6 +3366,7 @@ isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( + F7E4022D2BA85D1D007E5609 /* PrivacyInfo.xcprivacy in Resources */, F746EC52273906C40052598D /* NCViewCertificateDetails.storyboard in Resources */, ); runOnlyForDeploymentPostprocessing = 0; @@ -3389,6 +3402,7 @@ F31F69612A2F907800162F76 /* __Snapshots__ in Resources */, AF56C1DC2784856200D8BAE2 /* NCActivityCommentView.xib in Resources */, F7F4F10B27ECDBDB008676F9 /* Inconsolata-Light.ttf in Resources */, + F7CEE6002BA9A5C9003EFD89 /* NCTrashGridCell.xib in Resources */, 3704EB2A23D5A58400455C5B /* NCMenu.storyboard in Resources */, AF93471C27E2361E002537EE /* NCShareAdvancePermissionHeader.xib in Resources */, F76032A0252F0F8E0015A421 /* NCTransferCell.xib in Resources */, @@ -3418,6 +3432,7 @@ F7651A8A23A2A3F2001403D2 /* NCCreateFormUploadDocuments.storyboard in Resources */, F7F4F10A27ECDBDB008676F9 /* Inconsolata-ExtraBold.ttf in Resources */, F704B5E72430C06700632F5F /* NCCreateFormUploadConflictCell.xib in Resources */, + F7E402292BA85D1D007E5609 /* PrivacyInfo.xcprivacy in Resources */, F7C9555321F0C4CA0024296E /* NCActivity.storyboard in Resources */, F7BC287E26663F6C004D46C5 /* NCViewCertificateDetails.storyboard in Resources */, F78ACD54219047D40088454D /* NCSectionFooter.xib in Resources */, @@ -3450,6 +3465,7 @@ isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( + F7E4022B2BA85D1D007E5609 /* PrivacyInfo.xcprivacy in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -3684,7 +3700,7 @@ AF4BF61A27562A4B0081CEEF /* NCManageDatabase+Metadata.swift in Sources */, AF4BF615275629E20081CEEF /* NCManageDatabase+Account.swift in Sources */, F798F0E225880608000DAFFD /* UIColor+Extension.swift in Sources */, - AF3FDCC32796F3FB00710F60 /* NCTrashListCell+NCTrashCellProtocol.swift in Sources */, + AF3FDCC32796F3FB00710F60 /* NCTrashListCell.swift in Sources */, F7327E3F2B73B92800A462C7 /* NCNetworking+Synchronization.swift in Sources */, F7C9B9202B582F550064EA91 /* NCManageDatabase+SecurityGuard.swift in Sources */, AF817EF2274BC781009ED85B /* NCUserBaseUrl.swift in Sources */, @@ -3908,6 +3924,7 @@ F30A96312A27AEBF00D7BCFE /* EnvVars.generated.swift in Sources */, F77444F522281649000D5EB0 /* NCGridMediaCell.swift in Sources */, F78C6FDE296D677300C952C3 /* NCContextMenu.swift in Sources */, + F7E402332BA89551007E5609 /* NCTrash+Networking.swift in Sources */, F7E7AEA72BA32D0000512E52 /* NCCollectionViewUnifiedSearch.swift in Sources */, F769CA172965AB7C00039397 /* NCUploadAssets.swift in Sources */, F73EF7A72B0223900087E6E9 /* NCManageDatabase+Comments.swift in Sources */, @@ -3982,13 +3999,14 @@ F7A321AD1E9E6AD50069AD1B /* CCAdvanced.m in Sources */, F77B0E4F1D118A16002130FE /* CCManageAutoUpload.m in Sources */, F75C0C4823D1FAE300163CC8 /* NCRichWorkspaceCommon.swift in Sources */, - F78ACD4A21903F850088454D /* NCTrashListCell+NCTrashCellProtocol.swift in Sources */, + F78ACD4A21903F850088454D /* NCTrashListCell.swift in Sources */, F757CC8D29E82D0500F31428 /* NCGroupfolders.swift in Sources */, F760329F252F0F8E0015A421 /* NCTransferCell.swift in Sources */, F3BB46542A3A1E9D00461F6E /* CCCellMore.swift in Sources */, AF68326A27BE65A90010BF0B /* NCMenuAction.swift in Sources */, F7682FE023C36B0500983A04 /* NCMainTabBar.swift in Sources */, F7A0D1352591FBC5008F8A13 /* String+Extension.swift in Sources */, + F7CEE6012BA9A5C9003EFD89 /* NCTrashGridCell.swift in Sources */, F77B0E5F1D118A16002130FE /* NCSettings.m in Sources */, F7F9D1BB25397CE000D9BFF5 /* NCViewer.swift in Sources */, F7E7AEA52BA32C6500512E52 /* NCCollectionViewDownloadThumbnail.swift in Sources */, @@ -4048,7 +4066,6 @@ F7C30DFD291BD0B80017149B /* NCNetworkingE2EEDelete.swift in Sources */, F72FD3B5297ED49A00075D28 /* NCManageDatabase+E2EE.swift in Sources */, F73EF7CF2B0225BA0087E6E9 /* NCManageDatabase+Tag.swift in Sources */, - F36E64F92B92459B0085ABB5 /* NCCollectionViewCommon+SwipeCollectionViewCellDelegate.swift in Sources */, AF93471227E2341B002537EE /* NCShare+Menu.swift in Sources */, F7EFA47825ADBA500083159A /* NCViewerProviderContextMenu.swift in Sources */, F755BD9B20594AC7008C5FBB /* NCService.swift in Sources */, @@ -4070,6 +4087,7 @@ AF93471B27E2361E002537EE /* NCShareAdvancePermission.swift in Sources */, F77BC3ED293E528A005F2B08 /* NCConfigServer.swift in Sources */, F7A560422AE1593700BE8FD6 /* NCOperationSaveLivePhoto.swift in Sources */, + F7E402312BA891EB007E5609 /* NCTrash+SelectTabBarDelegate.swift in Sources */, F70753EB2542A99800972D44 /* NCViewerMediaPage.swift in Sources */, F7817CF829801A3500FFBC65 /* Data+Extension.swift in Sources */, F749B651297B0F2400087535 /* NCManageDatabase+Avatar.swift in Sources */, @@ -4126,7 +4144,6 @@ F7327E202B73A42F00A462C7 /* NCNetworking+Download.swift in Sources */, F717402E24F699A5000C87D5 /* NCFavorite.swift in Sources */, AF2D7C7E2742559100ADF566 /* NCShareUserCell.swift in Sources */, - AF7E505027A2D92300B5E4AF /* NCSelectableNavigationView.swift in Sources */, F74DE14325135B6800917068 /* NCTransfers.swift in Sources */, AF4BF614275629E20081CEEF /* NCManageDatabase+Account.swift in Sources */, F711A4DC2AF92CAE00095DD8 /* NCUtility+Date.swift in Sources */, @@ -5020,7 +5037,7 @@ CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; COPY_PHASE_STRIP = NO; - CURRENT_PROJECT_VERSION = 1; + CURRENT_PROJECT_VERSION = 2; DEBUG_INFORMATION_FORMAT = dwarf; DEVELOPMENT_TEAM = NKUJUXUJ3B; ENABLE_STRICT_OBJC_MSGSEND = YES; @@ -5046,7 +5063,7 @@ "@executable_path/Frameworks", "@executable_path/../../Frameworks", ); - MARKETING_VERSION = 5.2.2; + MARKETING_VERSION = 5.2.3; ONLY_ACTIVE_ARCH = YES; OTHER_LDFLAGS = ""; SDKROOT = iphoneos; @@ -5085,7 +5102,7 @@ CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; COPY_PHASE_STRIP = NO; - CURRENT_PROJECT_VERSION = 1; + CURRENT_PROJECT_VERSION = 2; DEVELOPMENT_TEAM = NKUJUXUJ3B; ENABLE_STRICT_OBJC_MSGSEND = YES; ENABLE_TESTABILITY = YES; @@ -5108,7 +5125,7 @@ "@executable_path/Frameworks", "@executable_path/../../Frameworks", ); - MARKETING_VERSION = 5.2.2; + MARKETING_VERSION = 5.2.3; ONLY_ACTIVE_ARCH = YES; OTHER_LDFLAGS = ""; SDKROOT = iphoneos; @@ -5259,14 +5276,6 @@ version = 1.4.0; }; }; - F327FA412B8CC0B900E5B743 /* XCRemoteSwiftPackageReference "SwipeCellKit" */ = { - isa = XCRemoteSwiftPackageReference; - repositoryURL = "https://github.com/SwipeCellKit/SwipeCellKit"; - requirement = { - kind = upToNextMajorVersion; - minimumVersion = 2.7.1; - }; - }; F70B86732642CE3B00ED5349 /* XCRemoteSwiftPackageReference "firebase-ios-sdk" */ = { isa = XCRemoteSwiftPackageReference; repositoryURL = "https://github.com/firebase/firebase-ios-sdk"; @@ -5408,7 +5417,7 @@ repositoryURL = "https://github.com/nextcloud/NextcloudKit"; requirement = { kind = exactVersion; - version = 2.9.8; + version = 2.9.9; }; }; F788ECC5263AAAF900ADC67F /* XCRemoteSwiftPackageReference "MarkdownKit" */ = { @@ -5492,16 +5501,6 @@ package = F31F69622A2F929600162F76 /* XCRemoteSwiftPackageReference "swiftui-preview-snapshots" */; productName = PreviewSnapshots; }; - F327FA422B8CC0B900E5B743 /* SwipeCellKit */ = { - isa = XCSwiftPackageProductDependency; - package = F327FA412B8CC0B900E5B743 /* XCRemoteSwiftPackageReference "SwipeCellKit" */; - productName = SwipeCellKit; - }; - F327FA442B8CC36900E5B743 /* SwipeCellKit */ = { - isa = XCSwiftPackageProductDependency; - package = F327FA412B8CC0B900E5B743 /* XCRemoteSwiftPackageReference "SwipeCellKit" */; - productName = SwipeCellKit; - }; F3C6D0962B0F9BA40078DD25 /* XLForm */ = { isa = XCSwiftPackageProductDependency; package = F74E771E277A2EF40013B958 /* XCRemoteSwiftPackageReference "XLForm" */; diff --git a/iOSClient/Account Request/NCAccountRequest.swift b/iOSClient/Account Request/NCAccountRequest.swift index 94d0dcef0f..504e22b1a2 100644 --- a/iOSClient/Account Request/NCAccountRequest.swift +++ b/iOSClient/Account Request/NCAccountRequest.swift @@ -77,24 +77,19 @@ class NCAccountRequest: UIViewController { NotificationCenter.default.addObserver(self, selector: #selector(applicationDidEnterBackground), name: NSNotification.Name(rawValue: NCGlobal.shared.notificationCenterApplicationDidEnterBackground), object: nil) } - override func viewWillAppear(_ animated: Bool) { - super.viewWillAppear(animated) - } - override func viewDidAppear(_ animated: Bool) { super.viewDidAppear(animated) let visibleCells = tableView.visibleCells var numAccounts = accounts.count if enableAddAccount { numAccounts += 1 } - if visibleCells.count == numAccounts { tableView.isScrollEnabled = false } } - override func viewWillDisappear(_ animated: Bool) { - super.viewWillDisappear(animated) + override func viewDidDisappear(_ animated: Bool) { + super.viewDidDisappear(animated) timer?.invalidate() } @@ -141,7 +136,6 @@ extension NCAccountRequest: UITableViewDelegate { progressView.progress = 0 } - func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat { return heightCell } diff --git a/iOSClient/Account Request/NCShareAccounts.swift b/iOSClient/Account Request/NCShareAccounts.swift index 9af170668a..2785e58f3e 100644 --- a/iOSClient/Account Request/NCShareAccounts.swift +++ b/iOSClient/Account Request/NCShareAccounts.swift @@ -58,15 +58,10 @@ class NCShareAccounts: UIViewController { tableView.backgroundColor = .secondarySystemBackground } - override func viewWillAppear(_ animated: Bool) { - super.viewWillAppear(animated) - } - override func viewDidAppear(_ animated: Bool) { super.viewDidAppear(animated) let visibleCells = tableView.visibleCells - if visibleCells.count == accounts.count { tableView.isScrollEnabled = false } diff --git a/iOSClient/Activity/NCActivity.swift b/iOSClient/Activity/NCActivity.swift index 4f3f93ac40..364c80cc35 100644 --- a/iOSClient/Activity/NCActivity.swift +++ b/iOSClient/Activity/NCActivity.swift @@ -98,15 +98,13 @@ class NCActivity: UIViewController, NCSharePagingContent { override func viewWillAppear(_ animated: Bool) { super.viewWillAppear(animated) - appDelegate.activeViewController = self - navigationController?.setNavigationBarAppearance() - fetchAll(isInitial: true) } - override func viewWillDisappear(_ animated: Bool) { - super.viewWillDisappear(animated) + override func viewDidAppear(_ animated: Bool) { + super.viewDidAppear(animated) + appDelegate.activeViewController = self } override func viewWillLayoutSubviews() { diff --git a/iOSClient/Activity/NCActivityTableViewCell.swift b/iOSClient/Activity/NCActivityTableViewCell.swift index 16bc0a5da6..225162d003 100644 --- a/iOSClient/Activity/NCActivityTableViewCell.swift +++ b/iOSClient/Activity/NCActivityTableViewCell.swift @@ -111,7 +111,7 @@ extension NCActivityTableViewCell: UICollectionViewDelegate { if let viewController = UIStoryboard(name: "NCTrash", bundle: nil).instantiateInitialViewController() as? NCTrash { if let result = NCManageDatabase.shared.getTrashItem(fileId: String(activityPreview.fileId), account: activityPreview.account) { viewController.blinkFileId = result.fileId - viewController.trashPath = result.filePath + viewController.filePath = result.filePath (responder as? UIViewController)!.navigationController?.pushViewController(viewController, animated: true) } else { let error = NKError(errorCode: NCGlobal.shared.errorInternalError, errorDescription: "_trash_file_not_found_") diff --git a/iOSClient/AppDelegate.swift b/iOSClient/AppDelegate.swift index 71497052ab..698a146803 100644 --- a/iOSClient/AppDelegate.swift +++ b/iOSClient/AppDelegate.swift @@ -106,7 +106,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD } if let account = NCManageDatabase.shared.getActiveAccount() { - NextcloudKit.shared.nkCommonInstance.writeLog("Account active \(account.account)") + NextcloudKit.shared.nkCommonInstance.writeLog("[INFO] Account active \(account.account)") if NCKeychain().getPassword(account: account.account).isEmpty { NextcloudKit.shared.nkCommonInstance.writeLog("[ERROR] PASSWORD NOT FOUND for \(account.account)") } @@ -250,14 +250,14 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD let activeAccount = NCManageDatabase.shared.getActiveAccount() if let autoUpload = activeAccount?.autoUpload, autoUpload { - NextcloudKit.shared.nkCommonInstance.writeLog("- Auto upload: true") + NextcloudKit.shared.nkCommonInstance.writeLog("[INFO] Auto upload: true") if UIApplication.shared.backgroundRefreshStatus == .available { - NextcloudKit.shared.nkCommonInstance.writeLog("- Auto upload in background: true") + NextcloudKit.shared.nkCommonInstance.writeLog("[INFO] Auto upload in background: true") } else { - NextcloudKit.shared.nkCommonInstance.writeLog("- Auto upload in background: false") + NextcloudKit.shared.nkCommonInstance.writeLog("[INFO] Auto upload in background: false") } } else { - NextcloudKit.shared.nkCommonInstance.writeLog("- Auto upload: false") + NextcloudKit.shared.nkCommonInstance.writeLog("[INFO] Auto upload: false") } if let error = updateShareAccounts() { @@ -287,7 +287,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD notificationCenter.add(req) } - NextcloudKit.shared.nkCommonInstance.writeLog("bye bye") + NextcloudKit.shared.nkCommonInstance.writeLog("[INFO] bye bye") } // MARK: - Background Task @@ -302,7 +302,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD request.earliestBeginDate = Date(timeIntervalSinceNow: 60) // Refresh after 60 seconds. do { try BGTaskScheduler.shared.submit(request) - NextcloudKit.shared.nkCommonInstance.writeLog("- Refresh task: ok") + NextcloudKit.shared.nkCommonInstance.writeLog("[INFO] Refresh task: ok") } catch { NextcloudKit.shared.nkCommonInstance.writeLog("[ERROR] Refresh task failed to submit request: \(error)") } @@ -320,7 +320,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD request.requiresExternalPower = false do { try BGTaskScheduler.shared.submit(request) - NextcloudKit.shared.nkCommonInstance.writeLog("- Processing task: ok") + NextcloudKit.shared.nkCommonInstance.writeLog("[INFO] Processing task: ok") } catch { NextcloudKit.shared.nkCommonInstance.writeLog("[ERROR] Background Processing task failed to submit request: \(error)") } diff --git a/iOSClient/AudioRecorder/NCAudioRecorderViewController.swift b/iOSClient/AudioRecorder/NCAudioRecorderViewController.swift index 90b733388e..ce4644e135 100644 --- a/iOSClient/AudioRecorder/NCAudioRecorderViewController.swift +++ b/iOSClient/AudioRecorder/NCAudioRecorderViewController.swift @@ -66,18 +66,6 @@ class NCAudioRecorderViewController: UIViewController, NCAudioRecorderDelegate { } } - override func viewWillAppear(_ animated: Bool) { - super.viewWillAppear(animated) - } - - override func viewDidAppear(_ animated: Bool) { - super.viewDidAppear(animated) - } - - override func traitCollectionDidChange(_ previousTraitCollection: UITraitCollection?) { - super.traitCollectionDidChange(previousTraitCollection) - } - // MARK: - Action @IBAction func touchViewController() { diff --git a/iOSClient/Data/NCManageDatabase+Account.swift b/iOSClient/Data/NCManageDatabase+Account.swift index ed6f385be5..43bee069e5 100644 --- a/iOSClient/Data/NCManageDatabase+Account.swift +++ b/iOSClient/Data/NCManageDatabase+Account.swift @@ -115,7 +115,7 @@ extension NCManageDatabase { realm.add(addObject, update: .all) } } catch let error { - NextcloudKit.shared.nkCommonInstance.writeLog("Could not write to database: \(error)") + NextcloudKit.shared.nkCommonInstance.writeLog("[ERROR] Could not write to database: \(error)") } } @@ -127,7 +127,7 @@ extension NCManageDatabase { realm.add(account, update: .all) } } catch let error { - NextcloudKit.shared.nkCommonInstance.writeLog("Could not write to database: \(error)") + NextcloudKit.shared.nkCommonInstance.writeLog("[ERROR] Could not write to database: \(error)") } } @@ -140,7 +140,7 @@ extension NCManageDatabase { realm.delete(result) } } catch let error { - NextcloudKit.shared.nkCommonInstance.writeLog("Could not write to database: \(error)") + NextcloudKit.shared.nkCommonInstance.writeLog("[ERROR] Could not write to database: \(error)") } } @@ -152,7 +152,7 @@ extension NCManageDatabase { guard let result = realm.objects(tableAccount.self).filter("active == true").first else { return nil } return tableAccount.init(value: result) } catch let error as NSError { - NextcloudKit.shared.nkCommonInstance.writeLog("Could not access database: \(error)") + NextcloudKit.shared.nkCommonInstance.writeLog("[ERROR] Could not access database: \(error)") } return nil @@ -168,7 +168,7 @@ extension NCManageDatabase { return Array(results.map { $0.account }) } } catch let error as NSError { - NextcloudKit.shared.nkCommonInstance.writeLog("Could not access database: \(error)") + NextcloudKit.shared.nkCommonInstance.writeLog("[ERROR] Could not access database: \(error)") } return nil @@ -182,7 +182,7 @@ extension NCManageDatabase { guard let result = realm.objects(tableAccount.self).filter(predicate).first else { return nil } return tableAccount.init(value: result) } catch let error as NSError { - NextcloudKit.shared.nkCommonInstance.writeLog("Could not access database: \(error)") + NextcloudKit.shared.nkCommonInstance.writeLog("[ERROR] Could not access database: \(error)") } return nil @@ -197,7 +197,7 @@ extension NCManageDatabase { let results = realm.objects(tableAccount.self).sorted(by: sorted) return Array(results.map { tableAccount.init(value: $0) }) } catch let error as NSError { - NextcloudKit.shared.nkCommonInstance.writeLog("Could not access database: \(error)") + NextcloudKit.shared.nkCommonInstance.writeLog("[ERROR] Could not access database: \(error)") } return [] @@ -212,7 +212,7 @@ extension NCManageDatabase { let results = realm.objects(tableAccount.self).sorted(by: sorted) return Array(results.map { tableAccount.init(value: $0) }) } catch let error as NSError { - NextcloudKit.shared.nkCommonInstance.writeLog("Could not access database: \(error)") + NextcloudKit.shared.nkCommonInstance.writeLog("[ERROR] Could not access database: \(error)") } return [] @@ -230,7 +230,7 @@ extension NCManageDatabase { return result.autoUploadFileName } } catch let error as NSError { - NextcloudKit.shared.nkCommonInstance.writeLog("Could not access database: \(error)") + NextcloudKit.shared.nkCommonInstance.writeLog("[ERROR] Could not access database: \(error)") } return "" @@ -253,7 +253,7 @@ extension NCManageDatabase { } } } catch let error as NSError { - NextcloudKit.shared.nkCommonInstance.writeLog("Could not access database: \(error)") + NextcloudKit.shared.nkCommonInstance.writeLog("[ERROR] Could not access database: \(error)") } return "" @@ -276,7 +276,7 @@ extension NCManageDatabase { guard let result = realm.objects(tableAccount.self).filter("active == true").first else { return NCGlobal.shared.subfolderGranularityMonthly } return result.autoUploadSubfolderGranularity } catch let error as NSError { - NextcloudKit.shared.nkCommonInstance.writeLog("Could not access database: \(error)") + NextcloudKit.shared.nkCommonInstance.writeLog("[ERROR] Could not access database: \(error)") } return NCGlobal.shared.subfolderGranularityMonthly @@ -300,7 +300,7 @@ extension NCManageDatabase { } } } catch let error { - NextcloudKit.shared.nkCommonInstance.writeLog("Could not write to database: \(error)") + NextcloudKit.shared.nkCommonInstance.writeLog("[ERROR] Could not write to database: \(error)") return nil } @@ -317,7 +317,7 @@ extension NCManageDatabase { } } } catch let error { - NextcloudKit.shared.nkCommonInstance.writeLog("Could not write to database: \(error)") + NextcloudKit.shared.nkCommonInstance.writeLog("[ERROR] Could not write to database: \(error)") } } @@ -333,7 +333,7 @@ extension NCManageDatabase { } } } catch let error { - NextcloudKit.shared.nkCommonInstance.writeLog("Could not write to database: \(error)") + NextcloudKit.shared.nkCommonInstance.writeLog("[ERROR] Could not write to database: \(error)") } } @@ -347,7 +347,7 @@ extension NCManageDatabase { } } } catch let error { - NextcloudKit.shared.nkCommonInstance.writeLog("Could not write to database: \(error)") + NextcloudKit.shared.nkCommonInstance.writeLog("[ERROR] Could not write to database: \(error)") } } @@ -365,7 +365,7 @@ extension NCManageDatabase { } } } catch let error { - NextcloudKit.shared.nkCommonInstance.writeLog("Could not write to database: \(error)") + NextcloudKit.shared.nkCommonInstance.writeLog("[ERROR] Could not write to database: \(error)") } } @@ -383,7 +383,7 @@ extension NCManageDatabase { } } } catch let error { - NextcloudKit.shared.nkCommonInstance.writeLog("Could not write to database: \(error)") + NextcloudKit.shared.nkCommonInstance.writeLog("[ERROR] Could not write to database: \(error)") } } @@ -419,7 +419,7 @@ extension NCManageDatabase { } } } catch let error { - NextcloudKit.shared.nkCommonInstance.writeLog("Could not write to database: \(error)") + NextcloudKit.shared.nkCommonInstance.writeLog("[ERROR] Could not write to database: \(error)") } } @@ -433,7 +433,7 @@ extension NCManageDatabase { } } } catch let error { - NextcloudKit.shared.nkCommonInstance.writeLog("Could not write to database: \(error)") + NextcloudKit.shared.nkCommonInstance.writeLog("[ERROR] Could not write to database: \(error)") } } @@ -453,7 +453,7 @@ extension NCManageDatabase { } } } catch let error { - NextcloudKit.shared.nkCommonInstance.writeLog("Could not write to database: \(error)") + NextcloudKit.shared.nkCommonInstance.writeLog("[ERROR] Could not write to database: \(error)") } } @@ -473,7 +473,7 @@ extension NCManageDatabase { } } } catch let error { - NextcloudKit.shared.nkCommonInstance.writeLog("Could not write to database: \(error)") + NextcloudKit.shared.nkCommonInstance.writeLog("[ERROR] Could not write to database: \(error)") } } } diff --git a/iOSClient/Data/NCManageDatabase+Activity.swift b/iOSClient/Data/NCManageDatabase+Activity.swift index a432d2d824..2392027075 100644 --- a/iOSClient/Data/NCManageDatabase+Activity.swift +++ b/iOSClient/Data/NCManageDatabase+Activity.swift @@ -188,7 +188,7 @@ extension NCManageDatabase { } } } catch let error { - NextcloudKit.shared.nkCommonInstance.writeLog("Could not write to database: \(error)") + NextcloudKit.shared.nkCommonInstance.writeLog("[ERROR] Could not write to database: \(error)") } } @@ -206,7 +206,7 @@ extension NCManageDatabase { let filtered = allActivity.filter({ String($0.objectId) == filterFileId && $0.type != "comments" }) return (all: allActivity, filter: filtered) } catch let error as NSError { - NextcloudKit.shared.nkCommonInstance.writeLog("Could not access database: \(error)") + NextcloudKit.shared.nkCommonInstance.writeLog("[ERROR] Could not access database: \(error)") } return([], []) @@ -220,7 +220,7 @@ extension NCManageDatabase { let results = realm.objects(tableActivitySubjectRich.self).filter("account == %@ && idActivity == %d && key == %@", account, idActivity, key).first return results.map { tableActivitySubjectRich.init(value: $0) } } catch let error as NSError { - NextcloudKit.shared.nkCommonInstance.writeLog("Could not access database: \(error)") + NextcloudKit.shared.nkCommonInstance.writeLog("[ERROR] Could not access database: \(error)") } return nil @@ -242,7 +242,7 @@ extension NCManageDatabase { } return activitySubjectRich.map { tableActivitySubjectRich.init(value: $0) } } catch let error as NSError { - NextcloudKit.shared.nkCommonInstance.writeLog("Could not access database: \(error)") + NextcloudKit.shared.nkCommonInstance.writeLog("[ERROR] Could not access database: \(error)") } return nil @@ -262,7 +262,7 @@ extension NCManageDatabase { } return results } catch let error as NSError { - NextcloudKit.shared.nkCommonInstance.writeLog("Could not access database: \(error)") + NextcloudKit.shared.nkCommonInstance.writeLog("[ERROR] Could not access database: \(error)") } return [] @@ -280,7 +280,7 @@ extension NCManageDatabase { realm.add(newRecentActivity, update: .all) } } catch { - NextcloudKit.shared.nkCommonInstance.writeLog("Could not write to database: \(error)") + NextcloudKit.shared.nkCommonInstance.writeLog("[ERROR] Could not write to database: \(error)") } } @@ -291,7 +291,7 @@ extension NCManageDatabase { realm.refresh() return realm.objects(tableActivityLatestId.self).filter("account == %@", account).first } catch let error as NSError { - NextcloudKit.shared.nkCommonInstance.writeLog("Could not access database: \(error)") + NextcloudKit.shared.nkCommonInstance.writeLog("[ERROR] Could not access database: \(error)") } return nil diff --git a/iOSClient/Data/NCManageDatabase+Avatar.swift b/iOSClient/Data/NCManageDatabase+Avatar.swift index dc10f3c4fc..3dff0daf8f 100644 --- a/iOSClient/Data/NCManageDatabase+Avatar.swift +++ b/iOSClient/Data/NCManageDatabase+Avatar.swift @@ -52,7 +52,7 @@ extension NCManageDatabase { realm.add(addObject, update: .all) } } catch let error { - NextcloudKit.shared.nkCommonInstance.writeLog("Could not write to database: \(error)") + NextcloudKit.shared.nkCommonInstance.writeLog("[ERROR] Could not write to database: \(error)") } } @@ -64,7 +64,7 @@ extension NCManageDatabase { guard let result = realm.objects(tableAvatar.self).filter("fileName == %@", fileName).first else { return nil } return tableAvatar.init(value: result) } catch let error as NSError { - NextcloudKit.shared.nkCommonInstance.writeLog("Could not access database: \(error)") + NextcloudKit.shared.nkCommonInstance.writeLog("[ERROR] Could not access database: \(error)") } return nil @@ -82,7 +82,7 @@ extension NCManageDatabase { } } } catch let error { - NextcloudKit.shared.nkCommonInstance.writeLog("Could not write to database: \(error)") + NextcloudKit.shared.nkCommonInstance.writeLog("[ERROR] Could not write to database: \(error)") } } @@ -105,7 +105,7 @@ extension NCManageDatabase { } } } catch let error { - NextcloudKit.shared.nkCommonInstance.writeLog("Could not write to database: \(error)") + NextcloudKit.shared.nkCommonInstance.writeLog("[ERROR] Could not write to database: \(error)") } return image @@ -127,7 +127,7 @@ extension NCManageDatabase { } return UIImage(contentsOfFile: fileNameLocalPath) } catch let error as NSError { - NextcloudKit.shared.nkCommonInstance.writeLog("Could not access database: \(error)") + NextcloudKit.shared.nkCommonInstance.writeLog("[ERROR] Could not access database: \(error)") } utilityFileSystem.removeFile(atPath: fileNameLocalPath) diff --git a/iOSClient/Data/NCManageDatabase+Capabilities.swift b/iOSClient/Data/NCManageDatabase+Capabilities.swift index facb347d11..6d02a73f7f 100644 --- a/iOSClient/Data/NCManageDatabase+Capabilities.swift +++ b/iOSClient/Data/NCManageDatabase+Capabilities.swift @@ -48,7 +48,7 @@ extension NCManageDatabase { realm.add(addObject, update: .all) } } catch let error { - NextcloudKit.shared.nkCommonInstance.writeLog("Could not write to database: \(error)") + NextcloudKit.shared.nkCommonInstance.writeLog("[ERROR] Could not write to database: \(error)") } } @@ -60,7 +60,7 @@ extension NCManageDatabase { guard let result = realm.objects(tableCapabilities.self).filter("account == %@", account).first else { return nil } return result.jsondata } catch let error as NSError { - NextcloudKit.shared.nkCommonInstance.writeLog("Could not access database: \(error)") + NextcloudKit.shared.nkCommonInstance.writeLog("[ERROR] Could not access database: \(error)") } return nil @@ -287,7 +287,7 @@ extension NCManageDatabase { } jsonData = data } catch let error as NSError { - NextcloudKit.shared.nkCommonInstance.writeLog("Could not access database: \(error)") + NextcloudKit.shared.nkCommonInstance.writeLog("[ERROR] Could not access database: \(error)") return } } @@ -358,7 +358,7 @@ extension NCManageDatabase { global.capabilityGroupfoldersEnabled = data.capabilities.groupfolders?.hasGroupFolders ?? false global.capabilitySecurityGuardDiagnostics = data.capabilities.securityguard?.diagnostics ?? false } catch let error as NSError { - NextcloudKit.shared.nkCommonInstance.writeLog("Could not access database: \(error)") + NextcloudKit.shared.nkCommonInstance.writeLog("[ERROR] Could not access database: \(error)") return } } diff --git a/iOSClient/Data/NCManageDatabase+Chunk.swift b/iOSClient/Data/NCManageDatabase+Chunk.swift index fe41537122..1bd8a87e1c 100644 --- a/iOSClient/Data/NCManageDatabase+Chunk.swift +++ b/iOSClient/Data/NCManageDatabase+Chunk.swift @@ -45,7 +45,7 @@ extension NCManageDatabase { guard let result = realm.objects(tableChunk.self).filter("account == %@ AND ocId == %@", account, ocId).first else { return NSUUID().uuidString } return result.chunkFolder } catch let error as NSError { - NextcloudKit.shared.nkCommonInstance.writeLog("Could not write to database: \(error)") + NextcloudKit.shared.nkCommonInstance.writeLog("[ERROR] Could not access to database: \(error)") } return NSUUID().uuidString @@ -63,7 +63,7 @@ extension NCManageDatabase { filesChunk.append((fileName: "\(result.fileName)", size: result.size)) } } catch let error as NSError { - NextcloudKit.shared.nkCommonInstance.writeLog("Could not write to database: \(error)") + NextcloudKit.shared.nkCommonInstance.writeLog("[ERROR] Could not access to database: \(error)") } return filesChunk @@ -88,7 +88,7 @@ extension NCManageDatabase { } } } catch let error { - NextcloudKit.shared.nkCommonInstance.writeLog("Could not write to database: \(error)") + NextcloudKit.shared.nkCommonInstance.writeLog("[ERROR] Could not write to database: \(error)") } } @@ -103,7 +103,7 @@ extension NCManageDatabase { utilityFileSystem.removeFile(atPath: filePath) } } catch let error { - NextcloudKit.shared.nkCommonInstance.writeLog("Could not write to database: \(error)") + NextcloudKit.shared.nkCommonInstance.writeLog("[ERROR] Could not write to database: \(error)") } } @@ -120,7 +120,7 @@ extension NCManageDatabase { realm.delete(results) } } catch let error { - NextcloudKit.shared.nkCommonInstance.writeLog("Could not write to database: \(error)") + NextcloudKit.shared.nkCommonInstance.writeLog("[ERROR] Could not write to database: \(error)") } } diff --git a/iOSClient/Data/NCManageDatabase+Comments.swift b/iOSClient/Data/NCManageDatabase+Comments.swift index a5cec3b780..8141c1081d 100644 --- a/iOSClient/Data/NCManageDatabase+Comments.swift +++ b/iOSClient/Data/NCManageDatabase+Comments.swift @@ -73,7 +73,7 @@ extension NCManageDatabase { } } } catch let error { - NextcloudKit.shared.nkCommonInstance.writeLog("Could not write to database: \(error)") + NextcloudKit.shared.nkCommonInstance.writeLog("[ERROR] Could not write to database: \(error)") } } @@ -85,7 +85,7 @@ extension NCManageDatabase { let results = realm.objects(tableComments.self).filter("account == %@ AND objectId == %@", account, objectId).sorted(byKeyPath: "creationDateTime", ascending: false) return Array(results.map(tableComments.init)) } catch let error as NSError { - NextcloudKit.shared.nkCommonInstance.writeLog("Could not access database: \(error)") + NextcloudKit.shared.nkCommonInstance.writeLog("[ERROR] Could not access database: \(error)") } return [] diff --git a/iOSClient/Data/NCManageDatabase+DashboardWidget.swift b/iOSClient/Data/NCManageDatabase+DashboardWidget.swift index a58c7c8624..b770269828 100644 --- a/iOSClient/Data/NCManageDatabase+DashboardWidget.swift +++ b/iOSClient/Data/NCManageDatabase+DashboardWidget.swift @@ -59,7 +59,7 @@ extension NCManageDatabase { let resultsButton = realm.objects(tableDashboardWidgetButton.self).filter("account == %@ AND id == %@", account, id).sorted(byKeyPath: "type", ascending: true) return (tableDashboardWidget.init(value: resultDashboard), Array(resultsButton.map { tableDashboardWidgetButton.init(value: $0) })) } catch let error as NSError { - NextcloudKit.shared.nkCommonInstance.writeLog("Could not access database: \(error)") + NextcloudKit.shared.nkCommonInstance.writeLog("[ERROR] Could not access database: \(error)") } return (nil, nil) @@ -74,7 +74,7 @@ extension NCManageDatabase { let results = realm.objects(tableDashboardWidget.self).filter("account == %@", account).sorted(by: sortProperties) return Array(results.map { tableDashboardWidget.init(value: $0) }) } catch let error as NSError { - NextcloudKit.shared.nkCommonInstance.writeLog("Could not access database: \(error)") + NextcloudKit.shared.nkCommonInstance.writeLog("[ERROR] Could not access database: \(error)") } return [] @@ -119,7 +119,7 @@ extension NCManageDatabase { } } } catch let error { - NextcloudKit.shared.nkCommonInstance.writeLog("Could not write to database: \(error)") + NextcloudKit.shared.nkCommonInstance.writeLog("[ERROR] Could not write to database: \(error)") } } } diff --git a/iOSClient/Data/NCManageDatabase+DirectEditing.swift b/iOSClient/Data/NCManageDatabase+DirectEditing.swift index 3ac8163e48..c104da3bce 100644 --- a/iOSClient/Data/NCManageDatabase+DirectEditing.swift +++ b/iOSClient/Data/NCManageDatabase+DirectEditing.swift @@ -98,7 +98,7 @@ extension NCManageDatabase { } } } catch let error { - NextcloudKit.shared.nkCommonInstance.writeLog("Could not write to database: \(error)") + NextcloudKit.shared.nkCommonInstance.writeLog("[ERROR] Could not write to database: \(error)") } } @@ -114,7 +114,7 @@ extension NCManageDatabase { return Array(results.map { tableDirectEditingCreators.init(value: $0) }) } } catch let error as NSError { - NextcloudKit.shared.nkCommonInstance.writeLog("Could not write to database: \(error)") + NextcloudKit.shared.nkCommonInstance.writeLog("[ERROR] Could not access to database: \(error)") } return nil @@ -132,7 +132,7 @@ extension NCManageDatabase { return Array(results.map { tableDirectEditingCreators.init(value: $0) }) } } catch let error as NSError { - NextcloudKit.shared.nkCommonInstance.writeLog("Could not write to database: \(error)") + NextcloudKit.shared.nkCommonInstance.writeLog("[ERROR] Could not access to database: \(error)") } return nil @@ -150,7 +150,7 @@ extension NCManageDatabase { return Array(results.map { tableDirectEditingEditors.init(value: $0) }) } } catch let error as NSError { - NextcloudKit.shared.nkCommonInstance.writeLog("Could not write to database: \(error)") + NextcloudKit.shared.nkCommonInstance.writeLog("[ERROR] Could not access to database: \(error)") } return nil diff --git a/iOSClient/Data/NCManageDatabase+Directory.swift b/iOSClient/Data/NCManageDatabase+Directory.swift index 6510b1a2e7..e3e3883c3b 100644 --- a/iOSClient/Data/NCManageDatabase+Directory.swift +++ b/iOSClient/Data/NCManageDatabase+Directory.swift @@ -72,7 +72,7 @@ extension NCManageDatabase { } } } catch let error { - NextcloudKit.shared.nkCommonInstance.writeLog("Could not write to database: \(error)") + NextcloudKit.shared.nkCommonInstance.writeLog("[ERROR] Could not write to database: \(error)") } } @@ -97,7 +97,7 @@ extension NCManageDatabase { realm.delete(results) } } catch let error { - NextcloudKit.shared.nkCommonInstance.writeLog("Could not write to database: \(error)") + NextcloudKit.shared.nkCommonInstance.writeLog("[ERROR] Could not write to database: \(error)") } } @@ -127,7 +127,7 @@ extension NCManageDatabase { realm.add(directory, update: .all) } } catch let error { - NextcloudKit.shared.nkCommonInstance.writeLog("Could not write to database: \(error)") + NextcloudKit.shared.nkCommonInstance.writeLog("[ERROR] Could not write to database: \(error)") } } @@ -140,7 +140,7 @@ extension NCManageDatabase { } } } catch let error { - NextcloudKit.shared.nkCommonInstance.writeLog("Could not write to database: \(error)") + NextcloudKit.shared.nkCommonInstance.writeLog("[ERROR] Could not write to database: \(error)") } } @@ -151,7 +151,7 @@ extension NCManageDatabase { guard let result = realm.objects(tableDirectory.self).filter(predicate).first else { return nil } return tableDirectory.init(value: result) } catch let error as NSError { - NextcloudKit.shared.nkCommonInstance.writeLog("Could not access database: \(error)") + NextcloudKit.shared.nkCommonInstance.writeLog("[ERROR] Could not access database: \(error)") } return nil } @@ -161,7 +161,7 @@ extension NCManageDatabase { let realm = try Realm() return realm.objects(tableDirectory.self).filter("account == %@ AND serverUrl == %@", account, serverUrl).first } catch let error as NSError { - NextcloudKit.shared.nkCommonInstance.writeLog("Could not access database: \(error)") + NextcloudKit.shared.nkCommonInstance.writeLog("[ERROR] Could not access database: \(error)") } return nil } @@ -172,7 +172,7 @@ extension NCManageDatabase { realm.refresh() return realm.objects(tableDirectory.self).filter("ocId == %@", ocId).first } catch let error as NSError { - NextcloudKit.shared.nkCommonInstance.writeLog("Could not access database: \(error)") + NextcloudKit.shared.nkCommonInstance.writeLog("[ERROR] Could not access database: \(error)") } return nil } @@ -188,7 +188,7 @@ extension NCManageDatabase { return Array(results.map { tableDirectory.init(value: $0) }) } } catch let error as NSError { - NextcloudKit.shared.nkCommonInstance.writeLog("Could not access database: \(error)") + NextcloudKit.shared.nkCommonInstance.writeLog("[ERROR] Could not access database: \(error)") } return nil @@ -202,7 +202,7 @@ extension NCManageDatabase { result?.serverUrl = serverUrl } } catch let error { - NextcloudKit.shared.nkCommonInstance.writeLog("Could not write to database: \(error)") + NextcloudKit.shared.nkCommonInstance.writeLog("[ERROR] Could not write to database: \(error)") } } @@ -214,7 +214,7 @@ extension NCManageDatabase { result?.offline = offline } } catch let error { - NextcloudKit.shared.nkCommonInstance.writeLog("Could not write to database: \(error)") + NextcloudKit.shared.nkCommonInstance.writeLog("[ERROR] Could not write to database: \(error)") } } @@ -226,7 +226,7 @@ extension NCManageDatabase { result?.offlineDate = Date() } } catch let error { - NextcloudKit.shared.nkCommonInstance.writeLog("Could not write to database: \(error)") + NextcloudKit.shared.nkCommonInstance.writeLog("[ERROR] Could not write to database: \(error)") } } @@ -241,7 +241,7 @@ extension NCManageDatabase { result?.richWorkspace = richWorkspace } } catch let error { - NextcloudKit.shared.nkCommonInstance.writeLog("Could not write to database: \(error)") + NextcloudKit.shared.nkCommonInstance.writeLog("[ERROR] Could not write to database: \(error)") } if let result = result { @@ -263,7 +263,7 @@ extension NCManageDatabase { result?.colorFolder = colorFolder } } catch let error { - NextcloudKit.shared.nkCommonInstance.writeLog("Could not write to database: \(error)") + NextcloudKit.shared.nkCommonInstance.writeLog("[ERROR] Could not write to database: \(error)") } if let result = result { diff --git a/iOSClient/Data/NCManageDatabase+E2EE.swift b/iOSClient/Data/NCManageDatabase+E2EE.swift index 3560d5ba13..0ed415176c 100644 --- a/iOSClient/Data/NCManageDatabase+E2EE.swift +++ b/iOSClient/Data/NCManageDatabase+E2EE.swift @@ -144,7 +144,7 @@ extension NCManageDatabase { realm.add(object, update: .all) } } catch let error { - NextcloudKit.shared.nkCommonInstance.writeLog("Could not write to database: \(error)") + NextcloudKit.shared.nkCommonInstance.writeLog("[ERROR] Could not write to database: \(error)") } } @@ -157,7 +157,7 @@ extension NCManageDatabase { realm.delete(results) } } catch let error { - NextcloudKit.shared.nkCommonInstance.writeLog("Could not write to database: \(error)") + NextcloudKit.shared.nkCommonInstance.writeLog("[ERROR] Could not write to database: \(error)") } } @@ -168,7 +168,7 @@ extension NCManageDatabase { guard let result = realm.objects(tableE2eEncryption.self).filter(predicate).sorted(byKeyPath: "metadataKeyIndex", ascending: false).first else { return nil } return tableE2eEncryption.init(value: result) } catch let error as NSError { - NextcloudKit.shared.nkCommonInstance.writeLog("Could not access database: \(error)") + NextcloudKit.shared.nkCommonInstance.writeLog("[ERROR] Could not access database: \(error)") } return nil @@ -182,7 +182,7 @@ extension NCManageDatabase { results = realm.objects(tableE2eEncryption.self).filter(predicate) return Array(results.map { tableE2eEncryption.init(value: $0) }) } catch let error as NSError { - NextcloudKit.shared.nkCommonInstance.writeLog("Could not access database: \(error)") + NextcloudKit.shared.nkCommonInstance.writeLog("[ERROR] Could not access database: \(error)") } return [] @@ -198,7 +198,7 @@ extension NCManageDatabase { realm.add(result, update: .all) } } catch let error as NSError { - NextcloudKit.shared.nkCommonInstance.writeLog("Could not write to database: \(error)") + NextcloudKit.shared.nkCommonInstance.writeLog("[ERROR] Could not write to database: \(error)") } } @@ -212,7 +212,7 @@ extension NCManageDatabase { guard let result = realm.objects(tableE2eEncryptionLock.self).filter("account == %@ AND serverUrl == %@", account, serverUrl).first else { return nil } return tableE2eEncryptionLock.init(value: result) } catch let error as NSError { - NextcloudKit.shared.nkCommonInstance.writeLog("Could not access database: \(error)") + NextcloudKit.shared.nkCommonInstance.writeLog("[ERROR] Could not access database: \(error)") } return nil @@ -229,7 +229,7 @@ extension NCManageDatabase { return Array(results.map { tableE2eEncryptionLock.init(value: $0) }) } } catch let error as NSError { - NextcloudKit.shared.nkCommonInstance.writeLog("Could not access database: \(error)") + NextcloudKit.shared.nkCommonInstance.writeLog("[ERROR] Could not access database: \(error)") } return [] @@ -248,7 +248,7 @@ extension NCManageDatabase { realm.add(object, update: .all) } } catch let error { - NextcloudKit.shared.nkCommonInstance.writeLog("Could not write to database: \(error)") + NextcloudKit.shared.nkCommonInstance.writeLog("[ERROR] Could not write to database: \(error)") } } @@ -262,7 +262,7 @@ extension NCManageDatabase { } } } catch let error { - NextcloudKit.shared.nkCommonInstance.writeLog("Could not write to database: \(error)") + NextcloudKit.shared.nkCommonInstance.writeLog("[ERROR] Could not write to database: \(error)") } } @@ -276,7 +276,7 @@ extension NCManageDatabase { guard let result = realm.objects(tableE2eMetadata12.self).filter("account == %@ AND serverUrl == %@", account, serverUrl).first else { return nil } return tableE2eMetadata12.init(value: result) } catch let error as NSError { - NextcloudKit.shared.nkCommonInstance.writeLog("Could not access database: \(error)") + NextcloudKit.shared.nkCommonInstance.writeLog("[ERROR] Could not access database: \(error)") } return nil @@ -295,7 +295,7 @@ extension NCManageDatabase { realm.add(object, update: .all) } } catch let error { - NextcloudKit.shared.nkCommonInstance.writeLog("Could not write to database: \(error)") + NextcloudKit.shared.nkCommonInstance.writeLog("[ERROR] Could not write to database: \(error)") } } @@ -321,7 +321,7 @@ extension NCManageDatabase { realm.add(object, update: .all) } } catch let error { - NextcloudKit.shared.nkCommonInstance.writeLog("Could not write to database: \(error)") + NextcloudKit.shared.nkCommonInstance.writeLog("[ERROR] Could not write to database: \(error)") } } @@ -335,7 +335,7 @@ extension NCManageDatabase { } } } catch let error { - NextcloudKit.shared.nkCommonInstance.writeLog("Could not write to database: \(error)") + NextcloudKit.shared.nkCommonInstance.writeLog("[ERROR] Could not write to database: \(error)") } } @@ -345,7 +345,7 @@ extension NCManageDatabase { let realm = try Realm() return realm.objects(tableE2eUsers.self).filter("account == %@ AND ocIdServerUrl == %@", account, ocIdServerUrl) } catch let error as NSError { - NextcloudKit.shared.nkCommonInstance.writeLog("Could not access database: \(error)") + NextcloudKit.shared.nkCommonInstance.writeLog("[ERROR] Could not access database: \(error)") } return nil @@ -357,7 +357,7 @@ extension NCManageDatabase { let realm = try Realm() return realm.objects(tableE2eUsers.self).filter("account == %@ && ocIdServerUrl == %@ AND userId == %@", account, ocIdServerUrl, userId).first } catch let error as NSError { - NextcloudKit.shared.nkCommonInstance.writeLog("Could not access database: \(error)") + NextcloudKit.shared.nkCommonInstance.writeLog("[ERROR] Could not access database: \(error)") } return nil @@ -369,7 +369,7 @@ extension NCManageDatabase { let realm = try Realm() return realm.objects(tableE2eMetadata.self).filter("account == %@ && ocIdServerUrl == %@", account, ocIdServerUrl).first } catch let error as NSError { - NextcloudKit.shared.nkCommonInstance.writeLog("Could not access database: \(error)") + NextcloudKit.shared.nkCommonInstance.writeLog("[ERROR] Could not access database: \(error)") } return nil @@ -396,7 +396,7 @@ extension NCManageDatabase { realm.add(object, update: .all) } } catch let error { - NextcloudKit.shared.nkCommonInstance.writeLog("Could not write to database: \(error)") + NextcloudKit.shared.nkCommonInstance.writeLog("[ERROR] Could not write to database: \(error)") } } @@ -409,7 +409,7 @@ extension NCManageDatabase { realm.add(object, update: .all) } } catch let error { - NextcloudKit.shared.nkCommonInstance.writeLog("Could not write to database: \(error)") + NextcloudKit.shared.nkCommonInstance.writeLog("[ERROR] Could not write to database: \(error)") } } @@ -419,7 +419,7 @@ extension NCManageDatabase { let realm = try Realm() return realm.objects(tableE2eCounter.self).filter("account == %@ && ocIdServerUrl == %@", account, ocIdServerUrl).first?.counter } catch let error as NSError { - NextcloudKit.shared.nkCommonInstance.writeLog("Could not access database: \(error)") + NextcloudKit.shared.nkCommonInstance.writeLog("[ERROR] Could not access database: \(error)") } return nil diff --git a/iOSClient/Data/NCManageDatabase+ExternalSites.swift b/iOSClient/Data/NCManageDatabase+ExternalSites.swift index 42b4f366bc..098042da56 100644 --- a/iOSClient/Data/NCManageDatabase+ExternalSites.swift +++ b/iOSClient/Data/NCManageDatabase+ExternalSites.swift @@ -56,7 +56,7 @@ extension NCManageDatabase { realm.add(addObject) } } catch let error { - NextcloudKit.shared.nkCommonInstance.writeLog("Could not write to database: \(error)") + NextcloudKit.shared.nkCommonInstance.writeLog("[ERROR] Could not write to database: \(error)") } } @@ -69,7 +69,7 @@ extension NCManageDatabase { realm.delete(results) } } catch let error { - NextcloudKit.shared.nkCommonInstance.writeLog("Could not write to database: \(error)") + NextcloudKit.shared.nkCommonInstance.writeLog("[ERROR] Could not write to database: \(error)") } } @@ -85,7 +85,7 @@ extension NCManageDatabase { return Array(results.map { tableExternalSites.init(value: $0) }) } } catch let error as NSError { - NextcloudKit.shared.nkCommonInstance.writeLog("Could not write to database: \(error)") + NextcloudKit.shared.nkCommonInstance.writeLog("[ERROR] Could not access to database: \(error)") } return nil diff --git a/iOSClient/Data/NCManageDatabase+GPS.swift b/iOSClient/Data/NCManageDatabase+GPS.swift index 3f6851ab4f..fae9896fbf 100644 --- a/iOSClient/Data/NCManageDatabase+GPS.swift +++ b/iOSClient/Data/NCManageDatabase+GPS.swift @@ -48,7 +48,7 @@ extension NCManageDatabase { realm.add(addObject) } } catch let error as NSError { - NextcloudKit.shared.nkCommonInstance.writeLog("Could not write to database: \(error)") + NextcloudKit.shared.nkCommonInstance.writeLog("[ERROR] Could not write to database: \(error)") } } @@ -59,7 +59,7 @@ extension NCManageDatabase { let result = realm.objects(tableGPS.self).filter("latitude == %@ AND longitude == %@", latitude, longitude).first return result?.location } catch let error as NSError { - NextcloudKit.shared.nkCommonInstance.writeLog("Could not write to database: \(error)") + NextcloudKit.shared.nkCommonInstance.writeLog("[ERROR] Could not access to database: \(error)") } return nil diff --git a/iOSClient/Data/NCManageDatabase+Groupfolders.swift b/iOSClient/Data/NCManageDatabase+Groupfolders.swift index d88e9077cb..83b2bf5a43 100644 --- a/iOSClient/Data/NCManageDatabase+Groupfolders.swift +++ b/iOSClient/Data/NCManageDatabase+Groupfolders.swift @@ -83,7 +83,7 @@ extension NCManageDatabase { } } } catch let error { - NextcloudKit.shared.nkCommonInstance.writeLog("Could not write to database: \(error)") + NextcloudKit.shared.nkCommonInstance.writeLog("[ERROR] Could not write to database: \(error)") } } } diff --git a/iOSClient/Data/NCManageDatabase+LayoutForView.swift b/iOSClient/Data/NCManageDatabase+LayoutForView.swift index 90bd872930..cbbbcff2e1 100644 --- a/iOSClient/Data/NCManageDatabase+LayoutForView.swift +++ b/iOSClient/Data/NCManageDatabase+LayoutForView.swift @@ -86,7 +86,7 @@ extension NCManageDatabase { realm.add(addObject, update: .all) } } catch let error { - NextcloudKit.shared.nkCommonInstance.writeLog("Could not write to database: \(error)") + NextcloudKit.shared.nkCommonInstance.writeLog("[ERROR] Could not write to database: \(error)") } return NCDBLayoutForView(value: addObject) @@ -103,7 +103,7 @@ extension NCManageDatabase { realm.add(result, update: .all) } } catch let error { - NextcloudKit.shared.nkCommonInstance.writeLog("Could not write to database: \(error)") + NextcloudKit.shared.nkCommonInstance.writeLog("[ERROR] Could not write to database: \(error)") return nil } return NCDBLayoutForView(value: result) @@ -124,7 +124,7 @@ extension NCManageDatabase { return setLayoutForView(account: account, key: key, serverUrl: serverUrl) } } catch let error as NSError { - NextcloudKit.shared.nkCommonInstance.writeLog("Could not access database: \(error)") + NextcloudKit.shared.nkCommonInstance.writeLog("[ERROR] Could not access database: \(error)") } return setLayoutForView(account: account, key: key, serverUrl: serverUrl) diff --git a/iOSClient/Data/NCManageDatabase+LocalFile.swift b/iOSClient/Data/NCManageDatabase+LocalFile.swift index 020669b606..387470112d 100644 --- a/iOSClient/Data/NCManageDatabase+LocalFile.swift +++ b/iOSClient/Data/NCManageDatabase+LocalFile.swift @@ -54,7 +54,7 @@ extension NCManageDatabase { let realm = try Realm() return realm.objects(tableLocalFile.self).filter("ocId == %@", ocId).first } catch let error as NSError { - NextcloudKit.shared.nkCommonInstance.writeLog("Could not access database: \(error)") + NextcloudKit.shared.nkCommonInstance.writeLog("[ERROR] Could not access database: \(error)") } return nil } @@ -81,7 +81,7 @@ extension NCManageDatabase { realm.add(addObject, update: .all) } } catch let error { - NextcloudKit.shared.nkCommonInstance.writeLog("Could not write to database: \(error)") + NextcloudKit.shared.nkCommonInstance.writeLog("[ERROR] Could not write to database: \(error)") } } @@ -101,7 +101,7 @@ extension NCManageDatabase { realm.add(addObject, update: .all) } } catch let error { - NextcloudKit.shared.nkCommonInstance.writeLog("Could not write to database: \(error)") + NextcloudKit.shared.nkCommonInstance.writeLog("[ERROR] Could not write to database: \(error)") } } @@ -114,7 +114,7 @@ extension NCManageDatabase { realm.delete(results) } } catch let error { - NextcloudKit.shared.nkCommonInstance.writeLog("Could not write to database: \(error)") + NextcloudKit.shared.nkCommonInstance.writeLog("[ERROR] Could not write to database: \(error)") } } @@ -129,7 +129,7 @@ extension NCManageDatabase { } } } catch let error { - NextcloudKit.shared.nkCommonInstance.writeLog("Could not write to database: \(error)") + NextcloudKit.shared.nkCommonInstance.writeLog("[ERROR] Could not write to database: \(error)") } } @@ -148,7 +148,7 @@ extension NCManageDatabase { } } } catch let error { - NextcloudKit.shared.nkCommonInstance.writeLog("Could not write to database: \(error)") + NextcloudKit.shared.nkCommonInstance.writeLog("[ERROR] Could not write to database: \(error)") } } @@ -161,7 +161,7 @@ extension NCManageDatabase { result?.offline = false } } catch let error { - NextcloudKit.shared.nkCommonInstance.writeLog("Could not write to database: \(error)") + NextcloudKit.shared.nkCommonInstance.writeLog("[ERROR] Could not write to database: \(error)") } } @@ -172,7 +172,7 @@ extension NCManageDatabase { let results = realm.objects(tableLocalFile.self).filter("account == %@", account) return Array(results.map { tableLocalFile.init(value: $0) }) } catch let error as NSError { - NextcloudKit.shared.nkCommonInstance.writeLog("Could not access database: \(error)") + NextcloudKit.shared.nkCommonInstance.writeLog("[ERROR] Could not access database: \(error)") } return [] @@ -185,7 +185,7 @@ extension NCManageDatabase { guard let result = realm.objects(tableLocalFile.self).filter(predicate).first else { return nil } return tableLocalFile.init(value: result) } catch let error as NSError { - NextcloudKit.shared.nkCommonInstance.writeLog("Could not access database: \(error)") + NextcloudKit.shared.nkCommonInstance.writeLog("[ERROR] Could not access database: \(error)") } return nil @@ -197,7 +197,7 @@ extension NCManageDatabase { let realm = try Realm() return realm.objects(tableLocalFile.self).filter(predicate) } catch let error as NSError { - NextcloudKit.shared.nkCommonInstance.writeLog("Could not access database: \(error)") + NextcloudKit.shared.nkCommonInstance.writeLog("[ERROR] Could not access database: \(error)") } return nil @@ -210,7 +210,7 @@ extension NCManageDatabase { let results = realm.objects(tableLocalFile.self).filter(predicate).sorted(byKeyPath: sorted, ascending: ascending) return Array(results.map { tableLocalFile.init(value: $0) }) } catch let error as NSError { - NextcloudKit.shared.nkCommonInstance.writeLog("Could not access database: \(error)") + NextcloudKit.shared.nkCommonInstance.writeLog("[ERROR] Could not access database: \(error)") } return [] @@ -222,7 +222,7 @@ extension NCManageDatabase { let realm = try Realm() return realm.objects(tableLocalFile.self).filter(predicate).sorted(byKeyPath: sorted, ascending: ascending) } catch let error as NSError { - NextcloudKit.shared.nkCommonInstance.writeLog("Could not access database: \(error)") + NextcloudKit.shared.nkCommonInstance.writeLog("[ERROR] Could not access database: \(error)") } return nil @@ -248,7 +248,7 @@ extension NCManageDatabase { } } } catch let error { - NextcloudKit.shared.nkCommonInstance.writeLog("Could not write to database: \(error)") + NextcloudKit.shared.nkCommonInstance.writeLog("[ERROR] Could not write to database: \(error)") } } } diff --git a/iOSClient/Data/NCManageDatabase+Metadata+Session.swift b/iOSClient/Data/NCManageDatabase+Metadata+Session.swift index 36fc642bef..088d5a6e79 100644 --- a/iOSClient/Data/NCManageDatabase+Metadata+Session.swift +++ b/iOSClient/Data/NCManageDatabase+Metadata+Session.swift @@ -73,7 +73,7 @@ extension NCManageDatabase { } } } catch let error { - NextcloudKit.shared.nkCommonInstance.writeLog("Could not write to database: \(error)") + NextcloudKit.shared.nkCommonInstance.writeLog("[ERROR] Could not write to database: \(error)") } } @@ -99,7 +99,7 @@ extension NCManageDatabase { } } } catch let error { - NextcloudKit.shared.nkCommonInstance.writeLog("Could not write to database: \(error)") + NextcloudKit.shared.nkCommonInstance.writeLog("[ERROR] Could not write to database: \(error)") } } @@ -131,7 +131,7 @@ extension NCManageDatabase { } } } catch let error { - NextcloudKit.shared.nkCommonInstance.writeLog("Could not write to database: \(error)") + NextcloudKit.shared.nkCommonInstance.writeLog("[ERROR] Could not write to database: \(error)") } return metadataUpdated @@ -150,7 +150,7 @@ extension NCManageDatabase { } } } catch let error { - NextcloudKit.shared.nkCommonInstance.writeLog("Could not write to database: \(error)") + NextcloudKit.shared.nkCommonInstance.writeLog("[ERROR] Could not write to database: \(error)") } } @@ -164,7 +164,7 @@ extension NCManageDatabase { result?.status = status } } catch let error { - NextcloudKit.shared.nkCommonInstance.writeLog("Could not write to database: \(error)") + NextcloudKit.shared.nkCommonInstance.writeLog("[ERROR] Could not write to database: \(error)") } if let result { return tableMetadata.init(value: result) diff --git a/iOSClient/Data/NCManageDatabase+Metadata.swift b/iOSClient/Data/NCManageDatabase+Metadata.swift index a2dd2f59a9..673c77d504 100644 --- a/iOSClient/Data/NCManageDatabase+Metadata.swift +++ b/iOSClient/Data/NCManageDatabase+Metadata.swift @@ -497,7 +497,7 @@ extension NCManageDatabase { realm.add(result, update: .all) } } catch let error { - NextcloudKit.shared.nkCommonInstance.writeLog("Could not write to database: \(error)") + NextcloudKit.shared.nkCommonInstance.writeLog("[ERROR] Could not write to database: \(error)") return nil } return tableMetadata.init(value: result) @@ -517,7 +517,7 @@ extension NCManageDatabase { } } } catch let error { - NextcloudKit.shared.nkCommonInstance.writeLog("Could not write to database: \(error)") + NextcloudKit.shared.nkCommonInstance.writeLog("[ERROR] Could not write to database: \(error)") } } @@ -529,7 +529,7 @@ extension NCManageDatabase { realm.add(metadatas, update: .all) } } catch let error { - NextcloudKit.shared.nkCommonInstance.writeLog("Could not write to database: \(error)") + NextcloudKit.shared.nkCommonInstance.writeLog("[ERROR] Could not write to database: \(error)") } } @@ -542,7 +542,7 @@ extension NCManageDatabase { realm.delete(results) } } catch let error { - NextcloudKit.shared.nkCommonInstance.writeLog("Could not write to database: \(error)") + NextcloudKit.shared.nkCommonInstance.writeLog("[ERROR] Could not write to database: \(error)") } } @@ -554,7 +554,7 @@ extension NCManageDatabase { realm.delete(results) } } catch let error { - NextcloudKit.shared.nkCommonInstance.writeLog("Could not write to database: \(error)") + NextcloudKit.shared.nkCommonInstance.writeLog("[ERROR] Could not write to database: \(error)") } } @@ -568,7 +568,7 @@ extension NCManageDatabase { } } } catch let error { - NextcloudKit.shared.nkCommonInstance.writeLog("Could not write to database: \(error)") + NextcloudKit.shared.nkCommonInstance.writeLog("[ERROR] Could not write to database: \(error)") } } @@ -587,7 +587,7 @@ extension NCManageDatabase { } } } catch let error { - NextcloudKit.shared.nkCommonInstance.writeLog("Could not write to database: \(error)") + NextcloudKit.shared.nkCommonInstance.writeLog("[ERROR] Could not write to database: \(error)") } } @@ -602,7 +602,7 @@ extension NCManageDatabase { result?.etagResource = etagResource } } catch let error { - NextcloudKit.shared.nkCommonInstance.writeLog("Could not write to database: \(error)") + NextcloudKit.shared.nkCommonInstance.writeLog("[ERROR] Could not write to database: \(error)") } } @@ -615,7 +615,7 @@ extension NCManageDatabase { result?.favorite = favorite } } catch let error { - NextcloudKit.shared.nkCommonInstance.writeLog("Could not write to database: \(error)") + NextcloudKit.shared.nkCommonInstance.writeLog("[ERROR] Could not write to database: \(error)") } } @@ -630,7 +630,7 @@ extension NCManageDatabase { } } } catch let error { - NextcloudKit.shared.nkCommonInstance.writeLog("Could not write to database: \(error)") + NextcloudKit.shared.nkCommonInstance.writeLog("[ERROR] Could not write to database: \(error)") } } @@ -648,7 +648,7 @@ extension NCManageDatabase { } } } catch let error { - NextcloudKit.shared.nkCommonInstance.writeLog("Could not write to database: \(error)") + NextcloudKit.shared.nkCommonInstance.writeLog("[ERROR] Could not write to database: \(error)") } } @@ -661,7 +661,7 @@ extension NCManageDatabase { result?.e2eEncrypted = encrypted } } catch let error { - NextcloudKit.shared.nkCommonInstance.writeLog("Could not write to database: \(error)") + NextcloudKit.shared.nkCommonInstance.writeLog("[ERROR] Could not write to database: \(error)") } } @@ -674,7 +674,7 @@ extension NCManageDatabase { result?.fileNameView = newFileNameView } } catch let error { - NextcloudKit.shared.nkCommonInstance.writeLog("Could not write to database: \(error)") + NextcloudKit.shared.nkCommonInstance.writeLog("[ERROR] Could not write to database: \(error)") } } @@ -686,7 +686,7 @@ extension NCManageDatabase { guard let result = realm.objects(tableMetadata.self).filter(predicate).first else { return nil } return tableMetadata.init(value: result) } catch let error as NSError { - NextcloudKit.shared.nkCommonInstance.writeLog("Could not access database: \(error)") + NextcloudKit.shared.nkCommonInstance.writeLog("[ERROR] Could not access database: \(error)") } return nil @@ -700,7 +700,7 @@ extension NCManageDatabase { guard let result = realm.objects(tableMetadata.self).filter(predicate).sorted(byKeyPath: sorted, ascending: ascending).first else { return nil } return tableMetadata.init(value: result) } catch let error as NSError { - NextcloudKit.shared.nkCommonInstance.writeLog("Could not access database: \(error)") + NextcloudKit.shared.nkCommonInstance.writeLog("[ERROR] Could not access database: \(error)") } return nil @@ -714,7 +714,7 @@ extension NCManageDatabase { let results = realm.objects(tableMetadata.self).filter(predicate) return Array(results.map { tableMetadata.init(value: $0) }) } catch let error as NSError { - NextcloudKit.shared.nkCommonInstance.writeLog("Could not access database: \(error)") + NextcloudKit.shared.nkCommonInstance.writeLog("[ERROR] Could not access database: \(error)") } return [] @@ -727,7 +727,7 @@ extension NCManageDatabase { let results = realm.objects(tableMetadata.self).filter(predicate).sorted(byKeyPath: sorted, ascending: ascending) return Array(results.map { tableMetadata.init(value: $0) }) } catch let error as NSError { - NextcloudKit.shared.nkCommonInstance.writeLog("Could not access database: \(error)") + NextcloudKit.shared.nkCommonInstance.writeLog("[ERROR] Could not access database: \(error)") } return nil @@ -743,7 +743,7 @@ extension NCManageDatabase { return realm.objects(tableMetadata.self).filter(predicate) } } catch let error as NSError { - NextcloudKit.shared.nkCommonInstance.writeLog("Could not access database: \(error)") + NextcloudKit.shared.nkCommonInstance.writeLog("[ERROR] Could not access database: \(error)") } return nil @@ -755,7 +755,7 @@ extension NCManageDatabase { let realm = try Realm() return realm.objects(tableMetadata.self).filter(predicate).sorted(by: sorted) } catch let error as NSError { - NextcloudKit.shared.nkCommonInstance.writeLog("Could not access database: \(error)") + NextcloudKit.shared.nkCommonInstance.writeLog("[ERROR] Could not access database: \(error)") } return nil @@ -767,7 +767,7 @@ extension NCManageDatabase { let realm = try Realm() return realm.objects(tableMetadata.self).filter(predicate).first } catch let error as NSError { - NextcloudKit.shared.nkCommonInstance.writeLog("Could not access database: \(error)") + NextcloudKit.shared.nkCommonInstance.writeLog("[ERROR] Could not access database: \(error)") } return nil @@ -796,7 +796,7 @@ extension NCManageDatabase { } } } catch let error as NSError { - NextcloudKit.shared.nkCommonInstance.writeLog("Could not access database: \(error)") + NextcloudKit.shared.nkCommonInstance.writeLog("[ERROR] Could not access database: \(error)") } return metadatas @@ -814,7 +814,7 @@ extension NCManageDatabase { return tableMetadata.init(value: results[index]) } } catch let error as NSError { - NextcloudKit.shared.nkCommonInstance.writeLog("Could not access database: \(error)") + NextcloudKit.shared.nkCommonInstance.writeLog("[ERROR] Could not access database: \(error)") } return nil @@ -829,7 +829,7 @@ extension NCManageDatabase { guard let result = realm.objects(tableMetadata.self).filter("ocId == %@", ocId).first else { return nil } return tableMetadata.init(value: result) } catch let error as NSError { - NextcloudKit.shared.nkCommonInstance.writeLog("Could not access database: \(error)") + NextcloudKit.shared.nkCommonInstance.writeLog("[ERROR] Could not access database: \(error)") } return nil @@ -843,7 +843,7 @@ extension NCManageDatabase { guard let result = realm.objects(tableMetadata.self).filter("fileName == %@ AND serverUrl == %@", fileName, serverUrl).first else { return nil } return tableMetadata.init(value: result) } catch let error as NSError { - NextcloudKit.shared.nkCommonInstance.writeLog("Could not access database: \(error)") + NextcloudKit.shared.nkCommonInstance.writeLog("[ERROR] Could not access database: \(error)") } return nil @@ -861,7 +861,7 @@ extension NCManageDatabase { guard let result = realm.objects(tableMetadata.self).filter("ocId == %@", ocId).first else { return nil } return tableMetadata.init(value: result) } catch let error as NSError { - NextcloudKit.shared.nkCommonInstance.writeLog("Could not access database: \(error)") + NextcloudKit.shared.nkCommonInstance.writeLog("[ERROR] Could not access database: \(error)") } } @@ -876,7 +876,7 @@ extension NCManageDatabase { realm.refresh() return realm.objects(tableMetadata.self).filter("ocId == %@", ocId).first } catch let error as NSError { - NextcloudKit.shared.nkCommonInstance.writeLog("Could not access database: \(error)") + NextcloudKit.shared.nkCommonInstance.writeLog("[ERROR] Could not access database: \(error)") } return nil } @@ -890,7 +890,7 @@ extension NCManageDatabase { guard let result = realm.objects(tableMetadata.self).filter("fileId == %@", fileId).first else { return nil } return tableMetadata.init(value: result) } catch let error as NSError { - NextcloudKit.shared.nkCommonInstance.writeLog("Could not access database: \(error)") + NextcloudKit.shared.nkCommonInstance.writeLog("[ERROR] Could not access database: \(error)") } return nil @@ -918,7 +918,7 @@ extension NCManageDatabase { guard let result = realm.objects(tableMetadata.self).filter("account == %@ AND serverUrl == %@ AND fileName == %@", account, serverUrl, fileName).first else { return nil } return tableMetadata.init(value: result) } catch let error as NSError { - NextcloudKit.shared.nkCommonInstance.writeLog("Could not access database: \(error)") + NextcloudKit.shared.nkCommonInstance.writeLog("[ERROR] Could not access database: \(error)") } return nil @@ -938,7 +938,7 @@ extension NCManageDatabase { listIdentifierRank[result.ocId] = NSNumber(value: Int64(counter)) } } catch let error as NSError { - NextcloudKit.shared.nkCommonInstance.writeLog("Could not access database: \(error)") + NextcloudKit.shared.nkCommonInstance.writeLog("[ERROR] Could not access database: \(error)") } return listIdentifierRank @@ -953,7 +953,7 @@ extension NCManageDatabase { realm.delete(results) } } catch let error { - NextcloudKit.shared.nkCommonInstance.writeLog("Could not write to database: \(error)") + NextcloudKit.shared.nkCommonInstance.writeLog("[ERROR] Could not write to database: \(error)") } } @@ -968,7 +968,7 @@ extension NCManageDatabase { } } } catch let error { - NextcloudKit.shared.nkCommonInstance.writeLog("Could not write to database: \(error)") + NextcloudKit.shared.nkCommonInstance.writeLog("[ERROR] Could not write to database: \(error)") } } @@ -983,7 +983,7 @@ extension NCManageDatabase { assetLocalIdentifiers.append(result.assetLocalIdentifier) } } catch let error as NSError { - NextcloudKit.shared.nkCommonInstance.writeLog("Could not access database: \(error)") + NextcloudKit.shared.nkCommonInstance.writeLog("[ERROR] Could not access database: \(error)") } return assetLocalIdentifiers @@ -1000,7 +1000,7 @@ extension NCManageDatabase { } } } catch let error { - NextcloudKit.shared.nkCommonInstance.writeLog("Could not write to database: \(error)") + NextcloudKit.shared.nkCommonInstance.writeLog("[ERROR] Could not write to database: \(error)") } } @@ -1013,7 +1013,7 @@ extension NCManageDatabase { guard let result = realm.objects(tableMetadata.self).filter(NSPredicate(format: "account == %@ AND serverUrl == %@ AND fileId == %@", metadata.account, metadata.serverUrl, metadata.livePhotoFile)).first else { return nil } return tableMetadata.init(value: result) } catch let error as NSError { - NextcloudKit.shared.nkCommonInstance.writeLog("Could not access database: \(error)") + NextcloudKit.shared.nkCommonInstance.writeLog("[ERROR] Could not access database: \(error)") } return nil @@ -1062,7 +1062,7 @@ extension NCManageDatabase { realm.refresh() return realm.objects(tableMetadata.self).filter(NSPredicate(format: "status == %i", NCGlobal.shared.metadataStatusUploading)).count } catch let error as NSError { - NextcloudKit.shared.nkCommonInstance.writeLog("Could not access database: \(error)") + NextcloudKit.shared.nkCommonInstance.writeLog("[ERROR] Could not access database: \(error)") } return 0 @@ -1077,7 +1077,7 @@ extension NCManageDatabase { guard let result = realm.objects(tableMetadata.self).filter("ocId == %@", directory.ocId).first else { return nil } return tableMetadata.init(value: result) } catch let error as NSError { - NextcloudKit.shared.nkCommonInstance.writeLog("Could not access database: \(error)") + NextcloudKit.shared.nkCommonInstance.writeLog("[ERROR] Could not access database: \(error)") } return nil @@ -1101,7 +1101,7 @@ extension NCManageDatabase { } } } catch let error as NSError { - NextcloudKit.shared.nkCommonInstance.writeLog("Could not access database: \(error)") + NextcloudKit.shared.nkCommonInstance.writeLog("[ERROR] Could not access database: \(error)") } return metadatas @@ -1114,7 +1114,7 @@ extension NCManageDatabase { let results = realm.objects(tableMetadata.self).filter("account == %@ AND errorCodeCounter > 1", account) return results } catch let error as NSError { - NextcloudKit.shared.nkCommonInstance.writeLog("Could not access database: \(error)") + NextcloudKit.shared.nkCommonInstance.writeLog("[ERROR] Could not access database: \(error)") } return nil @@ -1146,7 +1146,7 @@ extension NCManageDatabase { } } } catch let error { - NextcloudKit.shared.nkCommonInstance.writeLog("Could not write to database: \(error)") + NextcloudKit.shared.nkCommonInstance.writeLog("[ERROR] Could not write to database: \(error)") } return (metadatasDifferentCount, metadatasModified) @@ -1168,7 +1168,7 @@ extension NCManageDatabase { } } } catch let error { - NextcloudKit.shared.nkCommonInstance.writeLog("Could not write to database: \(error)") + NextcloudKit.shared.nkCommonInstance.writeLog("[ERROR] Could not write to database: \(error)") } } @@ -1179,7 +1179,7 @@ extension NCManageDatabase { let results = realm.objects(tableMetadata.self).filter(predicate).sorted(byKeyPath: "date", ascending: false) return ThreadSafeArray(results.map { tableMetadata.init(value: $0) }) } catch let error as NSError { - NextcloudKit.shared.nkCommonInstance.writeLog("Could not access database: \(error)") + NextcloudKit.shared.nkCommonInstance.writeLog("[ERROR] Could not access database: \(error)") } return nil diff --git a/iOSClient/Data/NCManageDatabase+PhotoLibrary.swift b/iOSClient/Data/NCManageDatabase+PhotoLibrary.swift index b830d48a9d..5ea775ffd9 100644 --- a/iOSClient/Data/NCManageDatabase+PhotoLibrary.swift +++ b/iOSClient/Data/NCManageDatabase+PhotoLibrary.swift @@ -65,7 +65,7 @@ extension NCManageDatabase { } } } catch let error { - NextcloudKit.shared.nkCommonInstance.writeLog("Could not write to database: \(error)") + NextcloudKit.shared.nkCommonInstance.writeLog("[ERROR] Could not write to database: \(error)") return false } @@ -91,7 +91,7 @@ extension NCManageDatabase { let idsAsset = results.map { $0.idAsset } return Array(idsAsset) } catch let error as NSError { - NextcloudKit.shared.nkCommonInstance.writeLog("Could not write to database: \(error)") + NextcloudKit.shared.nkCommonInstance.writeLog("[ERROR] Could not access to database: \(error)") } return nil diff --git a/iOSClient/Data/NCManageDatabase+SecurityGuard.swift b/iOSClient/Data/NCManageDatabase+SecurityGuard.swift index c89b6dd98a..fc4380a6f5 100644 --- a/iOSClient/Data/NCManageDatabase+SecurityGuard.swift +++ b/iOSClient/Data/NCManageDatabase+SecurityGuard.swift @@ -64,7 +64,7 @@ extension NCManageDatabase { } } } catch let error { - NextcloudKit.shared.nkCommonInstance.writeLog("Could not write to database: \(error)") + NextcloudKit.shared.nkCommonInstance.writeLog("[ERROR] Could not write to database: \(error)") } } @@ -77,7 +77,7 @@ extension NCManageDatabase { }) if !results.isEmpty { return true } } catch let error as NSError { - NextcloudKit.shared.nkCommonInstance.writeLog("Could not access database: \(error)") + NextcloudKit.shared.nkCommonInstance.writeLog("[ERROR] Could not access database: \(error)") } return false @@ -92,7 +92,7 @@ extension NCManageDatabase { }) return results } catch let error as NSError { - NextcloudKit.shared.nkCommonInstance.writeLog("Could not access database: \(error)") + NextcloudKit.shared.nkCommonInstance.writeLog("[ERROR] Could not access database: \(error)") } return nil @@ -111,7 +111,7 @@ extension NCManageDatabase { } } } catch let error { - NextcloudKit.shared.nkCommonInstance.writeLog("Could not write to database: \(error)") + NextcloudKit.shared.nkCommonInstance.writeLog("[ERROR] Could not write to database: \(error)") } } } diff --git a/iOSClient/Data/NCManageDatabase+Share.swift b/iOSClient/Data/NCManageDatabase+Share.swift index 592082cb84..14ebc82f5d 100644 --- a/iOSClient/Data/NCManageDatabase+Share.swift +++ b/iOSClient/Data/NCManageDatabase+Share.swift @@ -131,7 +131,7 @@ extension NCManageDatabase { } } } catch let error { - NextcloudKit.shared.nkCommonInstance.writeLog("Could not write to database: \(error)") + NextcloudKit.shared.nkCommonInstance.writeLog("[ERROR] Could not write to database: \(error)") } } @@ -144,7 +144,7 @@ extension NCManageDatabase { let results = realm.objects(tableShare.self).filter("account == %@", account).sorted(by: sortProperties) return Array(results.map { tableShare.init(value: $0) }) } catch let error as NSError { - NextcloudKit.shared.nkCommonInstance.writeLog("Could not access database: \(error)") + NextcloudKit.shared.nkCommonInstance.writeLog("[ERROR] Could not access database: \(error)") } return [] @@ -165,7 +165,7 @@ extension NCManageDatabase { return(firstShareLink: firstShareLink, share: Array(results.map { tableShare.init(value: $0) })) } } catch let error as NSError { - NextcloudKit.shared.nkCommonInstance.writeLog("Could not access database: \(error)") + NextcloudKit.shared.nkCommonInstance.writeLog("[ERROR] Could not access database: \(error)") } return (nil, nil) @@ -179,7 +179,7 @@ extension NCManageDatabase { guard let result = realm.objects(tableShare.self).filter("account = %@ AND idShare = %d", account, idShare).first else { return nil } return tableShare.init(value: result) } catch let error as NSError { - NextcloudKit.shared.nkCommonInstance.writeLog("Could not access database: \(error)") + NextcloudKit.shared.nkCommonInstance.writeLog("[ERROR] Could not access database: \(error)") } return nil @@ -194,7 +194,7 @@ extension NCManageDatabase { let results = realm.objects(tableShare.self).filter("account == %@ AND serverUrl == %@", account, serverUrl).sorted(by: sortProperties) return Array(results.map { tableShare.init(value: $0) }) } catch let error as NSError { - NextcloudKit.shared.nkCommonInstance.writeLog("Could not access database: \(error)") + NextcloudKit.shared.nkCommonInstance.writeLog("[ERROR] Could not access database: \(error)") } return [] @@ -209,7 +209,7 @@ extension NCManageDatabase { let results = realm.objects(tableShare.self).filter("account == %@ AND serverUrl == %@ AND fileName == %@", account, serverUrl, fileName).sorted(by: sortProperties) return Array(results.map { tableShare.init(value: $0) }) } catch let error as NSError { - NextcloudKit.shared.nkCommonInstance.writeLog("Could not access database: \(error)") + NextcloudKit.shared.nkCommonInstance.writeLog("[ERROR] Could not access database: \(error)") } return [] @@ -224,7 +224,7 @@ extension NCManageDatabase { realm.delete(result) } } catch let error as NSError { - NextcloudKit.shared.nkCommonInstance.writeLog("Could not write to database: \(error)") + NextcloudKit.shared.nkCommonInstance.writeLog("[ERROR] Could not write to database: \(error)") } } @@ -237,7 +237,7 @@ extension NCManageDatabase { realm.delete(result) } } catch let error as NSError { - NextcloudKit.shared.nkCommonInstance.writeLog("Could not write to database: \(error)") + NextcloudKit.shared.nkCommonInstance.writeLog("[ERROR] Could not write to database: \(error)") } } @@ -250,7 +250,7 @@ extension NCManageDatabase { realm.delete(result) } } catch let error as NSError { - NextcloudKit.shared.nkCommonInstance.writeLog("Could not write to database: \(error)") + NextcloudKit.shared.nkCommonInstance.writeLog("[ERROR] Could not write to database: \(error)") } } diff --git a/iOSClient/Data/NCManageDatabase+Tag.swift b/iOSClient/Data/NCManageDatabase+Tag.swift index e939d49292..51f05476c5 100644 --- a/iOSClient/Data/NCManageDatabase+Tag.swift +++ b/iOSClient/Data/NCManageDatabase+Tag.swift @@ -50,7 +50,7 @@ extension NCManageDatabase { realm.add(addObject, update: .all) } } catch let error { - NextcloudKit.shared.nkCommonInstance.writeLog("Could not write to database: \(error)") + NextcloudKit.shared.nkCommonInstance.writeLog("[ERROR] Could not write to database: \(error)") } } @@ -63,7 +63,7 @@ extension NCManageDatabase { realm.delete(results) } } catch let error { - NextcloudKit.shared.nkCommonInstance.writeLog("Could not write to database: \(error)") + NextcloudKit.shared.nkCommonInstance.writeLog("[ERROR] Could not write to database: \(error)") } } @@ -75,7 +75,7 @@ extension NCManageDatabase { let results = realm.objects(tableTag.self).filter(predicate) return Array(results.map { tableTag.init(value: $0) }) } catch let error as NSError { - NextcloudKit.shared.nkCommonInstance.writeLog("Could not write to database: \(error)") + NextcloudKit.shared.nkCommonInstance.writeLog("[ERROR] Could not access to database: \(error)") } return [] @@ -89,7 +89,7 @@ extension NCManageDatabase { guard let result = realm.objects(tableTag.self).filter(predicate).first else { return nil } return tableTag.init(value: result) } catch let error as NSError { - NextcloudKit.shared.nkCommonInstance.writeLog("Could not write to database: \(error)") + NextcloudKit.shared.nkCommonInstance.writeLog("[ERROR] Could not acess to database: \(error)") } return nil diff --git a/iOSClient/Data/NCManageDatabase+Tip.swift b/iOSClient/Data/NCManageDatabase+Tip.swift index e9f2a60253..6c9b7db34c 100644 --- a/iOSClient/Data/NCManageDatabase+Tip.swift +++ b/iOSClient/Data/NCManageDatabase+Tip.swift @@ -42,7 +42,7 @@ extension NCManageDatabase { return true } } catch let error as NSError { - NextcloudKit.shared.nkCommonInstance.writeLog("Could not write to database: \(error)") + NextcloudKit.shared.nkCommonInstance.writeLog("[ERROR] Could not access to database: \(error)") } return false @@ -58,7 +58,7 @@ extension NCManageDatabase { realm.add(addObject, update: .all) } } catch let error { - NextcloudKit.shared.nkCommonInstance.writeLog("Could not write to database: \(error)") + NextcloudKit.shared.nkCommonInstance.writeLog("[ERROR] Could not write to database: \(error)") } } } diff --git a/iOSClient/Data/NCManageDatabase+Trash.swift b/iOSClient/Data/NCManageDatabase+Trash.swift index d13e5ee1aa..2bd2a014c6 100644 --- a/iOSClient/Data/NCManageDatabase+Trash.swift +++ b/iOSClient/Data/NCManageDatabase+Trash.swift @@ -74,7 +74,7 @@ extension NCManageDatabase { } } } catch let error { - NextcloudKit.shared.nkCommonInstance.writeLog("Could not write to database: \(error)") + NextcloudKit.shared.nkCommonInstance.writeLog("[ERROR] Could not write to database: \(error)") } } @@ -94,7 +94,7 @@ extension NCManageDatabase { realm.delete(result) } } catch let error { - NextcloudKit.shared.nkCommonInstance.writeLog("Could not write to database: \(error)") + NextcloudKit.shared.nkCommonInstance.writeLog("[ERROR] Could not write to database: \(error)") } } @@ -114,11 +114,11 @@ extension NCManageDatabase { realm.delete(result) } } catch let error { - NextcloudKit.shared.nkCommonInstance.writeLog("Could not write to database: \(error)") + NextcloudKit.shared.nkCommonInstance.writeLog("[ERROR] Could not write to database: \(error)") } } - func getTrash(filePath: String, sort: String?, ascending: Bool?, account: String) -> [tableTrash]? { + func getTrash(filePath: String, sort: String?, ascending: Bool?, account: String) -> [tableTrash] { let sort = sort ?? "date" let ascending = ascending ?? false @@ -129,10 +129,10 @@ extension NCManageDatabase { let results = realm.objects(tableTrash.self).filter("account == %@ AND filePath == %@", account, filePath).sorted(byKeyPath: sort, ascending: ascending) return Array(results.map { tableTrash.init(value: $0) }) } catch let error as NSError { - NextcloudKit.shared.nkCommonInstance.writeLog("Could not write to database: \(error)") + NextcloudKit.shared.nkCommonInstance.writeLog("[ERROR] Could not access to database: \(error)") } - return nil + return [] } func getTrashItem(fileId: String, account: String) -> tableTrash? { @@ -143,7 +143,7 @@ extension NCManageDatabase { guard let result = realm.objects(tableTrash.self).filter("account == %@ AND fileId == %@", account, fileId).first else { return nil } return tableTrash.init(value: result) } catch let error as NSError { - NextcloudKit.shared.nkCommonInstance.writeLog("Could not write to database: \(error)") + NextcloudKit.shared.nkCommonInstance.writeLog("[ERROR] Could not access to database: \(error)") } return nil diff --git a/iOSClient/Data/NCManageDatabase+UserStatus.swift b/iOSClient/Data/NCManageDatabase+UserStatus.swift index 70254d54f0..0aeceb9c47 100644 --- a/iOSClient/Data/NCManageDatabase+UserStatus.swift +++ b/iOSClient/Data/NCManageDatabase+UserStatus.swift @@ -64,7 +64,7 @@ extension NCManageDatabase { } } } catch let error { - NextcloudKit.shared.nkCommonInstance.writeLog("Could not write to database: \(error)") + NextcloudKit.shared.nkCommonInstance.writeLog("[ERROR] Could not write to database: \(error)") } } } diff --git a/iOSClient/Data/NCManageDatabase+Video.swift b/iOSClient/Data/NCManageDatabase+Video.swift index 52edf2fac0..65f15dac29 100644 --- a/iOSClient/Data/NCManageDatabase+Video.swift +++ b/iOSClient/Data/NCManageDatabase+Video.swift @@ -99,7 +99,7 @@ extension NCManageDatabase { } } } catch let error { - NextcloudKit.shared.nkCommonInstance.writeLog("Could not write to database: \(error)") + NextcloudKit.shared.nkCommonInstance.writeLog("[ERROR] Could not write to database: \(error)") } } @@ -130,7 +130,7 @@ extension NCManageDatabase { } } } catch let error { - NextcloudKit.shared.nkCommonInstance.writeLog("Could not write to database: \(error)") + NextcloudKit.shared.nkCommonInstance.writeLog("[ERROR] Could not write to database: \(error)") } } @@ -144,7 +144,7 @@ extension NCManageDatabase { guard let result = realm.objects(tableVideo.self).filter("account == %@ AND ocId == %@", metadata.account, metadata.ocId).first else { return nil } return tableVideo.init(value: result) } catch let error as NSError { - NextcloudKit.shared.nkCommonInstance.writeLog("Could not access database: \(error)") + NextcloudKit.shared.nkCommonInstance.writeLog("[ERROR] Could not access database: \(error)") } return nil @@ -160,7 +160,7 @@ extension NCManageDatabase { } } } catch let error { - NextcloudKit.shared.nkCommonInstance.writeLog("Could not write to database: \(error)") + NextcloudKit.shared.nkCommonInstance.writeLog("[ERROR] Could not write to database: \(error)") } } } diff --git a/iOSClient/Data/NCManageDatabase.swift b/iOSClient/Data/NCManageDatabase.swift index f031eb118a..1d7873053a 100644 --- a/iOSClient/Data/NCManageDatabase.swift +++ b/iOSClient/Data/NCManageDatabase.swift @@ -51,9 +51,9 @@ class NCManageDatabase: NSObject { if let databaseFilePath = databaseFileUrlPath?.path { if FileManager.default.fileExists(atPath: databaseFilePath) { - NextcloudKit.shared.nkCommonInstance.writeLog("DATABASE FOUND in " + databaseFilePath) + NextcloudKit.shared.nkCommonInstance.writeLog("[INFO] DATABASE FOUND in " + databaseFilePath) } else { - NextcloudKit.shared.nkCommonInstance.writeLog("DATABASE NOT FOUND in " + databaseFilePath) + NextcloudKit.shared.nkCommonInstance.writeLog("[INFO] DATABASE NOT FOUND in " + databaseFilePath) } } @@ -148,7 +148,7 @@ class NCManageDatabase: NSObject { let nkError = NKError(errorCode: NCGlobal.shared.errorInternalError, errorDescription: error.localizedDescription) NCContentPresenter().showError(error: nkError, priority: .max) #endif - NextcloudKit.shared.nkCommonInstance.writeLog("DATABASE ERROR: \(error.localizedDescription)") + NextcloudKit.shared.nkCommonInstance.writeLog("[ERROR] DATABASE ERROR: \(error.localizedDescription)") try FileManager.default.removeItem(at: databaseFileUrlPath) } catch {} } @@ -170,7 +170,7 @@ class NCManageDatabase: NSObject { let nkError = NKError(errorCode: NCGlobal.shared.errorInternalError, errorDescription: error.localizedDescription) NCContentPresenter().showError(error: nkError, priority: .max) #endif - NextcloudKit.shared.nkCommonInstance.writeLog("DATABASE ERROR: \(error.localizedDescription)") + NextcloudKit.shared.nkCommonInstance.writeLog("[ERROR] DATABASE ERROR: \(error.localizedDescription)") try FileManager.default.removeItem(at: databaseFileUrlPath) } catch { } } @@ -179,7 +179,7 @@ class NCManageDatabase: NSObject { do { _ = try Realm() } catch let error as NSError { - NextcloudKit.shared.nkCommonInstance.writeLog("Could not open database: \(error)") + NextcloudKit.shared.nkCommonInstance.writeLog("[ERROR] Could not open database: \(error)") } } @@ -202,7 +202,7 @@ class NCManageDatabase: NSObject { realm.delete(results) } } catch let error { - NextcloudKit.shared.nkCommonInstance.writeLog("Could not write to database: \(error)") + NextcloudKit.shared.nkCommonInstance.writeLog("[ERROR] Could not write to database: \(error)") } } @@ -266,7 +266,7 @@ class NCManageDatabase: NSObject { do { try FileManager.default.removeItem(at: URL) } catch let error { - NextcloudKit.shared.nkCommonInstance.writeLog("Could not write to database: \(error)") + NextcloudKit.shared.nkCommonInstance.writeLog("[ERROR] Could not write to database: \(error)") } } } @@ -282,7 +282,7 @@ class NCManageDatabase: NSObject { let realm = try Realm() return realm.resolve(tableRef) } catch let error as NSError { - NextcloudKit.shared.nkCommonInstance.writeLog("Could not write to database: \(error)") + NextcloudKit.shared.nkCommonInstance.writeLog("[ERROR] Could not write to database: \(error)") } return nil diff --git a/iOSClient/Extensions/UIAlertController+Extension.swift b/iOSClient/Extensions/UIAlertController+Extension.swift index 4b97d1c621..c885a75d23 100644 --- a/iOSClient/Extensions/UIAlertController+Extension.swift +++ b/iOSClient/Extensions/UIAlertController+Extension.swift @@ -103,7 +103,7 @@ extension UIAlertController { }, completion: completion) } - static func deleteFileOrFolder(titleString: String, message: String?, canDeleteServer: Bool, selectedMetadatas: [tableMetadata], indexPaths: [IndexPath], completion: @escaping (_ cancelled: Bool) -> Void) -> UIAlertController { + static func deleteFileOrFolder(titleString: String, message: String?, canDeleteServer: Bool, selectedMetadatas: [tableMetadata], completion: @escaping (_ cancelled: Bool) -> Void) -> UIAlertController { let alertController = UIAlertController( title: titleString, message: message, @@ -119,7 +119,7 @@ extension UIAlertController { ocId.append(metadata.ocId) } } - NotificationCenter.default.postOnMainThread(name: NCGlobal.shared.notificationCenterDeleteFile, userInfo: ["ocId": ocId, "indexPath": indexPaths, "onlyLocalCache": false, "error": error]) + NotificationCenter.default.postOnMainThread(name: NCGlobal.shared.notificationCenterDeleteFile, userInfo: ["ocId": ocId, "onlyLocalCache": false, "error": error]) } completion(false) }) @@ -138,7 +138,7 @@ extension UIAlertController { if error != .success { NCContentPresenter().showError(error: error) } - NotificationCenter.default.postOnMainThread(name: NCGlobal.shared.notificationCenterDeleteFile, userInfo: ["ocId": ocId, "indexPath": indexPaths, "onlyLocalCache": true, "error": error]) + NotificationCenter.default.postOnMainThread(name: NCGlobal.shared.notificationCenterDeleteFile, userInfo: ["ocId": ocId, "onlyLocalCache": true, "error": error]) } completion(false) }) diff --git a/iOSClient/Extensions/UIColor+Extension.swift b/iOSClient/Extensions/UIColor+Extension.swift index bfd8f49539..8065308de4 100644 --- a/iOSClient/Extensions/UIColor+Extension.swift +++ b/iOSClient/Extensions/UIColor+Extension.swift @@ -30,7 +30,7 @@ extension UIColor { self.getRed(&r, green: &g, blue: &b, alpha: &a) return UIColor(red: (1 - r), green: (1 - g), blue: (1 - b), alpha: a) // Assuming you want the same alpha value. } - + var hexString: String { let cgColorInRGB = cgColor.converted(to: CGColorSpace(name: CGColorSpace.sRGB)!, intent: .defaultIntent, options: nil)! diff --git a/iOSClient/Files/NCFiles.swift b/iOSClient/Files/NCFiles.swift index 1f48b8f699..7caffea914 100644 --- a/iOSClient/Files/NCFiles.swift +++ b/iOSClient/Files/NCFiles.swift @@ -59,7 +59,6 @@ class NCFiles: NCCollectionViewCommon { self.isSearchingMode = false self.isEditMode = false self.selectOcId.removeAll() - self.selectIndexPaths.removeAll() self.layoutForView = NCManageDatabase.shared.getLayoutForView(account: self.appDelegate.account, key: self.layoutKey, serverUrl: self.serverUrl) self.gridLayout.itemForLine = CGFloat(self.layoutForView?.itemForLine ?? 3) @@ -92,8 +91,8 @@ class NCFiles: NCCollectionViewCommon { reloadDataSourceNetwork() } - override func viewWillDisappear(_ animated: Bool) { - super.viewWillDisappear(animated) + override func viewDidDisappear(_ animated: Bool) { + super.viewDidDisappear(animated) fileNameBlink = nil fileNameOpen = nil diff --git a/iOSClient/Login/NCLoginWeb.swift b/iOSClient/Login/NCLoginWeb.swift index 8ced23e0ff..d33875acb9 100644 --- a/iOSClient/Login/NCLoginWeb.swift +++ b/iOSClient/Login/NCLoginWeb.swift @@ -152,16 +152,9 @@ class NCLoginWeb: UIViewController { } } - override func viewWillDisappear(_ animated: Bool) { - super.viewWillDisappear(animated) - - NCActivityIndicator.shared.stop() - } - override func viewDidDisappear(_ animated: Bool) { super.viewDidDisappear(animated) - - // Start timer error network + NCActivityIndicator.shared.stop() appDelegate.startTimerErrorNetworking() } diff --git a/iOSClient/Main/Collection Common/NCCollectionViewCommon+SelectTabBarDelegate.swift b/iOSClient/Main/Collection Common/NCCollectionViewCommon+SelectTabBarDelegate.swift index cf1ea50da0..03b5f8ce67 100644 --- a/iOSClient/Main/Collection Common/NCCollectionViewCommon+SelectTabBarDelegate.swift +++ b/iOSClient/Main/Collection Common/NCCollectionViewCommon+SelectTabBarDelegate.swift @@ -24,86 +24,7 @@ import Foundation import NextcloudKit -extension NCCollectionViewCommon: NCSelectableNavigationView, NCCollectionViewCommonSelectTabBarDelegate { - func setNavigationRightItems(enableMenu: Bool = false) { - if layoutKey == NCGlobal.shared.layoutViewTransfers { return } - - var selectedMetadatas: [tableMetadata] = [] - var isAnyOffline = false - var isAnyDirectory = false - var isAllDirectory = true - var isAnyLocked = false - var canUnlock = true - var canSetAsOffline = true - let isTabBarHidden = self.tabBarController?.tabBar.isHidden - - for ocId in selectOcId { - guard let metadata = NCManageDatabase.shared.getMetadataFromOcId(ocId) else { continue } - selectedMetadatas.append(metadata) - - if metadata.directory { - isAnyDirectory = true - } else { - isAllDirectory = false - } - - if !metadata.canSetAsAvailableOffline { - canSetAsOffline = false - } - - if metadata.lock { - isAnyLocked = true - if metadata.lockOwner != appDelegate.userId { - canUnlock = false - } - } - - guard !isAnyOffline else { continue } - - if metadata.directory, - let directory = NCManageDatabase.shared.getTableDirectory(predicate: NSPredicate(format: "account == %@ AND serverUrl == %@", appDelegate.account, metadata.serverUrl + "/" + metadata.fileName)) { - isAnyOffline = directory.offline - } else if let localFile = NCManageDatabase.shared.getTableLocalFile(predicate: NSPredicate(format: "ocId == %@", metadata.ocId)) { - isAnyOffline = localFile.offline - } // else: file is not offline, continue - } - - guard let tabBarSelect = tabBarSelect as? NCCollectionViewCommonSelectTabBar else { return } - - tabBarSelect.isAnyOffline = isAnyOffline - tabBarSelect.canSetAsOffline = canSetAsOffline - tabBarSelect.isAnyDirectory = isAnyDirectory - tabBarSelect.isAllDirectory = isAllDirectory - tabBarSelect.isAnyLocked = isAnyLocked - tabBarSelect.canUnlock = canUnlock - tabBarSelect.enableLock = !isAnyDirectory && canUnlock && !NCGlobal.shared.capabilityFilesLockVersion.isEmpty - tabBarSelect.isSelectedEmpty = selectOcId.isEmpty - tabBarSelect.selectedMetadatas = selectedMetadatas - - if isEditMode { - tabBarSelect.show() - let select = UIBarButtonItem(title: NSLocalizedString("_cancel_", comment: ""), style: .done) { self.toggleSelect() } - navigationItem.rightBarButtonItems = [select] - } else { - tabBarSelect.hide() - if navigationItem.rightBarButtonItems == nil || enableMenu { - let menuButton = UIBarButtonItem(image: .init(systemName: "ellipsis.circle"), menu: UIMenu(children: createMenuActions())) - if layoutKey == NCGlobal.shared.layoutViewFiles { - let notification = UIBarButtonItem(image: .init(systemName: "bell"), style: .plain, action: tapNotification) - navigationItem.rightBarButtonItems = [menuButton, notification] - } else { - navigationItem.rightBarButtonItems = [menuButton] - } - } else { - navigationItem.rightBarButtonItems?.first?.menu = navigationItem.rightBarButtonItems?.first?.menu?.replacingChildren(createMenuActions()) - } - } - // fix, if the tabbar was hidden before the update, set hidden - if let isTabBarHidden, isTabBarHidden { - self.tabBarController?.tabBar.isHidden = true - } - } - +extension NCCollectionViewCommon: NCCollectionViewCommonSelectTabBarDelegate { func onListSelected() { if layoutForView?.layout == NCGlobal.shared.layoutGrid { layoutForView?.layout = NCGlobal.shared.layoutList @@ -139,19 +60,25 @@ extension NCCollectionViewCommon: NCSelectableNavigationView, NCCollectionViewCo } func selectAll() { - collectionViewSelectAll() + if !selectOcId.isEmpty, dataSource.getMetadataSourceForAllSections().count == selectOcId.count { + selectOcId = [] + } else { + selectOcId = dataSource.getMetadataSourceForAllSections().compactMap({ $0.ocId }) + } + tabBarSelect.update(selectOcId: selectOcId, metadatas: getSelectedMetadatas(), userId: appDelegate.userId) + collectionView.reloadData() } - func delete(selectedMetadatas: [tableMetadata]) { + func delete() { let alertController = UIAlertController( title: NSLocalizedString("_confirm_delete_selected_", comment: ""), message: nil, preferredStyle: .alert) - - let canDeleteServer = selectedMetadatas.allSatisfy { !$0.lock } + let metadatas = getSelectedMetadatas() + let canDeleteServer = metadatas.allSatisfy { !$0.lock } if canDeleteServer { - let copyMetadatas = selectedMetadatas + let copyMetadatas = metadatas alertController.addAction(UIAlertAction(title: NSLocalizedString("_yes_", comment: ""), style: .destructive) { _ in Task { @@ -163,15 +90,14 @@ extension NCCollectionViewCommon: NCSelectableNavigationView, NCCollectionViewCo ocId.append(metadata.ocId) } } - NotificationCenter.default.postOnMainThread(name: NCGlobal.shared.notificationCenterDeleteFile, userInfo: ["ocId": ocId, "indexPath": self.selectIndexPaths, "onlyLocalCache": false, "error": error]) + NotificationCenter.default.postOnMainThread(name: NCGlobal.shared.notificationCenterDeleteFile, userInfo: ["ocId": ocId, "onlyLocalCache": false, "error": error]) } - - self.toggleSelect() + self.setEditMode(false) }) } alertController.addAction(UIAlertAction(title: NSLocalizedString("_remove_local_file_", comment: ""), style: .default) { (_: UIAlertAction) in - let copyMetadatas = selectedMetadatas + let copyMetadatas = metadatas Task { var error = NKError() @@ -185,129 +111,73 @@ extension NCCollectionViewCommon: NCSelectableNavigationView, NCCollectionViewCo if error != .success { NCContentPresenter().showError(error: error) } - NotificationCenter.default.postOnMainThread(name: NCGlobal.shared.notificationCenterDeleteFile, userInfo: ["ocId": ocId, "indexPath": self.selectIndexPaths, "onlyLocalCache": true, "error": error]) - self.toggleSelect() + NotificationCenter.default.postOnMainThread(name: NCGlobal.shared.notificationCenterDeleteFile, userInfo: ["ocId": ocId, "onlyLocalCache": true, "error": error]) + self.setEditMode(false) } }) alertController.addAction(UIAlertAction(title: NSLocalizedString("_cancel_", comment: ""), style: .cancel) { (_: UIAlertAction) in }) - self.viewController.present(alertController, animated: true, completion: nil) + self.present(alertController, animated: true, completion: nil) } - func move(selectedMetadatas: [tableMetadata]) { - NCActionCenter.shared.openSelectView(items: selectedMetadatas, indexPath: self.selectIndexPaths) - self.toggleSelect() + func move() { + let metadatas = getSelectedMetadatas() + NCActionCenter.shared.openSelectView(items: metadatas) + setEditMode(false) } - func share(selectedMetadatas: [tableMetadata]) { - NCActionCenter.shared.openActivityViewController(selectedMetadata: selectedMetadatas) - self.toggleSelect() + func share() { + let metadatas = getSelectedMetadatas() + NCActionCenter.shared.openActivityViewController(selectedMetadata: metadatas) + setEditMode(false) } - func saveAsAvailableOffline(selectedMetadatas: [tableMetadata], isAnyOffline: Bool) { - if !isAnyOffline, selectedMetadatas.count > 3 { + func saveAsAvailableOffline(isAnyOffline: Bool) { + let metadatas = getSelectedMetadatas() + if !isAnyOffline, metadatas.count > 3 { let alert = UIAlertController( title: NSLocalizedString("_set_available_offline_", comment: ""), message: NSLocalizedString("_select_offline_warning_", comment: ""), preferredStyle: .alert) alert.addAction(UIAlertAction(title: NSLocalizedString("_continue_", comment: ""), style: .default, handler: { _ in - selectedMetadatas.forEach { NCActionCenter.shared.setMetadataAvalableOffline($0, isOffline: isAnyOffline) } - self.toggleSelect() + metadatas.forEach { NCActionCenter.shared.setMetadataAvalableOffline($0, isOffline: isAnyOffline) } + self.setEditMode(false) })) alert.addAction(UIAlertAction(title: NSLocalizedString("_cancel_", comment: ""), style: .cancel)) - self.viewController.present(alert, animated: true) + self.present(alert, animated: true) } else { - selectedMetadatas.forEach { NCActionCenter.shared.setMetadataAvalableOffline($0, isOffline: isAnyOffline) } - self.toggleSelect() + metadatas.forEach { NCActionCenter.shared.setMetadataAvalableOffline($0, isOffline: isAnyOffline) } + setEditMode(false) } } - func lock(selectedMetadatas: [tableMetadata], isAnyLocked: Bool) { - for metadata in selectedMetadatas where metadata.lock == isAnyLocked { + func lock(isAnyLocked: Bool) { + let metadatas = getSelectedMetadatas() + for metadata in metadatas where metadata.lock == isAnyLocked { NCNetworking.shared.lockUnlockFile(metadata, shoulLock: !isAnyLocked) } - - self.toggleSelect() + setEditMode(false) } - func createMenuActions() -> [UIMenuElement] { - guard let layoutForView = NCManageDatabase.shared.getLayoutForView(account: appDelegate.account, key: layoutKey, serverUrl: serverUrl) else { return [] } - - let select = UIAction(title: NSLocalizedString("_select_", comment: ""), image: .init(systemName: "checkmark.circle"), attributes: selectableDataSource.isEmpty ? .disabled : []) { _ in self.toggleSelect() } - - let list = UIAction(title: NSLocalizedString("_list_", comment: ""), image: .init(systemName: "list.bullet"), state: layoutForView.layout == NCGlobal.shared.layoutList ? .on : .off) { _ in - self.onListSelected() - self.setNavigationRightItems() - } - - let grid = UIAction(title: NSLocalizedString("_icons_", comment: ""), image: .init(systemName: "square.grid.2x2"), state: layoutForView.layout == NCGlobal.shared.layoutGrid ? .on : .off) { _ in - self.onGridSelected() - self.setNavigationRightItems() - } - - let viewStyleSubmenu = UIMenu(title: "", options: .displayInline, children: [list, grid]) - - let ascending = layoutForView.ascending - let ascendingChevronImage = UIImage(systemName: ascending ? "chevron.up" : "chevron.down") - let isName = layoutForView.sort == "fileName" - let isDate = layoutForView.sort == "date" - let isSize = layoutForView.sort == "size" - - let byName = UIAction(title: NSLocalizedString("_name_", comment: ""), image: isName ? ascendingChevronImage : nil, state: isName ? .on : .off) { _ in - if isName { // repeated press - layoutForView.ascending = !layoutForView.ascending - } - layoutForView.sort = "fileName" - self.saveLayout(layoutForView) - } - - let byNewest = UIAction(title: NSLocalizedString("_date_", comment: ""), image: isDate ? ascendingChevronImage : nil, state: isDate ? .on : .off) { _ in - if isDate { // repeated press - layoutForView.ascending = !layoutForView.ascending - } - layoutForView.sort = "date" - self.saveLayout(layoutForView) - } - - let byLargest = UIAction(title: NSLocalizedString("_size_", comment: ""), image: isSize ? ascendingChevronImage : nil, state: isSize ? .on : .off) { _ in - if isSize { // repeated press - layoutForView.ascending = !layoutForView.ascending - } - layoutForView.sort = "size" - self.saveLayout(layoutForView) - } - - let sortSubmenu = UIMenu(title: NSLocalizedString("_order_by_", comment: ""), options: .displayInline, children: [byName, byNewest, byLargest]) - - let foldersOnTop = UIAction(title: NSLocalizedString("_directory_on_top_no_", comment: ""), image: UIImage(systemName: "folder"), state: layoutForView.directoryOnTop ? .on : .off) { _ in - layoutForView.directoryOnTop = !layoutForView.directoryOnTop - self.saveLayout(layoutForView) - } - - let personalFilesOnly = NCKeychain().getPersonalFilesOnly(account: appDelegate.account) - let personalFilesOnlyAction = UIAction(title: NSLocalizedString("_personal_files_only_", comment: ""), image: UIImage(systemName: "folder.badge.person.crop"), state: personalFilesOnly ? .on : .off) { _ in - NCKeychain().setPersonalFilesOnly(account: self.appDelegate.account, value: !personalFilesOnly) - self.reloadDataSource() - } + func saveLayout(_ layoutForView: NCDBLayoutForView) { + NCManageDatabase.shared.setLayoutForView(layoutForView: layoutForView) + NotificationCenter.default.postOnMainThread(name: NCGlobal.shared.notificationCenterReloadDataSource) + setNavigationRightItems(enableMenu: false) + } - let showDescriptionKeychain = NCKeychain().showDescription - let showDescription = UIAction(title: NSLocalizedString("_show_description_", comment: ""), image: UIImage(systemName: "list.dash.header.rectangle"), attributes: richWorkspaceText == nil ? .disabled : [], state: showDescriptionKeychain && richWorkspaceText != nil ? .on : .off) { _ in - NCKeychain().showDescription = !showDescriptionKeychain - self.collectionView.reloadData() - self.setNavigationRightItems() + func getSelectedMetadatas() -> [tableMetadata] { + var selectedMetadatas: [tableMetadata] = [] + for ocId in selectOcId { + guard let metadata = NCManageDatabase.shared.getMetadataFromOcId(ocId) else { continue } + selectedMetadatas.append(metadata) } - showDescription.subtitle = richWorkspaceText == nil ? NSLocalizedString("_no_description_available_", comment: "") : "" + return selectedMetadatas + } - if layoutKey == NCGlobal.shared.layoutViewRecent { - return [select] - } else { - var additionalSubmenu = UIMenu() - if layoutKey == NCGlobal.shared.layoutViewFiles { - additionalSubmenu = UIMenu(title: "", options: .displayInline, children: [foldersOnTop, personalFilesOnlyAction, showDescription]) - } else { - additionalSubmenu = UIMenu(title: "", options: .displayInline, children: [foldersOnTop, showDescription]) - } - return [select, viewStyleSubmenu, sortSubmenu, additionalSubmenu] - } + func setEditMode(_ editMode: Bool) { + isEditMode = editMode + selectOcId.removeAll() + setNavigationRightItems(enableMenu: !editMode) + collectionView.reloadData() } } diff --git a/iOSClient/Main/Collection Common/NCCollectionViewCommon.swift b/iOSClient/Main/Collection Common/NCCollectionViewCommon.swift index 833f8f2d2f..4f083c26d0 100644 --- a/iOSClient/Main/Collection Common/NCCollectionViewCommon.swift +++ b/iOSClient/Main/Collection Common/NCCollectionViewCommon.swift @@ -34,7 +34,6 @@ class NCCollectionViewCommon: UIViewController, UIGestureRecognizerDelegate, UIS private var autoUploadFileName = "" private var autoUploadDirectory = "" - private var pushed: Bool = false private var tipView: EasyTipView? var isTransitioning: Bool = false @@ -48,14 +47,12 @@ class NCCollectionViewCommon: UIViewController, UIGestureRecognizerDelegate, UIS var serverUrl: String = "" var isEditMode = false var selectOcId: [String] = [] - var selectIndexPaths: [IndexPath] = [] var metadataFolder: tableMetadata? var dataSource = NCDataSource() var richWorkspaceText: String? var headerMenu: NCSectionHeaderMenu? var isSearchingMode: Bool = false var layoutForView: NCDBLayoutForView? - var selectableDataSource: [RealmSwiftObject] { dataSource.getMetadataSourceForAllSections() } var dataSourceTask: URLSessionTask? var groupByField = "name" var providers: [NKSearchProvider]? @@ -63,7 +60,7 @@ class NCCollectionViewCommon: UIViewController, UIGestureRecognizerDelegate, UIS var listLayout: NCListLayout! var gridLayout: NCGridLayout! var literalSearch: String? - var tabBarSelect: NCSelectableViewTabBar? + var tabBarSelect: NCCollectionViewCommonSelectTabBar! var timerNotificationCenter: Timer? var notificationReloadDataSource: Int = 0 @@ -94,7 +91,6 @@ class NCCollectionViewCommon: UIViewController, UIGestureRecognizerDelegate, UIS super.viewDidLoad() tabBarSelect = NCCollectionViewCommonSelectTabBar(tabBarController: tabBarController, delegate: self) - self.navigationController?.presentationController?.delegate = self // CollectionView & layout @@ -170,7 +166,19 @@ class NCCollectionViewCommon: UIViewController, UIGestureRecognizerDelegate, UIS override func viewWillAppear(_ animated: Bool) { super.viewWillAppear(animated) - appDelegate.activeViewController = self + navigationController?.setNavigationBarAppearance() + navigationController?.navigationBar.prefersLargeTitles = true + navigationController?.setNavigationBarHidden(false, animated: true) + navigationItem.title = titleCurrentFolder + + setNavigationLeftItems() + setNavigationRightItems() + + if serverUrl.isEmpty { + appDelegate.activeServerUrl = utilityFileSystem.getHomeServer(urlBase: appDelegate.urlBase, userId: appDelegate.userId) + } else { + appDelegate.activeServerUrl = serverUrl + } layoutForView = NCManageDatabase.shared.getLayoutForView(account: appDelegate.account, key: layoutKey, serverUrl: serverUrl) gridLayout.itemForLine = CGFloat(layoutForView?.itemForLine ?? 3) @@ -180,6 +188,16 @@ class NCCollectionViewCommon: UIViewController, UIGestureRecognizerDelegate, UIS collectionView?.collectionViewLayout = gridLayout } + // FIXME: iPAD PDF landscape mode iOS 16 + DispatchQueue.main.async { + self.collectionView?.collectionViewLayout.invalidateLayout() + } + } + + override func viewDidAppear(_ animated: Bool) { + super.viewDidAppear(animated) + appDelegate.activeViewController = self + timerNotificationCenter = Timer.scheduledTimer(timeInterval: 1.5, target: self, selector: #selector(notificationCenterEvents), userInfo: nil, repeats: true) NotificationCenter.default.addObserver(self, selector: #selector(applicationWillResignActive(_:)), name: NSNotification.Name(rawValue: NCGlobal.shared.notificationCenterApplicationWillResignActive), object: nil) @@ -207,29 +225,21 @@ class NCCollectionViewCommon: UIViewController, UIGestureRecognizerDelegate, UIS NotificationCenter.default.addObserver(self, selector: #selector(uploadCancelFile(_:)), name: NSNotification.Name(rawValue: NCGlobal.shared.notificationCenterUploadCancelFile), object: nil) NotificationCenter.default.addObserver(self, selector: #selector(triggerProgressTask(_:)), name: NSNotification.Name(rawValue: NCGlobal.shared.notificationCenterProgressTask), object: nil) - - if serverUrl.isEmpty { - appDelegate.activeServerUrl = utilityFileSystem.getHomeServer(urlBase: appDelegate.urlBase, userId: appDelegate.userId) - } else { - appDelegate.activeServerUrl = serverUrl - } - - navigationController?.navigationBar.prefersLargeTitles = true - navigationController?.setNavigationBarHidden(false, animated: true) - navigationController?.setNavigationBarAppearance() - - setNavigationLeftItems() - setNavigationRightItems() - - // FIXME: iPAD PDF landscape mode iOS 16 - DispatchQueue.main.async { - self.collectionView?.collectionViewLayout.invalidateLayout() - } } override func viewWillDisappear(_ animated: Bool) { super.viewWillDisappear(animated) + NCNetworking.shared.cancelUnifiedSearchFiles() + tipView?.dismiss() + setEditMode(false) + } + + override func viewDidDisappear(_ animated: Bool) { + super.viewDidDisappear(animated) + + timerNotificationCenter?.invalidate() + NotificationCenter.default.removeObserver(self, name: NSNotification.Name(rawValue: NCGlobal.shared.notificationCenterApplicationWillResignActive), object: nil) NotificationCenter.default.removeObserver(self, name: NSNotification.Name(rawValue: NCGlobal.shared.notificationCenterCloseRichWorkspaceWebView), object: nil) NotificationCenter.default.removeObserver(self, name: NSNotification.Name(rawValue: NCGlobal.shared.notificationCenterChangeStatusFolderE2EE), object: nil) @@ -255,17 +265,6 @@ class NCCollectionViewCommon: UIViewController, UIGestureRecognizerDelegate, UIS NotificationCenter.default.removeObserver(self, name: NSNotification.Name(rawValue: NCGlobal.shared.notificationCenterUploadCancelFile), object: nil) NotificationCenter.default.removeObserver(self, name: NSNotification.Name(rawValue: NCGlobal.shared.notificationCenterProgressTask), object: nil) - - timerNotificationCenter?.invalidate() - pushed = false - - // REQUEST - NCNetworking.shared.cancelUnifiedSearchFiles() - - // TIP - self.tipView?.dismiss() - - toggleSelect(isOn: false) } func presentationControllerDidDismiss( _ presentationController: UIPresentationController) { @@ -296,7 +295,7 @@ class NCCollectionViewCommon: UIViewController, UIGestureRecognizerDelegate, UIS super.viewWillLayoutSubviews() if let frame = tabBarController?.tabBar.frame { - (tabBarSelect as? NCCollectionViewCommonSelectTabBar)?.hostingController?.view.frame = frame + tabBarSelect.hostingController?.view.frame = frame } } @@ -597,8 +596,6 @@ class NCCollectionViewCommon: UIViewController, UIGestureRecognizerDelegate, UIS // MARK: - Layout func setNavigationLeftItems() { - navigationItem.title = titleCurrentFolder - guard layoutKey == NCGlobal.shared.layoutViewFiles else { return } // PROFILE BUTTON @@ -632,6 +629,7 @@ class NCCollectionViewCommon: UIViewController, UIGestureRecognizerDelegate, UIS let action = UIAction(title: name, image: image, state: account.active ? .on : .off) { _ in if !account.active { self.appDelegate.changeAccount(account.account, userProfile: nil) + self.setEditMode(false) } } @@ -666,6 +664,125 @@ class NCCollectionViewCommon: UIViewController, UIGestureRecognizerDelegate, UIS navigationItem.title = titleCurrentFolder } + func setNavigationRightItems(enableMenu: Bool = false) { + guard layoutKey != NCGlobal.shared.layoutViewTransfers else { return } + let isTabBarHidden = self.tabBarController?.tabBar.isHidden ?? true + let isTabBarSelectHidden = tabBarSelect.isHidden() + + func createMenuActions() -> [UIMenuElement] { + guard let layoutForView = NCManageDatabase.shared.getLayoutForView(account: appDelegate.account, key: layoutKey, serverUrl: serverUrl) else { return [] } + + let select = UIAction(title: NSLocalizedString("_select_", comment: ""), image: .init(systemName: "checkmark.circle"), attributes: self.dataSource.getMetadataSourceForAllSections().isEmpty ? .disabled : []) { _ in + self.setEditMode(true) + } + + let list = UIAction(title: NSLocalizedString("_list_", comment: ""), image: .init(systemName: "list.bullet"), state: layoutForView.layout == NCGlobal.shared.layoutList ? .on : .off) { _ in + self.onListSelected() + self.setNavigationRightItems() + } + + let grid = UIAction(title: NSLocalizedString("_icons_", comment: ""), image: .init(systemName: "square.grid.2x2"), state: layoutForView.layout == NCGlobal.shared.layoutGrid ? .on : .off) { _ in + self.onGridSelected() + self.setNavigationRightItems() + } + + let viewStyleSubmenu = UIMenu(title: "", options: .displayInline, children: [list, grid]) + + let ascending = layoutForView.ascending + let ascendingChevronImage = UIImage(systemName: ascending ? "chevron.up" : "chevron.down") + let isName = layoutForView.sort == "fileName" + let isDate = layoutForView.sort == "date" + let isSize = layoutForView.sort == "size" + + let byName = UIAction(title: NSLocalizedString("_name_", comment: ""), image: isName ? ascendingChevronImage : nil, state: isName ? .on : .off) { _ in + if isName { // repeated press + layoutForView.ascending = !layoutForView.ascending + } + layoutForView.sort = "fileName" + self.saveLayout(layoutForView) + } + + let byNewest = UIAction(title: NSLocalizedString("_date_", comment: ""), image: isDate ? ascendingChevronImage : nil, state: isDate ? .on : .off) { _ in + if isDate { // repeated press + layoutForView.ascending = !layoutForView.ascending + } + layoutForView.sort = "date" + self.saveLayout(layoutForView) + } + + let byLargest = UIAction(title: NSLocalizedString("_size_", comment: ""), image: isSize ? ascendingChevronImage : nil, state: isSize ? .on : .off) { _ in + if isSize { // repeated press + layoutForView.ascending = !layoutForView.ascending + } + layoutForView.sort = "size" + self.saveLayout(layoutForView) + } + + let sortSubmenu = UIMenu(title: NSLocalizedString("_order_by_", comment: ""), options: .displayInline, children: [byName, byNewest, byLargest]) + + let foldersOnTop = UIAction(title: NSLocalizedString("_directory_on_top_no_", comment: ""), image: UIImage(systemName: "folder"), state: layoutForView.directoryOnTop ? .on : .off) { _ in + layoutForView.directoryOnTop = !layoutForView.directoryOnTop + self.saveLayout(layoutForView) + } + + let personalFilesOnly = NCKeychain().getPersonalFilesOnly(account: appDelegate.account) + let personalFilesOnlyAction = UIAction(title: NSLocalizedString("_personal_files_only_", comment: ""), image: UIImage(systemName: "folder.badge.person.crop"), state: personalFilesOnly ? .on : .off) { _ in + NCKeychain().setPersonalFilesOnly(account: self.appDelegate.account, value: !personalFilesOnly) + self.reloadDataSource() + } + + let showDescriptionKeychain = NCKeychain().showDescription + let showDescription = UIAction(title: NSLocalizedString("_show_description_", comment: ""), image: UIImage(systemName: "list.dash.header.rectangle"), attributes: richWorkspaceText == nil ? .disabled : [], state: showDescriptionKeychain && richWorkspaceText != nil ? .on : .off) { _ in + NCKeychain().showDescription = !showDescriptionKeychain + self.collectionView.reloadData() + self.setNavigationRightItems() + } + showDescription.subtitle = richWorkspaceText == nil ? NSLocalizedString("_no_description_available_", comment: "") : "" + + if layoutKey == NCGlobal.shared.layoutViewRecent { + return [select] + } else { + var additionalSubmenu = UIMenu() + if layoutKey == NCGlobal.shared.layoutViewFiles { + additionalSubmenu = UIMenu(title: "", options: .displayInline, children: [foldersOnTop, personalFilesOnlyAction, showDescription]) + } else { + additionalSubmenu = UIMenu(title: "", options: .displayInline, children: [foldersOnTop, showDescription]) + } + return [select, viewStyleSubmenu, sortSubmenu, additionalSubmenu] + } + } + + if isEditMode { + tabBarSelect.update(selectOcId: selectOcId, metadatas: getSelectedMetadatas(), userId: appDelegate.userId) + tabBarSelect.show() + let select = UIBarButtonItem(title: NSLocalizedString("_cancel_", comment: ""), style: .done) { + self.setEditMode(false) + } + navigationItem.rightBarButtonItems = [select] + } else { + tabBarSelect.hide() + if navigationItem.rightBarButtonItems == nil || enableMenu { + let menuButton = UIBarButtonItem(image: .init(systemName: "ellipsis.circle"), menu: UIMenu(children: createMenuActions())) + if layoutKey == NCGlobal.shared.layoutViewFiles { + let notification = UIBarButtonItem(image: .init(systemName: "bell"), style: .plain) { + if let viewController = UIStoryboard(name: "NCNotification", bundle: nil).instantiateInitialViewController() as? NCNotification { + self.navigationController?.pushViewController(viewController, animated: true) + } + } + navigationItem.rightBarButtonItems = [menuButton, notification] + } else { + navigationItem.rightBarButtonItems = [menuButton] + } + } else { + navigationItem.rightBarButtonItems?.first?.menu = navigationItem.rightBarButtonItems?.first?.menu?.replacingChildren(createMenuActions()) + } + } + // fix, if the tabbar was hidden before the update, set it in hidden + if isTabBarHidden, isTabBarSelectHidden { + self.tabBarController?.tabBar.isHidden = true + } + } + func getNavigationTitle() -> String { let activeAccount = NCManageDatabase.shared.getActiveAccount() @@ -998,7 +1115,7 @@ class NCCollectionViewCommon: UIViewController, UIGestureRecognizerDelegate, UIS appDelegate.activeMetadata = metadata if let viewController = appDelegate.listFilesVC[serverUrlPush], viewController.isViewLoaded { - pushViewController(viewController: viewController) + navigationController?.pushViewController(viewController, animated: true) } else { if let viewController: NCFiles = UIStoryboard(name: "NCFiles", bundle: nil).instantiateInitialViewController() as? NCFiles { viewController.isRoot = false @@ -1006,7 +1123,7 @@ class NCCollectionViewCommon: UIViewController, UIGestureRecognizerDelegate, UIS viewController.titlePreviusFolder = navigationItem.title viewController.titleCurrentFolder = metadata.fileNameView appDelegate.listFilesVC[serverUrlPush] = viewController - pushViewController(viewController: viewController) + navigationController?.pushViewController(viewController, animated: true) } } } @@ -1030,20 +1147,15 @@ extension NCCollectionViewCommon: UICollectionViewDelegate { func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) { guard let metadata = dataSource.cellForItemAt(indexPath: indexPath) else { return } appDelegate.activeMetadata = metadata - let metadataSourceForAllSections = dataSource.getMetadataSourceForAllSections() if isEditMode { if let index = selectOcId.firstIndex(of: metadata.ocId) { selectOcId.remove(at: index) - selectIndexPaths.removeAll(where: { $0 == indexPath }) } else { selectOcId.append(metadata.ocId) - selectIndexPaths.append(indexPath) } collectionView.reloadItems(at: [indexPath]) - - self.setNavigationRightItems() - + tabBarSelect.update(selectOcId: selectOcId, metadatas: getSelectedMetadatas(), userId: appDelegate.userId) return } @@ -1071,7 +1183,7 @@ extension NCCollectionViewCommon: UICollectionViewDelegate { if !metadata.isDirectoryE2EE && (metadata.isImage || metadata.isAudioOrVideo) { var metadatas: [tableMetadata] = [] - for metadata in metadataSourceForAllSections { + for metadata in dataSource.getMetadataSourceForAllSections() { if metadata.isImage || metadata.isAudioOrVideo { metadatas.append(metadata) } @@ -1094,13 +1206,6 @@ extension NCCollectionViewCommon: UICollectionViewDelegate { } } - func pushViewController(viewController: UIViewController) { - if pushed { return } - - pushed = true - navigationController?.pushViewController(viewController, animated: true) - } - func collectionView(_ collectionView: UICollectionView, contextMenuConfigurationForItemAt indexPath: IndexPath, point: CGPoint) -> UIContextMenuConfiguration? { guard let metadata = dataSource.cellForItemAt(indexPath: indexPath) else { return nil } @@ -1121,7 +1226,7 @@ extension NCCollectionViewCommon: UICollectionViewDelegate { }, actionProvider: { _ in - return NCContextMenu().viewMenu(ocId: metadata.ocId, indexPath: indexPath, viewController: self, image: image) + return NCContextMenu().viewMenu(ocId: metadata.ocId, viewController: self, image: image) }) } @@ -1240,7 +1345,6 @@ extension NCCollectionViewCommon: UICollectionViewDataSource { if layoutForView?.layout == NCGlobal.shared.layoutList { guard let listCell = collectionView.dequeueReusableCell(withReuseIdentifier: "listCell", for: indexPath) as? NCListCell else { return NCListCell() } listCell.listCellDelegate = self - // listCell.delegate = self cell = listCell } else { // LAYOUT GRID diff --git a/iOSClient/Main/Collection Common/NCCollectionViewCommonSelectTabBar.swift b/iOSClient/Main/Collection Common/NCCollectionViewCommonSelectTabBar.swift index b369db4bda..085c584dfe 100644 --- a/iOSClient/Main/Collection Common/NCCollectionViewCommonSelectTabBar.swift +++ b/iOSClient/Main/Collection Common/NCCollectionViewCommonSelectTabBar.swift @@ -26,20 +26,18 @@ import SwiftUI protocol NCCollectionViewCommonSelectTabBarDelegate: AnyObject { func selectAll() - func delete(selectedMetadatas: [tableMetadata]) - func move(selectedMetadatas: [tableMetadata]) - func share(selectedMetadatas: [tableMetadata]) - func saveAsAvailableOffline(selectedMetadatas: [tableMetadata], isAnyOffline: Bool) - func lock(selectedMetadatas: [tableMetadata], isAnyLocked: Bool) + func delete() + func move() + func share() + func saveAsAvailableOffline(isAnyOffline: Bool) + func lock(isAnyLocked: Bool) } -class NCCollectionViewCommonSelectTabBar: NCSelectableViewTabBar, ObservableObject { +class NCCollectionViewCommonSelectTabBar: ObservableObject { var tabBarController: UITabBarController? var hostingController: UIViewController? open weak var delegate: NCCollectionViewCommonSelectTabBarDelegate? - var selectedMetadatas: [tableMetadata] = [] - @Published var isAnyOffline = false @Published var canSetAsOffline = false @Published var isAnyDirectory = false @@ -70,12 +68,9 @@ class NCCollectionViewCommonSelectTabBar: NCSelectableViewTabBar, ObservableObje guard let tabBarController, let hostingController else { return } tabBarController.tabBar.isHidden = true - if hostingController.view.isHidden { hostingController.view.isHidden = false - hostingController.view.transform = .init(translationX: 0, y: hostingController.view.frame.height) - UIView.animate(withDuration: 0.2) { hostingController.view.transform = .init(translationX: 0, y: 0) } @@ -88,6 +83,53 @@ class NCCollectionViewCommonSelectTabBar: NCSelectableViewTabBar, ObservableObje hostingController.view.isHidden = true tabBarController.tabBar.isHidden = false } + + func isHidden() -> Bool { + guard let hostingController else { return false } + return hostingController.view.isHidden + } + + func update(selectOcId: [String], metadatas: [tableMetadata]? = nil, userId: String? = nil) { + if let metadatas { + + isAnyOffline = false + canSetAsOffline = true + isAnyDirectory = false + isAllDirectory = true + isAnyLocked = false + canUnlock = true + + for metadata in metadatas { + if metadata.directory { + isAnyDirectory = true + } else { + isAllDirectory = false + } + + if !metadata.canSetAsAvailableOffline { + canSetAsOffline = false + } + + if metadata.lock { + isAnyLocked = true + if metadata.lockOwner != userId { + canUnlock = false + } + } + + guard !isAnyOffline else { continue } + + if metadata.directory, + let directory = NCManageDatabase.shared.getTableDirectory(predicate: NSPredicate(format: "account == %@ AND serverUrl == %@", metadata.account, metadata.serverUrl + "/" + metadata.fileName)) { + isAnyOffline = directory.offline + } else if let localFile = NCManageDatabase.shared.getTableLocalFile(predicate: NSPredicate(format: "ocId == %@", metadata.ocId)) { + isAnyOffline = localFile.offline + } // else: file is not offline, continue + } + enableLock = !isAnyDirectory && canUnlock && !NCGlobal.shared.capabilityFilesLockVersion.isEmpty + } + isSelectedEmpty = selectOcId.isEmpty + } } struct NCCollectionViewCommonSelectTabBarView: View { @@ -100,17 +142,16 @@ struct NCCollectionViewCommonSelectTabBarView: View { HStack { Button { - tabBarSelect.delegate?.share(selectedMetadatas: tabBarSelect.selectedMetadatas) + tabBarSelect.delegate?.share() } label: { Image(systemName: "square.and.arrow.up") .imageScale(sizeClass == .compact ? .medium : .large) - } .frame(maxWidth: .infinity) .disabled(tabBarSelect.isSelectedEmpty || tabBarSelect.isAllDirectory) Button { - tabBarSelect.delegate?.move(selectedMetadatas: tabBarSelect.selectedMetadatas) + tabBarSelect.delegate?.move() } label: { Image(systemName: "rectangle.portrait.and.arrow.right") .imageScale(sizeClass == .compact ? .medium : .large) @@ -119,7 +160,7 @@ struct NCCollectionViewCommonSelectTabBarView: View { .disabled(tabBarSelect.isSelectedEmpty) Button { - tabBarSelect.delegate?.delete(selectedMetadatas: tabBarSelect.selectedMetadatas) + tabBarSelect.delegate?.delete() } label: { Image(systemName: "trash") .imageScale(sizeClass == .compact ? .medium : .large) @@ -130,7 +171,7 @@ struct NCCollectionViewCommonSelectTabBarView: View { Menu { Button(action: { - tabBarSelect.delegate?.saveAsAvailableOffline(selectedMetadatas: tabBarSelect.selectedMetadatas, isAnyOffline: tabBarSelect.isAnyOffline) + tabBarSelect.delegate?.saveAsAvailableOffline(isAnyOffline: tabBarSelect.isAnyOffline) }, label: { Label(NSLocalizedString(tabBarSelect.isAnyOffline ? "_remove_available_offline_" : "_set_available_offline_", comment: ""), systemImage: tabBarSelect.isAnyOffline ? "icloud.slash" : "icloud.and.arrow.down") @@ -141,7 +182,7 @@ struct NCCollectionViewCommonSelectTabBarView: View { .disabled(!tabBarSelect.isAnyOffline && (!tabBarSelect.canSetAsOffline || tabBarSelect.isSelectedEmpty)) Button(action: { - tabBarSelect.delegate?.lock(selectedMetadatas: tabBarSelect.selectedMetadatas, isAnyLocked: tabBarSelect.isAnyLocked) + tabBarSelect.delegate?.lock(isAnyLocked: tabBarSelect.isAnyLocked) }, label: { Label(NSLocalizedString(tabBarSelect.isAnyLocked ? "_unlock_" : "_lock_", comment: ""), systemImage: tabBarSelect.isAnyLocked ? "lock.open" : "lock") diff --git a/iOSClient/Main/Collection Common/NCSelectableNavigationView.swift b/iOSClient/Main/Collection Common/NCSelectableNavigationView.swift deleted file mode 100644 index 3fb408eae6..0000000000 --- a/iOSClient/Main/Collection Common/NCSelectableNavigationView.swift +++ /dev/null @@ -1,104 +0,0 @@ -// -// NCSelectableNavigationView.swift -// Nextcloud -// -// Created by Henrik Storch on 27.01.22. -// Copyright © 2022 Henrik Storch. All rights reserved. -// -// Author Marino Faggiana -// Author Henrik Storch -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program. If not, see . -// - -import NextcloudKit -import Realm -import UIKit - -extension RealmSwiftObject { - var primaryKeyValue: String? { - guard let primaryKeyName = self.objectSchema.primaryKeyProperty?.name else { return nil } - return value(forKey: primaryKeyName) as? String - } -} - -public protocol NCSelectableViewTabBar { - var tabBarController: UITabBarController? { get } - var hostingController: UIViewController? { get } -} - -protocol NCSelectableNavigationView: AnyObject { - var viewController: UIViewController { get } - var appDelegate: AppDelegate { get } - var selectableDataSource: [RealmSwiftObject] { get } - var collectionView: UICollectionView! { get set } - var isEditMode: Bool { get set } - var selectOcId: [String] { get set } - var selectIndexPaths: [IndexPath] { get set } - var titleCurrentFolder: String { get } - var navigationItem: UINavigationItem { get } - var navigationController: UINavigationController? { get } - var layoutKey: String { get } - var serverUrl: String { get } - var tabBarSelect: NCSelectableViewTabBar? { get set } - - func reloadDataSource(withQueryDB: Bool) - func setNavigationLeftItems() - func setNavigationRightItems(enableMenu: Bool) - func createMenuActions() -> [UIMenuElement] - - func toggleSelect(isOn: Bool?) - func onListSelected() - func onGridSelected() -} - -extension NCSelectableNavigationView { - func setNavigationLeftItems() {} - - func saveLayout(_ layoutForView: NCDBLayoutForView) { - NCManageDatabase.shared.setLayoutForView(layoutForView: layoutForView) - NotificationCenter.default.postOnMainThread(name: NCGlobal.shared.notificationCenterReloadDataSource) - setNavigationRightItems(enableMenu: false) - } - - /// If explicit `isOn` is not set, it will invert `isEditMode` - func toggleSelect(isOn: Bool? = nil) { - DispatchQueue.main.async { - self.isEditMode = isOn ?? !self.isEditMode - self.selectOcId.removeAll() - self.selectIndexPaths.removeAll() - self.setNavigationLeftItems() - self.setNavigationRightItems(enableMenu: true) - self.collectionView.reloadData() - } - } - - func collectionViewSelectAll() { - selectOcId = selectableDataSource.compactMap({ $0.primaryKeyValue }) - collectionView.reloadData() - setNavigationRightItems(enableMenu: false) - } - - func tapNotification() { - if let viewController = UIStoryboard(name: "NCNotification", bundle: nil).instantiateInitialViewController() as? NCNotification { - navigationController?.pushViewController(viewController, animated: true) - } - } -} - -extension NCSelectableNavigationView where Self: UIViewController { - var viewController: UIViewController { - self - } -} diff --git a/iOSClient/Main/Create cloud/NCCreateFormUploadDocuments.swift b/iOSClient/Main/Create cloud/NCCreateFormUploadDocuments.swift index 3114fa97a2..ab579985ea 100644 --- a/iOSClient/Main/Create cloud/NCCreateFormUploadDocuments.swift +++ b/iOSClient/Main/Create cloud/NCCreateFormUploadDocuments.swift @@ -210,7 +210,7 @@ import XLForm // MARK: - Action - func dismissSelect(serverUrl: String?, metadata: tableMetadata?, type: String, items: [Any], indexPath: [IndexPath], overwrite: Bool, copy: Bool, move: Bool) { + func dismissSelect(serverUrl: String?, metadata: tableMetadata?, type: String, items: [Any], overwrite: Bool, copy: Bool, move: Bool) { guard let serverUrl = serverUrl else { return } @@ -499,7 +499,7 @@ import XLForm } else if error != .success { print("\(error.errorCode)") } else { - print("[LOG] It has been changed user during networking process, error.") + print("[ERROR] It has been changed user during networking process, error.") } } } diff --git a/iOSClient/Main/NCActionCenter.swift b/iOSClient/Main/NCActionCenter.swift index 5da93b16c6..7db171b676 100644 --- a/iOSClient/Main/NCActionCenter.swift +++ b/iOSClient/Main/NCActionCenter.swift @@ -617,7 +617,7 @@ class NCActionCenter: NSObject, UIDocumentInteractionControllerDelegate, NCSelec // MARK: - NCSelect + Delegate - func dismissSelect(serverUrl: String?, metadata: tableMetadata?, type: String, items: [Any], indexPath: [IndexPath], overwrite: Bool, copy: Bool, move: Bool) { + func dismissSelect(serverUrl: String?, metadata: tableMetadata?, type: String, items: [Any], overwrite: Bool, copy: Bool, move: Bool) { if let serverUrl, !items.isEmpty { if copy { Task { @@ -632,7 +632,7 @@ class NCActionCenter: NSObject, UIDocumentInteractionControllerDelegate, NCSelec if error != .success { NCContentPresenter().showError(error: error) } - NotificationCenter.default.postOnMainThread(name: NCGlobal.shared.notificationCenterCopyFile, userInfo: ["ocId": ocId, "indexPath": indexPath, "error": error]) + NotificationCenter.default.postOnMainThread(name: NCGlobal.shared.notificationCenterCopyFile, userInfo: ["ocId": ocId, "error": error]) } } else { Task { @@ -647,13 +647,13 @@ class NCActionCenter: NSObject, UIDocumentInteractionControllerDelegate, NCSelec if error != .success { NCContentPresenter().showError(error: error) } - NotificationCenter.default.postOnMainThread(name: NCGlobal.shared.notificationCenterMoveFile, userInfo: ["ocId": ocId, "indexPath": indexPath, "error": error]) + NotificationCenter.default.postOnMainThread(name: NCGlobal.shared.notificationCenterMoveFile, userInfo: ["ocId": ocId, "error": error]) } } } } - func openSelectView(items: [tableMetadata], indexPath: [IndexPath]) { + func openSelectView(items: [tableMetadata]) { guard let appDelegate = UIApplication.shared.delegate as? AppDelegate else { return } let navigationController = UIStoryboard(name: "NCSelect", bundle: nil).instantiateInitialViewController() as? UINavigationController @@ -688,7 +688,6 @@ class NCActionCenter: NSObject, UIDocumentInteractionControllerDelegate, NCSelec vc.typeOfCommandView = .copyMove vc.items = copyItems vc.serverUrl = serverUrl - vc.selectIndexPath = indexPath vc.navigationItem.backButtonTitle = vc.titleCurrentFolder listViewController.insert(vc, at: 0) diff --git a/iOSClient/Media/NCMedia+Command.swift b/iOSClient/Media/NCMedia+Command.swift index 51750d6de2..1987f62731 100644 --- a/iOSClient/Media/NCMedia+Command.swift +++ b/iOSClient/Media/NCMedia+Command.swift @@ -17,7 +17,7 @@ extension NCMedia { func setSelectcancelButton() { selectOcId.removeAll() - tabBarSelect?.selectCount = selectOcId.count + tabBarSelect.selectCount = selectOcId.count if let visibleCells = self.collectionView?.indexPathsForVisibleItems.compactMap({ self.collectionView?.cellForItem(at: $0) }) { for case let cell as NCGridMediaCell in visibleCells { cell.selected(false) @@ -29,14 +29,14 @@ extension NCMedia { selectOrCancelButtonTrailing.constant = 10 selectOrCancelButton.isHidden = false menuButton.isHidden = true - tabBarSelect?.show() + tabBarSelect.show() } else { activityIndicatorTrailing.constant = 150 selectOrCancelButton.setTitle( NSLocalizedString("_select_", comment: ""), for: .normal) selectOrCancelButtonTrailing.constant = 50 selectOrCancelButton.isHidden = false menuButton.isHidden = false - tabBarSelect?.hide() + tabBarSelect.hide() } } diff --git a/iOSClient/Media/NCMedia.swift b/iOSClient/Media/NCMedia.swift index c6d75c4215..2c53c92994 100644 --- a/iOSClient/Media/NCMedia.swift +++ b/iOSClient/Media/NCMedia.swift @@ -39,7 +39,7 @@ class NCMedia: UIViewController, NCEmptyDataSetDelegate { var activeAccount = tableAccount() var emptyDataSet: NCEmptyDataSet? var documentPickerViewController: NCDocumentPickerViewController? - var tabBarSelect: NCMediaSelectTabBar? + var tabBarSelect: NCMediaSelectTabBar! let appDelegate = (UIApplication.shared.delegate as? AppDelegate)! let utilityFileSystem = NCUtilityFileSystem() let utility = NCUtility() @@ -144,17 +144,18 @@ class NCMedia: UIViewController, NCEmptyDataSetDelegate { override func viewWillAppear(_ animated: Bool) { super.viewWillAppear(animated) - appDelegate.activeViewController = self navigationController?.setMediaAppreance() + } + + override func viewDidAppear(_ animated: Bool) { + super.viewDidAppear(animated) + + appDelegate.activeViewController = self NotificationCenter.default.addObserver(self, selector: #selector(deleteFile(_:)), name: NSNotification.Name(rawValue: NCGlobal.shared.notificationCenterDeleteFile), object: nil) NotificationCenter.default.addObserver(self, selector: #selector(enterForeground(_:)), name: NSNotification.Name(rawValue: NCGlobal.shared.notificationCenterApplicationWillEnterForeground), object: nil) startTimer() - } - - override func viewDidAppear(_ animated: Bool) { - super.viewDidAppear(animated) createMenu() if imageCache.createMediaCacheInProgress { @@ -170,8 +171,8 @@ class NCMedia: UIViewController, NCEmptyDataSetDelegate { } } - override func viewWillDisappear(_ animated: Bool) { - super.viewWillDisappear(animated) + override func viewDidDisappear(_ animated: Bool) { + super.viewDidDisappear(animated) NotificationCenter.default.removeObserver(self, name: NSNotification.Name(rawValue: NCGlobal.shared.notificationCenterDeleteFile), object: nil) NotificationCenter.default.removeObserver(self, name: NSNotification.Name(rawValue: NCGlobal.shared.notificationCenterApplicationWillEnterForeground), object: nil) @@ -198,7 +199,7 @@ class NCMedia: UIViewController, NCEmptyDataSetDelegate { super.viewWillLayoutSubviews() if let frame = tabBarController?.tabBar.frame { - tabBarSelect?.hostingController.view.frame = frame + tabBarSelect.hostingController.view.frame = frame } gradient.frame = gradientView.bounds } @@ -301,7 +302,7 @@ extension NCMedia: UICollectionViewDelegate { mediaCell?.selected(true) } - tabBarSelect?.selectCount = selectOcId.count + tabBarSelect.selectCount = selectOcId.count } else { // ACTIVE SERVERURL appDelegate.activeServerUrl = metadata.serverUrl @@ -321,7 +322,7 @@ extension NCMedia: UICollectionViewDelegate { return UIContextMenuConfiguration(identifier: identifier, previewProvider: { return NCViewerProviderContextMenu(metadata: metadata, image: image) }, actionProvider: { _ in - return NCContextMenu().viewMenu(ocId: metadata.ocId, indexPath: indexPath, viewController: self, image: image) + return NCContextMenu().viewMenu(ocId: metadata.ocId, viewController: self, image: image) }) } @@ -336,7 +337,7 @@ extension NCMedia: UICollectionViewDelegate { extension NCMedia: UICollectionViewDataSourcePrefetching { func collectionView(_ collectionView: UICollectionView, prefetchItemsAt indexPaths: [IndexPath]) { - // print("[LOG] n. " + String(indexPaths.count)) + // print("[INFO] n. " + String(indexPaths.count)) } } @@ -498,7 +499,7 @@ extension NCMedia: UIScrollViewDelegate { // MARK: - extension NCMedia: NCSelectDelegate { - func dismissSelect(serverUrl: String?, metadata: tableMetadata?, type: String, items: [Any], indexPath: [IndexPath], overwrite: Bool, copy: Bool, move: Bool) { + func dismissSelect(serverUrl: String?, metadata: tableMetadata?, type: String, items: [Any], overwrite: Bool, copy: Bool, move: Bool) { guard let serverUrl = serverUrl else { return } let home = utilityFileSystem.getHomeServer(urlBase: appDelegate.urlBase, userId: appDelegate.userId) let mediaPath = serverUrl.replacingOccurrences(of: home, with: "") diff --git a/iOSClient/Media/NCMediaDataSource.swift b/iOSClient/Media/NCMediaDataSource.swift index 20505d10da..7f046ab090 100644 --- a/iOSClient/Media/NCMediaDataSource.swift +++ b/iOSClient/Media/NCMediaDataSource.swift @@ -121,7 +121,7 @@ extension NCMedia { guard let mediaPath = NCManageDatabase.shared.getActiveAccount()?.mediaPath else { return(lessDate, greaterDate, 0, false, NKError()) } - NextcloudKit.shared.nkCommonInstance.writeLog("Start searchMedia with lessDate \(lessDate), greaterDate \(greaterDate)") + NextcloudKit.shared.nkCommonInstance.writeLog("[INFO] Start searchMedia with lessDate \(lessDate), greaterDate \(greaterDate)") let options = NKRequestOptions(timeout: timeout, queue: NextcloudKit.shared.nkCommonInstance.backgroundQueue) let results = await NextcloudKit.shared.searchMedia(path: mediaPath, lessDate: lessDate, greaterDate: greaterDate, elementDate: "d:getlastmodified/", limit: limit, showHiddenFiles: NCKeychain().showHiddenFiles, includeHiddenFiles: [], options: options) @@ -134,7 +134,7 @@ extension NCMedia { predicate = NSCompoundPredicate(andPredicateWithSubpredicates: [predicate, getPredicate(showAll: true)]) let resultsUpdate = NCManageDatabase.shared.updateMetadatas(metadatas, predicate: predicate) let isChaged: Bool = (resultsUpdate.metadatasDifferentCount != 0 || resultsUpdate.metadatasModified != 0) - NextcloudKit.shared.nkCommonInstance.writeLog("End searchMedia UpdateMetadatas with differentCount \(resultsUpdate.metadatasDifferentCount), modified \(resultsUpdate.metadatasModified)") + NextcloudKit.shared.nkCommonInstance.writeLog("[INFO] End searchMedia UpdateMetadatas with differentCount \(resultsUpdate.metadatasDifferentCount), modified \(resultsUpdate.metadatasModified)") return(lessDate, greaterDate, metadatas.count, isChaged, results.error) } else { return(lessDate, greaterDate, 0, false, results.error) diff --git a/iOSClient/Menu/NCContextMenu.swift b/iOSClient/Menu/NCContextMenu.swift index 9be6ff8597..c0f96047c7 100644 --- a/iOSClient/Menu/NCContextMenu.swift +++ b/iOSClient/Menu/NCContextMenu.swift @@ -31,7 +31,7 @@ class NCContextMenu: NSObject { let utilityFileSystem = NCUtilityFileSystem() let utility = NCUtility() - func viewMenu(ocId: String, indexPath: IndexPath, viewController: UIViewController, image: UIImage?) -> UIMenu { + func viewMenu(ocId: String, viewController: UIViewController, image: UIImage?) -> UIMenu { guard let metadata = NCManageDatabase.shared.getMetadataFromOcId(ocId) else { return UIMenu() } var downloadRequest: DownloadRequest? @@ -166,7 +166,7 @@ class NCContextMenu: NSObject { } else { NCContentPresenter().showError(error: error) } - NotificationCenter.default.postOnMainThread(name: NCGlobal.shared.notificationCenterDeleteFile, userInfo: ["ocId": ocId, "indexPath": [indexPath], "onlyLocalCache": false, "error": error]) + NotificationCenter.default.postOnMainThread(name: NCGlobal.shared.notificationCenterDeleteFile, userInfo: ["ocId": ocId, "onlyLocalCache": false, "error": error]) } }) alertController.addAction(UIAlertAction(title: NSLocalizedString("_cancel_", comment: ""), style: .cancel) { _ in }) @@ -183,7 +183,7 @@ class NCContextMenu: NSObject { } else { NCContentPresenter().showError(error: error) } - NotificationCenter.default.postOnMainThread(name: NCGlobal.shared.notificationCenterDeleteFile, userInfo: ["ocId": ocId, "indexPath": [indexPath], "onlyLocalCache": true, "error": error]) + NotificationCenter.default.postOnMainThread(name: NCGlobal.shared.notificationCenterDeleteFile, userInfo: ["ocId": ocId, "onlyLocalCache": true, "error": error]) } } diff --git a/iOSClient/Menu/NCMenuAction.swift b/iOSClient/Menu/NCMenuAction.swift index ec9eb7d24a..179a993c52 100644 --- a/iOSClient/Menu/NCMenuAction.swift +++ b/iOSClient/Menu/NCMenuAction.swift @@ -144,7 +144,7 @@ extension NCMenuAction { icon: NCUtility().loadImage(named: icon), order: order, action: { _ in - let alertController = UIAlertController.deleteFileOrFolder(titleString: titleDelete + "?", message: message + fileList, canDeleteServer: canDeleteServer, selectedMetadatas: selectedMetadatas, indexPaths: indexPaths) { _ in + let alertController = UIAlertController.deleteFileOrFolder(titleString: titleDelete + "?", message: message + fileList, canDeleteServer: canDeleteServer, selectedMetadatas: selectedMetadatas) { _ in completion?() } @@ -229,7 +229,7 @@ extension NCMenuAction { icon: NCUtility().loadImage(named: "rectangle.portrait.and.arrow.right"), order: order, action: { _ in - NCActionCenter.shared.openSelectView(items: selectedMetadatas, indexPath: indexPath) + NCActionCenter.shared.openSelectView(items: selectedMetadatas) completion?() } ) diff --git a/iOSClient/Menu/NCTrash+Menu.swift b/iOSClient/Menu/NCTrash+Menu.swift index dfcce125f7..5602619db9 100644 --- a/iOSClient/Menu/NCTrash+Menu.swift +++ b/iOSClient/Menu/NCTrash+Menu.swift @@ -28,85 +28,8 @@ import FloatingPanel import NextcloudKit extension NCTrash { - var selectActions: [NCMenuAction] { - [ - NCMenuAction( - title: NSLocalizedString("_cancel_", comment: ""), - icon: utility.loadImage(named: "xmark"), - action: { _ in - self.toggleSelect() - } - ), - NCMenuAction( - title: NSLocalizedString("_select_all_", comment: ""), - icon: utility.loadImage(named: "checkmark.circle.fill"), - action: { _ in - self.selectOcId = self.datasource.map { $0.fileId } - self.collectionView.reloadData() - } - ), - NCMenuAction.seperator(), - NCMenuAction( - title: NSLocalizedString("_trash_restore_selected_", comment: ""), - icon: utility.loadImage(named: "restore"), - action: { _ in - self.selectOcId.forEach(self.restoreItem) - self.toggleSelect() - } - ), - NCMenuAction( - title: NSLocalizedString("_trash_delete_selected_", comment: ""), - icon: utility.loadImage(named: "trash"), - action: { _ in - let alert = UIAlertController(title: NSLocalizedString("_trash_delete_selected_", comment: ""), message: "", preferredStyle: .alert) - alert.addAction(UIAlertAction(title: NSLocalizedString("_delete_", comment: ""), style: .destructive, handler: { _ in - self.selectOcId.forEach(self.deleteItem) - self.toggleSelect() - })) - alert.addAction(UIAlertAction(title: NSLocalizedString("_cancel_", comment: ""), style: .cancel, handler: { _ in })) - self.present(alert, animated: true, completion: nil) - } - ) - ] - } - - func toggleMenuMoreHeader() { - - var actions: [NCMenuAction] = [] - - actions.append( - NCMenuAction( - title: NSLocalizedString("_trash_restore_all_", comment: ""), - icon: utility.loadImage(named: "restore"), - action: { _ in - self.datasource.forEach({ self.restoreItem(with: $0.fileId) }) - } - ) - ) - - actions.append( - NCMenuAction( - title: NSLocalizedString("_trash_delete_all_", comment: ""), - icon: utility.loadImage(named: "trash"), - action: { _ in - let alert = UIAlertController(title: NSLocalizedString("_trash_delete_all_description_", comment: ""), message: "", preferredStyle: .alert) - alert.addAction(UIAlertAction(title: NSLocalizedString("_trash_delete_all_", comment: ""), style: .destructive, handler: { _ in - self.emptyTrash() - })) - alert.addAction(UIAlertAction(title: NSLocalizedString("_cancel_", comment: ""), style: .cancel)) - self.present(alert, animated: true, completion: nil) - } - ) - ) - presentMenu(with: actions) - } - func toggleMenuMore(with objectId: String, image: UIImage?, isGridCell: Bool) { - - guard let tableTrash = NCManageDatabase.shared.getTrashItem(fileId: objectId, account: appDelegate.account) else { - return - } - + guard let tableTrash = NCManageDatabase.shared.getTrashItem(fileId: objectId, account: appDelegate.account) else { return } guard isGridCell else { let alert = UIAlertController(title: NSLocalizedString("_want_delete_", comment: ""), message: tableTrash.trashbinFileName, preferredStyle: .alert) alert.addAction(UIAlertAction(title: NSLocalizedString("_delete_", comment: ""), style: .destructive, handler: { _ in @@ -152,6 +75,7 @@ extension NCTrash { actions.append( NCMenuAction( title: NSLocalizedString("_delete_", comment: ""), + destructive: true, icon: utility.loadImage(named: "trash"), action: { _ in self.deleteItem(with: objectId) diff --git a/iOSClient/More/NCMore.swift b/iOSClient/More/NCMore.swift index 2615180b67..48e9ecd2bd 100644 --- a/iOSClient/More/NCMore.swift +++ b/iOSClient/More/NCMore.swift @@ -79,10 +79,8 @@ class NCMore: UIViewController, UITableViewDelegate, UITableViewDataSource { override func viewWillAppear(_ animated: Bool) { super.viewWillAppear(animated) - - navigationController?.setGroupAppearance() - appDelegate.activeViewController = self + navigationController?.setGroupAppearance() loadItems() tableView.reloadData() } diff --git a/iOSClient/NCGlobal.swift b/iOSClient/NCGlobal.swift index 38392b682d..97d725b400 100644 --- a/iOSClient/NCGlobal.swift +++ b/iOSClient/NCGlobal.swift @@ -370,9 +370,9 @@ class NCGlobal: NSObject { let notificationCenterUpdateBadgeNumber = "updateBadgeNumber" let notificationCenterCreateFolder = "createFolder" // userInfo: ocId, serverUrl, account, withPush - let notificationCenterDeleteFile = "deleteFile" // userInfo: [ocId], [indexPath], onlyLocalCache, error - let notificationCenterMoveFile = "moveFile" // userInfo: [ocId], [indexPath], error - let notificationCenterCopyFile = "copyFile" // userInfo: [ocId], [indexPath], error + let notificationCenterDeleteFile = "deleteFile" // userInfo: [ocId], onlyLocalCache, error + let notificationCenterMoveFile = "moveFile" // userInfo: [ocId], error + let notificationCenterCopyFile = "copyFile" // userInfo: [ocId], error let notificationCenterRenameFile = "renameFile" // userInfo: ocId, account, indexPath let notificationCenterFavoriteFile = "favoriteFile" // userInfo: ocId, serverUrl diff --git a/iOSClient/Networking/E2EE/NCEndToEndEncryption.m b/iOSClient/Networking/E2EE/NCEndToEndEncryption.m index 33abb7f9ce..6b575dfe52 100644 --- a/iOSClient/Networking/E2EE/NCEndToEndEncryption.m +++ b/iOSClient/Networking/E2EE/NCEndToEndEncryption.m @@ -177,8 +177,8 @@ - (BOOL)generateCertificateX509WithUserId:(NSString *)userId directory:(NSString BIO_read(csrBIO, keyBytes, len); _csrData = [NSData dataWithBytes:keyBytes length:len]; - NSLog(@"[LOG] \n%@", [[NSString alloc] initWithData:_csrData encoding:NSUTF8StringEncoding]); - + NSLog(@"[INFO] \n%@", [[NSString alloc] initWithData:_csrData encoding:NSUTF8StringEncoding]); + // PublicKey BIO *publicKeyBIO = BIO_new(BIO_s_mem()); PEM_write_bio_PUBKEY(publicKeyBIO, pkey); @@ -189,8 +189,8 @@ - (BOOL)generateCertificateX509WithUserId:(NSString *)userId directory:(NSString BIO_read(publicKeyBIO, keyBytes, len); _publicKeyData = [NSData dataWithBytes:keyBytes length:len]; self.generatedPublicKey = [[NSString alloc] initWithData:_publicKeyData encoding:NSUTF8StringEncoding]; - NSLog(@"[LOG] \n%@", self.generatedPublicKey); - + NSLog(@"[INFO] \n%@", self.generatedPublicKey); + // PrivateKey BIO *privateKeyBIO = BIO_new(BIO_s_mem()); PEM_write_bio_PKCS8PrivateKey(privateKeyBIO, pkey, NULL, NULL, 0, NULL, NULL); @@ -201,8 +201,8 @@ - (BOOL)generateCertificateX509WithUserId:(NSString *)userId directory:(NSString BIO_read(privateKeyBIO, keyBytes, len); _privateKeyData = [NSData dataWithBytes:keyBytes length:len]; self.generatedPrivateKey = [[NSString alloc] initWithData:_privateKeyData encoding:NSUTF8StringEncoding]; - NSLog(@"[LOG] \n%@", self.generatedPrivateKey); - + NSLog(@"[INFO] \n%@", self.generatedPrivateKey); + if(keyBytes) free(keyBytes); @@ -235,7 +235,7 @@ - (NSString *)extractPublicKeyFromCertificate:(NSString *)pemCertificate BIO_free(certBio); X509_free(certX509); - NSLog(@"[LOG] \n%@", publicKey); + NSLog(@"[INFO] \n%@", publicKey); return publicKey; } @@ -251,7 +251,7 @@ - (BOOL)saveToDiskPEMWithCert:(X509 *)x509 key:(EVP_PKEY *)pkey directory:(NSStr fclose(f); return NO; } - NSLog(@"[LOG] Saved cert to %@", certificatePath); + NSLog(@"[INFO] Saved cert to %@", certificatePath); fclose(f); // PublicKey @@ -262,7 +262,7 @@ - (BOOL)saveToDiskPEMWithCert:(X509 *)x509 key:(EVP_PKEY *)pkey directory:(NSStr fclose(f); return NO; } - NSLog(@"[LOG] Saved publicKey to %@", publicKeyPath); + NSLog(@"[INFO] Saved publicKey to %@", publicKeyPath); fclose(f); // Here you write the private key (pkey) to disk. OpenSSL will encrypt the @@ -277,7 +277,7 @@ - (BOOL)saveToDiskPEMWithCert:(X509 *)x509 key:(EVP_PKEY *)pkey directory:(NSStr fclose(f); return NO; } - NSLog(@"[LOG] Saved privatekey to %@", privatekeyPath); + NSLog(@"[INFO] Saved privatekey to %@", privatekeyPath); fclose(f); // CSR Request sha256 @@ -289,7 +289,7 @@ - (BOOL)saveToDiskPEMWithCert:(X509 *)x509 key:(EVP_PKEY *)pkey directory:(NSStr fclose(f); return NO; } - NSLog(@"[LOG] Saved csr to %@", csrPath); + NSLog(@"[INFO] Saved csr to %@", csrPath); fclose(f); return YES; @@ -308,7 +308,7 @@ - (BOOL)saveP12WithCert:(X509 *)x509 key:(EVP_PKEY *)pkey directory:(NSString *) fclose(f); return NO; } - NSLog(@"[LOG] Saved p12 to %@", path); + NSLog(@"[INFO] Saved p12 to %@", path); fclose(f); return YES; diff --git a/iOSClient/Networking/NCNetworking+LivePhoto.swift b/iOSClient/Networking/NCNetworking+LivePhoto.swift index 3a6bf7a99e..b5c228b304 100644 --- a/iOSClient/Networking/NCNetworking+LivePhoto.swift +++ b/iOSClient/Networking/NCNetworking+LivePhoto.swift @@ -59,7 +59,7 @@ extension NCNetworking { NextcloudKit.shared.nkCommonInstance.writeLog("[ERROR] Upload set LivePhoto with error \(results.error.errorCode)") } if results.error == .success, results1.error == .success { - NextcloudKit.shared.nkCommonInstance.writeLog("[SUCCESS] Upload set LivePhoto for files " + (metadata.fileName as NSString).deletingPathExtension) + NextcloudKit.shared.nkCommonInstance.writeLog("[INFO] Upload set LivePhoto for files " + (metadata.fileName as NSString).deletingPathExtension) } NotificationCenter.default.post(name: Notification.Name(rawValue: NCGlobal.shared.notificationCenterUploadedLivePhoto), diff --git a/iOSClient/Networking/NCNetworking+Synchronization.swift b/iOSClient/Networking/NCNetworking+Synchronization.swift index f1183c42c9..c0ed548d74 100644 --- a/iOSClient/Networking/NCNetworking+Synchronization.swift +++ b/iOSClient/Networking/NCNetworking+Synchronization.swift @@ -61,7 +61,7 @@ extension NCNetworking { selector: NCGlobal.shared.selectorSynchronizationOffline) NCManageDatabase.shared.setDirectorySynchronizationDate(serverUrl: serverUrl, account: account) let diffDate = Date().timeIntervalSinceReferenceDate - startDate.timeIntervalSinceReferenceDate - NextcloudKit.shared.nkCommonInstance.writeLog("[LOG] Synchronization \(serverUrl) in \(diffDate)") + NextcloudKit.shared.nkCommonInstance.writeLog("[INFO] Synchronization \(serverUrl) in \(diffDate)") completion(0, metadatasSynchronizationOffline.count) } else { NextcloudKit.shared.nkCommonInstance.writeLog("[ERROR] Synchronization \(serverUrl), \(error.errorCode), \(error.description)") diff --git a/iOSClient/Networking/NCNetworking+Upload.swift b/iOSClient/Networking/NCNetworking+Upload.swift index 681052a9b3..e8653df069 100644 --- a/iOSClient/Networking/NCNetworking+Upload.swift +++ b/iOSClient/Networking/NCNetworking+Upload.swift @@ -356,7 +356,7 @@ extension NCNetworking { self.utilityFileSystem.removeFile(atPath: self.utilityFileSystem.getDirectoryProviderStorageOcId(ocIdTemp)) } - NextcloudKit.shared.nkCommonInstance.writeLog("[SUCCESS] Upload complete " + serverUrl + "/" + fileName + ", result: success(\(size) bytes)") + NextcloudKit.shared.nkCommonInstance.writeLog("[INFO] Upload complete " + serverUrl + "/" + fileName + ", result: success(\(size) bytes)") let userInfo: [AnyHashable: Any] = ["ocId": metadata.ocId, "serverUrl": metadata.serverUrl, "account": metadata.account, "fileName": metadata.fileName, "ocIdTemp": ocIdTemp, "error": error] if metadata.isLivePhoto, NCGlobal.shared.isLivePhotoServerAvailable { diff --git a/iOSClient/Networking/NCNetworkingProcess.swift b/iOSClient/Networking/NCNetworkingProcess.swift index 54ad14c6f0..8ff098c515 100644 --- a/iOSClient/Networking/NCNetworkingProcess.swift +++ b/iOSClient/Networking/NCNetworkingProcess.swift @@ -47,7 +47,7 @@ class NCNetworkingProcess: NSObject { if !self.pauseProcess, !self.appDelegate.account.isEmpty { Task { let results = await self.start() - print("[LOG] PROCESS (TIMER) Download: \(results.counterDownload) Upload: \(results.counterUpload)") + print("[INFO] PROCESS (TIMER) Download: \(results.counterDownload) Upload: \(results.counterUpload)") NotificationCenter.default.post(name: Notification.Name(rawValue: NCGlobal.shared.notificationCenterUpdateBadgeNumber), object: nil) } } diff --git a/iOSClient/Notification/NCNotification.swift b/iOSClient/Notification/NCNotification.swift index a9ff3bb549..b3a17714f3 100644 --- a/iOSClient/Notification/NCNotification.swift +++ b/iOSClient/Notification/NCNotification.swift @@ -65,9 +65,12 @@ class NCNotification: UITableViewController, NCNotificationCellDelegate, NCEmpty override func viewWillAppear(_ animated: Bool) { super.viewWillAppear(animated) + navigationController?.setNavigationBarAppearance() + } + override func viewDidAppear(_ animated: Bool) { + super.viewDidAppear(animated) appDelegate.activeViewController = self - navigationController?.setNavigationBarAppearance() getNetwokingNotification() } diff --git a/iOSClient/Offline/NCOffline.swift b/iOSClient/Offline/NCOffline.swift index 82191d002e..684c4f3cfd 100644 --- a/iOSClient/Offline/NCOffline.swift +++ b/iOSClient/Offline/NCOffline.swift @@ -42,7 +42,6 @@ class NCOffline: NCCollectionViewCommon { override func viewWillAppear(_ animated: Bool) { super.viewWillAppear(animated) - reloadDataSource() } diff --git a/iOSClient/PrivacyInfo.xcprivacy b/iOSClient/PrivacyInfo.xcprivacy new file mode 100644 index 0000000000..70e78c413e --- /dev/null +++ b/iOSClient/PrivacyInfo.xcprivacy @@ -0,0 +1,42 @@ + + + + + NSPrivacyAccessedAPITypes + + + NSPrivacyAccessedAPIType + NSPrivacyAccessedAPICategorySystemBootTime + NSPrivacyAccessedAPITypeReasons + + C617.1 + 35F9.1 + + + + NSPrivacyAccessedAPIType + NSPrivacyAccessedAPICategoryUserDefaults + NSPrivacyAccessedAPITypeReasons + + C617.1 + + + + NSPrivacyAccessedAPIType + NSPrivacyAccessedAPICategoryFileTimestamp + NSPrivacyAccessedAPITypeReasons + + C617.1 + + + + NSPrivacyAccessedAPIType + NSPrivacyAccessedAPICategoryDiskSpace + NSPrivacyAccessedAPITypeReasons + + C617.1 + + + + + diff --git a/iOSClient/Recent/NCRecent.swift b/iOSClient/Recent/NCRecent.swift index 2565fac42d..fe3449e94e 100644 --- a/iOSClient/Recent/NCRecent.swift +++ b/iOSClient/Recent/NCRecent.swift @@ -42,7 +42,6 @@ class NCRecent: NCCollectionViewCommon { override func viewWillAppear(_ animated: Bool) { super.viewWillAppear(animated) - reloadDataSourceNetwork() } diff --git a/iOSClient/Rename file/NCRenameFile.swift b/iOSClient/Rename file/NCRenameFile.swift index fb65a86317..7cf544dd01 100644 --- a/iOSClient/Rename file/NCRenameFile.swift +++ b/iOSClient/Rename file/NCRenameFile.swift @@ -126,10 +126,6 @@ class NCRenameFile: UIViewController, UITextFieldDelegate { renameButton.setTitle(NSLocalizedString("_rename_", comment: ""), for: .normal) } - override func viewWillAppear(_ animated: Bool) { - super.viewWillAppear(animated) - } - override func viewDidAppear(_ animated: Bool) { super.viewDidAppear(animated) diff --git a/iOSClient/RichWorkspace/NCViewerRichWorkspace.swift b/iOSClient/RichWorkspace/NCViewerRichWorkspace.swift index 34b4078338..19d5c5025e 100644 --- a/iOSClient/RichWorkspace/NCViewerRichWorkspace.swift +++ b/iOSClient/RichWorkspace/NCViewerRichWorkspace.swift @@ -58,19 +58,17 @@ import MarkdownKit textViewColor = .label } - override func viewWillAppear(_ animated: Bool) { - super.viewWillAppear(animated) - - DispatchQueue.main.asyncAfter(deadline: .now() + 1) { - NCNetworking.shared.readFile(serverUrlFileName: self.serverUrl, queue: .main) { _ in - } completion: { account, metadata, error in - if error == .success, account == self.appDelegate.account, let metadata { - NCManageDatabase.shared.setDirectory(serverUrl: self.serverUrl, richWorkspace: metadata.richWorkspace, account: account) - if self.richWorkspaceText != metadata.richWorkspace, metadata.richWorkspace != nil { - self.delegate?.richWorkspaceText = self.richWorkspaceText - self.richWorkspaceText = metadata.richWorkspace! - self.textView.attributedText = self.markdownParser.parse(metadata.richWorkspace!) - } + override func viewDidAppear(_ animated: Bool) { + super.viewDidAppear(animated) + + NCNetworking.shared.readFile(serverUrlFileName: self.serverUrl, queue: .main) { _ in + } completion: { account, metadata, error in + if error == .success, account == self.appDelegate.account, let metadata { + NCManageDatabase.shared.setDirectory(serverUrl: self.serverUrl, richWorkspace: metadata.richWorkspace, account: account) + if self.richWorkspaceText != metadata.richWorkspace, metadata.richWorkspace != nil { + self.delegate?.richWorkspaceText = self.richWorkspaceText + self.richWorkspaceText = metadata.richWorkspace! + self.textView.attributedText = self.markdownParser.parse(metadata.richWorkspace!) } } } diff --git a/iOSClient/Scan document/NCUploadScanDocument.swift b/iOSClient/Scan document/NCUploadScanDocument.swift index 2953afd0ba..22e400a31a 100644 --- a/iOSClient/Scan document/NCUploadScanDocument.swift +++ b/iOSClient/Scan document/NCUploadScanDocument.swift @@ -318,8 +318,7 @@ class NCUploadScanDocument: ObservableObject { extension NCUploadScanDocument: NCSelectDelegate { - func dismissSelect(serverUrl: String?, metadata: tableMetadata?, type: String, items: [Any], indexPath: [IndexPath], overwrite: Bool, copy: Bool, move: Bool) { - + func dismissSelect(serverUrl: String?, metadata: tableMetadata?, type: String, items: [Any], overwrite: Bool, copy: Bool, move: Bool) { if let serverUrl = serverUrl { self.serverUrl = serverUrl } diff --git a/iOSClient/Select/NCSelect.swift b/iOSClient/Select/NCSelect.swift index 8c846dcc4f..7500bef7a5 100644 --- a/iOSClient/Select/NCSelect.swift +++ b/iOSClient/Select/NCSelect.swift @@ -26,7 +26,7 @@ import SwiftUI import NextcloudKit @objc protocol NCSelectDelegate { - @objc func dismissSelect(serverUrl: String?, metadata: tableMetadata?, type: String, items: [Any], indexPath: [IndexPath], overwrite: Bool, copy: Bool, move: Bool) + @objc func dismissSelect(serverUrl: String?, metadata: tableMetadata?, type: String, items: [Any], overwrite: Bool, copy: Bool, move: Bool) } class NCSelect: UIViewController, UIGestureRecognizerDelegate, UIAdaptivePresentationControllerDelegate, NCListCellDelegate, NCGridCellDelegate, NCSectionHeaderMenuDelegate, NCEmptyDataSetDelegate { @@ -56,7 +56,6 @@ class NCSelect: UIViewController, UIGestureRecognizerDelegate, UIAdaptivePresent @objc var enableSelectFile = false @objc var type = "" @objc var items: [tableMetadata] = [] - @objc var selectIndexPath: [IndexPath] = [] var titleCurrentFolder = NCBrandOptions.shared.brand var serverUrl = "" @@ -148,8 +147,8 @@ class NCSelect: UIViewController, UIGestureRecognizerDelegate, UIAdaptivePresent NotificationCenter.default.addObserver(self, selector: #selector(createFolder(_:)), name: NSNotification.Name(rawValue: NCGlobal.shared.notificationCenterCreateFolder), object: nil) } - override func viewWillAppear(_ animated: Bool) { - super.viewWillAppear(animated) + override func viewDidAppear(_ animated: Bool) { + super.viewDidAppear(animated) self.navigationItem.title = titleCurrentFolder @@ -217,17 +216,17 @@ class NCSelect: UIViewController, UIGestureRecognizerDelegate, UIAdaptivePresent } func selectButtonPressed(_ sender: UIButton) { - delegate?.dismissSelect(serverUrl: serverUrl, metadata: metadataFolder, type: type, items: items, indexPath: selectIndexPath, overwrite: overwrite, copy: false, move: false) + delegate?.dismissSelect(serverUrl: serverUrl, metadata: metadataFolder, type: type, items: items, overwrite: overwrite, copy: false, move: false) self.dismiss(animated: true, completion: nil) } func copyButtonPressed(_ sender: UIButton) { - delegate?.dismissSelect(serverUrl: serverUrl, metadata: metadataFolder, type: type, items: items, indexPath: selectIndexPath, overwrite: overwrite, copy: true, move: false) + delegate?.dismissSelect(serverUrl: serverUrl, metadata: metadataFolder, type: type, items: items, overwrite: overwrite, copy: true, move: false) self.dismiss(animated: true, completion: nil) } func moveButtonPressed(_ sender: UIButton) { - delegate?.dismissSelect(serverUrl: serverUrl, metadata: metadataFolder, type: type, items: items, indexPath: selectIndexPath, overwrite: overwrite, copy: false, move: true) + delegate?.dismissSelect(serverUrl: serverUrl, metadata: metadataFolder, type: type, items: items, overwrite: overwrite, copy: false, move: true) self.dismiss(animated: true, completion: nil) } @@ -257,8 +256,6 @@ class NCSelect: UIViewController, UIGestureRecognizerDelegate, UIAdaptivePresent viewController.type = type viewController.overwrite = overwrite viewController.items = items - viewController.selectIndexPath = selectIndexPath - viewController.titleCurrentFolder = metadata.fileNameView viewController.serverUrl = serverUrlPush @@ -280,7 +277,7 @@ extension NCSelect: UICollectionViewDelegate { } else { - delegate?.dismissSelect(serverUrl: serverUrl, metadata: metadata, type: type, items: items, indexPath: selectIndexPath, overwrite: overwrite, copy: false, move: false) + delegate?.dismissSelect(serverUrl: serverUrl, metadata: metadata, type: type, items: items, overwrite: overwrite, copy: false, move: false) self.dismiss(animated: true, completion: nil) } } @@ -677,7 +674,7 @@ struct SelectView: UIViewControllerRepresentable { self.parent = parent } - func dismissSelect(serverUrl: String?, metadata: tableMetadata?, type: String, items: [Any], indexPath: [IndexPath], overwrite: Bool, copy: Bool, move: Bool) { + func dismissSelect(serverUrl: String?, metadata: tableMetadata?, type: String, items: [Any], overwrite: Bool, copy: Bool, move: Bool) { if let serverUrl = serverUrl { self.parent.serverUrl = serverUrl } diff --git a/iOSClient/Settings/Acknowledgements.rtf b/iOSClient/Settings/Acknowledgements.rtf index 6ddfa6cb3e..0256340b18 100644 --- a/iOSClient/Settings/Acknowledgements.rtf +++ b/iOSClient/Settings/Acknowledgements.rtf @@ -53,8 +53,7 @@ h \f1\b \ OpenSSL\ -\pard\tx566\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\pardirnatural\partightenfactor0 -\cf0 \ +\ \f0\b0 https://www.openssl.org/source/license.html\ @@ -257,19 +256,16 @@ __________________________________\ MIT License\ \ Copyright (c) LIU Dongyuan\ -\pard\tx566\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\pardirnatural\partightenfactor0 -\cf0 __________________________________\ +__________________________________\ \ -\pard\tx566\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\pardirnatural\partightenfactor0 -\f1\b \cf0 swift-snapshot-testing\ +\f1\b swift-snapshot-testing\ \ \f0\b0 MIT License\ \ Copyright (c) Point-Free, Inc.\ -\pard\tx566\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\pardirnatural\partightenfactor0 -\cf0 __________________________________\ +__________________________________\ \ \pard\pardeftab720\partightenfactor0 @@ -312,12 +308,4 @@ MIT License\ \ Copyright (c) Nick Lockwood\ __________________________________\ -\ - -\f1\b SwipeCellKit -\f0\b0 \ -\ -MIT License \ -\ -Copyright (c) Jeremy Koch\ } \ No newline at end of file diff --git a/iOSClient/Settings/CCManageAutoUpload.m b/iOSClient/Settings/CCManageAutoUpload.m index 269379039f..545b358d57 100644 --- a/iOSClient/Settings/CCManageAutoUpload.m +++ b/iOSClient/Settings/CCManageAutoUpload.m @@ -418,7 +418,7 @@ - (NSString *)tableView:(UITableView *)tableView titleForFooterInSection:(NSInte return sectionName; } -- (void)dismissSelectWithServerUrl:(NSString * _Nullable)serverUrl metadata:(tableMetadata * _Nullable)metadata type:(NSString * _Nonnull)type items:(NSArray * _Nonnull)items indexPath:(NSArray * _Nonnull)indexPath overwrite:(BOOL)overwrite copy:(BOOL)copy move:(BOOL)move +- (void)dismissSelectWithServerUrl:(NSString * _Nullable)serverUrl metadata:(tableMetadata * _Nullable)metadata type:(NSString * _Nonnull)type items:(NSArray * _Nonnull)items overwrite:(BOOL)overwrite copy:(BOOL)copy move:(BOOL)move { if (serverUrl != nil) { diff --git a/iOSClient/Settings/NCManageAutoUploadFileName.swift b/iOSClient/Settings/NCManageAutoUploadFileName.swift index 13fbd79369..b927522e0d 100644 --- a/iOSClient/Settings/NCManageAutoUploadFileName.swift +++ b/iOSClient/Settings/NCManageAutoUploadFileName.swift @@ -119,9 +119,8 @@ class NCManageAutoUploadFileName: XLFormViewController { reloadForm() } - override func viewWillAppear(_ animated: Bool) { - super.viewWillAppear(animated) - + override func viewDidAppear(_ animated: Bool) { + super.viewDidAppear(animated) appDelegate.activeViewController = self } diff --git a/iOSClient/Settings/NCManageE2EE.swift b/iOSClient/Settings/NCManageE2EE.swift index 277411fcfb..f608533287 100644 --- a/iOSClient/Settings/NCManageE2EE.swift +++ b/iOSClient/Settings/NCManageE2EE.swift @@ -104,7 +104,7 @@ class NCManageE2EE: NSObject, ObservableObject, NCEndToEndInitializeDelegate, TO endToEndInitialize.initEndToEndEncryption() case "readPassphrase": if let e2ePassphrase = NCKeychain().getEndToEndPassphrase(account: appDelegate.account) { - print("[LOG]Passphrase: " + e2ePassphrase) + print("[INFO]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: { _ in })) diff --git a/iOSClient/Shares/NCShares.swift b/iOSClient/Shares/NCShares.swift index 5baee4c66d..d73d4e8c23 100644 --- a/iOSClient/Shares/NCShares.swift +++ b/iOSClient/Shares/NCShares.swift @@ -42,7 +42,6 @@ class NCShares: NCCollectionViewCommon { override func viewWillAppear(_ animated: Bool) { super.viewWillAppear(animated) - if dataSource.metadatas.isEmpty { reloadDataSource() } diff --git a/iOSClient/Transfers/NCTransfers.swift b/iOSClient/Transfers/NCTransfers.swift index d82e0a8d89..88d54110ee 100644 --- a/iOSClient/Transfers/NCTransfers.swift +++ b/iOSClient/Transfers/NCTransfers.swift @@ -54,7 +54,6 @@ class NCTransfers: NCCollectionViewCommon, NCTransferCellDelegate { override func viewWillAppear(_ animated: Bool) { super.viewWillAppear(animated) - reloadDataSource() } diff --git a/iOSClient/Trash/Cell/NCTrashGridCell.swift b/iOSClient/Trash/Cell/NCTrashGridCell.swift new file mode 100644 index 0000000000..74301db332 --- /dev/null +++ b/iOSClient/Trash/Cell/NCTrashGridCell.swift @@ -0,0 +1,287 @@ +// +// NCTrashGridCell.swift +// Nextcloud +// +// Created by Marino Faggiana on 19/03/2024. +// Copyright © 2024 Marino Faggiana. All rights reserved. +// +// Author Marino Faggiana +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// + +import UIKit + +class NCTrashGridCell: UICollectionViewCell, UIGestureRecognizerDelegate, NCCellProtocol, NCTrashCellProtocol { + + @IBOutlet weak var imageItem: UIImageView! + @IBOutlet weak var imageSelect: UIImageView! + @IBOutlet weak var imageStatus: UIImageView! + @IBOutlet weak var imageFavorite: UIImageView! + @IBOutlet weak var imageLocal: UIImageView! + @IBOutlet weak var labelTitle: UILabel! + @IBOutlet weak var labelInfo: UILabel! + @IBOutlet weak var labelSubinfo: UILabel! + @IBOutlet weak var buttonMore: UIButton! + @IBOutlet weak var imageVisualEffect: UIVisualEffectView! + + var objectId = "" + var indexPath = IndexPath() + private var user = "" + + weak var gridCellDelegate: NCTrashGridCellDelegate? + var namedButtonMore = "" + + var fileObjectId: String? { + get { return objectId } + set { objectId = newValue ?? "" } + } + var filePreviewImageView: UIImageView? { + get { return imageItem } + set { imageItem = newValue } + } + var fileUser: String? { + get { return user } + set { user = newValue ?? "" } + } + var fileTitleLabel: UILabel? { + get { return labelTitle } + set { labelTitle = newValue } + } + var fileInfoLabel: UILabel? { + get { return labelInfo } + set { labelInfo = newValue } + } + var fileSubinfoLabel: UILabel? { + get { return labelSubinfo } + set { labelSubinfo = newValue } + } + var fileSelectImage: UIImageView? { + get { return imageSelect } + set { imageSelect = newValue } + } + var fileStatusImage: UIImageView? { + get { return imageStatus } + set { imageStatus = newValue } + } + var fileLocalImage: UIImageView? { + get { return imageLocal } + set { imageLocal = newValue } + } + var fileFavoriteImage: UIImageView? { + get { return imageFavorite } + set { imageFavorite = newValue } + } + + override func awakeFromNib() { + super.awakeFromNib() + + // use entire cell as accessibility element + accessibilityHint = nil + accessibilityLabel = nil + accessibilityValue = nil + isAccessibilityElement = true + + imageItem.layer.cornerRadius = 6 + imageItem.layer.masksToBounds = true + + imageVisualEffect.layer.cornerRadius = 6 + imageVisualEffect.clipsToBounds = true + imageVisualEffect.alpha = 0.5 + + let longPressedGesture = UILongPressGestureRecognizer(target: self, action: #selector(longPress(gestureRecognizer:))) + longPressedGesture.minimumPressDuration = 0.5 + longPressedGesture.delegate = self + longPressedGesture.delaysTouchesBegan = true + self.addGestureRecognizer(longPressedGesture) + + let longPressedGestureMore = UILongPressGestureRecognizer(target: self, action: #selector(longPressInsideMore(gestureRecognizer:))) + longPressedGestureMore.minimumPressDuration = 0.5 + longPressedGestureMore.delegate = self + longPressedGestureMore.delaysTouchesBegan = true + buttonMore.addGestureRecognizer(longPressedGestureMore) + + labelTitle.text = "" + labelInfo.text = "" + labelSubinfo.text = "" + } + + override func prepareForReuse() { + super.prepareForReuse() + imageItem.backgroundColor = nil + accessibilityHint = nil + accessibilityLabel = nil + accessibilityValue = nil + } + + override func snapshotView(afterScreenUpdates afterUpdates: Bool) -> UIView? { + return nil + } + + @IBAction func touchUpInsideMore(_ sender: Any) { + gridCellDelegate?.tapMoreGridItem(with: objectId, namedButtonMore: namedButtonMore, image: imageItem.image, indexPath: indexPath, sender: sender) + } + + @objc func longPressInsideMore(gestureRecognizer: UILongPressGestureRecognizer) { + gridCellDelegate?.longPressMoreGridItem(with: objectId, namedButtonMore: namedButtonMore, indexPath: indexPath, gestureRecognizer: gestureRecognizer) + } + + @objc func longPress(gestureRecognizer: UILongPressGestureRecognizer) { + gridCellDelegate?.longPressGridItem(with: objectId, indexPath: indexPath, gestureRecognizer: gestureRecognizer) + } + + fileprivate func setA11yActions() { + let moreName = namedButtonMore == NCGlobal.shared.buttonMoreStop ? "_cancel_" : "_more_" + + self.accessibilityCustomActions = [ + UIAccessibilityCustomAction( + name: NSLocalizedString(moreName, comment: ""), + target: self, + selector: #selector(touchUpInsideMore)) + ] + } + + func setButtonMore(named: String, image: UIImage) { + namedButtonMore = named + buttonMore.setImage(image, for: .normal) + setA11yActions() + } + + func hideButtonMore(_ status: Bool) { + buttonMore.isHidden = status + } + + func selectMode(_ status: Bool) { + if status { + imageSelect.isHidden = false + buttonMore.isHidden = true + accessibilityCustomActions = nil + } else { + imageSelect.isHidden = true + imageVisualEffect.isHidden = true + buttonMore.isHidden = false + setA11yActions() + } + } + + func selected(_ status: Bool) { + if status { + if traitCollection.userInterfaceStyle == .dark { + imageVisualEffect.effect = UIBlurEffect(style: .dark) + imageVisualEffect.backgroundColor = .black + } else { + imageVisualEffect.effect = UIBlurEffect(style: .extraLight) + imageVisualEffect.backgroundColor = .lightGray + } + imageSelect.image = NCImageCache.images.checkedYes + imageVisualEffect.isHidden = false + } else { + imageSelect.isHidden = true + imageVisualEffect.isHidden = true + } + } + + func writeInfoDateSize(date: NSDate, size: Int64) { + + let dateFormatter = DateFormatter() + dateFormatter.dateStyle = .short + dateFormatter.timeStyle = .none + dateFormatter.locale = Locale.current + + labelInfo.text = dateFormatter.string(from: date as Date) + labelSubinfo.text = NCUtilityFileSystem().transformedSize(size) + } + + func setAccessibility(label: String, value: String) { + accessibilityLabel = label + accessibilityValue = value + } + + func setIconOutlines() { + if imageStatus.image != nil { + imageStatus.makeCircularBackground(withColor: .systemBackground) + } else { + imageStatus.backgroundColor = .clear + } + } +} + +protocol NCTrashGridCellDelegate: AnyObject { + func tapMoreGridItem(with objectId: String, namedButtonMore: String, image: UIImage?, indexPath: IndexPath, sender: Any) + func longPressMoreGridItem(with objectId: String, namedButtonMore: String, indexPath: IndexPath, gestureRecognizer: UILongPressGestureRecognizer) + func longPressGridItem(with objectId: String, indexPath: IndexPath, gestureRecognizer: UILongPressGestureRecognizer) +} + +// optional func +extension NCTrashGridCellDelegate { + func tapMoreGridItem(with objectId: String, namedButtonMore: String, image: UIImage?, indexPath: IndexPath, sender: Any) {} + func longPressMoreGridItem(with objectId: String, namedButtonMore: String, indexPath: IndexPath, gestureRecognizer: UILongPressGestureRecognizer) {} + func longPressGridItem(with objectId: String, indexPath: IndexPath, gestureRecognizer: UILongPressGestureRecognizer) {} +} + +// MARK: - Grid Layout + +class NCTrashGridLayout: UICollectionViewFlowLayout { + + var heightLabelPlusButton: CGFloat = 60 + var marginLeftRight: CGFloat = 10 + var itemForLine: CGFloat = 3 + var itemWidthDefault: CGFloat = 140 + + // MARK: - View Life Cycle + + override init() { + super.init() + + sectionHeadersPinToVisibleBounds = false + + minimumInteritemSpacing = 1 + minimumLineSpacing = marginLeftRight + + self.scrollDirection = .vertical + self.sectionInset = UIEdgeInsets(top: 10, left: marginLeftRight, bottom: 0, right: marginLeftRight) + } + + required init?(coder aDecoder: NSCoder) { + fatalError("init(coder:) has not been implemented") + } + + override var itemSize: CGSize { + get { + if let collectionView = collectionView { + + if collectionView.frame.width < 400 { + itemForLine = 3 + } else { + itemForLine = collectionView.frame.width / itemWidthDefault + } + + let itemWidth: CGFloat = (collectionView.frame.width - marginLeftRight * 2 - marginLeftRight * (itemForLine - 1)) / itemForLine + let itemHeight: CGFloat = itemWidth + heightLabelPlusButton + + return CGSize(width: itemWidth, height: itemHeight) + } + + // Default fallback + return CGSize(width: itemWidthDefault, height: itemWidthDefault) + } + set { + super.itemSize = newValue + } + } + + override func targetContentOffset(forProposedContentOffset proposedContentOffset: CGPoint) -> CGPoint { + return proposedContentOffset + } +} diff --git a/iOSClient/Trash/Cell/NCTrashGridCell.xib b/iOSClient/Trash/Cell/NCTrashGridCell.xib new file mode 100644 index 0000000000..5b0c14fdf7 --- /dev/null +++ b/iOSClient/Trash/Cell/NCTrashGridCell.xib @@ -0,0 +1,180 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/iOSClient/Trash/Cell/NCTrashListCell+NCTrashCellProtocol.swift b/iOSClient/Trash/Cell/NCTrashListCell.swift similarity index 95% rename from iOSClient/Trash/Cell/NCTrashListCell+NCTrashCellProtocol.swift rename to iOSClient/Trash/Cell/NCTrashListCell.swift index becd20ab0e..06f1fa5ad0 100644 --- a/iOSClient/Trash/Cell/NCTrashListCell+NCTrashCellProtocol.swift +++ b/iOSClient/Trash/Cell/NCTrashListCell.swift @@ -43,7 +43,7 @@ class NCTrashListCell: UICollectionViewCell, NCTrashCellProtocol { @IBOutlet weak var separator: UIView! @IBOutlet weak var separatorHeightConstraint: NSLayoutConstraint! - weak var delegate: NCTrashListCellDelegate? + weak var listCellDelegate: NCTrashListCellDelegate? var objectId = "" var indexPath = IndexPath() @@ -79,11 +79,11 @@ class NCTrashListCell: UICollectionViewCell, NCTrashCellProtocol { } @IBAction func touchUpInsideMore(_ sender: Any) { - delegate?.tapMoreListItem(with: objectId, image: imageItem.image, sender: sender) + listCellDelegate?.tapMoreListItem(with: objectId, image: imageItem.image, sender: sender) } @IBAction func touchUpInsideRestore(_ sender: Any) { - delegate?.tapRestoreListItem(with: objectId, image: imageItem.image, sender: sender) + listCellDelegate?.tapRestoreListItem(with: objectId, image: imageItem.image, sender: sender) } func selectMode(_ status: Bool) { diff --git a/iOSClient/Trash/NCTrash+CollectionView.swift b/iOSClient/Trash/NCTrash+CollectionView.swift index 0a9be37f25..b266ffabdb 100644 --- a/iOSClient/Trash/NCTrash+CollectionView.swift +++ b/iOSClient/Trash/NCTrash+CollectionView.swift @@ -21,15 +21,13 @@ // along with this program. If not, see . // -import Foundation +import Realm +import UIKit // MARK: UICollectionViewDelegate extension NCTrash: UICollectionViewDelegate { - func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) { - let tableTrash = datasource[indexPath.item] - guard !isEditMode else { if let index = selectOcId.firstIndex(of: tableTrash.fileId) { selectOcId.remove(at: index) @@ -37,14 +35,15 @@ extension NCTrash: UICollectionViewDelegate { selectOcId.append(tableTrash.fileId) } collectionView.reloadItems(at: [indexPath]) - setNavigationRightItems() + tabBarSelect.update(selectOcId: selectOcId) return } if tableTrash.directory, let ncTrash: NCTrash = UIStoryboard(name: "NCTrash", bundle: nil).instantiateInitialViewController() as? NCTrash { - ncTrash.trashPath = tableTrash.filePath + tableTrash.fileName + ncTrash.filePath = tableTrash.filePath + tableTrash.fileName ncTrash.titleCurrentFolder = tableTrash.trashbinFileName + ncTrash.filename = tableTrash.fileName self.navigationController?.pushViewController(ncTrash, animated: true) } } @@ -52,15 +51,12 @@ extension NCTrash: UICollectionViewDelegate { // MARK: UICollectionViewDataSource extension NCTrash: UICollectionViewDataSource { - func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int { emptyDataSet?.numberOfItemsInSection(datasource.count, section: section) - setNavigationRightItems() return datasource.count } func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell { - let tableTrash = datasource[indexPath.item] var image: UIImage? @@ -81,12 +77,11 @@ extension NCTrash: UICollectionViewDataSource { var cell: NCTrashCellProtocol & UICollectionViewCell if layoutForView?.layout == NCGlobal.shared.layoutList { - guard let listCell = collectionView.dequeueReusableCell(withReuseIdentifier: "listCell", for: indexPath) as? NCTrashListCell else { return UICollectionViewCell() } - listCell.delegate = self + guard let listCell = collectionView.dequeueReusableCell(withReuseIdentifier: "listCell", for: indexPath) as? NCTrashListCell else { return NCTrashListCell() } + listCell.listCellDelegate = self cell = listCell } else { - // GRID - guard let gridCell = collectionView.dequeueReusableCell(withReuseIdentifier: "gridCell", for: indexPath) as? NCGridCell else { return UICollectionViewCell() } + guard let gridCell = collectionView.dequeueReusableCell(withReuseIdentifier: "gridCell", for: indexPath) as? NCTrashGridCell else { return NCTrashGridCell() } gridCell.setButtonMore(named: NCGlobal.shared.buttonMoreMore, image: NCImageCache.images.buttonMore) gridCell.gridCellDelegate = self cell = gridCell @@ -103,7 +98,6 @@ extension NCTrash: UICollectionViewDataSource { } func setTextFooter(datasource: [tableTrash]) -> String { - var folders: Int = 0, foldersText = "" var files: Int = 0, filesText = "" var size: Int64 = 0 @@ -142,7 +136,6 @@ extension NCTrash: UICollectionViewDataSource { } func collectionView(_ collectionView: UICollectionView, viewForSupplementaryElementOfKind kind: String, at indexPath: IndexPath) -> UICollectionReusableView { - guard let footer = collectionView.dequeueReusableSupplementaryView(ofKind: kind, withReuseIdentifier: "sectionFooter", for: indexPath) as? NCSectionFooter else { return UICollectionReusableView() } diff --git a/iOSClient/Trash/NCTrash+Networking.swift b/iOSClient/Trash/NCTrash+Networking.swift new file mode 100644 index 0000000000..0a8bfd5c8f --- /dev/null +++ b/iOSClient/Trash/NCTrash+Networking.swift @@ -0,0 +1,107 @@ +// +// NCTrash+Networking.swift +// Nextcloud +// +// Created by Marino Faggiana on 18/03/24. +// Copyright © 2024 Marino Faggiana. All rights reserved. +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// + +import Realm +import UIKit +import NextcloudKit + +extension NCTrash { + @objc func loadListingTrash() { + NextcloudKit.shared.listingTrash(filename: filename, showHiddenFiles: false) { task in + self.dataSourceTask = task + self.collectionView.reloadData() + } completion: { account, items, _, error in + self.refreshControl.endRefreshing() + if account == self.appDelegate.account { + NCManageDatabase.shared.deleteTrash(filePath: self.getFilePath(), account: account) + NCManageDatabase.shared.addTrash(account: account, items: items) + } + self.reloadDataSource() + if error != .success { + NCContentPresenter().showError(error: error) + } + } + } + + func restoreItem(with fileId: String) { + guard let tableTrash = NCManageDatabase.shared.getTrashItem(fileId: fileId, account: appDelegate.account) else { return } + let fileNameFrom = tableTrash.filePath + tableTrash.fileName + let fileNameTo = appDelegate.urlBase + "/" + NextcloudKit.shared.nkCommonInstance.dav + "/trashbin/" + appDelegate.userId + "/restore/" + tableTrash.fileName + + NextcloudKit.shared.moveFileOrFolder(serverUrlFileNameSource: fileNameFrom, serverUrlFileNameDestination: fileNameTo, overwrite: true) { account, error in + guard error == .success, account == self.appDelegate.account else { + NCContentPresenter().showError(error: error) + return + } + NCManageDatabase.shared.deleteTrash(fileId: fileId, account: account) + self.reloadDataSource() + } + } + + func emptyTrash() { + let serverUrlFileName = appDelegate.urlBase + "/" + NextcloudKit.shared.nkCommonInstance.dav + "/trashbin/" + appDelegate.userId + "/trash" + + NextcloudKit.shared.deleteFileOrFolder(serverUrlFileName: serverUrlFileName) { account, error in + guard error == .success, account == self.appDelegate.account else { + NCContentPresenter().showError(error: error) + return + } + NCManageDatabase.shared.deleteTrash(fileId: nil, account: self.appDelegate.account) + self.reloadDataSource() + } + } + + func deleteItem(with fileId: String) { + guard let tableTrash = NCManageDatabase.shared.getTrashItem(fileId: fileId, account: appDelegate.account) else { return } + let serverUrlFileName = tableTrash.filePath + tableTrash.fileName + + NextcloudKit.shared.deleteFileOrFolder(serverUrlFileName: serverUrlFileName) { account, error in + guard error == .success, account == self.appDelegate.account else { + NCContentPresenter().showError(error: error) + return + } + NCManageDatabase.shared.deleteTrash(fileId: fileId, account: account) + self.reloadDataSource() + } + } + + func downloadThumbnail(with tableTrash: tableTrash, indexPath: IndexPath) { + let fileNamePreviewLocalPath = utilityFileSystem.getDirectoryProviderStoragePreviewOcId(tableTrash.fileId, etag: tableTrash.fileName) + let fileNameIconLocalPath = utilityFileSystem.getDirectoryProviderStorageIconOcId(tableTrash.fileId, etag: tableTrash.fileName) + + NextcloudKit.shared.downloadPreview(fileNamePathOrFileId: tableTrash.fileId, + fileNamePreviewLocalPath: fileNamePreviewLocalPath, + widthPreview: NCGlobal.shared.sizePreview, + heightPreview: NCGlobal.shared.sizePreview, + fileNameIconLocalPath: fileNameIconLocalPath, + sizeIcon: NCGlobal.shared.sizeIcon, + etag: nil, + endpointTrashbin: true) { account, _, imageIcon, _, _, error in + guard error == .success, let imageIcon = imageIcon, account == self.appDelegate.account, + let cell = self.collectionView.cellForItem(at: indexPath) else { return } + if let cell = cell as? NCTrashListCell { + cell.imageItem.image = imageIcon + } else if let cell = cell as? NCGridCell { + cell.imageItem.image = imageIcon + } // else: undefined cell + } + } +} diff --git a/iOSClient/Trash/NCTrash+SelectTabBarDelegate.swift b/iOSClient/Trash/NCTrash+SelectTabBarDelegate.swift new file mode 100644 index 0000000000..082de8be95 --- /dev/null +++ b/iOSClient/Trash/NCTrash+SelectTabBarDelegate.swift @@ -0,0 +1,75 @@ +// +// NCTrash+SelectTabBarDelegate.swift +// Nextcloud +// +// Created by Marino Faggiana on 18/03/24. +// Copyright © 2024 Marino Faggiana. All rights reserved. +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// + +import Foundation + +extension NCTrash: NCTrashSelectTabBarDelegate { + func onListSelected() { + if layoutForView?.layout == NCGlobal.shared.layoutGrid { + // list layout + layoutForView?.layout = NCGlobal.shared.layoutList + NCManageDatabase.shared.setLayoutForView(account: appDelegate.account, key: layoutKey, serverUrl: "", layout: layoutForView?.layout) + + self.collectionView.reloadData() + self.collectionView.collectionViewLayout.invalidateLayout() + self.collectionView.setCollectionViewLayout(self.listLayout, animated: true) + } + } + + func onGridSelected() { + if layoutForView?.layout == NCGlobal.shared.layoutList { + // grid layout + layoutForView?.layout = NCGlobal.shared.layoutGrid + NCManageDatabase.shared.setLayoutForView(account: appDelegate.account, key: layoutKey, serverUrl: "", layout: layoutForView?.layout) + + self.collectionView.reloadData() + self.collectionView.collectionViewLayout.invalidateLayout() + self.collectionView.setCollectionViewLayout(self.gridLayout, animated: true) + } + } + + func selectAll() { + if !selectOcId.isEmpty, datasource.count == selectOcId.count { + selectOcId = [] + } else { + selectOcId = self.datasource.compactMap({ $0.fileId }) + } + tabBarSelect.update(selectOcId: selectOcId) + collectionView.reloadData() + } + + func recover() { + selectOcId.forEach(restoreItem) + setEditMode(false) + } + + func delete() { + selectOcId.forEach(deleteItem) + setEditMode(false) + } + + func setEditMode(_ editMode: Bool) { + isEditMode = editMode + selectOcId.removeAll() + setNavigationRightItems(enableMenu: !editMode) + collectionView.reloadData() + } +} diff --git a/iOSClient/Trash/NCTrash.swift b/iOSClient/Trash/NCTrash.swift index 837b0be4ba..5902d92408 100644 --- a/iOSClient/Trash/NCTrash.swift +++ b/iOSClient/Trash/NCTrash.swift @@ -27,30 +27,28 @@ import Realm import UIKit import NextcloudKit -class NCTrash: UIViewController, NCTrashListCellDelegate, NCEmptyDataSetDelegate, NCGridCellDelegate { +class NCTrash: UIViewController, NCTrashListCellDelegate, NCTrashGridCellDelegate, NCEmptyDataSetDelegate { @IBOutlet weak var collectionView: UICollectionView! - var trashPath = "" + var filePath = "" var titleCurrentFolder = NSLocalizedString("_trash_view_", comment: "") var blinkFileId: String? var emptyDataSet: NCEmptyDataSet? - var selectableDataSource: [RealmSwiftObject] { datasource } var dataSourceTask: URLSessionTask? let appDelegate = (UIApplication.shared.delegate as? AppDelegate)! let utilityFileSystem = NCUtilityFileSystem() let utility = NCUtility() var isEditMode = false var selectOcId: [String] = [] - var selectIndexPaths: [IndexPath] = [] - var tabBarSelect: NCSelectableViewTabBar? + var tabBarSelect: NCTrashSelectTabBar! var datasource: [tableTrash] = [] var layoutForView: NCDBLayoutForView? var listLayout: NCListLayout! var gridLayout: NCGridLayout! var layoutKey = NCGlobal.shared.layoutViewTrash - - private let refreshControl = UIRefreshControl() + let refreshControl = UIRefreshControl() + var filename: String? // MARK: - View Life Cycle @@ -64,7 +62,7 @@ class NCTrash: UIViewController, NCTrashListCellDelegate, NCEmptyDataSetDelegate // Cell collectionView.register(UINib(nibName: "NCTrashListCell", bundle: nil), forCellWithReuseIdentifier: "listCell") - collectionView.register(UINib(nibName: "NCGridCell", bundle: nil), forCellWithReuseIdentifier: "gridCell") + collectionView.register(UINib(nibName: "NCTrashGridCell", bundle: nil), forCellWithReuseIdentifier: "gridCell") // Footer collectionView.register(UINib(nibName: "NCSectionFooter", bundle: nil), forSupplementaryViewOfKind: UICollectionView.elementKindSectionFooter, withReuseIdentifier: "sectionFooter") @@ -80,19 +78,16 @@ class NCTrash: UIViewController, NCTrashListCellDelegate, NCEmptyDataSetDelegate refreshControl.tintColor = .gray refreshControl.addTarget(self, action: #selector(loadListingTrash), for: .valueChanged) - // Empty emptyDataSet = NCEmptyDataSet(view: collectionView, offset: NCGlobal.shared.heightButtonsView, delegate: self) + setNavigationRightItems() NotificationCenter.default.addObserver(self, selector: #selector(reloadDataSource), name: NSNotification.Name(rawValue: NCGlobal.shared.notificationCenterReloadDataSource), object: nil) } override func viewWillAppear(_ animated: Bool) { - - appDelegate.activeViewController = self - + super.viewWillAppear(animated) navigationController?.setNavigationBarAppearance() navigationItem.title = titleCurrentFolder - layoutForView = NCManageDatabase.shared.getLayoutForView(account: appDelegate.account, key: NCGlobal.shared.layoutViewTrash, serverUrl: "") gridLayout.itemForLine = CGFloat(layoutForView?.itemForLine ?? 3) @@ -102,18 +97,18 @@ class NCTrash: UIViewController, NCTrashListCellDelegate, NCEmptyDataSetDelegate collectionView.collectionViewLayout = gridLayout } - setNavigationLeftItems() reloadDataSource() + loadListingTrash() } override func viewDidAppear(_ animated: Bool) { super.viewDidAppear(animated) - loadListingTrash() + appDelegate.activeViewController = self } - override func viewWillDisappear(_ animated: Bool) { - isEditMode = false - setNavigationLeftItems() + override func viewDidDisappear(_ animated: Bool) { + super.viewDidDisappear(animated) + setEditMode(false) } override func viewWillTransition(to size: CGSize, with coordinator: UIViewControllerTransitionCoordinator) { @@ -126,8 +121,49 @@ class NCTrash: UIViewController, NCTrashListCellDelegate, NCEmptyDataSetDelegate override func viewWillLayoutSubviews() { super.viewWillLayoutSubviews() + if let frame = tabBarController?.tabBar.frame { - (tabBarSelect as? NCTrashSelectTabBar)?.hostingController?.view.frame = frame + tabBarSelect.hostingController?.view.frame = frame + } + } + + // MARK: - Layout + + func setNavigationRightItems(enableMenu: Bool = false) { + func createMenuActions() -> [UIMenuElement] { + guard let layoutForView = NCManageDatabase.shared.getLayoutForView(account: appDelegate.account, key: layoutKey, serverUrl: "") else { return [] } + + let select = UIAction(title: NSLocalizedString("_select_", comment: ""), image: .init(systemName: "checkmark.circle"), attributes: self.datasource.isEmpty ? .disabled : []) { _ in + self.setEditMode(true) + } + let list = UIAction(title: NSLocalizedString("_list_", comment: ""), image: .init(systemName: "list.bullet"), state: layoutForView.layout == NCGlobal.shared.layoutList ? .on : .off) { _ in + self.onListSelected() + self.setNavigationRightItems() + } + let grid = UIAction(title: NSLocalizedString("_icons_", comment: ""), image: .init(systemName: "square.grid.2x2"), state: layoutForView.layout == NCGlobal.shared.layoutGrid ? .on : .off) { _ in + self.onGridSelected() + self.setNavigationRightItems() + } + let viewStyleSubmenu = UIMenu(title: "", options: .displayInline, children: [list, grid]) + + return [select, viewStyleSubmenu] + } + + if isEditMode { + tabBarSelect.update(selectOcId: selectOcId) + tabBarSelect.show() + let select = UIBarButtonItem(title: NSLocalizedString("_cancel_", comment: ""), style: .done) { + self.setEditMode(false) + } + navigationItem.rightBarButtonItems = [select] + } else { + tabBarSelect.hide() + if navigationItem.rightBarButtonItems == nil || enableMenu { + let menu = UIBarButtonItem(image: .init(systemName: "ellipsis.circle"), menu: UIMenu(children: createMenuActions())) + navigationItem.rightBarButtonItems = [menu] + } else { + navigationItem.rightBarButtonItems?.first?.menu = navigationItem.rightBarButtonItems?.first?.menu?.replacingChildren(createMenuActions()) + } } } @@ -163,7 +199,7 @@ class NCTrash: UIViewController, NCTrashListCellDelegate, NCEmptyDataSetDelegate } // else: undefined sender } - func tapMoreGridItem(with objectId: String, namedButtonMore: String, image: UIImage?, sender: Any) { + func tapMoreGridItem(with objectId: String, namedButtonMore: String, image: UIImage?, indexPath: IndexPath, sender: Any) { if !isEditMode { toggleMenuMore(with: objectId, image: image, isGridCell: true) @@ -183,13 +219,10 @@ class NCTrash: UIViewController, NCTrashListCellDelegate, NCEmptyDataSetDelegate @objc func reloadDataSource(withQueryDB: Bool = true) { layoutForView = NCManageDatabase.shared.getLayoutForView(account: appDelegate.account, key: NCGlobal.shared.layoutViewTrash, serverUrl: "") - datasource.removeAll() - guard let trashPath = self.getTrashPath(), let tashItems = NCManageDatabase.shared.getTrash(filePath: trashPath, sort: layoutForView?.sort, ascending: layoutForView?.ascending, account: appDelegate.account) else { - return - } - - datasource = tashItems + datasource = NCManageDatabase.shared.getTrash(filePath: getFilePath(), sort: layoutForView?.sort, ascending: layoutForView?.ascending, account: appDelegate.account) collectionView.reloadData() + setNavigationRightItems() + guard let blinkFileId = blinkFileId else { return } for itemIx in 0.. String? { - - if self.trashPath.isEmpty { - guard let userId = (appDelegate.userId as NSString).addingPercentEncoding(withAllowedCharacters: NSCharacterSet.urlFragmentAllowed) else { return nil } - let trashPath = appDelegate.urlBase + "/" + NextcloudKit.shared.nkCommonInstance.dav + "/trashbin/" + userId + "/trash/" - return trashPath - } else { - return self.trashPath - } - } -} - -// MARK: - NC API & Algorithm - -extension NCTrash { - - @objc func loadListingTrash() { - - NextcloudKit.shared.listingTrash(showHiddenFiles: false) { task in - self.dataSourceTask = task - self.collectionView.reloadData() - } completion: { account, items, _, error in - DispatchQueue.main.async { self.refreshControl.endRefreshing() } - guard error == .success, account == self.appDelegate.account, let trashPath = self.getTrashPath() else { - NCContentPresenter().showError(error: error) - return - } - NCManageDatabase.shared.deleteTrash(filePath: trashPath, account: self.appDelegate.account) - NCManageDatabase.shared.addTrash(account: account, items: items) - self.reloadDataSource() - } - } - - func restoreItem(with fileId: String) { - - guard let tableTrash = NCManageDatabase.shared.getTrashItem(fileId: fileId, account: appDelegate.account) else { return } - let fileNameFrom = tableTrash.filePath + tableTrash.fileName - let fileNameTo = appDelegate.urlBase + "/" + NextcloudKit.shared.nkCommonInstance.dav + "/trashbin/" + appDelegate.userId + "/restore/" + tableTrash.fileName - - NextcloudKit.shared.moveFileOrFolder(serverUrlFileNameSource: fileNameFrom, serverUrlFileNameDestination: fileNameTo, overwrite: true) { account, error in - - guard error == .success, account == self.appDelegate.account else { - NCContentPresenter().showError(error: error) - return - } - - NCManageDatabase.shared.deleteTrash(fileId: fileId, account: account) - self.reloadDataSource() - } - } - - func emptyTrash() { - - let serverUrlFileName = appDelegate.urlBase + "/" + NextcloudKit.shared.nkCommonInstance.dav + "/trashbin/" + appDelegate.userId + "/trash" - - NextcloudKit.shared.deleteFileOrFolder(serverUrlFileName: serverUrlFileName) { account, error in - - guard error == .success, account == self.appDelegate.account else { - NCContentPresenter().showError(error: error) - return - } - - NCManageDatabase.shared.deleteTrash(fileId: nil, account: self.appDelegate.account) - self.reloadDataSource() - } - } - - func deleteItem(with fileId: String) { - - guard let tableTrash = NCManageDatabase.shared.getTrashItem(fileId: fileId, account: appDelegate.account) else { return } - let serverUrlFileName = tableTrash.filePath + tableTrash.fileName - - NextcloudKit.shared.deleteFileOrFolder(serverUrlFileName: serverUrlFileName) { account, error in - - guard error == .success, account == self.appDelegate.account else { - NCContentPresenter().showError(error: error) - return - } - - NCManageDatabase.shared.deleteTrash(fileId: fileId, account: account) - self.reloadDataSource() - } - } - - func downloadThumbnail(with tableTrash: tableTrash, indexPath: IndexPath) { - - let fileNamePreviewLocalPath = utilityFileSystem.getDirectoryProviderStoragePreviewOcId(tableTrash.fileId, etag: tableTrash.fileName) - let fileNameIconLocalPath = utilityFileSystem.getDirectoryProviderStorageIconOcId(tableTrash.fileId, etag: tableTrash.fileName) - - NextcloudKit.shared.downloadPreview(fileNamePathOrFileId: tableTrash.fileId, - fileNamePreviewLocalPath: fileNamePreviewLocalPath, - widthPreview: NCGlobal.shared.sizePreview, - heightPreview: NCGlobal.shared.sizePreview, - fileNameIconLocalPath: fileNameIconLocalPath, - sizeIcon: NCGlobal.shared.sizeIcon, - etag: nil, - endpointTrashbin: true) { account, _, imageIcon, _, _, error in - guard error == .success, let imageIcon = imageIcon, account == self.appDelegate.account, - let cell = self.collectionView.cellForItem(at: indexPath) else { return } - if let cell = cell as? NCTrashListCell { - cell.imageItem.image = imageIcon - } else if let cell = cell as? NCGridCell { - cell.imageItem.image = imageIcon - } // else: undefined cell - } - } -} - -extension NCTrash: NCSelectableNavigationView, NCTrashSelectTabBarDelegate { - var serverUrl: String { - "" - } - - func setNavigationRightItems(enableMenu: Bool = false) { - guard let tabBarSelect = tabBarSelect as? NCTrashSelectTabBar else { return } - - tabBarSelect.isSelectedEmpty = selectOcId.isEmpty - if isEditMode { - tabBarSelect.show() - let select = UIBarButtonItem(title: NSLocalizedString("_cancel_", comment: ""), style: .done) { self.toggleSelect() } - navigationItem.rightBarButtonItems = [select] + func getFilePath() -> String { + if filePath.isEmpty { + guard let userId = (appDelegate.userId as NSString).addingPercentEncoding(withAllowedCharacters: NSCharacterSet.urlFragmentAllowed) else { return "" } + let filePath = appDelegate.urlBase + "/" + NextcloudKit.shared.nkCommonInstance.dav + "/trashbin/" + userId + "/trash" + return filePath + "/" } else { - tabBarSelect.hide() - let menu = UIMenu(children: createMenuActions()) - let menuButton = UIBarButtonItem(image: .init(systemName: "ellipsis.circle"), menu: menu) - menuButton.isEnabled = true - navigationItem.rightBarButtonItems = [menuButton] - } - } - - func onListSelected() { - if layoutForView?.layout == NCGlobal.shared.layoutGrid { - // list layout - layoutForView?.layout = NCGlobal.shared.layoutList - NCManageDatabase.shared.setLayoutForView(account: appDelegate.account, key: layoutKey, serverUrl: "", layout: layoutForView?.layout) - - self.collectionView.reloadData() - self.collectionView.collectionViewLayout.invalidateLayout() - self.collectionView.setCollectionViewLayout(self.listLayout, animated: true) - } - } - - func onGridSelected() { - if layoutForView?.layout == NCGlobal.shared.layoutList { - // grid layout - layoutForView?.layout = NCGlobal.shared.layoutGrid - NCManageDatabase.shared.setLayoutForView(account: appDelegate.account, key: layoutKey, serverUrl: "", layout: layoutForView?.layout) - - self.collectionView.reloadData() - self.collectionView.collectionViewLayout.invalidateLayout() - self.collectionView.setCollectionViewLayout(self.gridLayout, animated: true) - } - } - - func selectAll() { - collectionViewSelectAll() - } - - func recover() { - self.selectOcId.forEach(restoreItem) - self.toggleSelect() - } - - func delete() { - self.selectOcId.forEach(deleteItem) - self.toggleSelect() - } - - func createMenuActions() -> [UIMenuElement] { - guard let layoutForView = NCManageDatabase.shared.getLayoutForView(account: appDelegate.account, key: layoutKey, serverUrl: serverUrl) else { return [] } - - let select = UIAction(title: NSLocalizedString("_select_", comment: ""), image: .init(systemName: "checkmark.circle"), attributes: selectableDataSource.isEmpty ? .disabled : []) { _ in self.toggleSelect() } - - let list = UIAction(title: NSLocalizedString("_list_", comment: ""), image: .init(systemName: "list.bullet"), state: layoutForView.layout == NCGlobal.shared.layoutList ? .on : .off) { _ in - self.onListSelected() - self.setNavigationRightItems() - } - - let grid = UIAction(title: NSLocalizedString("_icons_", comment: ""), image: .init(systemName: "square.grid.2x2"), state: layoutForView.layout == NCGlobal.shared.layoutGrid ? .on : .off) { _ in - self.onGridSelected() - self.setNavigationRightItems() + return filePath + "/" } - - let viewStyleSubmenu = UIMenu(title: "", options: .displayInline, children: [list, grid]) - - return [select, viewStyleSubmenu] } } diff --git a/iOSClient/Trash/NCTrashSelectTabBar.swift b/iOSClient/Trash/NCTrashSelectTabBar.swift index 8ae1ba363d..14fe53315c 100644 --- a/iOSClient/Trash/NCTrashSelectTabBar.swift +++ b/iOSClient/Trash/NCTrashSelectTabBar.swift @@ -5,6 +5,19 @@ // Created by Milen on 05.02.24. // Copyright © 2024 Marino Faggiana. All rights reserved. // +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// import Foundation import SwiftUI @@ -15,13 +28,11 @@ protocol NCTrashSelectTabBarDelegate: AnyObject { func delete() } -class NCTrashSelectTabBar: NCSelectableViewTabBar, ObservableObject { +class NCTrashSelectTabBar: ObservableObject { var tabBarController: UITabBarController? var hostingController: UIViewController? open weak var delegate: NCTrashSelectTabBarDelegate? - var selectedMetadatas: [tableMetadata] = [] - @Published var isSelectedEmpty = true init(tabBarController: UITabBarController? = nil, delegate: NCTrashSelectTabBarDelegate? = nil) { @@ -63,6 +74,10 @@ class NCTrashSelectTabBar: NCSelectableViewTabBar, ObservableObject { hostingController.view.isHidden = true tabBarController.tabBar.isHidden = false } + + func update(selectOcId: [String]) { + isSelectedEmpty = selectOcId.isEmpty + } } struct NCTrashSelectTabBarView: View { @@ -98,7 +113,6 @@ struct NCTrashSelectTabBarView: View { } label: { Image(systemName: "checkmark") .imageScale(sizeClass == .compact ? .medium : .large) - } .frame(maxWidth: .infinity) } diff --git a/iOSClient/Viewer/NCViewer.swift b/iOSClient/Viewer/NCViewer.swift index b913af923b..ee25a44572 100644 --- a/iOSClient/Viewer/NCViewer.swift +++ b/iOSClient/Viewer/NCViewer.swift @@ -243,7 +243,7 @@ class NCViewer: NSObject { // MARK: - SELECT extension NCViewer: NCSelectDelegate { - func dismissSelect(serverUrl: String?, metadata: tableMetadata?, type: String, items: [Any], indexPath: [IndexPath], overwrite: Bool, copy: Bool, move: Bool) { + func dismissSelect(serverUrl: String?, metadata: tableMetadata?, type: String, items: [Any], overwrite: Bool, copy: Bool, move: Bool) { if let serverUrl = serverUrl, let metadata = items[0] as? tableMetadata { if move { diff --git a/iOSClient/Viewer/NCViewerMedia/NCPlayer/NCPlayerToolBar.swift b/iOSClient/Viewer/NCViewerMedia/NCPlayer/NCPlayerToolBar.swift index 9094db39d9..ec098bb452 100644 --- a/iOSClient/Viewer/NCViewerMedia/NCPlayer/NCPlayerToolBar.swift +++ b/iOSClient/Viewer/NCViewerMedia/NCPlayer/NCPlayerToolBar.swift @@ -459,7 +459,7 @@ extension NCPlayerToolBar { extension NCPlayerToolBar: NCSelectDelegate { - func dismissSelect(serverUrl: String?, metadata: tableMetadata?, type: String, items: [Any], indexPath: [IndexPath], overwrite: Bool, copy: Bool, move: Bool) { + func dismissSelect(serverUrl: String?, metadata: tableMetadata?, type: String, items: [Any], overwrite: Bool, copy: Bool, move: Bool) { if let metadata = metadata, let viewerMediaPage = viewerMediaPage { diff --git a/iOSClient/Viewer/NCViewerRichdocument/NCViewerRichDocument.swift b/iOSClient/Viewer/NCViewerRichdocument/NCViewerRichDocument.swift index 8eef5f835c..9f82d04d06 100644 --- a/iOSClient/Viewer/NCViewerRichdocument/NCViewerRichDocument.swift +++ b/iOSClient/Viewer/NCViewerRichdocument/NCViewerRichDocument.swift @@ -301,7 +301,7 @@ class NCViewerRichDocument: UIViewController, WKNavigationDelegate, WKScriptMess // MARK: - - func dismissSelect(serverUrl: String?, metadata: tableMetadata?, type: String, items: [Any], indexPath: [IndexPath], overwrite: Bool, copy: Bool, move: Bool) { + func dismissSelect(serverUrl: String?, metadata: tableMetadata?, type: String, items: [Any], overwrite: Bool, copy: Bool, move: Bool) { if let serverUrl, let metadata { @@ -314,7 +314,7 @@ class NCViewerRichDocument: UIViewController, WKNavigationDelegate, WKScriptMess } else if error != .success { NCContentPresenter().showError(error: error) } else { - print("[LOG] It has been changed user during networking process, error.") + print("[ERROR] It has been changed user during networking process, error.") } } } @@ -331,7 +331,7 @@ class NCViewerRichDocument: UIViewController, WKNavigationDelegate, WKScriptMess } else if error != .success { NCContentPresenter().showError(error: error) } else { - print("[LOG] It has been changed user during networking process, error.") + print("[ERROR] It has been changed user during networking process, error.") } } }