@@ -110,7 +110,8 @@ class NCCollectionViewCommon: UIViewController, UIGestureRecognizerDelegate, UIS
110110 searchController? . searchBar. delegate = self
111111 searchController? . searchBar. autocapitalizationType = . none
112112 navigationItem. searchController = searchController
113- navigationItem. hidesSearchBarWhenScrolling = true
113+ navigationItem. hidesSearchBarWhenScrolling = false
114+ navigationItem. backBarButtonItem = UIBarButtonItem ( title: NSLocalizedString ( " _back_ " , comment: " " ) , style: . plain, target: nil , action: nil )
114115 }
115116
116117 // Cell
@@ -164,6 +165,11 @@ class NCCollectionViewCommon: UIViewController, UIGestureRecognizerDelegate, UIS
164165 override func viewWillAppear( _ animated: Bool ) {
165166 super. viewWillAppear ( animated)
166167
168+ // Deselect items when back to previous view controller
169+ if isEditMode {
170+ self . tapSelect ( )
171+ }
172+
167173 appDelegate. activeViewController = self
168174
169175 layoutForView = NCManageDatabase . shared. getLayoutForView ( account: appDelegate. account, key: layoutKey, serverUrl: serverUrl)
@@ -264,10 +270,6 @@ class NCCollectionViewCommon: UIViewController, UIGestureRecognizerDelegate, UIS
264270 self . collectionView? . collectionViewLayout. invalidateLayout ( )
265271 self . collectionView? . reloadData ( )
266272 self . tipView? . dismiss ( )
267-
268- coordinator. animate ( alongsideTransition: nil ) { _ in
269- self . showTip ( )
270- }
271273 }
272274
273275 override var canBecomeFirstResponder : Bool {
@@ -281,11 +283,6 @@ class NCCollectionViewCommon: UIViewController, UIGestureRecognizerDelegate, UIS
281283 }
282284
283285 @objc func reloadAvatar( _ notification: NSNotification ) {
284-
285- DispatchQueue . main. asyncAfter ( deadline: . now( ) + 1.0 ) {
286- self . showTip ( )
287- }
288-
289286 guard let userInfo = notification. userInfo as NSDictionary ? ,
290287 let error = userInfo [ " error " ] as? NKError ,
291288 error. errorCode != NCGlobal . shared. errorNotModified else { return }
@@ -573,70 +570,12 @@ class NCCollectionViewCommon: UIViewController, UIGestureRecognizerDelegate, UIS
573570 navigationItem. title = titleCurrentFolder
574571
575572 guard layoutKey == NCGlobal . shared. layoutViewFiles else { return }
576-
577- // PROFILE BUTTON
578-
579- let activeAccount = NCManageDatabase . shared. getActiveAccount ( )
580-
581- let image = utility. loadUserImage (
582- for: appDelegate. user,
583- displayName: activeAccount? . displayName,
584- userBaseUrl: appDelegate)
585-
586- let button = UIButton ( type: . custom)
587- button. setImage ( image, for: . normal)
588-
589- if serverUrl == utilityFileSystem. getHomeServer ( urlBase: appDelegate. urlBase, userId: appDelegate. userId) {
590-
591- var titleButton = " "
592-
593- if getNavigationTitle ( ) == activeAccount? . alias {
594- titleButton = " "
595- } else {
596- titleButton += activeAccount? . displayName ?? " "
597- }
598-
599- button. setTitle ( titleButton, for: . normal)
600- button. setTitleColor ( . systemBlue, for: . normal)
601- }
602-
603- button. semanticContentAttribute = . forceLeftToRight
604- button. sizeToFit ( )
605- button. action ( for: . touchUpInside) { _ in
606-
607- let accounts = NCManageDatabase . shared. getAllAccountOrderAlias ( )
608- if !accounts. isEmpty, !NCBrandOptions. shared. disable_multiaccount, !NCBrandOptions. shared. disable_manage_account {
609-
610- if let vcAccountRequest = UIStoryboard ( name: " NCAccountRequest " , bundle: nil ) . instantiateInitialViewController ( ) as? NCAccountRequest {
611-
612- vcAccountRequest. activeAccount = NCManageDatabase . shared. getActiveAccount ( )
613- vcAccountRequest. accounts = accounts
614- vcAccountRequest. enableTimerProgress = false
615- vcAccountRequest. enableAddAccount = true
616- vcAccountRequest. delegate = self
617- vcAccountRequest. dismissDidEnterBackground = true
618-
619- let screenHeighMax = UIScreen . main. bounds. height - ( UIScreen . main. bounds. height / 5 )
620- let numberCell = accounts. count + 1
621- let height = min ( CGFloat ( numberCell * Int( vcAccountRequest. heightCell) + 45 ) , screenHeighMax)
622-
623- let popup = NCPopupViewController ( contentController: vcAccountRequest, popupWidth: 300 , popupHeight: height)
624-
625- self . present ( popup, animated: true )
626- }
627-
628- // TIP
629- self . dismissTip ( )
630- }
631- }
632- navigationItem. setLeftBarButton ( UIBarButtonItem ( customView: button) , animated: true )
633573 navigationItem. leftItemsSupplementBackButton = true
634574 if titlePreviusFolder == nil {
635575 navigationController? . navigationBar. topItem? . title = getNavigationTitle ( )
636576 } else {
637577 navigationController? . navigationBar. topItem? . title = titlePreviusFolder
638578 }
639- navigationItem. title = titleCurrentFolder
640579 }
641580
642581 func getNavigationTitle( ) -> String {
@@ -671,7 +610,7 @@ class NCCollectionViewCommon: UIViewController, UIGestureRecognizerDelegate, UIS
671610 view. emptyTitle. text = NSLocalizedString ( emptyTitle, comment: " " )
672611 view. emptyDescription. text = NSLocalizedString ( emptyDescription, comment: " " )
673612 } else {
674- view. emptyImage. image = UIImage ( named: " folder " ) ? . image ( color : NCBrandColor . shared . brandElement , size : UIScreen . main . bounds . width )
613+ view. emptyImage. image = UIImage ( named: " folder_nmcloud " )
675614 view. emptyTitle. text = NSLocalizedString ( " _files_no_files_ " , comment: " " )
676615 view. emptyDescription. text = NSLocalizedString ( " _no_file_pull_down_ " , comment: " " )
677616 }
@@ -1240,15 +1179,6 @@ extension NCCollectionViewCommon: UICollectionViewDataSource {
12401179 }
12411180 }
12421181 }
1243-
1244- // Avatar
1245- if !metadata. ownerId. isEmpty,
1246- metadata. ownerId != appDelegate. userId,
1247- appDelegate. account == metadata. account,
1248- let cell = cell as? NCCellProtocol {
1249- let fileName = metadata. userBaseUrl + " - " + metadata. ownerId + " .png "
1250- NCNetworking . shared. downloadAvatar ( user: metadata. ownerId, dispalyName: metadata. ownerDisplayName, fileName: fileName, cell: cell, view: collectionView, cellImageView: cell. fileAvatarImageView)
1251- }
12521182 }
12531183
12541184 func collectionView( _ collectionView: UICollectionView , didEndDisplaying cell: UICollectionViewCell , forItemAt indexPath: IndexPath ) {
@@ -1298,7 +1228,7 @@ extension NCCollectionViewCommon: UICollectionViewDataSource {
12981228 var isShare = false
12991229 var isMounted = false
13001230 var a11yValues : [ String ] = [ ]
1301-
1231+ let shares = NCManageDatabase . shared . getTableShares ( metadata : metadata )
13021232 if metadataFolder != nil {
13031233 isShare = metadata. permissions. contains ( NCGlobal . shared. permissionShared) && !metadataFolder!. permissions. contains ( NCGlobal . shared. permissionShared)
13041234 isMounted = metadata. permissions. contains ( NCGlobal . shared. permissionMounted) && !metadataFolder!. permissions. contains ( NCGlobal . shared. permissionMounted)
@@ -1325,7 +1255,7 @@ extension NCCollectionViewCommon: UICollectionViewDataSource {
13251255 cell. fileTitleLabel? . text = metadata. fileName
13261256 cell. fileTitleLabel? . lineBreakMode = . byTruncatingTail
13271257 if metadata. name == NCGlobal . shared. appName {
1328- cell. fileInfoLabel? . text = NSLocalizedString ( " _in_ " , comment : " " ) + " " + utilityFileSystem. getPath ( path : metadata. path , user : metadata . user )
1258+ cell. fileInfoLabel? . text = utility . dateDiff ( metadata . date as Date ) + " · " + utilityFileSystem. transformedSize ( metadata. size )
13291259 } else {
13301260 cell. fileInfoLabel? . text = metadata. subline
13311261 }
@@ -1352,7 +1282,7 @@ extension NCCollectionViewCommon: UICollectionViewDataSource {
13521282 cell. filePreviewImageView? . image = NCImageCache . images. folderEncrypted
13531283 } else if isShare {
13541284 cell. filePreviewImageView? . image = NCImageCache . images. folderSharedWithMe
1355- } else if !metadata. shareType. isEmpty {
1285+ } else if ( !metadata. shareType. isEmpty || ! ( shares . share ? . isEmpty ?? true ) || ( shares . firstShareLink != nil ) ) {
13561286 metadata. shareType. contains ( 3 ) ?
13571287 ( cell. filePreviewImageView? . image = NCImageCache . images. folderPublic) :
13581288 ( cell. filePreviewImageView? . image = NCImageCache . images. folderSharedWithMe)
@@ -1399,14 +1329,24 @@ extension NCCollectionViewCommon: UICollectionViewDataSource {
13991329 if isShare {
14001330 cell. fileSharedImage? . image = NCImageCache . images. shared
14011331 } else if !metadata. shareType. isEmpty {
1402- metadata. shareType. contains ( 3 ) ?
1403- ( cell. fileSharedImage? . image = NCImageCache . images. shareByLink) :
14041332 ( cell. fileSharedImage? . image = NCImageCache . images. shared)
14051333 } else {
1406- cell. fileSharedImage? . image = NCImageCache . images. canShare
1334+ cell. fileSharedImage? . image = NCImageCache . images. canShare. image ( color: NCBrandColor . shared. gray60, size: 50 )
1335+ cell. fileSharedLabel? . text = " "
14071336 }
1408- if appDelegate. account != metadata. account {
1409- cell. fileSharedImage? . image = NCImageCache . images. shared
1337+ cell. fileSharedLabel? . text = NSLocalizedString ( " _shared_ " , comment: " " )
1338+ cell. fileSharedLabel? . textColor = NCBrandColor . shared. customer
1339+ if ( !metadata. shareType. isEmpty || !( shares. share? . isEmpty ?? true ) || ( shares. firstShareLink != nil ) ) {
1340+ cell. fileSharedImage? . image = cell. fileSharedImage? . image? . imageColor ( NCBrandColor . shared. customer)
1341+ } else {
1342+ cell. fileSharedImage? . image = NCImageCache . images. canShare. image ( color: NCBrandColor . shared. gray60, size: 50 )
1343+ cell. fileSharedLabel? . text = " "
1344+ }
1345+
1346+ if metadata. permissions. contains ( " S " ) , ( metadata. permissions. range ( of: " S " ) != nil ) {
1347+ cell. fileSharedImage? . image = NCImageCache . images. sharedWithMe
1348+ cell. fileSharedLabel? . text = NSLocalizedString ( " _recieved_ " , comment: " " )
1349+ cell. fileSharedLabel? . textColor = NCBrandColor . shared. notificationAction
14101350 }
14111351
14121352 // Button More
@@ -1462,6 +1402,15 @@ extension NCCollectionViewCommon: UICollectionViewDataSource {
14621402 }
14631403 }
14641404
1405+ // Hide lines on iPhone
1406+ if !UIDevice. current. orientation. isLandscape && UIDevice . current. model. hasPrefix ( " iPhone " ) {
1407+ cell. cellSeparatorView? . isHidden = true
1408+ cell. fileSharedLabel? . isHidden = true
1409+ } else {
1410+ cell. cellSeparatorView? . isHidden = false
1411+ cell. fileSharedLabel? . isHidden = false
1412+ }
1413+
14651414 // Separator
14661415 if collectionView. numberOfItems ( inSection: indexPath. section) == indexPath. row + 1 || isSearchingMode {
14671416 cell. cellSeparatorView? . isHidden = true
@@ -1485,14 +1434,6 @@ extension NCCollectionViewCommon: UICollectionViewDataSource {
14851434 // Accessibility
14861435 cell. setAccessibility ( label: metadata. fileNameView + " , " + ( cell. fileInfoLabel? . text ?? " " ) , value: a11yValues. joined ( separator: " , " ) )
14871436
1488- // Color string find in search
1489- if isSearchingMode, let literalSearch = self . literalSearch, let title = cell. fileTitleLabel? . text {
1490- let longestWordRange = ( title. lowercased ( ) as NSString ) . range ( of: literalSearch)
1491- let attributedString = NSMutableAttributedString ( string: title, attributes: [ NSAttributedString . Key. font: UIFont . systemFont ( ofSize: 15 ) ] )
1492- attributedString. setAttributes ( [ NSAttributedString . Key. font: UIFont . boldSystemFont ( ofSize: 15 ) , NSAttributedString . Key. foregroundColor: UIColor . systemBlue] , range: longestWordRange)
1493- cell. fileTitleLabel? . attributedText = attributedString
1494- }
1495-
14961437 // Add TAGS
14971438 cell. setTags ( tags: Array ( metadata. tags) )
14981439
@@ -1527,13 +1468,6 @@ extension NCCollectionViewCommon: UICollectionViewDataSource {
15271468
15281469 header. delegate = self
15291470
1530- if !isSearchingMode, headerMenuTransferView, let ocId = NCNetworking . shared. transferInForegorund? . ocId {
1531- let text = String ( format: NSLocalizedString ( " _upload_foreground_msg_ " , comment: " " ) , NCBrandOptions . shared. brand)
1532- header. setViewTransfer ( isHidden: false , ocId: ocId, text: text, progress: NCNetworking . shared. transferInForegorund? . progress)
1533- } else {
1534- header. setViewTransfer ( isHidden: true )
1535- }
1536-
15371471 if headerMenuButtonsView {
15381472 header. setStatusButtonsView ( enable: !dataSource. getMetadataSourceForAllSections ( ) . isEmpty)
15391473 header. setButtonsView ( height: NCGlobal . shared. heightButtonsView)
@@ -1580,6 +1514,7 @@ extension NCCollectionViewCommon: UICollectionViewDataSource {
15801514
15811515 footer. setTitleLabel ( " " )
15821516 footer. setButtonText ( NSLocalizedString ( " _show_more_results_ " , comment: " " ) )
1517+ footer. buttonSection. setTitleColor ( NCBrandColor . shared. customer, for: . normal)
15831518 footer. separatorIsHidden ( true )
15841519 footer. buttonIsHidden ( true )
15851520 footer. hideActivityIndicatorSection ( )
@@ -1621,17 +1556,6 @@ extension NCCollectionViewCommon: UICollectionViewDelegateFlowLayout {
16211556
16221557 var size : CGFloat = 0
16231558
1624- // transfer in progress
1625- if headerMenuTransferView,
1626- let metadata = NCManageDatabase . shared. getMetadataFromOcId ( NCNetworking . shared. transferInForegorund? . ocId) ,
1627- metadata. isTransferInForeground {
1628- if !isSearchingMode {
1629- size += NCGlobal . shared. heightHeaderTransfer
1630- }
1631- } else {
1632- NCNetworking . shared. transferInForegorund = nil
1633- }
1634-
16351559 if headerMenuButtonsView {
16361560 size += NCGlobal . shared. heightButtonsView
16371561 }
0 commit comments