@@ -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
@@ -172,6 +173,11 @@ class NCCollectionViewCommon: UIViewController, UIGestureRecognizerDelegate, UIS
172173 override func viewWillAppear( _ animated: Bool ) {
173174 super. viewWillAppear ( animated)
174175
176+ // Deselect items when back to previous view controller
177+ if isEditMode {
178+ self . tapSelect ( )
179+ }
180+
175181 appDelegate. activeViewController = self
176182
177183 layoutForView = NCManageDatabase . shared. getLayoutForView ( account: appDelegate. account, key: layoutKey, serverUrl: serverUrl)
@@ -285,10 +291,6 @@ class NCCollectionViewCommon: UIViewController, UIGestureRecognizerDelegate, UIS
285291 self . collectionView? . collectionViewLayout. invalidateLayout ( )
286292 self . collectionView? . reloadData ( )
287293 self . tipView? . dismiss ( )
288-
289- coordinator. animate ( alongsideTransition: nil ) { _ in
290- self . showTip ( )
291- }
292294 }
293295
294296 override var canBecomeFirstResponder : Bool {
@@ -302,11 +304,6 @@ class NCCollectionViewCommon: UIViewController, UIGestureRecognizerDelegate, UIS
302304 }
303305
304306 @objc func reloadAvatar( _ notification: NSNotification ) {
305-
306- DispatchQueue . main. asyncAfter ( deadline: . now( ) + 1.0 ) {
307- self . showTip ( )
308- }
309-
310307 guard let userInfo = notification. userInfo as NSDictionary ? ,
311308 let error = userInfo [ " error " ] as? NKError ,
312309 error. errorCode != NCGlobal . shared. errorNotModified else { return }
@@ -587,70 +584,12 @@ class NCCollectionViewCommon: UIViewController, UIGestureRecognizerDelegate, UIS
587584 navigationItem. title = titleCurrentFolder
588585
589586 guard layoutKey == NCGlobal . shared. layoutViewFiles else { return }
590-
591- // PROFILE BUTTON
592-
593- let activeAccount = NCManageDatabase . shared. getActiveAccount ( )
594-
595- let image = utility. loadUserImage (
596- for: appDelegate. user,
597- displayName: activeAccount? . displayName,
598- userBaseUrl: appDelegate)
599-
600- let button = UIButton ( type: . custom)
601- button. setImage ( image, for: . normal)
602-
603- if serverUrl == utilityFileSystem. getHomeServer ( urlBase: appDelegate. urlBase, userId: appDelegate. userId) {
604-
605- var titleButton = " "
606-
607- if getNavigationTitle ( ) == activeAccount? . alias {
608- titleButton = " "
609- } else {
610- titleButton += activeAccount? . displayName ?? " "
611- }
612-
613- button. setTitle ( titleButton, for: . normal)
614- button. setTitleColor ( . systemBlue, for: . normal)
615- }
616-
617- button. semanticContentAttribute = . forceLeftToRight
618- button. sizeToFit ( )
619- button. action ( for: . touchUpInside) { _ in
620-
621- let accounts = NCManageDatabase . shared. getAllAccountOrderAlias ( )
622- if !accounts. isEmpty, !NCBrandOptions. shared. disable_multiaccount, !NCBrandOptions. shared. disable_manage_account {
623-
624- if let vcAccountRequest = UIStoryboard ( name: " NCAccountRequest " , bundle: nil ) . instantiateInitialViewController ( ) as? NCAccountRequest {
625-
626- vcAccountRequest. activeAccount = NCManageDatabase . shared. getActiveAccount ( )
627- vcAccountRequest. accounts = accounts
628- vcAccountRequest. enableTimerProgress = false
629- vcAccountRequest. enableAddAccount = true
630- vcAccountRequest. delegate = self
631- vcAccountRequest. dismissDidEnterBackground = true
632-
633- let screenHeighMax = UIScreen . main. bounds. height - ( UIScreen . main. bounds. height / 5 )
634- let numberCell = accounts. count + 1
635- let height = min ( CGFloat ( numberCell * Int( vcAccountRequest. heightCell) + 45 ) , screenHeighMax)
636-
637- let popup = NCPopupViewController ( contentController: vcAccountRequest, popupWidth: 300 , popupHeight: height)
638-
639- self . present ( popup, animated: true )
640- }
641-
642- // TIP
643- self . dismissTip ( )
644- }
645- }
646- navigationItem. setLeftBarButton ( UIBarButtonItem ( customView: button) , animated: true )
647587 navigationItem. leftItemsSupplementBackButton = true
648588 if titlePreviusFolder == nil {
649589 navigationController? . navigationBar. topItem? . title = getNavigationTitle ( )
650590 } else {
651591 navigationController? . navigationBar. topItem? . title = titlePreviusFolder
652592 }
653- navigationItem. title = titleCurrentFolder
654593 }
655594
656595 func getNavigationTitle( ) -> String {
@@ -685,7 +624,7 @@ class NCCollectionViewCommon: UIViewController, UIGestureRecognizerDelegate, UIS
685624 view. emptyTitle. text = NSLocalizedString ( emptyTitle, comment: " " )
686625 view. emptyDescription. text = NSLocalizedString ( emptyDescription, comment: " " )
687626 } else {
688- view. emptyImage. image = UIImage ( named: " folder " ) ? . image ( color : NCBrandColor . shared . brandElement , size : UIScreen . main . bounds . width )
627+ view. emptyImage. image = UIImage ( named: " folder_nmcloud " )
689628 view. emptyTitle. text = NSLocalizedString ( " _files_no_files_ " , comment: " " )
690629 view. emptyDescription. text = NSLocalizedString ( " _no_file_pull_down_ " , comment: " " )
691630 }
@@ -1254,15 +1193,6 @@ extension NCCollectionViewCommon: UICollectionViewDataSource {
12541193 }
12551194 }
12561195 }
1257-
1258- // Avatar
1259- if !metadata. ownerId. isEmpty,
1260- metadata. ownerId != appDelegate. userId,
1261- appDelegate. account == metadata. account,
1262- let cell = cell as? NCCellProtocol {
1263- let fileName = metadata. userBaseUrl + " - " + metadata. ownerId + " .png "
1264- NCNetworking . shared. downloadAvatar ( user: metadata. ownerId, dispalyName: metadata. ownerDisplayName, fileName: fileName, cell: cell, view: collectionView, cellImageView: cell. fileAvatarImageView)
1265- }
12661196 }
12671197
12681198 func collectionView( _ collectionView: UICollectionView , didEndDisplaying cell: UICollectionViewCell , forItemAt indexPath: IndexPath ) {
@@ -1312,7 +1242,7 @@ extension NCCollectionViewCommon: UICollectionViewDataSource {
13121242 var isShare = false
13131243 var isMounted = false
13141244 var a11yValues : [ String ] = [ ]
1315-
1245+ let shares = NCManageDatabase . shared . getTableShares ( metadata : metadata )
13161246 if metadataFolder != nil {
13171247 isShare = metadata. permissions. contains ( NCGlobal . shared. permissionShared) && !metadataFolder!. permissions. contains ( NCGlobal . shared. permissionShared)
13181248 isMounted = metadata. permissions. contains ( NCGlobal . shared. permissionMounted) && !metadataFolder!. permissions. contains ( NCGlobal . shared. permissionMounted)
@@ -1339,7 +1269,7 @@ extension NCCollectionViewCommon: UICollectionViewDataSource {
13391269 cell. fileTitleLabel? . text = metadata. fileName
13401270 cell. fileTitleLabel? . lineBreakMode = . byTruncatingTail
13411271 if metadata. name == NCGlobal . shared. appName {
1342- cell. fileInfoLabel? . text = NSLocalizedString ( " _in_ " , comment : " " ) + " " + utilityFileSystem. getPath ( path : metadata. path , user : metadata . user )
1272+ cell. fileInfoLabel? . text = utility . dateDiff ( metadata . date as Date ) + " · " + utilityFileSystem. transformedSize ( metadata. size )
13431273 } else {
13441274 cell. fileInfoLabel? . text = metadata. subline
13451275 }
@@ -1366,7 +1296,7 @@ extension NCCollectionViewCommon: UICollectionViewDataSource {
13661296 cell. filePreviewImageView? . image = NCImageCache . images. folderEncrypted
13671297 } else if isShare {
13681298 cell. filePreviewImageView? . image = NCImageCache . images. folderSharedWithMe
1369- } else if !metadata. shareType. isEmpty {
1299+ } else if ( !metadata. shareType. isEmpty || ! ( shares . share ? . isEmpty ?? true ) || ( shares . firstShareLink != nil ) ) {
13701300 metadata. shareType. contains ( 3 ) ?
13711301 ( cell. filePreviewImageView? . image = NCImageCache . images. folderPublic) :
13721302 ( cell. filePreviewImageView? . image = NCImageCache . images. folderSharedWithMe)
@@ -1413,14 +1343,24 @@ extension NCCollectionViewCommon: UICollectionViewDataSource {
14131343 if isShare {
14141344 cell. fileSharedImage? . image = NCImageCache . images. shared
14151345 } else if !metadata. shareType. isEmpty {
1416- metadata. shareType. contains ( 3 ) ?
1417- ( cell. fileSharedImage? . image = NCImageCache . images. shareByLink) :
14181346 ( cell. fileSharedImage? . image = NCImageCache . images. shared)
14191347 } else {
1420- cell. fileSharedImage? . image = NCImageCache . images. canShare
1348+ cell. fileSharedImage? . image = NCImageCache . images. canShare. image ( color: NCBrandColor . shared. gray60, size: 50 )
1349+ cell. fileSharedLabel? . text = " "
14211350 }
1422- if appDelegate. account != metadata. account {
1423- cell. fileSharedImage? . image = NCImageCache . images. shared
1351+ cell. fileSharedLabel? . text = NSLocalizedString ( " _shared_ " , comment: " " )
1352+ cell. fileSharedLabel? . textColor = NCBrandColor . shared. customer
1353+ if ( !metadata. shareType. isEmpty || !( shares. share? . isEmpty ?? true ) || ( shares. firstShareLink != nil ) ) {
1354+ cell. fileSharedImage? . image = cell. fileSharedImage? . image? . imageColor ( NCBrandColor . shared. customer)
1355+ } else {
1356+ cell. fileSharedImage? . image = NCImageCache . images. canShare. image ( color: NCBrandColor . shared. gray60, size: 50 )
1357+ cell. fileSharedLabel? . text = " "
1358+ }
1359+
1360+ if metadata. permissions. contains ( " S " ) , ( metadata. permissions. range ( of: " S " ) != nil ) {
1361+ cell. fileSharedImage? . image = NCImageCache . images. sharedWithMe
1362+ cell. fileSharedLabel? . text = NSLocalizedString ( " _recieved_ " , comment: " " )
1363+ cell. fileSharedLabel? . textColor = NCBrandColor . shared. notificationAction
14241364 }
14251365
14261366 // Button More
@@ -1476,6 +1416,15 @@ extension NCCollectionViewCommon: UICollectionViewDataSource {
14761416 }
14771417 }
14781418
1419+ // Hide lines on iPhone
1420+ if !UIDevice. current. orientation. isLandscape && UIDevice . current. model. hasPrefix ( " iPhone " ) {
1421+ cell. cellSeparatorView? . isHidden = true
1422+ cell. fileSharedLabel? . isHidden = true
1423+ } else {
1424+ cell. cellSeparatorView? . isHidden = false
1425+ cell. fileSharedLabel? . isHidden = false
1426+ }
1427+
14791428 // Separator
14801429 if collectionView. numberOfItems ( inSection: indexPath. section) == indexPath. row + 1 || isSearchingMode {
14811430 cell. cellSeparatorView? . isHidden = true
@@ -1499,14 +1448,6 @@ extension NCCollectionViewCommon: UICollectionViewDataSource {
14991448 // Accessibility
15001449 cell. setAccessibility ( label: metadata. fileNameView + " , " + ( cell. fileInfoLabel? . text ?? " " ) , value: a11yValues. joined ( separator: " , " ) )
15011450
1502- // Color string find in search
1503- if isSearchingMode, let literalSearch = self . literalSearch, let title = cell. fileTitleLabel? . text {
1504- let longestWordRange = ( title. lowercased ( ) as NSString ) . range ( of: literalSearch)
1505- let attributedString = NSMutableAttributedString ( string: title, attributes: [ NSAttributedString . Key. font: UIFont . systemFont ( ofSize: 15 ) ] )
1506- attributedString. setAttributes ( [ NSAttributedString . Key. font: UIFont . boldSystemFont ( ofSize: 15 ) , NSAttributedString . Key. foregroundColor: UIColor . systemBlue] , range: longestWordRange)
1507- cell. fileTitleLabel? . attributedText = attributedString
1508- }
1509-
15101451 // Add TAGS
15111452 cell. setTags ( tags: Array ( metadata. tags) )
15121453
@@ -1530,7 +1471,7 @@ extension NCCollectionViewCommon: UICollectionViewDataSource {
15301471 let ( _, heightHeaderRichWorkspace, heightHeaderSection) = getHeaderHeight ( section: indexPath. section)
15311472
15321473 self . headerMenu = header
1533-
1474+ self . headerMenu ? . setViewTransfer ( isHidden : true )
15341475 if layoutForView? . layout == NCGlobal . shared. layoutGrid {
15351476 header. setImageSwitchList ( )
15361477 header. buttonSwitch. accessibilityLabel = NSLocalizedString ( " _list_view_ " , comment: " " )
@@ -1540,7 +1481,7 @@ extension NCCollectionViewCommon: UICollectionViewDataSource {
15401481 }
15411482
15421483 header. delegate = self
1543-
1484+
15441485 if !isSearchingMode, headerMenuTransferView, let ocId = NCNetworking . shared. transferInForegorund? . ocId {
15451486 let text = String ( format: NSLocalizedString ( " _upload_foreground_msg_ " , comment: " " ) , NCBrandOptions . shared. brand)
15461487 header. setViewTransfer ( isHidden: false , ocId: ocId, text: text, progress: NCNetworking . shared. transferInForegorund? . progress)
@@ -1594,6 +1535,7 @@ extension NCCollectionViewCommon: UICollectionViewDataSource {
15941535
15951536 footer. setTitleLabel ( " " )
15961537 footer. setButtonText ( NSLocalizedString ( " _show_more_results_ " , comment: " " ) )
1538+ footer. buttonSection. setTitleColor ( NCBrandColor . shared. customer, for: . normal)
15971539 footer. separatorIsHidden ( true )
15981540 footer. buttonIsHidden ( true )
15991541 footer. hideActivityIndicatorSection ( )
@@ -1634,7 +1576,6 @@ extension NCCollectionViewCommon: UICollectionViewDelegateFlowLayout {
16341576 func getHeaderHeight( ) -> CGFloat {
16351577
16361578 var size : CGFloat = 0
1637-
16381579 // transfer in progress
16391580 if headerMenuTransferView,
16401581 let metadata = NCManageDatabase . shared. getMetadataFromOcId ( NCNetworking . shared. transferInForegorund? . ocId) ,
@@ -1645,7 +1586,7 @@ extension NCCollectionViewCommon: UICollectionViewDelegateFlowLayout {
16451586 } else {
16461587 NCNetworking . shared. transferInForegorund = nil
16471588 }
1648-
1589+
16491590 if headerMenuButtonsView {
16501591 size += NCGlobal . shared. heightButtonsView
16511592 }
0 commit comments