-
-
Notifications
You must be signed in to change notification settings - Fork 894
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* coding Signed-off-by: Marino Faggiana <[email protected]> * change name Signed-off-by: Marino Faggiana <[email protected]> * rename Signed-off-by: Marino Faggiana <[email protected]> * rename Signed-off-by: Marino Faggiana <[email protected]> * cod Signed-off-by: Marino Faggiana <[email protected]> * cleaning Signed-off-by: Marino Faggiana <[email protected]> * cleaning Signed-off-by: Marino Faggiana <[email protected]> * fix Signed-off-by: Marino Faggiana <[email protected]> * cod Signed-off-by: Marino Faggiana <[email protected]> * cod Signed-off-by: Marino Faggiana <[email protected]> --------- Signed-off-by: Marino Faggiana <[email protected]>
- Loading branch information
1 parent
4080815
commit 3efb493
Showing
27 changed files
with
638 additions
and
479 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
101 changes: 101 additions & 0 deletions
101
...ient/Main/Collection Common/NCCollectionViewCommon+CollectionViewDelegateFlowLayout.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
// | ||
// NCCollectionViewCommon+CollectionViewDelegateFlowLayout.swift | ||
// Nextcloud | ||
// | ||
// Created by Marino Faggiana on 19/07/24. | ||
// Copyright © 2024 Marino Faggiana. All rights reserved. | ||
// | ||
// Author Marino Faggiana <[email protected]> | ||
// | ||
// 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 <http://www.gnu.org/licenses/>. | ||
// | ||
|
||
import Foundation | ||
import UIKit | ||
|
||
extension NCCollectionViewCommon: UICollectionViewDelegateFlowLayout { | ||
func isHeaderMenuTransferViewEnabled() -> Bool { | ||
if headerMenuTransferView, let metadata = NCManageDatabase.shared.getMetadataFromOcId(NCNetworking.shared.transferInForegorund?.ocId), metadata.isTransferInForeground { | ||
return true | ||
} | ||
return false | ||
} | ||
|
||
func getHeaderHeight() -> CGFloat { | ||
var size: CGFloat = 0 | ||
|
||
if isHeaderMenuTransferViewEnabled() { | ||
if !isSearchingMode { | ||
size += NCGlobal.shared.heightHeaderTransfer | ||
} | ||
} else { | ||
NCNetworking.shared.transferInForegorund = nil | ||
} | ||
return size | ||
} | ||
|
||
func getHeaderHeight(section: Int) -> (heightHeaderCommands: CGFloat, heightHeaderRichWorkspace: CGFloat, heightHeaderSection: CGFloat) { | ||
var headerRichWorkspace: CGFloat = 0 | ||
|
||
if let richWorkspaceText = richWorkspaceText, showDescription { | ||
let trimmed = richWorkspaceText.trimmingCharacters(in: .whitespaces) | ||
if !trimmed.isEmpty && !isSearchingMode { | ||
headerRichWorkspace = UIScreen.main.bounds.size.height / 6 | ||
} | ||
} | ||
|
||
if isSearchingMode || layoutForView?.groupBy != "none" || dataSource.numberOfSections() > 1 { | ||
if section == 0 { | ||
return (getHeaderHeight(), headerRichWorkspace, NCGlobal.shared.heightSection) | ||
} else { | ||
return (0, 0, NCGlobal.shared.heightSection) | ||
} | ||
} else { | ||
return (getHeaderHeight(), headerRichWorkspace, 0) | ||
} | ||
} | ||
|
||
func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, referenceSizeForHeaderInSection section: Int) -> CGSize { | ||
var height: CGFloat = 0 | ||
|
||
if isEditMode { | ||
return CGSize.zero | ||
} else if dataSource.getMetadataSourceForAllSections().isEmpty { | ||
height = NCGlobal.shared.getHeightHeaderEmptyData(view: view, portraitOffset: emptyDataPortaitOffset, landscapeOffset: emptyDataLandscapeOffset, isHeaderMenuTransferViewEnabled: isHeaderMenuTransferViewEnabled()) | ||
} else { | ||
let (heightHeaderCommands, heightHeaderRichWorkspace, heightHeaderSection) = getHeaderHeight(section: section) | ||
height = heightHeaderCommands + heightHeaderRichWorkspace + heightHeaderSection | ||
} | ||
return CGSize(width: collectionView.frame.width, height: height) | ||
} | ||
|
||
func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, referenceSizeForFooterInSection section: Int) -> CGSize { | ||
let sections = dataSource.numberOfSections() | ||
let metadataForSection = self.dataSource.getMetadataForSection(section) | ||
let isPaginated = metadataForSection?.lastSearchResult?.isPaginated ?? false | ||
let metadatasCount: Int = metadataForSection?.lastSearchResult?.entries.count ?? 0 | ||
var size = CGSize(width: collectionView.frame.width, height: 0) | ||
|
||
if section == sections - 1 { | ||
size.height += NCGlobal.shared.endHeightFooter | ||
} else { | ||
size.height += NCGlobal.shared.heightFooter | ||
} | ||
|
||
if isSearchingMode && isPaginated && metadatasCount > 0 { | ||
size.height += NCGlobal.shared.heightFooterButton | ||
} | ||
return size | ||
} | ||
} |
70 changes: 70 additions & 0 deletions
70
iOSClient/Main/Collection Common/NCCollectionViewCommon+EasyTipView.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
// | ||
// NCCollectionViewCommon+EasyTipView.swift | ||
// Nextcloud | ||
// | ||
// Created by Marino Faggiana on 20/07/24. | ||
// Copyright © 2024 Marino Faggiana. All rights reserved. | ||
// | ||
// Author Marino Faggiana <[email protected]> | ||
// | ||
// 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 <http://www.gnu.org/licenses/>. | ||
// | ||
|
||
import Foundation | ||
import UIKit | ||
import EasyTipView | ||
|
||
extension NCCollectionViewCommon: EasyTipViewDelegate { | ||
func showTip() { | ||
guard !appDelegate.account.isEmpty, | ||
self is NCFiles, | ||
self.view.window != nil, | ||
!NCBrandOptions.shared.disable_multiaccount, | ||
self.serverUrl == utilityFileSystem.getHomeServer(urlBase: appDelegate.urlBase, userId: appDelegate.userId), | ||
let view = self.navigationItem.leftBarButtonItem?.customView, | ||
!NCManageDatabase.shared.tipExists(NCGlobal.shared.tipNCCollectionViewCommonAccountRequest) else { return } | ||
var preferences = EasyTipView.Preferences() | ||
|
||
preferences.drawing.foregroundColor = .white | ||
preferences.drawing.backgroundColor = NCBrandColor.shared.nextcloud | ||
preferences.drawing.textAlignment = .left | ||
preferences.drawing.arrowPosition = .top | ||
preferences.drawing.cornerRadius = 10 | ||
|
||
preferences.animating.dismissTransform = CGAffineTransform(translationX: 0, y: 100) | ||
preferences.animating.showInitialTransform = CGAffineTransform(translationX: 0, y: -100) | ||
preferences.animating.showInitialAlpha = 0 | ||
preferences.animating.showDuration = 1.5 | ||
preferences.animating.dismissDuration = 1.5 | ||
|
||
if appDelegate.tipView == nil { | ||
appDelegate.tipView = EasyTipView(text: NSLocalizedString("_tip_accountrequest_", comment: ""), preferences: preferences, delegate: self) | ||
appDelegate.tipView?.show(forView: view) | ||
} | ||
} | ||
|
||
func easyTipViewDidTap(_ tipView: EasyTipView) { | ||
NCManageDatabase.shared.addTip(NCGlobal.shared.tipNCCollectionViewCommonAccountRequest) | ||
} | ||
|
||
func easyTipViewDidDismiss(_ tipView: EasyTipView) { } | ||
|
||
func dismissTip() { | ||
if !NCManageDatabase.shared.tipExists(NCGlobal.shared.tipNCCollectionViewCommonAccountRequest) { | ||
NCManageDatabase.shared.addTip(NCGlobal.shared.tipNCCollectionViewCommonAccountRequest) | ||
} | ||
appDelegate.tipView?.dismiss() | ||
appDelegate.tipView = nil | ||
} | ||
} |
33 changes: 33 additions & 0 deletions
33
iOSClient/Main/Collection Common/NCCollectionViewCommon+EndToEndInitialize.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
// | ||
// NCCollectionViewCommon+EndToEndInitialize.swift | ||
// Nextcloud | ||
// | ||
// Created by Marino Faggiana on 20/07/24. | ||
// Copyright © 2024 Marino Faggiana. All rights reserved. | ||
// | ||
// Author Marino Faggiana <[email protected]> | ||
// | ||
// 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 <http://www.gnu.org/licenses/>. | ||
// | ||
|
||
import Foundation | ||
import UIKit | ||
|
||
extension NCCollectionViewCommon: NCEndToEndInitializeDelegate { | ||
func endToEndInitializeSuccess(metadata: tableMetadata?) { | ||
if let metadata { | ||
pushMetadata(metadata) | ||
} | ||
} | ||
} |
17 changes: 16 additions & 1 deletion
17
...ctionViewCommon+PhotoLayoutDelegate.swift → .../NCCollectionViewCommon+PhotoLayout.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,25 @@ | ||
// | ||
// File.swift | ||
// NCCollectionViewCommon+PhotoLayout.swift | ||
// Nextcloud | ||
// | ||
// Created by Marino Faggiana on 13/07/24. | ||
// Copyright © 2024 Marino Faggiana. All rights reserved. | ||
// | ||
// Author Marino Faggiana <[email protected]> | ||
// | ||
// 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 <http://www.gnu.org/licenses/>. | ||
// | ||
|
||
import Foundation | ||
import UIKit | ||
|
2 changes: 1 addition & 1 deletion
2
...tionViewCommon+SelectTabBarDelegate.swift → ...NCCollectionViewCommon+SelectTabBar.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.