Ver Fonte

Merge branch 'develop'

# Conflicts:
#	iOSClient/Brand/File_Provider_Extension.plist
#	iOSClient/Brand/Notification_Service_Extension.plist
#	iOSClient/Brand/Share.plist
#	iOSClient/Brand/iOSClient.plist
#	iOSClient/Supporting Files/cs-CZ.lproj/Localizable.strings
#	iOSClient/Supporting Files/da.lproj/Localizable.strings
#	iOSClient/Supporting Files/es-AR.lproj/Localizable.strings
marinofaggiana há 6 anos atrás
pai
commit
ade83209d0
100 ficheiros alterados com 1802 adições e 3083 exclusões
  1. 1 0
      Cartfile
  2. 1 0
      Cartfile.resolved
  3. 0 13
      Carthage/Checkouts/CocoaLumberjack/Framework/CocoaLumberjack-iOS-Static/CocoaLumberjack_iOS_Static.h
  4. 0 17
      Carthage/Checkouts/CocoaLumberjack/Framework/iOSLibStaticTest/AppDelegate.h
  5. 0 15
      Carthage/Checkouts/CocoaLumberjack/Framework/iOSLibStaticTest/ViewController.h
  6. 0 123
      Libraries external/TOScrollBar/TOScrollBar.h
  7. 0 691
      Libraries external/TOScrollBar/TOScrollBar.m
  8. 0 27
      Libraries external/TOScrollBar/TOScrollBarGestureRecognizer.h
  9. 0 75
      Libraries external/TOScrollBar/TOScrollBarGestureRecognizer.m
  10. 0 43
      Libraries external/TOScrollBar/UIScrollView+TOScrollBar.h
  11. 0 51
      Libraries external/TOScrollBar/UIScrollView+TOScrollBar.m
  12. 22 45
      Nextcloud.xcodeproj/project.pbxproj
  13. 108 0
      Nextcloud.xcodeproj/xcshareddata/xcschemes/File Provider Extension.xcscheme
  14. 91 0
      Nextcloud.xcodeproj/xcshareddata/xcschemes/Nextcloud.xcscheme
  15. 108 0
      Nextcloud.xcodeproj/xcshareddata/xcschemes/Notification Service Extension.xcscheme
  16. 108 0
      Nextcloud.xcodeproj/xcshareddata/xcschemes/Share.xcscheme
  17. 2 2
      iOSClient/AppDelegate.h
  18. 0 1
      iOSClient/AppDelegate.m
  19. 2 2
      iOSClient/Brand/File_Provider_Extension.plist
  20. 2 2
      iOSClient/Brand/Notification_Service_Extension.plist
  21. 2 2
      iOSClient/Brand/Share.plist
  22. 2 2
      iOSClient/Brand/iOSClient.plist
  23. 1 1
      iOSClient/Database/NCDatabase.swift
  24. 46 40
      iOSClient/Database/NCManageDatabase.swift
  25. 10 8
      iOSClient/Favorites/CCFavorites.m
  26. 23 0
      iOSClient/Images.xcassets/file_photo_big.imageset/Contents.json
  27. BIN
      iOSClient/Images.xcassets/file_photo_big.imageset/file_photo_big.png
  28. BIN
      iOSClient/Images.xcassets/file_photo_big.imageset/file_photo_big@2x.png
  29. BIN
      iOSClient/Images.xcassets/file_photo_big.imageset/file_photo_big@3x.png
  30. 23 0
      iOSClient/Images.xcassets/file_video_big.imageset/Contents.json
  31. BIN
      iOSClient/Images.xcassets/file_video_big.imageset/file_video_big.png
  32. BIN
      iOSClient/Images.xcassets/file_video_big.imageset/file_video_big@2x.png
  33. BIN
      iOSClient/Images.xcassets/file_video_big.imageset/file_video_big@3x.png
  34. 23 0
      iOSClient/Images.xcassets/switchGridChange.imageset/Contents.json
  35. BIN
      iOSClient/Images.xcassets/switchGridChange.imageset/switchGridChange.png
  36. BIN
      iOSClient/Images.xcassets/switchGridChange.imageset/switchGridChange@2x.png
  37. BIN
      iOSClient/Images.xcassets/switchGridChange.imageset/switchGridChange@3x.png
  38. 1 1
      iOSClient/Library/OCCommunicationLib/OCCommunication.h
  39. 2 2
      iOSClient/Library/OCCommunicationLib/OCCommunication.m
  40. 1 1
      iOSClient/Library/OCCommunicationLib/OCWebDavClient/OCWebDAVClient.h
  41. 23 10
      iOSClient/Library/OCCommunicationLib/OCWebDavClient/OCWebDAVClient.m
  42. 0 5
      iOSClient/Main/CCDetail.m
  43. 11 10
      iOSClient/Main/CCMain.m
  44. 1 1
      iOSClient/Main/CCSection.h
  45. 23 4
      iOSClient/Main/CCSection.m
  46. 40 0
      iOSClient/Main/Cell/NCGridMediaCell.swift
  47. 81 0
      iOSClient/Main/Cell/NCGridMediaCell.xib
  48. 50 4
      iOSClient/Main/Layout/NCLayout.swift
  49. 45 151
      iOSClient/Main/Main.storyboard
  50. 85 33
      iOSClient/Main/NCMainCommon.swift
  51. 0 0
      iOSClient/Main/NCPhotosPickerViewController.swift
  52. 29 0
      iOSClient/Main/Section/NCSectionHeaderFooter.swift
  53. 44 0
      iOSClient/Main/Section/NCSectionMediaHeader.xib
  54. 0 53
      iOSClient/Media/CCMedia.h
  55. 0 1028
      iOSClient/Media/CCMedia.m
  56. 46 4
      iOSClient/Media/NCMedia.storyboard
  57. 554 386
      iOSClient/Media/NCMedia.swift
  58. 1 12
      iOSClient/Networking/CCNetworking.m
  59. 1 1
      iOSClient/Networking/NCService.swift
  60. 1 1
      iOSClient/Networking/OCNetworking.h
  61. 159 197
      iOSClient/Networking/OCNetworking.m
  62. 13 5
      iOSClient/Offline/NCOffline.swift
  63. 11 3
      iOSClient/Select/NCSelect.swift
  64. 2 2
      iOSClient/Settings/Acknowledgements.rtf
  65. 1 1
      iOSClient/Settings/CCAdvanced.m
  66. 1 1
      iOSClient/Settings/CCManageAccount.m
  67. 0 1
      iOSClient/Settings/CCManageAutoUpload.h
  68. 0 5
      iOSClient/Shares/NCShares.m
  69. BIN
      iOSClient/Supporting Files/ast.lproj/Localizable.strings
  70. BIN
      iOSClient/Supporting Files/ca.lproj/Localizable.strings
  71. BIN
      iOSClient/Supporting Files/cs-CZ.lproj/Localizable.strings
  72. BIN
      iOSClient/Supporting Files/da.lproj/Localizable.strings
  73. BIN
      iOSClient/Supporting Files/el.lproj/Localizable.strings
  74. BIN
      iOSClient/Supporting Files/en-GB.lproj/Localizable.strings
  75. 1 1
      iOSClient/Supporting Files/en.lproj/Localizable.strings
  76. BIN
      iOSClient/Supporting Files/es-419.lproj/Localizable.strings
  77. BIN
      iOSClient/Supporting Files/es-AR.lproj/Localizable.strings
  78. BIN
      iOSClient/Supporting Files/es-CL.lproj/Localizable.strings
  79. BIN
      iOSClient/Supporting Files/es-CO.lproj/Localizable.strings
  80. BIN
      iOSClient/Supporting Files/es-CR.lproj/Localizable.strings
  81. BIN
      iOSClient/Supporting Files/es-DO.lproj/Localizable.strings
  82. BIN
      iOSClient/Supporting Files/es-EC.lproj/Localizable.strings
  83. BIN
      iOSClient/Supporting Files/es-GT.lproj/Localizable.strings
  84. BIN
      iOSClient/Supporting Files/es-HN.lproj/Localizable.strings
  85. BIN
      iOSClient/Supporting Files/es-MX.lproj/Localizable.strings
  86. BIN
      iOSClient/Supporting Files/es-NI.lproj/Localizable.strings
  87. BIN
      iOSClient/Supporting Files/es-PA.lproj/Localizable.strings
  88. BIN
      iOSClient/Supporting Files/es-PE.lproj/Localizable.strings
  89. BIN
      iOSClient/Supporting Files/es-PR.lproj/Localizable.strings
  90. BIN
      iOSClient/Supporting Files/es-PY.lproj/Localizable.strings
  91. BIN
      iOSClient/Supporting Files/es-SV.lproj/Localizable.strings
  92. BIN
      iOSClient/Supporting Files/es-UY.lproj/Localizable.strings
  93. BIN
      iOSClient/Supporting Files/es.lproj/Localizable.strings
  94. BIN
      iOSClient/Supporting Files/eu.lproj/Localizable.strings
  95. BIN
      iOSClient/Supporting Files/fa.lproj/Localizable.strings
  96. BIN
      iOSClient/Supporting Files/fi-FI.lproj/Localizable.strings
  97. BIN
      iOSClient/Supporting Files/fr.lproj/Localizable.strings
  98. BIN
      iOSClient/Supporting Files/gl.lproj/Localizable.strings
  99. BIN
      iOSClient/Supporting Files/hu.lproj/Localizable.strings
  100. BIN
      iOSClient/Supporting Files/is.lproj/Localizable.strings

+ 1 - 0
Cartfile

@@ -12,3 +12,4 @@ github "realm/realm-cocoa"
 github "SVGKit/SVGKit" "2.x"
 github "SVGKit/SVGKit" "2.x"
 github "WeTransfer/WeScan" == 0.9.1
 github "WeTransfer/WeScan" == 0.9.1
 github "malcommac/SwiftRichString"
 github "malcommac/SwiftRichString"
+github "https://github.com/marinofaggiana/FastScroll" "master"

+ 1 - 0
Cartfile.resolved

@@ -11,6 +11,7 @@ github "ealeksandrov/EARestrictedScrollView" "1.1.0"
 github "jdg/MBProgressHUD" "1.1.0"
 github "jdg/MBProgressHUD" "1.1.0"
 github "kishikawakatsumi/UICKeyChainStore" "v2.1.2"
 github "kishikawakatsumi/UICKeyChainStore" "v2.1.2"
 github "malcommac/SwiftRichString" "2.1.0"
 github "malcommac/SwiftRichString" "2.1.0"
+github "marinofaggiana/FastScroll" "f52a16b20e738ee669658fa448016601a7494424"
 github "realm/realm-cocoa" "v3.13.1"
 github "realm/realm-cocoa" "v3.13.1"
 github "sgr-ksmt/PDFGenerator" "2.1.1"
 github "sgr-ksmt/PDFGenerator" "2.1.1"
 github "tilltue/TLPhotoPicker" "1.8.3"
 github "tilltue/TLPhotoPicker" "1.8.3"

+ 0 - 13
Carthage/Checkouts/CocoaLumberjack/Framework/CocoaLumberjack-iOS-Static/CocoaLumberjack_iOS_Static.h

@@ -1,13 +0,0 @@
-//
-//  CocoaLumberjack_iOS_Static.h
-//  CocoaLumberjack-iOS-Static
-//
-//  Created by Andrew Mackenzie-Ross on 3/02/2015.
-//
-//
-
-#import <Foundation/Foundation.h>
-
-@interface CocoaLumberjack_iOS_Static : NSObject
-
-@end

+ 0 - 17
Carthage/Checkouts/CocoaLumberjack/Framework/iOSLibStaticTest/AppDelegate.h

@@ -1,17 +0,0 @@
-//
-//  AppDelegate.h
-//  iOSLibStaticTest
-//
-//  Created by Andrew Mackenzie-Ross on 3/02/2015.
-//
-//
-
-#import <UIKit/UIKit.h>
-
-@interface AppDelegate : UIResponder <UIApplicationDelegate>
-
-@property (strong, nonatomic) UIWindow *window;
-
-
-@end
-

+ 0 - 15
Carthage/Checkouts/CocoaLumberjack/Framework/iOSLibStaticTest/ViewController.h

@@ -1,15 +0,0 @@
-//
-//  ViewController.h
-//  iOSLibStaticTest
-//
-//  Created by Andrew Mackenzie-Ross on 3/02/2015.
-//
-//
-
-#import <UIKit/UIKit.h>
-
-@interface ViewController : UIViewController
-
-
-@end
-

+ 0 - 123
Libraries external/TOScrollBar/TOScrollBar.h

@@ -1,123 +0,0 @@
-//
-//  TOScrollBar.h
-//
-//  Copyright 2016-2017 Timothy Oliver. All rights reserved.
-//
-//  Permission is hereby granted, free of charge, to any person obtaining a copy
-//  of this software and associated documentation files (the "Software"), to
-//  deal in the Software without restriction, including without limitation the
-//  rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
-//  sell copies of the Software, and to permit persons to whom the Software is
-//  furnished to do so, subject to the following conditions:
-//
-//  The above copyright notice and this permission notice shall be included in
-//  all copies or substantial portions of the Software.
-//
-//  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
-//  OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-//  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-//  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
-//  WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
-//  IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-#import <UIKit/UIKit.h>
-#import "UIScrollView+TOScrollBar.h"
-
-typedef NS_ENUM(NSInteger, TOScrollBarStyle) {
-    TOScrollBarStyleDefault,
-    TOScrollBarStyleDark
-};
-
-NS_ASSUME_NONNULL_BEGIN
-
-@interface TOScrollBar : UIView
-
-/* The visual style of the scroll bar, either light or dark */
-@property (nonatomic, assign) TOScrollBarStyle style;
-
-/** Aligns the scroll bar to the top of the scroll view content offset.
-     Set this to `YES` when using this in a view controller with iOS 11 large titles. */
-@property (nonatomic, assign) BOOL insetForLargeTitles;
-
-/** The amount of padding above and below the scroll bar (Only top and bottom values are counted. Default is {20,20} ) */
-@property (nonatomic, assign) UIEdgeInsets verticalInset;
-
-/** The inset, in points of the middle of track from the edge of the scroll view */
-@property (nonatomic, assign) CGFloat edgeInset;
-
-/** The tint color of the track */
-@property (nonatomic, strong) UIColor *trackTintColor;
-
-/** The width in points, of the track (Default value is 2.0) */
-@property (nonatomic, assign) CGFloat trackWidth;
-
-/** The tint color of the handle (Defaults to the system tint color) */
-@property (nonatomic, strong, nullable) UIColor *handleTintColor;
-
-/** The width in points, of the handle. (Default value is 4.0) */
-@property (nonatomic, assign) CGFloat handleWidth;
-
-/** The minimum height in points the handle may be in relation to the content height. (Default value is 64.0) */
-@property (nonatomic, assign) CGFloat handleMinimiumHeight;
-
-/** The user is currently dragging the handle */
-@property (nonatomic, assign, readonly) BOOL dragging;
-
-/** The minimum required scale of the scroll view's content height before the scroll bar is shown (Default is 5.0) */
-@property (nonatomic, assign) CGFloat minimumContentHeightScale;
-
-/** The scroll view in which this scroll bar has been added. */
-@property (nonatomic, weak, readonly) UIScrollView *scrollView;
-
-/** When enabled, the scroll bar will only respond to direct touches to the handle control.
- Touches to the track will be passed to the UI controls beneath it.
- Default is NO. */
-@property (nonatomic, assign) BOOL handleExclusiveInteractionEnabled;
-
-/** 
- Creates a new instance of the scroll bar view 
- 
- @param style The initial style of the scroll bar upon creation
- */
-- (instancetype)initWithStyle:(TOScrollBarStyle)style;
-
-/**
- Adds the scroll bar to a scroll view
- 
- @param scrollView The scroll view that will receive this scroll bar
- */
-- (void)addToScrollView:(UIScrollView *)scrollView;
-
-/**
- Removes the scroll bar from the scroll view and resets the scroll view's state
- */
-- (void)removeFromScrollView;
-
-/**
- If added to a table view, this convienience method will compute the appropriate
- inset values for the table separator so they don't underlap the scroll bar
- 
- @param inset The original separator inset value of the table view
- */
-- (UIEdgeInsets)adjustedTableViewSeparatorInsetForInset:(UIEdgeInsets)inset;
-
-/**
- If added to a table view, this convienience method will compute the appropriate
- insets values for each cell's layout margins in order to appropriately push the cell's
- content inwards
- 
- @param layoutMargins The current `layoutMargins` value of the `UITableViewCell` instance.
- @param offset If desired, any additional horizontal offset for this specific use case
- 
- */
-- (UIEdgeInsets)adjustedTableViewCellLayoutMarginsForMargins:(UIEdgeInsets)layoutMargins manualOffset:(CGFloat)offset;
-
-/**
- Shows or hides the scroll bar from the scroll view with an optional animation
- */
-- (void)setHidden:(BOOL)hidden animated:(BOOL)animated;
-
-@end
-
-NS_ASSUME_NONNULL_END
-

+ 0 - 691
Libraries external/TOScrollBar/TOScrollBar.m

@@ -1,691 +0,0 @@
-//
-//  TOScrollBar.m
-//
-//  Copyright 2016-2017 Timothy Oliver. All rights reserved.
-//
-//  Permission is hereby granted, free of charge, to any person obtaining a copy
-//  of this software and associated documentation files (the "Software"), to
-//  deal in the Software without restriction, including without limitation the
-//  rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
-//  sell copies of the Software, and to permit persons to whom the Software is
-//  furnished to do so, subject to the following conditions:
-//
-//  The above copyright notice and this permission notice shall be included in
-//  all copies or substantial portions of the Software.
-//
-//  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
-//  OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-//  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-//  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
-//  WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
-//  IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-#import "TOScrollBar.h"
-#import "UIScrollView+TOScrollBar.h"
-#import "TOScrollBarGestureRecognizer.h"
-
-/** Default values for the scroll bar */
-static const CGFloat kTOScrollBarTrackWidth      = 2.0f;     // The default width of the scrollable space indicator
-static const CGFloat kTOScrollBarHandleWidth     = 4.0f;     // The default width of the handle control
-static const CGFloat kTOScrollBarEdgeInset       = 7.5f;     // The distance from the edge of the view to the center of the track
-static const CGFloat kTOScrollBarHandleMinHeight = 64.0f;    // The minimum usable size to which the handle can shrink
-static const CGFloat kTOScrollBarWidth           = 20.0f;    // The width of this control (44 is minimum recommended tapping space) TWS how handleWidth
-static const CGFloat kTOScrollBarVerticalPadding = 10.0f;    // The default padding at the top and bottom of the view
-static const CGFloat kTOScrollBarMinimumContentScale = 5.0f; // The minimum scale of the content view before showing the scroll view is necessary
-
-/************************************************************************/
-
-// A struct to hold the scroll view's previous state before this bar was applied
-struct TOScrollBarScrollViewState {
-    BOOL showsVerticalScrollIndicator;
-};
-typedef struct TOScrollBarScrollViewState TOScrollBarScrollViewState;
-
-/************************************************************************/
-// Private interface exposure for scroll view category
-
-@interface UIScrollView () //TOScrollBar
-- (void)setTo_scrollBar:(TOScrollBar *)scrollBar;
-@end
-
-/************************************************************************/
-
-@interface TOScrollBar () <UIGestureRecognizerDelegate> {
-    TOScrollBarScrollViewState _scrollViewState;
-}
-
-@property (nonatomic, weak, readwrite) UIScrollView *scrollView;   // The parent scroll view in which we belong
-
-@property (nonatomic, assign) BOOL userHidden;          // View was explicitly hidden by the user as opposed to us
-
-@property (nonatomic, strong) UIImageView *trackView;   // The track indicating the scrollable distance
-@property (nonatomic, strong) UIImageView *handleView;  // The handle that may be dragged in the scroll bar
-
-@property (nonatomic, assign, readwrite) BOOL dragging; // The user is presently dragging the handle
-@property (nonatomic, assign) CGFloat yOffset;          // The offset from the center of the thumb
-
-@property (nonatomic, assign) CGFloat originalYOffset;  // The original placement of the scroll bar when the user started dragging
-@property (nonatomic, assign) CGFloat originalHeight;   // The original height of the scroll bar when the user started dragging
-@property (nonatomic, assign) CGFloat originalTopInset; // The original safe area inset of the scroll bar when the user started dragging
-
-@property (nonatomic, assign) CGFloat horizontalOffset; // The horizontal offset when the edge inset is too small for the touch region
-
-@property (nonatomic, assign) BOOL disabled;            // Disabled when there's not enough scroll content to merit showing this
-
-@property (nonatomic, strong) UIImpactFeedbackGenerator *feedbackGenerator; // Taptic feedback for iPhone 7 and above
-
-@property (nonatomic, strong) TOScrollBarGestureRecognizer *gestureRecognizer; // Our custom recognizer for handling user interactions with the scroll bar
-
-@end
-
-/************************************************************************/
-
-@implementation TOScrollBar
-
-#pragma mark - Class Creation -
-
-- (instancetype)initWithStyle:(TOScrollBarStyle)style
-{
-    if (self = [super initWithFrame:CGRectZero]) {
-        _style = style;
-        [self setUpInitialProperties];
-    }
-
-    return self;
-}
-
-- (instancetype)initWithFrame:(CGRect)frame
-{
-    if (self = [super initWithFrame:frame]) {
-        [self setUpInitialProperties];
-    }
-
-    return self;
-}
-
-- (instancetype)initWithCoder:(NSCoder *)aDecoder
-{
-    if (self = [super initWithCoder:aDecoder]) {
-        [self setUpInitialProperties];
-    }
-
-    return self;
-}
-
-#pragma mark - Set-up -
-
-- (void)setUpInitialProperties
-{
-    _trackWidth  = kTOScrollBarTrackWidth;
-    _handleWidth = kTOScrollBarHandleWidth;
-    _edgeInset   = kTOScrollBarEdgeInset;
-    _handleMinimiumHeight = kTOScrollBarHandleMinHeight;
-    _minimumContentHeightScale = kTOScrollBarMinimumContentScale;
-    _verticalInset = UIEdgeInsetsMake(kTOScrollBarVerticalPadding, 0.0f, kTOScrollBarVerticalPadding, 0.0f);
-    _feedbackGenerator = [[UIImpactFeedbackGenerator alloc] initWithStyle:UIImpactFeedbackStyleLight];
-    _gestureRecognizer = [[TOScrollBarGestureRecognizer alloc] initWithTarget:self action:@selector(scrollBarGestureRecognized:)];
-}
-
-- (void)setUpViews
-{
-    if (self.trackView || self.handleView) {
-        return;
-    }
-
-    self.backgroundColor = [UIColor clearColor];
-
-    // Create and add the track view
-    self.trackView = [[UIImageView alloc] initWithImage:[TOScrollBar verticalCapsuleImageWithWidth:self.trackWidth]];
-    [self addSubview:self.trackView];
-
-    // Add the handle view
-    self.handleView = [[UIImageView alloc] initWithImage:[TOScrollBar verticalCapsuleImageWithWidth:self.handleWidth]];
-    [self addSubview:self.handleView];
-
-    // Add the initial styling
-    [self configureViewsForStyle:self.style];
-    
-    // Add gesture recognizer
-    [self addGestureRecognizer:self.gestureRecognizer];
-}
-
-- (void)configureViewsForStyle:(TOScrollBarStyle)style
-{
-    BOOL dark = (style == TOScrollBarStyleDark);
-
-    CGFloat whiteColor = 0.0f;
-    if (dark) {
-        whiteColor = 1.0f;
-    }
-    self.trackView.tintColor = [UIColor colorWithWhite:whiteColor alpha:0.1f];
-}
-
-- (void)dealloc
-{
-    [self restoreScrollView:self.scrollView];
-}
-
-- (void)configureScrollView:(UIScrollView *)scrollView
-{
-    if (scrollView == nil) {
-        return;
-    }
-
-    // Make a copy of the scroll view's state and then configure
-    _scrollViewState.showsVerticalScrollIndicator = self.scrollView.showsVerticalScrollIndicator;
-    scrollView.showsVerticalScrollIndicator = NO;
-
-    //Key-value Observers
-    [scrollView addObserver:self forKeyPath:@"contentOffset" options:NSKeyValueObservingOptionNew context:nil];
-    [scrollView addObserver:self forKeyPath:@"contentSize" options:NSKeyValueObservingOptionNew context:nil];
-}
-
-- (void)restoreScrollView:(UIScrollView *)scrollView
-{
-    if (scrollView == nil) {
-        return;
-    }
-
-    // Restore the scroll view's state
-    scrollView.showsVerticalScrollIndicator = _scrollView.showsVerticalScrollIndicator;
-
-    // Remove the observers
-    [scrollView removeObserver:self forKeyPath:@"contentOffset"];
-    [scrollView removeObserver:self forKeyPath:@"contentSize"];
-}
-
-- (void)willMoveToSuperview:(UIView *)newSuperview
-{
-    [super willMoveToSuperview:newSuperview];
-    [self setUpViews];
-}
-
-#pragma mark - Content Layout -
-
-- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object
-                        change:(NSDictionary<NSKeyValueChangeKey,id> *)change context:(void *)context
-{
-    [self updateStateForScrollView];
-    if (self.hidden) { return; }
-    [self layoutInScrollView];
-    [self setNeedsLayout];
-}
-
-- (CGFloat)heightOfHandleForContentSize
-{
-    if (_scrollView == nil) {
-        return _handleMinimiumHeight;
-    }
-
-    CGFloat heightRatio = self.scrollView.frame.size.height / self.scrollView.contentSize.height;
-    CGFloat height = self.frame.size.height * heightRatio;
-
-    return MAX(floorf(height), _handleMinimiumHeight);
-}
-
-- (void)updateStateForScrollView
-{
-    CGRect frame = _scrollView.frame;
-    CGSize contentSize = _scrollView.contentSize;
-    self.disabled = (contentSize.height / frame.size.height) < _minimumContentHeightScale;
-    [self setHidden:(self.disabled || self.userHidden) animated:NO];
-}
-
-- (void)layoutInScrollView
-{
-    CGRect scrollViewFrame = _scrollView.frame;
-    UIEdgeInsets insets    = _scrollView.contentInset;
-    CGPoint contentOffset  = _scrollView.contentOffset;
-    CGFloat halfWidth      = (kTOScrollBarWidth * 0.5f);
-
-    if (@available(iOS 11.0, *)) {
-        insets = _scrollView.adjustedContentInset;
-    }
-
-    // Contract the usable space by the scroll view's content inset (eg navigation/tool bars)
-    scrollViewFrame.size.height -= (insets.top + insets.bottom);
-
-    CGFloat largeTitleDelta = 0.0f;
-    if (_insetForLargeTitles) {
-        largeTitleDelta = fabs(MIN(insets.top + contentOffset.y, 0.0f));
-    }
-
-    // Work out the final height be further contracting by the padding
-    CGFloat height = (scrollViewFrame.size.height - (_verticalInset.top + _verticalInset.bottom)) - largeTitleDelta;
-
-    // Work out how much we have to offset the track by to make sure all of the parent view
-    // is visible at the edge of the screen (Or else we'll be unable to tap properly)
-    CGFloat horizontalOffset = halfWidth - _edgeInset;
-    self.horizontalOffset = (horizontalOffset > 0.0f) ? horizontalOffset : 0.0f;
-
-    // Work out the frame for the scroll view
-    CGRect frame = CGRectZero;
-    
-    // Size
-    frame.size.width = kTOScrollBarWidth;
-    frame.size.height = (_dragging ? _originalHeight : height);
-    
-    // Horizontal placement
-    frame.origin.x = scrollViewFrame.size.width - (_edgeInset + halfWidth);
-    if (@available(iOS 11.0, *)) { frame.origin.x -= _scrollView.safeAreaInsets.right; }
-    frame.origin.x = MIN(frame.origin.x, scrollViewFrame.size.width - kTOScrollBarWidth);
-
-    // Vertical placement in scroll view
-    if (_dragging) {
-        frame.origin.y = _originalYOffset;
-    }
-    else {
-        frame.origin.y = _verticalInset.top;
-        frame.origin.y += insets.top;
-        frame.origin.y += largeTitleDelta;
-    }
-    frame.origin.y += contentOffset.y;
-
-    // Set the frame
-    self.frame = frame;
-    
-    // Bring the scroll bar to the front in case other subviews were subsequently added over it
-    [self.superview bringSubviewToFront:self];
-}
-
-- (void)layoutSubviews
-{
-    CGRect frame = self.frame;
-
-    // The frame of the track
-    CGRect trackFrame = CGRectZero;
-    trackFrame.size.width = _trackWidth;
-    trackFrame.size.height = frame.size.height;
-    trackFrame.origin.x = ceilf(((frame.size.width - _trackWidth) * 0.5f) + _horizontalOffset);
-    self.trackView.frame = CGRectIntegral(trackFrame);
-
-    // Don't handle automatic layout when dragging; we'll do that manually elsewhere
-    if (self.dragging || self.disabled) {
-        return;
-    }
-
-    // The frame of the handle
-    CGRect handleFrame = CGRectZero;
-    handleFrame.size.width = _handleWidth;
-    handleFrame.size.height = [self heightOfHandleForContentSize];
-    handleFrame.origin.x = ceilf(((frame.size.width - _handleWidth) * 0.5f) + _horizontalOffset);
-
-    // Work out the y offset of the handle
-    UIEdgeInsets contentInset = _scrollView.contentInset;
-    if (@available(iOS 11.0, *)) {
-        contentInset = _scrollView.safeAreaInsets;
-    }
-
-    CGPoint contentOffset     = _scrollView.contentOffset;
-    CGSize contentSize        = _scrollView.contentSize;
-    CGRect scrollViewFrame    = _scrollView.frame;
-
-    CGFloat scrollableHeight = (contentSize.height + contentInset.top + contentInset.bottom) - scrollViewFrame.size.height;
-    CGFloat scrollProgress = (contentOffset.y + contentInset.top) / scrollableHeight;
-    handleFrame.origin.y = (frame.size.height - handleFrame.size.height) * scrollProgress;
-
-    // If the scroll view expanded beyond its scrollable range, shrink the handle to match the rubber band effect
-    if (contentOffset.y < -contentInset.top) { // The top
-        handleFrame.size.height -= (-contentOffset.y - contentInset.top);
-        handleFrame.size.height = MAX(handleFrame.size.height, (_trackWidth * 2 + 2));
-    }
-    else if (contentOffset.y + scrollViewFrame.size.height > contentSize.height + contentInset.bottom) { // The bottom
-        CGFloat adjustedContentOffset = contentOffset.y + scrollViewFrame.size.height;
-        CGFloat delta = adjustedContentOffset - (contentSize.height + contentInset.bottom);
-        handleFrame.size.height -= delta;
-        handleFrame.size.height = MAX(handleFrame.size.height, (_trackWidth * 2 + 2));
-        handleFrame.origin.y = frame.size.height - handleFrame.size.height;
-    }
-
-    // Clamp to the bounds of the frame
-    handleFrame.origin.y = MAX(handleFrame.origin.y, 0.0f);
-    handleFrame.origin.y = MIN(handleFrame.origin.y, (frame.size.height - handleFrame.size.height));
-
-    self.handleView.frame = handleFrame;
-}
-
-- (void)setScrollYOffsetForHandleYOffset:(CGFloat)yOffset animated:(BOOL)animated
-{
-    CGFloat heightRange = _trackView.frame.size.height - _handleView.frame.size.height;
-    yOffset = MAX(0.0f, yOffset);
-    yOffset = MIN(heightRange, yOffset);
-
-    CGFloat positionRatio = yOffset / heightRange;
-
-    CGRect frame       = _scrollView.frame;
-    UIEdgeInsets inset = _scrollView.contentInset;
-    CGSize contentSize = _scrollView.contentSize;
-
-    if (@available(iOS 11.0, *)) {
-        inset = _scrollView.adjustedContentInset;
-    }
-    inset.top = _originalTopInset;
-
-    CGFloat totalScrollSize = (contentSize.height + inset.top + inset.bottom) - frame.size.height;
-    CGFloat scrollOffset = totalScrollSize * positionRatio;
-    scrollOffset -= inset.top;
-
-    CGPoint contentOffset = _scrollView.contentOffset;
-    contentOffset.y = scrollOffset;
-
-    // Animate to help coax the large title navigation bar to behave
-    if (@available(iOS 11.0, *)) {
-        [UIView animateWithDuration:animated ? 0.1f : 0.00001f animations:^{
-            [self.scrollView setContentOffset:contentOffset animated:NO];
-        }];
-    }
-    else {
-        [self.scrollView setContentOffset:contentOffset animated:NO];
-    }
-}
-
-#pragma mark - Scroll View Integration -
-
-- (void)addToScrollView:(UIScrollView *)scrollView
-{
-    if (scrollView == self.scrollView) {
-        return;
-    }
-
-    // Restore the previous scroll view
-    [self restoreScrollView:self.scrollView];
-
-    // Assign the new scroll view
-    self.scrollView = scrollView;
-
-    // Apply the observers/settings to the new scroll view
-    [self configureScrollView:scrollView];
-
-    // Add the scroll bar to the scroll view's content view
-    [self.scrollView addSubview:self];
-
-    // Add ourselves as a property of the scroll view
-    [self.scrollView setTo_scrollBar:self];
-
-    // Begin layout
-    [self layoutInScrollView];
-}
-
-- (void)removeFromScrollView
-{
-    [self restoreScrollView:self.scrollView];
-    [self removeFromSuperview];
-    [self.scrollView setTo_scrollBar:nil];
-    self.scrollView = nil;
-}
-
-- (UIEdgeInsets)adjustedTableViewSeparatorInsetForInset:(UIEdgeInsets)inset
-{
-    inset.right = _edgeInset * 2.0f;
-    return inset;
-}
-
-- (UIEdgeInsets)adjustedTableViewCellLayoutMarginsForMargins:(UIEdgeInsets)layoutMargins manualOffset:(CGFloat)offset
-{
-    layoutMargins.right = (_edgeInset * 2.0f) + 15.0f; // Magic system number is 20, but we can't infer that from here on time
-    layoutMargins.right += offset;
-    return layoutMargins;
-}
-
-#pragma mark - User Interaction -
-- (void)scrollBarGestureRecognized:(TOScrollBarGestureRecognizer *)recognizer
-{
-    CGPoint touchPoint = [recognizer locationInView:self];
-    
-    switch (recognizer.state) {
-        case UIGestureRecognizerStateBegan:
-            [self gestureBeganAtPoint:touchPoint];
-            break;
-        case UIGestureRecognizerStateChanged:
-            [self gestureMovedToPoint:touchPoint];
-            break;
-        case UIGestureRecognizerStateEnded:
-        case UIGestureRecognizerStateCancelled:
-            [self gestureEnded];
-            break;
-        default:
-            break;
-    }
-}
-
-- (void)gestureBeganAtPoint:(CGPoint)touchPoint
-{
-    if (self.disabled) {
-        return;
-    }
-
-    // Warm-up the feedback generator
-    [_feedbackGenerator prepare];
-
-    self.scrollView.scrollEnabled = NO;
-    self.dragging = YES;
-
-    // Capture the original position
-    self.originalHeight = self.frame.size.height;
-    self.originalYOffset = self.frame.origin.y - self.scrollView.contentOffset.y;
-
-    if (@available(iOS 11.0, *)) {
-        self.originalTopInset = _scrollView.adjustedContentInset.top;
-    } else {
-        self.originalTopInset = _scrollView.contentInset.top;
-    }
-
-    // Check if the user tapped inside the handle
-    CGRect handleFrame = self.handleView.frame;
-    if (touchPoint.y > (handleFrame.origin.y - 20) &&
-        touchPoint.y < handleFrame.origin.y + (handleFrame.size.height + 20))
-    {
-        self.yOffset = (touchPoint.y - handleFrame.origin.y);
-        return;
-    }
-
-	if (!self.handleExclusiveInteractionEnabled) {
-		// User tapped somewhere else, animate the handle to that point
-		CGFloat halfHeight = (handleFrame.size.height * 0.5f);
-
-		CGFloat destinationYOffset = touchPoint.y - halfHeight;
-		destinationYOffset = MAX(0.0f, destinationYOffset);
-		destinationYOffset = MIN(self.frame.size.height - halfHeight, destinationYOffset);
-
-		self.yOffset = (touchPoint.y - destinationYOffset);
-		handleFrame.origin.y = destinationYOffset;
-
-		[UIView animateWithDuration:0.2f
-							  delay:0.0f
-			 usingSpringWithDamping:1.0f
-			  initialSpringVelocity:0.1f options:UIViewAnimationOptionBeginFromCurrentState
-						 animations:^{
-							 self.handleView.frame = handleFrame;
-						 } completion:nil];
-
-		[self setScrollYOffsetForHandleYOffset:floorf(destinationYOffset) animated:NO];
-	}
-}
-
-- (void)gestureMovedToPoint:(CGPoint)touchPoint
-{
-    if (self.disabled) {
-        return;
-    }
-
-    CGFloat delta = 0.0f;
-    CGRect handleFrame = _handleView.frame;
-    CGRect trackFrame = _trackView.frame;
-    CGFloat minimumY = 0.0f;
-    CGFloat maximumY = trackFrame.size.height - handleFrame.size.height;
-
-	if (self.handleExclusiveInteractionEnabled) {
-		if (touchPoint.y < (handleFrame.origin.y - 20) ||
-			touchPoint.y > handleFrame.origin.y + (handleFrame.size.height + 20))
-		{
-			// This touch is not on the handle; eject.
-			return;
-		}
-	}
-	
-    // Apply the updated Y value plus the previous offset
-    delta = handleFrame.origin.y;
-    handleFrame.origin.y = touchPoint.y - _yOffset;
-
-    //Clamp the handle, and adjust the y offset to counter going outside the bounds
-    if (handleFrame.origin.y < minimumY) {
-        _yOffset += handleFrame.origin.y;
-        _yOffset = MAX(minimumY, _yOffset);
-        handleFrame.origin.y = minimumY;
-    }
-    else if (handleFrame.origin.y > maximumY) {
-        CGFloat handleOverflow = CGRectGetMaxY(handleFrame) - trackFrame.size.height;
-        _yOffset += handleOverflow;
-        _yOffset = MIN(self.yOffset, handleFrame.size.height);
-        handleFrame.origin.y = MIN(handleFrame.origin.y, maximumY);
-    }
-
-    _handleView.frame = handleFrame;
-
-    delta -= handleFrame.origin.y;
-    delta = fabs(delta);
-
-    // If the delta is not 0.0, but we're at either extreme,
-    // this is first frame we've since reaching that point.
-    // Play a taptic feedback impact
-    if (delta > FLT_EPSILON && (CGRectGetMinY(handleFrame) < FLT_EPSILON || CGRectGetMinY(handleFrame) >= maximumY - FLT_EPSILON)) {
-        [_feedbackGenerator impactOccurred];
-    }
-
-    // If the user is doing really granualar swipes, add a subtle amount
-    // of vertical animation so the scroll view isn't jumping on each frame
-    [self setScrollYOffsetForHandleYOffset:floorf(handleFrame.origin.y) animated:NO]; //(delta < 0.51f)
-}
-
-- (void)gestureEnded
-{
-    self.scrollView.scrollEnabled = YES;
-    self.dragging = NO;
-
-    [UIView animateWithDuration:0.5f delay:0.0f usingSpringWithDamping:1.0f initialSpringVelocity:0.5f options:0 animations:^{
-        [self layoutInScrollView];
-        [self layoutIfNeeded];
-    } completion:nil];
-}
-
-- (BOOL)pointInside:(CGPoint)point withEvent:(UIEvent *)event
-{
-    if (!self.handleExclusiveInteractionEnabled) {
-		return [super pointInside:point withEvent:event];
-	}
-    else {
-		CGFloat handleMinY = CGRectGetMinY(self.handleView.frame);
-		CGFloat handleMaxY = CGRectGetMaxY(self.handleView.frame);
-		return (0 <= point.x) && (handleMinY <= point.y) && (point.y <= handleMaxY);
-	}
-}
-
-- (UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event
-{
-    UIView *result = [super hitTest:point withEvent:event];
-
-    if (self.disabled || self.dragging) {
-        return result;
-    }
-
-    // If the user contacts the screen in a swiping motion,
-    // the scroll view will automatically highjack the touch
-    // event unless we explicitly override it here.
-
-    self.scrollView.scrollEnabled = (result != self);
-    return result;
-}
-
-#pragma mark - Accessors -
-- (void)setStyle:(TOScrollBarStyle)style
-{
-    _style = style;
-    [self configureViewsForStyle:style];
-}
-
-- (UIColor *)trackTintColor { return self.trackView.tintColor; }
-
-- (void)setTrackTintColor:(UIColor *)trackTintColor
-{
-    self.trackView.tintColor = trackTintColor;
-}
-
-- (UIColor *)handleTintColor { return self.handleView.tintColor; }
-
-- (void)setHandleTintColor:(UIColor *)handleTintColor
-{
-    self.handleView.tintColor = handleTintColor;
-}
-
-- (void)setHidden:(BOOL)hidden
-{
-    self.userHidden = hidden;
-    [self setHidden:hidden animated:NO];
-}
-
-- (void)setHidden:(BOOL)hidden animated:(BOOL)animated
-{
-    // Override. It cannot be shown if it's disabled
-    if (_disabled) {
-        super.hidden = YES;
-        return;
-    }
-
-    // Simply show or hide it if we're not animating
-    if (animated == NO) {
-        super.hidden = hidden;
-        return;
-    }
-
-    // Show it if we're going to animate it
-    if (self.hidden && hidden == NO) {
-        super.hidden = NO;
-        [self layoutInScrollView];
-        [self setNeedsLayout];
-    }
-
-    CGRect fromFrame = self.frame;
-    CGRect toFrame = self.frame;
-
-    CGFloat widestElement = MAX(_trackWidth, _handleWidth);
-    CGFloat hiddenOffset = fromFrame.origin.x + _edgeInset + (widestElement * 2.0f);
-    if (hidden == NO) {
-        fromFrame.origin.x = hiddenOffset;
-    }
-    else {
-        toFrame.origin.x = hiddenOffset;
-    }
-
-    self.frame = fromFrame;
-    [UIView animateWithDuration:0.3f
-                          delay:0.0f
-         usingSpringWithDamping:1.0f
-          initialSpringVelocity:0.1f
-                        options:UIViewAnimationOptionBeginFromCurrentState
-                     animations:^{
-                         self.frame = toFrame;
-                     } completion:^(BOOL finished) {
-                         super.hidden = hidden;
-                     }];
-
-}
-
-#pragma mark - Image Generation -
-+ (UIImage *)verticalCapsuleImageWithWidth:(CGFloat)width
-{
-    UIImage *image = nil;
-    CGFloat radius = width * 0.5f;
-    CGRect frame = (CGRect){0, 0, width+1, width+1};
-
-    UIGraphicsBeginImageContextWithOptions(frame.size, NO, 0.0f);
-    [[UIBezierPath bezierPathWithRoundedRect:frame cornerRadius:radius] fill];
-    image = UIGraphicsGetImageFromCurrentImageContext();
-    UIGraphicsEndImageContext();
-
-    image = [image resizableImageWithCapInsets:UIEdgeInsetsMake(radius, radius, radius, radius) resizingMode:UIImageResizingModeStretch];
-    image = [image imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate];
-
-    return image;
-}
-
-@end

+ 0 - 27
Libraries external/TOScrollBar/TOScrollBarGestureRecognizer.h

@@ -1,27 +0,0 @@
-//
-//  TOScrollBarGestureRecognizer.h
-//
-//  Copyright 2017 Timothy Oliver. All rights reserved.
-//
-//  Permission is hereby granted, free of charge, to any person obtaining a copy
-//  of this software and associated documentation files (the "Software"), to
-//  deal in the Software without restriction, including without limitation the
-//  rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
-//  sell copies of the Software, and to permit persons to whom the Software is
-//  furnished to do so, subject to the following conditions:
-//
-//  The above copyright notice and this permission notice shall be included in
-//  all copies or substantial portions of the Software.
-//
-//  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
-//  OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-//  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-//  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
-//  WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
-//  IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-#import <UIKit/UIKit.h>
-
-@interface TOScrollBarGestureRecognizer : UIGestureRecognizer
-
-@end

+ 0 - 75
Libraries external/TOScrollBar/TOScrollBarGestureRecognizer.m

@@ -1,75 +0,0 @@
-//
-//  TOScrollBarGestureRecognizer.h
-//
-//  Copyright 2017 Timothy Oliver. All rights reserved.
-//
-//  Permission is hereby granted, free of charge, to any person obtaining a copy
-//  of this software and associated documentation files (the "Software"), to
-//  deal in the Software without restriction, including without limitation the
-//  rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
-//  sell copies of the Software, and to permit persons to whom the Software is
-//  furnished to do so, subject to the following conditions:
-//
-//  The above copyright notice and this permission notice shall be included in
-//  all copies or substantial portions of the Software.
-//
-//  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
-//  OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-//  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-//  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
-//  WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
-//  IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-#import "TOScrollBarGestureRecognizer.h"
-#import <UIKit/UIGestureRecognizerSubclass.h>
-#import "TOScrollBar.h"
-
-@interface TOScrollBarGestureRecognizer ()
-
-@property (nonatomic, readonly) TOScrollBar *scrollBar; // The scroll bar this recognizer is attached to
-
-@end
-
-@implementation TOScrollBarGestureRecognizer
-
-#pragma mark - Gesture Recognizer Filtering -
-- (BOOL)canPreventGestureRecognizer:(UIGestureRecognizer *)preventedGestureRecognizer
-{
-    // Ensure that the pan gesture recognizer from the scroll view doesn't override the scroll bar
-    UIView *view = preventedGestureRecognizer.view;
-    if ([view isEqual:self.scrollBar.scrollView]) {
-        return YES;
-    }
-    
-    return NO;
-}
-
-#pragma mark - Touch Interaction -
-- (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event
-{
-    self.state = UIGestureRecognizerStateBegan;
-}
-
-- (void)touchesMoved:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event
-{
-    self.state = UIGestureRecognizerStateChanged;
-}
-
-- (void)touchesEnded:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event
-{
-    self.state = UIGestureRecognizerStateEnded;
-}
-
-- (void)touchesCancelled:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event
-{
-    self.state = UIGestureRecognizerStateCancelled;
-}
-
-#pragma mark - Accessors -
-- (TOScrollBar *)scrollBar
-{
-    if ([self.view isKindOfClass:[TOScrollBar class]] == NO) { return nil; }
-    return (TOScrollBar *)self.view;
-}
-
-@end

+ 0 - 43
Libraries external/TOScrollBar/UIScrollView+TOScrollBar.h

@@ -1,43 +0,0 @@
-//
-//  UIScrollView+TOScrollBar.h
-//
-//  Copyright 2016 Timothy Oliver. All rights reserved.
-//
-//  Permission is hereby granted, free of charge, to any person obtaining a copy
-//  of this software and associated documentation files (the "Software"), to
-//  deal in the Software without restriction, including without limitation the
-//  rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
-//  sell copies of the Software, and to permit persons to whom the Software is
-//  furnished to do so, subject to the following conditions:
-//
-//  The above copyright notice and this permission notice shall be included in
-//  all copies or substantial portions of the Software.
-//
-//  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
-//  OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-//  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-//  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
-//  WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
-//  IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-#import <UIKit/UIKit.h>
-
-@class TOScrollBar;
-
-@interface UIScrollView (TOScrollBar)
-
-/** The scroll bar view currently added to this scroll view */
-@property (nullable, nonatomic, readonly) TOScrollBar *to_scrollBar;
-
-/**
- Adds a new scroll bar instance to this scroll bar
- @param scrollBar The scroll bar in which to add
- */
-- (void)to_addScrollBar:(nullable TOScrollBar *)scrollBar;
-
-/**
- Removes the current scroll bar (if any) from the scroll bar
- */
-- (void)to_removeScrollbar;
-
-@end

+ 0 - 51
Libraries external/TOScrollBar/UIScrollView+TOScrollBar.m

@@ -1,51 +0,0 @@
-//
-//  UIScrollView+TOScrollBar.m
-//
-//  Copyright 2016 Timothy Oliver. All rights reserved.
-//
-//  Permission is hereby granted, free of charge, to any person obtaining a copy
-//  of this software and associated documentation files (the "Software"), to
-//  deal in the Software without restriction, including without limitation the
-//  rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
-//  sell copies of the Software, and to permit persons to whom the Software is
-//  furnished to do so, subject to the following conditions:
-//
-//  The above copyright notice and this permission notice shall be included in
-//  all copies or substantial portions of the Software.
-//
-//  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
-//  OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-//  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-//  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
-//  WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
-//  IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-#import <objc/runtime.h>
-#import "UIScrollView+TOScrollBar.h"
-#import "TOScrollBar.h"
-
-static void * TOScrollBarPropertyKey = &TOScrollBarPropertyKey;
-
-@implementation UIScrollView (TOScrollBar)
-
-- (TOScrollBar *)to_scrollBar
-{
-    return objc_getAssociatedObject(self, TOScrollBarPropertyKey);
-}
-
-- (void)setTo_scrollBar:(TOScrollBar *)scrollBar
-{
-    objc_setAssociatedObject(self, TOScrollBarPropertyKey, scrollBar, OBJC_ASSOCIATION_RETAIN);
-}
-
-- (void)to_addScrollBar:(TOScrollBar *)scrollBar
-{
-    [scrollBar addToScrollView:self];
-}
-
-- (void)to_removeScrollbar
-{
-    [self.to_scrollBar removeFromScrollView];
-}
-
-@end

+ 22 - 45
Nextcloud.xcodeproj/project.pbxproj

@@ -133,6 +133,7 @@
 		F7381EE1218218C9000B1560 /* NCOffline.swift in Sources */ = {isa = PBXBuildFile; fileRef = F7381EDA218218C9000B1560 /* NCOffline.swift */; };
 		F7381EE1218218C9000B1560 /* NCOffline.swift in Sources */ = {isa = PBXBuildFile; fileRef = F7381EDA218218C9000B1560 /* NCOffline.swift */; };
 		F7381EE5218218C9000B1560 /* NCOffline.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = F7381EDE218218C9000B1560 /* NCOffline.storyboard */; };
 		F7381EE5218218C9000B1560 /* NCOffline.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = F7381EDE218218C9000B1560 /* NCOffline.storyboard */; };
 		F738E8421F90FFD100F95C8E /* NCManageEndToEndEncryption.m in Sources */ = {isa = PBXBuildFile; fileRef = F738E8411F90FFD100F95C8E /* NCManageEndToEndEncryption.m */; };
 		F738E8421F90FFD100F95C8E /* NCManageEndToEndEncryption.m in Sources */ = {isa = PBXBuildFile; fileRef = F738E8411F90FFD100F95C8E /* NCManageEndToEndEncryption.m */; };
+		F739513A221B127F00D986C8 /* NCSectionMediaHeader.xib in Resources */ = {isa = PBXBuildFile; fileRef = F7395139221B127F00D986C8 /* NCSectionMediaHeader.xib */; };
 		F73B4EEE1F470D9100BBEE4B /* Big5Freq.tab in Resources */ = {isa = PBXBuildFile; fileRef = F73B4EAD1F470D9100BBEE4B /* Big5Freq.tab */; };
 		F73B4EEE1F470D9100BBEE4B /* Big5Freq.tab in Resources */ = {isa = PBXBuildFile; fileRef = F73B4EAD1F470D9100BBEE4B /* Big5Freq.tab */; };
 		F73B4EEF1F470D9100BBEE4B /* CharDistribution.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F73B4EAE1F470D9100BBEE4B /* CharDistribution.cpp */; };
 		F73B4EEF1F470D9100BBEE4B /* CharDistribution.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F73B4EAE1F470D9100BBEE4B /* CharDistribution.cpp */; };
 		F73B4EF01F470D9100BBEE4B /* CMakeLists.txt in Resources */ = {isa = PBXBuildFile; fileRef = F73B4EB01F470D9100BBEE4B /* CMakeLists.txt */; };
 		F73B4EF01F470D9100BBEE4B /* CMakeLists.txt in Resources */ = {isa = PBXBuildFile; fileRef = F73B4EB01F470D9100BBEE4B /* CMakeLists.txt */; };
@@ -246,6 +247,7 @@
 		F750374D1DBFA91A008FB480 /* ALView+PureLayout.m in Sources */ = {isa = PBXBuildFile; fileRef = F75037441DBFA91A008FB480 /* ALView+PureLayout.m */; };
 		F750374D1DBFA91A008FB480 /* ALView+PureLayout.m in Sources */ = {isa = PBXBuildFile; fileRef = F75037441DBFA91A008FB480 /* ALView+PureLayout.m */; };
 		F750374F1DBFA91A008FB480 /* NSArray+PureLayout.m in Sources */ = {isa = PBXBuildFile; fileRef = F75037461DBFA91A008FB480 /* NSArray+PureLayout.m */; };
 		F750374F1DBFA91A008FB480 /* NSArray+PureLayout.m in Sources */ = {isa = PBXBuildFile; fileRef = F75037461DBFA91A008FB480 /* NSArray+PureLayout.m */; };
 		F75037511DBFA91A008FB480 /* NSLayoutConstraint+PureLayout.m in Sources */ = {isa = PBXBuildFile; fileRef = F75037481DBFA91A008FB480 /* NSLayoutConstraint+PureLayout.m */; };
 		F75037511DBFA91A008FB480 /* NSLayoutConstraint+PureLayout.m in Sources */ = {isa = PBXBuildFile; fileRef = F75037481DBFA91A008FB480 /* NSLayoutConstraint+PureLayout.m */; };
+		F75153242226920200323DDC /* FastScroll.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F75153232226920200323DDC /* FastScroll.framework */; };
 		F754EEC921772B6100BB1CDF /* DropdownItem.swift in Sources */ = {isa = PBXBuildFile; fileRef = F754EEC421772B6100BB1CDF /* DropdownItem.swift */; };
 		F754EEC921772B6100BB1CDF /* DropdownItem.swift in Sources */ = {isa = PBXBuildFile; fileRef = F754EEC421772B6100BB1CDF /* DropdownItem.swift */; };
 		F754EECA21772B6100BB1CDF /* DropUpMenu.swift in Sources */ = {isa = PBXBuildFile; fileRef = F754EEC521772B6100BB1CDF /* DropUpMenu.swift */; };
 		F754EECA21772B6100BB1CDF /* DropUpMenu.swift in Sources */ = {isa = PBXBuildFile; fileRef = F754EEC521772B6100BB1CDF /* DropUpMenu.swift */; };
 		F754EECB21772B6100BB1CDF /* DropdownMenu.swift in Sources */ = {isa = PBXBuildFile; fileRef = F754EEC721772B6100BB1CDF /* DropdownMenu.swift */; };
 		F754EECB21772B6100BB1CDF /* DropdownMenu.swift in Sources */ = {isa = PBXBuildFile; fileRef = F754EEC721772B6100BB1CDF /* DropdownMenu.swift */; };
@@ -293,7 +295,6 @@
 		F760F79B21F21F61006B1A73 /* ColorCollectionViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = F760F77821F21F61006B1A73 /* ColorCollectionViewCell.swift */; };
 		F760F79B21F21F61006B1A73 /* ColorCollectionViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = F760F77821F21F61006B1A73 /* ColorCollectionViewCell.swift */; };
 		F760F79C21F21F61006B1A73 /* GradientView.swift in Sources */ = {isa = PBXBuildFile; fileRef = F760F77921F21F61006B1A73 /* GradientView.swift */; };
 		F760F79C21F21F61006B1A73 /* GradientView.swift in Sources */ = {isa = PBXBuildFile; fileRef = F760F77921F21F61006B1A73 /* GradientView.swift */; };
 		F760F79D21F21F61006B1A73 /* CropRectView.swift in Sources */ = {isa = PBXBuildFile; fileRef = F760F77A21F21F61006B1A73 /* CropRectView.swift */; };
 		F760F79D21F21F61006B1A73 /* CropRectView.swift in Sources */ = {isa = PBXBuildFile; fileRef = F760F77A21F21F61006B1A73 /* CropRectView.swift */; };
-		F761855A2198A2B500A65DC4 /* NCPhotosPickerViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = F76185592198A2B500A65DC4 /* NCPhotosPickerViewController.swift */; };
 		F762CAF71EACB66200B38484 /* XLFormBaseCell.m in Sources */ = {isa = PBXBuildFile; fileRef = F762CAA41EACB66200B38484 /* XLFormBaseCell.m */; };
 		F762CAF71EACB66200B38484 /* XLFormBaseCell.m in Sources */ = {isa = PBXBuildFile; fileRef = F762CAA41EACB66200B38484 /* XLFormBaseCell.m */; };
 		F762CAF81EACB66200B38484 /* XLFormButtonCell.m in Sources */ = {isa = PBXBuildFile; fileRef = F762CAA61EACB66200B38484 /* XLFormButtonCell.m */; };
 		F762CAF81EACB66200B38484 /* XLFormButtonCell.m in Sources */ = {isa = PBXBuildFile; fileRef = F762CAA61EACB66200B38484 /* XLFormButtonCell.m */; };
 		F762CAF91EACB66200B38484 /* XLFormCheckCell.m in Sources */ = {isa = PBXBuildFile; fileRef = F762CAA81EACB66200B38484 /* XLFormCheckCell.m */; };
 		F762CAF91EACB66200B38484 /* XLFormCheckCell.m in Sources */ = {isa = PBXBuildFile; fileRef = F762CAA81EACB66200B38484 /* XLFormCheckCell.m */; };
@@ -358,6 +359,9 @@
 		F771E3F920E239B500AFB62D /* FileProviderExtension+Network.swift in Sources */ = {isa = PBXBuildFile; fileRef = F771E3F620E239B400AFB62D /* FileProviderExtension+Network.swift */; };
 		F771E3F920E239B500AFB62D /* FileProviderExtension+Network.swift in Sources */ = {isa = PBXBuildFile; fileRef = F771E3F620E239B400AFB62D /* FileProviderExtension+Network.swift */; };
 		F771E3FF20E23C3A00AFB62D /* libssl.a in Frameworks */ = {isa = PBXBuildFile; fileRef = F70A63071D5B3467004E2AA5 /* libssl.a */; };
 		F771E3FF20E23C3A00AFB62D /* libssl.a in Frameworks */ = {isa = PBXBuildFile; fileRef = F70A63071D5B3467004E2AA5 /* libssl.a */; };
 		F771E40020E23C3D00AFB62D /* libcrypto.a in Frameworks */ = {isa = PBXBuildFile; fileRef = F70A63061D5B3467004E2AA5 /* libcrypto.a */; };
 		F771E40020E23C3D00AFB62D /* libcrypto.a in Frameworks */ = {isa = PBXBuildFile; fileRef = F70A63061D5B3467004E2AA5 /* libcrypto.a */; };
+		F77444F522281649000D5EB0 /* NCGridMediaCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = F77444F322281649000D5EB0 /* NCGridMediaCell.swift */; };
+		F77444F622281649000D5EB0 /* NCGridMediaCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = F77444F422281649000D5EB0 /* NCGridMediaCell.xib */; };
+		F77444F8222816D5000D5EB0 /* NCPhotosPickerViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = F77444F7222816D5000D5EB0 /* NCPhotosPickerViewController.swift */; };
 		F774DF0F1FCC26BE002AF9FC /* iTunesArtwork@1x.png in Resources */ = {isa = PBXBuildFile; fileRef = F774DF0C1FCC26BD002AF9FC /* iTunesArtwork@1x.png */; };
 		F774DF0F1FCC26BE002AF9FC /* iTunesArtwork@1x.png in Resources */ = {isa = PBXBuildFile; fileRef = F774DF0C1FCC26BD002AF9FC /* iTunesArtwork@1x.png */; };
 		F774DF101FCC26BE002AF9FC /* iTunesArtwork@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = F774DF0D1FCC26BD002AF9FC /* iTunesArtwork@2x.png */; };
 		F774DF101FCC26BE002AF9FC /* iTunesArtwork@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = F774DF0D1FCC26BD002AF9FC /* iTunesArtwork@2x.png */; };
 		F774DF111FCC26BE002AF9FC /* iTunesArtwork@3x.png in Resources */ = {isa = PBXBuildFile; fileRef = F774DF0E1FCC26BE002AF9FC /* iTunesArtwork@3x.png */; };
 		F774DF111FCC26BE002AF9FC /* iTunesArtwork@3x.png in Resources */ = {isa = PBXBuildFile; fileRef = F774DF0E1FCC26BE002AF9FC /* iTunesArtwork@3x.png */; };
@@ -436,9 +440,6 @@
 		F7A321AD1E9E6AD50069AD1B /* CCAdvanced.m in Sources */ = {isa = PBXBuildFile; fileRef = F7A321AC1E9E6AD50069AD1B /* CCAdvanced.m */; };
 		F7A321AD1E9E6AD50069AD1B /* CCAdvanced.m in Sources */ = {isa = PBXBuildFile; fileRef = F7A321AC1E9E6AD50069AD1B /* CCAdvanced.m */; };
 		F7A377161EB2364A002856D3 /* Crashlytics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F7A377141EB2364A002856D3 /* Crashlytics.framework */; };
 		F7A377161EB2364A002856D3 /* Crashlytics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F7A377141EB2364A002856D3 /* Crashlytics.framework */; };
 		F7A3771A1EB2364A002856D3 /* Fabric.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F7A377151EB2364A002856D3 /* Fabric.framework */; };
 		F7A3771A1EB2364A002856D3 /* Fabric.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F7A377151EB2364A002856D3 /* Fabric.framework */; };
-		F7A5541E204EF8AF008468EC /* TOScrollBarGestureRecognizer.m in Sources */ = {isa = PBXBuildFile; fileRef = F7A55418204EF8AF008468EC /* TOScrollBarGestureRecognizer.m */; };
-		F7A5541F204EF8AF008468EC /* TOScrollBar.m in Sources */ = {isa = PBXBuildFile; fileRef = F7A5541B204EF8AF008468EC /* TOScrollBar.m */; };
-		F7A55420204EF8AF008468EC /* UIScrollView+TOScrollBar.m in Sources */ = {isa = PBXBuildFile; fileRef = F7A5541D204EF8AF008468EC /* UIScrollView+TOScrollBar.m */; };
 		F7B0C0CD1EE7E7750033AC24 /* CCSynchronize.m in Sources */ = {isa = PBXBuildFile; fileRef = F7B0C0CC1EE7E7750033AC24 /* CCSynchronize.m */; };
 		F7B0C0CD1EE7E7750033AC24 /* CCSynchronize.m in Sources */ = {isa = PBXBuildFile; fileRef = F7B0C0CC1EE7E7750033AC24 /* CCSynchronize.m */; };
 		F7B0C1751EE839A30033AC24 /* NCAutoUpload.m in Sources */ = {isa = PBXBuildFile; fileRef = F7B0C1741EE839A30033AC24 /* NCAutoUpload.m */; };
 		F7B0C1751EE839A30033AC24 /* NCAutoUpload.m in Sources */ = {isa = PBXBuildFile; fileRef = F7B0C1741EE839A30033AC24 /* NCAutoUpload.m */; };
 		F7B1FBC41E72E3D1001781FE /* Media.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = F7B1FBB11E72E3D1001781FE /* Media.xcassets */; };
 		F7B1FBC41E72E3D1001781FE /* Media.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = F7B1FBB11E72E3D1001781FE /* Media.xcassets */; };
@@ -549,7 +550,6 @@
 		F7DFB7F4219C5CA800680748 /* NCCreateFormUploadScanDocument.swift in Sources */ = {isa = PBXBuildFile; fileRef = F7DFB7F3219C5CA800680748 /* NCCreateFormUploadScanDocument.swift */; };
 		F7DFB7F4219C5CA800680748 /* NCCreateFormUploadScanDocument.swift in Sources */ = {isa = PBXBuildFile; fileRef = F7DFB7F3219C5CA800680748 /* NCCreateFormUploadScanDocument.swift */; };
 		F7DFB7F6219C5F2300680748 /* NCCreateFormUploadRichdocuments.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = F7DFB7F5219C5F2300680748 /* NCCreateFormUploadRichdocuments.storyboard */; };
 		F7DFB7F6219C5F2300680748 /* NCCreateFormUploadRichdocuments.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = F7DFB7F5219C5F2300680748 /* NCCreateFormUploadRichdocuments.storyboard */; };
 		F7E9C41B20F4CA870040CF18 /* CCTransfers.m in Sources */ = {isa = PBXBuildFile; fileRef = F7E9C41820F4CA870040CF18 /* CCTransfers.m */; };
 		F7E9C41B20F4CA870040CF18 /* CCTransfers.m in Sources */ = {isa = PBXBuildFile; fileRef = F7E9C41820F4CA870040CF18 /* CCTransfers.m */; };
-		F7EC9CBC21185F2000F1C5CE /* CCMedia.m in Sources */ = {isa = PBXBuildFile; fileRef = F7EC9CBB21185F2000F1C5CE /* CCMedia.m */; };
 		F7ECBA6D1E239DCD003E6328 /* NCCreateFormUploadRichdocuments.swift in Sources */ = {isa = PBXBuildFile; fileRef = F7ECBA6C1E239DCD003E6328 /* NCCreateFormUploadRichdocuments.swift */; };
 		F7ECBA6D1E239DCD003E6328 /* NCCreateFormUploadRichdocuments.swift in Sources */ = {isa = PBXBuildFile; fileRef = F7ECBA6C1E239DCD003E6328 /* NCCreateFormUploadRichdocuments.swift */; };
 		F7F54CE51E5B14C700E19C62 /* ImageError.png in Resources */ = {isa = PBXBuildFile; fileRef = F7F54CAF1E5B14C700E19C62 /* ImageError.png */; };
 		F7F54CE51E5B14C700E19C62 /* ImageError.png in Resources */ = {isa = PBXBuildFile; fileRef = F7F54CAF1E5B14C700E19C62 /* ImageError.png */; };
 		F7F54CE61E5B14C700E19C62 /* ImageError@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = F7F54CB01E5B14C700E19C62 /* ImageError@2x.png */; };
 		F7F54CE61E5B14C700E19C62 /* ImageError@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = F7F54CB01E5B14C700E19C62 /* ImageError@2x.png */; };
@@ -795,6 +795,7 @@
 		F7381EDE218218C9000B1560 /* NCOffline.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; path = NCOffline.storyboard; sourceTree = "<group>"; };
 		F7381EDE218218C9000B1560 /* NCOffline.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; path = NCOffline.storyboard; sourceTree = "<group>"; };
 		F738E8401F90FFD100F95C8E /* NCManageEndToEndEncryption.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = NCManageEndToEndEncryption.h; sourceTree = "<group>"; };
 		F738E8401F90FFD100F95C8E /* NCManageEndToEndEncryption.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = NCManageEndToEndEncryption.h; sourceTree = "<group>"; };
 		F738E8411F90FFD100F95C8E /* NCManageEndToEndEncryption.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = NCManageEndToEndEncryption.m; sourceTree = "<group>"; };
 		F738E8411F90FFD100F95C8E /* NCManageEndToEndEncryption.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = NCManageEndToEndEncryption.m; sourceTree = "<group>"; };
+		F7395139221B127F00D986C8 /* NCSectionMediaHeader.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = NCSectionMediaHeader.xib; sourceTree = "<group>"; };
 		F73B4EAD1F470D9100BBEE4B /* Big5Freq.tab */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = Big5Freq.tab; sourceTree = "<group>"; };
 		F73B4EAD1F470D9100BBEE4B /* Big5Freq.tab */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = Big5Freq.tab; sourceTree = "<group>"; };
 		F73B4EAE1F470D9100BBEE4B /* CharDistribution.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CharDistribution.cpp; sourceTree = "<group>"; };
 		F73B4EAE1F470D9100BBEE4B /* CharDistribution.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CharDistribution.cpp; sourceTree = "<group>"; };
 		F73B4EAF1F470D9100BBEE4B /* CharDistribution.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CharDistribution.h; sourceTree = "<group>"; };
 		F73B4EAF1F470D9100BBEE4B /* CharDistribution.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CharDistribution.h; sourceTree = "<group>"; };
@@ -902,6 +903,7 @@
 		F750374B1DBFA91A008FB480 /* PureLayoutDefines.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PureLayoutDefines.h; sourceTree = "<group>"; };
 		F750374B1DBFA91A008FB480 /* PureLayoutDefines.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PureLayoutDefines.h; sourceTree = "<group>"; };
 		F7514EDA1C7B1336008F3338 /* CCHud.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCHud.h; sourceTree = "<group>"; };
 		F7514EDA1C7B1336008F3338 /* CCHud.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCHud.h; sourceTree = "<group>"; };
 		F7514EDB1C7B1336008F3338 /* CCHud.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CCHud.m; sourceTree = "<group>"; };
 		F7514EDB1C7B1336008F3338 /* CCHud.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CCHud.m; sourceTree = "<group>"; };
+		F75153232226920200323DDC /* FastScroll.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = FastScroll.framework; path = Carthage/Build/iOS/FastScroll.framework; sourceTree = "<group>"; };
 		F7540EE21D5B238600C3FFA8 /* aes.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = aes.h; sourceTree = "<group>"; };
 		F7540EE21D5B238600C3FFA8 /* aes.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = aes.h; sourceTree = "<group>"; };
 		F7540EE31D5B238600C3FFA8 /* asn1.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = asn1.h; sourceTree = "<group>"; };
 		F7540EE31D5B238600C3FFA8 /* asn1.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = asn1.h; sourceTree = "<group>"; };
 		F7540EE41D5B238600C3FFA8 /* asn1_mac.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = asn1_mac.h; sourceTree = "<group>"; };
 		F7540EE41D5B238600C3FFA8 /* asn1_mac.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = asn1_mac.h; sourceTree = "<group>"; };
@@ -1022,7 +1024,6 @@
 		F760F77821F21F61006B1A73 /* ColorCollectionViewCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ColorCollectionViewCell.swift; sourceTree = "<group>"; };
 		F760F77821F21F61006B1A73 /* ColorCollectionViewCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ColorCollectionViewCell.swift; sourceTree = "<group>"; };
 		F760F77921F21F61006B1A73 /* GradientView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GradientView.swift; sourceTree = "<group>"; };
 		F760F77921F21F61006B1A73 /* GradientView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GradientView.swift; sourceTree = "<group>"; };
 		F760F77A21F21F61006B1A73 /* CropRectView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CropRectView.swift; sourceTree = "<group>"; };
 		F760F77A21F21F61006B1A73 /* CropRectView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CropRectView.swift; sourceTree = "<group>"; };
-		F76185592198A2B500A65DC4 /* NCPhotosPickerViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NCPhotosPickerViewController.swift; sourceTree = "<group>"; };
 		F762CAA31EACB66200B38484 /* XLFormBaseCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XLFormBaseCell.h; sourceTree = "<group>"; };
 		F762CAA31EACB66200B38484 /* XLFormBaseCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XLFormBaseCell.h; sourceTree = "<group>"; };
 		F762CAA41EACB66200B38484 /* XLFormBaseCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = XLFormBaseCell.m; sourceTree = "<group>"; };
 		F762CAA41EACB66200B38484 /* XLFormBaseCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = XLFormBaseCell.m; sourceTree = "<group>"; };
 		F762CAA51EACB66200B38484 /* XLFormButtonCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XLFormButtonCell.h; sourceTree = "<group>"; };
 		F762CAA51EACB66200B38484 /* XLFormButtonCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XLFormButtonCell.h; sourceTree = "<group>"; };
@@ -1161,6 +1162,9 @@
 		F77439541FCD6D6100662C46 /* es-PY */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "es-PY"; path = "es-PY.lproj/Localizable.strings"; sourceTree = "<group>"; };
 		F77439541FCD6D6100662C46 /* es-PY */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "es-PY"; path = "es-PY.lproj/Localizable.strings"; sourceTree = "<group>"; };
 		F774395B1FCD6D8200662C46 /* es-SV */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "es-SV"; path = "es-SV.lproj/Localizable.strings"; sourceTree = "<group>"; };
 		F774395B1FCD6D8200662C46 /* es-SV */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "es-SV"; path = "es-SV.lproj/Localizable.strings"; sourceTree = "<group>"; };
 		F77439621FCD6D9C00662C46 /* es-UY */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "es-UY"; path = "es-UY.lproj/Localizable.strings"; sourceTree = "<group>"; };
 		F77439621FCD6D9C00662C46 /* es-UY */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "es-UY"; path = "es-UY.lproj/Localizable.strings"; sourceTree = "<group>"; };
+		F77444F322281649000D5EB0 /* NCGridMediaCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NCGridMediaCell.swift; sourceTree = "<group>"; };
+		F77444F422281649000D5EB0 /* NCGridMediaCell.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = NCGridMediaCell.xib; sourceTree = "<group>"; };
+		F77444F7222816D5000D5EB0 /* NCPhotosPickerViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NCPhotosPickerViewController.swift; sourceTree = "<group>"; };
 		F774DF0C1FCC26BD002AF9FC /* iTunesArtwork@1x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "iTunesArtwork@1x.png"; sourceTree = "<group>"; };
 		F774DF0C1FCC26BD002AF9FC /* iTunesArtwork@1x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "iTunesArtwork@1x.png"; sourceTree = "<group>"; };
 		F774DF0D1FCC26BD002AF9FC /* iTunesArtwork@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "iTunesArtwork@2x.png"; sourceTree = "<group>"; };
 		F774DF0D1FCC26BD002AF9FC /* iTunesArtwork@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "iTunesArtwork@2x.png"; sourceTree = "<group>"; };
 		F774DF0E1FCC26BE002AF9FC /* iTunesArtwork@3x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "iTunesArtwork@3x.png"; sourceTree = "<group>"; };
 		F774DF0E1FCC26BE002AF9FC /* iTunesArtwork@3x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "iTunesArtwork@3x.png"; sourceTree = "<group>"; };
@@ -1213,12 +1217,6 @@
 		F7A377151EB2364A002856D3 /* Fabric.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = Fabric.framework; sourceTree = "<group>"; };
 		F7A377151EB2364A002856D3 /* Fabric.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = Fabric.framework; sourceTree = "<group>"; };
 		F7A54C341C6267B500E2C8BF /* CCExifGeo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCExifGeo.h; sourceTree = "<group>"; };
 		F7A54C341C6267B500E2C8BF /* CCExifGeo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCExifGeo.h; sourceTree = "<group>"; };
 		F7A54C351C6267B500E2C8BF /* CCExifGeo.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CCExifGeo.m; sourceTree = "<group>"; };
 		F7A54C351C6267B500E2C8BF /* CCExifGeo.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CCExifGeo.m; sourceTree = "<group>"; };
-		F7A55418204EF8AF008468EC /* TOScrollBarGestureRecognizer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TOScrollBarGestureRecognizer.m; sourceTree = "<group>"; };
-		F7A55419204EF8AF008468EC /* TOScrollBar.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TOScrollBar.h; sourceTree = "<group>"; };
-		F7A5541A204EF8AF008468EC /* UIScrollView+TOScrollBar.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIScrollView+TOScrollBar.h"; sourceTree = "<group>"; };
-		F7A5541B204EF8AF008468EC /* TOScrollBar.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TOScrollBar.m; sourceTree = "<group>"; };
-		F7A5541C204EF8AF008468EC /* TOScrollBarGestureRecognizer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TOScrollBarGestureRecognizer.h; sourceTree = "<group>"; };
-		F7A5541D204EF8AF008468EC /* UIScrollView+TOScrollBar.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIScrollView+TOScrollBar.m"; sourceTree = "<group>"; };
 		F7A582D61A24DAB500E903D7 /* AppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; lineEnding = 0; path = AppDelegate.m; sourceTree = "<group>"; };
 		F7A582D61A24DAB500E903D7 /* AppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; lineEnding = 0; path = AppDelegate.m; sourceTree = "<group>"; };
 		F7A582D71A24DAB500E903D7 /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = AppDelegate.h; sourceTree = "<group>"; };
 		F7A582D71A24DAB500E903D7 /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = AppDelegate.h; sourceTree = "<group>"; };
 		F7ACE4291BAC0268006C0017 /* Acknowledgements.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Acknowledgements.h; sourceTree = "<group>"; };
 		F7ACE4291BAC0268006C0017 /* Acknowledgements.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Acknowledgements.h; sourceTree = "<group>"; };
@@ -1392,8 +1390,6 @@
 		F7E45E6D21E75BF200579249 /* ja-JP */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "ja-JP"; path = "ja-JP.lproj/Localizable.strings"; sourceTree = "<group>"; };
 		F7E45E6D21E75BF200579249 /* ja-JP */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "ja-JP"; path = "ja-JP.lproj/Localizable.strings"; sourceTree = "<group>"; };
 		F7E9C41520F4CA870040CF18 /* CCTransfers.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCTransfers.h; sourceTree = "<group>"; };
 		F7E9C41520F4CA870040CF18 /* CCTransfers.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCTransfers.h; sourceTree = "<group>"; };
 		F7E9C41820F4CA870040CF18 /* CCTransfers.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CCTransfers.m; sourceTree = "<group>"; };
 		F7E9C41820F4CA870040CF18 /* CCTransfers.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CCTransfers.m; sourceTree = "<group>"; };
-		F7EC9CBA21185F2000F1C5CE /* CCMedia.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCMedia.h; sourceTree = "<group>"; };
-		F7EC9CBB21185F2000F1C5CE /* CCMedia.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CCMedia.m; sourceTree = "<group>"; };
 		F7ECBA6C1E239DCD003E6328 /* NCCreateFormUploadRichdocuments.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NCCreateFormUploadRichdocuments.swift; sourceTree = "<group>"; };
 		F7ECBA6C1E239DCD003E6328 /* NCCreateFormUploadRichdocuments.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NCCreateFormUploadRichdocuments.swift; sourceTree = "<group>"; };
 		F7F0617A1BAACDD300846525 /* CryptoCloud.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CryptoCloud.pch; sourceTree = "<group>"; };
 		F7F0617A1BAACDD300846525 /* CryptoCloud.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CryptoCloud.pch; sourceTree = "<group>"; };
 		F7F54CAF1E5B14C700E19C62 /* ImageError.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = ImageError.png; sourceTree = "<group>"; };
 		F7F54CAF1E5B14C700E19C62 /* ImageError.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = ImageError.png; sourceTree = "<group>"; };
@@ -1527,6 +1523,7 @@
 				F7C40BF1219994F20004137E /* KTVHTTPCache.framework in Frameworks */,
 				F7C40BF1219994F20004137E /* KTVHTTPCache.framework in Frameworks */,
 				F72D0FFE210B6638009C96B7 /* nanopb.framework in Frameworks */,
 				F72D0FFE210B6638009C96B7 /* nanopb.framework in Frameworks */,
 				F7C40C102199BA5D0004137E /* Realm.framework in Frameworks */,
 				F7C40C102199BA5D0004137E /* Realm.framework in Frameworks */,
+				F75153242226920200323DDC /* FastScroll.framework in Frameworks */,
 				F7C40C122199BA620004137E /* RealmSwift.framework in Frameworks */,
 				F7C40C122199BA620004137E /* RealmSwift.framework in Frameworks */,
 				F72D0FFD210B6638009C96B7 /* GoogleToolboxForMac.framework in Frameworks */,
 				F72D0FFD210B6638009C96B7 /* GoogleToolboxForMac.framework in Frameworks */,
 				F72D0FF9210B6638009C96B7 /* Protobuf.framework in Frameworks */,
 				F72D0FF9210B6638009C96B7 /* Protobuf.framework in Frameworks */,
@@ -1662,19 +1659,19 @@
 				F78ACD4D219043E70088454D /* Layout */,
 				F78ACD4D219043E70088454D /* Layout */,
 				F78ACD3E21903BA20088454D /* Cell */,
 				F78ACD3E21903BA20088454D /* Cell */,
 				F78ACD5921904E460088454D /* ActionSheetHeaderView */,
 				F78ACD5921904E460088454D /* ActionSheetHeaderView */,
-				F76185582198A28E00A65DC4 /* NCPhotosPickerViewController */,
 				F7DFB7E9219C5A0500680748 /* Create cloud */,
 				F7DFB7E9219C5A0500680748 /* Create cloud */,
 				F70211FA1BAC56E9003FC03E /* CCMain.h */,
 				F70211FA1BAC56E9003FC03E /* CCMain.h */,
 				F70211FB1BAC56E9003FC03E /* CCMain.m */,
 				F70211FB1BAC56E9003FC03E /* CCMain.m */,
 				F7226EDB1EE4089300EBECB1 /* Main.storyboard */,
 				F7226EDB1EE4089300EBECB1 /* Main.storyboard */,
 				F7D0E65E1BC5042E008D989A /* CCDetail.h */,
 				F7D0E65E1BC5042E008D989A /* CCDetail.h */,
 				F7D0E65F1BC5042E008D989A /* CCDetail.m */,
 				F7D0E65F1BC5042E008D989A /* CCDetail.m */,
-				F73F537E1E929C8500F8678D /* CCMore.swift */,
 				F78F6FAE1CC8CCB700F4EA25 /* CCSection.h */,
 				F78F6FAE1CC8CCB700F4EA25 /* CCSection.h */,
 				F78F6FAF1CC8CCB700F4EA25 /* CCSection.m */,
 				F78F6FAF1CC8CCB700F4EA25 /* CCSection.m */,
 				F792A77B1BC7C45400C9388E /* CCSplit.h */,
 				F792A77B1BC7C45400C9388E /* CCSplit.h */,
 				F792A77C1BC7C45400C9388E /* CCSplit.m */,
 				F792A77C1BC7C45400C9388E /* CCSplit.m */,
 				F7D6650620FF341600BFBA9E /* NCMainCommon.swift */,
 				F7D6650620FF341600BFBA9E /* NCMainCommon.swift */,
+				F73F537E1E929C8500F8678D /* CCMore.swift */,
+				F77444F7222816D5000D5EB0 /* NCPhotosPickerViewController.swift */,
 			);
 			);
 			path = Main;
 			path = Main;
 			sourceTree = "<group>";
 			sourceTree = "<group>";
@@ -1700,7 +1697,6 @@
 				F7CA1EBB20E7E3FE002CC65E /* PKDownloadButton */,
 				F7CA1EBB20E7E3FE002CC65E /* PKDownloadButton */,
 				F75037421DBFA91A008FB480 /* PureLayout */,
 				F75037421DBFA91A008FB480 /* PureLayout */,
 				F70F05241C889184008DAB36 /* Reachability */,
 				F70F05241C889184008DAB36 /* Reachability */,
-				F7A55417204EF8AF008468EC /* TOScrollBar */,
 				F70F05561C889184008DAB36 /* UIImage+animatedGIF */,
 				F70F05561C889184008DAB36 /* UIImage+animatedGIF */,
 			);
 			);
 			path = "Libraries external";
 			path = "Libraries external";
@@ -2123,14 +2119,6 @@
 			path = PhotoEditor;
 			path = PhotoEditor;
 			sourceTree = "<group>";
 			sourceTree = "<group>";
 		};
 		};
-		F76185582198A28E00A65DC4 /* NCPhotosPickerViewController */ = {
-			isa = PBXGroup;
-			children = (
-				F76185592198A2B500A65DC4 /* NCPhotosPickerViewController.swift */,
-			);
-			path = NCPhotosPickerViewController;
-			sourceTree = "<group>";
-		};
 		F762CA9F1EACB66200B38484 /* XLForm */ = {
 		F762CA9F1EACB66200B38484 /* XLForm */ = {
 			isa = PBXGroup;
 			isa = PBXGroup;
 			children = (
 			children = (
@@ -2357,6 +2345,8 @@
 				F70211F91BAC56E9003FC03E /* CCCellMainTransfer.xib */,
 				F70211F91BAC56E9003FC03E /* CCCellMainTransfer.xib */,
 				F78ACD3F21903CC20088454D /* NCGridCell.swift */,
 				F78ACD3F21903CC20088454D /* NCGridCell.swift */,
 				F78ACD4521903D010088454D /* NCGridCell.xib */,
 				F78ACD4521903D010088454D /* NCGridCell.xib */,
+				F77444F322281649000D5EB0 /* NCGridMediaCell.swift */,
+				F77444F422281649000D5EB0 /* NCGridMediaCell.xib */,
 				F78ACD4121903CE00088454D /* NCListCell.swift */,
 				F78ACD4121903CE00088454D /* NCListCell.swift */,
 				F78ACD4321903CF20088454D /* NCListCell.xib */,
 				F78ACD4321903CF20088454D /* NCListCell.xib */,
 			);
 			);
@@ -2384,6 +2374,7 @@
 			isa = PBXGroup;
 			isa = PBXGroup;
 			children = (
 			children = (
 				F78ACD51219046DC0088454D /* NCSectionHeaderFooter.swift */,
 				F78ACD51219046DC0088454D /* NCSectionHeaderFooter.swift */,
+				F7395139221B127F00D986C8 /* NCSectionMediaHeader.xib */,
 				F78ACD55219047E90088454D /* NCSectionHeader.xib */,
 				F78ACD55219047E90088454D /* NCSectionHeader.xib */,
 				F78ACD57219048040088454D /* NCSectionHeaderMenu.xib */,
 				F78ACD57219048040088454D /* NCSectionHeaderMenu.xib */,
 				F78ACD53219047D40088454D /* NCSectionFooter.xib */,
 				F78ACD53219047D40088454D /* NCSectionFooter.xib */,
@@ -2468,19 +2459,6 @@
 			path = "Libraries external/Fabric";
 			path = "Libraries external/Fabric";
 			sourceTree = SOURCE_ROOT;
 			sourceTree = SOURCE_ROOT;
 		};
 		};
-		F7A55417204EF8AF008468EC /* TOScrollBar */ = {
-			isa = PBXGroup;
-			children = (
-				F7A55419204EF8AF008468EC /* TOScrollBar.h */,
-				F7A5541B204EF8AF008468EC /* TOScrollBar.m */,
-				F7A5541C204EF8AF008468EC /* TOScrollBarGestureRecognizer.h */,
-				F7A55418204EF8AF008468EC /* TOScrollBarGestureRecognizer.m */,
-				F7A5541A204EF8AF008468EC /* UIScrollView+TOScrollBar.h */,
-				F7A5541D204EF8AF008468EC /* UIScrollView+TOScrollBar.m */,
-			);
-			path = TOScrollBar;
-			sourceTree = "<group>";
-		};
 		F7ACE4281BAC0268006C0017 /* Settings */ = {
 		F7ACE4281BAC0268006C0017 /* Settings */ = {
 			isa = PBXGroup;
 			isa = PBXGroup;
 			children = (
 			children = (
@@ -2813,8 +2791,6 @@
 		F7EC9CB921185F2000F1C5CE /* Media */ = {
 		F7EC9CB921185F2000F1C5CE /* Media */ = {
 			isa = PBXGroup;
 			isa = PBXGroup;
 			children = (
 			children = (
-				F7EC9CBA21185F2000F1C5CE /* CCMedia.h */,
-				F7EC9CBB21185F2000F1C5CE /* CCMedia.m */,
 				F7501C302212E57400FB1415 /* NCMedia.storyboard */,
 				F7501C302212E57400FB1415 /* NCMedia.storyboard */,
 				F7501C312212E57400FB1415 /* NCMedia.swift */,
 				F7501C312212E57400FB1415 /* NCMedia.swift */,
 			);
 			);
@@ -2994,6 +2970,7 @@
 		F7FC7D541DC1F93700BB2C6A /* Frameworks */ = {
 		F7FC7D541DC1F93700BB2C6A /* Frameworks */ = {
 			isa = PBXGroup;
 			isa = PBXGroup;
 			children = (
 			children = (
+				F75153232226920200323DDC /* FastScroll.framework */,
 				F78AA20521F783E900D0F205 /* SwiftRichString.framework */,
 				F78AA20521F783E900D0F205 /* SwiftRichString.framework */,
 				F72E0B9C21AD60BC00898D7B /* WeScan.framework */,
 				F72E0B9C21AD60BC00898D7B /* WeScan.framework */,
 				F7063DF02199E56E003F38DA /* CocoaLumberjackSwift.framework */,
 				F7063DF02199E56E003F38DA /* CocoaLumberjackSwift.framework */,
@@ -3297,6 +3274,7 @@
 				F7F54D041E5B14C800E19C62 /* VideoOverlay@2x.png in Resources */,
 				F7F54D041E5B14C800E19C62 /* VideoOverlay@2x.png in Resources */,
 				F7F54CF51E5B14C700E19C62 /* PlayButtonOverlayLarge@2x.png in Resources */,
 				F7F54CF51E5B14C700E19C62 /* PlayButtonOverlayLarge@2x.png in Resources */,
 				F77D49A91DC238E500CDC568 /* loading.gif in Resources */,
 				F77D49A91DC238E500CDC568 /* loading.gif in Resources */,
+				F77444F622281649000D5EB0 /* NCGridMediaCell.xib in Resources */,
 				F78ACD4421903CF20088454D /* NCListCell.xib in Resources */,
 				F78ACD4421903CF20088454D /* NCListCell.xib in Resources */,
 				F78ACD4621903D010088454D /* NCGridCell.xib in Resources */,
 				F78ACD4621903D010088454D /* NCGridCell.xib in Resources */,
 				F7F54CF91E5B14C700E19C62 /* PlayButtonOverlayLargeTap@3x.png in Resources */,
 				F7F54CF91E5B14C700E19C62 /* PlayButtonOverlayLargeTap@3x.png in Resources */,
@@ -3341,6 +3319,7 @@
 				F7D4233C1F0596AC009C9782 /* Reader-Button-N@2x.png in Resources */,
 				F7D4233C1F0596AC009C9782 /* Reader-Button-N@2x.png in Resources */,
 				F729B92B217A2E4E00FE2150 /* NCActionSheetHeaderView.xib in Resources */,
 				F729B92B217A2E4E00FE2150 /* NCActionSheetHeaderView.xib in Resources */,
 				F7D423411F0596AC009C9782 /* Reader-Export.png in Resources */,
 				F7D423411F0596AC009C9782 /* Reader-Export.png in Resources */,
+				F739513A221B127F00D986C8 /* NCSectionMediaHeader.xib in Resources */,
 				F77B0F481D118A16002130FE /* synchronized.gif in Resources */,
 				F77B0F481D118A16002130FE /* synchronized.gif in Resources */,
 				F7D4233E1F0596AC009C9782 /* Reader-Email.png in Resources */,
 				F7D4233E1F0596AC009C9782 /* Reader-Email.png in Resources */,
 				F762CB981EACB84400B38484 /* icon-info@2x.png in Resources */,
 				F762CB981EACB84400B38484 /* icon-info@2x.png in Resources */,
@@ -3460,6 +3439,7 @@
 				"$(SRCROOT)/Carthage/Build/iOS/CocoaLumberjackSwift.framework",
 				"$(SRCROOT)/Carthage/Build/iOS/CocoaLumberjackSwift.framework",
 				"$(SRCROOT)/Carthage/Build/iOS/WeScan.framework",
 				"$(SRCROOT)/Carthage/Build/iOS/WeScan.framework",
 				"$(SRCROOT)/Carthage/Build/iOS/SwiftRichString.framework",
 				"$(SRCROOT)/Carthage/Build/iOS/SwiftRichString.framework",
+				"$(SRCROOT)/Carthage/Build/iOS/FastScroll.framework",
 			);
 			);
 			outputPaths = (
 			outputPaths = (
 			);
 			);
@@ -3639,6 +3619,7 @@
 				F77B0DF21D118A16002130FE /* CCUploadFromOtherUpp.m in Sources */,
 				F77B0DF21D118A16002130FE /* CCUploadFromOtherUpp.m in Sources */,
 				F754EECB21772B6100BB1CDF /* DropdownMenu.swift in Sources */,
 				F754EECB21772B6100BB1CDF /* DropdownMenu.swift in Sources */,
 				F760F78221F21F61006B1A73 /* PhotoEditor+UITextView.swift in Sources */,
 				F760F78221F21F61006B1A73 /* PhotoEditor+UITextView.swift in Sources */,
+				F77444F522281649000D5EB0 /* NCGridMediaCell.swift in Sources */,
 				F77B0DF41D118A16002130FE /* CCMain.m in Sources */,
 				F77B0DF41D118A16002130FE /* CCMain.m in Sources */,
 				F7E9C41B20F4CA870040CF18 /* CCTransfers.m in Sources */,
 				F7E9C41B20F4CA870040CF18 /* CCTransfers.m in Sources */,
 				F73B4F0D1F470D9100BBEE4B /* nsLatin1Prober.cpp in Sources */,
 				F73B4F0D1F470D9100BBEE4B /* nsLatin1Prober.cpp in Sources */,
@@ -3669,7 +3650,6 @@
 				F760F79921F21F61006B1A73 /* CropViewController.swift in Sources */,
 				F760F79921F21F61006B1A73 /* CropViewController.swift in Sources */,
 				F70022EC1EC4C9100080073F /* OCXMLSharedParser.m in Sources */,
 				F70022EC1EC4C9100080073F /* OCXMLSharedParser.m in Sources */,
 				F7F54D061E5B14C800E19C62 /* MWCaptionView.m in Sources */,
 				F7F54D061E5B14C800E19C62 /* MWCaptionView.m in Sources */,
-				F7A55420204EF8AF008468EC /* UIScrollView+TOScrollBar.m in Sources */,
 				F762CB001EACB66200B38484 /* XLFormSegmentedCell.m in Sources */,
 				F762CB001EACB66200B38484 /* XLFormSegmentedCell.m in Sources */,
 				F732BA061D76CE1500E9878B /* CCNetworking.m in Sources */,
 				F732BA061D76CE1500E9878B /* CCNetworking.m in Sources */,
 				F70022B01EC4C9100080073F /* AFURLSessionManager.m in Sources */,
 				F70022B01EC4C9100080073F /* AFURLSessionManager.m in Sources */,
@@ -3685,7 +3665,6 @@
 				F73B4EF71F470D9100BBEE4B /* LangBulgarianModel.cpp in Sources */,
 				F73B4EF71F470D9100BBEE4B /* LangBulgarianModel.cpp in Sources */,
 				F7F54D0C1E5B14C800E19C62 /* MWTapDetectingView.m in Sources */,
 				F7F54D0C1E5B14C800E19C62 /* MWTapDetectingView.m in Sources */,
 				F7B1FBC61E72E3D1001781FE /* SwiftModalWebVC.swift in Sources */,
 				F7B1FBC61E72E3D1001781FE /* SwiftModalWebVC.swift in Sources */,
-				F7A5541F204EF8AF008468EC /* TOScrollBar.m in Sources */,
 				F7FB1D3E215E191D00D669EA /* NCViewerDocumentWeb.swift in Sources */,
 				F7FB1D3E215E191D00D669EA /* NCViewerDocumentWeb.swift in Sources */,
 				F78E7065219F096B006F23E4 /* NCAvatar.swift in Sources */,
 				F78E7065219F096B006F23E4 /* NCAvatar.swift in Sources */,
 				F7DFB7F0219C5B8000680748 /* NCCreateFormUploadAssets.swift in Sources */,
 				F7DFB7F0219C5B8000680748 /* NCCreateFormUploadAssets.swift in Sources */,
@@ -3697,6 +3676,7 @@
 				F76C6F8E21943C8C0063591B /* NCActionSheetHeader.swift in Sources */,
 				F76C6F8E21943C8C0063591B /* NCActionSheetHeader.swift in Sources */,
 				F760F79121F21F61006B1A73 /* EmojiCollectionViewCell.swift in Sources */,
 				F760F79121F21F61006B1A73 /* EmojiCollectionViewCell.swift in Sources */,
 				F750374F1DBFA91A008FB480 /* NSArray+PureLayout.m in Sources */,
 				F750374F1DBFA91A008FB480 /* NSArray+PureLayout.m in Sources */,
+				F77444F8222816D5000D5EB0 /* NCPhotosPickerViewController.swift in Sources */,
 				F77B0E141D118A16002130FE /* CCError.m in Sources */,
 				F77B0E141D118A16002130FE /* CCError.m in Sources */,
 				F73B4F131F470D9100BBEE4B /* nsUniversalDetector.cpp in Sources */,
 				F73B4F131F470D9100BBEE4B /* nsUniversalDetector.cpp in Sources */,
 				F7B0C1751EE839A30033AC24 /* NCAutoUpload.m in Sources */,
 				F7B0C1751EE839A30033AC24 /* NCAutoUpload.m in Sources */,
@@ -3722,7 +3702,6 @@
 				F762CB081EACB66200B38484 /* XLFormOptionsViewController.m in Sources */,
 				F762CB081EACB66200B38484 /* XLFormOptionsViewController.m in Sources */,
 				F73CC0721E813DFF006E3047 /* BKPasscodeLockScreenManager.m in Sources */,
 				F73CC0721E813DFF006E3047 /* BKPasscodeLockScreenManager.m in Sources */,
 				F760F78B21F21F61006B1A73 /* UIImage+Crop.swift in Sources */,
 				F760F78B21F21F61006B1A73 /* UIImage+Crop.swift in Sources */,
-				F761855A2198A2B500A65DC4 /* NCPhotosPickerViewController.swift in Sources */,
 				F73B4F101F470D9100BBEE4B /* nsSBCharSetProber.cpp in Sources */,
 				F73B4F101F470D9100BBEE4B /* nsSBCharSetProber.cpp in Sources */,
 				F762CB0E1EACB66200B38484 /* NSExpression+XLFormAdditions.m in Sources */,
 				F762CB0E1EACB66200B38484 /* NSExpression+XLFormAdditions.m in Sources */,
 				F73B4F071F470D9100BBEE4B /* nsEscSM.cpp in Sources */,
 				F73B4F071F470D9100BBEE4B /* nsEscSM.cpp in Sources */,
@@ -3746,7 +3725,6 @@
 				F70022E31EC4C9100080073F /* OCXMLParser.m in Sources */,
 				F70022E31EC4C9100080073F /* OCXMLParser.m in Sources */,
 				F77B0E311D118A16002130FE /* CCExifGeo.m in Sources */,
 				F77B0E311D118A16002130FE /* CCExifGeo.m in Sources */,
 				F73B4F0E1F470D9100BBEE4B /* nsMBCSGroupProber.cpp in Sources */,
 				F73B4F0E1F470D9100BBEE4B /* nsMBCSGroupProber.cpp in Sources */,
-				F7EC9CBC21185F2000F1C5CE /* CCMedia.m in Sources */,
 				F7D423831F0596C6009C9782 /* ReaderThumbFetch.m in Sources */,
 				F7D423831F0596C6009C9782 /* ReaderThumbFetch.m in Sources */,
 				F73B4F171F470D9100BBEE4B /* uchardet.cpp in Sources */,
 				F73B4F171F470D9100BBEE4B /* uchardet.cpp in Sources */,
 				F7D4237A1F0596C6009C9782 /* ReaderConstants.m in Sources */,
 				F7D4237A1F0596C6009C9782 /* ReaderConstants.m in Sources */,
@@ -3769,7 +3747,6 @@
 				F760F77D21F21F61006B1A73 /* ColorsCollectionViewDelegate.swift in Sources */,
 				F760F77D21F21F61006B1A73 /* ColorsCollectionViewDelegate.swift in Sources */,
 				F7BAADC81ED5A87C00B7EAD4 /* NCDatabase.swift in Sources */,
 				F7BAADC81ED5A87C00B7EAD4 /* NCDatabase.swift in Sources */,
 				F77B0E541D118A16002130FE /* CCMove.m in Sources */,
 				F77B0E541D118A16002130FE /* CCMove.m in Sources */,
-				F7A5541E204EF8AF008468EC /* TOScrollBarGestureRecognizer.m in Sources */,
 				F70022E61EC4C9100080073F /* OCXMLServerErrorsParser.m in Sources */,
 				F70022E61EC4C9100080073F /* OCXMLServerErrorsParser.m in Sources */,
 				F762CB171EACB66200B38484 /* XLFormRegexValidator.m in Sources */,
 				F762CB171EACB66200B38484 /* XLFormRegexValidator.m in Sources */,
 				F729B92D217A2F1B00FE2150 /* NCActionSheetHeaderView.swift in Sources */,
 				F729B92D217A2F1B00FE2150 /* NCActionSheetHeaderView.swift in Sources */,

+ 108 - 0
Nextcloud.xcodeproj/xcshareddata/xcschemes/File Provider Extension.xcscheme

@@ -0,0 +1,108 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<Scheme
+   LastUpgradeVersion = "1010"
+   wasCreatedForAppExtension = "YES"
+   version = "2.0">
+   <BuildAction
+      parallelizeBuildables = "YES"
+      buildImplicitDependencies = "YES">
+      <BuildActionEntries>
+         <BuildActionEntry
+            buildForTesting = "YES"
+            buildForRunning = "YES"
+            buildForProfiling = "YES"
+            buildForArchiving = "YES"
+            buildForAnalyzing = "YES">
+            <BuildableReference
+               BuildableIdentifier = "primary"
+               BlueprintIdentifier = "F771E3CF20E2392D00AFB62D"
+               BuildableName = "File Provider Extension.appex"
+               BlueprintName = "File Provider Extension"
+               ReferencedContainer = "container:Nextcloud.xcodeproj">
+            </BuildableReference>
+         </BuildActionEntry>
+         <BuildActionEntry
+            buildForTesting = "YES"
+            buildForRunning = "YES"
+            buildForProfiling = "YES"
+            buildForArchiving = "YES"
+            buildForAnalyzing = "YES">
+            <BuildableReference
+               BuildableIdentifier = "primary"
+               BlueprintIdentifier = "F77B0DEB1D118A16002130FE"
+               BuildableName = "Nextcloud.app"
+               BlueprintName = "Nextcloud"
+               ReferencedContainer = "container:Nextcloud.xcodeproj">
+            </BuildableReference>
+         </BuildActionEntry>
+      </BuildActionEntries>
+   </BuildAction>
+   <TestAction
+      buildConfiguration = "Debug"
+      selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
+      selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
+      shouldUseLaunchSchemeArgsEnv = "YES">
+      <Testables>
+      </Testables>
+      <MacroExpansion>
+         <BuildableReference
+            BuildableIdentifier = "primary"
+            BlueprintIdentifier = "F771E3CF20E2392D00AFB62D"
+            BuildableName = "File Provider Extension.appex"
+            BlueprintName = "File Provider Extension"
+            ReferencedContainer = "container:Nextcloud.xcodeproj">
+         </BuildableReference>
+      </MacroExpansion>
+      <AdditionalOptions>
+      </AdditionalOptions>
+   </TestAction>
+   <LaunchAction
+      buildConfiguration = "Debug"
+      selectedDebuggerIdentifier = ""
+      selectedLauncherIdentifier = "Xcode.IDEFoundation.Launcher.PosixSpawn"
+      launchStyle = "0"
+      useCustomWorkingDirectory = "NO"
+      ignoresPersistentStateOnLaunch = "NO"
+      debugDocumentVersioning = "YES"
+      debugServiceExtension = "internal"
+      allowLocationSimulation = "YES"
+      launchAutomaticallySubstyle = "2">
+      <BuildableProductRunnable
+         runnableDebuggingMode = "0">
+         <BuildableReference
+            BuildableIdentifier = "primary"
+            BlueprintIdentifier = "F77B0DEB1D118A16002130FE"
+            BuildableName = "Nextcloud.app"
+            BlueprintName = "Nextcloud"
+            ReferencedContainer = "container:Nextcloud.xcodeproj">
+         </BuildableReference>
+      </BuildableProductRunnable>
+      <AdditionalOptions>
+      </AdditionalOptions>
+   </LaunchAction>
+   <ProfileAction
+      buildConfiguration = "Release"
+      shouldUseLaunchSchemeArgsEnv = "YES"
+      savedToolIdentifier = ""
+      useCustomWorkingDirectory = "NO"
+      debugDocumentVersioning = "YES"
+      launchAutomaticallySubstyle = "2">
+      <BuildableProductRunnable
+         runnableDebuggingMode = "0">
+         <BuildableReference
+            BuildableIdentifier = "primary"
+            BlueprintIdentifier = "F77B0DEB1D118A16002130FE"
+            BuildableName = "Nextcloud.app"
+            BlueprintName = "Nextcloud"
+            ReferencedContainer = "container:Nextcloud.xcodeproj">
+         </BuildableReference>
+      </BuildableProductRunnable>
+   </ProfileAction>
+   <AnalyzeAction
+      buildConfiguration = "Debug">
+   </AnalyzeAction>
+   <ArchiveAction
+      buildConfiguration = "Release"
+      revealArchiveInOrganizer = "YES">
+   </ArchiveAction>
+</Scheme>

+ 91 - 0
Nextcloud.xcodeproj/xcshareddata/xcschemes/Nextcloud.xcscheme

@@ -0,0 +1,91 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<Scheme
+   LastUpgradeVersion = "1010"
+   version = "1.3">
+   <BuildAction
+      parallelizeBuildables = "YES"
+      buildImplicitDependencies = "YES">
+      <BuildActionEntries>
+         <BuildActionEntry
+            buildForTesting = "YES"
+            buildForRunning = "YES"
+            buildForProfiling = "YES"
+            buildForArchiving = "YES"
+            buildForAnalyzing = "YES">
+            <BuildableReference
+               BuildableIdentifier = "primary"
+               BlueprintIdentifier = "F77B0DEB1D118A16002130FE"
+               BuildableName = "Nextcloud.app"
+               BlueprintName = "Nextcloud"
+               ReferencedContainer = "container:Nextcloud.xcodeproj">
+            </BuildableReference>
+         </BuildActionEntry>
+      </BuildActionEntries>
+   </BuildAction>
+   <TestAction
+      buildConfiguration = "Debug"
+      selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
+      selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
+      shouldUseLaunchSchemeArgsEnv = "YES">
+      <Testables>
+      </Testables>
+      <MacroExpansion>
+         <BuildableReference
+            BuildableIdentifier = "primary"
+            BlueprintIdentifier = "F77B0DEB1D118A16002130FE"
+            BuildableName = "Nextcloud.app"
+            BlueprintName = "Nextcloud"
+            ReferencedContainer = "container:Nextcloud.xcodeproj">
+         </BuildableReference>
+      </MacroExpansion>
+      <AdditionalOptions>
+      </AdditionalOptions>
+   </TestAction>
+   <LaunchAction
+      buildConfiguration = "Debug"
+      selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
+      selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
+      launchStyle = "0"
+      useCustomWorkingDirectory = "NO"
+      ignoresPersistentStateOnLaunch = "NO"
+      debugDocumentVersioning = "YES"
+      debugServiceExtension = "internal"
+      allowLocationSimulation = "YES">
+      <BuildableProductRunnable
+         runnableDebuggingMode = "0">
+         <BuildableReference
+            BuildableIdentifier = "primary"
+            BlueprintIdentifier = "F77B0DEB1D118A16002130FE"
+            BuildableName = "Nextcloud.app"
+            BlueprintName = "Nextcloud"
+            ReferencedContainer = "container:Nextcloud.xcodeproj">
+         </BuildableReference>
+      </BuildableProductRunnable>
+      <AdditionalOptions>
+      </AdditionalOptions>
+   </LaunchAction>
+   <ProfileAction
+      buildConfiguration = "Release"
+      shouldUseLaunchSchemeArgsEnv = "YES"
+      savedToolIdentifier = ""
+      useCustomWorkingDirectory = "NO"
+      debugDocumentVersioning = "YES">
+      <BuildableProductRunnable
+         runnableDebuggingMode = "0">
+         <BuildableReference
+            BuildableIdentifier = "primary"
+            BlueprintIdentifier = "F77B0DEB1D118A16002130FE"
+            BuildableName = "Nextcloud.app"
+            BlueprintName = "Nextcloud"
+            ReferencedContainer = "container:Nextcloud.xcodeproj">
+         </BuildableReference>
+      </BuildableProductRunnable>
+   </ProfileAction>
+   <AnalyzeAction
+      buildConfiguration = "Debug">
+   </AnalyzeAction>
+   <ArchiveAction
+      buildConfiguration = "Release"
+      revealArchiveInOrganizer = "YES">
+   </ArchiveAction>
+</Scheme>

+ 108 - 0
Nextcloud.xcodeproj/xcshareddata/xcschemes/Notification Service Extension.xcscheme

@@ -0,0 +1,108 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<Scheme
+   LastUpgradeVersion = "1010"
+   wasCreatedForAppExtension = "YES"
+   version = "2.0">
+   <BuildAction
+      parallelizeBuildables = "YES"
+      buildImplicitDependencies = "YES">
+      <BuildActionEntries>
+         <BuildActionEntry
+            buildForTesting = "YES"
+            buildForRunning = "YES"
+            buildForProfiling = "YES"
+            buildForArchiving = "YES"
+            buildForAnalyzing = "YES">
+            <BuildableReference
+               BuildableIdentifier = "primary"
+               BlueprintIdentifier = "F72D100B210B6B16009C96B7"
+               BuildableName = "Notification Service Extension.appex"
+               BlueprintName = "Notification Service Extension"
+               ReferencedContainer = "container:Nextcloud.xcodeproj">
+            </BuildableReference>
+         </BuildActionEntry>
+         <BuildActionEntry
+            buildForTesting = "YES"
+            buildForRunning = "YES"
+            buildForProfiling = "YES"
+            buildForArchiving = "YES"
+            buildForAnalyzing = "YES">
+            <BuildableReference
+               BuildableIdentifier = "primary"
+               BlueprintIdentifier = "F77B0DEB1D118A16002130FE"
+               BuildableName = "Nextcloud.app"
+               BlueprintName = "Nextcloud"
+               ReferencedContainer = "container:Nextcloud.xcodeproj">
+            </BuildableReference>
+         </BuildActionEntry>
+      </BuildActionEntries>
+   </BuildAction>
+   <TestAction
+      buildConfiguration = "Debug"
+      selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
+      selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
+      shouldUseLaunchSchemeArgsEnv = "YES">
+      <Testables>
+      </Testables>
+      <MacroExpansion>
+         <BuildableReference
+            BuildableIdentifier = "primary"
+            BlueprintIdentifier = "F72D100B210B6B16009C96B7"
+            BuildableName = "Notification Service Extension.appex"
+            BlueprintName = "Notification Service Extension"
+            ReferencedContainer = "container:Nextcloud.xcodeproj">
+         </BuildableReference>
+      </MacroExpansion>
+      <AdditionalOptions>
+      </AdditionalOptions>
+   </TestAction>
+   <LaunchAction
+      buildConfiguration = "Debug"
+      selectedDebuggerIdentifier = ""
+      selectedLauncherIdentifier = "Xcode.IDEFoundation.Launcher.PosixSpawn"
+      launchStyle = "0"
+      useCustomWorkingDirectory = "NO"
+      ignoresPersistentStateOnLaunch = "NO"
+      debugDocumentVersioning = "YES"
+      debugServiceExtension = "internal"
+      allowLocationSimulation = "YES"
+      launchAutomaticallySubstyle = "2">
+      <BuildableProductRunnable
+         runnableDebuggingMode = "0">
+         <BuildableReference
+            BuildableIdentifier = "primary"
+            BlueprintIdentifier = "F77B0DEB1D118A16002130FE"
+            BuildableName = "Nextcloud.app"
+            BlueprintName = "Nextcloud"
+            ReferencedContainer = "container:Nextcloud.xcodeproj">
+         </BuildableReference>
+      </BuildableProductRunnable>
+      <AdditionalOptions>
+      </AdditionalOptions>
+   </LaunchAction>
+   <ProfileAction
+      buildConfiguration = "Release"
+      shouldUseLaunchSchemeArgsEnv = "YES"
+      savedToolIdentifier = ""
+      useCustomWorkingDirectory = "NO"
+      debugDocumentVersioning = "YES"
+      launchAutomaticallySubstyle = "2">
+      <BuildableProductRunnable
+         runnableDebuggingMode = "0">
+         <BuildableReference
+            BuildableIdentifier = "primary"
+            BlueprintIdentifier = "F77B0DEB1D118A16002130FE"
+            BuildableName = "Nextcloud.app"
+            BlueprintName = "Nextcloud"
+            ReferencedContainer = "container:Nextcloud.xcodeproj">
+         </BuildableReference>
+      </BuildableProductRunnable>
+   </ProfileAction>
+   <AnalyzeAction
+      buildConfiguration = "Debug">
+   </AnalyzeAction>
+   <ArchiveAction
+      buildConfiguration = "Release"
+      revealArchiveInOrganizer = "YES">
+   </ArchiveAction>
+</Scheme>

+ 108 - 0
Nextcloud.xcodeproj/xcshareddata/xcschemes/Share.xcscheme

@@ -0,0 +1,108 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<Scheme
+   LastUpgradeVersion = "1010"
+   wasCreatedForAppExtension = "YES"
+   version = "2.0">
+   <BuildAction
+      parallelizeBuildables = "YES"
+      buildImplicitDependencies = "YES">
+      <BuildActionEntries>
+         <BuildActionEntry
+            buildForTesting = "YES"
+            buildForRunning = "YES"
+            buildForProfiling = "YES"
+            buildForArchiving = "YES"
+            buildForAnalyzing = "YES">
+            <BuildableReference
+               BuildableIdentifier = "primary"
+               BlueprintIdentifier = "F71459B41D12E3B700CAFEEC"
+               BuildableName = "Share.appex"
+               BlueprintName = "Share"
+               ReferencedContainer = "container:Nextcloud.xcodeproj">
+            </BuildableReference>
+         </BuildActionEntry>
+         <BuildActionEntry
+            buildForTesting = "YES"
+            buildForRunning = "YES"
+            buildForProfiling = "YES"
+            buildForArchiving = "YES"
+            buildForAnalyzing = "YES">
+            <BuildableReference
+               BuildableIdentifier = "primary"
+               BlueprintIdentifier = "F77B0DEB1D118A16002130FE"
+               BuildableName = "Nextcloud.app"
+               BlueprintName = "Nextcloud"
+               ReferencedContainer = "container:Nextcloud.xcodeproj">
+            </BuildableReference>
+         </BuildActionEntry>
+      </BuildActionEntries>
+   </BuildAction>
+   <TestAction
+      buildConfiguration = "Debug"
+      selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
+      selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
+      shouldUseLaunchSchemeArgsEnv = "YES">
+      <Testables>
+      </Testables>
+      <MacroExpansion>
+         <BuildableReference
+            BuildableIdentifier = "primary"
+            BlueprintIdentifier = "F71459B41D12E3B700CAFEEC"
+            BuildableName = "Share.appex"
+            BlueprintName = "Share"
+            ReferencedContainer = "container:Nextcloud.xcodeproj">
+         </BuildableReference>
+      </MacroExpansion>
+      <AdditionalOptions>
+      </AdditionalOptions>
+   </TestAction>
+   <LaunchAction
+      buildConfiguration = "Debug"
+      selectedDebuggerIdentifier = ""
+      selectedLauncherIdentifier = "Xcode.IDEFoundation.Launcher.PosixSpawn"
+      launchStyle = "0"
+      useCustomWorkingDirectory = "NO"
+      ignoresPersistentStateOnLaunch = "NO"
+      debugDocumentVersioning = "YES"
+      debugServiceExtension = "internal"
+      allowLocationSimulation = "YES"
+      launchAutomaticallySubstyle = "2">
+      <BuildableProductRunnable
+         runnableDebuggingMode = "0">
+         <BuildableReference
+            BuildableIdentifier = "primary"
+            BlueprintIdentifier = "F77B0DEB1D118A16002130FE"
+            BuildableName = "Nextcloud.app"
+            BlueprintName = "Nextcloud"
+            ReferencedContainer = "container:Nextcloud.xcodeproj">
+         </BuildableReference>
+      </BuildableProductRunnable>
+      <AdditionalOptions>
+      </AdditionalOptions>
+   </LaunchAction>
+   <ProfileAction
+      buildConfiguration = "Release"
+      shouldUseLaunchSchemeArgsEnv = "YES"
+      savedToolIdentifier = ""
+      useCustomWorkingDirectory = "NO"
+      debugDocumentVersioning = "YES"
+      launchAutomaticallySubstyle = "2">
+      <BuildableProductRunnable
+         runnableDebuggingMode = "0">
+         <BuildableReference
+            BuildableIdentifier = "primary"
+            BlueprintIdentifier = "F77B0DEB1D118A16002130FE"
+            BuildableName = "Nextcloud.app"
+            BlueprintName = "Nextcloud"
+            ReferencedContainer = "container:Nextcloud.xcodeproj">
+         </BuildableReference>
+      </BuildableProductRunnable>
+   </ProfileAction>
+   <AnalyzeAction
+      buildConfiguration = "Debug">
+   </AnalyzeAction>
+   <ArchiveAction
+      buildConfiguration = "Release"
+      revealArchiveInOrganizer = "YES">
+   </ArchiveAction>
+</Scheme>

+ 2 - 2
iOSClient/AppDelegate.h

@@ -32,13 +32,13 @@
 #import "CCUtility.h"
 #import "CCUtility.h"
 #import "CCDetail.h"
 #import "CCDetail.h"
 #import "CCMain.h"
 #import "CCMain.h"
-#import "CCMedia.h"
 #import "CCSettings.h"
 #import "CCSettings.h"
 #import "CCFavorites.h"
 #import "CCFavorites.h"
 #import "CCTransfers.h"
 #import "CCTransfers.h"
 
 
 @class CCLoginWeb;
 @class CCLoginWeb;
 @class CCMore;
 @class CCMore;
+@class NCMedia;
 
 
 @interface AppDelegate : UIResponder <UIApplicationDelegate, BKPasscodeLockScreenManagerDelegate, BKPasscodeViewControllerDelegate, TWMessageBarStyleSheet, CCNetworkingDelegate>
 @interface AppDelegate : UIResponder <UIApplicationDelegate, BKPasscodeLockScreenManagerDelegate, BKPasscodeViewControllerDelegate, TWMessageBarStyleSheet, CCNetworkingDelegate>
 
 
@@ -112,7 +112,7 @@
 @property (nonatomic, strong) CCMain *activeMain;
 @property (nonatomic, strong) CCMain *activeMain;
 @property (nonatomic, strong) CCMain *homeMain;
 @property (nonatomic, strong) CCMain *homeMain;
 @property (nonatomic, strong) CCFavorites *activeFavorites;
 @property (nonatomic, strong) CCFavorites *activeFavorites;
-@property (nonatomic, strong) CCMedia *activeMedia;
+@property (nonatomic, strong) NCMedia *activeMedia;
 @property (nonatomic, retain) CCDetail *activeDetail;
 @property (nonatomic, retain) CCDetail *activeDetail;
 @property (nonatomic, retain) CCSettings *activeSettings;
 @property (nonatomic, retain) CCSettings *activeSettings;
 @property (nonatomic, retain) CCTransfers *activeTransfers;
 @property (nonatomic, retain) CCTransfers *activeTransfers;

+ 0 - 1
iOSClient/AppDelegate.m

@@ -27,7 +27,6 @@
 #import "AFURLSessionManager.h"
 #import "AFURLSessionManager.h"
 #import "CCNetworking.h"
 #import "CCNetworking.h"
 #import "CCGraphics.h"
 #import "CCGraphics.h"
-#import "CCMedia.h"
 #import "CCSynchronize.h"
 #import "CCSynchronize.h"
 #import "CCMain.h"
 #import "CCMain.h"
 #import "CCDetail.h"
 #import "CCDetail.h"

+ 2 - 2
iOSClient/Brand/File_Provider_Extension.plist

@@ -17,9 +17,9 @@
 	<key>CFBundlePackageType</key>
 	<key>CFBundlePackageType</key>
 	<string>XPC!</string>
 	<string>XPC!</string>
 	<key>CFBundleShortVersionString</key>
 	<key>CFBundleShortVersionString</key>
-	<string>2.23.0</string>
+	<string>2.23.1</string>
 	<key>CFBundleVersion</key>
 	<key>CFBundleVersion</key>
-	<string>0</string>
+	<string>10</string>
 	<key>NSExtension</key>
 	<key>NSExtension</key>
 	<dict>
 	<dict>
 		<key>NSExtensionFileProviderDocumentGroup</key>
 		<key>NSExtensionFileProviderDocumentGroup</key>

+ 2 - 2
iOSClient/Brand/Notification_Service_Extension.plist

@@ -17,9 +17,9 @@
 	<key>CFBundlePackageType</key>
 	<key>CFBundlePackageType</key>
 	<string>XPC!</string>
 	<string>XPC!</string>
 	<key>CFBundleShortVersionString</key>
 	<key>CFBundleShortVersionString</key>
-	<string>2.23.0</string>
+	<string>2.23.1</string>
 	<key>CFBundleVersion</key>
 	<key>CFBundleVersion</key>
-	<string>0</string>
+	<string>10</string>
 	<key>NSExtension</key>
 	<key>NSExtension</key>
 	<dict>
 	<dict>
 		<key>NSExtensionPointIdentifier</key>
 		<key>NSExtensionPointIdentifier</key>

+ 2 - 2
iOSClient/Brand/Share.plist

@@ -17,9 +17,9 @@
 	<key>CFBundlePackageType</key>
 	<key>CFBundlePackageType</key>
 	<string>XPC!</string>
 	<string>XPC!</string>
 	<key>CFBundleShortVersionString</key>
 	<key>CFBundleShortVersionString</key>
-	<string>2.23.0</string>
+	<string>2.23.1</string>
 	<key>CFBundleVersion</key>
 	<key>CFBundleVersion</key>
-	<string>0</string>
+	<string>10</string>
 	<key>NSAppTransportSecurity</key>
 	<key>NSAppTransportSecurity</key>
 	<dict>
 	<dict>
 		<key>NSAllowsArbitraryLoads</key>
 		<key>NSAllowsArbitraryLoads</key>

+ 2 - 2
iOSClient/Brand/iOSClient.plist

@@ -46,11 +46,11 @@
 	<key>CFBundlePackageType</key>
 	<key>CFBundlePackageType</key>
 	<string>APPL</string>
 	<string>APPL</string>
 	<key>CFBundleShortVersionString</key>
 	<key>CFBundleShortVersionString</key>
-	<string>2.23.0</string>
+	<string>2.23.1</string>
 	<key>CFBundleSignature</key>
 	<key>CFBundleSignature</key>
 	<string>????</string>
 	<string>????</string>
 	<key>CFBundleVersion</key>
 	<key>CFBundleVersion</key>
-	<string>0</string>
+	<string>10</string>
 	<key>FIREBASE_ANALYTICS_COLLECTION_DEACTIVATED</key>
 	<key>FIREBASE_ANALYTICS_COLLECTION_DEACTIVATED</key>
 	<true/>
 	<true/>
 	<key>Fabric</key>
 	<key>Fabric</key>

+ 1 - 1
iOSClient/Database/NCDatabase.swift

@@ -273,7 +273,7 @@ class tableMetadata: Object {
     }
     }
 }
 }
 
 
-class tablePhotos: Object {
+class tableMedia: Object {
     
     
     @objc dynamic var account = ""
     @objc dynamic var account = ""
     @objc dynamic var assetLocalIdentifier = ""
     @objc dynamic var assetLocalIdentifier = ""

+ 46 - 40
iOSClient/Database/NCManageDatabase.swift

@@ -64,7 +64,7 @@ class NCManageDatabase: NSObject {
         var config = Realm.Configuration(
         var config = Realm.Configuration(
         
         
             fileURL: dirGroup?.appendingPathComponent("\(k_appDatabaseNextcloud)/\(k_databaseDefault)"),
             fileURL: dirGroup?.appendingPathComponent("\(k_appDatabaseNextcloud)/\(k_databaseDefault)"),
-            schemaVersion: 41,
+            schemaVersion: 42,
             
             
             // 10 : Version 2.18.0
             // 10 : Version 2.18.0
             // 11 : Version 2.18.2
             // 11 : Version 2.18.2
@@ -98,6 +98,7 @@ class NCManageDatabase: NSObject {
             // 39 : Version 2.22.9.1
             // 39 : Version 2.22.9.1
             // 40 : Version 2.22.9.3
             // 40 : Version 2.22.9.3
             // 41 : Version 2.22.9.5
             // 41 : Version 2.22.9.5
+            // 42 : Version 2.23.1.0
             
             
 
 
             migrationBlock: { migration, oldSchemaVersion in
             migrationBlock: { migration, oldSchemaVersion in
@@ -123,7 +124,6 @@ class NCManageDatabase: NSObject {
                 if oldSchemaVersion < 41 {
                 if oldSchemaVersion < 41 {
                     migration.deleteData(forType: tableActivity.className())
                     migration.deleteData(forType: tableActivity.className())
                     migration.deleteData(forType: tableMetadata.className())
                     migration.deleteData(forType: tableMetadata.className())
-                    migration.deleteData(forType: tablePhotos.className())
                     migration.deleteData(forType: tableDirectory.className())
                     migration.deleteData(forType: tableDirectory.className())
                 }
                 }
         })
         })
@@ -1924,79 +1924,85 @@ class NCManageDatabase: NSObject {
     }
     }
     
     
     //MARK: -
     //MARK: -
-    //MARK: Table Photos
-    @objc func getTablePhotos(addMetadatasFromUpload: [tableMetadata], account: String) -> [tableMetadata]? {
-
+    //MARK: Table Media
+ 
+    @objc func getTableMedia(predicate: NSPredicate) -> tableMetadata? {
+        
         let realm = try! Realm()
         let realm = try! Realm()
         realm.refresh()
         realm.refresh()
-
-        let predicate = NSPredicate(format: "account == %@", account)
-        let results = realm.objects(tablePhotos.self).filter(predicate).sorted(byKeyPath: "date", ascending: false)
-
-        if (results.count > 0) {
-            var returnMetadatas = Array(results.map { tableMetadata.init(value:$0) })
-            for metadata in addMetadatasFromUpload {
-                let result = realm.objects(tablePhotos.self).filter("fileID == %@", metadata.fileID).first
-                if result == nil {
-                    returnMetadatas.append(metadata)
-                }
-            }
-            return returnMetadatas
-        } else {
+        
+        guard let result = realm.objects(tableMedia.self).filter(predicate).first else {
             return nil
             return nil
         }
         }
+        
+        return tableMetadata.init(value: result)
     }
     }
-    
-    @objc func getTablePhoto(predicate: NSPredicate) -> tableMetadata? {
+   
+    @objc func getTableMedias(predicate: NSPredicate) -> [tableMetadata]? {
         
         
         let realm = try! Realm()
         let realm = try! Realm()
         realm.refresh()
         realm.refresh()
         
         
-        guard let result = realm.objects(tablePhotos.self).filter(predicate).first else {
+        let results = realm.objects(tableMedia.self).filter(predicate).sorted(byKeyPath: "date", ascending: false)
+        
+        if (results.count > 0) {
+            return Array(results.map { tableMetadata.init(value:$0) })
+        } else {
             return nil
             return nil
         }
         }
-        
-        return tableMetadata.init(value: result)
     }
     }
     
     
-    @objc func createTablePhotos(_ metadatas: [tableMetadata], account: String) {
+    func createTableMedia(_ metadatas: [tableMetadata], lteDate: Date, gteDate: Date,account: String) -> (differenceSizeInsert: Int64, differenceNumInsert: Int64) {
 
 
         let realm = try! Realm()
         let realm = try! Realm()
         realm.refresh()
         realm.refresh()
         
         
+        var sizeDelete: Int64 = 0
+        var sizeInsert: Int64 = 0
+        var numDelete: Int64 = 0
+        var numInsert: Int64 = 0
+        var differenceSizeInsert: Int64 = 0
+        var differenceNumInsert: Int64 = 0
+
         do {
         do {
             try realm.write {
             try realm.write {
                 // DELETE ALL
                 // DELETE ALL
-                let results = realm.objects(tablePhotos.self).filter("account = %@", account)
+                let results = realm.objects(tableMedia.self).filter("account = %@ AND date >= %@ AND date <= %@", account, gteDate, lteDate)
+                for resul in results {
+                    sizeDelete = sizeDelete + Int64(resul.size)
+                    numDelete += 1
+                }
                 realm.delete(results)
                 realm.delete(results)
                 // INSERT ALL
                 // INSERT ALL
-                let photos = Array(metadatas.map { tablePhotos.init(value:$0) })
+                let photos = Array(metadatas.map { tableMedia.init(value:$0) })
+                for photo in photos {
+                    sizeInsert = sizeInsert + Int64(photo.size)
+                    numInsert += 1
+                }
                 realm.add(photos, update: true)
                 realm.add(photos, update: true)
+                differenceSizeInsert = sizeInsert - sizeDelete
+                differenceNumInsert = numInsert - numDelete
             }
             }
         } catch let error {
         } catch let error {
             print("[LOG] Could not write to database: ", error)
             print("[LOG] Could not write to database: ", error)
             realm.cancelWrite()
             realm.cancelWrite()
         }
         }
+        
+        return(differenceSizeInsert, differenceNumInsert)
     }
     }
     
     
-    @objc func deletePhotos(fileID: String) {
+    @objc func getTableMediaDate(account: String, order: ComparisonResult) -> Date {
         
         
         let realm = try! Realm()
         let realm = try! Realm()
+        realm.refresh()
         
         
-        realm.beginWrite()
-        
-        let results = realm.objects(tablePhotos.self).filter("fileID = %@", fileID)
-        
-        realm.delete(results)
-        
-        do {
-            try realm.commitWrite()
-        } catch let error {
-            print("[LOG] Could not write to database: ", error)
-            return
+        if let entities = realm.objects(tableMedia.self).filter("account = %@", account).max(by: { $0.date.compare($1.date as Date) == order }) {
+            return Calendar.current.date(bySettingHour: 0, minute: 0, second: 0, of: entities.date as Date)!
         }
         }
+        
+        return Calendar.current.date(bySettingHour: 0, minute: 0, second: 0, of: Date())!
     }
     }
- 
+    
     //MARK: -
     //MARK: -
     //MARK: Table Photo Library
     //MARK: Table Photo Library
     
     

+ 10 - 8
iOSClient/Favorites/CCFavorites.m

@@ -215,16 +215,16 @@
                     if (metadata.directory) {
                     if (metadata.directory) {
                         
                         
                         if ([CCUtility getFavoriteOffline])
                         if ([CCUtility getFavoriteOffline])
-                            [[CCSynchronize sharedSynchronize] readFolder:[CCUtility stringAppendServerUrl:serverUrl addFileName:metadata.fileName] selector:selectorReadFolderWithDownload];
+                            [[CCSynchronize sharedSynchronize] readFolder:[CCUtility stringAppendServerUrl:serverUrl addFileName:metadata.fileName] selector:selectorReadFolderWithDownload account:account];
                         else
                         else
-                            [[CCSynchronize sharedSynchronize] readFolder:[CCUtility stringAppendServerUrl:serverUrl addFileName:metadata.fileName] selector:selectorReadFolder];
+                            [[CCSynchronize sharedSynchronize] readFolder:[CCUtility stringAppendServerUrl:serverUrl addFileName:metadata.fileName] selector:selectorReadFolder account:account];
                         
                         
                     } else {
                     } else {
                         
                         
                         if ([CCUtility getFavoriteOffline])
                         if ([CCUtility getFavoriteOffline])
-                            [[CCSynchronize sharedSynchronize] readFile:metadata.fileID fileName:metadata.fileName serverUrl:serverUrl selector:selectorReadFileWithDownload];
+                            [[CCSynchronize sharedSynchronize] readFile:metadata.fileID fileName:metadata.fileName serverUrl:serverUrl selector:selectorReadFileWithDownload account:account];
                         else
                         else
-                            [[CCSynchronize sharedSynchronize] readFile:metadata.fileID fileName:metadata.fileName serverUrl:serverUrl selector:selectorReadFile];
+                            [[CCSynchronize sharedSynchronize] readFile:metadata.fileID fileName:metadata.fileName serverUrl:serverUrl selector:selectorReadFile account:account];
                     }
                     }
                     
                     
                     father = serverUrlSon;
                     father = serverUrlSon;
@@ -289,7 +289,9 @@
 
 
 - (void)triggerProgressTask:(NSNotification *)notification
 - (void)triggerProgressTask:(NSNotification *)notification
 {
 {
-    [[NCMainCommon sharedInstance] triggerProgressTask:notification sectionDataSourceFileIDIndexPath:sectionDataSource.fileIDIndexPath tableView:self.tableView viewController:self serverUrlViewController:self.serverUrl];
+    if (sectionDataSource.fileIDIndexPath != nil) {
+        [[NCMainCommon sharedInstance] triggerProgressTask:notification sectionDataSourceFileIDIndexPath:sectionDataSource.fileIDIndexPath tableView:self.tableView viewController:self serverUrlViewController:self.serverUrl];
+    }
 }
 }
 
 
 - (void)cancelTaskButton:(id)sender withEvent:(UIEvent *)event
 - (void)cancelTaskButton:(id)sender withEvent:(UIEvent *)event
@@ -540,14 +542,14 @@
     
     
     if (!_serverUrl) {
     if (!_serverUrl) {
         
         
-        recordsTableMetadata = [[NCManageDatabase sharedInstance] getMetadatasWithPredicate:[NSPredicate predicateWithFormat:@"account == %@ AND favorite == true", appDelegate.activeAccount] sorted:sorted ascending:[CCUtility getAscendingSettings]];
+        recordsTableMetadata = [[NCManageDatabase sharedInstance] getMetadatasWithPredicate:[NSPredicate predicateWithFormat:@"account == %@ AND favorite == true", appDelegate.activeAccount] sorted:nil ascending:NO];
         
         
     } else {
     } else {
         
         
-        recordsTableMetadata = [[NCManageDatabase sharedInstance] getMetadatasWithPredicate:[NSPredicate predicateWithFormat:@"account == %@ AND serverUrl == %@", appDelegate.activeAccount, _serverUrl] sorted:sorted ascending:[CCUtility getAscendingSettings]];
+        recordsTableMetadata = [[NCManageDatabase sharedInstance] getMetadatasWithPredicate:[NSPredicate predicateWithFormat:@"account == %@ AND serverUrl == %@", appDelegate.activeAccount, _serverUrl] sorted:nil ascending:NO];
     }
     }
     
     
-    sectionDataSource = [CCSectionMetadata creataDataSourseSectionMetadata:recordsTableMetadata listProgressMetadata:nil groupByField:nil filterFileID:appDelegate.filterFileID filterTypeFileImage:NO filterTypeFileVideo:NO activeAccount:appDelegate.activeAccount];
+    sectionDataSource = [CCSectionMetadata creataDataSourseSectionMetadata:recordsTableMetadata listProgressMetadata:nil groupByField:nil filterFileID:appDelegate.filterFileID filterTypeFileImage:NO filterTypeFileVideo:NO sorted:sorted ascending:[CCUtility getAscendingSettings] activeAccount:appDelegate.activeAccount];
     
     
     [self.tableView reloadData];
     [self.tableView reloadData];
 }
 }

+ 23 - 0
iOSClient/Images.xcassets/file_photo_big.imageset/Contents.json

@@ -0,0 +1,23 @@
+{
+  "images" : [
+    {
+      "idiom" : "universal",
+      "filename" : "file_photo_big.png",
+      "scale" : "1x"
+    },
+    {
+      "idiom" : "universal",
+      "filename" : "file_photo_big@2x.png",
+      "scale" : "2x"
+    },
+    {
+      "idiom" : "universal",
+      "filename" : "file_photo_big@3x.png",
+      "scale" : "3x"
+    }
+  ],
+  "info" : {
+    "version" : 1,
+    "author" : "xcode"
+  }
+}

BIN
iOSClient/Images.xcassets/file_photo_big.imageset/file_photo_big.png


BIN
iOSClient/Images.xcassets/file_photo_big.imageset/file_photo_big@2x.png


BIN
iOSClient/Images.xcassets/file_photo_big.imageset/file_photo_big@3x.png


+ 23 - 0
iOSClient/Images.xcassets/file_video_big.imageset/Contents.json

@@ -0,0 +1,23 @@
+{
+  "images" : [
+    {
+      "idiom" : "universal",
+      "filename" : "file_video_big.png",
+      "scale" : "1x"
+    },
+    {
+      "idiom" : "universal",
+      "filename" : "file_video_big@2x.png",
+      "scale" : "2x"
+    },
+    {
+      "idiom" : "universal",
+      "filename" : "file_video_big@3x.png",
+      "scale" : "3x"
+    }
+  ],
+  "info" : {
+    "version" : 1,
+    "author" : "xcode"
+  }
+}

BIN
iOSClient/Images.xcassets/file_video_big.imageset/file_video_big.png


BIN
iOSClient/Images.xcassets/file_video_big.imageset/file_video_big@2x.png


BIN
iOSClient/Images.xcassets/file_video_big.imageset/file_video_big@3x.png


+ 23 - 0
iOSClient/Images.xcassets/switchGridChange.imageset/Contents.json

@@ -0,0 +1,23 @@
+{
+  "images" : [
+    {
+      "idiom" : "universal",
+      "filename" : "switchGridChange.png",
+      "scale" : "1x"
+    },
+    {
+      "idiom" : "universal",
+      "filename" : "switchGridChange@2x.png",
+      "scale" : "2x"
+    },
+    {
+      "idiom" : "universal",
+      "filename" : "switchGridChange@3x.png",
+      "scale" : "3x"
+    }
+  ],
+  "info" : {
+    "version" : 1,
+    "author" : "xcode"
+  }
+}

BIN
iOSClient/Images.xcassets/switchGridChange.imageset/switchGridChange.png


BIN
iOSClient/Images.xcassets/switchGridChange.imageset/switchGridChange@2x.png


BIN
iOSClient/Images.xcassets/switchGridChange.imageset/switchGridChange@3x.png


+ 1 - 1
iOSClient/Library/OCCommunicationLib/OCCommunication.h

@@ -469,7 +469,7 @@ typedef enum {
 /// @name Search
 /// @name Search
 ///-----------------------------------
 ///-----------------------------------
 
 
-- (void)search:(NSString *)path folder:(NSString *)folder fileName:(NSString *)fileName depth:(NSString *)depth dateLastModified:(NSString *)dateLastModified contentType:(NSArray *)contentType withUserSessionToken:(NSString *)token onCommunication:(OCCommunication *)sharedOCCommunication successRequest:(void(^)(NSHTTPURLResponse *response, NSArray *items, NSString *redirectedServer, NSString *token)) successRequest failureRequest:(void(^)(NSHTTPURLResponse *response, NSError *error, NSString *token, NSString *redirectedServer)) failureRequest;
+- (void)search:(NSString *)path folder:(NSString *)folder fileName:(NSString *)fileName depth:(NSString *)depth lteDateLastModified:(NSString *)lteDateLastModified gteDateLastModified:(NSString *)gteDateLastModified contentType:(NSArray *)contentType withUserSessionToken:(NSString *)token onCommunication:(OCCommunication *)sharedOCCommunication successRequest:(void(^)(NSHTTPURLResponse *response, NSArray *items, NSString *redirectedServer, NSString *token)) successRequest failureRequest:(void(^)(NSHTTPURLResponse *response, NSError *error, NSString *token, NSString *redirectedServer)) failureRequest;
 
 
 ///-----------------------------------
 ///-----------------------------------
 /// @name Setting favorite
 /// @name Setting favorite

+ 2 - 2
iOSClient/Library/OCCommunicationLib/OCCommunication.m

@@ -625,7 +625,7 @@
 ///-----------------------------------
 ///-----------------------------------
 /// @name search
 /// @name search
 ///-----------------------------------
 ///-----------------------------------
-- (void)search:(NSString *)path folder:(NSString *)folder fileName:(NSString *)fileName depth:(NSString *)depth dateLastModified:(NSString *)dateLastModified contentType:(NSArray *)contentType withUserSessionToken:(NSString *)token onCommunication:(OCCommunication *)sharedOCCommunication successRequest:(void(^)(NSHTTPURLResponse *response, NSArray *items, NSString *redirectedServer, NSString *token)) successRequest failureRequest:(void(^)(NSHTTPURLResponse *response, NSError *error, NSString *token, NSString *redirectedServer)) failureRequest{
+- (void)search:(NSString *)path folder:(NSString *)folder fileName:(NSString *)fileName depth:(NSString *)depth lteDateLastModified:(NSString *)lteDateLastModified gteDateLastModified:(NSString *)gteDateLastModified contentType:(NSArray *)contentType withUserSessionToken:(NSString *)token onCommunication:(OCCommunication *)sharedOCCommunication successRequest:(void(^)(NSHTTPURLResponse *response, NSArray *items, NSString *redirectedServer, NSString *token)) successRequest failureRequest:(void(^)(NSHTTPURLResponse *response, NSError *error, NSString *token, NSString *redirectedServer)) failureRequest{
     
     
     if (!token){
     if (!token){
         token = @"no token";
         token = @"no token";
@@ -636,7 +636,7 @@
     OCWebDAVClient *request = [OCWebDAVClient new];
     OCWebDAVClient *request = [OCWebDAVClient new];
     request = [self getRequestWithCredentials:request];
     request = [self getRequestWithCredentials:request];
     
     
-    [request search:path folder:folder fileName:fileName depth:depth dateLastModified:dateLastModified contentType:contentType user:_user userID:_userID onCommunication:sharedOCCommunication withUserSessionToken:token success:^(NSHTTPURLResponse *response, id responseObject, NSString *token) {
+    [request search:path folder:folder fileName:fileName depth:depth lteDateLastModified:lteDateLastModified gteDateLastModified:gteDateLastModified contentType:contentType user:_user userID:_userID onCommunication:sharedOCCommunication withUserSessionToken:token success:^(NSHTTPURLResponse *response, id responseObject, NSString *token) {
         
         
         if (successRequest) {
         if (successRequest) {
             
             

+ 1 - 1
iOSClient/Library/OCCommunicationLib/OCWebDavClient/OCWebDAVClient.h

@@ -196,7 +196,7 @@ extern NSString * _Nullable OCWebDAVModificationDateKey;
  
  
 */ 
 */ 
 
 
-- (void)search:(NSString * _Nonnull)path folder:(NSString * _Nonnull)folder fileName:(NSString * _Nonnull)fileName depth:(NSString * _Nonnull)depth dateLastModified:(NSString * _Nonnull)dateLastModified contentType:(NSArray * _Nonnull)contentType user:(NSString * _Nonnull)user userID:(NSString * _Nonnull)userID onCommunication:(OCCommunication * _Nonnull)sharedOCCommunication withUserSessionToken:(NSString * _Nonnull)token success:(void(^ _Nonnull)(NSHTTPURLResponse * _Nonnull, id  _Nonnull, NSString * _Nonnull token))success failure:(void(^ _Nonnull)(NSHTTPURLResponse * _Nonnull, id  _Nullable responseObject, NSError * _Nonnull, NSString * _Nonnull token))failure;
+- (void)search:(NSString * _Nonnull)path folder:(NSString * _Nonnull)folder fileName:(NSString * _Nonnull)fileName depth:(NSString * _Nonnull)depth lteDateLastModified:(NSString *)lteDateLastModified gteDateLastModified:(NSString *)gteDateLastModified contentType:(NSArray * _Nonnull)contentType user:(NSString * _Nonnull)user userID:(NSString * _Nonnull)userID onCommunication:(OCCommunication * _Nonnull)sharedOCCommunication withUserSessionToken:(NSString * _Nonnull)token success:(void(^ _Nonnull)(NSHTTPURLResponse * _Nonnull, id  _Nonnull, NSString * _Nonnull token))success failure:(void(^ _Nonnull)(NSHTTPURLResponse * _Nonnull, id  _Nullable responseObject, NSError * _Nonnull, NSString * _Nonnull token))failure;
 
 
 /**
 /**
  
  

+ 23 - 10
iOSClient/Library/OCCommunicationLib/OCWebDavClient/OCWebDAVClient.m

@@ -266,18 +266,19 @@ NSString const *OCWebDAVModificationDateKey	= @"modificationdate";
     [self mr_listPath:path depth:depth withUserSessionToken:token onCommunication:sharedOCCommunication success:success failure:failure];
     [self mr_listPath:path depth:depth withUserSessionToken:token onCommunication:sharedOCCommunication success:success failure:failure];
 }
 }
 
 
-- (void)search:(NSString *)path folder:(NSString *)folder fileName:(NSString *)fileName depth:(NSString *)depth dateLastModified:(NSString *)dateLastModified contentType:(NSArray *)contentType user:(NSString *)user userID:(NSString *)userID onCommunication:(OCCommunication *)sharedOCCommunication withUserSessionToken:(NSString *)token success:(void(^)(NSHTTPURLResponse *, id, NSString *token))success failure:(void(^)(NSHTTPURLResponse *, id  _Nullable responseObject, NSError *, NSString *token))failure {
+- (void)search:(NSString *)path folder:(NSString *)folder fileName:(NSString *)fileName depth:(NSString *)depth lteDateLastModified:(NSString *)lteDateLastModified gteDateLastModified:(NSString *)gteDateLastModified contentType:(NSArray *)contentType user:(NSString *)user userID:(NSString *)userID onCommunication:(OCCommunication *)sharedOCCommunication withUserSessionToken:(NSString *)token success:(void(^)(NSHTTPURLResponse *, id, NSString *token))success failure:(void(^)(NSHTTPURLResponse *, id  _Nullable responseObject, NSError *, NSString *token))failure {
     
     
     NSString *body = @"";
     NSString *body = @"";
     NSString *whereType = @"";
     NSString *whereType = @"";
-        
+    NSString *whereDate = @"";
+    
     NSParameterAssert(success);
     NSParameterAssert(success);
     
     
     _requestMethod = @"SEARCH";
     _requestMethod = @"SEARCH";
     
     
     NSMutableURLRequest *request = [self requestWithMethod:_requestMethod path:path parameters:nil timeout:k_timeout_search];
     NSMutableURLRequest *request = [self requestWithMethod:_requestMethod path:path parameters:nil timeout:k_timeout_search];
     
     
-    if (contentType && dateLastModified) {
+    if (contentType && lteDateLastModified && gteDateLastModified) {
         
         
         body = [NSString stringWithFormat: @""
         body = [NSString stringWithFormat: @""
         "<?xml version=\"1.0\"?>"
         "<?xml version=\"1.0\"?>"
@@ -311,7 +312,19 @@ NSString const *OCWebDAVModificationDateKey	= @"modificationdate";
             whereType = [NSString stringWithFormat: @"%@<d:like><d:prop><d:getcontenttype/></d:prop><d:literal>%@</d:literal></d:like>", whereType, type];
             whereType = [NSString stringWithFormat: @"%@<d:like><d:prop><d:getcontenttype/></d:prop><d:literal>%@</d:literal></d:like>", whereType, type];
         }
         }
         
         
-        body = [NSString stringWithFormat: @"%@%@</d:or><d:gte><d:prop><d:getlastmodified/></d:prop><d:literal>%@</d:literal></d:gte></d:and></d:where></d:basicsearch></d:searchrequest>", body, whereType, dateLastModified];
+        body = [NSString stringWithFormat: @"%@%@</d:or><d:or>", body, whereType];
+        
+        whereDate = [NSString stringWithFormat: @"%@<d:and><d:lte><d:prop><d:getlastmodified/></d:prop><d:literal>%@</d:literal></d:lte><d:gte><d:prop><d:getlastmodified/></d:prop><d:literal>%@</d:literal></d:gte></d:and>", whereDate, lteDateLastModified, gteDateLastModified];
+        
+        /*
+        if (gteDateLastModified != nil && lteDateLastModified == nil) {
+            whereDate = [NSString stringWithFormat: @"%@<d:gte><d:prop><d:getlastmodified/></d:prop><d:literal>%@</d:literal></d:gte>", whereDate, gteDateLastModified];
+        } else if (gteDateLastModified != nil && lteDateLastModified != nil) {
+            whereDate = [NSString stringWithFormat: @"%@<d:and><d:lte><d:prop><d:getlastmodified/></d:prop><d:literal>%@</d:literal></d:lte><d:gte><d:prop><d:getlastmodified/></d:prop><d:literal>%@</d:literal></d:gte></d:and>", whereDate, lteDateLastModified, gteDateLastModified];
+        }
+        */
+        
+        body = [NSString stringWithFormat: @"%@%@</d:or></d:and></d:where></d:basicsearch></d:searchrequest>", body, whereDate];
         
         
     } else {
     } else {
         
         
@@ -321,15 +334,15 @@ NSString const *OCWebDAVModificationDateKey	= @"modificationdate";
             "<d:basicsearch>"
             "<d:basicsearch>"
                 "<d:select>"
                 "<d:select>"
                     "<d:prop>"
                     "<d:prop>"
-                        "<d:getlastmodified />"
-                        "<d:getetag />"
-                        "<d:getcontenttype />"
+                        "<d:getlastmodified/>"
+                        "<d:getetag/>"
+                        "<d:getcontenttype/>"
                         "<d:resourcetype/>"
                         "<d:resourcetype/>"
-                        "<d:getcontentlength />"
+                        "<d:getcontentlength/>"
                         "<oc:fileid/>"
                         "<oc:fileid/>"
                         "<oc:id/>"
                         "<oc:id/>"
-                        "<oc:permissions />"
-                        "<oc:size />"
+                        "<oc:permissions/>"
+                        "<oc:size/>"
                         "<oc:favorite/>"
                         "<oc:favorite/>"
                         "<nc:is-encrypted/>"
                         "<nc:is-encrypted/>"
                         "<nc:has-preview/>"
                         "<nc:has-preview/>"

+ 0 - 5
iOSClient/Main/CCDetail.m

@@ -63,7 +63,6 @@
         
         
         appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
         appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
 
 
-        [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(triggerProgressTask:) name:@"NotificationProgressTask" object:nil];
         [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(changeTheming) name:@"changeTheming" object:nil];
         [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(changeTheming) name:@"changeTheming" object:nil];
 
 
         self.metadataDetail = [[tableMetadata alloc] init];
         self.metadataDetail = [[tableMetadata alloc] init];
@@ -604,10 +603,6 @@
     [self.navigationController popViewControllerAnimated:YES];
     [self.navigationController popViewControllerAnimated:YES];
 }
 }
 
 
-- (void)triggerProgressTask:(NSNotification *)notification
-{
-}
-
 - (void)downloadPhotoBrowserSuccessFailure:(tableMetadata *)metadata selector:(NSString *)selector errorCode:(NSInteger)errorCode
 - (void)downloadPhotoBrowserSuccessFailure:(tableMetadata *)metadata selector:(NSString *)selector errorCode:(NSInteger)errorCode
 {
 {
     // if a message for a directory of these
     // if a message for a directory of these

+ 11 - 10
iOSClient/Main/CCMain.m

@@ -25,7 +25,6 @@
 
 
 #import "CCMain.h"
 #import "CCMain.h"
 #import "AppDelegate.h"
 #import "AppDelegate.h"
-#import "CCMedia.h"
 #import "CCSynchronize.h"
 #import "CCSynchronize.h"
 #import "OCActivity.h"
 #import "OCActivity.h"
 #import "OCNotifications.h"
 #import "OCNotifications.h"
@@ -980,11 +979,11 @@
             
             
             if (metadata.directory) {
             if (metadata.directory) {
                 
                 
-                [[CCSynchronize sharedSynchronize] readFolder:[CCUtility stringAppendServerUrl:metadata.serverUrl addFileName:metadata.fileName] selector:selectorReadFolderWithDownload];
+                [[CCSynchronize sharedSynchronize] readFolder:[CCUtility stringAppendServerUrl:metadata.serverUrl addFileName:metadata.fileName] selector:selectorReadFolderWithDownload account:appDelegate.activeAccount];
                     
                     
             } else {
             } else {
                 
                 
-                [[CCSynchronize sharedSynchronize] readFile:metadata.fileID fileName:metadata.fileName serverUrl:metadata.serverUrl selector:selectorReadFileWithDownload];
+                [[CCSynchronize sharedSynchronize] readFile:metadata.fileID fileName:metadata.fileName serverUrl:metadata.serverUrl selector:selectorReadFileWithDownload account:appDelegate.activeAccount];
             }
             }
         }
         }
         
         
@@ -1319,7 +1318,7 @@
 {
 {
     NSString *startDirectory = [CCUtility getHomeServerUrlActiveUrl:appDelegate.activeUrl];
     NSString *startDirectory = [CCUtility getHomeServerUrlActiveUrl:appDelegate.activeUrl];
     
     
-    [[OCNetworking sharedManager] searchWithAccount:appDelegate.activeAccount fileName:_searchFileName serverUrl:startDirectory contentType:nil date:nil depth:@"infinity" completion:^(NSString *account, NSArray *metadatas, NSString *message, NSInteger errorCode) {
+    [[OCNetworking sharedManager] searchWithAccount:appDelegate.activeAccount fileName:_searchFileName serverUrl:startDirectory contentType:nil lteDateLastModified:nil gteDateLastModified:nil depth:@"infinity" completion:^(NSString *account, NSArray *metadatas, NSString *message, NSInteger errorCode) {
        
        
         if (errorCode == 0 && [account isEqualToString:appDelegate.activeAccount]) {
         if (errorCode == 0 && [account isEqualToString:appDelegate.activeAccount]) {
             
             
@@ -1834,7 +1833,9 @@
 
 
 - (void)triggerProgressTask:(NSNotification *)notification
 - (void)triggerProgressTask:(NSNotification *)notification
 {
 {
-    [[NCMainCommon sharedInstance] triggerProgressTask:notification sectionDataSourceFileIDIndexPath:sectionDataSource.fileIDIndexPath tableView:self.tableView viewController:self serverUrlViewController:self.serverUrl];    
+    if (sectionDataSource.fileIDIndexPath != nil) {
+        [[NCMainCommon sharedInstance] triggerProgressTask:notification sectionDataSourceFileIDIndexPath:sectionDataSource.fileIDIndexPath tableView:self.tableView viewController:self serverUrlViewController:self.serverUrl];
+    }
 }
 }
 
 
 - (void)cancelTaskButton:(id)sender withEvent:(UIEvent *)event
 - (void)cancelTaskButton:(id)sender withEvent:(UIEvent *)event
@@ -2146,7 +2147,7 @@
                 else
                 else
                     selector = selectorReadFolder;
                     selector = selectorReadFolder;
                 
                 
-                [[CCSynchronize sharedSynchronize] readFolder:[CCUtility stringAppendServerUrl:self.serverUrl addFileName:metadata.fileName] selector:selector];                
+                [[CCSynchronize sharedSynchronize] readFolder:[CCUtility stringAppendServerUrl:self.serverUrl addFileName:metadata.fileName] selector:selector account:appDelegate.activeAccount];                
             }
             }
             
             
             if (!metadata.directory && favorite && [CCUtility getFavoriteOffline]) {
             if (!metadata.directory && favorite && [CCUtility getFavoriteOffline]) {
@@ -3354,7 +3355,7 @@
                                             [self.tableView reloadRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationNone];
                                             [self.tableView reloadRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationNone];
                                         } else {
                                         } else {
                                             [[NCManageDatabase sharedInstance] setDirectoryWithServerUrl:dirServerUrl offline:true account:appDelegate.activeAccount];
                                             [[NCManageDatabase sharedInstance] setDirectoryWithServerUrl:dirServerUrl offline:true account:appDelegate.activeAccount];
-                                            [[CCSynchronize sharedSynchronize] readFolder:dirServerUrl selector:selectorReadFolderWithDownload];
+                                            [[CCSynchronize sharedSynchronize] readFolder:dirServerUrl selector:selectorReadFolderWithDownload account:appDelegate.activeAccount];
                                             [self.tableView reloadRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationNone];
                                             [self.tableView reloadRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationNone];
                                         }
                                         }
                                     }];
                                     }];
@@ -3623,7 +3624,7 @@
             }
             }
         }
         }
         
         
-        sectionDataSource = [CCSectionMetadata creataDataSourseSectionMetadata:metadatas listProgressMetadata:nil groupByField:[CCUtility getGroupBySettings] filterFileID:appDelegate.filterFileID filterTypeFileImage:NO filterTypeFileVideo:NO activeAccount:appDelegate.activeAccount];
+        sectionDataSource = [CCSectionMetadata creataDataSourseSectionMetadata:metadatas listProgressMetadata:nil groupByField:[CCUtility getGroupBySettings] filterFileID:appDelegate.filterFileID filterTypeFileImage:NO filterTypeFileVideo:NO sorted:@"fileName" ascending:NO activeAccount:appDelegate.activeAccount];
 
 
         [self tableViewReloadData];
         [self tableViewReloadData];
         
         
@@ -3707,9 +3708,9 @@
     
     
     CCSectionDataSourceMetadata *sectionDataSourceTemp = [CCSectionDataSourceMetadata new];
     CCSectionDataSourceMetadata *sectionDataSourceTemp = [CCSectionDataSourceMetadata new];
 
 
-    NSArray *recordsTableMetadata = [[NCManageDatabase sharedInstance] getMetadatasWithPredicate:[NSPredicate predicateWithFormat:@"account == %@ AND serverUrl == %@ AND status != %i", appDelegate.activeAccount, serverUrl, k_metadataStatusHide] sorted:[CCUtility getOrderSettings] ascending:[CCUtility getAscendingSettings]];
+    NSArray *recordsTableMetadata = [[NCManageDatabase sharedInstance] getMetadatasWithPredicate:[NSPredicate predicateWithFormat:@"account == %@ AND serverUrl == %@ AND status != %i", appDelegate.activeAccount, serverUrl, k_metadataStatusHide] sorted:nil ascending:NO];
     
     
-    sectionDataSourceTemp = [CCSectionMetadata creataDataSourseSectionMetadata:recordsTableMetadata listProgressMetadata:nil groupByField:[CCUtility getGroupBySettings] filterFileID:appDelegate.filterFileID filterTypeFileImage:NO filterTypeFileVideo:NO activeAccount:appDelegate.activeAccount];
+    sectionDataSourceTemp = [CCSectionMetadata creataDataSourseSectionMetadata:recordsTableMetadata listProgressMetadata:nil groupByField:[CCUtility getGroupBySettings] filterFileID:appDelegate.filterFileID filterTypeFileImage:NO filterTypeFileVideo:NO sorted:[CCUtility getOrderSettings] ascending:[CCUtility getAscendingSettings] activeAccount:appDelegate.activeAccount];
     
     
     if (withReloadData) {
     if (withReloadData) {
         sectionDataSource = sectionDataSourceTemp;
         sectionDataSource = sectionDataSourceTemp;

+ 1 - 1
iOSClient/Main/CCSection.h

@@ -44,7 +44,7 @@
 
 
 @interface CCSectionMetadata : NSObject
 @interface CCSectionMetadata : NSObject
 
 
-+ (CCSectionDataSourceMetadata *)creataDataSourseSectionMetadata:(NSArray *)arrayMetadatas listProgressMetadata:(NSMutableDictionary *)listProgressMetadata groupByField:(NSString *)groupByField filterFileID:(NSArray *)filterFileID filterTypeFileImage:(BOOL)filterTypeFileImage filterTypeFileVideo:(BOOL)filterTypeFileVideo activeAccount:(NSString *)activeAccount;
++ (CCSectionDataSourceMetadata *)creataDataSourseSectionMetadata:(NSArray *)arrayMetadatas listProgressMetadata:(NSMutableDictionary *)listProgressMetadata groupByField:(NSString *)groupByField filterFileID:(NSArray *)filterFileID filterTypeFileImage:(BOOL)filterTypeFileImage filterTypeFileVideo:(BOOL)filterTypeFileVideo sorted:(NSString *)sorted ascending:(BOOL)ascending activeAccount:(NSString *)activeAccount;
 
 
 + (void)removeAllObjectsSectionDataSource:(CCSectionDataSourceMetadata *)sectionDataSource;
 + (void)removeAllObjectsSectionDataSource:(CCSectionDataSourceMetadata *)sectionDataSource;
 
 

+ 23 - 4
iOSClient/Main/CCSection.m

@@ -74,15 +74,32 @@
 //
 //
 // orderByField : nil, date, typeFile
 // orderByField : nil, date, typeFile
 //
 //
-+ (CCSectionDataSourceMetadata *)creataDataSourseSectionMetadata:(NSArray *)arrayMetadatas listProgressMetadata:(NSMutableDictionary *)listProgressMetadata groupByField:(NSString *)groupByField filterFileID:(NSArray *)filterFileID filterTypeFileImage:(BOOL)filterTypeFileImage filterTypeFileVideo:(BOOL)filterTypeFileVideo activeAccount:(NSString *)activeAccount
++ (CCSectionDataSourceMetadata *)creataDataSourseSectionMetadata:(NSArray *)arrayMetadatas listProgressMetadata:(NSMutableDictionary *)listProgressMetadata groupByField:(NSString *)groupByField filterFileID:(NSArray *)filterFileID filterTypeFileImage:(BOOL)filterTypeFileImage filterTypeFileVideo:(BOOL)filterTypeFileVideo sorted:(NSString *)sorted ascending:(BOOL)ascending activeAccount:(NSString *)activeAccount
 {
 {
     id dataSection;
     id dataSection;
-
+    
     NSMutableArray *metadatas = [NSMutableArray new];
     NSMutableArray *metadatas = [NSMutableArray new];
     NSMutableDictionary *dictionaryEtagMetadataForIndexPath = [NSMutableDictionary new];
     NSMutableDictionary *dictionaryEtagMetadataForIndexPath = [NSMutableDictionary new];
-    
     CCSectionDataSourceMetadata *sectionDataSource = [CCSectionDataSourceMetadata new];
     CCSectionDataSourceMetadata *sectionDataSource = [CCSectionDataSourceMetadata new];
     
     
+    /*
+     Metadata order
+    */
+    
+    NSArray *arraySoprtedMetadatas = [arrayMetadatas sortedArrayUsingComparator:^NSComparisonResult(tableMetadata *obj1, tableMetadata *obj2) {
+        // Sort with Locale
+        if ([sorted isEqualToString:@"date"]) {
+            if (ascending) return [obj1.date compare:obj2.date];
+            else return [obj2.date compare:obj1.date];
+        } else if ([sorted isEqualToString:@"sessionTaskIdentifier"]) {
+            if (ascending) return (obj1.sessionTaskIdentifier > obj2.sessionTaskIdentifier);
+            else return (obj2.sessionTaskIdentifier < obj1.sessionTaskIdentifier);
+        } else {
+            if (ascending) return [obj1.fileName compare:obj2.fileName options:NSCaseInsensitiveSearch range:NSMakeRange(0,[obj1.fileName length]) locale:[NSLocale currentLocale]];
+            else return [obj2.fileName compare:obj1.fileName options:NSCaseInsensitiveSearch range:NSMakeRange(0,[obj2.fileName length]) locale:[NSLocale currentLocale]];
+        }
+    }];
+    
     /*
     /*
      Initialize datasource
      Initialize datasource
     */
     */
@@ -92,7 +109,7 @@
     BOOL directoryOnTop = [CCUtility getDirectoryOnTop];
     BOOL directoryOnTop = [CCUtility getDirectoryOnTop];
     NSMutableArray *metadataFilesFavorite = [NSMutableArray new];
     NSMutableArray *metadataFilesFavorite = [NSMutableArray new];
     
     
-    for (tableMetadata *metadata in arrayMetadatas) {
+    for (tableMetadata *metadata in arraySoprtedMetadatas) {
         
         
         // *** LIST : DO NOT INSERT ***
         // *** LIST : DO NOT INSERT ***
         if (metadata.status == k_metadataStatusHide || [filterFileID containsObject: metadata.fileID] || (filterTypeFileImage == YES && [metadata.typeFile isEqualToString: k_metadataTypeFile_image]) || (filterTypeFileVideo == YES && [metadata.typeFile isEqualToString: k_metadataTypeFile_video])) {
         if (metadata.status == k_metadataStatusHide || [filterFileID containsObject: metadata.fileID] || (filterTypeFileImage == YES && [metadata.typeFile isEqualToString: k_metadataTypeFile_image]) || (filterTypeFileVideo == YES && [metadata.typeFile isEqualToString: k_metadataTypeFile_video])) {
@@ -164,10 +181,12 @@
     Sections order
     Sections order
     */
     */
     
     
+    /*
     BOOL ascending;
     BOOL ascending;
     
     
     if ([groupByField isEqualToString:@"date"]) ascending = NO;
     if ([groupByField isEqualToString:@"date"]) ascending = NO;
     else ascending = YES;
     else ascending = YES;
+    */
     
     
     NSArray *sortSections = [[sectionDataSource.sectionArrayRow allKeys] sortedArrayUsingComparator:^NSComparisonResult(id obj1, id obj2) {
     NSArray *sortSections = [[sectionDataSource.sectionArrayRow allKeys] sortedArrayUsingComparator:^NSComparisonResult(id obj1, id obj2) {
         
         

+ 40 - 0
iOSClient/Main/Cell/NCGridMediaCell.swift

@@ -0,0 +1,40 @@
+//
+//  NCGridMediaCell.swift
+//  Nextcloud
+//
+//  Created by Marino Faggiana on 12/02/2019.
+//  Copyright © 2019 Marino Faggiana. All rights reserved.
+//
+//  Author Marino Faggiana <marino.faggiana@nextcloud.com>
+//
+//  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
+
+class NCGridMediaCell: UICollectionViewCell {
+    
+    @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!
+    
+    override func awakeFromNib() {
+        super.awakeFromNib()
+    }
+}
+

+ 81 - 0
iOSClient/Main/Cell/NCGridMediaCell.xib

@@ -0,0 +1,81 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="14460.31" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
+    <device id="retina4_7" orientation="portrait">
+        <adaptation id="fullscreen"/>
+    </device>
+    <dependencies>
+        <deployment identifier="iOS"/>
+        <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14460.20"/>
+        <capability name="Safe area layout guides" minToolsVersion="9.0"/>
+        <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
+    </dependencies>
+    <objects>
+        <placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
+        <placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
+        <collectionViewCell opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" reuseIdentifier="gridCell" id="vf1-Kf-9uL" customClass="NCGridMediaCell" customModule="Nextcloud" customModuleProvider="target">
+            <rect key="frame" x="0.0" y="0.0" width="220" height="220"/>
+            <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
+            <view key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" insetsLayoutMarginsFromSafeArea="NO">
+                <rect key="frame" x="0.0" y="0.0" width="220" height="220"/>
+                <autoresizingMask key="autoresizingMask"/>
+                <subviews>
+                    <imageView autoresizesSubviews="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="5Ci-V1-hf5" userLabel="imageItem">
+                        <rect key="frame" x="0.0" y="0.0" width="220" height="220"/>
+                    </imageView>
+                    <imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="DHy-Up-3Bh" userLabel="imageSelect">
+                        <rect key="frame" x="5" y="5" width="25" height="25"/>
+                        <constraints>
+                            <constraint firstAttribute="height" constant="25" id="SoZ-J3-98x"/>
+                            <constraint firstAttribute="width" constant="25" id="cZG-gx-gwt"/>
+                        </constraints>
+                    </imageView>
+                    <imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="AYs-f2-vve" userLabel="imageFavorite">
+                        <rect key="frame" x="200" y="5" width="15" height="15"/>
+                        <constraints>
+                            <constraint firstAttribute="height" constant="15" id="ZjS-Hv-JNm"/>
+                            <constraint firstAttribute="width" constant="15" id="kDr-15-VeJ"/>
+                        </constraints>
+                    </imageView>
+                    <imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="a0p-rj-jnV" userLabel="imageStatus">
+                        <rect key="frame" x="5" y="200" width="15" height="15"/>
+                        <constraints>
+                            <constraint firstAttribute="height" constant="15" id="gq1-0a-eLC"/>
+                            <constraint firstAttribute="width" constant="15" id="uJE-4b-Qt7"/>
+                        </constraints>
+                    </imageView>
+                    <imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="81G-wH-fjN" userLabel="imageLocal">
+                        <rect key="frame" x="200" y="200" width="15" height="15"/>
+                        <constraints>
+                            <constraint firstAttribute="height" constant="15" id="NTa-Gi-uzY"/>
+                            <constraint firstAttribute="width" constant="15" id="xLe-lb-N1p"/>
+                        </constraints>
+                    </imageView>
+                </subviews>
+            </view>
+            <constraints>
+                <constraint firstItem="DHy-Up-3Bh" firstAttribute="leading" secondItem="VXh-sQ-LeX" secondAttribute="leading" constant="5" id="1T3-8p-uIW"/>
+                <constraint firstItem="AYs-f2-vve" firstAttribute="leading" secondItem="5Ci-V1-hf5" secondAttribute="trailing" constant="-20" id="3e3-0A-NSl"/>
+                <constraint firstItem="DHy-Up-3Bh" firstAttribute="top" secondItem="VXh-sQ-LeX" secondAttribute="top" constant="5" id="ESV-qE-tbO"/>
+                <constraint firstItem="5Ci-V1-hf5" firstAttribute="top" secondItem="VXh-sQ-LeX" secondAttribute="top" id="Ouj-ZD-UFm"/>
+                <constraint firstItem="5Ci-V1-hf5" firstAttribute="leading" secondItem="a0p-rj-jnV" secondAttribute="trailing" constant="-20" id="UtQ-6D-cYc"/>
+                <constraint firstItem="81G-wH-fjN" firstAttribute="top" secondItem="5Ci-V1-hf5" secondAttribute="bottom" constant="-20" id="aEb-vq-8sk"/>
+                <constraint firstItem="VXh-sQ-LeX" firstAttribute="trailing" secondItem="5Ci-V1-hf5" secondAttribute="trailing" id="cHT-cP-NN6"/>
+                <constraint firstItem="VXh-sQ-LeX" firstAttribute="bottom" secondItem="5Ci-V1-hf5" secondAttribute="bottom" id="eEC-eB-alE"/>
+                <constraint firstItem="81G-wH-fjN" firstAttribute="leading" secondItem="5Ci-V1-hf5" secondAttribute="trailing" constant="-20" id="nFH-Pc-end"/>
+                <constraint firstItem="5Ci-V1-hf5" firstAttribute="leading" secondItem="VXh-sQ-LeX" secondAttribute="leading" id="qT3-WD-iTV"/>
+                <constraint firstItem="5Ci-V1-hf5" firstAttribute="top" secondItem="AYs-f2-vve" secondAttribute="bottom" constant="-20" id="rLL-6g-ypv"/>
+                <constraint firstItem="a0p-rj-jnV" firstAttribute="top" secondItem="5Ci-V1-hf5" secondAttribute="bottom" constant="-20" id="upV-Ov-WWd"/>
+            </constraints>
+            <viewLayoutGuide key="safeArea" id="VXh-sQ-LeX"/>
+            <size key="customSize" width="220" height="260"/>
+            <connections>
+                <outlet property="imageFavorite" destination="AYs-f2-vve" id="UeH-R7-bZr"/>
+                <outlet property="imageItem" destination="5Ci-V1-hf5" id="xky-Nw-NUb"/>
+                <outlet property="imageLocal" destination="81G-wH-fjN" id="bqj-wQ-CBV"/>
+                <outlet property="imageSelect" destination="DHy-Up-3Bh" id="mo9-rP-P4I"/>
+                <outlet property="imageStatus" destination="a0p-rj-jnV" id="6Dg-tf-evd"/>
+            </connections>
+            <point key="canvasLocation" x="88" y="141.67916041979012"/>
+        </collectionViewCell>
+    </objects>
+</document>

+ 50 - 4
iOSClient/Main/Layout/NCLayout.swift

@@ -65,9 +65,10 @@ class NCListLayout: UICollectionViewFlowLayout {
 
 
 class NCGridLayout: UICollectionViewFlowLayout {
 class NCGridLayout: UICollectionViewFlowLayout {
     
     
-    let heightLabelPlusButton: CGFloat = 45
-    let preferenceWidth: CGFloat = 110
-    let marginLeftRight: CGFloat = 1
+    var heightLabelPlusButton: CGFloat = 45
+    var preferenceWidth: CGFloat = 110
+    var marginLeftRight: CGFloat = 1
+    var numItems: Int = 0
     
     
     override init() {
     override init() {
         super.init()
         super.init()
@@ -89,7 +90,7 @@ class NCGridLayout: UICollectionViewFlowLayout {
         get {
         get {
             if let collectionView = collectionView {
             if let collectionView = collectionView {
                 
                 
-                let numItems: Int = Int(collectionView.frame.width / preferenceWidth)
+                self.numItems = Int(collectionView.frame.width / preferenceWidth)
                 let itemWidth: CGFloat = (collectionView.frame.width - (marginLeftRight * 2) - CGFloat(numItems)) / CGFloat(numItems)
                 let itemWidth: CGFloat = (collectionView.frame.width - (marginLeftRight * 2) - CGFloat(numItems)) / CGFloat(numItems)
                 let itemHeight: CGFloat = itemWidth + heightLabelPlusButton
                 let itemHeight: CGFloat = itemWidth + heightLabelPlusButton
                 return CGSize(width: itemWidth, height: itemHeight)
                 return CGSize(width: itemWidth, height: itemHeight)
@@ -107,3 +108,48 @@ class NCGridLayout: UICollectionViewFlowLayout {
         return proposedContentOffset
         return proposedContentOffset
     }
     }
 }
 }
+
+class NCGridMediaLayout: UICollectionViewFlowLayout {
+    
+    var preferenceWidth: CGFloat = 110
+    var marginLeftRight: CGFloat = 1
+    var numItems: Int = 0
+    
+    override init() {
+        super.init()
+        
+        sectionHeadersPinToVisibleBounds = false
+        
+        minimumInteritemSpacing = 1
+        minimumLineSpacing = 1
+        
+        self.scrollDirection = .vertical
+        self.sectionInset = UIEdgeInsets(top: 0, 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 {
+                
+                self.numItems = Int(collectionView.frame.width / preferenceWidth)
+                let itemWidth: CGFloat = (collectionView.frame.width - (marginLeftRight * 2) - CGFloat(numItems)) / CGFloat(numItems)
+                let itemHeight: CGFloat = itemWidth
+                return CGSize(width: itemWidth, height: itemHeight)
+            }
+            
+            // Default fallback
+            return CGSize(width: 100, height: 100)
+        }
+        set {
+            super.itemSize = newValue
+        }
+    }
+    
+    override func targetContentOffset(forProposedContentOffset proposedContentOffset: CGPoint) -> CGPoint {
+        return proposedContentOffset
+    }
+}

+ 45 - 151
iOSClient/Main/Main.storyboard

@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <?xml version="1.0" encoding="UTF-8"?>
 <document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="14460.31" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="4IE-mo-rkp">
 <document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="14460.31" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="4IE-mo-rkp">
-    <device id="retina4_7" orientation="portrait">
+    <device id="retina6_1" orientation="portrait">
         <adaptation id="fullscreen"/>
         <adaptation id="fullscreen"/>
     </device>
     </device>
     <dependencies>
     <dependencies>
@@ -29,7 +29,7 @@
             <objects>
             <objects>
                 <viewController automaticallyAdjustsScrollViewInsets="NO" id="amx-XG-NId" customClass="CCSettings" sceneMemberID="viewController">
                 <viewController automaticallyAdjustsScrollViewInsets="NO" id="amx-XG-NId" customClass="CCSettings" sceneMemberID="viewController">
                     <view key="view" clearsContextBeforeDrawing="NO" contentMode="scaleToFill" id="qPP-0c-bH9">
                     <view key="view" clearsContextBeforeDrawing="NO" contentMode="scaleToFill" id="qPP-0c-bH9">
-                        <rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
+                        <rect key="frame" x="0.0" y="0.0" width="414" height="896"/>
                         <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
                         <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
                         <subviews>
                         <subviews>
                             <tableView clipsSubviews="YES" contentMode="scaleToFill" fixedFrame="YES" alwaysBounceVertical="YES" dataMode="prototypes" style="grouped" separatorStyle="default" rowHeight="44" sectionHeaderHeight="10" sectionFooterHeight="10" translatesAutoresizingMaskIntoConstraints="NO" id="RbN-9l-HP2">
                             <tableView clipsSubviews="YES" contentMode="scaleToFill" fixedFrame="YES" alwaysBounceVertical="YES" dataMode="prototypes" style="grouped" separatorStyle="default" rowHeight="44" sectionHeaderHeight="10" sectionFooterHeight="10" translatesAutoresizingMaskIntoConstraints="NO" id="RbN-9l-HP2">
@@ -52,132 +52,26 @@
             </objects>
             </objects>
             <point key="canvasLocation" x="11143" y="1217"/>
             <point key="canvasLocation" x="11143" y="1217"/>
         </scene>
         </scene>
-        <!--Media-->
-        <scene sceneID="kWr-RF-gdq">
+        <!--NCMedia.storyboard-->
+        <scene sceneID="udp-lL-CYh">
             <objects>
             <objects>
-                <collectionViewController id="1Ca-6H-d29" customClass="CCMedia" sceneMemberID="viewController">
-                    <collectionView key="view" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" showsHorizontalScrollIndicator="NO" showsVerticalScrollIndicator="NO" dataMode="prototypes" id="zkC-IW-U7O">
-                        <rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
-                        <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
-                        <color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
-                        <collectionViewFlowLayout key="collectionViewLayout" minimumLineSpacing="1" minimumInteritemSpacing="1" id="Ode-Gf-Nqo">
-                            <size key="itemSize" width="75" height="75"/>
-                            <size key="headerReferenceSize" width="10" height="40"/>
-                            <size key="footerReferenceSize" width="10" height="20"/>
-                            <inset key="sectionInset" minX="1" minY="1" maxX="1" maxY="1"/>
-                        </collectionViewFlowLayout>
-                        <cells>
-                            <collectionViewCell opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" reuseIdentifier="cell" id="ax6-Kq-EOT">
-                                <rect key="frame" x="1" y="41" width="75" height="75"/>
-                                <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
-                                <view key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center">
-                                    <rect key="frame" x="0.0" y="0.0" width="75" height="75"/>
-                                    <autoresizingMask key="autoresizingMask"/>
-                                    <subviews>
-                                        <imageView userInteractionEnabled="NO" tag="100" contentMode="scaleAspectFill" translatesAutoresizingMaskIntoConstraints="NO" id="wv7-Pl-1S9" userLabel="Image">
-                                            <rect key="frame" x="0.0" y="0.0" width="75" height="75"/>
-                                        </imageView>
-                                        <visualEffectView hidden="YES" opaque="NO" tag="200" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="Vaz-kb-VZC" userLabel="VisualEffect">
-                                            <rect key="frame" x="0.0" y="0.0" width="75" height="75"/>
-                                            <view key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" id="zTo-QZ-xyF">
-                                                <rect key="frame" x="0.0" y="0.0" width="75" height="75"/>
-                                                <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
-                                            </view>
-                                            <color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
-                                            <blurEffect style="extraLight"/>
-                                        </visualEffectView>
-                                        <imageView hidden="YES" opaque="NO" userInteractionEnabled="NO" tag="300" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="sj1-BH-NWl" userLabel="ImageCheckled">
-                                            <rect key="frame" x="25" y="25" width="25" height="25"/>
-                                            <constraints>
-                                                <constraint firstAttribute="height" constant="25" id="8D0-Br-VLn"/>
-                                                <constraint firstAttribute="width" constant="25" id="JTW-Py-sqE"/>
-                                            </constraints>
-                                        </imageView>
-                                        <imageView hidden="YES" opaque="NO" userInteractionEnabled="NO" tag="400" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="ie8-HI-w6E" userLabel="ImageVideo">
-                                            <rect key="frame" x="55" y="61" width="20" height="14"/>
-                                            <constraints>
-                                                <constraint firstAttribute="width" constant="20" id="Ehd-rd-RIc"/>
-                                                <constraint firstAttribute="height" constant="14" id="Yam-RU-2Qc"/>
-                                            </constraints>
-                                        </imageView>
-                                    </subviews>
-                                </view>
-                                <constraints>
-                                    <constraint firstItem="wv7-Pl-1S9" firstAttribute="leading" secondItem="ax6-Kq-EOT" secondAttribute="leading" id="8Lf-ww-OoY"/>
-                                    <constraint firstItem="wv7-Pl-1S9" firstAttribute="bottom" secondItem="Vaz-kb-VZC" secondAttribute="bottom" id="8nn-9h-h8F"/>
-                                    <constraint firstItem="sj1-BH-NWl" firstAttribute="centerX" secondItem="zTo-QZ-xyF" secondAttribute="centerX" id="Aou-FC-rhP"/>
-                                    <constraint firstItem="wv7-Pl-1S9" firstAttribute="trailing" secondItem="Vaz-kb-VZC" secondAttribute="trailing" id="CGZ-Ir-z0l"/>
-                                    <constraint firstItem="ie8-HI-w6E" firstAttribute="top" secondItem="zTo-QZ-xyF" secondAttribute="bottom" constant="-14" id="FlS-6N-OuF"/>
-                                    <constraint firstItem="wv7-Pl-1S9" firstAttribute="top" secondItem="ax6-Kq-EOT" secondAttribute="top" id="H2J-n2-czF"/>
-                                    <constraint firstItem="ie8-HI-w6E" firstAttribute="leading" secondItem="zTo-QZ-xyF" secondAttribute="trailing" constant="-20" id="NkC-RJ-YOg"/>
-                                    <constraint firstItem="wv7-Pl-1S9" firstAttribute="leading" secondItem="Vaz-kb-VZC" secondAttribute="leading" id="TKe-Ml-mj4"/>
-                                    <constraint firstItem="wv7-Pl-1S9" firstAttribute="top" secondItem="Vaz-kb-VZC" secondAttribute="top" id="V3X-qR-o1I"/>
-                                    <constraint firstAttribute="trailing" secondItem="wv7-Pl-1S9" secondAttribute="trailing" id="WRD-6l-xgj"/>
-                                    <constraint firstItem="sj1-BH-NWl" firstAttribute="centerY" secondItem="zTo-QZ-xyF" secondAttribute="centerY" id="qDU-Pg-7gS"/>
-                                    <constraint firstAttribute="bottom" secondItem="wv7-Pl-1S9" secondAttribute="bottom" id="vwT-T5-hkc"/>
-                                </constraints>
-                            </collectionViewCell>
-                        </cells>
-                        <collectionReusableView key="sectionHeaderView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" reuseIdentifier="header" id="0S8-Db-U0e">
-                            <rect key="frame" x="0.0" y="0.0" width="375" height="40"/>
-                            <autoresizingMask key="autoresizingMask"/>
-                            <subviews>
-                                <label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" tag="100" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Header" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="55Q-Lx-UkW">
-                                    <rect key="frame" x="6" y="11" width="352" height="18"/>
-                                    <fontDescription key="fontDescription" type="system" pointSize="15"/>
-                                    <color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
-                                    <nil key="highlightedColor"/>
-                                </label>
-                            </subviews>
-                            <constraints>
-                                <constraint firstAttribute="trailingMargin" secondItem="55Q-Lx-UkW" secondAttribute="trailing" constant="9" id="5gh-ql-db6"/>
-                                <constraint firstItem="55Q-Lx-UkW" firstAttribute="leading" secondItem="0S8-Db-U0e" secondAttribute="leading" constant="6" id="Ltr-ca-4oa"/>
-                                <constraint firstItem="55Q-Lx-UkW" firstAttribute="centerY" secondItem="0S8-Db-U0e" secondAttribute="centerY" id="p4z-mm-sQP"/>
-                            </constraints>
-                        </collectionReusableView>
-                        <collectionReusableView key="sectionFooterView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" reuseIdentifier="footer" id="jDW-vn-a9W">
-                            <rect key="frame" x="0.0" y="117" width="375" height="20"/>
-                            <autoresizingMask key="autoresizingMask"/>
-                            <subviews>
-                                <label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" tag="100" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Header" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="HVV-2C-7PP">
-                                    <rect key="frame" x="8" y="2.5" width="359" height="15"/>
-                                    <fontDescription key="fontDescription" type="system" pointSize="12"/>
-                                    <color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
-                                    <nil key="highlightedColor"/>
-                                </label>
-                            </subviews>
-                            <constraints>
-                                <constraint firstItem="HVV-2C-7PP" firstAttribute="leading" secondItem="jDW-vn-a9W" secondAttribute="leadingMargin" id="1Cm-hJ-kcH"/>
-                                <constraint firstItem="HVV-2C-7PP" firstAttribute="height" secondItem="jDW-vn-a9W" secondAttribute="height" constant="-5" id="Jio-JV-jMB"/>
-                                <constraint firstItem="HVV-2C-7PP" firstAttribute="centerY" secondItem="jDW-vn-a9W" secondAttribute="centerY" id="SQf-VK-Db4"/>
-                                <constraint firstItem="HVV-2C-7PP" firstAttribute="width" secondItem="jDW-vn-a9W" secondAttribute="width" constant="-16" id="nQC-oH-6jE"/>
-                            </constraints>
-                        </collectionReusableView>
-                        <connections>
-                            <outlet property="dataSource" destination="1Ca-6H-d29" id="Uzm-Ti-Qig"/>
-                            <outlet property="delegate" destination="1Ca-6H-d29" id="GXw-PZ-AIG"/>
-                        </connections>
-                    </collectionView>
-                    <navigationItem key="navigationItem" id="Ljh-k8-LVi"/>
-                    <freeformSimulatedSizeMetrics key="simulatedDestinationMetrics"/>
-                    <connections>
-                        <segue destination="mtc-lf-PRo" kind="showDetail" identifier="segueDetail" id="op6-ow-K8v"/>
-                    </connections>
-                </collectionViewController>
-                <placeholder placeholderIdentifier="IBFirstResponder" id="W1h-qt-Bld" userLabel="First Responder" sceneMemberID="firstResponder"/>
+                <viewControllerPlaceholder storyboardName="NCMedia" referencedIdentifier="NCMedia.storyboard" id="kO6-hz-Gsq" sceneMemberID="viewController">
+                    <navigationItem key="navigationItem" id="3mJ-L2-Cmt"/>
+                </viewControllerPlaceholder>
+                <placeholder placeholderIdentifier="IBFirstResponder" id="6gG-SV-Hvv" userLabel="First Responder" sceneMemberID="firstResponder"/>
             </objects>
             </objects>
-            <point key="canvasLocation" x="8572" y="1218"/>
+            <point key="canvasLocation" x="8572" y="887"/>
         </scene>
         </scene>
         <!--Acknowledgements-->
         <!--Acknowledgements-->
         <scene sceneID="h9y-Lj-jxB">
         <scene sceneID="h9y-Lj-jxB">
             <objects>
             <objects>
                 <viewController id="Wu3-ow-y4h" customClass="Acknowledgements" sceneMemberID="viewController">
                 <viewController id="Wu3-ow-y4h" customClass="Acknowledgements" sceneMemberID="viewController">
                     <view key="view" opaque="NO" contentMode="scaleToFill" id="HYE-hK-m2I">
                     <view key="view" opaque="NO" contentMode="scaleToFill" id="HYE-hK-m2I">
-                        <rect key="frame" x="0.0" y="0.0" width="375" height="603"/>
+                        <rect key="frame" x="0.0" y="0.0" width="414" height="808"/>
                         <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
                         <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
                         <subviews>
                         <subviews>
                             <textView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" showsHorizontalScrollIndicator="NO" delaysContentTouches="NO" canCancelContentTouches="NO" bouncesZoom="NO" editable="NO" usesAttributedText="YES" selectable="NO" translatesAutoresizingMaskIntoConstraints="NO" id="vYq-of-LmL">
                             <textView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" showsHorizontalScrollIndicator="NO" delaysContentTouches="NO" canCancelContentTouches="NO" bouncesZoom="NO" editable="NO" usesAttributedText="YES" selectable="NO" translatesAutoresizingMaskIntoConstraints="NO" id="vYq-of-LmL">
-                                <rect key="frame" x="3" y="0.0" width="369" height="603"/>
+                                <rect key="frame" x="7" y="0.0" width="400" height="774"/>
                                 <color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
                                 <color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
                                 <attributedString key="attributedText">
                                 <attributedString key="attributedText">
                                     <fragment content="Copyright (C)">
                                     <fragment content="Copyright (C)">
@@ -220,7 +114,7 @@
                     <extendedEdge key="edgesForExtendedLayout"/>
                     <extendedEdge key="edgesForExtendedLayout"/>
                     <toolbarItems/>
                     <toolbarItems/>
                     <navigationBar key="navigationBar" contentMode="scaleToFill" id="rJe-3o-bpZ">
                     <navigationBar key="navigationBar" contentMode="scaleToFill" id="rJe-3o-bpZ">
-                        <rect key="frame" x="0.0" y="20" width="375" height="44"/>
+                        <rect key="frame" x="0.0" y="44" width="414" height="44"/>
                         <autoresizingMask key="autoresizingMask"/>
                         <autoresizingMask key="autoresizingMask"/>
                     </navigationBar>
                     </navigationBar>
                     <nil name="viewControllers"/>
                     <nil name="viewControllers"/>
@@ -237,7 +131,7 @@
             <objects>
             <objects>
                 <viewController id="DEi-yz-wEj" customClass="CCManageAutoUpload" sceneMemberID="viewController">
                 <viewController id="DEi-yz-wEj" customClass="CCManageAutoUpload" sceneMemberID="viewController">
                     <view key="view" contentMode="scaleToFill" id="WFy-lj-QJi">
                     <view key="view" contentMode="scaleToFill" id="WFy-lj-QJi">
-                        <rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
+                        <rect key="frame" x="0.0" y="0.0" width="414" height="896"/>
                         <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
                         <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
                         <color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
                         <color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
                         <viewLayoutGuide key="safeArea" id="un0-l9-x74"/>
                         <viewLayoutGuide key="safeArea" id="un0-l9-x74"/>
@@ -279,11 +173,11 @@
             <objects>
             <objects>
                 <viewController storyboardIdentifier="CCDetailVC" extendedLayoutIncludesOpaqueBars="YES" id="zg6-hy-EbU" customClass="CCDetail" sceneMemberID="viewController">
                 <viewController storyboardIdentifier="CCDetailVC" extendedLayoutIncludesOpaqueBars="YES" id="zg6-hy-EbU" customClass="CCDetail" sceneMemberID="viewController">
                     <view key="view" tag="900" contentMode="scaleToFill" id="cUA-lB-tGG">
                     <view key="view" tag="900" contentMode="scaleToFill" id="cUA-lB-tGG">
-                        <rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
+                        <rect key="frame" x="0.0" y="0.0" width="414" height="896"/>
                         <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
                         <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
                         <subviews>
                         <subviews>
                             <imageView userInteractionEnabled="NO" tag="999" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" preservesSuperviewLayoutMargins="YES" image="logo" translatesAutoresizingMaskIntoConstraints="NO" id="zlU-MP-ZVs">
                             <imageView userInteractionEnabled="NO" tag="999" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" preservesSuperviewLayoutMargins="YES" image="logo" translatesAutoresizingMaskIntoConstraints="NO" id="zlU-MP-ZVs">
-                                <rect key="frame" x="134" y="296" width="107" height="75"/>
+                                <rect key="frame" x="153.5" y="410.5" width="107" height="75"/>
                             </imageView>
                             </imageView>
                         </subviews>
                         </subviews>
                         <color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
                         <color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
@@ -308,7 +202,7 @@
                 <navigationController storyboardIdentifier="CCDetailNC" extendedLayoutIncludesOpaqueBars="YES" automaticallyAdjustsScrollViewInsets="NO" id="mtc-lf-PRo" sceneMemberID="viewController">
                 <navigationController storyboardIdentifier="CCDetailNC" extendedLayoutIncludesOpaqueBars="YES" automaticallyAdjustsScrollViewInsets="NO" id="mtc-lf-PRo" sceneMemberID="viewController">
                     <toolbarItems/>
                     <toolbarItems/>
                     <navigationBar key="navigationBar" contentMode="scaleToFill" id="vxw-dW-rgx">
                     <navigationBar key="navigationBar" contentMode="scaleToFill" id="vxw-dW-rgx">
-                        <rect key="frame" x="0.0" y="20" width="375" height="44"/>
+                        <rect key="frame" x="0.0" y="44" width="414" height="44"/>
                         <autoresizingMask key="autoresizingMask"/>
                         <autoresizingMask key="autoresizingMask"/>
                     </navigationBar>
                     </navigationBar>
                     <nil name="viewControllers"/>
                     <nil name="viewControllers"/>
@@ -327,7 +221,7 @@
                     <tabBarItem key="tabBarItem" title="File" id="Zxv-aS-HGF"/>
                     <tabBarItem key="tabBarItem" title="File" id="Zxv-aS-HGF"/>
                     <toolbarItems/>
                     <toolbarItems/>
                     <navigationBar key="navigationBar" contentMode="scaleToFill" id="cj6-rT-wnB">
                     <navigationBar key="navigationBar" contentMode="scaleToFill" id="cj6-rT-wnB">
-                        <rect key="frame" x="0.0" y="20" width="375" height="44"/>
+                        <rect key="frame" x="0.0" y="44" width="414" height="44"/>
                         <autoresizingMask key="autoresizingMask"/>
                         <autoresizingMask key="autoresizingMask"/>
                     </navigationBar>
                     </navigationBar>
                     <nil name="viewControllers"/>
                     <nil name="viewControllers"/>
@@ -346,7 +240,7 @@
                     <tabBarItem key="tabBarItem" title="Favorites" id="o09-67-hwf"/>
                     <tabBarItem key="tabBarItem" title="Favorites" id="o09-67-hwf"/>
                     <toolbarItems/>
                     <toolbarItems/>
                     <navigationBar key="navigationBar" contentMode="scaleToFill" id="MJw-Bn-5le">
                     <navigationBar key="navigationBar" contentMode="scaleToFill" id="MJw-Bn-5le">
-                        <rect key="frame" x="0.0" y="20" width="375" height="44"/>
+                        <rect key="frame" x="0.0" y="44" width="414" height="44"/>
                         <autoresizingMask key="autoresizingMask"/>
                         <autoresizingMask key="autoresizingMask"/>
                     </navigationBar>
                     </navigationBar>
                     <nil name="viewControllers"/>
                     <nil name="viewControllers"/>
@@ -363,11 +257,11 @@
             <objects>
             <objects>
                 <viewController storyboardIdentifier="CCFavorites" id="6uw-SF-2Qu" customClass="CCFavorites" sceneMemberID="viewController">
                 <viewController storyboardIdentifier="CCFavorites" id="6uw-SF-2Qu" customClass="CCFavorites" sceneMemberID="viewController">
                     <view key="view" contentMode="scaleToFill" id="o6l-1S-6dH">
                     <view key="view" contentMode="scaleToFill" id="o6l-1S-6dH">
-                        <rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
+                        <rect key="frame" x="0.0" y="0.0" width="414" height="896"/>
                         <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
                         <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
                         <subviews>
                         <subviews>
                             <tableView clipsSubviews="YES" contentMode="scaleToFill" fixedFrame="YES" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" separatorStyle="default" rowHeight="44" sectionHeaderHeight="28" sectionFooterHeight="28" translatesAutoresizingMaskIntoConstraints="NO" id="Pes-cJ-S4N">
                             <tableView clipsSubviews="YES" contentMode="scaleToFill" fixedFrame="YES" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" separatorStyle="default" rowHeight="44" sectionHeaderHeight="28" sectionFooterHeight="28" translatesAutoresizingMaskIntoConstraints="NO" id="Pes-cJ-S4N">
-                                <rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
+                                <rect key="frame" x="0.0" y="0.0" width="414" height="896"/>
                                 <autoresizingMask key="autoresizingMask" flexibleMinX="YES" widthSizable="YES" flexibleMaxX="YES" flexibleMinY="YES" heightSizable="YES" flexibleMaxY="YES"/>
                                 <autoresizingMask key="autoresizingMask" flexibleMinX="YES" widthSizable="YES" flexibleMaxX="YES" flexibleMinY="YES" heightSizable="YES" flexibleMaxY="YES"/>
                                 <color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
                                 <color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
                                 <connections>
                                 <connections>
@@ -396,12 +290,12 @@
                     <tabBarItem key="tabBarItem" title="Media" id="5cw-bP-7It"/>
                     <tabBarItem key="tabBarItem" title="Media" id="5cw-bP-7It"/>
                     <toolbarItems/>
                     <toolbarItems/>
                     <navigationBar key="navigationBar" contentMode="scaleToFill" id="ixg-Pw-TNO">
                     <navigationBar key="navigationBar" contentMode="scaleToFill" id="ixg-Pw-TNO">
-                        <rect key="frame" x="0.0" y="20" width="375" height="44"/>
+                        <rect key="frame" x="0.0" y="44" width="414" height="44"/>
                         <autoresizingMask key="autoresizingMask"/>
                         <autoresizingMask key="autoresizingMask"/>
                     </navigationBar>
                     </navigationBar>
                     <nil name="viewControllers"/>
                     <nil name="viewControllers"/>
                     <connections>
                     <connections>
-                        <segue destination="1Ca-6H-d29" kind="relationship" relationship="rootViewController" id="z78-Fg-8sL"/>
+                        <segue destination="kO6-hz-Gsq" kind="relationship" relationship="rootViewController" id="9zw-1n-Dhk"/>
                     </connections>
                     </connections>
                 </navigationController>
                 </navigationController>
                 <placeholder placeholderIdentifier="IBFirstResponder" id="cZf-pk-3Bd" userLabel="First Responder" sceneMemberID="firstResponder"/>
                 <placeholder placeholderIdentifier="IBFirstResponder" id="cZf-pk-3Bd" userLabel="First Responder" sceneMemberID="firstResponder"/>
@@ -415,7 +309,7 @@
                     <tabBarItem key="tabBarItem" enabled="NO" title="" image="tabBarPlus" id="vIy-cM-ojV"/>
                     <tabBarItem key="tabBarItem" enabled="NO" title="" image="tabBarPlus" id="vIy-cM-ojV"/>
                     <toolbarItems/>
                     <toolbarItems/>
                     <navigationBar key="navigationBar" contentMode="scaleToFill" id="jCU-so-Np6">
                     <navigationBar key="navigationBar" contentMode="scaleToFill" id="jCU-so-Np6">
-                        <rect key="frame" x="0.0" y="20" width="375" height="44"/>
+                        <rect key="frame" x="0.0" y="44" width="414" height="44"/>
                         <autoresizingMask key="autoresizingMask"/>
                         <autoresizingMask key="autoresizingMask"/>
                     </navigationBar>
                     </navigationBar>
                     <nil name="viewControllers"/>
                     <nil name="viewControllers"/>
@@ -431,7 +325,7 @@
                     <tabBarItem key="tabBarItem" title="More" id="U4f-qS-cgh"/>
                     <tabBarItem key="tabBarItem" title="More" id="U4f-qS-cgh"/>
                     <toolbarItems/>
                     <toolbarItems/>
                     <navigationBar key="navigationBar" contentMode="scaleToFill" id="yVo-p8-ApS">
                     <navigationBar key="navigationBar" contentMode="scaleToFill" id="yVo-p8-ApS">
-                        <rect key="frame" x="0.0" y="20" width="375" height="44"/>
+                        <rect key="frame" x="0.0" y="44" width="414" height="44"/>
                         <autoresizingMask key="autoresizingMask"/>
                         <autoresizingMask key="autoresizingMask"/>
                     </navigationBar>
                     </navigationBar>
                     <nil name="viewControllers"/>
                     <nil name="viewControllers"/>
@@ -478,11 +372,11 @@
             <objects>
             <objects>
                 <viewController storyboardIdentifier="CCTransfers" id="Gtp-25-3Em" customClass="CCTransfers" sceneMemberID="viewController">
                 <viewController storyboardIdentifier="CCTransfers" id="Gtp-25-3Em" customClass="CCTransfers" sceneMemberID="viewController">
                     <view key="view" contentMode="scaleToFill" id="fak-dH-6Vp">
                     <view key="view" contentMode="scaleToFill" id="fak-dH-6Vp">
-                        <rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
+                        <rect key="frame" x="0.0" y="0.0" width="414" height="896"/>
                         <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
                         <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
                         <subviews>
                         <subviews>
                             <tableView clipsSubviews="YES" contentMode="scaleToFill" fixedFrame="YES" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" separatorStyle="default" rowHeight="44" sectionHeaderHeight="28" sectionFooterHeight="28" translatesAutoresizingMaskIntoConstraints="NO" id="pnc-dQ-cNG">
                             <tableView clipsSubviews="YES" contentMode="scaleToFill" fixedFrame="YES" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" separatorStyle="default" rowHeight="44" sectionHeaderHeight="28" sectionFooterHeight="28" translatesAutoresizingMaskIntoConstraints="NO" id="pnc-dQ-cNG">
-                                <rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
+                                <rect key="frame" x="0.0" y="0.0" width="414" height="896"/>
                                 <autoresizingMask key="autoresizingMask" flexibleMinX="YES" widthSizable="YES" flexibleMaxX="YES" flexibleMinY="YES" heightSizable="YES" flexibleMaxY="YES"/>
                                 <autoresizingMask key="autoresizingMask" flexibleMinX="YES" widthSizable="YES" flexibleMaxX="YES" flexibleMinY="YES" heightSizable="YES" flexibleMaxY="YES"/>
                                 <color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
                                 <color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
                                 <connections>
                                 <connections>
@@ -507,11 +401,11 @@
             <objects>
             <objects>
                 <viewController storyboardIdentifier="NCShares" id="7jW-Ey-7M7" customClass="NCShares" sceneMemberID="viewController">
                 <viewController storyboardIdentifier="NCShares" id="7jW-Ey-7M7" customClass="NCShares" sceneMemberID="viewController">
                     <view key="view" contentMode="scaleToFill" id="y16-gC-0XR">
                     <view key="view" contentMode="scaleToFill" id="y16-gC-0XR">
-                        <rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
+                        <rect key="frame" x="0.0" y="0.0" width="414" height="896"/>
                         <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
                         <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
                         <subviews>
                         <subviews>
                             <tableView clipsSubviews="YES" contentMode="scaleToFill" fixedFrame="YES" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" separatorStyle="default" rowHeight="44" sectionHeaderHeight="28" sectionFooterHeight="28" translatesAutoresizingMaskIntoConstraints="NO" id="UXi-wu-3m5">
                             <tableView clipsSubviews="YES" contentMode="scaleToFill" fixedFrame="YES" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" separatorStyle="default" rowHeight="44" sectionHeaderHeight="28" sectionFooterHeight="28" translatesAutoresizingMaskIntoConstraints="NO" id="UXi-wu-3m5">
-                                <rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
+                                <rect key="frame" x="0.0" y="0.0" width="414" height="896"/>
                                 <autoresizingMask key="autoresizingMask" flexibleMinX="YES" widthSizable="YES" flexibleMaxX="YES" flexibleMinY="YES" heightSizable="YES" flexibleMaxY="YES"/>
                                 <autoresizingMask key="autoresizingMask" flexibleMinX="YES" widthSizable="YES" flexibleMaxX="YES" flexibleMinY="YES" heightSizable="YES" flexibleMaxY="YES"/>
                                 <color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
                                 <color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
                                 <connections>
                                 <connections>
@@ -536,11 +430,11 @@
             <objects>
             <objects>
                 <viewController storyboardIdentifier="CCMain" id="Qyv-Eo-LeA" customClass="CCMain" sceneMemberID="viewController">
                 <viewController storyboardIdentifier="CCMain" id="Qyv-Eo-LeA" customClass="CCMain" sceneMemberID="viewController">
                     <view key="view" contentMode="scaleToFill" id="QRE-ju-M4I">
                     <view key="view" contentMode="scaleToFill" id="QRE-ju-M4I">
-                        <rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
+                        <rect key="frame" x="0.0" y="0.0" width="414" height="896"/>
                         <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
                         <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
                         <subviews>
                         <subviews>
                             <tableView clipsSubviews="YES" contentMode="scaleToFill" fixedFrame="YES" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" separatorStyle="default" rowHeight="44" sectionHeaderHeight="28" sectionFooterHeight="28" translatesAutoresizingMaskIntoConstraints="NO" id="dC6-NQ-0Td">
                             <tableView clipsSubviews="YES" contentMode="scaleToFill" fixedFrame="YES" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" separatorStyle="default" rowHeight="44" sectionHeaderHeight="28" sectionFooterHeight="28" translatesAutoresizingMaskIntoConstraints="NO" id="dC6-NQ-0Td">
-                                <rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
+                                <rect key="frame" x="0.0" y="0.0" width="414" height="896"/>
                                 <autoresizingMask key="autoresizingMask" flexibleMinX="YES" widthSizable="YES" flexibleMaxX="YES" flexibleMinY="YES" heightSizable="YES" flexibleMaxY="YES"/>
                                 <autoresizingMask key="autoresizingMask" flexibleMinX="YES" widthSizable="YES" flexibleMaxX="YES" flexibleMinY="YES" heightSizable="YES" flexibleMaxY="YES"/>
                                 <color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
                                 <color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
                                 <connections>
                                 <connections>
@@ -567,42 +461,42 @@
             <objects>
             <objects>
                 <viewController id="Frr-j9-xav" customClass="CCMore" customModule="Nextcloud" customModuleProvider="target" sceneMemberID="viewController">
                 <viewController id="Frr-j9-xav" customClass="CCMore" customModule="Nextcloud" customModuleProvider="target" sceneMemberID="viewController">
                     <view key="view" contentMode="scaleToFill" id="hLP-ql-OiA">
                     <view key="view" contentMode="scaleToFill" id="hLP-ql-OiA">
-                        <rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
+                        <rect key="frame" x="0.0" y="0.0" width="414" height="896"/>
                         <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
                         <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
                         <subviews>
                         <subviews>
                             <imageView userInteractionEnabled="NO" contentMode="scaleAspectFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="qW6-AL-KO3">
                             <imageView userInteractionEnabled="NO" contentMode="scaleAspectFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="qW6-AL-KO3">
-                                <rect key="frame" x="0.0" y="64" width="375" height="100"/>
+                                <rect key="frame" x="0.0" y="88" width="414" height="100"/>
                                 <constraints>
                                 <constraints>
                                     <constraint firstAttribute="height" constant="100" id="GJt-sN-4QE"/>
                                     <constraint firstAttribute="height" constant="100" id="GJt-sN-4QE"/>
                                 </constraints>
                                 </constraints>
                             </imageView>
                             </imageView>
                             <imageView userInteractionEnabled="NO" contentMode="center" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="disclosureIndicator" translatesAutoresizingMaskIntoConstraints="NO" id="Lgd-72-bTD">
                             <imageView userInteractionEnabled="NO" contentMode="center" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="disclosureIndicator" translatesAutoresizingMaskIntoConstraints="NO" id="Lgd-72-bTD">
-                                <rect key="frame" x="346" y="91" width="24" height="26"/>
+                                <rect key="frame" x="381" y="115" width="24" height="26"/>
                                 <constraints>
                                 <constraints>
                                     <constraint firstAttribute="height" constant="26" id="9SQ-KV-aJa"/>
                                     <constraint firstAttribute="height" constant="26" id="9SQ-KV-aJa"/>
                                     <constraint firstAttribute="width" constant="24" id="KBe-Dy-an6"/>
                                     <constraint firstAttribute="width" constant="24" id="KBe-Dy-an6"/>
                                 </constraints>
                                 </constraints>
                             </imageView>
                             </imageView>
                             <tableView clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="grouped" rowHeight="50" sectionHeaderHeight="1" sectionFooterHeight="1" translatesAutoresizingMaskIntoConstraints="NO" id="aKC-5k-tLM">
                             <tableView clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="grouped" rowHeight="50" sectionHeaderHeight="1" sectionFooterHeight="1" translatesAutoresizingMaskIntoConstraints="NO" id="aKC-5k-tLM">
-                                <rect key="frame" x="0.0" y="164" width="375" height="402"/>
+                                <rect key="frame" x="0.0" y="188" width="414" height="573"/>
                                 <color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
                                 <color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
                                 <prototypes>
                                 <prototypes>
                                     <tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" reuseIdentifier="Cell" rowHeight="50" id="V1G-2M-Q0I" customClass="CCCellMore" customModule="Nextcloud" customModuleProvider="target">
                                     <tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" reuseIdentifier="Cell" rowHeight="50" id="V1G-2M-Q0I" customClass="CCCellMore" customModule="Nextcloud" customModuleProvider="target">
-                                        <rect key="frame" x="0.0" y="55.5" width="375" height="50"/>
+                                        <rect key="frame" x="0.0" y="55.5" width="414" height="50"/>
                                         <autoresizingMask key="autoresizingMask"/>
                                         <autoresizingMask key="autoresizingMask"/>
                                         <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="V1G-2M-Q0I" id="mMB-QG-hoe">
                                         <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="V1G-2M-Q0I" id="mMB-QG-hoe">
-                                            <rect key="frame" x="0.0" y="0.0" width="375" height="49.5"/>
+                                            <rect key="frame" x="0.0" y="0.0" width="414" height="49.5"/>
                                             <autoresizingMask key="autoresizingMask"/>
                                             <autoresizingMask key="autoresizingMask"/>
                                             <subviews>
                                             <subviews>
                                                 <imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="center" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="6dd-uC-EQT">
                                                 <imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="center" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="6dd-uC-EQT">
-                                                    <rect key="frame" x="15" y="5" width="40" height="40"/>
+                                                    <rect key="frame" x="20" y="5" width="40" height="40"/>
                                                     <constraints>
                                                     <constraints>
                                                         <constraint firstAttribute="width" constant="40" id="Jg6-vD-zNJ"/>
                                                         <constraint firstAttribute="width" constant="40" id="Jg6-vD-zNJ"/>
                                                         <constraint firstAttribute="height" constant="40" id="KbT-nO-u8E"/>
                                                         <constraint firstAttribute="height" constant="40" id="KbT-nO-u8E"/>
                                                     </constraints>
                                                     </constraints>
                                                 </imageView>
                                                 </imageView>
                                                 <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Jgw-HO-Z7g">
                                                 <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Jgw-HO-Z7g">
-                                                    <rect key="frame" x="63" y="15" width="297" height="20"/>
+                                                    <rect key="frame" x="68" y="15" width="326" height="20"/>
                                                     <fontDescription key="fontDescription" type="system" pointSize="16"/>
                                                     <fontDescription key="fontDescription" type="system" pointSize="16"/>
                                                     <nil key="textColor"/>
                                                     <nil key="textColor"/>
                                                     <nil key="highlightedColor"/>
                                                     <nil key="highlightedColor"/>
@@ -628,7 +522,7 @@
                                 </connections>
                                 </connections>
                             </tableView>
                             </tableView>
                             <imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="avatar" translatesAutoresizingMaskIntoConstraints="NO" id="oJg-wO-2iv" customClass="NCAvatar" customModule="Nextcloud" customModuleProvider="target">
                             <imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="avatar" translatesAutoresizingMaskIntoConstraints="NO" id="oJg-wO-2iv" customClass="NCAvatar" customModule="Nextcloud" customModuleProvider="target">
-                                <rect key="frame" x="15" y="79" width="50" height="50"/>
+                                <rect key="frame" x="15" y="103" width="50" height="50"/>
                                 <constraints>
                                 <constraints>
                                     <constraint firstAttribute="width" constant="50" id="moA-ZW-N2y"/>
                                     <constraint firstAttribute="width" constant="50" id="moA-ZW-N2y"/>
                                     <constraint firstAttribute="height" constant="50" id="nQ1-8m-5h7"/>
                                     <constraint firstAttribute="height" constant="50" id="nQ1-8m-5h7"/>
@@ -643,19 +537,19 @@
                                 </userDefinedRuntimeAttributes>
                                 </userDefinedRuntimeAttributes>
                             </imageView>
                             </imageView>
                             <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="username" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="aqE-Wq-B1A">
                             <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="username" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="aqE-Wq-B1A">
-                                <rect key="frame" x="78" y="94" width="78" height="20"/>
+                                <rect key="frame" x="78" y="118" width="78" height="20"/>
                                 <fontDescription key="fontDescription" type="boldSystem" pointSize="16"/>
                                 <fontDescription key="fontDescription" type="boldSystem" pointSize="16"/>
                                 <color key="textColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
                                 <color key="textColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
                                 <nil key="highlightedColor"/>
                                 <nil key="highlightedColor"/>
                             </label>
                             </label>
                             <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="J2k-UZ-XQQ" userLabel="View Quota">
                             <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="J2k-UZ-XQQ" userLabel="View Quota">
-                                <rect key="frame" x="0.0" y="566" width="375" height="52"/>
+                                <rect key="frame" x="0.0" y="761" width="414" height="52"/>
                                 <subviews>
                                 <subviews>
                                     <progressView opaque="NO" contentMode="scaleToFill" verticalHuggingPriority="750" progress="0.5" translatesAutoresizingMaskIntoConstraints="NO" id="uGf-Fa-QQ3">
                                     <progressView opaque="NO" contentMode="scaleToFill" verticalHuggingPriority="750" progress="0.5" translatesAutoresizingMaskIntoConstraints="NO" id="uGf-Fa-QQ3">
-                                        <rect key="frame" x="35" y="25" width="305" height="2"/>
+                                        <rect key="frame" x="35" y="25" width="344" height="2"/>
                                     </progressView>
                                     </progressView>
                                     <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="DAP-np-Q1J">
                                     <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="DAP-np-Q1J">
-                                        <rect key="frame" x="35" y="2" width="305" height="20"/>
+                                        <rect key="frame" x="35" y="2" width="344" height="20"/>
                                         <color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
                                         <color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
                                         <constraints>
                                         <constraints>
                                             <constraint firstAttribute="height" constant="20" id="o78-Yq-dPq"/>
                                             <constraint firstAttribute="height" constant="20" id="o78-Yq-dPq"/>
@@ -665,7 +559,7 @@
                                         <nil key="highlightedColor"/>
                                         <nil key="highlightedColor"/>
                                     </label>
                                     </label>
                                     <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="vfl-ZC-XFd">
                                     <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="vfl-ZC-XFd">
-                                        <rect key="frame" x="35" y="29" width="305" height="20"/>
+                                        <rect key="frame" x="35" y="29" width="344" height="20"/>
                                         <color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
                                         <color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
                                         <constraints>
                                         <constraints>
                                             <constraint firstAttribute="height" constant="20" id="B11-kS-b2d"/>
                                             <constraint firstAttribute="height" constant="20" id="B11-kS-b2d"/>
@@ -735,6 +629,6 @@
         <image name="tabBarPlus" width="40" height="40"/>
         <image name="tabBarPlus" width="40" height="40"/>
     </resources>
     </resources>
     <inferredMetricsTieBreakers>
     <inferredMetricsTieBreakers>
-        <segue reference="op6-ow-K8v"/>
+        <segue reference="45n-bF-9RO"/>
     </inferredMetricsTieBreakers>
     </inferredMetricsTieBreakers>
 </document>
 </document>

+ 85 - 33
iOSClient/Main/NCMainCommon.swift

@@ -86,8 +86,8 @@ class NCMainCommon: NSObject, PhotoEditorDelegate {
                     image = "↑"
                     image = "↑"
                 }
                 }
                 
                 
-                cell.labelInfoFile.text = CCUtility.transformedSize(totalBytesExpected) + " - " + image + CCUtility.transformedSize(totalBytes)
-                cell.transferButton.progress = progress
+                cell.labelInfoFile?.text = CCUtility.transformedSize(totalBytesExpected) + " - " + image + CCUtility.transformedSize(totalBytes)
+                cell.transferButton?.progress = progress
             }
             }
         }
         }
     }
     }
@@ -208,24 +208,35 @@ class NCMainCommon: NSObject, PhotoEditorDelegate {
     
     
     //MARK: -
     //MARK: -
     
     
-    func collectionViewCellForItemAt(_ indexPath: IndexPath, collectionView: UICollectionView, typeLayout: String, metadata: tableMetadata, metadataFolder: tableMetadata?, serverUrl: String, isEditMode: Bool, selectFileID: [String], autoUploadFileName: String, autoUploadDirectory: String, hideButtonMore: Bool, source: UIViewController) -> UICollectionViewCell {
+    func collectionViewCellForItemAt(_ indexPath: IndexPath, collectionView: UICollectionView, cell: UICollectionViewCell, metadata: tableMetadata, metadataFolder: tableMetadata?, serverUrl: String, isEditMode: Bool, selectFileID: [String], autoUploadFileName: String, autoUploadDirectory: String, hideButtonMore: Bool, downloadThumbnail: Bool,source: UIViewController) {
         
         
         var image: UIImage?
         var image: UIImage?
-        var imagePreview = false
-        
-        if metadata.iconName.count > 0 {
-            image = UIImage.init(named: metadata.iconName)
-        } else {
-            image = UIImage.init(named: "file")
-        }
+        var isImagePreviewLoaded = false
         
         
+        // Image Preview
         if FileManager().fileExists(atPath: CCUtility.getDirectoryProviderStorageIconFileID(metadata.fileID, fileNameView: metadata.fileName)) {
         if FileManager().fileExists(atPath: CCUtility.getDirectoryProviderStorageIconFileID(metadata.fileID, fileNameView: metadata.fileName)) {
             image = UIImage.init(contentsOfFile: CCUtility.getDirectoryProviderStorageIconFileID(metadata.fileID, fileNameView: metadata.fileName))
             image = UIImage.init(contentsOfFile: CCUtility.getDirectoryProviderStorageIconFileID(metadata.fileID, fileNameView: metadata.fileName))
-            imagePreview = true
+            isImagePreviewLoaded = true
+        } else {
+            if metadata.iconName.count > 0 {
+                if cell is NCGridMediaCell {
+                    if metadata.typeFile == k_metadataTypeFile_video {
+                        image = UIImage.init(named: "file_video_big")
+                    } else {
+                        image = UIImage.init(named: "file_photo_big")
+                    }
+                } else {
+                    image = UIImage.init(named: metadata.iconName)
+                }
+            } else {
+                image = UIImage.init(named: "file")
+            }
         }
         }
         
         
         // Download preview
         // Download preview
-        NCNetworkingMain.sharedInstance.downloadThumbnail(with: metadata, view: collectionView, indexPath: indexPath)
+        if downloadThumbnail {
+            NCNetworkingMain.sharedInstance.downloadThumbnail(with: metadata, view: collectionView, indexPath: indexPath)
+        }
         
         
         // Share
         // Share
         let sharesLink = appDelegate.sharesLink.object(forKey: serverUrl + metadata.fileName)
         let sharesLink = appDelegate.sharesLink.object(forKey: serverUrl + metadata.fileName)
@@ -238,10 +249,10 @@ class NCMainCommon: NSObject, PhotoEditorDelegate {
             isMounted = metadata.permissions.contains(k_permission_mounted) && !metadataFolder!.permissions.contains(k_permission_mounted)
             isMounted = metadata.permissions.contains(k_permission_mounted) && !metadataFolder!.permissions.contains(k_permission_mounted)
         }
         }
         
         
-        if typeLayout == k_layout_list {
+        if cell is NCListCell {
             
             
-            // LIST
-            let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "listCell", for: indexPath) as! NCListCell
+            let cell = cell as! NCListCell
+           
             cell.delegate = source as? NCListCellDelegate
             cell.delegate = source as? NCListCellDelegate
             
             
             cell.fileID = metadata.fileID
             cell.fileID = metadata.fileID
@@ -344,12 +355,10 @@ class NCMainCommon: NSObject, PhotoEditorDelegate {
                 cell.separator.isHidden = false
                 cell.separator.isHidden = false
             }
             }
             
             
-            return cell
+        } else if cell is NCGridCell {
             
             
-        } else {
-            
-            // GRID
-            let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "gridCell", for: indexPath) as! NCGridCell
+            let cell = cell as! NCGridCell
+
             cell.delegate = source as? NCGridCellDelegate
             cell.delegate = source as? NCGridCellDelegate
             
             
             cell.fileID = metadata.fileID
             cell.fileID = metadata.fileID
@@ -398,7 +407,7 @@ class NCMainCommon: NSObject, PhotoEditorDelegate {
             } else {
             } else {
                 
                 
                 cell.imageItem.image = image
                 cell.imageItem.image = image
-                if imagePreview == false {
+                if isImagePreviewLoaded == false {
                     let width = cell.imageItem.image!.size.width * 2
                     let width = cell.imageItem.image!.size.width * 2
                     //let scale = UIScreen.main.scale
                     //let scale = UIScreen.main.scale
                     cell.imageItem.image = NCUtility.sharedInstance.resizeImage(image: image!, newWidth: width)
                     cell.imageItem.image = NCUtility.sharedInstance.resizeImage(image: image!, newWidth: width)
@@ -446,7 +455,50 @@ class NCMainCommon: NSObject, PhotoEditorDelegate {
                 cell.imageSelect.isHidden = true
                 cell.imageSelect.isHidden = true
                 cell.backgroundView = nil
                 cell.backgroundView = nil
             }
             }
-            return cell
+            
+        } else if cell is NCGridMediaCell {
+            
+            let cell = cell as! NCGridMediaCell
+            
+            cell.imageStatus.image = nil
+            cell.imageLocal.image = nil
+            cell.imageFavorite.image = nil
+            
+            cell.imageItem.image = image
+          
+            if isImagePreviewLoaded {
+                // Preview
+                cell.imageItem.contentMode = .scaleAspectFill
+            } else {
+                // Default xcassets
+                cell.imageItem.contentMode = .scaleAspectFit
+            }
+            
+            // image Local
+            let tableLocalFile = NCManageDatabase.sharedInstance.getTableLocalFile(predicate: NSPredicate(format: "fileID == %@", metadata.fileID))
+            if tableLocalFile != nil && CCUtility.fileProviderStorageExists(metadata.fileID, fileNameView: metadata.fileNameView) {
+                if tableLocalFile!.offline { cell.imageLocal.image = UIImage.init(named: "offlineFlag") }
+                else { cell.imageLocal.image = UIImage.init(named: "local") }
+            }
+            
+            // image Favorite
+            if metadata.favorite {
+                cell.imageFavorite.image = CCGraphics.changeThemingColorImage(UIImage.init(named: "favorite"), multiplier: 2, color: NCBrandColor.sharedInstance.yellowFavorite)
+            }
+            
+            if isEditMode {
+                cell.imageSelect.isHidden = false
+                if selectFileID.contains(metadata.fileID) {
+                    cell.imageSelect.image = CCGraphics.changeThemingColorImage(UIImage.init(named: "checkedYes"), multiplier: 2, color: NCBrandColor.sharedInstance.brand)
+                    cell.backgroundView = NCUtility.sharedInstance.cellBlurEffect(with: cell.bounds)
+                } else {
+                    cell.imageSelect.isHidden = true
+                    cell.backgroundView = nil
+                }
+            } else {
+                cell.imageSelect.isHidden = true
+                cell.backgroundView = nil
+            }
         }
         }
     }
     }
     
     
@@ -877,7 +929,6 @@ class NCMainCommon: NSObject, PhotoEditorDelegate {
                         
                         
                         NCManageDatabase.sharedInstance.deleteMetadata(predicate: NSPredicate(format: "fileID == %@", metadata.fileID))
                         NCManageDatabase.sharedInstance.deleteMetadata(predicate: NSPredicate(format: "fileID == %@", metadata.fileID))
                         NCManageDatabase.sharedInstance.deleteLocalFile(predicate: NSPredicate(format: "fileID == %@", metadata.fileID))
                         NCManageDatabase.sharedInstance.deleteLocalFile(predicate: NSPredicate(format: "fileID == %@", metadata.fileID))
-                        NCManageDatabase.sharedInstance.deletePhotos(fileID: metadata.fileID)
                         
                         
                         if metadata.directory {
                         if metadata.directory {
                             NCManageDatabase.sharedInstance.deleteDirectoryAndSubDirectory(serverUrl: CCUtility.stringAppendServerUrl(serverUrl, addFileName: metadata.fileName), account: metadata.account)
                             NCManageDatabase.sharedInstance.deleteDirectoryAndSubDirectory(serverUrl: CCUtility.stringAppendServerUrl(serverUrl, addFileName: metadata.fileName), account: metadata.account)
@@ -917,7 +968,6 @@ class NCMainCommon: NSObject, PhotoEditorDelegate {
         }
         }
         
         
         self.reloadDatasource(ServerUrl: serverUrl, fileID: nil, action: k_action_NULL)
         self.reloadDatasource(ServerUrl: serverUrl, fileID: nil, action: k_action_NULL)
-        self.appDelegate.activeMedia.reloadDatasource(nil, action: Int(k_action_NULL))
     }
     }
     
     
     @objc func editPhoto(_ metadata: tableMetadata, viewController: UIViewController) {
     @objc func editPhoto(_ metadata: tableMetadata, viewController: UIViewController) {
@@ -1171,9 +1221,6 @@ class NCNetworkingMain: NSObject, CCNetworkingDelegate {
                 if appDelegate.activeDetail != nil {
                 if appDelegate.activeDetail != nil {
                     appDelegate.activeDetail.downloadPhotoBrowserSuccessFailure(metadata, selector: selector, errorCode: errorCode)
                     appDelegate.activeDetail.downloadPhotoBrowserSuccessFailure(metadata, selector: selector, errorCode: errorCode)
                 }
                 }
-                if appDelegate.activeMedia != nil {
-                    appDelegate.activeMedia.downloadFileSuccessFailure(metadata.fileName, fileID: metadata.fileID, serverUrl: serverUrl, selector: selector, errorMessage: errorMessage, errorCode: errorCode)
-                }
             }
             }
             
             
             self.appDelegate.performSelector(onMainThread: #selector(self.appDelegate.loadAutoDownloadUpload), with: nil, waitUntilDone: true)
             self.appDelegate.performSelector(onMainThread: #selector(self.appDelegate.loadAutoDownloadUpload), with: nil, waitUntilDone: true)
@@ -1189,7 +1236,6 @@ class NCNetworkingMain: NSObject, CCNetworkingDelegate {
                 
                 
                 NCManageDatabase.sharedInstance.deleteMetadata(predicate: NSPredicate(format: "fileID == %@", metadata.fileID))
                 NCManageDatabase.sharedInstance.deleteMetadata(predicate: NSPredicate(format: "fileID == %@", metadata.fileID))
                 NCManageDatabase.sharedInstance.deleteLocalFile(predicate: NSPredicate(format: "fileID == %@", metadata.fileID))
                 NCManageDatabase.sharedInstance.deleteLocalFile(predicate: NSPredicate(format: "fileID == %@", metadata.fileID))
-                NCManageDatabase.sharedInstance.deletePhotos(fileID: fileID)
                 
                 
                 NCMainCommon.sharedInstance.reloadDatasource(ServerUrl: serverUrl, fileID: fileID, action: Int32(k_action_DEL))
                 NCMainCommon.sharedInstance.reloadDatasource(ServerUrl: serverUrl, fileID: fileID, action: Int32(k_action_DEL))
             }
             }
@@ -1199,9 +1245,6 @@ class NCNetworkingMain: NSObject, CCNetworkingDelegate {
                 if appDelegate.activeDetail.view.window != nil {
                 if appDelegate.activeDetail.view.window != nil {
                     appDelegate.activeDetail.downloadPhotoBrowserSuccessFailure(metadata, selector: selector, errorCode: errorCode)
                     appDelegate.activeDetail.downloadPhotoBrowserSuccessFailure(metadata, selector: selector, errorCode: errorCode)
                 }
                 }
-                if appDelegate.activeMedia.view.window != nil {
-                    appDelegate.activeMedia.downloadFileSuccessFailure(metadata.fileName, fileID: metadata.fileID, serverUrl: serverUrl, selector: selector, errorMessage: errorMessage, errorCode: errorCode)
-                }
                 
                 
                 NCMainCommon.sharedInstance.reloadDatasource(ServerUrl: serverUrl, fileID: fileID, action: Int32(k_action_MOD))
                 NCMainCommon.sharedInstance.reloadDatasource(ServerUrl: serverUrl, fileID: fileID, action: Int32(k_action_MOD))
             }
             }
@@ -1248,21 +1291,30 @@ class NCNetworkingMain: NSObject, CCNetworkingDelegate {
                 
                 
                 if errorCode == 0 && account == self.appDelegate.activeAccount {
                 if errorCode == 0 && account == self.appDelegate.activeAccount {
                     if CCUtility.fileProviderStorageIconExists(metadata.fileID, fileNameView: metadata.fileName) {
                     if CCUtility.fileProviderStorageIconExists(metadata.fileID, fileNameView: metadata.fileName) {
+                        
                         if view is UICollectionView && NCMainCommon.sharedInstance.isValidIndexPath(indexPath, view: view) {
                         if view is UICollectionView && NCMainCommon.sharedInstance.isValidIndexPath(indexPath, view: view) {
                             if let cell = (view as! UICollectionView).cellForItem(at: indexPath) {
                             if let cell = (view as! UICollectionView).cellForItem(at: indexPath) {
                                 if cell is NCListCell {
                                 if cell is NCListCell {
                                     (cell as! NCListCell).imageItem.image = image
                                     (cell as! NCListCell).imageItem.image = image
+                                    (cell as! NCListCell).imageItem.contentMode = .scaleAspectFill
                                 } else if cell is NCGridCell {
                                 } else if cell is NCGridCell {
                                     (cell as! NCGridCell).imageItem.image = image
                                     (cell as! NCGridCell).imageItem.image = image
+                                    (cell as! NCGridCell).imageItem.contentMode = .scaleAspectFill
+                                } else if cell is NCGridMediaCell {
+                                    (cell as! NCGridMediaCell).imageItem.image = image
+                                    (cell as! NCGridMediaCell).imageItem.contentMode = .scaleAspectFill
                                 }
                                 }
                             }
                             }
                         }
                         }
+                        
                         if view is UITableView && CCUtility.fileProviderStorageIconExists(metadata.fileID, fileNameView: metadata.fileName) && NCMainCommon.sharedInstance.isValidIndexPath(indexPath, view: view) {
                         if view is UITableView && CCUtility.fileProviderStorageIconExists(metadata.fileID, fileNameView: metadata.fileName) && NCMainCommon.sharedInstance.isValidIndexPath(indexPath, view: view) {
                             if let cell = (view as! UITableView).cellForRow(at: indexPath) {
                             if let cell = (view as! UITableView).cellForRow(at: indexPath) {
                                 if cell is CCCellMainTransfer {
                                 if cell is CCCellMainTransfer {
                                     (cell as! CCCellMainTransfer).file.image = image
                                     (cell as! CCCellMainTransfer).file.image = image
+                                    (cell as! CCCellMainTransfer).file.contentMode = .scaleAspectFill
                                 } else if cell is CCCellMain {
                                 } else if cell is CCCellMain {
                                     (cell as! CCCellMain).file.image = image
                                     (cell as! CCCellMain).file.image = image
+                                    (cell as! CCCellMain).file.contentMode = .scaleAspectFill
                                 }
                                 }
                             }
                             }
                         }
                         }
@@ -1289,7 +1341,7 @@ class NCFunctionMain: NSObject {
         let directories = NCManageDatabase.sharedInstance.getTablesDirectory(predicate: NSPredicate(format: "account == %@ AND offline == true", appDelegate.activeAccount), sorted: "serverUrl", ascending: true)
         let directories = NCManageDatabase.sharedInstance.getTablesDirectory(predicate: NSPredicate(format: "account == %@ AND offline == true", appDelegate.activeAccount), sorted: "serverUrl", ascending: true)
         if (directories != nil) {
         if (directories != nil) {
             for directory: tableDirectory in directories! {
             for directory: tableDirectory in directories! {
-                CCSynchronize.shared()?.readFolder(directory.serverUrl, selector: selectorReadFolderWithDownload)
+                CCSynchronize.shared()?.readFolder(directory.serverUrl, selector: selectorReadFolderWithDownload, account: appDelegate.activeAccount)
             }
             }
         }
         }
         
         
@@ -1299,7 +1351,7 @@ class NCFunctionMain: NSObject {
                 guard let metadata = NCManageDatabase.sharedInstance.getMetadata(predicate: NSPredicate(format: "fileID == %@", file.fileID)) else {
                 guard let metadata = NCManageDatabase.sharedInstance.getMetadata(predicate: NSPredicate(format: "fileID == %@", file.fileID)) else {
                     continue
                     continue
                 }
                 }
-                CCSynchronize.shared()?.readFile(metadata.fileID, fileName: metadata.fileName, serverUrl: metadata.serverUrl, selector: selectorReadFileWithDownload)
+                CCSynchronize.shared()?.readFile(metadata.fileID, fileName: metadata.fileName, serverUrl: metadata.serverUrl, selector: selectorReadFileWithDownload, account: appDelegate.activeAccount)
             }
             }
         }
         }
     
     

+ 0 - 0
iOSClient/Main/NCPhotosPickerViewController/NCPhotosPickerViewController.swift → iOSClient/Main/NCPhotosPickerViewController.swift


+ 29 - 0
iOSClient/Main/Section/NCSectionHeaderFooter.swift

@@ -162,6 +162,35 @@ class NCSectionHeader: UICollectionReusableView {
     }
     }
 }
 }
 
 
+class NCSectionMediaHeader: UICollectionReusableView {
+    
+    @IBOutlet weak var labelSection: UILabel!
+    @IBOutlet weak var labelLeadingConstraint: NSLayoutConstraint!
+    @IBOutlet weak var labelHeightConstraint: NSLayoutConstraint!
+    @IBOutlet weak var labelWidthConstraint: NSLayoutConstraint!
+    
+    override func awakeFromNib() {
+        super.awakeFromNib()
+    }
+    
+    func setTitleLabel(sectionDatasource: CCSectionDataSourceMetadata, section: Int) {
+        
+        var title = ""
+        
+        if sectionDatasource.sections.count > section {
+            if sectionDatasource.sections.object(at: section) is String {
+                title = sectionDatasource.sections.object(at: section) as! String
+            }
+            if sectionDatasource.sections.object(at: section) is Date {
+                let titleDate = sectionDatasource.sections.object(at: section) as! Date
+                title = CCUtility.getTitleSectionDate(titleDate)
+            }
+        }
+        
+        labelSection.text = NSLocalizedString(title, comment: "")
+    }
+}
+
 class NCSectionFooter: UICollectionReusableView {
 class NCSectionFooter: UICollectionReusableView {
     
     
     @IBOutlet weak var labelSection: UILabel!
     @IBOutlet weak var labelSection: UILabel!

+ 44 - 0
iOSClient/Main/Section/NCSectionMediaHeader.xib

@@ -0,0 +1,44 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="14460.31" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
+    <device id="retina4_7" orientation="portrait">
+        <adaptation id="fullscreen"/>
+    </device>
+    <dependencies>
+        <deployment identifier="iOS"/>
+        <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14460.20"/>
+        <capability name="Safe area layout guides" minToolsVersion="9.0"/>
+        <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
+    </dependencies>
+    <objects>
+        <placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
+        <placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
+        <collectionReusableView opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" insetsLayoutMarginsFromSafeArea="NO" reuseIdentifier="sectionHeader" id="Vin-9E-7nW" customClass="NCSectionMediaHeader" customModule="Nextcloud" customModuleProvider="target">
+            <rect key="frame" x="0.0" y="0.0" width="377" height="50"/>
+            <autoresizingMask key="autoresizingMask"/>
+            <subviews>
+                <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="LabelSectionHeader" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="gzy-cT-Gjn" userLabel="Label Section">
+                    <rect key="frame" x="109" y="14" width="158" height="22"/>
+                    <constraints>
+                        <constraint firstAttribute="height" constant="22" id="fSy-kX-khX"/>
+                        <constraint firstAttribute="width" constant="158" id="q8E-Aw-w6I"/>
+                    </constraints>
+                    <fontDescription key="fontDescription" type="system" pointSize="14"/>
+                    <nil key="textColor"/>
+                    <nil key="highlightedColor"/>
+                </label>
+            </subviews>
+            <constraints>
+                <constraint firstItem="gzy-cT-Gjn" firstAttribute="centerY" secondItem="EFn-SN-cxu" secondAttribute="centerY" id="1Ld-Nt-Kpm"/>
+                <constraint firstItem="gzy-cT-Gjn" firstAttribute="leading" secondItem="EFn-SN-cxu" secondAttribute="leading" constant="109" id="lwa-IO-uij"/>
+            </constraints>
+            <viewLayoutGuide key="safeArea" id="EFn-SN-cxu"/>
+            <connections>
+                <outlet property="labelHeightConstraint" destination="fSy-kX-khX" id="I8c-I3-WSP"/>
+                <outlet property="labelLeadingConstraint" destination="lwa-IO-uij" id="V9f-rn-jae"/>
+                <outlet property="labelSection" destination="gzy-cT-Gjn" id="yG6-wJ-CmI"/>
+                <outlet property="labelWidthConstraint" destination="q8E-Aw-w6I" id="3kq-Fd-E9d"/>
+            </connections>
+            <point key="canvasLocation" x="42.399999999999999" y="45.877061469265371"/>
+        </collectionReusableView>
+    </objects>
+</document>

+ 0 - 53
iOSClient/Media/CCMedia.h

@@ -1,53 +0,0 @@
-//
-//  CCMedia.h
-//  Nextcloud iOS
-//
-//  Created by Marino Faggiana on 29/07/15.
-//  Copyright (c) 2017 Marino Faggiana. All rights reserved.
-//
-//  Author Marino Faggiana <marino.faggiana@nextcloud.com>
-//
-//  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 <UIKit/UIKit.h>
-#import <Photos/Photos.h>
-#import <ImageIO/ImageIO.h>
-#import <DZNEmptyDataSet/UIScrollView+EmptyDataSet.h>
-
-#import "OCErrorMsg.h"
-#import "TWMessageBarManager.h"
-#import "CCManageLocation.h"
-#import "CCDetail.h"
-#import "CCUtility.h"
-#import "CCSection.h"
-#import "CCHud.h"
-#import "OCNetworking.h"
-
-@class tableMetadata;
-
-@interface CCMedia: UICollectionViewController <UICollectionViewDataSource, UICollectionViewDelegate, UIActionSheetDelegate, DZNEmptyDataSetSource, DZNEmptyDataSetDelegate>
-
-@property (nonatomic, weak) CCDetail *detailViewController;
-@property (nonatomic, strong) tableMetadata *metadata;
-@property (nonatomic, strong) NSMutableArray *addMetadatasFromUpload;
-@property (nonatomic, strong) UIView *reMenuBackgroundView;
-@property (nonatomic, strong) UITapGestureRecognizer *singleFingerTap;
-
-- (void)downloadFileSuccessFailure:(NSString *)fileName fileID:(NSString *)fileID serverUrl:(NSString *)serverUrl selector:(NSString *)selector errorMessage:(NSString *)errorMessage errorCode:(NSInteger)errorCode;
-
-- (void)reloadDatasource:(NSString *)fileID action:(NSInteger)action;
-- (void)searchPhotoVideo;
-
-@end

+ 0 - 1028
iOSClient/Media/CCMedia.m

@@ -1,1028 +0,0 @@
-//
-//  CCMedia.m
-//  Nextcloud iOS
-//
-//  Created by Marino Faggiana on 29/07/15.
-//  Copyright (c) 2017 Marino Faggiana. All rights reserved.
-//
-//  Author Marino Faggiana <marino.faggiana@nextcloud.com>
-//
-//  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 "CCMedia.h"
-#import "AppDelegate.h"
-#import "CCManageAutoUpload.h"
-#import "TOScrollBar.h"
-#import "NCBridgeSwift.h"
-
-@interface CCMedia () <NCSelectDelegate>
-{
-    AppDelegate *appDelegate;
-
-    NSMutableArray *selectedMetadatas;
-    CCSectionDataSourceMetadata *sectionDataSource;
-    
-    BOOL filterTypeFileImage;
-    BOOL filterTypeFileVideo;
-    
-    BOOL isSearchMode;
-    BOOL isEditMode;
-    
-    TOScrollBar *scrollBar;
-    NSMutableDictionary *saveEtagForStartDirectory;
-    
-    // Fix Crash Thumbnail + collectionView ReloadData ?
-    NSInteger counterThumbnail;
-    BOOL collectionViewReloadDataInProgress;
-    
-    // Remenu
-    REMenu *menu;
-    REMenuItem *menuSelectMediaFolder;
-    REMenuItem *menuFilterImage;
-    REMenuItem *menuFilterVideo;
-    REMenuItem *menuSelectItems;
-}
-@end
-
-@implementation CCMedia
-
-#pragma --------------------------------------------------------------------------------------------
-#pragma mark ===== Init =====
-#pragma --------------------------------------------------------------------------------------------
-
--  (id)initWithCoder:(NSCoder *)aDecoder
-{
-    if (self = [super initWithCoder:aDecoder])  {
-        
-        appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
-
-        [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(triggerProgressTask:) name:@"NotificationProgressTask" object:nil];
-        [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(changeTheming) name:@"changeTheming" object:nil];
-        
-        appDelegate.activeMedia = self;
-    }
-    
-    return self;
-}
-
-- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
-{
-    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
-    
-    if (self) {
-        
-        appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
-    }
-    
-    return self;
-}
-
-#pragma --------------------------------------------------------------------------------------------
-#pragma mark ===== View =====
-#pragma --------------------------------------------------------------------------------------------
-
-- (void)viewDidLoad
-{
-    [super viewDidLoad];
-    
-    saveEtagForStartDirectory = [NSMutableDictionary new];
-    selectedMetadatas = [NSMutableArray new];
-    self.addMetadatasFromUpload = [NSMutableArray new];
-    
-    // empty Data Source
-    self.collectionView.emptyDataSetDelegate = self;
-    self.collectionView.emptyDataSetSource = self;
-
-    // scroll bar
-    scrollBar = [TOScrollBar new];
-    [self.collectionView to_addScrollBar:scrollBar];
-    
-    scrollBar.handleTintColor = [NCBrandColor sharedInstance].brand;
-    scrollBar.handleWidth = 20;
-    scrollBar.handleMinimiumHeight = 20;
-    scrollBar.trackWidth = 0;
-    scrollBar.edgeInset = 12;
-    
-    // Query data source
-    [self queryDatasourceWithReloadData:YES];
-}
-
-- (void)viewWillAppear:(BOOL)animated
-{
-    [super viewWillAppear:animated];
-    
-    // Color
-    [appDelegate aspectNavigationControllerBar:self.navigationController.navigationBar online:[appDelegate.reachability isReachable] hidden:NO];
-    [appDelegate aspectTabBar:self.tabBarController.tabBar hidden:NO];
-    
-    // Plus Button
-    [appDelegate plusButtonVisibile:true];
-}
-
-- (void)viewDidAppear:(BOOL)animated
-{
-    [super viewDidAppear:animated];
-    
-    dispatch_after(dispatch_time(DISPATCH_TIME_NOW, 0.001 * NSEC_PER_SEC), dispatch_get_main_queue(), ^(void) {
-        [self reloadDatasource:nil action:k_action_NULL];
-    });
-}
-
-- (void)viewSafeAreaInsetsDidChange
-{
-    [super viewSafeAreaInsetsDidChange];
-    
-    self.collectionView.contentInset = self.view.safeAreaInsets;
-}
-
-- (void)changeTheming
-{
-    if (self.isViewLoaded && self.view.window)
-        [appDelegate changeTheming:self];
-    
-    scrollBar.handleTintColor = [NCBrandColor sharedInstance].brand;
-    
-    [self.collectionView reloadData];
-}
-
-- (void)viewWillTransitionToSize:(CGSize)size withTransitionCoordinator:(id<UIViewControllerTransitionCoordinator>)coordinator
-{
-    [super viewWillTransitionToSize:size withTransitionCoordinator:coordinator];
-    
-    [menu close];
-    
-    // Before rotation
-    
-    [coordinator animateAlongsideTransition:nil completion:^(id<UIViewControllerTransitionCoordinatorContext> context) {
-        
-        if (self.view.frame.size.width == ([[UIScreen mainScreen] bounds].size.width*([[UIScreen mainScreen] bounds].size.width<[[UIScreen mainScreen] bounds].size.height))+([[UIScreen mainScreen] bounds].size.height*([[UIScreen mainScreen] bounds].size.width>[[UIScreen mainScreen] bounds].size.height))) {
-            
-            // Portrait
-            
-        } else {
-            
-            // Landscape
-        }
-        
-        [self.collectionView reloadData];
-    }];
-}
-
-#pragma --------------------------------------------------------------------------------------------
-#pragma mark ===== Gestione Grafica Window =====
-#pragma --------------------------------------------------------------------------------------------
-
-- (void)openMenu
-{
-    if (menu.isOpen) {
-        
-        [menu close];
-        
-    } else {
-        
-        [self createReMainMenu];
-        [menu showFromNavigationController:self.navigationController];
-        
-        // Backgroun reMenu & (Gesture)
-        [self createReMenuBackgroundView:menu];
-        
-        self.singleFingerTap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(openMenu)];
-        [self.reMenuBackgroundView addGestureRecognizer:_singleFingerTap];
-    }
-}
-
-- (void)createReMenuBackgroundView:(REMenu *)menu
-{
-    CGFloat safeAreaBottom = 0;
-    CGFloat safeAreaTop = 0;
-    CGFloat statusBar = 0;
-    
-    if (@available(iOS 11, *)) {
-        safeAreaTop = [UIApplication sharedApplication].delegate.window.safeAreaInsets.top;
-        safeAreaBottom = [UIApplication sharedApplication].delegate.window.safeAreaInsets.bottom;
-    }
-    if ([UIApplication sharedApplication].isStatusBarHidden) {
-        statusBar = 13;
-    }
-    
-    CGFloat computeNavigationBarOffset = [menu computeNavigationBarOffset];
-    UIViewController *rootController = [[[[UIApplication sharedApplication]delegate] window] rootViewController];
-    CGRect globalPositionMenu = [menu.menuView convertRect:menu.menuView.bounds toView:rootController.view];
-    
-    self.reMenuBackgroundView = [UIView new];
-    self.reMenuBackgroundView.backgroundColor = [UIColor colorWithWhite:0 alpha:0.5];
-    self.reMenuBackgroundView.frame = CGRectMake(0, computeNavigationBarOffset, globalPositionMenu.size.width,  rootController.view.frame.size.height);
-    
-    [UIView animateWithDuration:0.2 animations:^{
-        
-        CGFloat minimum = safeAreaBottom + self.tabBarController.tabBar.frame.size.height;
-        CGFloat y =  rootController.view.frame.size.height - menu.menuView.frame.size.height - globalPositionMenu.origin.y + statusBar;
-        
-        if (y>minimum) {
-            
-            self.reMenuBackgroundView.frame = CGRectMake(0, rootController.view.frame.size.height, globalPositionMenu.size.width, - y);
-            [self.tabBarController.view addSubview:self.reMenuBackgroundView];
-        }
-    }];
-}
-
-- (void)createReMainMenu
-{
-    menuSelectItems = [[REMenuItem alloc] initWithTitle:NSLocalizedString(@"_select_", nil)subtitle:@"" image:[CCGraphics changeThemingColorImage:[UIImage imageNamed:@"select"] multiplier:2 color:[NCBrandColor sharedInstance].icon] highlightedImage:nil action:^(REMenuItem *item) {
-        if ([sectionDataSource.allRecordsDataSource count] > 0) {
-            [self editingModeYES];
-        }
-    }];
-    
-    menuSelectMediaFolder = [[REMenuItem alloc] initWithTitle:NSLocalizedString(@"_select_media_folder_", nil)subtitle:@"" image:[CCGraphics changeThemingColorImage:[UIImage imageNamed:@"folderMedia"] multiplier:2 color:[NCBrandColor sharedInstance].icon] highlightedImage:nil action:^(REMenuItem *item) {
-        [self selectStartDirectoryPhotosTab];
-    }];
-    
-    if (filterTypeFileImage) {
-        menuFilterImage = [[REMenuItem alloc] initWithTitle:NSLocalizedString(@"_media_viewimage_show_", nil)subtitle:@"" image:[CCGraphics changeThemingColorImage:[UIImage imageNamed:@"imageno"] multiplier:2 color:[NCBrandColor sharedInstance].icon] highlightedImage:nil action:^(REMenuItem *item) {
-            filterTypeFileImage = NO;
-            [self reloadDatasource:nil action:k_action_NULL];
-        }];
-    } else {
-        menuFilterImage = [[REMenuItem alloc] initWithTitle:NSLocalizedString(@"_media_viewimage_hide_", nil)subtitle:@"" image:[CCGraphics changeThemingColorImage:[UIImage imageNamed:@"imageyes"] multiplier:2 color:[NCBrandColor sharedInstance].icon] highlightedImage:nil action:^(REMenuItem *item) {
-            filterTypeFileImage = YES;
-            [self reloadDatasource:nil action:k_action_NULL];
-        }];
-    }
-    
-    if (filterTypeFileVideo) {
-        menuFilterVideo = [[REMenuItem alloc] initWithTitle:NSLocalizedString(@"_media_viewvideo_show_", nil)subtitle:@"" image:[CCGraphics changeThemingColorImage:[UIImage imageNamed:@"videono"] multiplier:2 color:[NCBrandColor sharedInstance].icon] highlightedImage:nil action:^(REMenuItem *item) {
-            filterTypeFileVideo = NO;
-            [self reloadDatasource:nil action:k_action_NULL];
-        }];
-    } else {
-        menuFilterVideo = [[REMenuItem alloc] initWithTitle:NSLocalizedString(@"_media_viewvideo_hide_", nil)subtitle:@"" image:[CCGraphics changeThemingColorImage:[UIImage imageNamed:@"videoyes"] multiplier:2 color:[NCBrandColor sharedInstance].icon] highlightedImage:nil action:^(REMenuItem *item) {
-            filterTypeFileVideo = YES;
-            [self reloadDatasource:nil action:k_action_NULL];
-        }];
-    }
-    
-    // REMENU --------------------------------------------------------------------------------------------------------------
-    
-    menu = [[REMenu alloc] initWithItems:@[menuSelectItems, menuSelectMediaFolder, menuFilterImage, menuFilterVideo]];
-    
-    menu.imageOffset = CGSizeMake(5, -1);
-    
-    menu.separatorOffset = CGSizeMake(50.0, 0.0);
-    menu.imageOffset = CGSizeMake(0, 0);
-    menu.waitUntilAnimationIsComplete = NO;
-    
-    menu.separatorHeight = 0.5;
-    menu.separatorColor = [NCBrandColor sharedInstance].seperator;
-    
-    menu.backgroundColor = [NCBrandColor sharedInstance].backgroundView;
-    menu.textColor = [UIColor blackColor];
-    menu.textAlignment = NSTextAlignmentLeft;
-    menu.textShadowColor = nil;
-    menu.textOffset = CGSizeMake(50, 0.0);
-    menu.font = [UIFont systemFontOfSize:14.0];
-    
-    menu.highlightedBackgroundColor = [[NCBrandColor sharedInstance] getColorSelectBackgrond];
-    menu.highlightedSeparatorColor = nil;
-    menu.highlightedTextColor = [UIColor blackColor];
-    menu.highlightedTextShadowColor = nil;
-    menu.highlightedTextShadowOffset = CGSizeMake(0, 0);
-    
-    menu.subtitleTextColor = [UIColor colorWithWhite:0.425 alpha:1];
-    menu.subtitleTextAlignment = NSTextAlignmentLeft;
-    menu.subtitleTextShadowColor = nil;
-    menu.subtitleTextShadowOffset = CGSizeMake(0, 0.0);
-    menu.subtitleTextOffset = CGSizeMake(50, 0.0);
-    menu.subtitleFont = [UIFont systemFontOfSize:12.0];
-    
-    menu.subtitleHighlightedTextColor = [UIColor lightGrayColor];
-    menu.subtitleHighlightedTextShadowColor = nil;
-    menu.subtitleHighlightedTextShadowOffset = CGSizeMake(0, 0);
-    
-    menu.borderWidth = 0.3;
-    menu.borderColor =  [UIColor lightGrayColor];
-    
-    menu.animationDuration = 0.2;
-    menu.closeAnimationDuration = 0.2;
-    
-    menu.bounce = NO;
-    
-    __weak typeof(self) weakSelf = self;
-    [menu setClosePreparationBlock:^{
-        
-        // Backgroun reMenu (Gesture)
-        [weakSelf.reMenuBackgroundView removeFromSuperview];
-        [weakSelf.reMenuBackgroundView removeGestureRecognizer:weakSelf.singleFingerTap];
-    }];
-}
-
-- (void)setUINavigationBarDefault
-{
-    [appDelegate aspectNavigationControllerBar:self.navigationController.navigationBar online:[appDelegate.reachability isReachable] hidden:NO];
- 
-    // curront folder search
-    NSString *directory = [[NCManageDatabase sharedInstance] getAccountStartDirectoryMediaTabView:[CCUtility getHomeServerUrlActiveUrl:appDelegate.activeUrl]];
-    NSString *home = [CCUtility getHomeServerUrlActiveUrl:appDelegate.activeUrl];
-    NSString *folder = @"";
-    if (home.length > 0) {
-        folder = [directory stringByReplacingOccurrencesOfString:home withString:@""];
-    }
-    
-    // Title
-    NSString *title;
-    if (folder.length == 0) {
-        title = NSLocalizedString(@"_media_", nil);
-    } else {
-        title = [NSString stringWithFormat:@"%@: %@", NSLocalizedString(@"_media_", nil), [folder substringFromIndex:1]];
-    }
-    
-    self.navigationItem.titleView = nil;
-    self.navigationItem.title = title;
-    
-    if (isSearchMode) {
-        [CCGraphics addImageToTitle:title colorTitle:[NCBrandColor sharedInstance].brandText imageTitle:[CCGraphics changeThemingColorImage:[UIImage imageNamed:@"load"] multiplier:2 color:[NCBrandColor sharedInstance].brandText] imageRight:NO navigationItem:self.navigationItem];
-    }
-    
-    // Button Item RIGHT
-    UIBarButtonItem *buttonMore = [[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"navigationControllerMenu"] style:UIBarButtonItemStylePlain target:self action:@selector(openMenu)];
-    
-    self.navigationItem.rightBarButtonItems = [[NSArray alloc] initWithObjects:buttonMore, nil];
-    self.navigationItem.leftBarButtonItems = nil;
-}
-
-- (void)setUINavigationBarSelected
-{
-    UIBarButtonItem *buttonDelete = [[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"delete"] style:UIBarButtonItemStylePlain target:self action:@selector(deleteSelectedFiles)];
-//    UIBarButtonItem *buttonOpenIn = [[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"openFile"] style:UIBarButtonItemStylePlain target:self action:@selector(openSelectedFiles)];
-    
-    UIBarButtonItem *cancelButton = [[UIBarButtonItem alloc] initWithTitle:NSLocalizedString(@"_cancel_", nil) style:UIBarButtonItemStylePlain target:self action:@selector(editingModeNO)];
-    
-    self.navigationItem.rightBarButtonItems = [[NSArray alloc] initWithObjects:cancelButton, nil];
-    self.navigationItem.leftBarButtonItems = [[NSArray alloc] initWithObjects:buttonDelete, nil];
-    
-    // Title
-    self.navigationItem.title = [NSString stringWithFormat:@"%@ : %lu / %lu", NSLocalizedString(@"_selected_", nil), (unsigned long)[selectedMetadatas count], (unsigned long)[sectionDataSource.allRecordsDataSource count]];
-}
-
-- (void)cellSelect:(BOOL)select indexPath:(NSIndexPath *)indexPath metadata:(tableMetadata *)metadata
-{
-    UICollectionViewCell *cell = [self.collectionView cellForItemAtIndexPath:indexPath];
-    UIVisualEffectView *effect = [cell viewWithTag:200];
-    UIImageView *checked = [cell viewWithTag:300];
-    
-    if (select) {
-        effect.hidden = NO;
-        effect.alpha = 0.4;
-        checked.hidden = NO;
-        [selectedMetadatas addObject:metadata];
-        
-    } else {
-        effect.hidden = YES;
-        checked.hidden = YES;
-        [selectedMetadatas removeObject:metadata];
-    }
-    
-    // Title
-    self.navigationItem.title = [NSString stringWithFormat:@"%@ : %lu / %lu", NSLocalizedString(@"_selected_", nil), (unsigned long)[selectedMetadatas count], (unsigned long)[sectionDataSource.allRecordsDataSource count]];
-}
-
-- (void)scrollToTop
-{
-    [self.collectionView setContentOffset:CGPointMake(0, - self.collectionView.contentInset.top) animated:NO];
-}
-
-- (void)getGeoLocationForSection:(NSInteger)section
-{
-    NSString *addLocation = @"";
-    
-    NSArray *fileIDsForKey = [sectionDataSource.sectionArrayRow objectForKey:[sectionDataSource.sections objectAtIndex:section]];
-    
-    for (NSString *fileID in fileIDsForKey) {
-    
-        tableLocalFile *localFile = [[NCManageDatabase sharedInstance] getTableLocalFileWithPredicate:[NSPredicate predicateWithFormat:@"fileID == %@", fileID]];
-    
-        if ([localFile.exifLatitude floatValue] > 0 || [localFile.exifLongitude floatValue] > 0) {
-        
-            NSString *location = [[NCManageDatabase sharedInstance] getLocationFromGeoLatitude:localFile.exifLatitude longitude:localFile.exifLongitude];
-            
-            addLocation = [NSString stringWithFormat:@"%@, %@", addLocation, location];
-        
-        }
-    }
-}
-
-#pragma --------------------------------------------------------------------------------------------
-#pragma mark ==== DZNEmptyDataSetSource Methods ====
-#pragma --------------------------------------------------------------------------------------------
-
-- (UIColor *)backgroundColorForEmptyDataSet:(UIScrollView *)scrollView
-{
-    return [NCBrandColor sharedInstance].backgroundView;
-}
-
-- (UIImage *)imageForEmptyDataSet:(UIScrollView *)scrollView
-{
-    return [CCGraphics changeThemingColorImage:[UIImage imageNamed:@"mediaNoRecord"] multiplier:1 color:[NCBrandColor sharedInstance].graySoft];
-}
-
-- (NSAttributedString *)titleForEmptyDataSet:(UIScrollView *)scrollView
-{
-    NSString *text;
-    
-    if (isSearchMode) {
-        text = [NSString stringWithFormat:@"\n%@", NSLocalizedString(@"_search_in_progress_", nil)];
-    } else {
-        text = [NSString stringWithFormat:@"\n%@", NSLocalizedString(@"_tutorial_photo_view_", nil)];
-    }
-    
-    NSDictionary *attributes = @{NSFontAttributeName:[UIFont boldSystemFontOfSize:20.0f], NSForegroundColorAttributeName:[UIColor lightGrayColor]};
-    
-    return [[NSAttributedString alloc] initWithString:text attributes:attributes];
-}
-
-/*
-#pragma --------------------------------------------------------------------------------------------
-#pragma mark ===== openSelectedFiles =====
-#pragma--------------------------------------------------------------------------------------------
-
-- (void)openSelectedFiles
-{
-    NSMutableArray *dataToShare = [[NSMutableArray alloc] init];
-    
-    for (tableMetadata *metadata in selectedMetadatas) {
-    
-        NSString *fileNamePath = [CCUtility getDirectoryProviderStorageFileID:metadata.fileID fileName:metadata.fileNameView];
-                
-        if ([CCUtility fileProviderStorageExists:metadata.fileID fileName:metadata.fileNameView]) {
-            
-            if ([metadata.typeFile isEqualToString: k_metadataTypeFile_image]) {
-                
-                NSData *data = [NSData dataWithData:UIImageJPEGRepresentation([UIImage imageWithContentsOfFile:fileNamePath], 0.9)];
-                [dataToShare addObject:data];
-            }
-            
-            if ([metadata.typeFile isEqualToString: k_metadataTypeFile_video]) {
-                
-                [dataToShare addObject:[NSURL fileURLWithPath:fileNamePath]];
-            }
-        }
-    }
-    
-    if ([dataToShare count] > 0) {
-        
-        UIActivityViewController* activityViewController = [[UIActivityViewController alloc] initWithActivityItems:dataToShare applicationActivities:nil];
-        
-        // iPad
-        activityViewController.popoverPresentationController.barButtonItem = self.navigationItem.rightBarButtonItems.lastObject;
-        
-        self.navigationItem.leftBarButtonItem.enabled = NO;
-        self.navigationItem.rightBarButtonItem.enabled = NO;
-        
-        [self presentViewController:activityViewController animated:YES completion:^{
-            
-            [activityViewController setCompletionWithItemsHandler:^(NSString *activityType, BOOL completed, NSArray *returnedItems, NSError *activityError) {
-                
-                self.navigationItem.leftBarButtonItem.enabled = YES;
-                self.navigationItem.rightBarButtonItem.enabled = YES;
-                
-                [self editingModeNO];
-
-                if (completed) {
-                    [self.collectionView reloadData];
-                }
-            }];
-        }];
-    }
-}
-*/
-
-#pragma --------------------------------------------------------------------------------------------
-#pragma mark ===== Download =====
-#pragma--------------------------------------------------------------------------------------------
-
-- (void)triggerProgressTask:(NSNotification *)notification
-{
-}
-
-- (void)downloadFileSuccessFailure:(NSString *)fileName fileID:(NSString *)fileID serverUrl:(NSString *)serverUrl selector:(NSString *)selector errorMessage:(NSString *)errorMessage errorCode:(NSInteger)errorCode
-{
-    if (errorCode == 0) {
-        
-        tableMetadata *metadata = [[NCManageDatabase sharedInstance] getMetadataWithPredicate:[NSPredicate predicateWithFormat:@"fileID == %@", fileID]];
-        if (metadata == nil || metadata.account != appDelegate.activeAccount) {
-            return;
-        }
-
-        NSIndexPath *indexPath;
-        BOOL existsIcon = NO;
-        
-        if (fileID) {
-            existsIcon = [[NSFileManager defaultManager] fileExistsAtPath:[CCUtility getDirectoryProviderStorageIconFileID:fileID fileNameView:fileName]];
-            indexPath = [sectionDataSource.fileIDIndexPath objectForKey:fileID];
-        }
-        
-        if ([self indexPathIsValid:indexPath] && existsIcon) {
-            
-            UICollectionViewCell *cell = [self.collectionView cellForItemAtIndexPath:indexPath];
-            
-            if (cell) {
-                UIImageView *imageView = (UIImageView *)[cell viewWithTag:100];
-                UIVisualEffectView *effect = [cell viewWithTag:200];
-                UIImageView *checked = [cell viewWithTag:300];
-                
-                imageView.image = [UIImage imageWithContentsOfFile:[CCUtility getDirectoryProviderStorageIconFileID:fileID fileNameView:fileName]];
-                effect.hidden = YES;
-                checked.hidden = YES;
-            }
-        }
-        
-    } else {
-        
-        [appDelegate messageNotification:@"_download_selected_files_" description:@"_error_download_photobrowser_" visible:YES delay:k_dismissAfterSecond type:TWMessageBarMessageTypeError errorCode:errorCode];
-    }
-}
-
-#pragma --------------------------------------------------------------------------------------------
-#pragma mark ===== Delete =====
-#pragma--------------------------------------------------------------------------------------------
-
-- (void)deleteFile:(NSArray *)metadatas e2ee:(BOOL)e2ee
-{
-    [[NCMainCommon sharedInstance ] deleteFileWithMetadatas:metadatas e2ee:false serverUrl:@"" folderFileID:@"" completion:^(NSInteger errorCode, NSString *message) {
-        [[NCMainCommon sharedInstance] reloadDatasourceWithServerUrl:nil fileID:nil action:k_action_NULL];
-    }];
-    
-    [self editingModeNO];
-}
-
-- (void)deleteSelectedFiles
-{
-    if ([selectedMetadatas count] == 0)
-        return;
-    
-    UIAlertController *alertController = [UIAlertController alertControllerWithTitle:nil message:nil preferredStyle:UIAlertControllerStyleActionSheet];
-    
-    [alertController addAction: [UIAlertAction actionWithTitle:NSLocalizedString(@"_delete_", nil)
-                                                         style:UIAlertActionStyleDestructive
-                                                       handler:^(UIAlertAction *action) {
-                                                           [self deleteFile:selectedMetadatas e2ee:false];
-                                                       }]];
-    
-    [alertController addAction: [UIAlertAction actionWithTitle:NSLocalizedString(@"_cancel_", nil)
-                                                         style:UIAlertActionStyleCancel
-                                                       handler:^(UIAlertAction *action) {
-                                                       }]];
-    
-    alertController.popoverPresentationController.barButtonItem = self.navigationItem.leftBarButtonItems.firstObject;
-    
-    if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)
-        [alertController.view layoutIfNeeded];
-    
-    [self presentViewController:alertController animated:YES completion:NULL];
-}
-
-#pragma --------------------------------------------------------------------------------------------
-#pragma mark ==== Download Thumbnail ====
-#pragma --------------------------------------------------------------------------------------------
-
-- (void)downloadThumbnail:(tableMetadata *)metadata indexPath:(NSIndexPath *)indexPath
-{
-    counterThumbnail++;
-    
-    CGFloat width = [[NCUtility sharedInstance] getScreenWidthForPreview];
-    CGFloat height = [[NCUtility sharedInstance] getScreenHeightForPreview];
-    
-    [[OCNetworking sharedManager] downloadPreviewWithAccount:appDelegate.activeAccount metadata:metadata withWidth:width andHeight:height completion:^(NSString *account, UIImage *image, NSString *message, NSInteger errorCode) {
-        
-        counterThumbnail--;
-        
-        if (errorCode == 0 && [account isEqualToString:appDelegate.activeAccount]) {
-            UICollectionViewCell *cell = [self.collectionView cellForItemAtIndexPath:indexPath];
-            UIImageView *imageView = (UIImageView *)[cell viewWithTag:100];
-            imageView.image = image;
-        }
-    }];
-}
-
-#pragma --------------------------------------------------------------------------------------------
-#pragma mark ==== Change Start directory ====
-#pragma --------------------------------------------------------------------------------------------
-
-- (void)dismissSelectWithServerUrl:(NSString *)serverUrl metadata:(tableMetadata *)metadata type:(NSString *)type
-{
-    if ([type isEqualToString:@"mediaFolder"]) {
-        
-        NSString *oldStartDirectoryMediaTabView = [[NCManageDatabase sharedInstance] getAccountStartDirectoryMediaTabView:[CCUtility getHomeServerUrlActiveUrl:appDelegate.activeUrl]];
-        
-        if (![serverUrl isEqualToString:oldStartDirectoryMediaTabView]) {
-            
-            // Save Start Directory
-            [[NCManageDatabase sharedInstance] setAccountStartDirectoryMediaTabView:serverUrl];
-            
-            // search PhotoVideo with new start directory
-            [self searchPhotoVideo];
-        }
-    }
-}
-
-- (void)selectStartDirectoryPhotosTab
-{
-    UINavigationController *navigationController = [[UIStoryboard storyboardWithName:@"NCSelect" bundle:nil] instantiateInitialViewController];
-    NCSelect *viewController = (NCSelect *)navigationController.topViewController;
-    
-    viewController.delegate = self;
-    viewController.hideButtonCreateFolder = true;
-    viewController.selectFile = false;
-    viewController.includeDirectoryE2EEncryption = false;
-    viewController.includeImages = false;
-    viewController.type = @"mediaFolder";
-    viewController.titleButtonDone = NSLocalizedString(@"_select_", nil);
-    viewController.layoutViewSelect = k_layout_view_move;
-    
-    [navigationController setModalPresentationStyle:UIModalPresentationFormSheet];
-    [self presentViewController:navigationController animated:YES completion:nil];
-}
-
-#pragma --------------------------------------------------------------------------------------------
-#pragma mark ==== Search Photo/Video ====
-#pragma --------------------------------------------------------------------------------------------
-
-- (void)searchPhotoVideo
-{
-    // test
-    if (appDelegate.activeAccount.length == 0 || isSearchMode)
-        return;
-    
-    // WAITING FOR d:creationdate
-    //
-    // tableAccount *account = [[NCManageDatabase sharedInstance] getAccountActive];
-    // account.dateSearchContentTypeImageVideo
-    
-    NSString *startDirectory = [[NCManageDatabase sharedInstance] getAccountStartDirectoryMediaTabView:[CCUtility getHomeServerUrlActiveUrl:appDelegate.activeUrl]];
-    
-    [[OCNetworking sharedManager] readFileWithAccount:appDelegate.activeAccount serverUrl:startDirectory fileName:nil completion:^(NSString *account, tableMetadata *metadata, NSString *message, NSInteger errorCode) {
-
-        if (errorCode == 0 && [account isEqualToString:appDelegate.activeAccount]) {
-            
-            if (![metadata.etag isEqualToString:[saveEtagForStartDirectory objectForKey:startDirectory]] || sectionDataSource.allRecordsDataSource.count == 0) {
-                
-                isSearchMode = YES;
-                [self editingModeNO];
-                
-                NSDate *date = [[NSCalendar currentCalendar] dateByAddingUnit:NSCalendarUnitDay value:-30 toDate:[NSDate date] options:0];
-                
-                [[OCNetworking sharedManager] searchWithAccount:appDelegate.activeAccount fileName:@"" serverUrl:startDirectory contentType:@[@"image/%", @"video/%"] date:date depth:@"infinity" completion:^(NSString *account, NSArray *metadatas, NSString *message, NSInteger errorCode) {
-                    
-                    isSearchMode = NO;
-
-                    if (errorCode == 0 && [appDelegate.activeAccount isEqualToString:account]) {
-                        
-                        dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0), ^{
-                            
-                            // Clear all Hardcoded new foto/video from CCNetworking
-                            [self.addMetadatasFromUpload removeAllObjects];
-                            
-                            [[NCManageDatabase sharedInstance] createTablePhotos:metadatas account:account];
-                            
-                            dispatch_async(dispatch_get_main_queue(), ^{
-                                [self reloadDatasource:nil action:k_action_NULL];
-                            });
-                            
-                            // Update date
-                            [[NCManageDatabase sharedInstance] setAccountDateSearchContentTypeImageVideo:[NSDate date]];
-                            // Save etag
-                            [saveEtagForStartDirectory setObject:metadata.etag forKey:metadata.serverUrl];
-                        });
-                        
-                    } else {
-                        [self reloadDatasource:nil action:k_action_NULL];
-                    }
-                }];
-                
-            } else {
-                if (errorCode != 0) {
-                    NSLog(@"[LOG] Search error.");
-                } else {
-                    NSLog(@"[LOG] It has been changed user during networking process, error.");
-                }
-                
-                [self reloadDatasource:nil action:k_action_NULL];
-            }
-        } else if (errorCode != 0) {
-            NSLog(@"[LOG] Read file error.");
-        } else {
-            NSLog(@"[LOG] It has been changed user during networking process, error.");
-        }
-    }];
-}
-
-#pragma --------------------------------------------------------------------------------------------
-#pragma mark ==== Datasource ====
-#pragma --------------------------------------------------------------------------------------------
-
-- (void)reloadDatasource:(NSString *)fileID action:(NSInteger)action
-{
-    // test
-    if (appDelegate.activeAccount.length == 0 || self.view.window == nil) {
-        return;
-    }
-    
-    dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
-
-        collectionViewReloadDataInProgress = YES;
-
-        CCSectionDataSourceMetadata *sectionDataSourceTemp = [self queryDatasourceWithReloadData:NO];
-
-        dispatch_async(dispatch_get_main_queue(), ^{
-               
-            if (isEditMode)
-                [self setUINavigationBarSelected];
-            else
-                [self setUINavigationBarDefault];
-            
-            sectionDataSource = sectionDataSourceTemp;
-            [self.collectionView reloadData];
-            
-            [self.collectionView performBatchUpdates:^{} completion:^(BOOL finished) {
-                collectionViewReloadDataInProgress = NO;
-            }];
-        });
-    });
-}
-
-- (CCSectionDataSourceMetadata *)queryDatasourceWithReloadData:(BOOL)withReloadData
-{
-    // test
-    if (appDelegate.activeAccount.length == 0) {
-        return nil;
-    }
-    
-    CCSectionDataSourceMetadata *sectionDataSourceTemp = [CCSectionDataSourceMetadata new];
-    
-    NSArray *metadatas = [[NCManageDatabase sharedInstance] getTablePhotosWithAddMetadatasFromUpload:self.addMetadatasFromUpload account:appDelegate.activeAccount];
-    sectionDataSourceTemp = [CCSectionMetadata creataDataSourseSectionMetadata:metadatas listProgressMetadata:nil groupByField:@"date" filterFileID:appDelegate.filterFileID filterTypeFileImage:filterTypeFileImage filterTypeFileVideo:filterTypeFileVideo activeAccount:appDelegate.activeAccount];
-    
-    if (withReloadData) {
-        sectionDataSource = sectionDataSourceTemp;
-        [self.collectionView reloadData];
-    }
-    
-    return sectionDataSourceTemp;
-}
-
-- (void)editingModeYES
-{
-    [self.collectionView setAllowsMultipleSelection:true];
-    isEditMode = true;
-    [selectedMetadatas removeAllObjects];
-    [self setUINavigationBarSelected];
-
-    collectionViewReloadDataInProgress = YES;
-    [self.collectionView reloadData];
-    [self.collectionView performBatchUpdates:^{} completion:^(BOOL finished) {
-        collectionViewReloadDataInProgress = NO;
-    }];
-}
-
-- (void)editingModeNO
-{
-    [self.collectionView setAllowsMultipleSelection:false];
-    isEditMode = false;
-    [selectedMetadatas removeAllObjects];
-    [self setUINavigationBarDefault];
-    
-    collectionViewReloadDataInProgress = YES;
-    [self.collectionView reloadData];
-    [self.collectionView performBatchUpdates:^{} completion:^(BOOL finished) {
-        collectionViewReloadDataInProgress = NO;
-    }];
-}
-
-#pragma --------------------------------------------------------------------------------------------
-#pragma mark ==== Collection ====
-#pragma --------------------------------------------------------------------------------------------
-
-- (BOOL)indexPathIsValid:(NSIndexPath *)indexPath
-{
-    return indexPath.section < [self numberOfSectionsInCollectionView:self.collectionView] && indexPath.row < [self collectionView:self.collectionView numberOfItemsInSection:indexPath.section];
-}
-
-- (NSInteger)numberOfSectionsInCollectionView:(UICollectionView *)collectionView
-{    
-    return [[sectionDataSource.sectionArrayRow allKeys] count];
-}
-
-- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section
-{
-    return [[sectionDataSource.sectionArrayRow objectForKey:[sectionDataSource.sections objectAtIndex:section]] count];
-}
-
-- (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath
-{
-    UIInterfaceOrientation orientationOnLunch = [[UIApplication sharedApplication] statusBarOrientation];
-    
-    if (orientationOnLunch == UIInterfaceOrientationPortrait)
-        return CGSizeMake(collectionView.frame.size.width / 5.1f, collectionView.frame.size.width / 5.1f);
-    else
-        return CGSizeMake(collectionView.frame.size.width / 7.1f, collectionView.frame.size.width / 7.1f);
-}
-
--(CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout referenceSizeForFooterInSection:(NSInteger)section
-{
-    if ([sectionDataSource.sections count] - 1 == section)
-        return CGSizeMake(collectionView.frame.size.width, 50);
-    
-    return CGSizeZero;
-}
-
-- (UICollectionReusableView *)collectionView:(UICollectionView *)collectionView viewForSupplementaryElementOfKind:(NSString *)kind atIndexPath:(NSIndexPath *)indexPath
-{
-    if (kind == UICollectionElementKindSectionHeader) {
-        
-        UICollectionReusableView *headerView = [collectionView dequeueReusableSupplementaryViewOfKind:kind withReuseIdentifier:@"header" forIndexPath:indexPath];
-        
-        //headerView.backgroundColor = COLOR_GROUPBY_BAR_NO_BLUR;
-        
-        [self getGeoLocationForSection:indexPath.section];
-        
-        UILabel *titleLabel = (UILabel *)[headerView viewWithTag:100];
-        titleLabel.textColor = [UIColor blackColor];
-        if (sectionDataSource.sections.count > indexPath.section)
-            titleLabel.text = [CCUtility getTitleSectionDate:[sectionDataSource.sections objectAtIndex:indexPath.section]];
-
-        return headerView;
-    }
-    
-    if (kind == UICollectionElementKindSectionFooter) {
-        
-        UICollectionReusableView *footerView = [collectionView dequeueReusableSupplementaryViewOfKind:kind withReuseIdentifier:@"footer" forIndexPath:indexPath];
-        
-        UILabel *titleLabel = (UILabel *)[footerView viewWithTag:100];
-        titleLabel.textColor = [UIColor grayColor];
-        titleLabel.text = [NSString stringWithFormat:@"%lu %@, %lu %@", (long)sectionDataSource.image, NSLocalizedString(@"photo", nil), (long)sectionDataSource.video, NSLocalizedString(@"_video_", nil)];
-        
-        return footerView;
-    }
-    
-    return nil;
-}
-
-- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath
-{
-    UICollectionViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"cell" forIndexPath:indexPath];
-    UIImageView *imageView = (UIImageView *)[cell viewWithTag:100];
-    UIVisualEffectView *effect = [cell viewWithTag:200];
-
-    UIImageView *checkedOverlay = [cell viewWithTag:300];
-    checkedOverlay.image = [CCGraphics changeThemingColorImage:[UIImage imageNamed:@"checkedYes"] multiplier:2 color:[NCBrandColor sharedInstance].brand];
-    
-    UIImageView *videoOverlay = [cell viewWithTag:400];
-    videoOverlay.image = [UIImage imageNamed:@"VideoOverlay"];
-
-    NSArray *metadatasForKey = [sectionDataSource.sectionArrayRow objectForKey:[sectionDataSource.sections objectAtIndex:indexPath.section]];
-    
-    if ([metadatasForKey count] > indexPath.row) {
-        
-        NSString *fileID = [metadatasForKey objectAtIndex:indexPath.row];
-        tableMetadata *metadata = [sectionDataSource.allRecordsDataSource objectForKey:fileID];
-    
-        // Image
-        if ([[NSFileManager defaultManager] fileExistsAtPath:[CCUtility getDirectoryProviderStorageIconFileID:metadata.fileID fileNameView:metadata.fileNameView]]) {
-        
-            // insert Image
-            imageView.image = [UIImage imageWithContentsOfFile:[CCUtility getDirectoryProviderStorageIconFileID:metadata.fileID fileNameView:metadata.fileNameView]];
-        
-        } else {
-        
-            imageView.image = [UIImage imageNamed:@"file_photo"];
-
-            if (metadata.hasPreview == 1 && ![CCUtility fileProviderStorageIconExists:metadata.fileID fileNameView:metadata.fileNameView]) {
-                [self downloadThumbnail:metadata indexPath:indexPath];
-            }
-        }
-    
-        // Cheched Overlay
-        if (cell.selected) {
-            checkedOverlay.hidden = NO;
-            effect.hidden = NO;
-            effect.alpha = 0.4;
-        } else {
-            checkedOverlay.hidden = YES;
-            effect.hidden = YES;
-        }
-        
-        // Video Overlay
-        if ([metadata.typeFile isEqualToString: k_metadataTypeFile_video]) {
-            videoOverlay.hidden = NO;
-        } else {
-            videoOverlay.hidden = YES;
-        }
-    }
-    
-    return cell;
-}
-
-- (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath
-{
-    NSArray *metadatasForKey = [sectionDataSource.sectionArrayRow objectForKey:[sectionDataSource.sections objectAtIndex:indexPath.section]];
-    
-    if ([metadatasForKey count] > indexPath.row) {
-        
-        NSString *fileID = [metadatasForKey objectAtIndex:indexPath.row];
-        self.metadata = [sectionDataSource.allRecordsDataSource objectForKey:fileID];
-        
-        if (isEditMode) {
-        
-            [self cellSelect:YES indexPath:indexPath metadata:self.metadata];
-        
-        } else {
-        
-            if ([self shouldPerformSegue])
-                [self performSegueWithIdentifier:@"segueDetail" sender:self];
-        }
-    }
-}
-
-- (void)collectionView:(UICollectionView *)collectionView didDeselectItemAtIndexPath:(NSIndexPath *)indexPath
-{
-    // test
-    if (isEditMode == NO)
-        return;
-   
-    NSArray *metadatasForKey = [sectionDataSource.sectionArrayRow objectForKey:[sectionDataSource.sections objectAtIndex:indexPath.section]];
-    
-    if ([metadatasForKey count] > indexPath.row) {
-        
-        NSString *fileID = [metadatasForKey objectAtIndex:indexPath.row];
-        self.metadata = [sectionDataSource.allRecordsDataSource objectForKey:fileID];
-        
-        [self cellSelect:NO indexPath:indexPath metadata:self.metadata];
-    }
-}
-
-#pragma --------------------------------------------------------------------------------------------
-#pragma mark ===== Navigation ====
-#pragma --------------------------------------------------------------------------------------------
-
-- (BOOL)shouldPerformSegue
-{
-    if ([[UIApplication sharedApplication] applicationState] == UIApplicationStateBackground)
-        return NO;
-    
-    // Not in first plain ? exit
-    if (self.view.window == NO)
-        return NO;
-    
-    // Collapsed but in first plain in detail exit
-    if (self.splitViewController.isCollapsed)
-        if (self.detailViewController.isViewLoaded && self.detailViewController.view.window)
-            return NO;
-    
-    // check if metadata is invalidated
-    if ([[NCManageDatabase sharedInstance] isTableInvalidated:self.metadata]) {
-        return NO;
-    }
-    
-    // ok perform segue
-    return YES;
-}
-
--(void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
-{
-    id controller = segue.destinationViewController;
-    
-    if ([controller isKindOfClass:[UINavigationController class]]) {
-        UINavigationController *navigationController = controller;
-        self.detailViewController = (CCDetail *)navigationController.topViewController;
-    } else {
-        self.detailViewController = segue.destinationViewController;
-    }
-    
-    NSMutableArray *photoDataSource = [NSMutableArray new];
-    
-    for (NSString *fileID in sectionDataSource.allFileID) {
-        tableMetadata *metadata = [sectionDataSource.allRecordsDataSource objectForKey:fileID];
-        if ([metadata.typeFile isEqualToString: k_metadataTypeFile_image])
-            [photoDataSource addObject:metadata];
-    }
-    
-    self.detailViewController.photoDataSource = photoDataSource;
-    self.detailViewController.metadataDetail = self.metadata;
-    self.detailViewController.dateFilterQuery = self.metadata.date;
-    
-    [self.detailViewController setTitle:self.metadata.fileName];
-}
-
-@end

+ 46 - 4
iOSClient/Media/NCMedia.storyboard

@@ -18,8 +18,8 @@
                         <rect key="frame" x="0.0" y="0.0" width="375" height="812"/>
                         <rect key="frame" x="0.0" y="0.0" width="375" height="812"/>
                         <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
                         <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
                         <subviews>
                         <subviews>
-                            <collectionView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" dataMode="prototypes" translatesAutoresizingMaskIntoConstraints="NO" id="Zaz-Cl-qpZ">
-                                <rect key="frame" x="0.0" y="44" width="375" height="734"/>
+                            <collectionView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" dataMode="prototypes" translatesAutoresizingMaskIntoConstraints="NO" id="Zaz-Cl-qpZ" customClass="FastScrollCollectionView" customModule="FastScroll">
+                                <rect key="frame" x="0.0" y="84" width="375" height="694"/>
                                 <color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
                                 <color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
                                 <collectionViewFlowLayout key="collectionViewLayout" minimumLineSpacing="0.0" minimumInteritemSpacing="0.0" id="fF1-wd-0xN">
                                 <collectionViewFlowLayout key="collectionViewLayout" minimumLineSpacing="0.0" minimumInteritemSpacing="0.0" id="fF1-wd-0xN">
                                     <size key="itemSize" width="0.0" height="0.0"/>
                                     <size key="itemSize" width="0.0" height="0.0"/>
@@ -33,24 +33,62 @@
                                     <outlet property="delegate" destination="EFX-fO-Oip" id="s3n-CL-8X2"/>
                                     <outlet property="delegate" destination="EFX-fO-Oip" id="s3n-CL-8X2"/>
                                 </connections>
                                 </connections>
                             </collectionView>
                             </collectionView>
+                            <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="G50-oX-FLW" userLabel="menuView">
+                                <rect key="frame" x="0.0" y="44" width="375" height="40"/>
+                                <constraints>
+                                    <constraint firstAttribute="height" constant="40" id="BWR-lv-VfM"/>
+                                </constraints>
+                            </view>
+                            <button opaque="NO" contentMode="scaleAspectFit" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="1LR-q9-gsg" userLabel="menuButtonMore">
+                                <rect key="frame" x="338" y="51.666666666666657" width="25" height="25"/>
+                                <constraints>
+                                    <constraint firstAttribute="width" constant="25" id="or7-4c-KqJ"/>
+                                    <constraint firstAttribute="height" constant="25" id="pn1-Jb-zyy"/>
+                                </constraints>
+                                <state key="normal" image="moreBig"/>
+                                <connections>
+                                    <action selector="touchUpInsideMenuButtonMore:" destination="EFX-fO-Oip" eventType="touchUpInside" id="Bma-8w-2u5"/>
+                                </connections>
+                            </button>
+                            <button opaque="NO" contentMode="scaleAspectFit" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="OQ1-lf-7It" userLabel="menuButtonSwitch">
+                                <rect key="frame" x="12" y="51.666666666666657" width="25" height="25"/>
+                                <constraints>
+                                    <constraint firstAttribute="height" constant="25" id="ekW-sZ-OU6"/>
+                                    <constraint firstAttribute="width" constant="25" id="rTQ-C2-KxE"/>
+                                </constraints>
+                                <state key="normal" image="switchGridChange"/>
+                                <connections>
+                                    <action selector="touchUpInsideMenuButtonSwitch:" destination="EFX-fO-Oip" eventType="touchUpInside" id="yZN-9G-Cj2"/>
+                                </connections>
+                            </button>
                         </subviews>
                         </subviews>
                         <color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
                         <color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
                         <constraints>
                         <constraints>
+                            <constraint firstItem="1LR-q9-gsg" firstAttribute="centerY" secondItem="G50-oX-FLW" secondAttribute="centerY" id="1IG-0W-2Km"/>
                             <constraint firstItem="Zaz-Cl-qpZ" firstAttribute="leading" secondItem="Meh-VD-wWh" secondAttribute="leading" id="1bp-sm-u0X"/>
                             <constraint firstItem="Zaz-Cl-qpZ" firstAttribute="leading" secondItem="Meh-VD-wWh" secondAttribute="leading" id="1bp-sm-u0X"/>
+                            <constraint firstItem="G50-oX-FLW" firstAttribute="top" secondItem="Meh-VD-wWh" secondAttribute="top" id="3ed-pX-rRh"/>
+                            <constraint firstItem="OQ1-lf-7It" firstAttribute="centerY" secondItem="G50-oX-FLW" secondAttribute="centerY" id="SQq-P5-U5X"/>
+                            <constraint firstItem="Meh-VD-wWh" firstAttribute="trailing" secondItem="G50-oX-FLW" secondAttribute="trailing" id="Tfa-a7-aJb"/>
                             <constraint firstItem="Meh-VD-wWh" firstAttribute="trailing" secondItem="Zaz-Cl-qpZ" secondAttribute="trailing" id="aNd-UL-hmu"/>
                             <constraint firstItem="Meh-VD-wWh" firstAttribute="trailing" secondItem="Zaz-Cl-qpZ" secondAttribute="trailing" id="aNd-UL-hmu"/>
                             <constraint firstItem="Meh-VD-wWh" firstAttribute="bottom" secondItem="Zaz-Cl-qpZ" secondAttribute="bottom" id="aNr-tf-2AH"/>
                             <constraint firstItem="Meh-VD-wWh" firstAttribute="bottom" secondItem="Zaz-Cl-qpZ" secondAttribute="bottom" id="aNr-tf-2AH"/>
-                            <constraint firstItem="Zaz-Cl-qpZ" firstAttribute="top" secondItem="Meh-VD-wWh" secondAttribute="top" id="tji-wt-R7s"/>
+                            <constraint firstItem="1LR-q9-gsg" firstAttribute="trailing" secondItem="G50-oX-FLW" secondAttribute="trailing" constant="-12" id="hRt-cK-gXl"/>
+                            <constraint firstItem="G50-oX-FLW" firstAttribute="leading" secondItem="Meh-VD-wWh" secondAttribute="leading" id="mg3-LM-XZM"/>
+                            <constraint firstItem="Zaz-Cl-qpZ" firstAttribute="top" secondItem="G50-oX-FLW" secondAttribute="bottom" id="xKg-EU-lKl"/>
+                            <constraint firstItem="OQ1-lf-7It" firstAttribute="leading" secondItem="G50-oX-FLW" secondAttribute="leading" constant="12" id="yys-ji-8dV"/>
                         </constraints>
                         </constraints>
                         <viewLayoutGuide key="safeArea" id="Meh-VD-wWh"/>
                         <viewLayoutGuide key="safeArea" id="Meh-VD-wWh"/>
                     </view>
                     </view>
                     <connections>
                     <connections>
                         <outlet property="collectionView" destination="Zaz-Cl-qpZ" id="8oA-Gx-z7T"/>
                         <outlet property="collectionView" destination="Zaz-Cl-qpZ" id="8oA-Gx-z7T"/>
+                        <outlet property="menuButtonMore" destination="1LR-q9-gsg" id="6Yc-bd-p3W"/>
+                        <outlet property="menuButtonSwitch" destination="OQ1-lf-7It" id="G1t-eK-QCB"/>
+                        <outlet property="menuView" destination="G50-oX-FLW" id="9Rs-ip-Ybj"/>
                         <segue destination="rIl-hI-jAh" kind="showDetail" identifier="segueDetail" id="MHI-ti-PGq"/>
                         <segue destination="rIl-hI-jAh" kind="showDetail" identifier="segueDetail" id="MHI-ti-PGq"/>
                     </connections>
                     </connections>
                 </viewController>
                 </viewController>
                 <placeholder placeholderIdentifier="IBFirstResponder" id="JJ0-Le-6eT" userLabel="First Responder" sceneMemberID="firstResponder"/>
                 <placeholder placeholderIdentifier="IBFirstResponder" id="JJ0-Le-6eT" userLabel="First Responder" sceneMemberID="firstResponder"/>
             </objects>
             </objects>
-            <point key="canvasLocation" x="256.80000000000001" y="228.93553223388307"/>
+            <point key="canvasLocation" x="256.80000000000001" y="228.32512315270938"/>
         </scene>
         </scene>
         <!--CCDetailNC-->
         <!--CCDetailNC-->
         <scene sceneID="D5y-IR-BuC">
         <scene sceneID="D5y-IR-BuC">
@@ -61,4 +99,8 @@
             <point key="canvasLocation" x="1080" y="228"/>
             <point key="canvasLocation" x="1080" y="228"/>
         </scene>
         </scene>
     </scenes>
     </scenes>
+    <resources>
+        <image name="moreBig" width="120" height="120"/>
+        <image name="switchGridChange" width="25" height="25"/>
+    </resources>
 </document>
 </document>

+ 554 - 386
iOSClient/Media/NCMedia.swift

@@ -3,7 +3,7 @@
 //  Nextcloud
 //  Nextcloud
 //
 //
 //  Created by Marino Faggiana on 12/02/2019.
 //  Created by Marino Faggiana on 12/02/2019.
-//  Copyright © 2018 Marino Faggiana. All rights reserved.
+//  Copyright © 2019 Marino Faggiana. All rights reserved.
 //
 //
 //  Author Marino Faggiana <marino.faggiana@nextcloud.com>
 //  Author Marino Faggiana <marino.faggiana@nextcloud.com>
 //
 //
@@ -23,13 +23,15 @@
 
 
 import Foundation
 import Foundation
 import Sheeeeeeeeet
 import Sheeeeeeeeet
+import FastScroll
 
 
-class NCMedia: UIViewController ,UICollectionViewDataSource, UICollectionViewDelegate, UICollectionViewDelegateFlowLayout, UIGestureRecognizerDelegate, NCListCellDelegate, NCGridCellDelegate, NCSectionHeaderMenuDelegate, DropdownMenuDelegate, DZNEmptyDataSetSource, DZNEmptyDataSetDelegate  {
+class NCMedia: UIViewController, DropdownMenuDelegate, DZNEmptyDataSetSource, DZNEmptyDataSetDelegate, NCSelectDelegate {
+    
+    @IBOutlet weak var collectionView : FastScrollCollectionView!
+    @IBOutlet weak var menuButtonMore: UIButton!
+    @IBOutlet weak var menuButtonSwitch: UIButton!
+    @IBOutlet weak var menuView: UIView!
     
     
-    @IBOutlet fileprivate weak var collectionView: UICollectionView!
-
-    var titleCurrentFolder = NSLocalizedString("_manage_file_offline_", comment: "")
-    var serverUrl = ""
     
     
     private let appDelegate = UIApplication.shared.delegate as! AppDelegate
     private let appDelegate = UIApplication.shared.delegate as! AppDelegate
    
    
@@ -37,97 +39,123 @@ class NCMedia: UIViewController ,UICollectionViewDataSource, UICollectionViewDel
     private var isEditMode = false
     private var isEditMode = false
     private var selectFileID = [String]()
     private var selectFileID = [String]()
     
     
-    private var sectionDatasource = CCSectionDataSourceMetadata()
+    private var filterTypeFileImage = false;
+    private var filterTypeFileVideo = false;
     
     
-    private var typeLayout = ""
-    private var datasourceSorted = ""
-    private var datasourceAscending = true
-    private var datasourceGroupBy = ""
-    private var datasourceDirectoryOnTop = false
+    private var sectionDatasource = CCSectionDataSourceMetadata()
     
     
     private var autoUploadFileName = ""
     private var autoUploadFileName = ""
     private var autoUploadDirectory = ""
     private var autoUploadDirectory = ""
     
     
-    private var listLayout: NCListLayout!
-    private var gridLayout: NCGridLayout!
+    private var gridLayout: NCGridMediaLayout!
     
     
     private var actionSheet: ActionSheet?
     private var actionSheet: ActionSheet?
     
     
-    private let headerMenuHeight: CGFloat = 50
-    private let sectionHeaderHeight: CGFloat = 20
+    private let sectionHeaderHeight: CGFloat = 50
     private let footerHeight: CGFloat = 50
     private let footerHeight: CGFloat = 50
+    
+    private var stepImageWidth: CGFloat = 10
+    
+    private var isDistantPast = false
 
 
     private let refreshControl = UIRefreshControl()
     private let refreshControl = UIRefreshControl()
+    private var loadingSearch = false
+
+    required init?(coder aDecoder: NSCoder) {
+        super.init(coder: aDecoder)
+
+        appDelegate.activeMedia = self
+    }
     
     
     override func viewDidLoad() {
     override func viewDidLoad() {
         super.viewDidLoad()
         super.viewDidLoad()
         
         
         // Cell
         // Cell
-        collectionView.register(UINib.init(nibName: "NCListCell", bundle: nil), forCellWithReuseIdentifier: "listCell")
-        collectionView.register(UINib.init(nibName: "NCGridCell", bundle: nil), forCellWithReuseIdentifier: "gridCell")
+        collectionView.register(UINib.init(nibName: "NCGridMediaCell", bundle: nil), forCellWithReuseIdentifier: "gridCell")
         
         
         // Header
         // Header
-        collectionView.register(UINib.init(nibName: "NCSectionHeaderMenu", bundle: nil), forSupplementaryViewOfKind: UICollectionView.elementKindSectionHeader, withReuseIdentifier: "sectionHeaderMenu")
-        collectionView.register(UINib.init(nibName: "NCSectionHeader", bundle: nil), forSupplementaryViewOfKind: UICollectionView.elementKindSectionHeader, withReuseIdentifier: "sectionHeader")
+        collectionView.register(UINib.init(nibName: "NCSectionMediaHeader", bundle: nil), forSupplementaryViewOfKind: UICollectionView.elementKindSectionHeader, withReuseIdentifier: "sectionHeader")
         
         
         // Footer
         // Footer
         collectionView.register(UINib.init(nibName: "NCSectionFooter", bundle: nil), forSupplementaryViewOfKind: UICollectionView.elementKindSectionFooter, withReuseIdentifier: "sectionFooter")
         collectionView.register(UINib.init(nibName: "NCSectionFooter", bundle: nil), forSupplementaryViewOfKind: UICollectionView.elementKindSectionFooter, withReuseIdentifier: "sectionFooter")
         
         
         collectionView.alwaysBounceVertical = true
         collectionView.alwaysBounceVertical = true
 
 
-        listLayout = NCListLayout()
-        gridLayout = NCGridLayout()
-        
+        gridLayout = NCGridMediaLayout()
+        gridLayout.preferenceWidth = CGFloat(CCUtility.getMediaWidthImage())
+        gridLayout.sectionHeadersPinToVisibleBounds = true
+
+        collectionView.collectionViewLayout = gridLayout
+
         // Add Refresh Control
         // Add Refresh Control
-        if #available(iOS 10.0, *) {
-            collectionView.refreshControl = refreshControl
-        } else {
-            collectionView.addSubview(refreshControl)
-        }
-        
-        // Configure Refresh Control
-        refreshControl.tintColor = NCBrandColor.sharedInstance.brandText
-        refreshControl.backgroundColor = NCBrandColor.sharedInstance.brand
-        refreshControl.addTarget(self, action: #selector(loadDatasource), for: .valueChanged)
+        collectionView.refreshControl = refreshControl
         
         
         // empty Data Source
         // empty Data Source
-        self.collectionView.emptyDataSetDelegate = self;
-        self.collectionView.emptyDataSetSource = self;        
+        collectionView.emptyDataSetDelegate = self
+        collectionView.emptyDataSetSource = self
+        
+        // Notification
+        NotificationCenter.default.addObserver(self, selector: #selector(self.changeTheming), name: NSNotification.Name(rawValue: "changeTheming"), object: nil)
     }
     }
     
     
     override func viewWillAppear(_ animated: Bool) {
     override func viewWillAppear(_ animated: Bool) {
         super.viewWillAppear(animated)
         super.viewWillAppear(animated)
         
         
-        // Color
+        // Aspect Color
         appDelegate.aspectNavigationControllerBar(self.navigationController?.navigationBar, online: appDelegate.reachability.isReachable(), hidden: false)
         appDelegate.aspectNavigationControllerBar(self.navigationController?.navigationBar, online: appDelegate.reachability.isReachable(), hidden: false)
         appDelegate.aspectTabBar(self.tabBarController?.tabBar, hidden: false)
         appDelegate.aspectTabBar(self.tabBarController?.tabBar, hidden: false)
         
         
-        self.navigationItem.title = titleCurrentFolder
+        // Configure Refresh Control
+        refreshControl.tintColor = NCBrandColor.sharedInstance.brandText
+        refreshControl.backgroundColor = NCBrandColor.sharedInstance.brand
+        refreshControl.addTarget(self, action: #selector(loadNetworkDatasource), for: .valueChanged)
         
         
-        (typeLayout, datasourceSorted, datasourceAscending, datasourceGroupBy, datasourceDirectoryOnTop) = NCUtility.sharedInstance.getLayoutForView(key: k_layout_view_offline)
+        menuView.backgroundColor = NCBrandColor.sharedInstance.brand
+        menuButtonSwitch.setImage(UIImage(named: "switchGridChange")?.withRenderingMode(.alwaysTemplate), for: .normal)
+        menuButtonSwitch.tintColor = NCBrandColor.sharedInstance.brandText
+        menuButtonMore.setImage(UIImage(named: "moreBig")?.withRenderingMode(.alwaysTemplate), for: .normal)
+        menuButtonMore.tintColor = NCBrandColor.sharedInstance.brandText
         
         
         // get auto upload folder
         // get auto upload folder
         autoUploadFileName = NCManageDatabase.sharedInstance.getAccountAutoUploadFileName()
         autoUploadFileName = NCManageDatabase.sharedInstance.getAccountAutoUploadFileName()
         autoUploadDirectory = NCManageDatabase.sharedInstance.getAccountAutoUploadDirectory(appDelegate.activeUrl)
         autoUploadDirectory = NCManageDatabase.sharedInstance.getAccountAutoUploadDirectory(appDelegate.activeUrl)
         
         
-        if typeLayout == k_layout_list {
-            collectionView.collectionViewLayout = listLayout
-        } else {
-            collectionView.collectionViewLayout = gridLayout
-        }
+        // Title
+        self.navigationItem.title = NSLocalizedString("_media_", comment: "")
         
         
-        loadDatasource()
+        // Fast Scrool
+        configFastScroll()
+
+        // Reload Data Source
+        self.reloadDataSource(loadNetworkDatasource: true)
+    }
+    
+    override func viewDidAppear(_ animated: Bool) {
+        super.viewDidAppear(animated)
+        
+        collectionView?.reloadDataThenPerform {
+            self.selectSearchSections()
+        }
     }
     }
     
     
     override func viewWillTransition(to size: CGSize, with coordinator: UIViewControllerTransitionCoordinator) {
     override func viewWillTransition(to size: CGSize, with coordinator: UIViewControllerTransitionCoordinator) {
         super.viewWillTransition(to: size, with: coordinator)
         super.viewWillTransition(to: size, with: coordinator)
         
         
         coordinator.animate(alongsideTransition: nil) { _ in
         coordinator.animate(alongsideTransition: nil) { _ in
-            self.collectionView.collectionViewLayout.invalidateLayout()
+            self.collectionView?.reloadDataThenPerform {
+                self.downloadThumbnail()
+            }
             self.actionSheet?.viewDidLayoutSubviews()
             self.actionSheet?.viewDidLayoutSubviews()
         }
         }
     }
     }
     
     
+    @objc func changeTheming() {
+        
+        if self.isViewLoaded && self.view?.window != nil {
+            appDelegate.changeTheming(self)
+        }
+    }
+
     // MARK: DZNEmpty
     // MARK: DZNEmpty
     
     
     func backgroundColor(forEmptyDataSet scrollView: UIScrollView) -> UIColor? {
     func backgroundColor(forEmptyDataSet scrollView: UIScrollView) -> UIColor? {
@@ -135,11 +163,17 @@ class NCMedia: UIViewController ,UICollectionViewDataSource, UICollectionViewDel
     }
     }
     
     
     func image(forEmptyDataSet scrollView: UIScrollView) -> UIImage? {
     func image(forEmptyDataSet scrollView: UIScrollView) -> UIImage? {
-        return CCGraphics.changeThemingColorImage(UIImage.init(named: "filesNoFiles"), multiplier: 2, color: NCBrandColor.sharedInstance.brandElement)
+        return CCGraphics.changeThemingColorImage(UIImage.init(named: "mediaNoRecord"), multiplier: 2, color: NCBrandColor.sharedInstance.brandElement)
     }
     }
     
     
     func title(forEmptyDataSet scrollView: UIScrollView) -> NSAttributedString? {
     func title(forEmptyDataSet scrollView: UIScrollView) -> NSAttributedString? {
-        let text = "\n"+NSLocalizedString("_files_no_files_", comment: "")
+        
+        var text = "\n" + NSLocalizedString("_tutorial_photo_view_", comment: "")
+
+        if loadingSearch {
+            text = "\n" + NSLocalizedString("_search_in_progress_", comment: "")
+        }
+        
         let attributes = [NSAttributedString.Key.font: UIFont.boldSystemFont(ofSize: 20), NSAttributedString.Key.foregroundColor: UIColor.lightGray]
         let attributes = [NSAttributedString.Key.font: UIFont.boldSystemFont(ofSize: 20), NSAttributedString.Key.foregroundColor: UIColor.lightGray]
         return NSAttributedString.init(string: text, attributes: attributes)
         return NSAttributedString.init(string: text, attributes: attributes)
     }
     }
@@ -148,442 +182,576 @@ class NCMedia: UIViewController ,UICollectionViewDataSource, UICollectionViewDel
         return true
         return true
     }
     }
     
     
-    // MARK: TAP EVENT
+    // MARK: IBAction
     
     
-    func tapSwitchHeader(sender: Any) {
+    @IBAction func touchUpInsideMenuButtonSwitch(_ sender: Any) {
         
         
-        if collectionView.collectionViewLayout == gridLayout {
-            // list layout
-            UIView.animate(withDuration: 0.0, animations: {
-                self.collectionView.collectionViewLayout.invalidateLayout()
-                self.collectionView.setCollectionViewLayout(self.listLayout, animated: false, completion: { (_) in
-                    self.collectionView.reloadData()
-                    self.collectionView.setContentOffset(CGPoint(x:0,y:0), animated: false)
-                })
-            })
-            typeLayout = k_layout_list
-            NCUtility.sharedInstance.setLayoutForView(key: k_layout_view_offline, layout: typeLayout, sort: datasourceSorted, ascending: datasourceAscending, groupBy: datasourceGroupBy, directoryOnTop: datasourceDirectoryOnTop)
-        } else {
-            // grid layout
-            UIView.animate(withDuration: 0.0, animations: {
-                self.collectionView.collectionViewLayout.invalidateLayout()
-                self.collectionView.setCollectionViewLayout(self.gridLayout, animated: false, completion: { (_) in
-                    self.collectionView.reloadData()
-                    self.collectionView.setContentOffset(CGPoint(x:0,y:0), animated: false)
-                })
-            })
-            typeLayout = k_layout_grid
-            NCUtility.sharedInstance.setLayoutForView(key: k_layout_view_offline, layout: typeLayout, sort: datasourceSorted, ascending: datasourceAscending, groupBy: datasourceGroupBy, directoryOnTop: datasourceDirectoryOnTop)
-        }
+        let itemSizeStart = self.gridLayout.itemSize
+        
+        UIView.animate(withDuration: 0.0, animations: {
+            
+            if self.gridLayout.numItems == 1 && self.stepImageWidth > 0 {
+                self.stepImageWidth = -10
+            } else if itemSizeStart.width < 50 {
+                self.stepImageWidth = 10
+            }
+            
+            repeat {
+                self.gridLayout.preferenceWidth = self.gridLayout.preferenceWidth + self.stepImageWidth
+            } while (self.gridLayout.itemSize == itemSizeStart)
+            
+            CCUtility.setMediaWidthImage(Int(self.gridLayout?.preferenceWidth ?? 80))
+            self.collectionView.collectionViewLayout.invalidateLayout()
+            
+            if self.stepImageWidth < 0 {
+                DispatchQueue.main.asyncAfter(deadline: .now() + 0.5) {
+                    self.selectSearchSections()
+                }
+            }
+        })
     }
     }
     
     
-    func tapOrderHeader(sender: Any) {
-        
-        var menuView: DropdownMenu?
-        var selectedIndexPath = [IndexPath()]
+    @IBAction func touchUpInsideMenuButtonMore(_ sender: Any) {
         
         
-        let item1 = DropdownItem(image: CCGraphics.changeThemingColorImage(UIImage.init(named: "sortFileNameAZ"), multiplier: 2, color: NCBrandColor.sharedInstance.icon), title: NSLocalizedString("_order_by_name_a_z_", comment: ""))
-        let item2 = DropdownItem(image: CCGraphics.changeThemingColorImage(UIImage.init(named: "sortFileNameZA"), multiplier: 2, color: NCBrandColor.sharedInstance.icon), title: NSLocalizedString("_order_by_name_z_a_", comment: ""))
-        let item3 = DropdownItem(image: CCGraphics.changeThemingColorImage(UIImage.init(named: "sortDateMoreRecent"), multiplier: 2, color: NCBrandColor.sharedInstance.icon), title: NSLocalizedString("_order_by_date_more_recent_", comment: ""))
-        let item4 = DropdownItem(image: CCGraphics.changeThemingColorImage(UIImage.init(named: "sortDateLessRecent"), multiplier: 2, color: NCBrandColor.sharedInstance.icon), title: NSLocalizedString("_order_by_date_less_recent_", comment: ""))
-        let item5 = DropdownItem(image: CCGraphics.changeThemingColorImage(UIImage.init(named: "sortSmallest"), multiplier: 2, color: NCBrandColor.sharedInstance.icon), title: NSLocalizedString("_order_by_size_smallest_", comment: ""))
-        let item6 = DropdownItem(image: CCGraphics.changeThemingColorImage(UIImage.init(named: "sortLargest"), multiplier: 2, color: NCBrandColor.sharedInstance.icon), title: NSLocalizedString("_order_by_size_largest_", comment: ""))
-        
-        switch datasourceSorted {
-        case "fileName":
-            if datasourceAscending == true { item1.style = .highlight; selectedIndexPath.append(IndexPath(row: 0, section: 0)) }
-            if datasourceAscending == false { item2.style = .highlight; selectedIndexPath.append(IndexPath(row: 1, section: 0)) }
-        case "date":
-            if datasourceAscending == false { item3.style = .highlight; selectedIndexPath.append(IndexPath(row: 2, section: 0)) }
-            if datasourceAscending == true { item4.style = .highlight; selectedIndexPath.append(IndexPath(row: 3, section: 0)) }
-        case "size":
-            if datasourceAscending == true { item5.style = .highlight; selectedIndexPath.append(IndexPath(row: 4, section: 0)) }
-            if datasourceAscending == false { item6.style = .highlight; selectedIndexPath.append(IndexPath(row: 5, section: 0)) }
-        default:
-            ()
+        var menu: DropdownMenu?
+
+        if !isEditMode {
+            
+            let item0 = DropdownItem(image: CCGraphics.changeThemingColorImage(UIImage.init(named: "select"), multiplier: 2, color: NCBrandColor.sharedInstance.icon), title:  NSLocalizedString("_select_", comment: ""))
+            let item1 = DropdownItem(image: CCGraphics.changeThemingColorImage(UIImage.init(named: "folderMedia"), multiplier: 2, color: NCBrandColor.sharedInstance.icon), title:  NSLocalizedString("_select_media_folder_", comment: ""))
+            var item2: DropdownItem
+            if filterTypeFileImage {
+                item2 = DropdownItem(image: CCGraphics.changeThemingColorImage(UIImage.init(named: "imageno"), multiplier: 2, color: NCBrandColor.sharedInstance.icon), title:  NSLocalizedString("_media_viewimage_show_", comment: ""))
+            } else {
+                item2 = DropdownItem(image: CCGraphics.changeThemingColorImage(UIImage.init(named: "imageyes"), multiplier: 2, color: NCBrandColor.sharedInstance.icon), title:  NSLocalizedString("_media_viewimage_hide_", comment: ""))
+            }
+            var item3: DropdownItem
+            if filterTypeFileVideo {
+                item3 = DropdownItem(image: CCGraphics.changeThemingColorImage(UIImage.init(named: "videono"), multiplier: 2, color: NCBrandColor.sharedInstance.icon), title:  NSLocalizedString("_media_viewvideo_show_", comment: ""))
+            } else {
+                item3 = DropdownItem(image: CCGraphics.changeThemingColorImage(UIImage.init(named: "videoyes"), multiplier: 2, color: NCBrandColor.sharedInstance.icon), title:  NSLocalizedString("_media_viewvideo_hide_", comment: ""))
+            }
+            menu = DropdownMenu(navigationController: self.navigationController!, items: [item0,item1,item2,item3], selectedRow: -1)
+            menu?.token = "menuButtonMore"
+            
+        } else {
+            
+            let item0 = DropdownItem(image: CCGraphics.changeThemingColorImage(UIImage.init(named: "select"), multiplier: 2, color: NCBrandColor.sharedInstance.icon), title:  NSLocalizedString("_cancel_", comment: ""))
+            
+            let item1 = DropdownItem(image: CCGraphics.changeThemingColorImage(UIImage.init(named: "trash"), multiplier: 2, color: NCBrandColor.sharedInstance.icon), title:  NSLocalizedString("_delete_", comment: ""))
+            
+            menu = DropdownMenu(navigationController: self.navigationController!, items: [item0, item1], selectedRow: -1)
+            menu?.token = "menuButtonMoreSelect"
         }
         }
         
         
-        let item7 = DropdownItem(image: CCGraphics.changeThemingColorImage(UIImage.init(named: "MenuGroupByAlphabetic"), multiplier: 2, color: NCBrandColor.sharedInstance.icon), title: NSLocalizedString("_group_alphabetic_no_", comment: ""))
-        let item8 = DropdownItem(image: CCGraphics.changeThemingColorImage(UIImage.init(named: "MenuGroupByFile"), multiplier: 2, color: NCBrandColor.sharedInstance.icon), title: NSLocalizedString("_group_typefile_no_", comment: ""))
-        let item9 = DropdownItem(image: CCGraphics.changeThemingColorImage(UIImage.init(named: "MenuGroupByDate"), multiplier: 2, color: NCBrandColor.sharedInstance.icon), title: NSLocalizedString("_group_date_no_", comment: ""))
+        menu?.delegate = self
+        menu?.rowHeight = 45
+        menu?.highlightColor = NCBrandColor.sharedInstance.brand
+        menu?.tableView.alwaysBounceVertical = false
+        menu?.tableViewBackgroundColor = UIColor.white
+        menu?.topOffsetY = menuView.bounds.height
+    
+        menu?.showMenu()
+    }
+    
+    // MARK: DROP-DOWN-MENU
+
+    func dropdownMenu(_ dropdownMenu: DropdownMenu, didSelectRowAt indexPath: IndexPath) {
         
         
-        switch datasourceGroupBy {
-        case "alphabetic":
-            item7.style = .highlight; selectedIndexPath.append(IndexPath(row: 0, section: 1))
-        case "typefile":
-            item8.style = .highlight; selectedIndexPath.append(IndexPath(row: 1, section: 1))
-        case "date":
-            item9.style = .highlight; selectedIndexPath.append(IndexPath(row: 2, section: 1))
-        default:
-            ()
+        if dropdownMenu.token == "menuButtonMore" {
+            switch indexPath.row {
+            case 0:
+                isEditMode = true
+            case 1:
+                selectStartDirectoryPhotosTab()
+            case 2:
+                filterTypeFileImage = !filterTypeFileImage
+                reloadDataSource(loadNetworkDatasource: false)
+            case 3:
+                filterTypeFileVideo = !filterTypeFileVideo
+                reloadDataSource(loadNetworkDatasource: false)
+            default: ()
+            }
         }
         }
         
         
-        let item10 = DropdownItem(image: CCGraphics.changeThemingColorImage(UIImage.init(named: "foldersOnTop"), multiplier: 2, color: NCBrandColor.sharedInstance.icon), title: NSLocalizedString("_directory_on_top_no_", comment: ""))
-        
-        if datasourceDirectoryOnTop {
-            item10.style = .highlight; selectedIndexPath.append(IndexPath(row: 0, section: 2))
+        if dropdownMenu.token == "menuButtonMoreSelect" {
+            switch indexPath.row {
+            case 0:
+                isEditMode = false
+                selectFileID.removeAll()
+                collectionView?.reloadDataThenPerform {
+                    self.downloadThumbnail()
+                }
+            case 1:
+                deleteItems()
+            default: ()
+            }
         }
         }
+    }
+    
+    // MARK: Select Directory
+    
+    func selectStartDirectoryPhotosTab() {
         
         
-        let sectionOrder = DropdownSection(sectionIdentifier: "", items: [item1, item2, item3, item4, item5, item6])
-        let sectionGroupBy = DropdownSection(sectionIdentifier: "", items: [item7, item8, item9])
-        let sectionFolderOnTop = DropdownSection(sectionIdentifier: "", items: [item10])
+        let navigationController = UIStoryboard(name: "NCSelect", bundle: nil).instantiateInitialViewController() as! UINavigationController
+        let viewController = navigationController.topViewController as! NCSelect
         
         
-        menuView = DropdownMenu(navigationController: self.navigationController!, sections: [sectionOrder, sectionGroupBy, sectionFolderOnTop], selectedIndexPath: selectedIndexPath)
-        menuView?.token = "tapOrderHeaderMenu"
-        menuView?.delegate = self
-        menuView?.rowHeight = 45
-        menuView?.sectionHeaderHeight = 8
-        menuView?.highlightColor = NCBrandColor.sharedInstance.brand
-        menuView?.tableView.alwaysBounceVertical = false
-        menuView?.tableViewBackgroundColor = UIColor.white
+        viewController.delegate = self
+        viewController.hideButtonCreateFolder = true
+        viewController.includeDirectoryE2EEncryption = false
+        viewController.includeImages = false
+        viewController.layoutViewSelect = k_layout_view_move
+        viewController.selectFile = false
+        viewController.titleButtonDone = NSLocalizedString("_select_", comment: "")
+        viewController.type = "mediaFolder"
         
         
-        let header = (sender as? UIButton)?.superview
-        let headerRect = self.collectionView.convert(header!.bounds, from: self.view)
-        let menuOffsetY =  headerRect.height - headerRect.origin.y - 2
-        menuView?.topOffsetY = CGFloat(menuOffsetY)
+        navigationController.modalPresentationStyle = UIModalPresentationStyle.formSheet
+        self.present(navigationController, animated: true, completion: nil)
         
         
-        menuView?.showMenu()
     }
     }
     
     
-    func tapMoreHeader(sender: Any) {
+    func dismissSelect(serverUrl: String?, metadata: tableMetadata?, type: String) {
+        
+        let oldStartDirectoryMediaTabView = NCManageDatabase.sharedInstance.getAccountStartDirectoryMediaTabView(CCUtility.getHomeServerUrlActiveUrl(appDelegate.activeUrl))
         
         
+        if serverUrl != nil && serverUrl != oldStartDirectoryMediaTabView {
+            
+            // Save Start Directory
+            NCManageDatabase.sharedInstance.setAccountStartDirectoryMediaTabView(serverUrl!)
+            //
+            NCManageDatabase.sharedInstance.clearTable(tableMedia.self, account: appDelegate.activeAccount)
+            self.sectionDatasource = CCSectionDataSourceMetadata()
+            //
+            loadNetworkDatasource()
+        }
     }
     }
     
     
-    func tapMoreListItem(with fileID: String, sender: Any) {
-        tapMoreGridItem(with: fileID, sender: sender)
+    // MARK: SEGUE
+    
+    override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
+        
+        let photoDataSource: NSMutableArray = []
+        
+        for fileID: String in sectionDatasource.allFileID as! [String] {
+            let metadata = sectionDatasource.allRecordsDataSource.object(forKey: fileID) as! tableMetadata
+            if metadata.typeFile == k_metadataTypeFile_image {
+                photoDataSource.add(metadata)
+            }
+        }
+        
+        if let segueNavigationController = segue.destination as? UINavigationController {
+            if let segueViewController = segueNavigationController.topViewController as? CCDetail {
+            
+                segueViewController.metadataDetail = metadataPush
+                segueViewController.dateFilterQuery = nil
+                segueViewController.photoDataSource = photoDataSource
+                segueViewController.title = metadataPush!.fileNameView
+            }
+        }
     }
     }
+}
+
+// MARK: - Collection View
+
+extension NCMedia: UICollectionViewDelegate {
     
     
-    func tapMoreGridItem(with fileID: String, sender: Any) {
+    func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
         
         
-        guard let metadata = NCManageDatabase.sharedInstance.getMetadata(predicate: NSPredicate(format: "fileID == %@", fileID)) else {
+        guard let metadata = NCMainCommon.sharedInstance.getMetadataFromSectionDataSourceIndexPath(indexPath, sectionDataSource: sectionDatasource) else {
             return
             return
         }
         }
+        metadataPush = metadata
         
         
-        if !isEditMode {
-            
-            var items = [ActionSheetItem]()
-            let appearanceDelete = ActionSheetItemAppearance.init()
-            appearanceDelete.textColor = UIColor.red
-            
-            // 0 == CCMore, 1 = first NCOffline ....
-            if (self == self.navigationController?.viewControllers[1]) {
-                items.append(ActionSheetItem(title: NSLocalizedString("_remove_available_offline_", comment: ""), value: 0, image: CCGraphics.changeThemingColorImage(UIImage.init(named: "offline"), multiplier: 2, color: NCBrandColor.sharedInstance.icon)))
+        if isEditMode {
+            if let index = selectFileID.index(of: metadata.fileID) {
+                selectFileID.remove(at: index)
+            } else {
+                selectFileID.append(metadata.fileID)
             }
             }
-            items.append(ActionSheetItem(title: NSLocalizedString("_share_", comment: ""), value: 1, image: CCGraphics.changeThemingColorImage(UIImage.init(named: "share"), multiplier: 2, color: NCBrandColor.sharedInstance.icon)))
+            collectionView.reloadItems(at: [indexPath])
+            return
+        }
+        
+        performSegue(withIdentifier: "segueDetail", sender: self)
+    }
+}
 
 
-            let itemDelete = ActionSheetItem(title: NSLocalizedString("_delete_", comment: ""), value: 2, image: CCGraphics.changeThemingColorImage(UIImage.init(named: "trash"), multiplier: 2, color: UIColor.red))
-            itemDelete.customAppearance = appearanceDelete
-            items.append(itemDelete)
-            items.append(ActionSheetCancelButton(title: NSLocalizedString("_cancel_", comment: "")))
+extension NCMedia: UICollectionViewDataSource {
+    
+    func collectionView(_ collectionView: UICollectionView, viewForSupplementaryElementOfKind kind: String, at indexPath: IndexPath) -> UICollectionReusableView {
+        
+        if kind == UICollectionView.elementKindSectionHeader {
             
             
-            actionSheet = ActionSheet(items: items) { sheet, item in
-                if item.value as? Int == 0 {
-                    if metadata.directory {
-                        NCManageDatabase.sharedInstance.setDirectory(serverUrl: CCUtility.stringAppendServerUrl(metadata.serverUrl, addFileName: metadata.fileName)!, offline: false, account: self.appDelegate.activeAccount)
-                    } else {
-                        NCManageDatabase.sharedInstance.setLocalFile(fileID: metadata.fileID, offline: false)
-                    }
-                    self.loadDatasource()
-                }
-                if item.value as? Int == 1 { self.appDelegate.activeMain.readShare(withAccount: self.appDelegate.activeAccount, openWindow: true, metadata: metadata) }
-                if item.value as? Int == 2 { self.deleteItem(with: metadata, sender: sender) }
-                if item is ActionSheetCancelButton { print("Cancel buttons has the value `true`") }
-            }
+            let header = collectionView.dequeueReusableSupplementaryView(ofKind: kind, withReuseIdentifier: "sectionHeader", for: indexPath) as! NCSectionMediaHeader
+            
+            header.setTitleLabel(sectionDatasource: sectionDatasource, section: indexPath.section)
+            header.labelSection.textColor = .white
+            header.labelHeightConstraint.constant = 20
+            header.labelSection.layer.cornerRadius = 10
+            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
+            header.labelLeadingConstraint.constant = leading
             
             
-            let headerView = NCActionSheetHeader.sharedInstance.actionSheetHeader(isDirectory: metadata.directory, iconName: metadata.iconName, fileID: metadata.fileID, fileNameView: metadata.fileNameView, text: metadata.fileNameView)
-            actionSheet?.headerView = headerView
-            actionSheet?.headerView?.frame.size.height = 50
+            return header
             
             
-            actionSheet?.present(in: self, from: sender as! UIButton)
         } else {
         } else {
             
             
-            let buttonPosition:CGPoint = (sender as! UIButton).convert(CGPoint.zero, to:collectionView)
-            let indexPath = collectionView.indexPathForItem(at: buttonPosition)
-            collectionView(self.collectionView, didSelectItemAt: indexPath!)
+            let footer = collectionView.dequeueReusableSupplementaryView(ofKind: kind, withReuseIdentifier: "sectionFooter", for: indexPath) as! NCSectionFooter
+            
+            footer.setTitleLabel(sectionDatasource: sectionDatasource)
+            
+            return footer
         }
         }
     }
     }
     
     
-    // MARK: DROP-DOWN-MENU
-
-    func dropdownMenu(_ dropdownMenu: DropdownMenu, didSelectRowAt indexPath: IndexPath) {
+    func numberOfSections(in collectionView: UICollectionView) -> Int {
+        let sections = sectionDatasource.sectionArrayRow.allKeys.count
+        return sections
+    }
+    
+    func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
         
         
-        if dropdownMenu.token == "tapOrderHeaderMenu" {
-            
-            switch indexPath.section {
-            
-                    case 0: switch indexPath.row {
-                        
-                    case 0: datasourceSorted = "fileName"; datasourceAscending = true
-                    case 1: datasourceSorted = "fileName"; datasourceAscending = false
-                        
-                    case 2: datasourceSorted = "date"; datasourceAscending = false
-                    case 3: datasourceSorted = "date"; datasourceAscending = true
-                        
-                    case 4: datasourceSorted = "size"; datasourceAscending = true
-                    case 5: datasourceSorted = "size"; datasourceAscending = false
-                
-                    default: ()
-                    }
-                
-            case 1: switch indexPath.row {
-                
-                    case 0:
-                        if datasourceGroupBy == "alphabetic" {
-                            datasourceGroupBy = "none"
-                        } else {
-                            datasourceGroupBy = "alphabetic"
-                        }
-                    case 1:
-                        if datasourceGroupBy == "typefile" {
-                            datasourceGroupBy = "none"
-                        } else {
-                            datasourceGroupBy = "typefile"
-                        }
-                    case 2:
-                        if datasourceGroupBy == "date" {
-                            datasourceGroupBy = "none"
-                        } else {
-                            datasourceGroupBy = "date"
-                        }
-                
-                    default: ()
-                        }
-                    case 2:
-                        if datasourceDirectoryOnTop {
-                            datasourceDirectoryOnTop = false
-                        } else {
-                            datasourceDirectoryOnTop = true
-                        }
-                    default: ()
-                    }
-            
-            NCUtility.sharedInstance.setLayoutForView(key: k_layout_view_offline, layout: typeLayout, sort: datasourceSorted, ascending: datasourceAscending, groupBy: datasourceGroupBy, directoryOnTop: datasourceDirectoryOnTop)
-
-            loadDatasource()
+        var numberOfItemsInSection: Int = 0
+        
+        if section < sectionDatasource.sections.count {
+            let key = sectionDatasource.sections.object(at: section)
+            let datasource = sectionDatasource.sectionArrayRow.object(forKey: key) as! [tableMetadata]
+            numberOfItemsInSection = datasource.count
         }
         }
         
         
-        if dropdownMenu.token == "tapMoreHeaderMenu" {
+        return numberOfItemsInSection
+    }
+    
+    func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
         
         
+        guard let metadata = NCMainCommon.sharedInstance.getMetadataFromSectionDataSourceIndexPath(indexPath, sectionDataSource: sectionDatasource) else {
+            return collectionView.dequeueReusableCell(withReuseIdentifier: "gridCell", for: indexPath) as! NCGridMediaCell
         }
         }
         
         
-        if dropdownMenu.token == "tapMoreHeaderMenuSelect" {
-            
-        }
+        let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "gridCell", for: indexPath) as! NCGridMediaCell
+        
+        NCMainCommon.sharedInstance.collectionViewCellForItemAt(indexPath, collectionView: collectionView, cell: cell, metadata: metadata, metadataFolder: nil, serverUrl: metadata.serverUrl, isEditMode: isEditMode, selectFileID: selectFileID, autoUploadFileName: autoUploadFileName, autoUploadDirectory: autoUploadDirectory, hideButtonMore: true, downloadThumbnail: false, source: self)
+        
+        return cell
     }
     }
+}
+
+extension NCMedia: UICollectionViewDelegateFlowLayout {
     
     
-    // MARK: NC API
+    func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, referenceSizeForHeaderInSection section: Int) -> CGSize {
+        return CGSize(width: collectionView.frame.width, height: sectionHeaderHeight)
+    }
     
     
-    func deleteItem(with metadata: tableMetadata, sender: Any) {
-        
-        var items = [ActionSheetItem]()
+    func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, referenceSizeForFooterInSection section: Int) -> CGSize {
+        let sections = sectionDatasource.sectionArrayRow.allKeys.count
+        if (section == sections - 1) {
+            return CGSize(width: collectionView.frame.width, height: footerHeight)
+        } else {
+            return CGSize(width: collectionView.frame.width, height: 0)
+        }
+    }
+}
+
+// MARK: NC API & Algorithm
+
+extension NCMedia {
+
+    public func reloadDataSource(loadNetworkDatasource: Bool) {
         
         
-        guard let tableDirectory = NCManageDatabase.sharedInstance.getTableDirectory(predicate: NSPredicate(format: "account == %@ AND serverUrl == serverUrl", appDelegate.activeAccount, metadata.serverUrl)) else {
+        if appDelegate.activeAccount.count == 0 {
             return
             return
         }
         }
         
         
-        items.append(ActionSheetDangerButton(title: NSLocalizedString("_delete_", comment: "")))
-        items.append(ActionSheetCancelButton(title: NSLocalizedString("_cancel_", comment: "")))
-        
-        actionSheet = ActionSheet(items: items) { sheet, item in
-            if item is ActionSheetDangerButton {
-                NCMainCommon.sharedInstance.deleteFile(metadatas: [metadata], e2ee: tableDirectory.e2eEncrypted, serverUrl: tableDirectory.serverUrl, folderFileID: tableDirectory.fileID) { (errorCode, message) in
-                    self.loadDatasource()
+        DispatchQueue.global().async {
+            
+            let metadatas = NCManageDatabase.sharedInstance.getTableMedias(predicate: NSPredicate(format: "account == %@", self.appDelegate.activeAccount))
+            self.sectionDatasource = CCSectionMetadata.creataDataSourseSectionMetadata(metadatas, listProgressMetadata: nil, groupByField: "date", filterFileID: nil, filterTypeFileImage: self.filterTypeFileImage, filterTypeFileVideo: self.filterTypeFileVideo, sorted: "date", ascending: false, activeAccount: self.appDelegate.activeAccount)
+            
+            DispatchQueue.main.async {
+                
+                if loadNetworkDatasource {
+                    self.loadNetworkDatasource()
+                }
+                
+                self.collectionView?.reloadDataThenPerform {
+                    self.downloadThumbnail()
                 }
                 }
             }
             }
-            if item is ActionSheetCancelButton { print("Cancel buttons has the value `true`") }
         }
         }
-        
-        let headerView = NCActionSheetHeader.sharedInstance.actionSheetHeader(isDirectory: metadata.directory, iconName: metadata.iconName, fileID: metadata.fileID, fileNameView: metadata.fileNameView, text: metadata.fileNameView)
-        actionSheet?.headerView = headerView
-        actionSheet?.headerView?.frame.size.height = 50
-        
-        actionSheet?.present(in: self, from: sender as! UIButton)
     }
     }
     
     
-    // MARK: DATASOURCE
-    @objc func loadDatasource() {
+    func deleteItems() {
         
         
-        var fileIDs = [String]()
-        sectionDatasource = CCSectionDataSourceMetadata()
-
-        if serverUrl == "" {
+        if appDelegate.activeAccount.count == 0 {
+            return
+        }
         
         
-            if let directories = NCManageDatabase.sharedInstance.getTablesDirectory(predicate: NSPredicate(format: "account == %@ AND offline == true", appDelegate.activeAccount), sorted: "serverUrl", ascending: true) {
-                for directory: tableDirectory in directories {
-                    fileIDs.append(directory.fileID)
-                }
-            }
-          
-            if let files = NCManageDatabase.sharedInstance.getTableLocalFiles(predicate: NSPredicate(format: "account == %@ AND offline == true", appDelegate.activeAccount), sorted: "fileName", ascending: true) {
-                for file: tableLocalFile in files {
-                    fileIDs.append(file.fileID)
-                }
-            }
-            
-            if let metadatas = NCManageDatabase.sharedInstance.getMetadatas(predicate: NSPredicate(format: "account == %@ AND fileID IN %@", appDelegate.activeAccount, fileIDs), sorted: datasourceSorted, ascending: datasourceAscending)  {
-
-                sectionDatasource = CCSectionMetadata.creataDataSourseSectionMetadata(metadatas, listProgressMetadata: nil, groupByField: datasourceGroupBy, filterFileID: nil, filterTypeFileImage: false, filterTypeFileVideo: false, activeAccount: appDelegate.activeAccount)
+        var metadatas = [tableMetadata]()
+        
+        for fileID in selectFileID {
+            if let metadata = NCManageDatabase.sharedInstance.getTableMedia(predicate: NSPredicate(format: "fileID == %@", fileID)) {
+                metadatas.append(metadata)
             }
             }
-            
-        } else {
+        }
         
         
-            if let metadatas = NCManageDatabase.sharedInstance.getMetadatas(predicate: NSPredicate(format: "account == %@ AND serverUrl == %@", appDelegate.activeAccount, serverUrl), sorted: datasourceSorted, ascending: datasourceAscending)  {
+        if metadatas.count > 0 {
+            NCMainCommon.sharedInstance.deleteFile(metadatas: metadatas as NSArray, e2ee: false, serverUrl: "", folderFileID: "") { (errorCode, message) in
+                
+                self.isEditMode = false
+                self.selectFileID.removeAll()
                 
                 
-                sectionDatasource = CCSectionMetadata.creataDataSourseSectionMetadata(metadatas, listProgressMetadata: nil, groupByField: datasourceGroupBy, filterFileID: nil, filterTypeFileImage: false, filterTypeFileVideo: false, activeAccount: appDelegate.activeAccount)
+                self.selectSearchSections()
             }
             }
         }
         }
-        
-        self.refreshControl.endRefreshing()
-        
-        collectionView.reloadData()
     }
     }
     
     
-    // MARK: COLLECTIONVIEW METHODS
-    
-    func collectionView(_ collectionView: UICollectionView, viewForSupplementaryElementOfKind kind: String, at indexPath: IndexPath) -> UICollectionReusableView {
+    func search(lteDate: Date, gteDate: Date, addPast: Bool, setDistantPast: Bool) {
+        
+        // ----- DEBUG -----
+#if DEBUG
+        let dateFormatter = DateFormatter()
+        dateFormatter.dateFormat = "dd-MM-yyyy HH:mm"
+        print("[LOG] Search: addPast \(addPast), distantPass: \(setDistantPast), Lte: " + dateFormatter.string(from: lteDate) + " - Gte: " + dateFormatter.string(from: gteDate))
+#endif
+        // -----------------
+        
+        if appDelegate.activeAccount.count == 0 {
+            return
+        }
         
         
-        if (indexPath.section == 0) {
+        if addPast && loadingSearch {
+            return
+        }
+        
+        if setDistantPast {
+            isDistantPast = true
+        }
+        
+        if addPast {
+            //CCGraphics.addImage(toTitle: NSLocalizedString("_media_", comment: ""), colorTitle: NCBrandColor.sharedInstance.brandText, imageTitle: CCGraphics.changeThemingColorImage(UIImage.init(named: "load"), multiplier: 2, color: NCBrandColor.sharedInstance.brandText), imageRight: false, navigationItem: self.navigationItem)
+            NCUtility.sharedInstance.startActivityIndicator(view: self.view, bottom: 50)
+        }
+        loadingSearch = true
+        
+        let startDirectory = NCManageDatabase.sharedInstance.getAccountStartDirectoryMediaTabView(CCUtility.getHomeServerUrlActiveUrl(appDelegate.activeUrl))
+        
+        OCNetworking.sharedManager()?.search(withAccount: appDelegate.activeAccount, fileName: "", serverUrl: startDirectory, contentType: ["image/%", "video/%"], lteDateLastModified: lteDate, gteDateLastModified: gteDate, depth: "infinity", completion: { (account, metadatas, message, errorCode) in
             
             
-            if kind == UICollectionView.elementKindSectionHeader {
-                
-                let header = collectionView.dequeueReusableSupplementaryView(ofKind: kind, withReuseIdentifier: "sectionHeaderMenu", for: indexPath) as! NCSectionHeaderMenu
-                
-                if collectionView.collectionViewLayout == gridLayout {
-                    header.buttonSwitch.setImage(CCGraphics.changeThemingColorImage(UIImage.init(named: "switchList"), multiplier: 2, color: NCBrandColor.sharedInstance.icon), for: .normal)
-                } else {
-                    header.buttonSwitch.setImage(CCGraphics.changeThemingColorImage(UIImage.init(named: "switchGrid"), multiplier: 2, color: NCBrandColor.sharedInstance.icon), for: .normal)
-                }
+            self.refreshControl.endRefreshing()
+            NCUtility.sharedInstance.stopActivityIndicator()
+            //self.navigationItem.titleView = nil
+            //self.navigationItem.title = NSLocalizedString("_media_", comment: "")
+            
+            if errorCode == 0 && account == self.appDelegate.activeAccount {
                 
                 
-                header.delegate = self
+                var differenceSizeInsert: Int64 = 0
+                var differenceNumInsert: Int64 = 0
                 
                 
-                header.setStatusButton(count: sectionDatasource.allFileID.count)
-                header.setTitleOrder(datasourceSorted: datasourceSorted, datasourceAscending: datasourceAscending)
+                let totalDistance = Calendar.current.dateComponents([Calendar.Component.day], from: gteDate, to: lteDate).value(for: .day) ?? 0
                 
                 
-                if datasourceGroupBy == "none" {
-                    header.labelSection.isHidden = true
-                    header.labelSectionHeightConstraint.constant = 0
-                } else {
-                    header.labelSection.isHidden = false
-                    header.setTitleLabel(sectionDatasource: sectionDatasource, section: indexPath.section)
-                    header.labelSectionHeightConstraint.constant = sectionHeaderHeight
-                }
-         
-                return header
-            
-            } else {
+                let difference = NCManageDatabase.sharedInstance.createTableMedia(metadatas as! [tableMetadata], lteDate: lteDate, gteDate: gteDate, account: account!)
+                differenceSizeInsert = difference.differenceSizeInsert
+                differenceNumInsert = difference.differenceNumInsert
                 
                 
-                let footer = collectionView.dequeueReusableSupplementaryView(ofKind: kind, withReuseIdentifier: "sectionFooter", for: indexPath) as! NCSectionFooter
+                self.loadingSearch = false
                 
                 
-                footer.setTitleLabel(sectionDatasource: sectionDatasource)
+                print("[LOG] Totale Distance \(totalDistance) - Different Size \(differenceSizeInsert) - Different Num \(differenceNumInsert)")
                 
                 
-                return footer
-            }
-            
-        } else {
-        
-            if kind == UICollectionView.elementKindSectionHeader {
-                
-                let header = collectionView.dequeueReusableSupplementaryView(ofKind: kind, withReuseIdentifier: "sectionHeader", for: indexPath) as! NCSectionHeader
+                if differenceSizeInsert != 0 {
+                    self.reloadDataSource(loadNetworkDatasource: false)
+                }
                 
                 
-                header.setTitleLabel(sectionDatasource: sectionDatasource, section: indexPath.section)
+                if (differenceSizeInsert == 0 || differenceNumInsert < 100) && addPast && setDistantPast == false {
+                    
+                    switch totalDistance {
+                    case 0...89:
+                        if var gteDate90 = Calendar.current.date(byAdding: .day, value: -90, to: gteDate) {
+                            gteDate90 = Calendar.current.date(bySettingHour: 0, minute: 0, second: 0, of: gteDate90) ?? Date()
+                            self.search(lteDate: lteDate, gteDate: gteDate90, addPast: addPast, setDistantPast: false)
+                            print("[LOG] Media search 90 gg")
+                        }
+                    case 90...179:
+                        if var gteDate180 = Calendar.current.date(byAdding: .day, value: -180, to: gteDate) {
+                            gteDate180 = Calendar.current.date(bySettingHour: 0, minute: 0, second: 0, of: gteDate180) ?? Date()
+                            self.search(lteDate: lteDate, gteDate: gteDate180, addPast: addPast, setDistantPast: false)
+                            print("[LOG] Media search 180 gg")
+                        }
+                    case 180...364:
+                        if var gteDate365 = Calendar.current.date(byAdding: .day, value: -365, to: gteDate) {
+                            gteDate365 = Calendar.current.date(bySettingHour: 0, minute: 0, second: 0, of: gteDate365) ?? Date()
+                            self.search(lteDate: lteDate, gteDate: gteDate365, addPast: addPast, setDistantPast: false)
+                            print("[LOG] Media search 365 gg")
+                        }
+                    default:
+                        self.search(lteDate: lteDate, gteDate: NSDate.distantPast, addPast: addPast, setDistantPast: true)
+                        print("[LOG] Media search distant pass")
+                    }
+                }
                 
                 
-                return header
+                self.collectionView?.reloadDataThenPerform {
+                    self.downloadThumbnail()
+                }
                 
                 
-            } else {
+            }  else {
                 
                 
-                let footer = collectionView.dequeueReusableSupplementaryView(ofKind: kind, withReuseIdentifier: "sectionFooter", for: indexPath) as! NCSectionFooter
+                self.loadingSearch = false
                 
                 
-                footer.setTitleLabel(sectionDatasource: sectionDatasource)
-
-                return footer
+                self.reloadDataSource(loadNetworkDatasource: false)
             }
             }
-        }
+        })
     }
     }
     
     
-    func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, referenceSizeForHeaderInSection section: Int) -> CGSize {
-        if section == 0 {
-            if datasourceGroupBy == "none" {
-                return CGSize(width: collectionView.frame.width, height: headerMenuHeight)
-            } else {
-                return CGSize(width: collectionView.frame.width, height: headerMenuHeight + sectionHeaderHeight)
-            }
-        } else {
-            return CGSize(width: collectionView.frame.width, height: sectionHeaderHeight)
+    @objc private func loadNetworkDatasource() {
+        
+        isDistantPast = false
+        
+        if appDelegate.activeAccount.count == 0 {
+            return
         }
         }
-    }
-    
-    func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, referenceSizeForFooterInSection section: Int) -> CGSize {
-        let sections = sectionDatasource.sectionArrayRow.allKeys.count
-        if (section == sections - 1) {
-            return CGSize(width: collectionView.frame.width, height: footerHeight)
+        
+        if sectionDatasource.allRecordsDataSource.count == 0 {
+            
+            let gteDate = Calendar.current.date(byAdding: .day, value: -30, to: Date())
+            search(lteDate: Date(), gteDate: gteDate!, addPast: true, setDistantPast: false)
+            
         } else {
         } else {
-            return CGSize(width: collectionView.frame.width, height: 0)
+            
+            let gteDate = NCManageDatabase.sharedInstance.getTableMediaDate(account: self.appDelegate.activeAccount, order: .orderedAscending)
+            search(lteDate: Date(), gteDate: gteDate, addPast: false, setDistantPast: false)
         }
         }
-    }
-    
-    func numberOfSections(in collectionView: UICollectionView) -> Int {
-        let sections = sectionDatasource.sectionArrayRow.allKeys.count
-        return sections
-    }
-    
-    func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
-        let key = sectionDatasource.sections.object(at: section)
-        let datasource = sectionDatasource.sectionArrayRow.object(forKey: key) as! [tableMetadata]
-        return datasource.count
-    }
-    
-    func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
         
         
-        guard let metadata = NCMainCommon.sharedInstance.getMetadataFromSectionDataSourceIndexPath(indexPath, sectionDataSource: sectionDatasource) else {
-            return collectionView.dequeueReusableCell(withReuseIdentifier: "listCell", for: indexPath) as! NCListCell
+        collectionView?.reloadDataThenPerform {
+            self.downloadThumbnail()
         }
         }
-        
-        let cell = NCMainCommon.sharedInstance.collectionViewCellForItemAt(indexPath, collectionView: collectionView, typeLayout: typeLayout, metadata: metadata, metadataFolder: nil, serverUrl: metadata.serverUrl, isEditMode: isEditMode, selectFileID: selectFileID, autoUploadFileName: autoUploadFileName, autoUploadDirectory: autoUploadDirectory, hideButtonMore: false, source: self)
-        
-        return cell
     }
     }
     
     
-    func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
+    private func selectSearchSections() {
         
         
-        guard let metadata = NCMainCommon.sharedInstance.getMetadataFromSectionDataSourceIndexPath(indexPath, sectionDataSource: sectionDatasource) else {
+        if appDelegate.activeAccount.count == 0 {
             return
             return
         }
         }
-        metadataPush = metadata
         
         
-        if isEditMode {
-            if let index = selectFileID.index(of: metadata.fileID) {
-                selectFileID.remove(at: index)
-            } else {
-                selectFileID.append(metadata.fileID)
+        let sections = NSMutableSet()
+        let lastDate = NCManageDatabase.sharedInstance.getTableMediaDate(account: self.appDelegate.activeAccount, order: .orderedDescending)
+        var gteDate: Date?
+        
+        for item in collectionView.indexPathsForVisibleItems {
+            if let metadata = NCMainCommon.sharedInstance.getMetadataFromSectionDataSourceIndexPath(item, sectionDataSource: sectionDatasource) {
+                if let date = Calendar.current.date(bySettingHour: 0, minute: 0, second: 0, of: metadata.date as Date) {
+                    sections.add(date)
+                }
             }
             }
-            collectionView.reloadItems(at: [indexPath])
-            return
+        }
+        let sortedSections = sections.sorted { (date1, date2) -> Bool in
+            (date1 as! Date).compare(date2 as! Date) == .orderedDescending
         }
         }
         
         
-        performSegue(withIdentifier: "segueDetail", sender: self)
+        if sortedSections.count >= 1 {
+            let lteDate = Calendar.current.date(byAdding: .day, value: 1, to: sortedSections.first as! Date)!
+            if lastDate == sortedSections.last as! Date {
+                gteDate = Calendar.current.date(byAdding: .day, value: -30, to: sortedSections.last as! Date)!
+                search(lteDate: lteDate, gteDate: gteDate!, addPast: true, setDistantPast: false)
+            } else {
+                gteDate = Calendar.current.date(byAdding: .day, value: -1, to: sortedSections.last as! Date)!
+                search(lteDate: lteDate, gteDate: gteDate!, addPast: false, setDistantPast: false)
+            }
+        }
     }
     }
     
     
-    // MARK: SEGUE
-    
-    override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
-        
-        let photoDataSource: NSMutableArray = []
-        
-        for fileID: String in sectionDatasource.allFileID as! [String] {
-            let metadata = sectionDatasource.allRecordsDataSource.object(forKey: fileID) as! tableMetadata
-            if metadata.typeFile == k_metadataTypeFile_image {
-                photoDataSource.add(metadata)
+    private func downloadThumbnail() {
+        DispatchQueue.main.asyncAfter(deadline: .now() + 0.1) {
+            for item in self.collectionView.indexPathsForVisibleItems {
+                if let metadata = NCMainCommon.sharedInstance.getMetadataFromSectionDataSourceIndexPath(item, sectionDataSource: self.sectionDatasource) {
+                    NCNetworkingMain.sharedInstance.downloadThumbnail(with: metadata, view: self.collectionView, indexPath: item)
+                }
             }
             }
         }
         }
-        
-        if let segueNavigationController = segue.destination as? UINavigationController {
-            if let segueViewController = segueNavigationController.topViewController as? CCDetail {
-            
-                segueViewController.metadataDetail = metadataPush
-                segueViewController.dateFilterQuery = nil
-                segueViewController.photoDataSource = photoDataSource
-                segueViewController.title = metadataPush!.fileNameView
-            }
+    }
+}
+
+// MARK: FastScroll - 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)
+    }
+}
+
+extension NCMedia: FastScrollCollectionViewDelegate {
+    
+    fileprivate func configFastScroll() {
+        
+        collectionView.fastScrollDelegate = self
+        collectionView.handleTimeToDisappear = 1
+        
+        //bubble
+        collectionView.deactivateBubble = true
+        collectionView.bubbleFocus = .dynamic
+        collectionView.bubbleTextSize = 14.0
+        collectionView.bubbleMarginRight = 50.0
+        collectionView.bubbleColor = UIColor(red: 38.0 / 255.0, green: 48.0 / 255.0, blue: 60.0 / 255.0, alpha: 1.0)
+        
+        //handle
+        /*
+        collectionView.handleHeight = 40.0
+        collectionView.handleWidth = 40.0
+        collectionView.handleRadius = 20.0
+        collectionView.handleMarginRight = -20
+        */
+        collectionView.handleColor = NCBrandColor.sharedInstance.brand
+        
+        //scrollbar
+        collectionView.scrollbarWidth = 0.0
+        collectionView.scrollbarMarginTop = 45.0
+        collectionView.scrollbarMarginBottom = 5.0
+        collectionView.scrollbarMarginRight = 10.0
+        
+        //callback action to display bubble name
+        /*
+        collectionView.bubbleNameForIndexPath = { indexPath in
+            let visibleSection: Section = self.data[indexPath.section]
+            return visibleSection.sectionTitle
         }
         }
+        */
+    }
+    
+    func hideHandle() {
+        selectSearchSections()
     }
     }
 }
 }
+
+extension FastScrollCollectionView
+{
+    /// Calls reloadsData() on self, and ensures that the given closure is
+    /// called after reloadData() has been completed.
+    ///
+    /// Discussion: reloadData() appears to be asynchronous. i.e. the
+    /// reloading actually happens during the next layout pass. So, doing
+    /// things like scrolling the collectionView immediately after a
+    /// call to reloadData() can cause trouble.
+    ///
+    /// This method uses CATransaction to schedule the closure.
+    
+    func reloadDataThenPerform(_ closure: @escaping (() -> Void))
+    {
+        CATransaction.begin()
+        CATransaction.setCompletionBlock(closure)
+        self.reloadData()
+        CATransaction.commit()
+    }
+}
+

+ 1 - 12
iOSClient/Networking/CCNetworking.m

@@ -1101,18 +1101,7 @@
                 [CCUtility moveFileAtPath:[NSString stringWithFormat:@"%@/%@", [CCUtility getDirectoryProviderStorage], tempFileID] toPath:[NSString stringWithFormat:@"%@/%@", [CCUtility getDirectoryProviderStorage], metadata.fileID]];
                 [CCUtility moveFileAtPath:[NSString stringWithFormat:@"%@/%@", [CCUtility getDirectoryProviderStorage], tempFileID] toPath:[NSString stringWithFormat:@"%@/%@", [CCUtility getDirectoryProviderStorage], metadata.fileID]];
             }
             }
         }
         }
-         
-#ifndef EXTENSION
-        AppDelegate *appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
-        [appDelegate.listProgressMetadata removeObjectForKey:metadata.fileID];
-        
-        // Hardcoded for add new photo/video for tab Media view
-        NSString *startDirectoryMediaTabView = [[NCManageDatabase sharedInstance] getAccountStartDirectoryMediaTabView:[CCUtility getHomeServerUrlActiveUrl:appDelegate.activeUrl]];
-        if ([serverUrl containsString:startDirectoryMediaTabView] && ([metadata.typeFile isEqualToString:k_metadataTypeFile_image] || [metadata.typeFile isEqualToString:k_metadataTypeFile_video])) {
-            [appDelegate.activeMedia.addMetadatasFromUpload addObject:metadata];
-        }
-#endif
-        
+                 
         // Add Local
         // Add Local
         [[NCManageDatabase sharedInstance] addLocalFileWithMetadata:metadata];
         [[NCManageDatabase sharedInstance] addLocalFileWithMetadata:metadata];
         
         

+ 1 - 1
iOSClient/Networking/NCService.swift

@@ -245,7 +245,7 @@ class NCService: NSObject {
                 
                 
                 // Call func thath required the userdID
                 // Call func thath required the userdID
                 self.appDelegate.activeFavorites.listingFavorites()
                 self.appDelegate.activeFavorites.listingFavorites()
-                self.appDelegate.activeMedia.searchPhotoVideo()
+                self.appDelegate.activeMedia.reloadDataSource(loadNetworkDatasource: true)
                 NCFunctionMain.sharedInstance.synchronizeOffline()
                 NCFunctionMain.sharedInstance.synchronizeOffline()
                 
                 
                 DispatchQueue.global(qos: .default).async {
                 DispatchQueue.global(qos: .default).async {

+ 1 - 1
iOSClient/Networking/OCNetworking.h

@@ -53,7 +53,7 @@
 - (void)createFolderWithAccount:(NSString *)account serverUrl:(NSString *)serverUrl fileName:(NSString *)fileName completion:(void(^)(NSString *account, NSString *fileID, NSDate *date, NSString *message, NSInteger errorCode))completion;
 - (void)createFolderWithAccount:(NSString *)account serverUrl:(NSString *)serverUrl fileName:(NSString *)fileName completion:(void(^)(NSString *account, NSString *fileID, NSDate *date, NSString *message, NSInteger errorCode))completion;
 - (void)deleteFileOrFolderWithAccount:(NSString *)account path:(NSString *)path completion:(void (^)(NSString *account, NSString *message, NSInteger errorCode))completion;
 - (void)deleteFileOrFolderWithAccount:(NSString *)account path:(NSString *)path completion:(void (^)(NSString *account, NSString *message, NSInteger errorCode))completion;
 - (void)moveFileOrFolderWithAccount:(NSString *)account fileName:(NSString *)fileName fileNameTo:(NSString *)fileNameTo completion:(void (^)(NSString *account, NSString *message, NSInteger errorCode))completion;
 - (void)moveFileOrFolderWithAccount:(NSString *)account fileName:(NSString *)fileName fileNameTo:(NSString *)fileNameTo completion:(void (^)(NSString *account, NSString *message, NSInteger errorCode))completion;
-- (void)searchWithAccount:(NSString *)account fileName:(NSString *)fileName serverUrl:(NSString *)serverUrl contentType:(NSArray *)contentType date:(NSDate *)date depth:(NSString *)depth completion:(void(^)(NSString *account, NSArray *metadatas, NSString *message, NSInteger errorCode))completion;
+- (void)searchWithAccount:(NSString *)account fileName:(NSString *)fileName serverUrl:(NSString *)serverUrl contentType:(NSArray *)contentType lteDateLastModified:(NSDate *)lteDateLastModified gteDateLastModified:(NSDate *)gteDateLastModified depth:(NSString *)depth completion:(void(^)(NSString *account, NSArray *metadatas, NSString *message, NSInteger errorCode))completion;
 
 
 #pragma mark ===== downloadPreview =====
 #pragma mark ===== downloadPreview =====
 
 

+ 159 - 197
iOSClient/Networking/OCNetworking.m

@@ -417,18 +417,21 @@
 #pragma mark ===== WebDav =====
 #pragma mark ===== WebDav =====
 #pragma --------------------------------------------------------------------------------------------
 #pragma --------------------------------------------------------------------------------------------
 
 
-- (void)readFolderWithAccount:(NSString *)account serverUrl:(NSString *)serverUrl depth:(NSString *)depth completion:(void(^)(NSString *account, NSArray *metadatas, tableMetadata *metadataFolder, NSString *message, NSInteger errorCode))completion
+- (void)readFolderWithAccount:(NSString *)account serverUrl:(NSString *)serverUrl  depth:(NSString *)depth completion:(void(^)(NSString *account, NSArray *metadatas, tableMetadata *metadataFolder, NSString *message, NSInteger errorCode))completion
 {
 {
     tableAccount *tableAccount = [[NCManageDatabase sharedInstance] getAccountWithPredicate:[NSPredicate predicateWithFormat:@"account == %@", account]];
     tableAccount *tableAccount = [[NCManageDatabase sharedInstance] getAccountWithPredicate:[NSPredicate predicateWithFormat:@"account == %@", account]];
     if (tableAccount == nil) {
     if (tableAccount == nil) {
         completion(account, nil, nil, NSLocalizedString(@"_error_user_not_available_", nil), k_CCErrorUserNotAvailble);
         completion(account, nil, nil, NSLocalizedString(@"_error_user_not_available_", nil), k_CCErrorUserNotAvailble);
     }
     }
     
     
+    NSString *url = tableAccount.url;
+    NSString *autoUploadFileName = [[NCManageDatabase sharedInstance] getAccountAutoUploadFileName];
+    NSString *autoUploadDirectory = [[NCManageDatabase sharedInstance] getAccountAutoUploadDirectory:url];
+    
     OCCommunication *communication = [OCNetworking sharedManager].sharedOCCommunication;
     OCCommunication *communication = [OCNetworking sharedManager].sharedOCCommunication;
 
 
     [communication setCredentialsWithUser:tableAccount.user andUserID:tableAccount.userID andPassword:tableAccount.password];
     [communication setCredentialsWithUser:tableAccount.user andUserID:tableAccount.userID andPassword:tableAccount.password];
     [communication setUserAgent:[CCUtility getUserAgent]];
     [communication setUserAgent:[CCUtility getUserAgent]];
-    
     [communication readFolder:serverUrl depth:depth withUserSessionToken:nil onCommunication:communication successRequest:^(NSHTTPURLResponse *response, NSArray *items, NSString *redirectedServer, NSString *token) {
     [communication readFolder:serverUrl depth:depth withUserSessionToken:nil onCommunication:communication successRequest:^(NSHTTPURLResponse *response, NSArray *items, NSString *redirectedServer, NSString *token) {
         
         
         // Check items > 0
         // Check items > 0
@@ -443,70 +446,62 @@
 
 
         } else {
         } else {
                 
                 
-            dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0), ^{
+            BOOL showHiddenFiles = [CCUtility getShowHiddenFiles];
+            BOOL isFolderEncrypted = [CCUtility isFolderEncrypted:serverUrl account:account];
+            
+            // directory [0]
+            OCFileDto *itemDtoFolder = [items objectAtIndex:0];
+            //NSDate *date = [NSDate dateWithTimeIntervalSince1970:itemDtoDirectory.date];
+            
+            NSMutableArray *metadatas = [NSMutableArray new];
+            tableMetadata *metadataFolder = [tableMetadata new];
+            
+            NSString *serverUrlFolder;
+
+            // Metadata . (self Folder)
+            if ([serverUrl isEqualToString:[CCUtility getHomeServerUrlActiveUrl:url]]) {
                 
                 
-                BOOL showHiddenFiles = [CCUtility getShowHiddenFiles];
-                BOOL isFolderEncrypted = [CCUtility isFolderEncrypted:serverUrl account:account];
-                    
-                // directory [0]
-                OCFileDto *itemDtoFolder = [items objectAtIndex:0];
-                //NSDate *date = [NSDate dateWithTimeIntervalSince1970:itemDtoDirectory.date];
-                    
-                NSMutableArray *metadatas = [NSMutableArray new];
-                tableMetadata *metadataFolder = [tableMetadata new];
-                    
-                NSString *autoUploadFileName = [[NCManageDatabase sharedInstance] getAccountAutoUploadFileName];
-                NSString *autoUploadDirectory = [[NCManageDatabase sharedInstance] getAccountAutoUploadDirectory:tableAccount.url];
-                    
-                NSString *serverUrlFolder;
+                // root folder
+                serverUrlFolder = k_serverUrl_root;
+                metadataFolder = [CCUtility trasformedOCFileToCCMetadata:itemDtoFolder fileName:@"." serverUrl:serverUrlFolder autoUploadFileName:autoUploadFileName autoUploadDirectory:autoUploadDirectory activeAccount:account isFolderEncrypted:isFolderEncrypted];
+                
+            } else {
+                
+                serverUrlFolder = [CCUtility deletingLastPathComponentFromServerUrl:serverUrl];
+                metadataFolder = [CCUtility trasformedOCFileToCCMetadata:itemDtoFolder fileName:[serverUrl lastPathComponent] serverUrl:serverUrlFolder autoUploadFileName:autoUploadFileName autoUploadDirectory:autoUploadDirectory activeAccount:account isFolderEncrypted:isFolderEncrypted];
+            }
+            
+            // Add metadata folder
+            (void)[[NCManageDatabase sharedInstance] addDirectoryWithEncrypted:itemDtoFolder.isEncrypted favorite:itemDtoFolder.isFavorite fileID:itemDtoFolder.ocId permissions:itemDtoFolder.permissions serverUrl:serverUrl account:account];
 
 
-                // Metadata . (self Folder)
-                if ([serverUrl isEqualToString:[CCUtility getHomeServerUrlActiveUrl:tableAccount.url]]) {
-                        
-                    // root folder
-                    serverUrlFolder = k_serverUrl_root;
-                    metadataFolder = [CCUtility trasformedOCFileToCCMetadata:itemDtoFolder fileName:@"." serverUrl:serverUrlFolder autoUploadFileName:autoUploadFileName autoUploadDirectory:autoUploadDirectory activeAccount:account isFolderEncrypted:isFolderEncrypted];
-                        
+            NSArray *itemsSortedArray = [items sortedArrayUsingComparator:^NSComparisonResult(id a, id b) {
+                
+                NSString *first = [(OCFileDto*)a fileName];
+                NSString *second = [(OCFileDto*)b fileName];
+                return [[first lowercaseString] compare:[second lowercaseString]];
+            }];
+            
+            for (NSUInteger i=1; i < [itemsSortedArray count]; i++) {
+                
+                OCFileDto *itemDto = [itemsSortedArray objectAtIndex:i];
+                NSString *fileName = [itemDto.fileName stringByReplacingOccurrencesOfString:@"/" withString:@""];
+                
+                // Skip hidden files
+                if (fileName.length > 0) {
+                    if (!showHiddenFiles && [[fileName substringToIndex:1] isEqualToString:@"."])
+                        continue;
                 } else {
                 } else {
-                        
-                    serverUrlFolder = [CCUtility deletingLastPathComponentFromServerUrl:serverUrl];
-                    metadataFolder = [CCUtility trasformedOCFileToCCMetadata:itemDtoFolder fileName:[serverUrl lastPathComponent] serverUrl:serverUrlFolder autoUploadFileName:autoUploadFileName autoUploadDirectory:autoUploadDirectory activeAccount:account isFolderEncrypted:isFolderEncrypted];
+                    continue;
                 }
                 }
-                    
-                // Add metadata folder
-                (void)[[NCManageDatabase sharedInstance] addDirectoryWithEncrypted:itemDtoFolder.isEncrypted favorite:itemDtoFolder.isFavorite fileID:itemDtoFolder.ocId permissions:itemDtoFolder.permissions serverUrl:serverUrl account:account];
-
-                NSArray *itemsSortedArray = [items sortedArrayUsingComparator:^NSComparisonResult(id a, id b) {
-                        
-                    NSString *first = [(OCFileDto*)a fileName];
-                    NSString *second = [(OCFileDto*)b fileName];
-                    return [[first lowercaseString] compare:[second lowercaseString]];
-                }];
-                    
-                for (NSUInteger i=1; i < [itemsSortedArray count]; i++) {
-                        
-                    OCFileDto *itemDto = [itemsSortedArray objectAtIndex:i];
-                    NSString *fileName = [itemDto.fileName stringByReplacingOccurrencesOfString:@"/" withString:@""];
-                        
-                    // Skip hidden files
-                    if (fileName.length > 0) {
-                        if (!showHiddenFiles && [[fileName substringToIndex:1] isEqualToString:@"."])
-                            continue;
-                    } else {
-                        continue;
-                    }
-                        
-                    if (itemDto.isDirectory) {
-                        (void)[[NCManageDatabase sharedInstance] addDirectoryWithEncrypted:itemDto.isEncrypted favorite:itemDto.isFavorite fileID:itemDto.ocId permissions:itemDto.permissions serverUrl:[CCUtility stringAppendServerUrl:serverUrl addFileName:fileName] account:account];
-                    }
-                        
-                    [metadatas addObject:[CCUtility trasformedOCFileToCCMetadata:itemDto fileName:itemDto.fileName serverUrl:serverUrl autoUploadFileName:autoUploadFileName autoUploadDirectory:autoUploadDirectory activeAccount:account isFolderEncrypted:isFolderEncrypted]];
+                
+                if (itemDto.isDirectory) {
+                    (void)[[NCManageDatabase sharedInstance] addDirectoryWithEncrypted:itemDto.isEncrypted favorite:itemDto.isFavorite fileID:itemDto.ocId permissions:itemDto.permissions serverUrl:[CCUtility stringAppendServerUrl:serverUrl addFileName:fileName] account:account];
                 }
                 }
-                    
-                dispatch_async(dispatch_get_main_queue(), ^{
-                    completion(account, metadatas, metadataFolder, nil, 0);
-                });
-            });
+                
+                [metadatas addObject:[CCUtility trasformedOCFileToCCMetadata:itemDto fileName:itemDto.fileName serverUrl:serverUrl autoUploadFileName:autoUploadFileName autoUploadDirectory:autoUploadDirectory activeAccount:account isFolderEncrypted:isFolderEncrypted]];
+            }
+            
+            completion(account, metadatas, metadataFolder, nil, 0);
         }
         }
     
     
     } failureRequest:^(NSHTTPURLResponse *response, NSError *error, NSString *token, NSString *redirectedServer) {
     } failureRequest:^(NSHTTPURLResponse *response, NSError *error, NSString *token, NSString *redirectedServer) {
@@ -534,8 +529,8 @@
         completion(account, nil, NSLocalizedString(@"_error_user_not_available_", nil), k_CCErrorUserNotAvailble);
         completion(account, nil, NSLocalizedString(@"_error_user_not_available_", nil), k_CCErrorUserNotAvailble);
     }
     }
     
     
-    OCCommunication *communication = [OCNetworking sharedManager].sharedOCCommunication;
-    
+    NSString *autoUploadFileName = [[NCManageDatabase sharedInstance] getAccountAutoUploadFileName];
+    NSString *autoUploadDirectory = [[NCManageDatabase sharedInstance] getAccountAutoUploadDirectory:tableAccount.url];
     NSString *fileNamePath;
     NSString *fileNamePath;
 
 
     if (fileName) {
     if (fileName) {
@@ -545,9 +540,10 @@
         fileNamePath = serverUrl;
         fileNamePath = serverUrl;
     }
     }
     
     
+    OCCommunication *communication = [OCNetworking sharedManager].sharedOCCommunication;
+
     [communication setCredentialsWithUser:tableAccount.user andUserID:tableAccount.userID andPassword:tableAccount.password];
     [communication setCredentialsWithUser:tableAccount.user andUserID:tableAccount.userID andPassword:tableAccount.password];
     [communication setUserAgent:[CCUtility getUserAgent]];
     [communication setUserAgent:[CCUtility getUserAgent]];
-    
     [communication readFile:fileNamePath onCommunication:communication successRequest:^(NSHTTPURLResponse *response, NSArray *items, NSString *redirectedServer) {
     [communication readFile:fileNamePath onCommunication:communication successRequest:^(NSHTTPURLResponse *response, NSArray *items, NSString *redirectedServer) {
         
         
         BOOL isFolderEncrypted = [CCUtility isFolderEncrypted:serverUrl account:account];
         BOOL isFolderEncrypted = [CCUtility isFolderEncrypted:serverUrl account:account];
@@ -557,10 +553,7 @@
             tableMetadata *metadata = [tableMetadata new];
             tableMetadata *metadata = [tableMetadata new];
                 
                 
             OCFileDto *itemDto = [items objectAtIndex:0];
             OCFileDto *itemDto = [items objectAtIndex:0];
-                
-            NSString *autoUploadFileName = [[NCManageDatabase sharedInstance] getAccountAutoUploadFileName];
-            NSString *autoUploadDirectory = [[NCManageDatabase sharedInstance] getAccountAutoUploadDirectory:tableAccount.url];
-                    
+            
             metadata = [CCUtility trasformedOCFileToCCMetadata:itemDto fileName:fileName serverUrl:serverUrl autoUploadFileName:autoUploadFileName autoUploadDirectory:autoUploadDirectory activeAccount:account isFolderEncrypted:isFolderEncrypted];
             metadata = [CCUtility trasformedOCFileToCCMetadata:itemDto fileName:fileName serverUrl:serverUrl autoUploadFileName:autoUploadFileName autoUploadDirectory:autoUploadDirectory activeAccount:account isFolderEncrypted:isFolderEncrypted];
                     
                     
             completion(account, metadata, nil, 0);
             completion(account, metadata, nil, 0);
@@ -609,7 +602,6 @@
     
     
     [communication setCredentialsWithUser:tableAccount.user andUserID:tableAccount.userID andPassword:tableAccount.password];
     [communication setCredentialsWithUser:tableAccount.user andUserID:tableAccount.userID andPassword:tableAccount.password];
     [communication setUserAgent:[CCUtility getUserAgent]];
     [communication setUserAgent:[CCUtility getUserAgent]];
-    
     [communication createFolder:path onCommunication:communication withForbiddenCharactersSupported:YES successRequest:^(NSHTTPURLResponse *response, NSString *redirectedServer) {
     [communication createFolder:path onCommunication:communication withForbiddenCharactersSupported:YES successRequest:^(NSHTTPURLResponse *response, NSString *redirectedServer) {
         
         
         NSDictionary *fields = [response allHeaderFields];
         NSDictionary *fields = [response allHeaderFields];
@@ -662,7 +654,6 @@
     
     
     [communication setCredentialsWithUser:tableAccount.user andUserID:tableAccount.userID andPassword:tableAccount.password];
     [communication setCredentialsWithUser:tableAccount.user andUserID:tableAccount.userID andPassword:tableAccount.password];
     [communication setUserAgent:[CCUtility getUserAgent]];
     [communication setUserAgent:[CCUtility getUserAgent]];
-    
     [communication deleteFileOrFolder:path onCommunication:communication successRequest:^(NSHTTPURLResponse *response, NSString *redirectedServer) {
     [communication deleteFileOrFolder:path onCommunication:communication successRequest:^(NSHTTPURLResponse *response, NSString *redirectedServer) {
         
         
         completion(account, nil, 0);
         completion(account, nil, 0);
@@ -696,7 +687,6 @@
     
     
     [communication setCredentialsWithUser:tableAccount.user andUserID:tableAccount.userID andPassword:tableAccount.password];
     [communication setCredentialsWithUser:tableAccount.user andUserID:tableAccount.userID andPassword:tableAccount.password];
     [communication setUserAgent:[CCUtility getUserAgent]];
     [communication setUserAgent:[CCUtility getUserAgent]];
-    
     [communication moveFileOrFolder:fileName toDestiny:fileNameTo onCommunication:communication withForbiddenCharactersSupported:YES successRequest:^(NSHTTPURLResponse *response, NSString *redirectedServer) {
     [communication moveFileOrFolder:fileName toDestiny:fileNameTo onCommunication:communication withForbiddenCharactersSupported:YES successRequest:^(NSHTTPURLResponse *response, NSString *redirectedServer) {
         
         
         completion(account, nil, 0);
         completion(account, nil, 0);
@@ -729,73 +719,76 @@
     }];
     }];
 }
 }
 
 
-- (void)searchWithAccount:(NSString *)account fileName:(NSString *)fileName serverUrl:(NSString *)serverUrl contentType:(NSArray *)contentType date:(NSDate *)date depth:(NSString *)depth completion:(void(^)(NSString *account, NSArray *metadatas, NSString *message, NSInteger errorCode))completion
+- (void)searchWithAccount:(NSString *)account fileName:(NSString *)fileName serverUrl:(NSString *)serverUrl contentType:(NSArray *)contentType lteDateLastModified:(NSDate *)lteDateLastModified gteDateLastModified:(NSDate *)gteDateLastModified depth:(NSString *)depth completion:(void(^)(NSString *account, NSArray *metadatas, NSString *message, NSInteger errorCode))completion
 {
 {
     tableAccount *tableAccount = [[NCManageDatabase sharedInstance] getAccountWithPredicate:[NSPredicate predicateWithFormat:@"account == %@", account]];
     tableAccount *tableAccount = [[NCManageDatabase sharedInstance] getAccountWithPredicate:[NSPredicate predicateWithFormat:@"account == %@", account]];
     if (tableAccount == nil) {
     if (tableAccount == nil) {
         completion(account, nil, NSLocalizedString(@"_error_user_not_available_", nil), k_CCErrorUserNotAvailble);
         completion(account, nil, NSLocalizedString(@"_error_user_not_available_", nil), k_CCErrorUserNotAvailble);
     }
     }
     
     
-    OCCommunication *communication = [OCNetworking sharedManager].sharedOCCommunication;
-    
-    [communication setCredentialsWithUser:tableAccount.user andUserID:tableAccount.userID andPassword:tableAccount.password];
-    [communication setUserAgent:[CCUtility getUserAgent]];
-
     NSString *path = [tableAccount.url stringByAppendingString:k_dav];
     NSString *path = [tableAccount.url stringByAppendingString:k_dav];
     NSString *folder = [serverUrl stringByReplacingOccurrencesOfString:[CCUtility getHomeServerUrlActiveUrl:tableAccount.url] withString:@""];
     NSString *folder = [serverUrl stringByReplacingOccurrencesOfString:[CCUtility getHomeServerUrlActiveUrl:tableAccount.url] withString:@""];
-    NSString *dateLastModified;
+    NSString *lteDateLastModifiedString;
+    NSString *gteDateLastModifiedString;
+    NSString *autoUploadFileName = [[NCManageDatabase sharedInstance] getAccountAutoUploadFileName];
+    NSString *autoUploadDirectory = [[NCManageDatabase sharedInstance] getAccountAutoUploadDirectory:tableAccount.url];
+    NSString *url = tableAccount.url;
+    NSString *userID = tableAccount.userID;
+
+    if (lteDateLastModified) {
+        NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
+        NSLocale *enUSPOSIXLocale = [NSLocale localeWithLocaleIdentifier:@"en_US_POSIX"];
+        [dateFormatter setLocale:enUSPOSIXLocale];
+        [dateFormatter setDateFormat:@"yyyy-MM-dd'T'HH:mm:ssZZZZZ"];
+        lteDateLastModifiedString = [dateFormatter stringFromDate:lteDateLastModified];
+    }
     
     
-    if (date) {
+    if (gteDateLastModified) {
         NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
         NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
         NSLocale *enUSPOSIXLocale = [NSLocale localeWithLocaleIdentifier:@"en_US_POSIX"];
         NSLocale *enUSPOSIXLocale = [NSLocale localeWithLocaleIdentifier:@"en_US_POSIX"];
         [dateFormatter setLocale:enUSPOSIXLocale];
         [dateFormatter setLocale:enUSPOSIXLocale];
         [dateFormatter setDateFormat:@"yyyy-MM-dd'T'HH:mm:ssZZZZZ"];
         [dateFormatter setDateFormat:@"yyyy-MM-dd'T'HH:mm:ssZZZZZ"];
-        
-        dateLastModified = [dateFormatter stringFromDate:date];
+        gteDateLastModifiedString = [dateFormatter stringFromDate:gteDateLastModified];
     }
     }
- 
-    [communication search:path folder:folder fileName: [NSString stringWithFormat:@"%%%@%%", fileName] depth:depth dateLastModified:dateLastModified contentType:contentType withUserSessionToken:nil onCommunication:communication successRequest:^(NSHTTPURLResponse *response, NSArray *items, NSString *redirectedServer, NSString *token) {
+    
+    OCCommunication *communication = [OCNetworking sharedManager].sharedOCCommunication;
+    
+    [communication setCredentialsWithUser:tableAccount.user andUserID:tableAccount.userID andPassword:tableAccount.password];
+    [communication setUserAgent:[CCUtility getUserAgent]];
+    [communication search:path folder:folder fileName: [NSString stringWithFormat:@"%%%@%%", fileName] depth:depth lteDateLastModified:lteDateLastModifiedString gteDateLastModified:gteDateLastModifiedString contentType:contentType withUserSessionToken:nil onCommunication:communication successRequest:^(NSHTTPURLResponse *response, NSArray *items, NSString *redirectedServer, NSString *token) {
         
         
         NSMutableArray *metadatas = [NSMutableArray new];
         NSMutableArray *metadatas = [NSMutableArray new];
         BOOL showHiddenFiles = [CCUtility getShowHiddenFiles];
         BOOL showHiddenFiles = [CCUtility getShowHiddenFiles];
         
         
-        NSString *autoUploadFileName = [[NCManageDatabase sharedInstance] getAccountAutoUploadFileName];
-        NSString *autoUploadDirectory = [[NCManageDatabase sharedInstance] getAccountAutoUploadDirectory:tableAccount.url];
-        
-        dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0), ^{
+        for (OCFileDto *itemDto in items) {
             
             
-            for (OCFileDto *itemDto in items) {
-                
-                NSString *serverUrl;
-                BOOL isFolderEncrypted;
-                
-                NSString *fileName = [itemDto.fileName stringByReplacingOccurrencesOfString:@"/" withString:@""];
-                
-                // Skip hidden files
-                if (fileName.length > 0) {
-                    if (!showHiddenFiles && [[fileName substringToIndex:1] isEqualToString:@"."])
-                        continue;
-                } else
+            NSString *serverUrl;
+            BOOL isFolderEncrypted;
+            
+            NSString *fileName = [itemDto.fileName stringByReplacingOccurrencesOfString:@"/" withString:@""];
+            
+            // Skip hidden files
+            if (fileName.length > 0) {
+                if (!showHiddenFiles && [[fileName substringToIndex:1] isEqualToString:@"."])
                     continue;
                     continue;
-                
-                NSRange firstInstance = [itemDto.filePath rangeOfString:[NSString stringWithFormat:@"%@/files/%@", k_dav, tableAccount.userID]];
-                NSString *serverPath = [itemDto.filePath substringFromIndex:firstInstance.length+firstInstance.location+1];
-                if ([serverPath hasSuffix:@"/"]) serverPath = [serverPath substringToIndex:[serverPath length] - 1];
-                serverUrl = [CCUtility stringAppendServerUrl:[tableAccount.url stringByAppendingString:k_webDAV] addFileName:serverPath];
-                
-                if (itemDto.isDirectory) {
-                    (void)[[NCManageDatabase sharedInstance] addDirectoryWithEncrypted:itemDto.isEncrypted favorite:itemDto.isFavorite fileID:itemDto.ocId permissions:itemDto.permissions serverUrl:[NSString stringWithFormat:@"%@/%@", serverUrl, fileName] account:account];
-                }
-                
-                isFolderEncrypted = [CCUtility isFolderEncrypted:serverUrl account:account];
-                
-                [metadatas addObject:[CCUtility trasformedOCFileToCCMetadata:itemDto fileName:itemDto.fileName serverUrl:serverUrl autoUploadFileName:autoUploadFileName autoUploadDirectory:autoUploadDirectory activeAccount:account isFolderEncrypted:isFolderEncrypted]];
+            } else
+                continue;
+            
+            NSRange firstInstance = [itemDto.filePath rangeOfString:[NSString stringWithFormat:@"%@/files/%@", k_dav, userID]];
+            NSString *serverPath = [itemDto.filePath substringFromIndex:firstInstance.length+firstInstance.location+1];
+            if ([serverPath hasSuffix:@"/"]) serverPath = [serverPath substringToIndex:[serverPath length] - 1];
+            serverUrl = [CCUtility stringAppendServerUrl:[url stringByAppendingString:k_webDAV] addFileName:serverPath];
+            
+            if (itemDto.isDirectory) {
+                (void)[[NCManageDatabase sharedInstance] addDirectoryWithEncrypted:itemDto.isEncrypted favorite:itemDto.isFavorite fileID:itemDto.ocId permissions:itemDto.permissions serverUrl:[NSString stringWithFormat:@"%@/%@", serverUrl, fileName] account:account];
             }
             }
             
             
-            dispatch_async(dispatch_get_main_queue(), ^{
-                completion(account, metadatas, nil, 0);
-            });
-        });
+            isFolderEncrypted = [CCUtility isFolderEncrypted:serverUrl account:account];
+            
+            [metadatas addObject:[CCUtility trasformedOCFileToCCMetadata:itemDto fileName:itemDto.fileName serverUrl:serverUrl autoUploadFileName:autoUploadFileName autoUploadDirectory:autoUploadDirectory activeAccount:account isFolderEncrypted:isFolderEncrypted]];
+        }
+        
+        completion(account, metadatas, nil, 0);
         
         
     } failureRequest:^(NSHTTPURLResponse *response, NSError *error, NSString *token, NSString *redirectedServer) {
     } failureRequest:^(NSHTTPURLResponse *response, NSError *error, NSString *token, NSString *redirectedServer) {
         
         
@@ -868,13 +861,12 @@
         completion(account, nil, NSLocalizedString(@"_error_user_not_available_", nil), k_CCErrorUserNotAvailble);
         completion(account, nil, NSLocalizedString(@"_error_user_not_available_", nil), k_CCErrorUserNotAvailble);
     }
     }
     
     
+    NSString *file = [NSString stringWithFormat:@"%@/%@.ico", [CCUtility getDirectoryProviderStorageFileID:metadata.fileID], metadata.fileNameView];
+    
     OCCommunication *communication = [OCNetworking sharedManager].sharedOCCommunication;
     OCCommunication *communication = [OCNetworking sharedManager].sharedOCCommunication;
     
     
     [communication setCredentialsWithUser:tableAccount.user andUserID:tableAccount.userID andPassword:tableAccount.password];
     [communication setCredentialsWithUser:tableAccount.user andUserID:tableAccount.userID andPassword:tableAccount.password];
     [communication setUserAgent:[CCUtility getUserAgent]];
     [communication setUserAgent:[CCUtility getUserAgent]];
-    
-    NSString *file = [NSString stringWithFormat:@"%@/%@.ico", [CCUtility getDirectoryProviderStorageFileID:metadata.fileID], metadata.fileNameView];
-    
     [communication getRemotePreviewByServer:tableAccount.url ofFilePath:[CCUtility returnFileNamePathFromFileName:metadata.fileName serverUrl:metadata.serverUrl activeUrl:tableAccount.url] withWidth:width andHeight:height andA:1 andMode:@"cover" path:@"" onCommunication:communication successRequest:^(NSHTTPURLResponse *response, NSData *preview, NSString *redirectedServer) {
     [communication getRemotePreviewByServer:tableAccount.url ofFilePath:[CCUtility returnFileNamePathFromFileName:metadata.fileName serverUrl:metadata.serverUrl activeUrl:tableAccount.url] withWidth:width andHeight:height andA:1 andMode:@"cover" path:@"" onCommunication:communication successRequest:^(NSHTTPURLResponse *response, NSData *preview, NSString *redirectedServer) {
         
         
         [preview writeToFile:file atomically:YES];
         [preview writeToFile:file atomically:YES];
@@ -909,7 +901,6 @@
     
     
     [communication setCredentialsWithUser:tableAccount.user andUserID:tableAccount.userID andPassword:tableAccount.password];
     [communication setCredentialsWithUser:tableAccount.user andUserID:tableAccount.userID andPassword:tableAccount.password];
     [communication setUserAgent:[CCUtility getUserAgent]];
     [communication setUserAgent:[CCUtility getUserAgent]];
-    
     [communication getRemotePreviewByServer:tableAccount.url ofFilePath:@"" withWidth:0 andHeight:0 andA:0 andMode:@"" path:serverPath onCommunication:communication successRequest:^(NSHTTPURLResponse *response, NSData *preview, NSString *redirectedServer) {
     [communication getRemotePreviewByServer:tableAccount.url ofFilePath:@"" withWidth:0 andHeight:0 andA:0 andMode:@"" path:serverPath onCommunication:communication successRequest:^(NSHTTPURLResponse *response, NSData *preview, NSString *redirectedServer) {
         
         
         [preview writeToFile:fileNamePath atomically:YES];
         [preview writeToFile:fileNamePath atomically:YES];
@@ -937,7 +928,6 @@
 {
 {
     tableAccount *tableAccount = [[NCManageDatabase sharedInstance] getAccountWithPredicate:[NSPredicate predicateWithFormat:@"account == %@", account]];
     tableAccount *tableAccount = [[NCManageDatabase sharedInstance] getAccountWithPredicate:[NSPredicate predicateWithFormat:@"account == %@", account]];
     if (tableAccount == nil) {
     if (tableAccount == nil) {
-        
         completion(account, nil, NSLocalizedString(@"_error_user_not_available_", nil), k_CCErrorUserNotAvailble);
         completion(account, nil, NSLocalizedString(@"_error_user_not_available_", nil), k_CCErrorUserNotAvailble);
     }
     }
     
     
@@ -953,7 +943,6 @@
         
         
         [communication setCredentialsWithUser:tableAccount.user andUserID:tableAccount.userID andPassword:tableAccount.password];
         [communication setCredentialsWithUser:tableAccount.user andUserID:tableAccount.userID andPassword:tableAccount.password];
         [communication setUserAgent:[CCUtility getUserAgent]];
         [communication setUserAgent:[CCUtility getUserAgent]];
-        
         [communication getRemotePreviewTrashByServer:tableAccount.url ofFileID:fileID onCommunication:communication successRequest:^(NSHTTPURLResponse *response, NSData *preview, NSString *redirectedServer) {
         [communication getRemotePreviewTrashByServer:tableAccount.url ofFileID:fileID onCommunication:communication successRequest:^(NSHTTPURLResponse *response, NSData *preview, NSString *redirectedServer) {
             
             
             [preview writeToFile:file atomically:YES];
             [preview writeToFile:file atomically:YES];
@@ -990,21 +979,21 @@
         completion(account, nil, NSLocalizedString(@"_error_user_not_available_", nil), k_CCErrorUserNotAvailble);
         completion(account, nil, NSLocalizedString(@"_error_user_not_available_", nil), k_CCErrorUserNotAvailble);
     }
     }
     
     
+    NSString *autoUploadFileName = [[NCManageDatabase sharedInstance] getAccountAutoUploadFileName];
+    NSString *autoUploadDirectory = [[NCManageDatabase sharedInstance] getAccountAutoUploadDirectory:tableAccount.url];
+    NSString *url = tableAccount.url;
+    NSString *userID = tableAccount.userID;
+    NSString *path = [url stringByAppendingString:k_dav];
+
     OCCommunication *communication = [OCNetworking sharedManager].sharedOCCommunication;
     OCCommunication *communication = [OCNetworking sharedManager].sharedOCCommunication;
     
     
     [communication setCredentialsWithUser:tableAccount.user andUserID:tableAccount.userID andPassword:tableAccount.password];
     [communication setCredentialsWithUser:tableAccount.user andUserID:tableAccount.userID andPassword:tableAccount.password];
     [communication setUserAgent:[CCUtility getUserAgent]];
     [communication setUserAgent:[CCUtility getUserAgent]];
-    
-    NSString *path = [tableAccount.url stringByAppendingString:k_dav];
-    
     [communication listingFavorites:path folder:@"" withUserSessionToken:nil onCommunication:communication successRequest:^(NSHTTPURLResponse *response, NSArray *items, NSString *redirectedServer, NSString *token) {
     [communication listingFavorites:path folder:@"" withUserSessionToken:nil onCommunication:communication successRequest:^(NSHTTPURLResponse *response, NSArray *items, NSString *redirectedServer, NSString *token) {
         
         
         NSMutableArray *metadatas = [NSMutableArray new];
         NSMutableArray *metadatas = [NSMutableArray new];
         BOOL showHiddenFiles = [CCUtility getShowHiddenFiles];
         BOOL showHiddenFiles = [CCUtility getShowHiddenFiles];
         
         
-        NSString *autoUploadFileName = [[NCManageDatabase sharedInstance] getAccountAutoUploadFileName];
-        NSString *autoUploadDirectory = [[NCManageDatabase sharedInstance] getAccountAutoUploadDirectory:tableAccount.url];
-        
         // Order by fileNamePath
         // Order by fileNamePath
         items = [items sortedArrayUsingComparator:^NSComparisonResult(id obj1, id obj2) {
         items = [items sortedArrayUsingComparator:^NSComparisonResult(id obj1, id obj2) {
             
             
@@ -1017,41 +1006,36 @@
             
             
         }];
         }];
         
         
-        dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0), ^{
+        for(OCFileDto *itemDto in items) {
             
             
-            for(OCFileDto *itemDto in items) {
-                
-                NSString *serverUrl;
-                BOOL isFolderEncrypted;
-                
-                NSString *fileName = [itemDto.fileName stringByReplacingOccurrencesOfString:@"/" withString:@""];
-                
-                // Skip hidden files
-                if (fileName.length > 0) {
-                    if (!showHiddenFiles && [[fileName substringToIndex:1] isEqualToString:@"."])
-                        continue;
-                } else
+            NSString *serverUrl;
+            BOOL isFolderEncrypted;
+            
+            NSString *fileName = [itemDto.fileName stringByReplacingOccurrencesOfString:@"/" withString:@""];
+            
+            // Skip hidden files
+            if (fileName.length > 0) {
+                if (!showHiddenFiles && [[fileName substringToIndex:1] isEqualToString:@"."])
                     continue;
                     continue;
-                
-                NSRange firstInstance = [itemDto.filePath rangeOfString:[NSString stringWithFormat:@"%@/files/%@", k_dav, tableAccount.userID]];
-                NSString *serverPath = [itemDto.filePath substringFromIndex:firstInstance.length+firstInstance.location+1];
-                if ([serverPath hasSuffix:@"/"])
-                    serverPath = [serverPath substringToIndex:[serverPath length] - 1];
-                serverUrl = [CCUtility stringAppendServerUrl:[tableAccount.url stringByAppendingString:k_webDAV] addFileName:serverPath];
-                
-                if (itemDto.isDirectory) {
-                    (void)[[NCManageDatabase sharedInstance] addDirectoryWithEncrypted:itemDto.isEncrypted favorite:itemDto.isFavorite fileID:itemDto.ocId permissions:itemDto.permissions serverUrl:[NSString stringWithFormat:@"%@/%@", serverUrl, fileName] account:account];
-                }
-                
-                isFolderEncrypted = [CCUtility isFolderEncrypted:serverUrl account:account];
-                
-                [metadatas addObject:[CCUtility trasformedOCFileToCCMetadata:itemDto fileName:itemDto.fileName serverUrl:serverUrl autoUploadFileName:autoUploadFileName autoUploadDirectory:autoUploadDirectory activeAccount:account isFolderEncrypted:isFolderEncrypted]];
+            } else
+                continue;
+            
+            NSRange firstInstance = [itemDto.filePath rangeOfString:[NSString stringWithFormat:@"%@/files/%@", k_dav, userID]];
+            NSString *serverPath = [itemDto.filePath substringFromIndex:firstInstance.length+firstInstance.location+1];
+            if ([serverPath hasSuffix:@"/"])
+                serverPath = [serverPath substringToIndex:[serverPath length] - 1];
+            serverUrl = [CCUtility stringAppendServerUrl:[url stringByAppendingString:k_webDAV] addFileName:serverPath];
+            
+            if (itemDto.isDirectory) {
+                (void)[[NCManageDatabase sharedInstance] addDirectoryWithEncrypted:itemDto.isEncrypted favorite:itemDto.isFavorite fileID:itemDto.ocId permissions:itemDto.permissions serverUrl:[NSString stringWithFormat:@"%@/%@", serverUrl, fileName] account:account];
             }
             }
             
             
-            dispatch_async(dispatch_get_main_queue(), ^{
-                completion(account, metadatas, nil, 0);
-            });
-        });
+            isFolderEncrypted = [CCUtility isFolderEncrypted:serverUrl account:account];
+            
+            [metadatas addObject:[CCUtility trasformedOCFileToCCMetadata:itemDto fileName:itemDto.fileName serverUrl:serverUrl autoUploadFileName:autoUploadFileName autoUploadDirectory:autoUploadDirectory activeAccount:account isFolderEncrypted:isFolderEncrypted]];
+        }
+        
+        completion(account, metadatas, nil, 0);
         
         
     } failureRequest:^(NSHTTPURLResponse *response, NSError *error, NSString *token, NSString *redirectedServer) {
     } failureRequest:^(NSHTTPURLResponse *response, NSError *error, NSString *token, NSString *redirectedServer) {
         
         
@@ -1078,13 +1062,12 @@
         completion(account, NSLocalizedString(@"_error_user_not_available_", nil), k_CCErrorUserNotAvailble);
         completion(account, NSLocalizedString(@"_error_user_not_available_", nil), k_CCErrorUserNotAvailble);
     }
     }
     
     
+    NSString *server = [tableAccount.url stringByAppendingString:k_dav];
+
     OCCommunication *communication = [OCNetworking sharedManager].sharedOCCommunication;
     OCCommunication *communication = [OCNetworking sharedManager].sharedOCCommunication;
     
     
     [communication setCredentialsWithUser:tableAccount.user andUserID:tableAccount.userID andPassword:tableAccount.password];
     [communication setCredentialsWithUser:tableAccount.user andUserID:tableAccount.userID andPassword:tableAccount.password];
     [communication setUserAgent:[CCUtility getUserAgent]];
     [communication setUserAgent:[CCUtility getUserAgent]];
-    
-    NSString *server = [tableAccount.url stringByAppendingString:k_dav];
-
     [communication settingFavoriteServer:server andFileOrFolderPath:fileName favorite:favorite withUserSessionToken:nil onCommunication:communication successRequest:^(NSHTTPURLResponse *response, NSString *redirectedServer, NSString *token) {
     [communication settingFavoriteServer:server andFileOrFolderPath:fileName favorite:favorite withUserSessionToken:nil onCommunication:communication successRequest:^(NSHTTPURLResponse *response, NSString *redirectedServer, NSString *token) {
         
         
         completion(account, nil, 0);
         completion(account, nil, 0);
@@ -1122,7 +1105,6 @@
     
     
     [communication setCredentialsWithUser:tableAccount.user andUserID:tableAccount.userID andPassword:tableAccount.password];
     [communication setCredentialsWithUser:tableAccount.user andUserID:tableAccount.userID andPassword:tableAccount.password];
     [communication setUserAgent:[CCUtility getUserAgent]];
     [communication setUserAgent:[CCUtility getUserAgent]];
-    
     [communication readSharedByServer:[tableAccount.url stringByAppendingString:@"/"] onCommunication:communication successRequest:^(NSHTTPURLResponse *response, NSArray *items, NSString *redirectedServer) {
     [communication readSharedByServer:[tableAccount.url stringByAppendingString:@"/"] onCommunication:communication successRequest:^(NSHTTPURLResponse *response, NSArray *items, NSString *redirectedServer) {
         
         
         completion(account, items, nil, 0);
         completion(account, items, nil, 0);
@@ -1156,7 +1138,6 @@
     
     
     [communication setCredentialsWithUser:tableAccount.user andUserID:tableAccount.userID andPassword:tableAccount.password];
     [communication setCredentialsWithUser:tableAccount.user andUserID:tableAccount.userID andPassword:tableAccount.password];
     [communication setUserAgent:[CCUtility getUserAgent]];
     [communication setUserAgent:[CCUtility getUserAgent]];
-    
     [communication shareFileOrFolderByServer:[tableAccount.url stringByAppendingString:@"/"] andFileOrFolderPath:[fileName encodeString:NSUTF8StringEncoding] andPassword:[password encodeString:NSUTF8StringEncoding] andPermission:permission andHideDownload:hideDownload onCommunication:communication successRequest:^(NSHTTPURLResponse *response, NSString *token, NSString *redirectedServer) {
     [communication shareFileOrFolderByServer:[tableAccount.url stringByAppendingString:@"/"] andFileOrFolderPath:[fileName encodeString:NSUTF8StringEncoding] andPassword:[password encodeString:NSUTF8StringEncoding] andPermission:permission andHideDownload:hideDownload onCommunication:communication successRequest:^(NSHTTPURLResponse *response, NSString *token, NSString *redirectedServer) {
         
         
         completion(account, nil, 0);
         completion(account, nil, 0);
@@ -1192,7 +1173,6 @@
     
     
     [communication setCredentialsWithUser:tableAccount.user andUserID:tableAccount.userID andPassword:tableAccount.password];
     [communication setCredentialsWithUser:tableAccount.user andUserID:tableAccount.userID andPassword:tableAccount.password];
     [communication setUserAgent:[CCUtility getUserAgent]];
     [communication setUserAgent:[CCUtility getUserAgent]];
-    
     [communication shareWith:userOrGroup shareeType:shareeType inServer:[tableAccount.url stringByAppendingString:@"/"] andFileOrFolderPath:[fileName encodeString:NSUTF8StringEncoding] andPermissions:permission onCommunication:communication successRequest:^(NSHTTPURLResponse *response, NSString *redirectedServer) {
     [communication shareWith:userOrGroup shareeType:shareeType inServer:[tableAccount.url stringByAppendingString:@"/"] andFileOrFolderPath:[fileName encodeString:NSUTF8StringEncoding] andPermissions:permission onCommunication:communication successRequest:^(NSHTTPURLResponse *response, NSString *redirectedServer) {
         
         
         completion(account, nil, 0);
         completion(account, nil, 0);
@@ -1226,7 +1206,6 @@
     
     
     [communication setCredentialsWithUser:tableAccount.user andUserID:tableAccount.userID andPassword:tableAccount.password];
     [communication setCredentialsWithUser:tableAccount.user andUserID:tableAccount.userID andPassword:tableAccount.password];
     [communication setUserAgent:[CCUtility getUserAgent]];
     [communication setUserAgent:[CCUtility getUserAgent]];
-    
     [communication updateShare:shareID ofServerPath:[tableAccount.url stringByAppendingString:@"/"] withPasswordProtect:[password encodeString:NSUTF8StringEncoding] andExpirationTime:expirationTime andPermissions:permission andHideDownload:hideDownload onCommunication:communication successRequest:^(NSHTTPURLResponse *response, NSString *redirectedServer) {
     [communication updateShare:shareID ofServerPath:[tableAccount.url stringByAppendingString:@"/"] withPasswordProtect:[password encodeString:NSUTF8StringEncoding] andExpirationTime:expirationTime andPermissions:permission andHideDownload:hideDownload onCommunication:communication successRequest:^(NSHTTPURLResponse *response, NSString *redirectedServer) {
         
         
         completion(account, nil, 0);
         completion(account, nil, 0);
@@ -1260,7 +1239,6 @@
     
     
     [communication setCredentialsWithUser:tableAccount.user andUserID:tableAccount.userID andPassword:tableAccount.password];
     [communication setCredentialsWithUser:tableAccount.user andUserID:tableAccount.userID andPassword:tableAccount.password];
     [communication setUserAgent:[CCUtility getUserAgent]];
     [communication setUserAgent:[CCUtility getUserAgent]];
-    
     [communication unShareFileOrFolderByServer:[tableAccount.url stringByAppendingString:@"/"] andIdRemoteShared:shareID onCommunication:communication successRequest:^(NSHTTPURLResponse *response, NSString *redirectedServer) {
     [communication unShareFileOrFolderByServer:[tableAccount.url stringByAppendingString:@"/"] andIdRemoteShared:shareID onCommunication:communication successRequest:^(NSHTTPURLResponse *response, NSString *redirectedServer) {
         
         
         completion(account, nil, 0);
         completion(account, nil, 0);
@@ -1294,7 +1272,6 @@
     
     
     [communication setCredentialsWithUser:tableAccount.user andUserID:tableAccount.userID andPassword:tableAccount.password];
     [communication setCredentialsWithUser:tableAccount.user andUserID:tableAccount.userID andPassword:tableAccount.password];
     [communication setUserAgent:[CCUtility getUserAgent]];
     [communication setUserAgent:[CCUtility getUserAgent]];
-    
     [communication searchUsersAndGroupsWith:searchString forPage:1 with:50 ofServer:[tableAccount.url stringByAppendingString:@"/"] onCommunication:communication successRequest:^(NSHTTPURLResponse *response, NSArray *itemList, NSString *redirectedServer) {
     [communication searchUsersAndGroupsWith:searchString forPage:1 with:50 ofServer:[tableAccount.url stringByAppendingString:@"/"] onCommunication:communication successRequest:^(NSHTTPURLResponse *response, NSArray *itemList, NSString *redirectedServer) {
         
         
         completion(account, itemList, nil, 0);
         completion(account, itemList, nil, 0);
@@ -1328,7 +1305,6 @@
     
     
     [communication setCredentialsWithUser:tableAccount.user andUserID:tableAccount.userID andPassword:tableAccount.password];
     [communication setCredentialsWithUser:tableAccount.user andUserID:tableAccount.userID andPassword:tableAccount.password];
     [communication setUserAgent:[CCUtility getUserAgent]];
     [communication setUserAgent:[CCUtility getUserAgent]];
-        
     [communication getSharePermissionsFile:fileNamePath onCommunication:communication successRequest:^(NSHTTPURLResponse *response, NSString *permissions, NSString *redirectedServer) {
     [communication getSharePermissionsFile:fileNamePath onCommunication:communication successRequest:^(NSHTTPURLResponse *response, NSString *permissions, NSString *redirectedServer) {
         
         
         completion(account, permissions, nil ,0);
         completion(account, permissions, nil ,0);
@@ -1364,16 +1340,15 @@
         completion(account, nil, NSLocalizedString(@"_error_user_not_available_", nil), k_CCErrorUserNotAvailble);
         completion(account, nil, NSLocalizedString(@"_error_user_not_available_", nil), k_CCErrorUserNotAvailble);
     }
     }
     
     
-    OCCommunication *communication = [OCNetworking sharedManager].sharedOCCommunication;
-
-    [communication setCredentialsWithUser:tableAccount.user andUserID:tableAccount.userID andPassword:tableAccount.password];
-    [communication setUserAgent:[CCUtility getUserAgent]];
-    
     tableCapabilities *capabilities = [[NCManageDatabase sharedInstance] getCapabilitesWithAccount:account];
     tableCapabilities *capabilities = [[NCManageDatabase sharedInstance] getCapabilitesWithAccount:account];
     if (capabilities != nil && capabilities.versionMajor >= k_nextcloud_version_15_0) {
     if (capabilities != nil && capabilities.versionMajor >= k_nextcloud_version_15_0) {
         previews = true;
         previews = true;
     }
     }
     
     
+    OCCommunication *communication = [OCNetworking sharedManager].sharedOCCommunication;
+    
+    [communication setCredentialsWithUser:tableAccount.user andUserID:tableAccount.userID andPassword:tableAccount.password];
+    [communication setUserAgent:[CCUtility getUserAgent]];
     [communication getActivityServer:[tableAccount.url stringByAppendingString:@"/"] since:since limit:limit previews:previews link:link onCommunication:communication successRequest:^(NSHTTPURLResponse *response, NSArray *listOfActivity, NSString *redirectedServer) {
     [communication getActivityServer:[tableAccount.url stringByAppendingString:@"/"] since:since limit:limit previews:previews link:link onCommunication:communication successRequest:^(NSHTTPURLResponse *response, NSArray *listOfActivity, NSString *redirectedServer) {
         
         
         completion(account, listOfActivity, nil, 0);
         completion(account, listOfActivity, nil, 0);
@@ -1407,7 +1382,6 @@
 
 
     [communication setCredentialsWithUser:tableAccount.user andUserID:tableAccount.userID andPassword:tableAccount.password];
     [communication setCredentialsWithUser:tableAccount.user andUserID:tableAccount.userID andPassword:tableAccount.password];
     [communication setUserAgent:[CCUtility getUserAgent]];
     [communication setUserAgent:[CCUtility getUserAgent]];
-    
     [communication getExternalSitesServer:[tableAccount.url stringByAppendingString:@"/"] onCommunication:communication successRequest:^(NSHTTPURLResponse *response, NSArray *listOfExternalSites, NSString *redirectedServer) {
     [communication getExternalSitesServer:[tableAccount.url stringByAppendingString:@"/"] onCommunication:communication successRequest:^(NSHTTPURLResponse *response, NSArray *listOfExternalSites, NSString *redirectedServer) {
         
         
         completion(account, listOfExternalSites, nil, 0);
         completion(account, listOfExternalSites, nil, 0);
@@ -1478,7 +1452,6 @@
 
 
     [communication setCredentialsWithUser:tableAccount.user andUserID:tableAccount.userID andPassword:tableAccount.password];
     [communication setCredentialsWithUser:tableAccount.user andUserID:tableAccount.userID andPassword:tableAccount.password];
     [communication setUserAgent:[CCUtility getUserAgent]];
     [communication setUserAgent:[CCUtility getUserAgent]];
-    
     [communication getNotificationServer:[tableAccount.url stringByAppendingString:@"/"] onCommunication:communication successRequest:^(NSHTTPURLResponse *response, NSArray *listOfNotifications, NSString *redirectedServer) {
     [communication getNotificationServer:[tableAccount.url stringByAppendingString:@"/"] onCommunication:communication successRequest:^(NSHTTPURLResponse *response, NSArray *listOfNotifications, NSString *redirectedServer) {
         
         
         completion(account, listOfNotifications, nil, 0);
         completion(account, listOfNotifications, nil, 0);
@@ -1512,7 +1485,6 @@
 
 
     [communication setCredentialsWithUser:tableAccount.user andUserID:tableAccount.userID andPassword:tableAccount.password];
     [communication setCredentialsWithUser:tableAccount.user andUserID:tableAccount.userID andPassword:tableAccount.password];
     [communication setUserAgent:[CCUtility getUserAgent]];
     [communication setUserAgent:[CCUtility getUserAgent]];
-    
     [communication setNotificationServer:serverUrl type:type onCommunication:communication successRequest:^(NSHTTPURLResponse *response, NSString *redirectedServer) {
     [communication setNotificationServer:serverUrl type:type onCommunication:communication successRequest:^(NSHTTPURLResponse *response, NSString *redirectedServer) {
         
         
         completion(account, nil, 0);
         completion(account, nil, 0);
@@ -1546,7 +1518,6 @@
 
 
     [communication setCredentialsWithUser:tableAccount.user andUserID:tableAccount.userID andPassword:tableAccount.password];
     [communication setCredentialsWithUser:tableAccount.user andUserID:tableAccount.userID andPassword:tableAccount.password];
     [communication setUserAgent:[CCUtility getUserAgent]];
     [communication setUserAgent:[CCUtility getUserAgent]];
-    
     [communication getCapabilitiesOfServer:[tableAccount.url stringByAppendingString:@"/"] onCommunication:communication successRequest:^(NSHTTPURLResponse *response, OCCapabilities *capabilities, NSString *redirectedServer) {
     [communication getCapabilitiesOfServer:[tableAccount.url stringByAppendingString:@"/"] onCommunication:communication successRequest:^(NSHTTPURLResponse *response, OCCapabilities *capabilities, NSString *redirectedServer) {
         
         
         completion(account, capabilities, nil, 0);
         completion(account, capabilities, nil, 0);
@@ -1580,7 +1551,6 @@
 
 
     [communication setCredentialsWithUser:tableAccount.user andUserID:tableAccount.userID andPassword:tableAccount.password];
     [communication setCredentialsWithUser:tableAccount.user andUserID:tableAccount.userID andPassword:tableAccount.password];
     [communication setUserAgent:[CCUtility getUserAgent]];
     [communication setUserAgent:[CCUtility getUserAgent]];
-    
     [communication getUserProfileServer:[tableAccount.url stringByAppendingString:@"/"] onCommunication:communication successRequest:^(NSHTTPURLResponse *response, OCUserProfile *userProfile, NSString *redirectedServer) {
     [communication getUserProfileServer:[tableAccount.url stringByAppendingString:@"/"] onCommunication:communication successRequest:^(NSHTTPURLResponse *response, OCUserProfile *userProfile, NSString *redirectedServer) {
         
         
         completion(account, userProfile, nil, 0);
         completion(account, userProfile, nil, 0);
@@ -1614,13 +1584,12 @@
         completion(account, nil, nil, nil, NSLocalizedString(@"_error_user_not_available_", nil), k_CCErrorUserNotAvailble);
         completion(account, nil, nil, nil, NSLocalizedString(@"_error_user_not_available_", nil), k_CCErrorUserNotAvailble);
     }
     }
     
     
-    OCCommunication *communication = [OCNetworking sharedManager].sharedOCCommunication;
+    devicePublicKey = [CCUtility URLEncodeStringFromString:devicePublicKey];
 
 
+    OCCommunication *communication = [OCNetworking sharedManager].sharedOCCommunication;
+    
     [communication setCredentialsWithUser:tableAccount.user andUserID:tableAccount.userID andPassword:tableAccount.password];
     [communication setCredentialsWithUser:tableAccount.user andUserID:tableAccount.userID andPassword:tableAccount.password];
     [communication setUserAgent:[CCUtility getUserAgent]];
     [communication setUserAgent:[CCUtility getUserAgent]];
-    
-    devicePublicKey = [CCUtility URLEncodeStringFromString:devicePublicKey];
-
     [communication subscribingNextcloudServerPush:url pushTokenHash:pushTokenHash devicePublicKey:devicePublicKey proxyServerPath: [NCBrandOptions sharedInstance].pushNotificationServerProxy onCommunication:communication successRequest:^(NSHTTPURLResponse *response, NSString *publicKey, NSString *deviceIdentifier, NSString *signature, NSString *redirectedServer) {
     [communication subscribingNextcloudServerPush:url pushTokenHash:pushTokenHash devicePublicKey:devicePublicKey proxyServerPath: [NCBrandOptions sharedInstance].pushNotificationServerProxy onCommunication:communication successRequest:^(NSHTTPURLResponse *response, NSString *publicKey, NSString *deviceIdentifier, NSString *signature, NSString *redirectedServer) {
         
         
         deviceIdentifier = [CCUtility URLEncodeStringFromString:deviceIdentifier];
         deviceIdentifier = [CCUtility URLEncodeStringFromString:deviceIdentifier];
@@ -1675,7 +1644,6 @@
 
 
     [communication setCredentialsWithUser:tableAccount.user andUserID:tableAccount.userID andPassword:tableAccount.password];
     [communication setCredentialsWithUser:tableAccount.user andUserID:tableAccount.userID andPassword:tableAccount.password];
     [communication setUserAgent:[CCUtility getUserAgent]];
     [communication setUserAgent:[CCUtility getUserAgent]];
-    
     [communication unsubscribingNextcloudServerPush:url onCommunication:communication successRequest:^(NSHTTPURLResponse *response, NSString *redirectedServer) {
     [communication unsubscribingNextcloudServerPush:url onCommunication:communication successRequest:^(NSHTTPURLResponse *response, NSString *redirectedServer) {
 
 
         [communication unsubscribingPushProxy:[NCBrandOptions sharedInstance].pushNotificationServerProxy deviceIdentifier:deviceIdentifier deviceIdentifierSignature:deviceIdentifierSignature publicKey:publicKey onCommunication:communication successRequest:^(NSHTTPURLResponse *response, NSString *redirectedServer) {
         [communication unsubscribingPushProxy:[NCBrandOptions sharedInstance].pushNotificationServerProxy deviceIdentifier:deviceIdentifier deviceIdentifierSignature:deviceIdentifierSignature publicKey:publicKey onCommunication:communication successRequest:^(NSHTTPURLResponse *response, NSString *redirectedServer) {
@@ -1726,13 +1694,12 @@
         completion(account, nil, NSLocalizedString(@"_error_user_not_available_", nil), k_CCErrorUserNotAvailble);
         completion(account, nil, NSLocalizedString(@"_error_user_not_available_", nil), k_CCErrorUserNotAvailble);
     }
     }
     
     
+    NSString *fileIDServer = [[NCUtility sharedInstance] convertFileIDClientToFileIDServer:fileID];
+    
     OCCommunication *communication = [OCNetworking sharedManager].sharedOCCommunication;
     OCCommunication *communication = [OCNetworking sharedManager].sharedOCCommunication;
-
+    
     [communication setCredentialsWithUser:tableAccount.user andUserID:tableAccount.userID andPassword:tableAccount.password];
     [communication setCredentialsWithUser:tableAccount.user andUserID:tableAccount.userID andPassword:tableAccount.password];
     [communication setUserAgent:[CCUtility getUserAgent]];
     [communication setUserAgent:[CCUtility getUserAgent]];
-    
-    NSString *fileIDServer = [[NCUtility sharedInstance] convertFileIDClientToFileIDServer:fileID];
-    
     [communication createLinkRichdocuments:[tableAccount.url stringByAppendingString:@"/"] fileID:fileIDServer onCommunication:communication successRequest:^(NSHTTPURLResponse *response, NSString *link, NSString *redirectedServer) {
     [communication createLinkRichdocuments:[tableAccount.url stringByAppendingString:@"/"] fileID:fileIDServer onCommunication:communication successRequest:^(NSHTTPURLResponse *response, NSString *link, NSString *redirectedServer) {
         
         
         completion(account, link, nil, 0);
         completion(account, link, nil, 0);
@@ -1765,7 +1732,6 @@
 
 
     [communication setCredentialsWithUser:tableAccount.user andUserID:tableAccount.userID andPassword:tableAccount.password];
     [communication setCredentialsWithUser:tableAccount.user andUserID:tableAccount.userID andPassword:tableAccount.password];
     [communication setUserAgent:[CCUtility getUserAgent]];
     [communication setUserAgent:[CCUtility getUserAgent]];
-        
     [communication geTemplatesRichdocuments:[tableAccount.url stringByAppendingString:@"/"] typeTemplate:typeTemplate onCommunication:communication successRequest:^(NSHTTPURLResponse *response, NSArray *listOfTemplate, NSString *redirectedServer) {
     [communication geTemplatesRichdocuments:[tableAccount.url stringByAppendingString:@"/"] typeTemplate:typeTemplate onCommunication:communication successRequest:^(NSHTTPURLResponse *response, NSArray *listOfTemplate, NSString *redirectedServer) {
         
         
         completion(account, listOfTemplate, nil, 0);
         completion(account, listOfTemplate, nil, 0);
@@ -1798,7 +1764,6 @@
 
 
     [communication setCredentialsWithUser:tableAccount.user andUserID:tableAccount.userID andPassword:tableAccount.password];
     [communication setCredentialsWithUser:tableAccount.user andUserID:tableAccount.userID andPassword:tableAccount.password];
     [communication setUserAgent:[CCUtility getUserAgent]];
     [communication setUserAgent:[CCUtility getUserAgent]];
-        
     [communication createNewRichdocuments:[tableAccount.url stringByAppendingString:@"/"] path:fileName templateID:templateID onCommunication:communication successRequest:^(NSHTTPURLResponse *response, NSString *url, NSString *redirectedServer) {
     [communication createNewRichdocuments:[tableAccount.url stringByAppendingString:@"/"] path:fileName templateID:templateID onCommunication:communication successRequest:^(NSHTTPURLResponse *response, NSString *url, NSString *redirectedServer) {
         
         
         completion(account, url, nil, 0);
         completion(account, url, nil, 0);
@@ -1827,13 +1792,12 @@
         completion(account, nil, NSLocalizedString(@"_error_user_not_available_", nil), k_CCErrorUserNotAvailble);
         completion(account, nil, NSLocalizedString(@"_error_user_not_available_", nil), k_CCErrorUserNotAvailble);
     }
     }
     
     
+    NSString *fileNamePath = [CCUtility returnFileNamePathFromFileName:fileName serverUrl:serverUrl activeUrl:tableAccount.url];
+
     OCCommunication *communication = [OCNetworking sharedManager].sharedOCCommunication;
     OCCommunication *communication = [OCNetworking sharedManager].sharedOCCommunication;
 
 
     [communication setCredentialsWithUser:tableAccount.user andUserID:tableAccount.userID andPassword:tableAccount.password];
     [communication setCredentialsWithUser:tableAccount.user andUserID:tableAccount.userID andPassword:tableAccount.password];
     [communication setUserAgent:[CCUtility getUserAgent]];
     [communication setUserAgent:[CCUtility getUserAgent]];
-    
-    NSString *fileNamePath = [CCUtility returnFileNamePathFromFileName:fileName serverUrl:serverUrl activeUrl:tableAccount.url];
-    
     [communication createAssetRichdocuments:[tableAccount.url stringByAppendingString:@"/"] path:fileNamePath onCommunication:communication successRequest:^(NSHTTPURLResponse *response, NSString *url, NSString *redirectedServer) {
     [communication createAssetRichdocuments:[tableAccount.url stringByAppendingString:@"/"] path:fileNamePath onCommunication:communication successRequest:^(NSHTTPURLResponse *response, NSString *url, NSString *redirectedServer) {
         
         
         completion(account, url, nil, 0);
         completion(account, url, nil, 0);
@@ -1871,7 +1835,6 @@
 
 
     [communication setCredentialsWithUser:tableAccount.user andUserID:tableAccount.userID andPassword:tableAccount.password];
     [communication setCredentialsWithUser:tableAccount.user andUserID:tableAccount.userID andPassword:tableAccount.password];
     [communication setUserAgent:[CCUtility getUserAgent]];
     [communication setUserAgent:[CCUtility getUserAgent]];
-    
     [communication listingTrash:[serverUrl stringByAppendingString:path] onCommunication:communication successRequest:^(NSHTTPURLResponse *response, NSArray *items, NSString *redirectedServer) {
     [communication listingTrash:[serverUrl stringByAppendingString:path] onCommunication:communication successRequest:^(NSHTTPURLResponse *response, NSArray *items, NSString *redirectedServer) {
         
         
         // Check items > 0
         // Check items > 0
@@ -1941,13 +1904,12 @@
         completion(account, NSLocalizedString(@"_error_user_not_available_", nil), k_CCErrorUserNotAvailble);
         completion(account, NSLocalizedString(@"_error_user_not_available_", nil), k_CCErrorUserNotAvailble);
     }
     }
     
     
+    NSString *path = [NSString stringWithFormat:@"%@%@/trashbin/%@/trash", tableAccount.url, k_dav, tableAccount.userID];
+
     OCCommunication *communication = [OCNetworking sharedManager].sharedOCCommunication;
     OCCommunication *communication = [OCNetworking sharedManager].sharedOCCommunication;
 
 
     [communication setCredentialsWithUser:tableAccount.user andUserID:tableAccount.userID andPassword:tableAccount.password];
     [communication setCredentialsWithUser:tableAccount.user andUserID:tableAccount.userID andPassword:tableAccount.password];
     [communication setUserAgent:[CCUtility getUserAgent]];
     [communication setUserAgent:[CCUtility getUserAgent]];
-    
-    NSString *path = [NSString stringWithFormat:@"%@%@/trashbin/%@/trash", tableAccount.url, k_dav, tableAccount.userID];
-    
     [communication emptyTrash:path onCommunication:communication successRequest:^(NSHTTPURLResponse *response, NSString *redirectedServer) {
     [communication emptyTrash:path onCommunication:communication successRequest:^(NSHTTPURLResponse *response, NSString *redirectedServer) {
         
         
         completion(account, nil, 0);
         completion(account, nil, 0);

+ 13 - 5
iOSClient/Offline/NCOffline.swift

@@ -468,16 +468,16 @@ class NCOffline: UIViewController ,UICollectionViewDataSource, UICollectionViewD
                 }
                 }
             }
             }
             
             
-            if let metadatas = NCManageDatabase.sharedInstance.getMetadatas(predicate: NSPredicate(format: "account == %@ AND fileID IN %@", appDelegate.activeAccount, fileIDs), sorted: datasourceSorted, ascending: datasourceAscending)  {
+            if let metadatas = NCManageDatabase.sharedInstance.getMetadatas(predicate: NSPredicate(format: "account == %@ AND fileID IN %@", appDelegate.activeAccount, fileIDs), sorted: nil, ascending: false)  {
 
 
-                sectionDatasource = CCSectionMetadata.creataDataSourseSectionMetadata(metadatas, listProgressMetadata: nil, groupByField: datasourceGroupBy, filterFileID: nil, filterTypeFileImage: false, filterTypeFileVideo: false, activeAccount: appDelegate.activeAccount)
+                sectionDatasource = CCSectionMetadata.creataDataSourseSectionMetadata(metadatas, listProgressMetadata: nil, groupByField: datasourceGroupBy, filterFileID: nil, filterTypeFileImage: false, filterTypeFileVideo: false, sorted: datasourceSorted, ascending: datasourceAscending, activeAccount: appDelegate.activeAccount)
             }
             }
             
             
         } else {
         } else {
         
         
-            if let metadatas = NCManageDatabase.sharedInstance.getMetadatas(predicate: NSPredicate(format: "account == %@ AND serverUrl == %@", appDelegate.activeAccount, serverUrl), sorted: datasourceSorted, ascending: datasourceAscending)  {
+            if let metadatas = NCManageDatabase.sharedInstance.getMetadatas(predicate: NSPredicate(format: "account == %@ AND serverUrl == %@", appDelegate.activeAccount, serverUrl), sorted: nil, ascending: false)  {
                 
                 
-                sectionDatasource = CCSectionMetadata.creataDataSourseSectionMetadata(metadatas, listProgressMetadata: nil, groupByField: datasourceGroupBy, filterFileID: nil, filterTypeFileImage: false, filterTypeFileVideo: false, activeAccount: appDelegate.activeAccount)
+                sectionDatasource = CCSectionMetadata.creataDataSourseSectionMetadata(metadatas, listProgressMetadata: nil, groupByField: datasourceGroupBy, filterFileID: nil, filterTypeFileImage: false, filterTypeFileVideo: false, sorted: datasourceSorted, ascending: datasourceAscending, activeAccount: appDelegate.activeAccount)
             }
             }
         }
         }
         
         
@@ -582,11 +582,19 @@ class NCOffline: UIViewController ,UICollectionViewDataSource, UICollectionViewD
     
     
     func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
     func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
         
         
+        let cell: UICollectionViewCell
+
         guard let metadata = NCMainCommon.sharedInstance.getMetadataFromSectionDataSourceIndexPath(indexPath, sectionDataSource: sectionDatasource) else {
         guard let metadata = NCMainCommon.sharedInstance.getMetadataFromSectionDataSourceIndexPath(indexPath, sectionDataSource: sectionDatasource) else {
             return collectionView.dequeueReusableCell(withReuseIdentifier: "listCell", for: indexPath) as! NCListCell
             return collectionView.dequeueReusableCell(withReuseIdentifier: "listCell", for: indexPath) as! NCListCell
         }
         }
         
         
-        let cell = NCMainCommon.sharedInstance.collectionViewCellForItemAt(indexPath, collectionView: collectionView, typeLayout: typeLayout, metadata: metadata, metadataFolder: nil, serverUrl: metadata.serverUrl, isEditMode: isEditMode, selectFileID: selectFileID, autoUploadFileName: autoUploadFileName, autoUploadDirectory: autoUploadDirectory, hideButtonMore: false, source: self)
+        if typeLayout == k_layout_grid {
+            cell = collectionView.dequeueReusableCell(withReuseIdentifier: "gridCell", for: indexPath) as! NCGridCell
+        } else {
+            cell = collectionView.dequeueReusableCell(withReuseIdentifier: "listCell", for: indexPath) as! NCListCell
+        }
+        
+        NCMainCommon.sharedInstance.collectionViewCellForItemAt(indexPath, collectionView: collectionView, cell: cell, metadata: metadata, metadataFolder: nil, serverUrl: metadata.serverUrl, isEditMode: isEditMode, selectFileID: selectFileID, autoUploadFileName: autoUploadFileName, autoUploadDirectory: autoUploadDirectory, hideButtonMore: false, downloadThumbnail: true, source: self)
         
         
         return cell
         return cell
     }
     }

+ 11 - 3
iOSClient/Select/NCSelect.swift

@@ -534,9 +534,9 @@ class NCSelect: UIViewController ,UICollectionViewDataSource, UICollectionViewDe
             }
             }
         }
         }
         
         
-        if let metadatas = NCManageDatabase.sharedInstance.getMetadatas(predicate: predicate!, sorted: datasourceSorted, ascending: datasourceAscending) {
+        if let metadatas = NCManageDatabase.sharedInstance.getMetadatas(predicate: predicate!, sorted: nil, ascending: false) {
             
             
-            sectionDatasource = CCSectionMetadata.creataDataSourseSectionMetadata(metadatas, listProgressMetadata: nil, groupByField: datasourceGroupBy, filterFileID: nil, filterTypeFileImage: false, filterTypeFileVideo: false, activeAccount: appDelegate.activeAccount)
+            sectionDatasource = CCSectionMetadata.creataDataSourseSectionMetadata(metadatas, listProgressMetadata: nil, groupByField: datasourceGroupBy, filterFileID: nil, filterTypeFileImage: false, filterTypeFileVideo: false, sorted: datasourceSorted, ascending: datasourceAscending, activeAccount: appDelegate.activeAccount)
         }
         }
         
         
         if withLoadFolder {
         if withLoadFolder {
@@ -644,11 +644,19 @@ class NCSelect: UIViewController ,UICollectionViewDataSource, UICollectionViewDe
     
     
     func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
     func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
         
         
+        let cell: UICollectionViewCell
+        
         guard let metadata = NCMainCommon.sharedInstance.getMetadataFromSectionDataSourceIndexPath(indexPath, sectionDataSource: sectionDatasource) else {
         guard let metadata = NCMainCommon.sharedInstance.getMetadataFromSectionDataSourceIndexPath(indexPath, sectionDataSource: sectionDatasource) else {
             return collectionView.dequeueReusableCell(withReuseIdentifier: "listCell", for: indexPath) as! NCListCell
             return collectionView.dequeueReusableCell(withReuseIdentifier: "listCell", for: indexPath) as! NCListCell
         }
         }
         
         
-        let cell = NCMainCommon.sharedInstance.collectionViewCellForItemAt(indexPath, collectionView: collectionView, typeLayout: typeLayout, metadata: metadata, metadataFolder: metadataFolder, serverUrl: serverUrl, isEditMode: isEditMode, selectFileID: selectFileID, autoUploadFileName: autoUploadFileName, autoUploadDirectory: autoUploadDirectory ,hideButtonMore: true, source: self)
+        if typeLayout == k_layout_grid {
+            cell = collectionView.dequeueReusableCell(withReuseIdentifier: "gridCell", for: indexPath) as! NCGridCell
+        } else {
+            cell = collectionView.dequeueReusableCell(withReuseIdentifier: "listCell", for: indexPath) as! NCListCell
+        }
+        
+        NCMainCommon.sharedInstance.collectionViewCellForItemAt(indexPath, collectionView: collectionView, cell: cell, metadata: metadata, metadataFolder: metadataFolder, serverUrl: serverUrl, isEditMode: isEditMode, selectFileID: selectFileID, autoUploadFileName: autoUploadFileName, autoUploadDirectory: autoUploadDirectory ,hideButtonMore: true, downloadThumbnail: true, source: self)
         
         
         return cell
         return cell
     }
     }

+ 2 - 2
iOSClient/Settings/Acknowledgements.rtf

@@ -221,12 +221,12 @@ Copyright (c) Xmartlabs ( http://xmartlabs.com )\
 ____________________________________________\
 ____________________________________________\
 \
 \
 
 
-\f1\b TOScrollBar
+\f1\b FastScroll
 \f0\b0 \
 \f0\b0 \
 \
 \
 The MIT License (MIT)\
 The MIT License (MIT)\
 \
 \
-Copyright (c) Tim Oliver\
+Copyright (c) Frichti\
 ____________________________________________\
 ____________________________________________\
 \
 \
 
 

+ 1 - 1
iOSClient/Settings/CCAdvanced.m

@@ -208,7 +208,7 @@
             [[NCManageDatabase sharedInstance] clearTable:[tableExternalSites class] account:appDelegate.activeAccount];
             [[NCManageDatabase sharedInstance] clearTable:[tableExternalSites class] account:appDelegate.activeAccount];
             [[NCManageDatabase sharedInstance] clearTable:[tableGPS class] account:nil];
             [[NCManageDatabase sharedInstance] clearTable:[tableGPS class] account:nil];
             [[NCManageDatabase sharedInstance] clearTable:[tableMetadata class] account:appDelegate.activeAccount];
             [[NCManageDatabase sharedInstance] clearTable:[tableMetadata class] account:appDelegate.activeAccount];
-            [[NCManageDatabase sharedInstance] clearTable:[tablePhotos class] account:appDelegate.activeAccount];
+            [[NCManageDatabase sharedInstance] clearTable:[tableMedia class] account:appDelegate.activeAccount];
             [[NCManageDatabase sharedInstance] clearTable:[tablePhotoLibrary class] account:appDelegate.activeAccount];
             [[NCManageDatabase sharedInstance] clearTable:[tablePhotoLibrary class] account:appDelegate.activeAccount];
             [[NCManageDatabase sharedInstance] clearTable:[tableShare class] account:appDelegate.activeAccount];
             [[NCManageDatabase sharedInstance] clearTable:[tableShare class] account:appDelegate.activeAccount];
             
             

+ 1 - 1
iOSClient/Settings/CCManageAccount.m

@@ -247,7 +247,7 @@
     [[NCManageDatabase sharedInstance] clearTable:[tableExternalSites class] account:account];
     [[NCManageDatabase sharedInstance] clearTable:[tableExternalSites class] account:account];
     [[NCManageDatabase sharedInstance] clearTable:[tableLocalFile class] account:account];
     [[NCManageDatabase sharedInstance] clearTable:[tableLocalFile class] account:account];
     [[NCManageDatabase sharedInstance] clearTable:[tableMetadata class] account:account];
     [[NCManageDatabase sharedInstance] clearTable:[tableMetadata class] account:account];
-    [[NCManageDatabase sharedInstance] clearTable:[tablePhotos class] account:account];
+    [[NCManageDatabase sharedInstance] clearTable:[tableMedia class] account:account];
     [[NCManageDatabase sharedInstance] clearTable:[tablePhotoLibrary class] account:account];
     [[NCManageDatabase sharedInstance] clearTable:[tablePhotoLibrary class] account:account];
     [[NCManageDatabase sharedInstance] clearTable:[tableShare class] account:account];
     [[NCManageDatabase sharedInstance] clearTable:[tableShare class] account:account];
     
     

+ 0 - 1
iOSClient/Settings/CCManageAutoUpload.h

@@ -24,7 +24,6 @@
 #import "XLFormViewController.h"
 #import "XLFormViewController.h"
 #import "CCMain.h"
 #import "CCMain.h"
 #import "CCManageLocation.h"
 #import "CCManageLocation.h"
-#import "CCMedia.h"
 
 
 @interface CCManageAutoUpload : XLFormViewController
 @interface CCManageAutoUpload : XLFormViewController
 
 

+ 0 - 5
iOSClient/Shares/NCShares.m

@@ -45,7 +45,6 @@
         
         
         appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
         appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
 
 
-        [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(triggerProgressTask:) name:@"NotificationProgressTask" object:nil];
         [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(changeTheming) name:@"changeTheming" object:nil];
         [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(changeTheming) name:@"changeTheming" object:nil];
         
         
         [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(reloadDatasource) name:@"SharesReloadDatasource" object:nil];
         [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(reloadDatasource) name:@"SharesReloadDatasource" object:nil];
@@ -97,10 +96,6 @@
     [self.tableView reloadData];
     [self.tableView reloadData];
 }
 }
 
 
-- (void)triggerProgressTask:(NSNotification *)notification
-{
-}
-
 #pragma --------------------------------------------------------------------------------------------
 #pragma --------------------------------------------------------------------------------------------
 #pragma mark ==== DZNEmptyDataSetSource ====
 #pragma mark ==== DZNEmptyDataSetSource ====
 #pragma --------------------------------------------------------------------------------------------
 #pragma --------------------------------------------------------------------------------------------

BIN
iOSClient/Supporting Files/ast.lproj/Localizable.strings


BIN
iOSClient/Supporting Files/ca.lproj/Localizable.strings


BIN
iOSClient/Supporting Files/cs-CZ.lproj/Localizable.strings


BIN
iOSClient/Supporting Files/da.lproj/Localizable.strings


BIN
iOSClient/Supporting Files/el.lproj/Localizable.strings


BIN
iOSClient/Supporting Files/en-GB.lproj/Localizable.strings


+ 1 - 1
iOSClient/Supporting Files/en.lproj/Localizable.strings

@@ -580,7 +580,7 @@
 
 
 // Scan Document
 // Scan Document
 
 
-"_scans_document_"                  = "Scans document";
+"_scans_document_"                  = "Scan document";
 "_scanned_images_"                  = "Scanned images";
 "_scanned_images_"                  = "Scanned images";
 "_scan_document_pdf_page_"          = "Page";
 "_scan_document_pdf_page_"          = "Page";
 "_scan_label_document_zone_"        = "Drag images down for document creation";
 "_scan_label_document_zone_"        = "Drag images down for document creation";

BIN
iOSClient/Supporting Files/es-419.lproj/Localizable.strings


BIN
iOSClient/Supporting Files/es-AR.lproj/Localizable.strings


BIN
iOSClient/Supporting Files/es-CL.lproj/Localizable.strings


BIN
iOSClient/Supporting Files/es-CO.lproj/Localizable.strings


BIN
iOSClient/Supporting Files/es-CR.lproj/Localizable.strings


BIN
iOSClient/Supporting Files/es-DO.lproj/Localizable.strings


BIN
iOSClient/Supporting Files/es-EC.lproj/Localizable.strings


BIN
iOSClient/Supporting Files/es-GT.lproj/Localizable.strings


BIN
iOSClient/Supporting Files/es-HN.lproj/Localizable.strings


BIN
iOSClient/Supporting Files/es-MX.lproj/Localizable.strings


BIN
iOSClient/Supporting Files/es-NI.lproj/Localizable.strings


BIN
iOSClient/Supporting Files/es-PA.lproj/Localizable.strings


BIN
iOSClient/Supporting Files/es-PE.lproj/Localizable.strings


BIN
iOSClient/Supporting Files/es-PR.lproj/Localizable.strings


BIN
iOSClient/Supporting Files/es-PY.lproj/Localizable.strings


BIN
iOSClient/Supporting Files/es-SV.lproj/Localizable.strings


BIN
iOSClient/Supporting Files/es-UY.lproj/Localizable.strings


BIN
iOSClient/Supporting Files/es.lproj/Localizable.strings


BIN
iOSClient/Supporting Files/eu.lproj/Localizable.strings


BIN
iOSClient/Supporting Files/fa.lproj/Localizable.strings


BIN
iOSClient/Supporting Files/fi-FI.lproj/Localizable.strings


BIN
iOSClient/Supporting Files/fr.lproj/Localizable.strings


BIN
iOSClient/Supporting Files/gl.lproj/Localizable.strings


BIN
iOSClient/Supporting Files/hu.lproj/Localizable.strings


BIN
iOSClient/Supporting Files/is.lproj/Localizable.strings


Alguns ficheiros não foram mostrados porque muitos ficheiros mudaram neste diff