Browse Source

clear code remove fastscroll lib

marinofaggiana 5 years ago
parent
commit
d38d7cbe46

+ 0 - 16
Nextcloud.xcodeproj/project.pbxproj

@@ -473,8 +473,6 @@
 		F7B174C822FAC0A8000B7579 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = F7B174C722FAC0A8000B7579 /* AppDelegate.m */; };
 		F7B2DEF01F976854007CF4D2 /* NYMnemonic.m in Sources */ = {isa = PBXBuildFile; fileRef = F7B2DEEF1F976785007CF4D2 /* NYMnemonic.m */; };
 		F7B2DEF11F976859007CF4D2 /* english.txt in Resources */ = {isa = PBXBuildFile; fileRef = F7B2DEED1F976785007CF4D2 /* english.txt */; };
-		F7B3FF37243A0F5D00BD9150 /* FastScrollTableView.swift in Sources */ = {isa = PBXBuildFile; fileRef = F7B3FF35243A0F5D00BD9150 /* FastScrollTableView.swift */; };
-		F7B3FF38243A0F5D00BD9150 /* FastScrollCollectionView.swift in Sources */ = {isa = PBXBuildFile; fileRef = F7B3FF36243A0F5D00BD9150 /* FastScrollCollectionView.swift */; };
 		F7B4F1CB1F44356F00B53B42 /* NCUchardet.m in Sources */ = {isa = PBXBuildFile; fileRef = F7B4F1C81F44356F00B53B42 /* NCUchardet.m */; };
 		F7B6ACD622FC2BD4008AB646 /* NCXMLCommentsParser.m in Sources */ = {isa = PBXBuildFile; fileRef = F7B6ACD422FC2BD3008AB646 /* NCXMLCommentsParser.m */; };
 		F7B6ACD722FC2BD4008AB646 /* NCXMLCommentsParser.m in Sources */ = {isa = PBXBuildFile; fileRef = F7B6ACD422FC2BD3008AB646 /* NCXMLCommentsParser.m */; };
@@ -1165,8 +1163,6 @@
 		F7B2DEED1F976785007CF4D2 /* english.txt */ = {isa = PBXFileReference; lastKnownFileType = text; path = english.txt; sourceTree = "<group>"; };
 		F7B2DEEE1F976785007CF4D2 /* NYMnemonic.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = NYMnemonic.h; sourceTree = "<group>"; };
 		F7B2DEEF1F976785007CF4D2 /* NYMnemonic.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = NYMnemonic.m; sourceTree = "<group>"; };
-		F7B3FF35243A0F5D00BD9150 /* FastScrollTableView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FastScrollTableView.swift; sourceTree = "<group>"; };
-		F7B3FF36243A0F5D00BD9150 /* FastScrollCollectionView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FastScrollCollectionView.swift; sourceTree = "<group>"; };
 		F7B4F1C71F44356F00B53B42 /* NCUchardet.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NCUchardet.h; sourceTree = "<group>"; };
 		F7B4F1C81F44356F00B53B42 /* NCUchardet.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = NCUchardet.m; sourceTree = "<group>"; };
 		F7B6ACD422FC2BD3008AB646 /* NCXMLCommentsParser.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = NCXMLCommentsParser.m; sourceTree = "<group>"; };
@@ -2245,15 +2241,6 @@
 			path = languages;
 			sourceTree = "<group>";
 		};
-		F7B3FF34243A0F5D00BD9150 /* FastScroll */ = {
-			isa = PBXGroup;
-			children = (
-				F7B3FF35243A0F5D00BD9150 /* FastScrollTableView.swift */,
-				F7B3FF36243A0F5D00BD9150 /* FastScrollCollectionView.swift */,
-			);
-			path = FastScroll;
-			sourceTree = "<group>";
-		};
 		F7B4F1C51F44356F00B53B42 /* NCUchardet */ = {
 			isa = PBXGroup;
 			children = (
@@ -2509,7 +2496,6 @@
 			children = (
 				F73CC0571E813DFF006E3047 /* BKPasscodeView */,
 				F754EEC321772B6100BB1CDF /* DropdownMenu */,
-				F7B3FF34243A0F5D00BD9150 /* FastScroll */,
 				F7B4F1C51F44356F00B53B42 /* NCUchardet */,
 				F760F75621F21F61006B1A73 /* PhotoEditor */,
 				F762CA9F1EACB66200B38484 /* XLForm */,
@@ -3306,7 +3292,6 @@
 				F762CB111EACB66200B38484 /* NSString+XLFormAdditions.m in Sources */,
 				F762CB081EACB66200B38484 /* XLFormOptionsViewController.m in Sources */,
 				F704B5E92430C0B800632F5F /* NCCreateFormUploadConflictCell.swift in Sources */,
-				F7B3FF38243A0F5D00BD9150 /* FastScrollCollectionView.swift in Sources */,
 				F72D404923D2082500A97FD0 /* NCViewerNextcloudText.swift in Sources */,
 				F73CC0721E813DFF006E3047 /* BKPasscodeLockScreenManager.m in Sources */,
 				F760F78B21F21F61006B1A73 /* UIImage+Crop.swift in Sources */,
@@ -3443,7 +3428,6 @@
 				F726EEEC1FED1C820030B9C8 /* NCEndToEndInitialize.swift in Sources */,
 				F79A65C62191D95E00FF6DCC /* NCSelect.swift in Sources */,
 				F7E0E1DC22327885006B0911 /* NCAudioRecorderViewController.swift in Sources */,
-				F7B3FF37243A0F5D00BD9150 /* FastScrollTableView.swift in Sources */,
 				F70CAE3A1F8CF31A008125FD /* NCEndToEndEncryption.m in Sources */,
 				3781B9B423DB2BC9006B4B1D /* CCFavorites+Menu.swift in Sources */,
 				F710D1F924057C9D00A6033D /* NCDetailViewController.swift in Sources */,

+ 0 - 403
iOSClient/Library/FastScroll/FastScrollCollectionView.swift

@@ -1,403 +0,0 @@
-//
-//  FastScrollCollectionView.swift
-//  FastScroll
-//
-//  Created by Arsene Huot on 15/06/2018.
-//  Copyright © 2018 Frichti. All rights reserved.
-//
-
-import Foundation
-import UIKit
-
-@objc public protocol FastScrollCollectionViewDelegate {
-    @objc func hideHandle()
-}
-
-open class FastScrollCollectionView: UICollectionView {
-    public enum BubbleFocus {
-        case first
-        case last
-        case dynamic
-    }
-    
-    // Bubble to display your information during scroll
-    public var deactivateBubble: Bool = false
-    public var bubble: UITextView?
-    public var bubbleFont: UIFont =  UIFont.systemFont(ofSize: 12.0)
-    public var bubbleTextSize: CGFloat = 12.0
-    public var bubbleTextColor: UIColor = UIColor.white
-    public var bubbleRadius: CGFloat = 20.0
-    public var bubblePadding: CGFloat = 12.0
-    public var bubbleMarginRight: CGFloat = 30.0
-    public var bubbleColor: UIColor = UIColor.darkGray
-    public var bubbleShadowColor: UIColor = UIColor.darkGray
-    public var bubbleShadowOpacity: Float = 0.7
-    public var bubbleShadowRadius: CGFloat = 3.0
-    public var bubbleShadowOffset: CGSize = CGSize(width: 0.0, height: 5.0)
-    public var bubbleFocus: BubbleFocus = .first
-    
-    // Handler to scroll
-    public var handle: UIView?
-    public var handleImage: UIImage?
-    public var handleWidth: CGFloat = 30.0
-    public var handleHeight: CGFloat = 30.0
-    public var handleRadius: CGFloat = 15.0
-    public var handleMarginRight: CGFloat = 6.0
-    public var handleShadowColor: UIColor = UIColor.darkGray
-    public var handleShadowOpacity: Float = 0.7
-    public var handleShadowOffset: CGSize = CGSize(width: 0.0, height: 5.0)
-    public var handleShadowRadius: CGFloat = 3.0
-    public var handleColor: UIColor = UIColor.darkGray
-    public var handleTimeToDisappear: CGFloat = 1.5
-    public var handleDisappearAnimationDuration: CGFloat = 0.2
-    fileprivate var handleTouched: Bool = false
-    
-    // Gesture center on handler
-    public var gestureHandleView: UIView?
-    public var gestureWidth: CGFloat = 50.0
-    public var gestureHeight: CGFloat = 50.0
-    
-    // Scrollbar
-    public var scrollbar: UIView?
-    public var scrollbarWidth: CGFloat = 2.0
-    public var scrollbarColor: UIColor = UIColor(red: 220.0 / 255.0, green: 220.0 / 255.0, blue: 220.0 / 255.0, alpha: 1.0)
-    public var scrollbarRadius: CGFloat = 1.0
-    public var scrollbarMarginTop: CGFloat = 40.0
-    public var scrollbarMarginBottom: CGFloat = 20.0
-    public var scrollbarMarginRight: CGFloat = 20.0
-    
-    // Timer to dismiss handle
-    fileprivate var handleTimer: Timer?
-    
-    // Action callback
-    public var bubbleNameForIndexPath: (IndexPath) -> String = { _ in return ""}
-    
-    // Delegate
-    public var fastScrollDelegate: FastScrollCollectionViewDelegate?
-    
-    // MARK: LifeCycle
-    
-    override open func draw(_ rect: CGRect) {
-        super.draw(rect)
-        setup()
-        setupCollectionView()
-    }
-    
-    // MARK: Setups
-    
-    fileprivate func setupCollectionView() {
-        showsVerticalScrollIndicator = false
-    }
-    
-    public func setup() {
-        cleanViews()
-        
-        setupScrollbar()
-        setupHandle()
-        setupBubble()
-    }
-    
-    public func cleanViews() {
-        guard let bubble = bubble, let handle = handle, let scrollbar = scrollbar, let gestureHandleView = gestureHandleView else {
-            return
-        }
-        
-        bubble.removeFromSuperview()
-        handle.removeFromSuperview()
-        scrollbar.removeFromSuperview()
-        gestureHandleView.removeFromSuperview()
-        
-        self.bubble = nil
-        self.handle = nil
-        self.scrollbar = nil
-        self.gestureHandleView = nil
-    }
-    
-    fileprivate func setupHandle() {
-        if handle == nil {
-            handle = UIView(frame: CGRect(x: self.frame.width - handleWidth - handleMarginRight, y: scrollbarMarginTop, width: handleWidth, height: handleHeight))
-            self.superview?.addSubview(handle!)
-            
-            gestureHandleView  = UIView(frame: CGRect(x: 0.0, y: 0.0, width: gestureWidth, height: gestureHeight))
-            gestureHandleView!.center = handle!.center
-            
-            self.superview?.addSubview(handle!)
-            self.superview?.addSubview(gestureHandleView!)
-        }
-        
-        //config layer
-        handle!.backgroundColor = handleColor
-        handle!.layer.cornerRadius = handleRadius
-        handle!.layer.shadowColor = handleShadowColor.cgColor
-        handle!.layer.shadowOffset = handleShadowOffset
-        handle!.layer.shadowRadius = handleShadowRadius
-        handle!.layer.shadowOpacity = handleShadowOpacity
-        
-        //set imageView
-        if let handleImage = handleImage {
-            let imageView = UIImageView(frame: CGRect(x: 0, y: 0, width: handleWidth, height: handleHeight))
-            imageView.image = handleImage
-            handle!.addSubview(imageView)
-        }
-        
-        //set gesture
-        let panGesture = UIPanGestureRecognizer(target: self, action: #selector(handlePanGesture(_:)))
-        gestureHandleView!.addGestureRecognizer(panGesture)
-        
-        //hide
-        handle!.alpha = 0.0
-        handle!.isHidden = true
-        gestureHandleView!.isHidden = true
-        
-        //position
-        positionHandle(scrollbarMarginTop)
-    }
-    
-    fileprivate func setupBubble() {
-        if bubble == nil {
-            bubble = UITextView()
-            self.superview?.addSubview(bubble!)
-        }
-        
-        bubble!.font = bubbleFont
-        bubble!.font = UIFont(name: bubbleFont.fontName, size: bubbleTextSize)
-        bubble!.text = "Test"
-        bubble!.textColor = bubbleTextColor
-        bubble!.textAlignment = NSTextAlignment.center
-        bubble!.textContainerInset = UIEdgeInsets(top: bubblePadding, left: bubblePadding, bottom: bubblePadding, right: bubblePadding)
-        bubble!.contentMode = UIView.ContentMode.scaleAspectFit
-        bubble!.sizeToFit()
-        
-        bubble!.backgroundColor = bubbleColor
-        bubble!.layer.cornerRadius = bubbleRadius
-        bubble!.layer.shadowColor = bubbleShadowColor.cgColor
-        bubble!.layer.shadowOffset = bubbleShadowOffset
-        bubble!.layer.shadowRadius = bubbleRadius
-        bubble!.layer.shadowOpacity = bubbleShadowOpacity
-        bubble!.layer.shadowRadius = bubbleShadowRadius
-        bubble!.layer.masksToBounds = false
-        
-        bubble!.isHidden = true
-        
-        updateBubblePosition()
-    }
-    
-    fileprivate func setupScrollbar() {
-        guard let superview = self.superview else {
-            return
-        }
-        
-        if scrollbar == nil {
-            scrollbar = UIView(frame: CGRect(x: self.frame.width - scrollbarWidth - scrollbarMarginRight, y: scrollbarMarginTop, width: scrollbarWidth, height: superview.bounds.height - scrollbarMarginBottom - scrollbarMarginTop))
-            self.superview?.addSubview(scrollbar!)
-        }
-        
-        scrollbar!.backgroundColor = scrollbarColor
-        scrollbar!.layer.cornerRadius = scrollbarRadius
-        scrollbar!.alpha = 0.0
-        scrollbar!.isHidden = true
-    }
-    
-    // MARK: Helpers
-    @objc func hideHandle() {
-        guard let handle = handle, let scrollbar = scrollbar, let gestureHandleView = gestureHandleView else {
-            return
-        }
-        
-        if gestureHandleView.isHidden == false {
-            self.fastScrollDelegate?.hideHandle()
-        }
-        
-        gestureHandleView.isHidden = true
-        
-        UIView.animate(withDuration: TimeInterval(handleDisappearAnimationDuration), animations: {
-            handle.alpha = 0.0
-            scrollbar.alpha = 0.0
-        }, completion: { finished in
-            if finished {
-                handle.isHidden = true
-                scrollbar.isHidden = true
-            }
-        })
-    }
-    
-    fileprivate func updateBubblePosition() {
-        guard let scrollbar = scrollbar, let bubble = bubble, let handle = handle else {
-            return
-        }
-        
-        bubble.frame.origin.x = scrollbar.frame.origin.x - bubble.frame.size.width - bubbleMarginRight
-        bubble.center.y = handle.center.y
-    }
-    
-    fileprivate func positionHandle(_ y: CGFloat) {
-        guard let handle = handle, let scrollbar = scrollbar, let gestureHandleView = gestureHandleView else {
-            return
-        }
-        
-        handle.frame.origin.y = y >= scrollbarMarginTop ?
-            (y > scrollbarMarginTop + scrollbar.frame.height - handle.frame.height) ? scrollbarMarginTop + scrollbar.frame.height - handle.frame.height : y
-            :
-        scrollbarMarginTop
-        
-        gestureHandleView.center = handle.center
-    }
-    
-    fileprivate func scrollCollectionFromHandle() {
-        guard let handle = handle, let scrollbar = scrollbar else {
-            return
-        }
-        
-        let collectionContentHeight = self.contentSize.height - self.bounds.height
-        let scrollBarHeight = scrollbar.frame.height
-        
-        let scrollY = (handle.frame.origin.y - scrollbarMarginTop) * (collectionContentHeight / (scrollBarHeight - handle.frame.size.height))
-        
-        self.setContentOffset(CGPoint(x: 0.0, y: scrollY), animated: false)
-    }
-    
-    @objc func handlePanGesture(_ panGesture: UIPanGestureRecognizer) {
-        guard let superview = superview, let bubble = bubble, let handle = handle, let scrollbar = scrollbar, let gestureHandleView = gestureHandleView  else {
-            return
-        }
-        
-        // get translation
-        let translation = panGesture.translation(in: superview)
-        panGesture.setTranslation(CGPoint.zero, in: superview)
-        
-        // manage start stop pan
-        if panGesture.state == UIGestureRecognizer.State.began {
-            bubble.isHidden = deactivateBubble ? true : false
-            handleTouched = true
-            
-            //invalid hide timer
-            if let handleTimer = handleTimer {
-                handleTimer.invalidate()
-            }
-            
-            handle.alpha = 1.0
-            scrollbar.alpha = 1.0
-            handle.isHidden = false
-            scrollbar.isHidden = false
-            gestureHandleView.isHidden = false
-        }
-        
-        if panGesture.state == UIGestureRecognizer.State.ended {
-            bubble.isHidden = true
-            handleTouched = false
-            if contentOffset.y < 0 {
-                self.setContentOffset(CGPoint(x: 0.0, y: 0), animated: false)
-            }
-            self.handleTimer = Timer.scheduledTimer(timeInterval: TimeInterval(handleTimeToDisappear), target: self, selector: #selector(hideHandle), userInfo: nil, repeats: false)
-        }
-        
-        if panGesture.state == UIGestureRecognizer.State.changed {
-            //invalid hide timer
-            if let handleTimer = handleTimer {
-                handleTimer.invalidate()
-            }
-            
-            handle.alpha = 1.0
-            scrollbar.alpha = 1.0
-            handle.isHidden = false
-            scrollbar.isHidden = false
-            gestureHandleView.isHidden = false
-        }
-        
-        // views positions
-        positionHandle(handle.frame.origin.y + translation.y)
-        updateBubblePosition()
-        scrollCollectionFromHandle()
-        
-        // manage bubble info
-        manageBubbleInfo()
-    }
-    
-    fileprivate func manageBubbleInfo() {
-        guard let bubble = bubble else {
-            return
-        }
-        
-        let visibleCells = self.visibleCells
-        
-        var currentCellIndex: Int
-        
-        switch bubbleFocus {
-        case .first:
-            currentCellIndex = 0
-            
-        case .last:
-            currentCellIndex = visibleCells.count - 1
-            
-        case .dynamic:
-            //Calcul scroll percentage
-            let scrollY =  contentOffset.y
-            let collectionContentHeight = self.contentSize.height > self.bounds.height ? self.contentSize.height - self.bounds.height : self.bounds.height
-            let scrollPercentage = scrollY / collectionContentHeight
-            currentCellIndex = Int(floor(CGFloat(visibleCells.count) * scrollPercentage))
-            if currentCellIndex < 0 {
-                currentCellIndex = 0
-            }
-        }
-        
-        if currentCellIndex < visibleCells.count {
-            if let indexPath = indexPath(for: visibleCells[currentCellIndex]) {
-                bubble.text = bubbleNameForIndexPath(indexPath)
-                let newSize = bubble.sizeThatFits(CGSize(width: self.bounds.width - (self.bounds.width - (bubble.frame.origin.x + bubble.frame.size.width)), height: bubble.frame.size.height))
-                let oldSize = bubble.frame.size
-                bubble.frame = CGRect(x: bubble.frame.origin.x + (oldSize.width - newSize.width), y: bubble.frame.origin.y, width: newSize.width, height: newSize.height)
-            }
-        }
-    }
-}
-
-// MARK: Scroll Management
-
-extension FastScrollCollectionView {
-    public func scrollViewWillBeginDragging(_ scrollView: UIScrollView) {
-        guard let handle = handle, let scrollbar = scrollbar, let gestureHandleView = gestureHandleView else {
-            return
-        }
-        
-        handle.alpha = 1.0
-        scrollbar.alpha = 1.0
-        handle.isHidden = false
-        scrollbar.isHidden = false
-        gestureHandleView.isHidden = false
-    }
-    
-    public func scrollViewDidEndDragging(_ scrollView: UIScrollView, willDecelerate decelerate: Bool) {
-        if !decelerate {
-            self.handleTimer = Timer.scheduledTimer(timeInterval: TimeInterval(handleTimeToDisappear), target: self, selector: #selector(hideHandle), userInfo: nil, repeats: false)
-        }
-    }
-    
-    public func scrollViewDidEndDecelerating(_ scrollView: UIScrollView) {
-        self.handleTimer = Timer.scheduledTimer(timeInterval: TimeInterval(handleTimeToDisappear), target: self, selector: #selector(hideHandle), userInfo: nil, repeats: false)
-    }
-    
-    public func scrollViewDidScroll(_ scrollView: UIScrollView) {
-        guard let handle = handle, let scrollbar = scrollbar else {
-            return
-        }
-        
-        //invalid timer
-        if let handleTimer = handleTimer {
-            handleTimer.invalidate()
-        }
-        
-        //scroll position
-        let scrollY =  scrollView.contentOffset.y
-        let collectionContentHeight = self.contentSize.height > self.bounds.height ? self.contentSize.height - self.bounds.height : self.bounds.height
-        let scrollBarHeight = scrollbar.frame.height
-        
-        
-        let handlePosition = (scrollY / collectionContentHeight) * (scrollBarHeight - handle.frame.size.height) + scrollbarMarginTop
-        if (handleTouched == false) {
-            positionHandle(handlePosition)
-        }
-        
-        updateBubblePosition()
-    }
-}
-

+ 0 - 387
iOSClient/Library/FastScroll/FastScrollTableView.swift

@@ -1,387 +0,0 @@
-//
-//  FastScrollTableView.swift
-//  FastScroll
-//
-//  Created by Arsene Huot on 15/06/2018.
-//  Copyright © 2018 Frichti. All rights reserved.
-//
-
-import Foundation
-import UIKit
-
-open class FastScrollTableView: UITableView {
-    public enum BubbleFocus {
-        case first
-        case last
-        case dynamic
-    }
-    
-    // Bubble to display your information during scroll
-    public var deactivateBubble: Bool = false
-    public var bubble: UITextView?
-    public var bubbleFont: UIFont =  UIFont.systemFont(ofSize: 12.0)
-    public var bubbleTextSize: CGFloat = 12.0
-    public var bubbleTextColor: UIColor = UIColor.white
-    public var bubbleRadius: CGFloat = 20.0
-    public var bubblePadding: CGFloat = 12.0
-    public var bubbleMarginRight: CGFloat = 30.0
-    public var bubbleColor: UIColor = UIColor.darkGray
-    public var bubbleShadowColor: UIColor = UIColor.darkGray
-    public var bubbleShadowOpacity: Float = 0.7
-    public var bubbleShadowRadius: CGFloat = 3.0
-    public var bubbleShadowOffset: CGSize = CGSize(width: 0.0, height: 5.0)
-    public var bubbleFocus: BubbleFocus = .first
-    
-    // Handler to scroll
-    public var handle: UIView?
-    public var handleImage: UIImage?
-    public var handleWidth: CGFloat = 30.0
-    public var handleHeight: CGFloat = 30.0
-    public var handleRadius: CGFloat = 15.0
-    public var handleMarginRight: CGFloat = 6.0
-    public var handleShadowColor: UIColor = UIColor.darkGray
-    public var handleShadowOpacity: Float = 0.7
-    public var handleShadowOffset: CGSize = CGSize(width: 0.0, height: 5.0)
-    public var handleShadowRadius: CGFloat = 3.0
-    public var handleColor: UIColor = UIColor.darkGray
-    public var handleTimeToDisappear: CGFloat = 1.5
-    public var handleDisappearAnimationDuration: CGFloat = 0.2
-    fileprivate var handleTouched: Bool = false
-    
-    // Gesture center on handler
-    public var gestureHandleView: UIView?
-    public var gestureWidth: CGFloat = 50.0
-    public var gestureHeight: CGFloat = 50.0
-    
-    // Scrollbar
-    public var scrollbar: UIView?
-    public var scrollbarWidth: CGFloat = 2.0
-    public var scrollbarColor: UIColor = UIColor(red: 220.0 / 255.0, green: 220.0 / 255.0, blue: 220.0 / 255.0, alpha: 1.0)
-    public var scrollbarRadius: CGFloat = 1.0
-    public var scrollbarMarginTop: CGFloat = 40.0
-    public var scrollbarMarginBottom: CGFloat = 20.0
-    public var scrollbarMarginRight: CGFloat = 20.0
-    
-    // Timer to dismiss handle
-    fileprivate var handleTimer: Timer?
-    
-    // Action callback
-    public var bubbleNameForIndexPath: (IndexPath) -> String = { _ in return ""}
-    
-    // MARK: LifeCycle
-    
-    override open func draw(_ rect: CGRect) {
-        super.draw(rect)
-        setup()
-        setupCollectionView()
-    }
-    
-    // MARK: Setups
-    
-    fileprivate func setupCollectionView() {
-        showsVerticalScrollIndicator = false
-    }
-    
-    public func setup() {
-        cleanViews()
-        
-        setupScrollbar()
-        setupHandle()
-        setupBubble()
-    }
-    
-    public func cleanViews() {
-        guard let bubble = bubble, let handle = handle, let scrollbar = scrollbar, let gestureHandleView = gestureHandleView else {
-            return
-        }
-        
-        bubble.removeFromSuperview()
-        handle.removeFromSuperview()
-        scrollbar.removeFromSuperview()
-        gestureHandleView.removeFromSuperview()
-        
-        self.bubble = nil
-        self.handle = nil
-        self.scrollbar = nil
-        self.gestureHandleView = nil
-    }
-    
-    fileprivate func setupHandle() {
-        if handle == nil {
-            handle = UIView(frame: CGRect(x: self.frame.width - handleWidth - handleMarginRight, y: scrollbarMarginTop, width: handleWidth, height: handleHeight))
-            self.superview?.addSubview(handle!)
-            
-            gestureHandleView  = UIView(frame: CGRect(x: 0.0, y: 0.0, width: gestureWidth, height: gestureHeight))
-            gestureHandleView!.center = handle!.center
-            
-            self.superview?.addSubview(handle!)
-            self.superview?.addSubview(gestureHandleView!)
-        }
-        
-        //config layer
-        handle!.backgroundColor = handleColor
-        handle!.layer.cornerRadius = handleRadius
-        handle!.layer.shadowColor = handleShadowColor.cgColor
-        handle!.layer.shadowOffset = handleShadowOffset
-        handle!.layer.shadowRadius = handleShadowRadius
-        handle!.layer.shadowOpacity = handleShadowOpacity
-        
-        //set imageView
-        if let handleImage = handleImage {
-            let imageView = UIImageView(frame: CGRect(x: 0, y: 0, width: handleWidth, height: handleHeight))
-            imageView.image = handleImage
-            handle!.addSubview(imageView)
-        }
-        
-        //set gesture
-        let panGesture = UIPanGestureRecognizer(target: self, action: #selector(handlePanGesture(_:)))
-        gestureHandleView!.addGestureRecognizer(panGesture)
-        
-        //hide
-        handle!.alpha = 0.0
-        handle!.isHidden = true
-        gestureHandleView!.isHidden = true
-        
-        //position
-        positionHandle(scrollbarMarginTop)
-    }
-    
-    fileprivate func setupBubble() {
-        if bubble == nil {
-            bubble = UITextView()
-            self.superview?.addSubview(bubble!)
-        }
-        
-        bubble!.font = bubbleFont
-        bubble!.font = UIFont(name: bubbleFont.fontName, size: bubbleTextSize)
-        bubble!.text = "Test"
-        bubble!.textColor = bubbleTextColor
-        bubble!.textAlignment = NSTextAlignment.center
-        bubble!.textContainerInset = UIEdgeInsets(top: bubblePadding, left: bubblePadding, bottom: bubblePadding, right: bubblePadding)
-        bubble!.contentMode = UIView.ContentMode.scaleAspectFit
-        bubble!.sizeToFit()
-        
-        bubble!.backgroundColor = bubbleColor
-        bubble!.layer.cornerRadius = bubbleRadius
-        bubble!.layer.shadowColor = bubbleShadowColor.cgColor
-        bubble!.layer.shadowOffset = bubbleShadowOffset
-        bubble!.layer.shadowRadius = bubbleRadius
-        bubble!.layer.shadowOpacity = bubbleShadowOpacity
-        bubble!.layer.shadowRadius = bubbleShadowRadius
-        bubble!.layer.masksToBounds = false
-        
-        bubble!.isHidden = true
-        
-        updateBubblePosition()
-    }
-    
-    fileprivate func setupScrollbar() {
-        guard let superview = self.superview else {
-            return
-        }
-        
-        if scrollbar == nil {
-            scrollbar = UIView(frame: CGRect(x: self.frame.width - scrollbarWidth - scrollbarMarginRight, y: scrollbarMarginTop, width: scrollbarWidth, height: superview.bounds.height - scrollbarMarginBottom - scrollbarMarginTop))
-            self.superview?.addSubview(scrollbar!)
-        }
-        
-        scrollbar!.backgroundColor = scrollbarColor
-        scrollbar!.layer.cornerRadius = scrollbarRadius
-        scrollbar!.alpha = 0.0
-        scrollbar!.isHidden = true
-    }
-    
-    // MARK: Helpers
-    @objc func hideHandle() {
-        guard let handle = handle, let scrollbar = scrollbar, let gestureHandleView = gestureHandleView else {
-            return
-        }
-        
-        gestureHandleView.isHidden = true
-        
-        UIView.animate(withDuration: TimeInterval(handleDisappearAnimationDuration), animations: {
-            handle.alpha = 0.0
-            scrollbar.alpha = 0.0
-        }, completion: { finished in
-            if finished {
-                handle.isHidden = true
-                scrollbar.isHidden = true
-            }
-        })
-    }
-    
-    fileprivate func updateBubblePosition() {
-        guard let scrollbar = scrollbar, let bubble = bubble, let handle = handle else {
-            return
-        }
-        
-        bubble.frame.origin.x = scrollbar.frame.origin.x - bubble.frame.size.width - bubbleMarginRight
-        bubble.center.y = handle.center.y
-    }
-    
-    fileprivate func positionHandle(_ y: CGFloat) {
-        guard let handle = handle, let scrollbar = scrollbar, let gestureHandleView = gestureHandleView else {
-            return
-        }
-        
-        handle.frame.origin.y = y >= scrollbarMarginTop ?
-            (y > scrollbarMarginTop + scrollbar.frame.height - handle.frame.height) ? scrollbarMarginTop + scrollbar.frame.height - handle.frame.height : y
-            :
-        scrollbarMarginTop
-        
-        gestureHandleView.center = handle.center
-    }
-    
-    fileprivate func scrollCollectionFromHandle() {
-        guard let handle = handle, let scrollbar = scrollbar else {
-            return
-        }
-        
-        let collectionContentHeight = self.contentSize.height - self.bounds.height
-        let scrollBarHeight = scrollbar.frame.height
-        
-        let scrollY = (handle.frame.origin.y - scrollbarMarginTop) * (collectionContentHeight / (scrollBarHeight - handle.frame.size.height))
-        
-        self.setContentOffset(CGPoint(x: 0.0, y: scrollY), animated: false)
-    }
-    
-    @objc func handlePanGesture(_ panGesture: UIPanGestureRecognizer) {
-        guard let superview = superview, let bubble = bubble, let handle = handle, let scrollbar = scrollbar, let gestureHandleView = gestureHandleView  else {
-            return
-        }
-        
-        // get translation
-        let translation = panGesture.translation(in: superview)
-        panGesture.setTranslation(CGPoint.zero, in: superview)
-        
-        // manage start stop pan
-        if panGesture.state == UIGestureRecognizer.State.began {
-            bubble.isHidden = deactivateBubble ? true : false
-            handleTouched = true
-            
-            //invalid hide timer
-            if let handleTimer = handleTimer {
-                handleTimer.invalidate()
-            }
-            
-            handle.alpha = 1.0
-            scrollbar.alpha = 1.0
-            handle.isHidden = false
-            scrollbar.isHidden = false
-            gestureHandleView.isHidden = false
-        }
-        
-        if panGesture.state == UIGestureRecognizer.State.ended {
-            bubble.isHidden = true
-            handleTouched = false
-            self.handleTimer = Timer.scheduledTimer(timeInterval: TimeInterval(handleTimeToDisappear), target: self, selector: #selector(hideHandle), userInfo: nil, repeats: false)
-        }
-        
-        if panGesture.state == UIGestureRecognizer.State.changed {
-            //invalid hide timer
-            if let handleTimer = handleTimer {
-                handleTimer.invalidate()
-            }
-            
-            handle.alpha = 1.0
-            scrollbar.alpha = 1.0
-            handle.isHidden = false
-            scrollbar.isHidden = false
-            gestureHandleView.isHidden = false
-        }
-        
-        // views positions
-        positionHandle(handle.frame.origin.y + translation.y)
-        updateBubblePosition()
-        scrollCollectionFromHandle()
-        
-        // manage bubble info
-        manageBubbleInfo()
-    }
-    
-    fileprivate func manageBubbleInfo() {
-        guard let bubble = bubble else {
-            return
-        }
-        
-        let visibleCells = self.visibleCells
-        
-        var currentCellIndex: Int
-        
-        switch bubbleFocus {
-        case .first:
-            currentCellIndex = 0
-            
-        case .last:
-            currentCellIndex = visibleCells.count - 1
-            
-        case .dynamic:
-            //Calcul scroll percentage
-            let scrollY =  contentOffset.y
-            let collectionContentHeight = self.contentSize.height > self.bounds.height ? self.contentSize.height - self.bounds.height : self.bounds.height
-            let scrollPercentage = scrollY / collectionContentHeight
-            currentCellIndex = Int(floor(CGFloat(visibleCells.count) * scrollPercentage))
-        }
-        
-        if currentCellIndex < visibleCells.count {
-            if let indexPath = indexPath(for: visibleCells[currentCellIndex]) {
-                bubble.text = bubbleNameForIndexPath(indexPath)
-                let newSize = bubble.sizeThatFits(CGSize(width: self.bounds.width - (self.bounds.width - (bubble.frame.origin.x + bubble.frame.size.width)), height: bubble.frame.size.height))
-                let oldSize = bubble.frame.size
-                bubble.frame = CGRect(x: bubble.frame.origin.x + (oldSize.width - newSize.width), y: bubble.frame.origin.y, width: newSize.width, height: newSize.height)
-            }
-        }
-    }
-}
-
-// MARK: Scroll Management
-
-extension FastScrollTableView {
-    public func scrollViewWillBeginDragging(_ scrollView: UIScrollView) {
-        guard let handle = handle, let scrollbar = scrollbar, let gestureHandleView = gestureHandleView else {
-            return
-        }
-        
-        handle.alpha = 1.0
-        scrollbar.alpha = 1.0
-        handle.isHidden = false
-        scrollbar.isHidden = false
-        gestureHandleView.isHidden = false
-    }
-    
-    public func scrollViewDidEndDragging(_ scrollView: UIScrollView, willDecelerate decelerate: Bool) {
-        if !decelerate {
-            self.handleTimer = Timer.scheduledTimer(timeInterval: TimeInterval(handleTimeToDisappear), target: self, selector: #selector(hideHandle), userInfo: nil, repeats: false)
-        }
-    }
-    
-    public func scrollViewDidEndDecelerating(_ scrollView: UIScrollView) {
-        self.handleTimer = Timer.scheduledTimer(timeInterval: TimeInterval(handleTimeToDisappear), target: self, selector: #selector(hideHandle), userInfo: nil, repeats: false)
-    }
-    
-    public func scrollViewDidScroll(_ scrollView: UIScrollView) {
-        guard let handle = handle, let scrollbar = scrollbar else {
-            return
-        }
-        
-        //invalid timer
-        if let handleTimer = handleTimer {
-            handleTimer.invalidate()
-        }
-        
-        //scroll position
-        let scrollY =  scrollView.contentOffset.y
-        let collectionContentHeight = self.contentSize.height > self.bounds.height ? self.contentSize.height - self.bounds.height : self.bounds.height
-        let scrollBarHeight = scrollbar.frame.height
-        
-        
-        let handlePosition = (scrollY / collectionContentHeight) * (scrollBarHeight - handle.frame.size.height) + scrollbarMarginTop
-        if (handleTouched == false) {
-            positionHandle(handlePosition)
-        }
-        
-        updateBubblePosition()
-    }
-}
-
-

+ 1 - 1
iOSClient/Media/NCMedia.storyboard

@@ -16,7 +16,7 @@
                         <rect key="frame" x="0.0" y="0.0" width="375" height="812"/>
                         <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
                         <subviews>
-                            <collectionView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" dataMode="prototypes" translatesAutoresizingMaskIntoConstraints="NO" id="Zaz-Cl-qpZ" customClass="FastScrollCollectionView" customModule="Nextcloud" customModuleProvider="target">
+                            <collectionView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" showsHorizontalScrollIndicator="NO" dataMode="prototypes" translatesAutoresizingMaskIntoConstraints="NO" id="Zaz-Cl-qpZ">
                                 <rect key="frame" x="0.0" y="44" width="375" height="734"/>
                                 <color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
                                 <collectionViewFlowLayout key="collectionViewLayout" minimumLineSpacing="0.0" minimumInteritemSpacing="0.0" id="fF1-wd-0xN">

+ 28 - 82
iOSClient/Media/NCMedia.swift

@@ -25,8 +25,7 @@ import Foundation
 
 class NCMedia: UIViewController, DropdownMenuDelegate, DZNEmptyDataSetSource, DZNEmptyDataSetDelegate, NCSelectDelegate {
     
-    @IBOutlet weak var collectionView : FastScrollCollectionView!
-    
+    @IBOutlet weak var collectionView : UICollectionView!
     
     private let appDelegate = UIApplication.shared.delegate as! AppDelegate
     var sectionDatasource = CCSectionDataSourceMetadata()
@@ -52,7 +51,6 @@ class NCMedia: UIViewController, DropdownMenuDelegate, DZNEmptyDataSetSource, DZ
 
     private let refreshControl = UIRefreshControl()
     private var loadingSearch = false
-    private let colorSection = UIColor(red: 152.0/255.0, green: 167.0/255.0, blue: 181.0/255.0, alpha: 0.8)
 
     required init?(coder aDecoder: NSCoder) {
         super.init(coder: aDecoder)
@@ -77,6 +75,11 @@ class NCMedia: UIViewController, DropdownMenuDelegate, DZNEmptyDataSetSource, DZ
         collectionView.register(UINib.init(nibName: "NCSectionFooter", bundle: nil), forSupplementaryViewOfKind: UICollectionView.elementKindSectionFooter, withReuseIdentifier: "sectionFooter")
         
         collectionView.alwaysBounceVertical = true
+        
+        collectionView.scrollIndicatorInsets = UIEdgeInsets.init(top: 10, left: 10, bottom: 10, right: 10)
+        
+       
+
 
         gridLayout = NCGridMediaLayout()
         gridLayout.preferenceWidth = CGFloat(CCUtility.getMediaWidthImage())
@@ -90,7 +93,7 @@ class NCMedia: UIViewController, DropdownMenuDelegate, DZNEmptyDataSetSource, DZ
         // empty Data Source
         collectionView.emptyDataSetDelegate = self
         collectionView.emptyDataSetSource = self
-        
+                
         // 3D Touch peek and pop
         if traitCollection.forceTouchCapability == .available {
             registerForPreviewing(with: self, sourceView: view)
@@ -121,10 +124,6 @@ class NCMedia: UIViewController, DropdownMenuDelegate, DZNEmptyDataSetSource, DZ
         // Title
         self.navigationItem.title = NSLocalizedString("_media_", comment: "")
         
-        // Fast Scrool
-        collectionView?.setup()
-        configFastScroll()
-
         // Reload Data Source
         self.reloadDataSource(loadNetworkDatasource: true) { }
     }
@@ -132,7 +131,7 @@ class NCMedia: UIViewController, DropdownMenuDelegate, DZNEmptyDataSetSource, DZ
     override func viewDidAppear(_ animated: Bool) {
         super.viewDidAppear(animated)
         
-        collectionView?.reloadDataThenPerform {
+        reloadDataThenPerform {
             self.selectSearchSections()
         }
     }
@@ -141,10 +140,9 @@ class NCMedia: UIViewController, DropdownMenuDelegate, DZNEmptyDataSetSource, DZ
         super.viewWillTransition(to: size, with: coordinator)
         
         coordinator.animate(alongsideTransition: nil) { _ in
-            self.collectionView?.reloadDataThenPerform {
+            self.reloadDataThenPerform {
                 self.downloadThumbnail()
             }
-            self.collectionView?.setup()
         }
     }
     
@@ -313,7 +311,7 @@ class NCMedia: UIViewController, DropdownMenuDelegate, DZNEmptyDataSetSource, DZ
                     action: { menuAction in
                         self.isEditMode = false
                         self.selectocId.removeAll()
-                        self.collectionView?.reloadDataThenPerform {
+                        self.reloadDataThenPerform {
                             self.downloadThumbnail()
                         }
                     }
@@ -462,6 +460,13 @@ extension NCMedia: UICollectionViewDelegate {
 
 extension NCMedia: UICollectionViewDataSource {
     
+    func reloadDataThenPerform(_ closure: @escaping (() -> Void)) {
+        CATransaction.begin()
+        CATransaction.setCompletionBlock(closure)
+        collectionView?.reloadData()
+        CATransaction.commit()
+    }
+    
     func collectionView(_ collectionView: UICollectionView, viewForSupplementaryElementOfKind kind: String, at indexPath: IndexPath) -> UICollectionReusableView {
         
         if kind == UICollectionView.elementKindSectionHeader {
@@ -472,7 +477,7 @@ extension NCMedia: UICollectionViewDataSource {
             header.labelSection.textColor = .white
             header.labelHeightConstraint.constant = 20
             header.labelSection.layer.cornerRadius = 10
-            header.labelSection.layer.backgroundColor = colorSection.cgColor
+            header.labelSection.layer.backgroundColor = UIColor(red: 152.0/255.0, green: 167.0/255.0, blue: 181.0/255.0, alpha: 0.8).cgColor
             let width = header.labelSection.intrinsicContentSize.width + 30
             let leading = collectionView.bounds.width / 2 - width / 2
             header.labelWidthConstraint.constant = width
@@ -561,7 +566,7 @@ extension NCMedia {
                     self.loadNetworkDatasource()
                 }
                 
-                self.collectionView?.reloadDataThenPerform {
+                self.reloadDataThenPerform {
                     self.downloadThumbnail()
                 }
                 
@@ -669,7 +674,7 @@ extension NCMedia {
                     }
                 }
                 
-                self.collectionView?.reloadDataThenPerform {
+                self.reloadDataThenPerform {
                     self.downloadThumbnail()
                 }
                 
@@ -701,7 +706,7 @@ extension NCMedia {
             search(lteDate: Date(), gteDate: gteDate, addPast: false, insertPrevius: 0, setDistantPast: false, debug: "search today, first date record")
         }
         
-        collectionView?.reloadDataThenPerform {
+        reloadDataThenPerform {
             self.downloadThumbnail()
         }
     }
@@ -740,8 +745,9 @@ extension NCMedia {
     }
     
     private func downloadThumbnail() {
+        guard let collectionView = self.collectionView else { return }
         DispatchQueue.main.asyncAfter(deadline: .now() + 0.1) {
-            for item in self.collectionView.indexPathsForVisibleItems {
+            for item in collectionView.indexPathsForVisibleItems {
                 if let metadata = NCMainCommon.sharedInstance.getMetadataFromSectionDataSourceIndexPath(item, sectionDataSource: self.sectionDatasource) {
                     NCNetworkingMain.sharedInstance.downloadThumbnail(with: metadata, view: self.collectionView as Any, indexPath: item)
                 }
@@ -750,77 +756,17 @@ extension NCMedia {
     }
 }
 
-// MARK: - FastScroll - ScrollView
+// MARK: - ScrollView
 
 extension NCMedia: UIScrollViewDelegate {
-    func scrollViewDidScroll(_ scrollView: UIScrollView) {
-        collectionView.scrollViewDidScroll(scrollView)
-    }
-    
-    func scrollViewWillBeginDragging(_ scrollView: UIScrollView) {
-        collectionView.scrollViewWillBeginDragging(scrollView)
-    }
-    
-    func scrollViewDidEndDecelerating(_ scrollView: UIScrollView) {
-        collectionView.scrollViewDidEndDecelerating(scrollView)
-    }
     
     func scrollViewDidEndDragging(_ scrollView: UIScrollView, willDecelerate decelerate: Bool) {
-        collectionView.scrollViewDidEndDragging(scrollView, willDecelerate: decelerate)
-    }
-    
-    func scrollViewDidScrollToTop(_ scrollView: UIScrollView) {
-        selectSearchSections()
-    }
-}
-
-extension NCMedia: FastScrollCollectionViewDelegate {
-    
-    fileprivate func configFastScroll() {
-        
-        collectionView.fastScrollDelegate = self
-        
-        //bubble
-        collectionView.deactivateBubble = true
-        
-        //handle
-        collectionView.handleTimeToDisappear = 1
-        collectionView.handleImage = CCGraphics.changeThemingColorImage(UIImage.init(named: "cursor"), width: 34, height: 30, color: colorSection)
-        collectionView.handleWidth = 34.0
-        collectionView.handleHeight = 30.0
-        collectionView.handleRadius = 0.0
-        collectionView.handleMarginRight = 0
-        collectionView.handleColor = UIColor.clear
-        
-        //scrollbar
-        collectionView.scrollbarWidth = 0.0
-        collectionView.scrollbarMarginTop = 0//43.0
-        collectionView.scrollbarMarginBottom = 0//5.0
-        collectionView.scrollbarMarginRight = 0//10.0
-        
-        
- 
-        //callback action to display bubble name
-        /*
-         collectionView.bubbleNameForIndexPath = { indexPath in
-            let visibleSection: Section = self.data[indexPath.section]
-            return visibleSection.sectionTitle
-         }
-         */
+        if !decelerate {
+            selectSearchSections()
+        }
     }
     
-    func hideHandle() {
+    func scrollViewDidEndDecelerating(_ scrollView: UIScrollView) {
         selectSearchSections()
     }
 }
-
-extension FastScrollCollectionView
-{
-    func reloadDataThenPerform(_ closure: @escaping (() -> Void)) {
-        CATransaction.begin()
-        CATransaction.setCompletionBlock(closure)
-        self.reloadData()
-        CATransaction.commit()
-    }
-}
-

+ 0 - 18
iOSClient/Settings/Acknowledgements.rtf

@@ -179,15 +179,6 @@ Copyright (c) kishikawa katsumi\
 ____________________________________________\
 \
 
-\f1\b VFR Reader
-\f0\b0 \
-\
-The MIT License (MIT)\
-\
-Copyright (c)  Julius Oklamcak (http://www.vfr.org).\
-____________________________________________\
-\
-
 \f1\b XLForm
 \f0\b0 \
 \
@@ -197,15 +188,6 @@ Copyright (c) Xmartlabs ( http://xmartlabs.com )\
 ____________________________________________\
 \
 
-\f1\b FastScroll
-\f0\b0 \
-\
-The MIT License (MIT)\
-\
-Copyright (c) Frichti\
-____________________________________________\
-\
-
 \f1\b DownloadButton
 \f0\b0 \
 \