Эх сурвалжийг харах

Merge branch 'develop'

# Conflicts:
#	Nextcloud.xcodeproj/project.pbxproj
#	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/BKPasscodeView.strings
#	iOSClient/Supporting Files/cs-CZ.lproj/CTAssetsPicker.strings
#	iOSClient/Supporting Files/cs-CZ.lproj/InfoPlist.strings
#	iOSClient/Supporting Files/cs-CZ.lproj/Localizable.strings
#	iOSClient/Supporting Files/en-GB.lproj/Localizable.strings
#	iOSClient/Supporting Files/it.lproj/Localizable.strings
#	iOSClient/Supporting Files/sv.lproj/Localizable.strings
Marino Faggiana 6 жил өмнө
parent
commit
bdeb062183
85 өөрчлөгдсөн 4098 нэмэгдсэн , 2785 устгасан
  1. 1 1
      File Provider Extension/FileProviderData.swift
  2. 216 202
      Libraries external/Realm/Realm.framework/402D8A9F-892F-3C5E-9154-6A540B74D63C.bcsymbolmap
  3. 36 0
      Libraries external/Realm/Realm.framework/CHANGELOG.md
  4. 218 207
      Libraries external/Realm/Realm.framework/D681F990-5480-3415-9F1A-940504AE6826.bcsymbolmap
  5. 14 0
      Libraries external/Realm/Realm.framework/Headers/RLMSyncConfiguration.h
  6. 25 0
      Libraries external/Realm/Realm.framework/Headers/RLMSyncManager.h
  7. 46 2
      Libraries external/Realm/Realm.framework/Headers/RLMSyncSession.h
  8. 58 1
      Libraries external/Realm/Realm.framework/Headers/RLMSyncSubscription.h
  9. 8 0
      Libraries external/Realm/Realm.framework/Headers/RLMSyncUser.h
  10. BIN
      Libraries external/Realm/Realm.framework/Info.plist
  11. 2 1
      Libraries external/Realm/Realm.framework/PrivateHeaders/RLMSyncConfiguration_Private.h
  12. BIN
      Libraries external/Realm/Realm.framework/Realm
  13. 0 494
      Libraries external/Realm/RealmSwift.framework/0A85D1C9-A4CC-36AF-8CCA-4A34B492531A.bcsymbolmap
  14. 216 202
      Libraries external/Realm/RealmSwift.framework/402D8A9F-892F-3C5E-9154-6A540B74D63C.bcsymbolmap
  15. 894 0
      Libraries external/Realm/RealmSwift.framework/5C573639-1261-3D04-A749-BD077CE893DF.bcsymbolmap
  16. 889 0
      Libraries external/Realm/RealmSwift.framework/CC1F1DA4-4D64-3ED7-B9CC-C4E9B9DED5B8.bcsymbolmap
  17. 218 207
      Libraries external/Realm/RealmSwift.framework/D681F990-5480-3415-9F1A-940504AE6826.bcsymbolmap
  18. 0 494
      Libraries external/Realm/RealmSwift.framework/F141265C-71B9-3F69-9ED6-18AB64CAB929.bcsymbolmap
  19. 8 8
      Libraries external/Realm/RealmSwift.framework/Headers/RealmSwift-Swift.h
  20. BIN
      Libraries external/Realm/RealmSwift.framework/Info.plist
  21. BIN
      Libraries external/Realm/RealmSwift.framework/Modules/RealmSwift.swiftmodule/arm.swiftdoc
  22. BIN
      Libraries external/Realm/RealmSwift.framework/Modules/RealmSwift.swiftmodule/arm.swiftmodule
  23. BIN
      Libraries external/Realm/RealmSwift.framework/Modules/RealmSwift.swiftmodule/arm64.swiftdoc
  24. BIN
      Libraries external/Realm/RealmSwift.framework/Modules/RealmSwift.swiftmodule/arm64.swiftmodule
  25. BIN
      Libraries external/Realm/RealmSwift.framework/Modules/RealmSwift.swiftmodule/i386.swiftdoc
  26. BIN
      Libraries external/Realm/RealmSwift.framework/Modules/RealmSwift.swiftmodule/i386.swiftmodule
  27. BIN
      Libraries external/Realm/RealmSwift.framework/Modules/RealmSwift.swiftmodule/x86_64.swiftdoc
  28. BIN
      Libraries external/Realm/RealmSwift.framework/Modules/RealmSwift.swiftmodule/x86_64.swiftmodule
  29. 2 2
      Libraries external/Realm/RealmSwift.framework/Modules/module.modulemap
  30. BIN
      Libraries external/Realm/RealmSwift.framework/RealmSwift
  31. 515 510
      Nextcloud.xcodeproj/project.pbxproj
  32. 2 3
      Share/CCloadItemData.swift
  33. 2 2
      iOSClient/Actions/CCActions.swift
  34. 2 2
      iOSClient/Brand/File_Provider_Extension.plist
  35. 6 5
      iOSClient/Brand/NCBrand.swift
  36. 2 2
      iOSClient/Brand/Notification_Service_Extension.plist
  37. 2 2
      iOSClient/Brand/Share.plist
  38. 2 2
      iOSClient/Brand/iOSClient.plist
  39. 23 23
      iOSClient/Create/CCCreateCloud.swift
  40. 1 1
      iOSClient/Favorites/CCFavorites.m
  41. 9 20
      iOSClient/Library/MWPhotoBrowser/MWPhotoBrowser.m
  42. 2 0
      iOSClient/Library/OCCommunicationLib/OCCommunication.h
  43. 40 0
      iOSClient/Library/OCCommunicationLib/OCCommunication.m
  44. 3 0
      iOSClient/Library/OCCommunicationLib/OCFrameworkConstants.h
  45. 2 0
      iOSClient/Library/OCCommunicationLib/OCWebDavClient/OCWebDAVClient.h
  46. 16 0
      iOSClient/Library/OCCommunicationLib/OCWebDavClient/OCWebDAVClient.m
  47. 1 1
      iOSClient/Library/SwiftWebVC/SwiftModalWebVC.swift
  48. 8 8
      iOSClient/Library/SwiftWebVC/SwiftWebVC.swift
  49. 2 2
      iOSClient/Library/SwiftWebVC/SwiftWebVCActivity.swift
  50. 4 0
      iOSClient/Main/CCDetail.h
  51. 62 171
      iOSClient/Main/CCDetail.m
  52. 39 15
      iOSClient/Main/CCMain.m
  53. 1 1
      iOSClient/Main/CCMore.swift
  54. 2 2
      iOSClient/Main/Main.storyboard
  55. 7 7
      iOSClient/Main/NCMainCommon.swift
  56. 8 2
      iOSClient/Move/CCMove.h
  57. 59 28
      iOSClient/Move/CCMove.m
  58. 6 6
      iOSClient/Move/CCMove.storyboard
  59. 2 2
      iOSClient/Networking/NCService.swift
  60. 1 0
      iOSClient/Networking/OCNetworking.h
  61. 85 51
      iOSClient/Networking/OCNetworking.m
  62. 2 2
      iOSClient/Notification/CCNotification.swift
  63. 0 65
      iOSClient/Richdocument/NCRichdocument.swift
  64. 2 2
      iOSClient/Scan/ScanCollectionView.swift
  65. 1 1
      iOSClient/Scan/WeScan/Common/QuadrilateralView.swift
  66. 1 1
      iOSClient/Scan/WeScan/Extensions/CGPoint+Utils.swift
  67. 1 1
      iOSClient/Scan/WeScan/ImageScannerController.swift
  68. 2 2
      iOSClient/Scan/WeScan/Scan/CloseButton.swift
  69. 2 2
      iOSClient/Scan/WeScan/Scan/ScannerViewController.swift
  70. 2 2
      iOSClient/Scan/WeScan/Scan/ShutterButton.swift
  71. 13 10
      iOSClient/Settings/CCAdvanced.m
  72. 2 2
      iOSClient/Settings/NCManageAutoUploadFileName.swift
  73. BIN
      iOSClient/Supporting Files/cs-CZ.lproj/BKPasscodeView.strings
  74. BIN
      iOSClient/Supporting Files/cs-CZ.lproj/CTAssetsPicker.strings
  75. BIN
      iOSClient/Supporting Files/cs-CZ.lproj/Error.strings
  76. BIN
      iOSClient/Supporting Files/cs-CZ.lproj/Intro.strings
  77. BIN
      iOSClient/Supporting Files/cs-CZ.lproj/Localizable.strings
  78. BIN
      iOSClient/Supporting Files/en-GB.lproj/Localizable.strings
  79. BIN
      iOSClient/Supporting Files/it.lproj/Localizable.strings
  80. BIN
      iOSClient/Supporting Files/sv.lproj/Localizable.strings
  81. 4 4
      iOSClient/Text/NCText.swift
  82. 2 1
      iOSClient/Utility/CCUtility.h
  83. 10 1
      iOSClient/Utility/CCUtility.m
  84. 145 0
      iOSClient/Viewer/NCViewerMedia.swift
  85. 142 0
      iOSClient/Viewer/NCViewerRichdocument.swift

+ 1 - 1
File Provider Extension/FileProviderData.swift

@@ -62,7 +62,7 @@ class FileProviderData: NSObject {
     
     func setupActiveAccount() -> Bool {
         
-        if CCUtility.getDisableFilesApp() {
+        if CCUtility.getDisableFilesApp() || NCBrandOptions.sharedInstance.disable_openin_file {
             return false
         }
         

Файлын зөрүү хэтэрхий том тул дарагдсан байна
+ 216 - 202
Libraries external/Realm/Realm.framework/402D8A9F-892F-3C5E-9154-6A540B74D63C.bcsymbolmap


+ 36 - 0
Libraries external/Realm/Realm.framework/CHANGELOG.md

@@ -1,3 +1,39 @@
+3.9.0 Release notes (2018-09-10)
+=============================================================
+
+### Enhancements
+
+* Expose RLMSyncUser.refreshToken publicly so that it can be used for custom
+  HTTP requests to Realm Object Server.
+* Add RLMSyncSession.connectionState, which reports whether the session is
+  currently connected to the Realm Object Server or if it is offline.
+* Add `-suspend` and `-resume` methods to `RLMSyncSession` to enable manually
+  pausing data synchronization.
+* Add support for limiting the number of objects matched by a query-based sync
+  subscription. This requires a server running ROS 3.10.1 or newer.
+
+### Bugfixes
+
+* Fix crash when getting the description of a `MigrationObject` which has
+  `List` properties.
+* Fix crash when calling `dynamicList()` on a `MigrationObject`.
+
+3.8.0 Release notes (2018-09-05)
+=============================================================
+
+### Enhancements
+
+* Remove some old and no longer applicable migration logic which created an
+  unencrypted file in the sync metadata directory containing a list of ROS URLs
+  connected to.
+* Add support for pinning SSL certificates used for https and realms
+  connections by setting `RLMSyncManager.sharedManager.pinnedCertificatePaths`
+  in obj-c and `SyncManager.shared.pinnedCertificatePaths` in Swift.
+
+### Bugfixes
+
+* Fix warnings when building Realm as a static framework with CocoaPods.
+
 3.7.6 Release notes (2018-08-08)
 =============================================================
 

Файлын зөрүү хэтэрхий том тул дарагдсан байна
+ 218 - 207
Libraries external/Realm/Realm.framework/D681F990-5480-3415-9F1A-940504AE6826.bcsymbolmap


+ 14 - 0
Libraries external/Realm/Realm.framework/Headers/RLMSyncConfiguration.h

@@ -39,6 +39,20 @@ NS_ASSUME_NONNULL_BEGIN
  */
 @property (nonatomic, readonly) NSURL *realmURL;
 
+/**
+ A local path to a file containing the trust anchors for SSL connections.
+
+ Only the certificates stored in the PEM file (or any certificates signed by it,
+ if the file contains a CA cert) will be accepted when initiating a connection
+ to a server. This prevents certain certain kinds of man-in-the-middle (MITM)
+ attacks, and can also be used to trust a self-signed certificate which would
+ otherwise be untrusted.
+
+ On macOS, the file may be in any of the formats supported by SecItemImport(),
+ including PEM and .cer (see SecExternalFormat for a complete list of possible
+ formats). On iOS and other platforms, only DER .cer files are supported.
+ */
+@property (nonatomic, nullable) NSURL *pinnedCertificateURL;
 
 /**
  Whether SSL certificate validation is enabled for the connection associated

+ 25 - 0
Libraries external/Realm/Realm.framework/Headers/RLMSyncManager.h

@@ -103,6 +103,31 @@ typedef void(^RLMSyncErrorReportingBlock)(NSError *, RLMSyncSession * _Nullable)
  */
 @property (nullable, nonatomic, copy) NSDictionary<NSString *, NSString *> *customRequestHeaders;
 
+/**
+ A map of hostname to file URL for pinned certificates to use for HTTPS requests.
+
+ When initiating a HTTPS connection to a server, if this dictionary contains an
+ entry for the server's hostname, only the certificates stored in the file (or
+ any certificates signed by it, if the file contains a CA cert) will be accepted
+ when initiating a connection to a server. This prevents certain certain kinds
+ of man-in-the-middle (MITM) attacks, and can also be used to trust a self-signed
+ certificate which would otherwise be untrusted.
+
+ On macOS, the certificate files may be in any of the formats supported by
+ SecItemImport(), including PEM and .cer (see SecExternalFormat for a complete
+ list of possible formats). On iOS and other platforms, only DER .cer files are
+ supported.
+
+ For example, to pin example.com to a .cer file included in your bundle:
+
+ <pre>
+ RLMSyncManager.sharedManager.pinnedCertificatePaths = @{
+    @"example.com": [NSBundle.mainBundle pathForResource:@"example.com" ofType:@"cer"]
+ };
+ </pre>
+ */
+@property (nullable, nonatomic, copy) NSDictionary<NSString *, NSURL *> *pinnedCertificatePaths;
+
 /// The sole instance of the singleton.
 + (instancetype)sharedManager NS_REFINED_FOR_SWIFT;
 

+ 46 - 2
Libraries external/Realm/Realm.framework/Headers/RLMSyncSession.h

@@ -24,14 +24,33 @@
  The current state of the session represented by a session object.
  */
 typedef NS_ENUM(NSUInteger, RLMSyncSessionState) {
-    /// The sync session is bound to the Realm Object Server and communicating with it.
+    /// The sync session is actively communicating or attempting to communicate
+    /// with the Realm Object Server. A session is considered Active even if
+    /// it is not currently connected. Check the connection state instead if you
+    /// wish to know if the connection is currently online.
     RLMSyncSessionStateActive,
-    /// The sync session is not currently communicating with the Realm Object Server.
+    /// The sync session is not attempting to communicate with the Realm Object
+    /// Server, due to the user logging out or synchronization being paused.
     RLMSyncSessionStateInactive,
     /// The sync session encountered a fatal error and is permanently invalid; it should be discarded.
     RLMSyncSessionStateInvalid
 };
 
+/**
+ The current state of a sync session's connection. Sessions which are not in
+ the Active state will always be Disconnected.
+ */
+typedef NS_ENUM(NSUInteger, RLMSyncConnectionState) {
+    /// The sync session is not connected to the server, and is not attempting
+    /// to connect, either because the session is inactive or because it is
+    /// waiting to retry after a failed connection.
+    RLMSyncConnectionStateDisconnected,
+    /// The sync session is attempting to connect to the Realm Object Server.
+    RLMSyncConnectionStateConnecting,
+    /// The sync session is currently connected to the Realm Object Server.
+    RLMSyncConnectionStateConnected,
+};
+
 /**
  The transfer direction (upload or download) tracked by a given progress notification block.
 
@@ -105,8 +124,17 @@ NS_ASSUME_NONNULL_BEGIN
 @interface RLMSyncSession : NSObject
 
 /// The session's current state.
+///
+/// This property is not KVO-compliant.
 @property (nonatomic, readonly) RLMSyncSessionState state;
 
+/// The session's current connection state.
+///
+/// This property is KVO-compliant and can be observed to be notified of changes.
+/// Be warned that KVO observers for this property may be called on a background
+/// thread.
+@property (atomic, readonly) RLMSyncConnectionState connectionState;
+
 /// The Realm Object Server URL of the remote Realm this session corresponds to.
 @property (nullable, nonatomic, readonly) NSURL *realmURL;
 
@@ -119,6 +147,22 @@ NS_ASSUME_NONNULL_BEGIN
  */
 - (nullable RLMSyncConfiguration *)configuration;
 
+/**
+ Temporarily suspend syncronization and disconnect from the server.
+
+ The session will not attempt to connect to Realm Object Server until `resume`
+ is called or the Realm file is closed and re-opened.
+ */
+- (void)suspend;
+
+/**
+ Resume syncronization and reconnect to Realm Object Server after suspending.
+
+ This is a no-op if the session was already active or if the session is invalid.
+ Newly created sessions begin in the Active state and do not need to be resumed.
+ */
+- (void)resume;
+
 /**
  Register a progress notification block.
 

+ 58 - 1
Libraries external/Realm/Realm.framework/Headers/RLMSyncSubscription.h

@@ -115,6 +115,14 @@ typedef NS_ENUM(NSInteger, RLMSyncSubscriptionState) {
 /**
  Subscribe to the query represented by this `RLMResults`.
 
+ Subscribing to a query asks the server to synchronize all objects to the
+ client which match the query, along with all objects which are reachable
+ from those objects via links. This happens asynchronously, and the local
+ client Realm may not immediately have all objects which match the query.
+ Observe the `state` property of the returned subscription object to be
+ notified of when the subscription has been processed by the server and
+ all objects matching the query are available.
+
  The subscription will not be explicitly named.
 
  @return The subscription
@@ -126,13 +134,62 @@ typedef NS_ENUM(NSInteger, RLMSyncSubscriptionState) {
 /**
  Subscribe to the query represented by this `RLMResults`.
 
+ Subscribing to a query asks the server to synchronize all objects to the
+ client which match the query, along with all objects which are reachable
+ from those objects via links. This happens asynchronously, and the local
+ client Realm may not immediately have all objects which match the query.
+ Observe the `state` property of the returned subscription object to be
+ notified of when the subscription has been processed by the server and
+ all objects matching the query are available.
+
+ Creating a new subscription with the same name and query as an existing
+ subscription will not create a new subscription, but instead will return
+ an object referring to the existing sync subscription. This means that
+ performing the same subscription twice followed by removing it once will
+ result in no subscription existing.
+
  @param subscriptionName The name of the subscription
 
  @return The subscription
 
  @see RLMSyncSubscription
 */
-- (RLMSyncSubscription *)subscribeWithName:(NSString *)subscriptionName;
+- (RLMSyncSubscription *)subscribeWithName:(nullable NSString *)subscriptionName;
+
+/**
+ Subscribe to a subset of the query represented by this `RLMResults`.
+
+ Subscribing to a query asks the server to synchronize all objects to the
+ client which match the query, along with all objects which are reachable
+ from those objects via links. This happens asynchronously, and the local
+ client Realm may not immediately have all objects which match the query.
+ Observe the `state` property of the returned subscription object to be
+ notified of when the subscription has been processed by the server and
+ all objects matching the query are available.
+
+ Creating a new subscription with the same name and query as an existing
+ subscription will not create a new subscription, but instead will return
+ an object referring to the existing sync subscription. This means that
+ performing the same subscription twice followed by removing it once will
+ result in no subscription existing.
+
+ The number of top-level matches may optionally be limited. This limit
+ respects the sort and distinct order of the query being subscribed to,
+ if any. Please note that the limit does not count or apply to objects
+ which are added indirectly due to being linked to by the objects in the
+ subscription. If the limit is larger than the number of objects which
+ match the query, all objects will be included. Limiting a subscription
+ requires ROS 3.10.1 or newer, and will fail with an invalid predicate
+ error with older versions.
+
+ @param subscriptionName The name of the subscription
+ @param limit The maximum number of objects to include in the subscription.
+
+ @return The subscription
+
+ @see RLMSyncSubscription
+ */
+- (RLMSyncSubscription *)subscribeWithName:(nullable NSString *)subscriptionName limit:(NSUInteger)limit;
 @end
 
 NS_ASSUME_NONNULL_END

+ 8 - 0
Libraries external/Realm/Realm.framework/Headers/RLMSyncUser.h

@@ -96,6 +96,14 @@ NS_ASSUME_NONNULL_BEGIN
  */
 @property (nullable, nonatomic, readonly) NSString *identity;
 
+/**
+ The user's refresh token used to access the Realm Object Server.
+
+ This is required to make HTTP requests to Realm Object Server's REST API
+ for functionality not exposed natively. It should be treated as sensitive data.
+ */
+@property (nullable, nonatomic, readonly) NSString *refreshToken;
+
 /**
  The URL of the authentication server this user will communicate with.
  */

BIN
Libraries external/Realm/Realm.framework/Info.plist


+ 2 - 1
Libraries external/Realm/Realm.framework/PrivateHeaders/RLMSyncConfiguration_Private.h

@@ -33,7 +33,8 @@ typedef NS_ENUM(NSUInteger, RLMSyncStopPolicy) {
                    isPartial:(BOOL)isPartial
                    urlPrefix:(nullable NSString *)urlPrefix
                   stopPolicy:(RLMSyncStopPolicy)stopPolicy
-         enableSSLValidation:(BOOL)enableSSLValidation;
+         enableSSLValidation:(BOOL)enableSSLValidation
+             certificatePath:(nullable NSURL *)certificatePath;
 
 @property (nonatomic, readwrite) RLMSyncStopPolicy stopPolicy;
 

BIN
Libraries external/Realm/Realm.framework/Realm


Файлын зөрүү хэтэрхий том тул дарагдсан байна
+ 0 - 494
Libraries external/Realm/RealmSwift.framework/0A85D1C9-A4CC-36AF-8CCA-4A34B492531A.bcsymbolmap


Файлын зөрүү хэтэрхий том тул дарагдсан байна
+ 216 - 202
Libraries external/Realm/RealmSwift.framework/402D8A9F-892F-3C5E-9154-6A540B74D63C.bcsymbolmap


Файлын зөрүү хэтэрхий том тул дарагдсан байна
+ 894 - 0
Libraries external/Realm/RealmSwift.framework/5C573639-1261-3D04-A749-BD077CE893DF.bcsymbolmap


Файлын зөрүү хэтэрхий том тул дарагдсан байна
+ 889 - 0
Libraries external/Realm/RealmSwift.framework/CC1F1DA4-4D64-3ED7-B9CC-C4E9B9DED5B8.bcsymbolmap


Файлын зөрүү хэтэрхий том тул дарагдсан байна
+ 218 - 207
Libraries external/Realm/RealmSwift.framework/D681F990-5480-3415-9F1A-940504AE6826.bcsymbolmap


Файлын зөрүү хэтэрхий том тул дарагдсан байна
+ 0 - 494
Libraries external/Realm/RealmSwift.framework/F141265C-71B9-3F69-9ED6-18AB64CAB929.bcsymbolmap


+ 8 - 8
Libraries external/Realm/RealmSwift.framework/Headers/RealmSwift-Swift.h

@@ -1,4 +1,4 @@
-// Generated by Apple Swift version 4.1 (swiftlang-902.0.48 clang-902.0.37.1)
+// Generated by Apple Swift version 4.2 (swiftlang-1000.11.37.1 clang-1000.11.45.1)
 #pragma clang diagnostic push
 #pragma clang diagnostic ignored "-Wgcc-compat"
 
@@ -129,17 +129,17 @@ typedef unsigned int swift_uint4  __attribute__((__ext_vector_type__(4)));
 #endif
 #if !defined(SWIFT_ENUM_ATTR)
 # if defined(__has_attribute) && __has_attribute(enum_extensibility)
-#  define SWIFT_ENUM_ATTR __attribute__((enum_extensibility(open)))
+#  define SWIFT_ENUM_ATTR(_extensibility) __attribute__((enum_extensibility(_extensibility)))
 # else
-#  define SWIFT_ENUM_ATTR
+#  define SWIFT_ENUM_ATTR(_extensibility)
 # endif
 #endif
 #if !defined(SWIFT_ENUM)
-# define SWIFT_ENUM(_type, _name) enum _name : _type _name; enum SWIFT_ENUM_ATTR SWIFT_ENUM_EXTRA _name : _type
+# define SWIFT_ENUM(_type, _name, _extensibility) enum _name : _type _name; enum SWIFT_ENUM_ATTR(_extensibility) SWIFT_ENUM_EXTRA _name : _type
 # if __has_feature(generalized_swift_name)
-#  define SWIFT_ENUM_NAMED(_type, _name, SWIFT_NAME) enum _name : _type _name SWIFT_COMPILE_NAME(SWIFT_NAME); enum SWIFT_COMPILE_NAME(SWIFT_NAME) SWIFT_ENUM_ATTR SWIFT_ENUM_EXTRA _name : _type
+#  define SWIFT_ENUM_NAMED(_type, _name, SWIFT_NAME, _extensibility) enum _name : _type _name SWIFT_COMPILE_NAME(SWIFT_NAME); enum SWIFT_COMPILE_NAME(SWIFT_NAME) SWIFT_ENUM_ATTR(_extensibility) SWIFT_ENUM_EXTRA _name : _type
 # else
-#  define SWIFT_ENUM_NAMED(_type, _name, SWIFT_NAME) SWIFT_ENUM(_type, _name)
+#  define SWIFT_ENUM_NAMED(_type, _name, SWIFT_NAME, _extensibility) SWIFT_ENUM(_type, _name, _extensibility)
 # endif
 #endif
 #if !defined(SWIFT_UNAVAILABLE)
@@ -163,9 +163,9 @@ typedef unsigned int swift_uint4  __attribute__((__ext_vector_type__(4)));
 # define SWIFT_DEPRECATED_OBJC(Msg) SWIFT_DEPRECATED_MSG(Msg)
 #endif
 #if __has_feature(modules)
-@import Realm;
-@import ObjectiveC;
 @import Foundation;
+@import ObjectiveC;
+@import Realm;
 @import Realm.Private;
 #endif
 

BIN
Libraries external/Realm/RealmSwift.framework/Info.plist


BIN
Libraries external/Realm/RealmSwift.framework/Modules/RealmSwift.swiftmodule/arm.swiftdoc


BIN
Libraries external/Realm/RealmSwift.framework/Modules/RealmSwift.swiftmodule/arm.swiftmodule


BIN
Libraries external/Realm/RealmSwift.framework/Modules/RealmSwift.swiftmodule/arm64.swiftdoc


BIN
Libraries external/Realm/RealmSwift.framework/Modules/RealmSwift.swiftmodule/arm64.swiftmodule


BIN
Libraries external/Realm/RealmSwift.framework/Modules/RealmSwift.swiftmodule/i386.swiftdoc


BIN
Libraries external/Realm/RealmSwift.framework/Modules/RealmSwift.swiftmodule/i386.swiftmodule


BIN
Libraries external/Realm/RealmSwift.framework/Modules/RealmSwift.swiftmodule/x86_64.swiftdoc


BIN
Libraries external/Realm/RealmSwift.framework/Modules/RealmSwift.swiftmodule/x86_64.swiftmodule


+ 2 - 2
Libraries external/Realm/RealmSwift.framework/Modules/module.modulemap

@@ -1,4 +1,4 @@
 framework module RealmSwift {
-    header "RealmSwift-Swift.h"
-    requires objc
+  header "RealmSwift-Swift.h"
+  requires objc
 }

BIN
Libraries external/Realm/RealmSwift.framework/RealmSwift


Файлын зөрүү хэтэрхий том тул дарагдсан байна
+ 515 - 510
Nextcloud.xcodeproj/project.pbxproj


+ 2 - 3
Share/CCloadItemData.swift

@@ -36,7 +36,7 @@ class CCloadItemData: NSObject {
             
             for item : NSExtensionItem in inputItems {
                 
-                if let attachments = item.attachments as? [NSItemProvider] {
+                if let attachments = item.attachments {
                     
                     if attachments.isEmpty {
                         
@@ -65,7 +65,7 @@ class CCloadItemData: NSObject {
                                         
                                         print("item as UIImage")
                                         
-                                        if let pngImageData = UIImagePNGRepresentation(image) {
+                                        if let pngImageData = image.pngData() {
                                         
                                             let fileName = "\(dateFormatter.string(from: Date()))\(conuter).png"
                                             let filenamePath = directory + "/" + fileName
@@ -167,7 +167,6 @@ class CCloadItemData: NSObject {
                                     
                                 } else {
                                     
-                                    print("ERROR: \(error)")
                                     hud.performSelector(onMainThread: #selector(CCHud.hideHud), with: nil, waitUntilDone: false)
                                 }
                             })

+ 2 - 2
iOSClient/Actions/CCActions.swift

@@ -80,9 +80,9 @@ class CCActions: NSObject {
         
         ocNetworking?.readFile(fileName, serverUrl: serverUrl, account: self.appDelegate.activeAccount, success: { (metadata) in
                 
-            let alertController = UIAlertController(title: NSLocalizedString("_error_", comment: ""), message: NSLocalizedString("_file_already_exists_", comment: ""), preferredStyle: UIAlertControllerStyle.alert)
+            let alertController = UIAlertController(title: NSLocalizedString("_error_", comment: ""), message: NSLocalizedString("_file_already_exists_", comment: ""), preferredStyle: UIAlertController.Style.alert)
                 
-            let okAction = UIAlertAction(title: "OK", style: UIAlertActionStyle.default) {
+            let okAction = UIAlertAction(title: "OK", style: UIAlertAction.Style.default) {
                 (result : UIAlertAction) -> Void in
             }
                 

+ 2 - 2
iOSClient/Brand/File_Provider_Extension.plist

@@ -17,9 +17,9 @@
 	<key>CFBundlePackageType</key>
 	<string>XPC!</string>
 	<key>CFBundleShortVersionString</key>
-	<string>2.22.3</string>
+	<string>2.22.4</string>
 	<key>CFBundleVersion</key>
-	<string>12</string>
+	<string>0</string>
 	<key>NSExtension</key>
 	<dict>
 		<key>NSExtensionFileProviderDocumentGroup</key>

+ 6 - 5
iOSClient/Brand/NCBrand.swift

@@ -78,10 +78,10 @@ class NCBrandColor: NSObject {
     @objc public let linkLoginProvider:                 String = "https://nextcloud.com/providers"
     @objc public let textLoginProvider:                 String = "_login_bottom_label_"
     @objc public let middlewarePingUrl:                 String = ""
-    @objc public let webLoginAutenticationProtocol:     String = "nc://"                                          // example "abc://"
+    @objc public let webLoginAutenticationProtocol:     String = "nc://"                                            // example "abc://"
     // Personalized
-    @objc public let webCloseViewProtocolPersonalized:  String = ""                                               // example "abc://change/plan"      Don't touch me !!
-    @objc public let folderBrandAutoUpload:             String = ""                                               // example "_auto_upload_folder_"   Don't touch me !!
+    @objc public let webCloseViewProtocolPersonalized:  String = ""                                                 // example "abc://change/plan"      Don't touch me !!
+    @objc public let folderBrandAutoUpload:             String = ""                                                 // example "_auto_upload_folder_"   Don't touch me !!
 
     // Auto Upload default folder
     @objc public var folderDefaultAutoUpload:           String = "Photos"
@@ -90,7 +90,7 @@ class NCBrandColor: NSObject {
     @objc public let capabilitiesGroups:                String = "group.it.twsweb.Crypto-Cloud"
     
     // Options
-    @objc public let use_login_web_personalized:        Bool = false                                              // Don't touch me !!
+    @objc public let use_login_web_personalized:        Bool = false                                                // Don't touch me !!
     @objc public let use_default_auto_upload:           Bool = false
     @objc public let use_themingColor:                  Bool = true
     @objc public let use_themingBackground:             Bool = true
@@ -103,7 +103,8 @@ class NCBrandColor: NSObject {
     @objc public let disable_multiaccount:              Bool = false
     @objc public let disable_manage_account:            Bool = false
     @objc public let disable_more_external_site:        Bool = false
-    
+    @objc public let disable_openin_file:               Bool = false
+
     override init() {
         
         if folderBrandAutoUpload != "" {

+ 2 - 2
iOSClient/Brand/Notification_Service_Extension.plist

@@ -17,9 +17,9 @@
 	<key>CFBundlePackageType</key>
 	<string>XPC!</string>
 	<key>CFBundleShortVersionString</key>
-	<string>2.22.3</string>
+	<string>2.22.4</string>
 	<key>CFBundleVersion</key>
-	<string>12</string>
+	<string>0</string>
 	<key>NSExtension</key>
 	<dict>
 		<key>NSExtensionPointIdentifier</key>

+ 2 - 2
iOSClient/Brand/Share.plist

@@ -17,9 +17,9 @@
 	<key>CFBundlePackageType</key>
 	<string>XPC!</string>
 	<key>CFBundleShortVersionString</key>
-	<string>2.22.3</string>
+	<string>2.22.4</string>
 	<key>CFBundleVersion</key>
-	<string>12</string>
+	<string>0</string>
 	<key>NSAppTransportSecurity</key>
 	<dict>
 		<key>NSAllowsArbitraryLoads</key>

+ 2 - 2
iOSClient/Brand/iOSClient.plist

@@ -46,7 +46,7 @@
 	<key>CFBundlePackageType</key>
 	<string>APPL</string>
 	<key>CFBundleShortVersionString</key>
-	<string>2.22.3</string>
+	<string>2.22.4</string>
 	<key>CFBundleSignature</key>
 	<string>????</string>
 	<key>CFBundleURLTypes</key>
@@ -69,7 +69,7 @@
 		</dict>
 	</array>
 	<key>CFBundleVersion</key>
-	<string>12</string>
+	<string>0</string>
 	<key>FIREBASE_ANALYTICS_COLLECTION_DEACTIVATED</key>
 	<true/>
 	<key>Fabric</key>

+ 23 - 23
iOSClient/Create/CCCreateCloud.swift

@@ -29,10 +29,10 @@ class CreateMenuAdd: NSObject {
     
     let appDelegate = UIApplication.shared.delegate as! AppDelegate
 
-    let fontButton = [NSAttributedStringKey.font:UIFont(name: "HelveticaNeue", size: 16)!, NSAttributedStringKey.foregroundColor: UIColor.black]
-    let fontEncrypted = [NSAttributedStringKey.font:UIFont(name: "HelveticaNeue", size: 16)!, NSAttributedStringKey.foregroundColor: NCBrandColor.sharedInstance.encrypted as UIColor]
-    let fontCancel = [NSAttributedStringKey.font:UIFont(name: "HelveticaNeue-Bold", size: 17)!, NSAttributedStringKey.foregroundColor: UIColor.black]
-    let fontDisable = [NSAttributedStringKey.font:UIFont(name: "HelveticaNeue", size: 16)!, NSAttributedStringKey.foregroundColor: UIColor.darkGray]
+    let fontButton = [NSAttributedString.Key.font:UIFont(name: "HelveticaNeue", size: 16)!, NSAttributedString.Key.foregroundColor: UIColor.black]
+    let fontEncrypted = [NSAttributedString.Key.font:UIFont(name: "HelveticaNeue", size: 16)!, NSAttributedString.Key.foregroundColor: NCBrandColor.sharedInstance.encrypted as UIColor]
+    let fontCancel = [NSAttributedString.Key.font:UIFont(name: "HelveticaNeue-Bold", size: 17)!, NSAttributedString.Key.foregroundColor: UIColor.black]
+    let fontDisable = [NSAttributedString.Key.font:UIFont(name: "HelveticaNeue", size: 16)!, NSAttributedString.Key.foregroundColor: UIColor.darkGray]
 
     let colorLightGray = UIColor(red: 250.0/255.0, green: 250.0/255.0, blue: 250.0/255.0, alpha: 1)
     let colorGray = UIColor(red: 150.0/255.0, green: 150.0/255.0, blue: 150.0/255.0, alpha: 1)
@@ -308,8 +308,8 @@ class CreateFormUploadAssets: XLFormViewController, CCMoveDelegate {
         
         super.viewDidLoad()
         
-        let cancelButton : UIBarButtonItem = UIBarButtonItem(title: NSLocalizedString("_cancel_", comment: ""), style: UIBarButtonItemStyle.plain, target: self, action: #selector(cancel))
-        let saveButton : UIBarButtonItem = UIBarButtonItem(title: NSLocalizedString("_save_", comment: ""), style: UIBarButtonItemStyle.plain, target: self, action: #selector(save))
+        let cancelButton : UIBarButtonItem = UIBarButtonItem(title: NSLocalizedString("_cancel_", comment: ""), style: UIBarButtonItem.Style.plain, target: self, action: #selector(cancel))
+        let saveButton : UIBarButtonItem = UIBarButtonItem(title: NSLocalizedString("_save_", comment: ""), style: UIBarButtonItem.Style.plain, target: self, action: #selector(save))
         
         self.navigationItem.leftBarButtonItem = cancelButton
         self.navigationItem.rightBarButtonItem = saveButton
@@ -317,9 +317,9 @@ class CreateFormUploadAssets: XLFormViewController, CCMoveDelegate {
         self.navigationController?.navigationBar.isTranslucent = false
         self.navigationController?.navigationBar.barTintColor = NCBrandColor.sharedInstance.brand
         self.navigationController?.navigationBar.tintColor = NCBrandColor.sharedInstance.brandText
-        self.navigationController?.navigationBar.titleTextAttributes = [NSAttributedStringKey.foregroundColor: NCBrandColor.sharedInstance.brandText]
+        self.navigationController?.navigationBar.titleTextAttributes = [NSAttributedString.Key.foregroundColor: NCBrandColor.sharedInstance.brandText]
         
-        self.tableView.separatorStyle = UITableViewCellSeparatorStyle.none
+        self.tableView.separatorStyle = UITableViewCell.SeparatorStyle.none
         
         self.reloadForm()
     }
@@ -408,18 +408,18 @@ class CreateFormUploadAssets: XLFormViewController, CCMoveDelegate {
                 CCUtility.setFileNameMask(valueRename, key: k_keyFileNameMask)
                 self.form.delegate = self
                 
-                returnString = CCUtility.createFileName(asset.value(forKey: "filename"), fileDate: asset.creationDate, fileType: asset.mediaType, keyFileName: k_keyFileNameMask, keyFileNameType: k_keyFileNameType, keyFileNameOriginal: k_keyFileNameOriginal)
+                returnString = CCUtility.createFileName(asset.value(forKey: "filename") as! String?, fileDate: asset.creationDate, fileType: asset.mediaType, keyFileName: k_keyFileNameMask, keyFileNameType: k_keyFileNameType, keyFileNameOriginal: k_keyFileNameOriginal)
                 
             } else {
                 
                 CCUtility.setFileNameMask("", key: k_keyFileNameMask)
-                returnString = CCUtility.createFileName(asset.value(forKey: "filename"), fileDate: asset.creationDate, fileType: asset.mediaType, keyFileName: nil, keyFileNameType: k_keyFileNameType, keyFileNameOriginal: k_keyFileNameOriginal)
+                returnString = CCUtility.createFileName(asset.value(forKey: "filename") as! String?, fileDate: asset.creationDate, fileType: asset.mediaType, keyFileName: nil, keyFileNameType: k_keyFileNameType, keyFileNameOriginal: k_keyFileNameOriginal)
             }
             
         } else {
             
             CCUtility.setFileNameMask("", key: k_keyFileNameMask)
-            returnString = CCUtility.createFileName(asset.value(forKey: "filename"), fileDate: asset.creationDate, fileType: asset.mediaType, keyFileName: nil, keyFileNameType: k_keyFileNameType, keyFileNameOriginal: k_keyFileNameOriginal)
+            returnString = CCUtility.createFileName(asset.value(forKey: "filename") as! String?, fileDate: asset.creationDate, fileType: asset.mediaType, keyFileName: nil, keyFileNameType: k_keyFileNameType, keyFileNameOriginal: k_keyFileNameOriginal)
         }
         
         return String(format: NSLocalizedString("_preview_filename_", comment: ""), "MM,MMM,DD,YY,YYYY and HH,hh,mm,ss,ampm") + ":" + "\n\n" + returnString
@@ -530,7 +530,7 @@ class CreateFormUploadFileText: XLFormViewController, CCMoveDelegate {
             self.form.delegate = nil
             
             if let fileNameNew = formRow.value {
-                 self.fileName = CCUtility.removeForbiddenCharactersServer(fileNameNew as! String)
+                 self.fileName = CCUtility.removeForbiddenCharactersServer(fileNameNew as? String)
             }
         
             formRow.value = self.fileName
@@ -548,15 +548,15 @@ class CreateFormUploadFileText: XLFormViewController, CCMoveDelegate {
         
         super.viewDidLoad()
         
-        let saveButton : UIBarButtonItem = UIBarButtonItem(title: NSLocalizedString("_save_", comment: ""), style: UIBarButtonItemStyle.plain, target: self, action: #selector(save))
+        let saveButton : UIBarButtonItem = UIBarButtonItem(title: NSLocalizedString("_save_", comment: ""), style: UIBarButtonItem.Style.plain, target: self, action: #selector(save))
         self.navigationItem.rightBarButtonItem = saveButton
         
         self.navigationController?.navigationBar.isTranslucent = false
         self.navigationController?.navigationBar.barTintColor = NCBrandColor.sharedInstance.brand
         self.navigationController?.navigationBar.tintColor = NCBrandColor.sharedInstance.brandText
-        self.navigationController?.navigationBar.titleTextAttributes = [NSAttributedStringKey.foregroundColor: NCBrandColor.sharedInstance.brandText]
+        self.navigationController?.navigationBar.titleTextAttributes = [NSAttributedString.Key.foregroundColor: NCBrandColor.sharedInstance.brandText]
         
-        self.tableView.separatorStyle = UITableViewCellSeparatorStyle.none
+        self.tableView.separatorStyle = UITableViewCell.SeparatorStyle.none
     }
     
     // MARK: - Action
@@ -691,7 +691,7 @@ class CreateFormUploadScanDocument: XLFormViewController, CCMoveDelegate {
     var serverUrl = ""
     var titleServerUrl = ""
     var arrayImages = [UIImage]()
-    var fileName = "scan.pdf"
+    var fileName = CCUtility.createFileNameDate("scan", extension: "pdf")
     var password : PDFPassword = ""
     var compressionQuality: Double = 0.5
     var fileType = "PDF"
@@ -870,7 +870,7 @@ class CreateFormUploadScanDocument: XLFormViewController, CCMoveDelegate {
                 return
             }
             if name as! String == "" {
-                name = "scan"
+                name = CCUtility.createFileNameDate("scan", extension: "pdf")
             }
             
             let ext = (name as! NSString).pathExtension.uppercased()
@@ -905,15 +905,15 @@ class CreateFormUploadScanDocument: XLFormViewController, CCMoveDelegate {
         
         super.viewDidLoad()
         
-        let saveButton : UIBarButtonItem = UIBarButtonItem(title: NSLocalizedString("_save_", comment: ""), style: UIBarButtonItemStyle.plain, target: self, action: #selector(save))
+        let saveButton : UIBarButtonItem = UIBarButtonItem(title: NSLocalizedString("_save_", comment: ""), style: UIBarButtonItem.Style.plain, target: self, action: #selector(save))
         self.navigationItem.rightBarButtonItem = saveButton
         
         self.navigationController?.navigationBar.isTranslucent = false
         self.navigationController?.navigationBar.barTintColor = NCBrandColor.sharedInstance.brand
         self.navigationController?.navigationBar.tintColor = NCBrandColor.sharedInstance.brandText
-        self.navigationController?.navigationBar.titleTextAttributes = [NSAttributedStringKey.foregroundColor: NCBrandColor.sharedInstance.brandText]
+        self.navigationController?.navigationBar.titleTextAttributes = [NSAttributedString.Key.foregroundColor: NCBrandColor.sharedInstance.brandText]
         
-        self.tableView.separatorStyle = UITableViewCellSeparatorStyle.none
+        self.tableView.separatorStyle = UITableViewCell.SeparatorStyle.none
 //        self.tableView.sectionHeaderHeight = 10
 //        self.tableView.sectionFooterHeight = 10
 //        self.tableView.backgroundColor = NCBrandColor.sharedInstance.backgroundView
@@ -1005,7 +1005,7 @@ class CreateFormUploadScanDocument: XLFormViewController, CCMoveDelegate {
 
             //Generate PDF
             for image in self.arrayImages {
-                guard let data = UIImageJPEGRepresentation(image, CGFloat(compressionQuality)) else {
+                guard let data = image.jpegData(compressionQuality: CGFloat(compressionQuality)) else {
                     self.appDelegate.messageNotification("_error_", description: "_error_creation_file_", visible: true, delay: TimeInterval(k_dismissAfterSecond), type: TWMessageBarMessageType.info, errorCode: 0)
                     return
                 }
@@ -1023,7 +1023,7 @@ class CreateFormUploadScanDocument: XLFormViewController, CCMoveDelegate {
         
         if fileType == "JPG" {
             
-            guard let data = UIImageJPEGRepresentation(self.arrayImages[0], CGFloat(compressionQuality)) else {
+            guard let data = self.arrayImages[0].jpegData(compressionQuality: CGFloat(compressionQuality)) else {
                 self.appDelegate.messageNotification("_error_", description: "_error_creation_file_", visible: true, delay: TimeInterval(k_dismissAfterSecond), type: TWMessageBarMessageType.info, errorCode: 0)
                 return
             }
@@ -1123,7 +1123,7 @@ class NCCreateScanDocument : NSObject, ImageScannerControllerDelegate {
         }
         
         do {
-            try UIImagePNGRepresentation(image)?.write(to: NSURL.fileURL(withPath: fileNamePath), options: .atomic)
+            try image.pngData()?.write(to: NSURL.fileURL(withPath: fileNamePath), options: .atomic)
         } catch { }
         
         scanner.dismiss(animated: true, completion: {

+ 1 - 1
iOSClient/Favorites/CCFavorites.m

@@ -506,7 +506,7 @@
     }];
     
     // NO Directory
-    if (metadata.directory == NO) {
+    if (metadata.directory == NO && [NCBrandOptions sharedInstance].disable_openin_file == NO) {
         
         [actionSheet addButtonWithTitle:NSLocalizedString(@"_open_in_", nil) image:[CCGraphics changeThemingColorImage:[UIImage imageNamed:@"openFile"] multiplier:2 color:[NCBrandColor sharedInstance].brandElement] backgroundColor:[NCBrandColor sharedInstance].backgroundView height: 50.0 type:AHKActionSheetButtonTypeDefault handler:^(AHKActionSheet *as) {
             [self.tableView setEditing:NO animated:YES];

+ 9 - 20
iOSClient/Library/MWPhotoBrowser/MWPhotoBrowser.m

@@ -248,29 +248,18 @@ static void * MWVideoPlayerObservation = &MWVideoPlayerObservation;
         [items addObject:flexSpace];
     }
 
-    // Right - Action
+    if (_deleteButton) {
+        [items addObject:_deleteButton];
+        [items addObject:fixedSpaceMini];
+    }
+    if (_shareButton) {
+        [items addObject:_shareButton];
+        [items addObject:fixedSpaceMini];
+    }
     if (_actionButton) {
-        
-        if (_deleteButton) {
-            
-            [items addObject:_deleteButton];
-            [items addObject:fixedSpaceMini];
-        }
-        if (_shareButton) {
-            
-            [items addObject:_shareButton];
-            [items addObject:fixedSpaceMini];
-        }
         [items addObject:_actionButton];
-        
-    } else {
-        
-        // We're not showing the toolbar so try and show in top right
-        if (_actionButton)
-            self.navigationItem.rightBarButtonItem = _actionButton;
-        [items addObject:fixedSpace];
     }
-
+    
     // Toolbar visibility
     [_toolbar setItems:items];
     BOOL hideToolbar = YES;

+ 2 - 0
iOSClient/Library/OCCommunicationLib/OCCommunication.h

@@ -949,6 +949,8 @@ typedef enum {
 
 - (void)createLinkRichdocuments:(NSString *)serverPath fileID:(NSString *)fileID onCommunication:(OCCommunication *)sharedOCComunication successRequest:(void(^)(NSHTTPURLResponse *response, NSString *link, NSString *redirectedServer))successRequest  failureRequest:(void(^)(NSHTTPURLResponse *response, NSError *error, NSString *redirectedServer)) failureRequest;
 
+- (void)createAssetRichdocuments:(NSString *)serverPath path:(NSString *)path onCommunication:(OCCommunication *)sharedOCComunication successRequest:(void(^)(NSHTTPURLResponse *response, NSString *url, NSString *redirectedServer))successRequest failureRequest:(void(^)(NSHTTPURLResponse *response, NSError *error, NSString *redirectedServer)) failureRequest;
+
 @end
 
 

+ 40 - 0
iOSClient/Library/OCCommunicationLib/OCCommunication.m

@@ -2771,6 +2771,46 @@
     }];
 }
 
+- (void)createAssetRichdocuments:(NSString *)serverPath path:(NSString *)path onCommunication:(OCCommunication *)sharedOCComunication successRequest:(void(^)(NSHTTPURLResponse *response, NSString *url, NSString *redirectedServer))successRequest failureRequest:(void(^)(NSHTTPURLResponse *response, NSError *error, NSString *redirectedServer)) failureRequest {
+    
+    serverPath = [serverPath stringByAppendingString:k_url_insert_assets_to_collabora];
+    serverPath = [serverPath stringByAppendingString:@"?format=json"];
+    
+    OCWebDAVClient *request = [[OCWebDAVClient alloc] init];
+    request = [self getRequestWithCredentials:request];
+    
+    [request createAssetRichdocuments:serverPath path:path onCommunication:sharedOCComunication success:^(NSHTTPURLResponse *operation, id response) {
+        
+        NSData *responseData = (NSData*) response;
+        
+        //Parse
+        NSError *error;
+        NSDictionary *jsongParsed = [NSJSONSerialization JSONObjectWithData:responseData options:NSJSONReadingMutableContainers error:&error];
+        NSLog(@"[LOG] URL Asset : %@",jsongParsed);
+        
+        if (jsongParsed && jsongParsed.allKeys > 0) {
+            
+            if ([jsongParsed valueForKey:@"url"] && ![[jsongParsed valueForKey:@"url"] isKindOfClass:[NSNull class]]) {
+                    
+                NSString *url = [jsongParsed valueForKey:@"url"];
+                successRequest(response, url, request.redirectedServer);
+                    
+            } else {
+                failureRequest(response, [UtilsFramework getErrorWithCode:k_CCErrorWebdavResponseError andCustomMessageFromTheServer:NSLocalizedStringFromTable(@"_server_response_error_", @"Error", nil)], request.redirectedServer);
+            }
+                
+        } else {
+            failureRequest(response, [UtilsFramework getErrorWithCode:k_CCErrorWebdavResponseError andCustomMessageFromTheServer:NSLocalizedStringFromTable(@"_server_response_error_", @"Error", nil)], request.redirectedServer);
+        }
+        
+    } failure:^(NSHTTPURLResponse *response, NSData *responseData, NSError *error) {
+        
+        //Return error
+        failureRequest(response, error, request.redirectedServer);
+    }];
+}
+
+
 #pragma mark - Manage Mobile Editor OCS API
 
 - (void)eraseURLCache

+ 3 - 0
iOSClient/Library/OCCommunicationLib/OCFrameworkConstants.h

@@ -73,6 +73,9 @@
 //Url to access to Mobile Editor OCS API
 #define k_url_create_link_mobile_editor @"ocs/v2.php/apps/richdocuments/api/v1/document"
 
+//Url to insert files directly from your Nextcloud to a Collabora Online document
+#define k_url_insert_assets_to_collabora @"apps/richdocuments/assets"
+
 //Version of the server that have share API
 #define k_version_support_shared [NSArray arrayWithObjects:  @"5", @"0", @"27", nil]
 

+ 2 - 0
iOSClient/Library/OCCommunicationLib/OCWebDavClient/OCWebDAVClient.h

@@ -656,4 +656,6 @@ extern NSString * _Nullable OCWebDAVModificationDateKey;
 
 - (void)createLinkRichdocuments:(NSString *_Nonnull)serverPath fileID:(NSString * _Nonnull)fileID onCommunication:(OCCommunication * _Nonnull)sharedOCCommunication success:(void(^)(NSHTTPURLResponse *operation, id response))success failure:(void(^)(NSHTTPURLResponse *operation, id  _Nullable responseObject, NSError *error))failure;
 
+- (void)createAssetRichdocuments:(NSString *_Nonnull)serverPath path:(NSString *_Nonnull)path onCommunication:(OCCommunication *_Nonnull)sharedOCCommunication success:(void(^)(NSHTTPURLResponse *operation, id response))success failure:(void(^)(NSHTTPURLResponse *operation, id  _Nullable responseObject, NSError *error))failure;
+
 @end

+ 16 - 0
iOSClient/Library/OCCommunicationLib/OCWebDavClient/OCWebDAVClient.m

@@ -1190,6 +1190,22 @@ NSString const *OCWebDAVModificationDateKey	= @"modificationdate";
     [operation resume];
 }
 
+- (void)createAssetRichdocuments:(NSString *)serverPath path:(NSString *)path onCommunication:(OCCommunication *)sharedOCCommunication success:(void(^)(NSHTTPURLResponse *operation, id response))success failure:(void(^)(NSHTTPURLResponse *operation, id  _Nullable responseObject, NSError *error))failure {
+
+    NSParameterAssert(success);
+    
+    _requestMethod = @"POST";
+    
+    NSMutableURLRequest *request = [self sharedRequestWithMethod:_requestMethod path:serverPath parameters:nil timeout:k_timeout_webdav];
+    [request setValue:@"true" forHTTPHeaderField:@"OCS-APIRequest"];
+    [request setHTTPBody:[[NSString stringWithFormat: @"path=%@",path] dataUsingEncoding:NSUTF8StringEncoding]];
+    
+    OCHTTPRequestOperation *operation = [self mr_operationWithRequest:request onCommunication:sharedOCCommunication success:success failure:failure];
+    [self setRedirectionBlockOnDatataskWithOCCommunication:sharedOCCommunication andSessionManager:sharedOCCommunication.networkSessionManager];
+    
+    [operation resume];
+}
+
 #pragma mark - Manage Redirections
 
 - (void)setRedirectionBlockOnDatataskWithOCCommunication: (OCCommunication *) sharedOCCommunication andSessionManager:(AFURLSessionManager *) sessionManager{

+ 1 - 1
iOSClient/Library/SwiftWebVC/SwiftModalWebVC.swift

@@ -54,7 +54,7 @@ public class SwiftModalWebVC: UINavigationController {
         super.init(rootViewController: webViewController)
 
         let doneButton = UIBarButtonItem(image: SwiftWebVC.bundledImage(named: "SwiftWebVCDismiss"),
-                                         style: UIBarButtonItemStyle.plain,
+                                         style: UIBarButtonItem.Style.plain,
                                          target: webViewController,
                                          action: #selector(SwiftWebVC.doneButtonTapped))
     

+ 8 - 8
iOSClient/Library/SwiftWebVC/SwiftWebVC.swift

@@ -27,7 +27,7 @@ public class SwiftWebVC: UIViewController {
     
     lazy var backBarButtonItem: UIBarButtonItem =  {
         var tempBackBarButtonItem = UIBarButtonItem(image: SwiftWebVC.bundledImage(named: "SwiftWebVCBack"),
-                                                    style: UIBarButtonItemStyle.plain,
+                                                    style: UIBarButtonItem.Style.plain,
                                                     target: self,
                                                     action: #selector(SwiftWebVC.goBackTapped(_:)))
         tempBackBarButtonItem.width = 18.0
@@ -37,7 +37,7 @@ public class SwiftWebVC: UIViewController {
     
     lazy var forwardBarButtonItem: UIBarButtonItem =  {
         var tempForwardBarButtonItem = UIBarButtonItem(image: SwiftWebVC.bundledImage(named: "SwiftWebVCNext"),
-                                                       style: UIBarButtonItemStyle.plain,
+                                                       style: UIBarButtonItem.Style.plain,
                                                        target: self,
                                                        action: #selector(SwiftWebVC.goForwardTapped(_:)))
         tempForwardBarButtonItem.width = 18.0
@@ -46,7 +46,7 @@ public class SwiftWebVC: UIViewController {
     }()
     
     lazy var refreshBarButtonItem: UIBarButtonItem = {
-        var tempRefreshBarButtonItem = UIBarButtonItem(barButtonSystemItem: UIBarButtonSystemItem.refresh,
+        var tempRefreshBarButtonItem = UIBarButtonItem(barButtonSystemItem: UIBarButtonItem.SystemItem.refresh,
                                                        target: self,
                                                        action: #selector(SwiftWebVC.reloadTapped(_:)))
         tempRefreshBarButtonItem.tintColor = self.buttonColor
@@ -54,7 +54,7 @@ public class SwiftWebVC: UIViewController {
     }()
     
     lazy var stopBarButtonItem: UIBarButtonItem = {
-        var tempStopBarButtonItem = UIBarButtonItem(barButtonSystemItem: UIBarButtonSystemItem.stop,
+        var tempStopBarButtonItem = UIBarButtonItem(barButtonSystemItem: UIBarButtonItem.SystemItem.stop,
                                                     target: self,
                                                     action: #selector(SwiftWebVC.stopTapped(_:)))
         tempStopBarButtonItem.tintColor = self.buttonColor
@@ -62,7 +62,7 @@ public class SwiftWebVC: UIViewController {
     }()
     
     lazy var actionBarButtonItem: UIBarButtonItem = {
-        var tempActionBarButtonItem = UIBarButtonItem(barButtonSystemItem: UIBarButtonSystemItem.action,
+        var tempActionBarButtonItem = UIBarButtonItem(barButtonSystemItem: UIBarButtonItem.SystemItem.action,
                                                       target: self,
                                                       action: #selector(SwiftWebVC.actionButtonTapped(_:)))
         tempActionBarButtonItem.tintColor = self.buttonColor
@@ -138,7 +138,7 @@ public class SwiftWebVC: UIViewController {
         navBarTitle.backgroundColor = UIColor.clear
         if presentingViewController == nil {
             if let titleAttributes = navigationController!.navigationBar.titleTextAttributes {
-                navBarTitle.textColor = titleAttributes[NSAttributedStringKey.foregroundColor] as! UIColor //[titleAttributes:"NSColor"] // ["NSColor"] as! UIColor
+                navBarTitle.textColor = titleAttributes[NSAttributedString.Key.foregroundColor] as? UIColor //[titleAttributes:"NSColor"] // ["NSColor"] as! UIColor
             }
         }
         else {
@@ -192,8 +192,8 @@ public class SwiftWebVC: UIViewController {
         
         let refreshStopBarButtonItem: UIBarButtonItem = webView.isLoading ? stopBarButtonItem : refreshBarButtonItem
         
-        let fixedSpace: UIBarButtonItem = UIBarButtonItem(barButtonSystemItem: UIBarButtonSystemItem.fixedSpace, target: nil, action: nil)
-        let flexibleSpace: UIBarButtonItem = UIBarButtonItem(barButtonSystemItem: UIBarButtonSystemItem.flexibleSpace, target: nil, action: nil)
+        let fixedSpace: UIBarButtonItem = UIBarButtonItem(barButtonSystemItem: UIBarButtonItem.SystemItem.fixedSpace, target: nil, action: nil)
+        let flexibleSpace: UIBarButtonItem = UIBarButtonItem(barButtonSystemItem: UIBarButtonItem.SystemItem.flexibleSpace, target: nil, action: nil)
         
         if (UIDevice.current.userInterfaceIdiom == UIUserInterfaceIdiom.pad) {
             

+ 2 - 2
iOSClient/Library/SwiftWebVC/SwiftWebVCActivity.swift

@@ -14,10 +14,10 @@ class SwiftWebVCActivity: UIActivity {
     var URLToOpen: URL?
     var schemePrefix: String?
     
-    override var activityType : UIActivityType? {
+    override var activityType : UIActivity.ActivityType? {
         let typeArray = "\(Swift.type(of: self))".components(separatedBy: ".")
         let type: String = typeArray[typeArray.count-1]
-        return UIActivityType(rawValue: type)
+        return UIActivity.ActivityType(rawValue: type)
     }
         
     override var activityImage : UIImage {

+ 4 - 0
iOSClient/Main/CCDetail.h

@@ -44,6 +44,10 @@
 // Document
 @property (nonatomic, strong) WKWebView *webView;
 
+// Media
+@property (nonatomic, strong) UIBarButtonItem *buttonAction;
+@property BOOL isMediaObserver;
+
 // Photo
 @property (nonatomic, strong) NSMutableArray *photoDataSource;
 @property (nonatomic, strong) MWPhotoBrowser *photoBrowser;

+ 62 - 171
iOSClient/Main/CCDetail.m

@@ -41,7 +41,6 @@
     UIDocumentInteractionController *docController;
     
     UIBarButtonItem *buttonModifyTxt;
-    UIBarButtonItem *buttonAction;
     UIBarButtonItem *buttonShare;
     UIBarButtonItem *buttonDelete;
     
@@ -50,10 +49,6 @@
     
     NSMutableOrderedSet *dataSourceDirectoryID;
     NSString *fileNameExtension;
-    
-    NSURL *videoURLProxy;
-    NSURL *videoURL;
-    BOOL isMediaObserver;
 }
 @end
 
@@ -96,16 +91,13 @@
 
     self.imageBackground.image = [UIImage imageNamed:@"backgroundDetail"];
     
-    // Proxy
-    static dispatch_once_t onceToken;
-    dispatch_once(&onceToken, ^{
-        [self setupHTTPCache];
-    });
-    
     // Change bar bottom line shadow and remove title back button <"title"
     self.navigationController.navigationBar.shadowImage = [CCGraphics generateSinglePixelImageWithColor:[NCBrandColor sharedInstance].brand];
     self.navigationController.navigationBar.topItem.title = @"";
     
+    // Color Navigation Controller
+    [appDelegate aspectNavigationControllerBar:self.navigationController.navigationBar online:[appDelegate.reachability isReachable] hidden:NO];
+
     // TabBar
     self.tabBarController.tabBar.hidden = YES;
     self.tabBarController.tabBar.translucent = YES;
@@ -136,11 +128,10 @@
     }
     
     // remove Observer AVPlayer
-    if (isMediaObserver) {
-        isMediaObserver = NO;
+    if (self.isMediaObserver) {
+        self.isMediaObserver = NO;
         @try{
-            [appDelegate.player removeObserver:self forKeyPath:@"rate" context:nil];
-            [[NSNotificationCenter defaultCenter] removeObserver:self name:AVPlayerItemDidPlayToEndTimeNotification object:[appDelegate.player currentItem]];
+            [[NCViewerMedia sharedInstance] removeObserver];
         }@catch(id anException) { }
     }
 }
@@ -155,11 +146,6 @@
     }
 }
 
-- (void)backNavigationController
-{
-    [self.navigationController popViewControllerAnimated:YES];
-}
-
 - (void)changeToDisplayMode
 {
     if (_readerPDFViewController)
@@ -172,16 +158,18 @@
 
 - (void)viewFile
 {
+    // Title
+    self.navigationController.navigationBar.topItem.title =  _metadataDetail.fileNameView;
+
     // verifico se esiste l'icona e se la posso creare
     if ([[NSFileManager defaultManager] fileExistsAtPath:[CCUtility getDirectoryProviderStorageIconFileID:self.metadataDetail.fileID fileNameView:self.metadataDetail.fileNameView]] == NO) {
         [CCGraphics createNewImageFrom:self.metadataDetail.fileNameView fileID:self.metadataDetail.fileID extension:[self.metadataDetail.fileNameView pathExtension] filterGrayScale:NO typeFile:self.metadataDetail.typeFile writeImage:YES];
     }
     
     // remove Observer AVPlayer
-    if (isMediaObserver) {
-        isMediaObserver = NO;
-        [appDelegate.player removeObserver:self forKeyPath:@"rate" context:nil];
-        [[NSNotificationCenter defaultCenter] removeObserver:self name:AVPlayerItemDidPlayToEndTimeNotification object:[appDelegate.player currentItem]];
+    if (self.isMediaObserver) {
+        self.isMediaObserver = NO;
+        [[NCViewerMedia sharedInstance] removeObserver];
     }
     
     // IMAGE
@@ -197,61 +185,61 @@
         self.edgesForExtendedLayout = UIRectEdgeAll;
         [self createToolbar];
         [self viewMedia];
-        [appDelegate aspectNavigationControllerBar:self.navigationController.navigationBar online:[appDelegate.reachability isReachable] hidden:NO];
     }
     
     // DOCUMENT
     if ([self.metadataDetail.typeFile isEqualToString: k_metadataTypeFile_document]) {
         
+        BOOL openWithRichDocument = false;
+        
         fileNameExtension = [[self.metadataDetail.fileNameView pathExtension] uppercaseString];
         
-/*
-#if DEBUG
-        // Richdocument editor
+        if ([fileNameExtension isEqualToString:@"PDF"]) {
+            
+            self.edgesForExtendedLayout = UIRectEdgeBottom;
+            [self createToolbar];
+            [self viewPDF:@""];
+            
+            return;
+        }
+        
+        // Very if mimeType is compatible with Rich Document viewer
         NSString *mimeType = [CCUtility getMimeType:self.metadataDetail.fileNameView];
         NSArray *richdocumentsMimetypes = [[NCManageDatabase sharedInstance] getRichdocumentsMimetypes];
         
         if (richdocumentsMimetypes.count > 0 & mimeType != nil && [mimeType componentsSeparatedByString:@"."].count > 2) {
+            
             NSArray *mimeTypeArray = [mimeType componentsSeparatedByString:@"."];
-            NSString* mimeType = [NSString stringWithFormat:@"%@.%@",mimeTypeArray[mimeTypeArray.count-2], mimeTypeArray[mimeTypeArray.count-1]];
+            NSString *mimeType = [NSString stringWithFormat:@"%@.%@",mimeTypeArray[mimeTypeArray.count-2], mimeTypeArray[mimeTypeArray.count-1]];
+            
             for (NSString *richdocumentMimetype in richdocumentsMimetypes) {
                 if ([richdocumentMimetype containsString:mimeType]) {
-                    NSLog(@"Collabora");
-                    
-                    OCnetworking *ocNetworking = [[OCnetworking alloc] initWithDelegate:nil metadataNet:nil withUser:appDelegate.activeUser withUserID:appDelegate.activeUserID withPassword:appDelegate.activePassword withUrl:appDelegate.activeUrl];
-                    
-                    [ocNetworking createLinkRichdocumentsWithFileID:self.metadataDetail.fileID success:^(NSString *link) {
-                        
-                        [[NCRichdocument sharedInstance] viewRichDocumentAt:link navigationViewController:self.navigationController];
-                        
-                    } failure:^(NSString *message, NSInteger errorCode) {
-                        
-                        [appDelegate messageNotification:@"_error_" description:message visible:YES delay:k_dismissAfterSecond type:TWMessageBarMessageTypeError errorCode:errorCode];
-                        [self backNavigationController];
-                        return;
-                    }];
+                    openWithRichDocument = true;
                 }
             }
         }
-#endif
-*/
-        if ([fileNameExtension isEqualToString:@"PDF"]) {
+
+        if (openWithRichDocument) {
             
-            self.edgesForExtendedLayout = UIRectEdgeBottom;
-            [self createToolbar];
-            [self viewPDF:@""];
-            [appDelegate aspectNavigationControllerBar:self.navigationController.navigationBar online:[appDelegate.reachability isReachable] hidden:NO];
+            OCnetworking *ocNetworking = [[OCnetworking alloc] initWithDelegate:nil metadataNet:nil withUser:appDelegate.activeUser withUserID:appDelegate.activeUserID withPassword:appDelegate.activePassword withUrl:appDelegate.activeUrl];
             
-        } else {
+            [ocNetworking createLinkRichdocumentsWithFileID:self.metadataDetail.fileID success:^(NSString *link) {
+                
+                [[NCViewerRichdocument sharedInstance] viewRichDocumentAt:link viewDetail:self];
+                
+            } failure:^(NSString *message, NSInteger errorCode) {
+                
+                [appDelegate messageNotification:@"_error_" description:message visible:YES delay:k_dismissAfterSecond type:TWMessageBarMessageTypeError errorCode:errorCode];
+                [self.navigationController popViewControllerAnimated:YES];
+            }];
             
-            self.edgesForExtendedLayout = UIRectEdgeBottom;
-            [self createToolbar];
-            [self viewDocument];
-            [appDelegate aspectNavigationControllerBar:self.navigationController.navigationBar online:[appDelegate.reachability isReachable] hidden:NO];
+            return;
         }
+        
+        self.edgesForExtendedLayout = UIRectEdgeBottom;
+        [self createToolbar];
+        [self viewDocument];
     }
-    
-    self.title = _metadataDetail.fileNameView;
 }
 
 #pragma --------------------------------------------------------------------------------------------
@@ -276,20 +264,22 @@
     fixedSpaceMini.width = 25;
     
     buttonModifyTxt = [[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"actionSheetModify"] style:UIBarButtonItemStylePlain target:self action:@selector(modifyTxtButtonPressed:)];
-    buttonAction = [[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"openFile"] style:UIBarButtonItemStylePlain target:self action:@selector(actionButtonPressed:)];
+    if (![NCBrandOptions sharedInstance].disable_openin_file) {
+        self.buttonAction = [[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"openFile"] style:UIBarButtonItemStylePlain target:self action:@selector(actionButtonPressed:)];
+    }
     buttonShare  = [[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"share"] style:UIBarButtonItemStylePlain target:self action:@selector(shareButtonPressed:)];
     buttonDelete = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemTrash target:self action:@selector(deleteButtonPressed:)];
     
     if ([CCUtility isDocumentModifiableExtension:fileNameExtension]) {
         if ([CCUtility isFolderEncrypted:serverUrl account:appDelegate.activeAccount]) // E2EE
-            [self.toolbar setItems:[NSArray arrayWithObjects: buttonModifyTxt, flexible, buttonDelete, fixedSpaceMini, buttonAction,  nil]];
+            [self.toolbar setItems:[NSArray arrayWithObjects: buttonModifyTxt, flexible, buttonDelete, fixedSpaceMini, self.buttonAction,  nil]];
         else
-            [self.toolbar setItems:[NSArray arrayWithObjects: buttonModifyTxt, flexible, buttonDelete, fixedSpaceMini, buttonShare, fixedSpaceMini, buttonAction,  nil]];
+            [self.toolbar setItems:[NSArray arrayWithObjects: buttonModifyTxt, flexible, buttonDelete, fixedSpaceMini, buttonShare, fixedSpaceMini, self.buttonAction,  nil]];
     } else {
         if ([CCUtility isFolderEncrypted:serverUrl account:appDelegate.activeAccount]) // E2EE
-            [self.toolbar setItems:[NSArray arrayWithObjects: flexible, buttonDelete, fixedSpaceMini, buttonAction,  nil]];
+            [self.toolbar setItems:[NSArray arrayWithObjects: flexible, buttonDelete, fixedSpaceMini, self.buttonAction,  nil]];
         else
-            [self.toolbar setItems:[NSArray arrayWithObjects: flexible, buttonDelete, fixedSpaceMini, buttonShare, fixedSpaceMini, buttonAction,  nil]];
+            [self.toolbar setItems:[NSArray arrayWithObjects: flexible, buttonDelete, fixedSpaceMini, buttonShare, fixedSpaceMini, self.buttonAction,  nil]];
     }
     
     [self.toolbar setAutoresizingMask:UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleTopMargin];
@@ -314,7 +304,7 @@
     
     if ([CCUtility fileProviderStorageExists:self.metadataDetail.fileID fileNameView:self.metadataDetail.fileNameView] == NO) {
         
-        [self backNavigationController];
+        [self.navigationController popViewControllerAnimated:YES];
         return;
     }
     
@@ -383,110 +373,7 @@
         safeAreaBottom = [UIApplication sharedApplication].delegate.window.safeAreaInsets.bottom;
     }
     
-    NSString *serverUrl = [[NCManageDatabase sharedInstance] getServerUrl:_metadataDetail.directoryID];
-    if (!serverUrl)
-        return;
-    
-    if ([CCUtility fileProviderStorageExists:self.metadataDetail.fileID fileNameView:self.metadataDetail.fileNameView]) {
-    
-        videoURL = [NSURL fileURLWithPath:[CCUtility getDirectoryProviderStorageFileID:self.metadataDetail.fileID fileNameView:self.metadataDetail.fileNameView]];
-        videoURLProxy = videoURL;
-        
-    } else {
-    
-        videoURL = [NSURL URLWithString:[[NSString stringWithFormat:@"%@/%@", serverUrl, _metadataDetail.fileName] stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLQueryAllowedCharacterSet]]];
-        videoURLProxy = [KTVHTTPCache proxyURLWithOriginalURL:videoURL];
-
-        NSMutableDictionary *header = [NSMutableDictionary new];
-        NSData *authData = [[NSString stringWithFormat:@"%@:%@", appDelegate.activeUser, appDelegate.activePassword] dataUsingEncoding:NSUTF8StringEncoding];
-        NSString *authValue = [NSString stringWithFormat: @"Basic %@",[authData base64EncodedStringWithOptions:0]];
-        [header setValue:authValue forKey:@"Authorization"];
-        [header setValue:[CCUtility getUserAgent] forKey:@"User-Agent"];        
-        [KTVHTTPCache downloadSetAdditionalHeaders:header];
-        
-        // Disable Button Action (the file is in download via Proxy Server)
-        buttonAction.enabled = false;
-    }
-    
-    appDelegate.player = [AVPlayer playerWithURL:videoURLProxy];
-    appDelegate.playerController = [AVPlayerViewController new];
-
-    appDelegate.playerController.player = appDelegate.player;
-    appDelegate.playerController.view.frame = CGRectMake(0, 0, self.view.bounds.size.width, self.view.bounds.size.height - TOOLBAR_HEIGHT - safeAreaBottom);
-    appDelegate.playerController.allowsPictureInPicturePlayback = false;
-    [self addChildViewController:appDelegate.playerController];
-    [self.view addSubview:appDelegate.playerController.view];
-    [appDelegate.playerController didMoveToParentViewController:self];
-    
-    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(itemDidFinishPlaying:) name:AVPlayerItemDidPlayToEndTimeNotification object:[appDelegate.player currentItem]];
-    [appDelegate.player addObserver:self forKeyPath:@"rate" options:0 context:nil];
-    isMediaObserver = YES;
-
-    [appDelegate.player play];
-}
-
-- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context {
-    if ([keyPath isEqualToString:@"rate"]) {
-        if ([appDelegate.player rate]) {
-            NSLog(@"start");
-        }
-        else {
-            NSLog(@"pause");
-        }
-        [self saveCacheToFileProvider];
-    }
-}
-
-- (void)itemDidFinishPlaying:(NSNotification *)notification
-{
-    AVPlayerItem *player = [notification object];
-    [player seekToTime:kCMTimeZero];    
-}
-
-- (void)saveCacheToFileProvider
-{
-    if (![CCUtility fileProviderStorageExists:self.metadataDetail.fileID fileNameView:self.metadataDetail.fileNameView]) {
-        NSURL *url = [KTVHTTPCache cacheCompleteFileURLIfExistedWithURL:videoURL];
-        if (url) {
-            
-            [CCUtility copyFileAtPath:[url path] toPath:[CCUtility getDirectoryProviderStorageFileID:self.metadataDetail.fileID fileNameView:self.metadataDetail.fileNameView]];
-            [[NCManageDatabase sharedInstance] addLocalFileWithMetadata:self.metadataDetail];
-            [KTVHTTPCache cacheDeleteCacheWithURL:videoURL];
-            
-            // reload Data Source
-            [[NCMainCommon sharedInstance] reloadDatasourceWithServerUrl:[[NCManageDatabase sharedInstance] getServerUrl:self.metadataDetail.directoryID] fileID:self.metadataDetail.fileID action:k_action_MOD];
-            
-            // Enabled Button Action (the file is in local)
-            buttonAction.enabled = true;
-        }
-    }
-}
-
-- (void)setupHTTPCache
-{
-    [KTVHTTPCache cacheSetMaxCacheLength:k_maxHTTPCache];
-    
-#if TARGET_IPHONE_SIMULATOR
-    [KTVHTTPCache logSetConsoleLogEnable:YES];
-#endif
-    
-    NSError * error;
-    [KTVHTTPCache proxyStart:&error];
-    if (error) {
-        NSLog(@"Proxy Start Failure, %@", error);
-    } else {
-        NSLog(@"Proxy Start Success");
-    }
-    
-    [KTVHTTPCache tokenSetURLFilter:^NSURL * (NSURL * URL) {
-        NSLog(@"URL Filter reviced URL : %@", URL);
-        return URL;
-    }];
-    
-    [KTVHTTPCache downloadSetUnsupportContentTypeFilter:^BOOL(NSURL * URL, NSString * contentType) {
-        NSLog(@"Unsupport Content-Type Filter reviced URL : %@, %@", URL, contentType);
-        return NO;
-    }];
+    [[NCViewerMedia sharedInstance] viewMedia:self.metadataDetail viewDetail:self width:self.view.bounds.size.width height:self.view.bounds.size.height - TOOLBAR_HEIGHT - safeAreaBottom];
 }
 
 #pragma --------------------------------------------------------------------------------------------
@@ -526,7 +413,11 @@
     }
     
     // PhotoBrowser
-    self.photoBrowser.displayActionButton = YES;
+    if ([NCBrandOptions sharedInstance].disable_openin_file) {
+        self.photoBrowser.displayActionButton = NO;
+    } else {
+        self.photoBrowser.displayActionButton = YES;
+    }
     self.photoBrowser.displayDeleteButton = YES;
     if ([CCUtility isFolderEncrypted:serverUrl account:appDelegate.activeAccount]) // E2EE
         self.photoBrowser.displayShareButton = NO;
@@ -848,7 +739,7 @@
     } else {
         [appDelegate messageNotification:@"_download_selected_files_" description:@"_error_download_photobrowser_" visible:YES delay:k_dismissAfterSecond type:TWMessageBarMessageTypeError errorCode:errorCode];
         
-        [self backNavigationController];
+        [self.navigationController popViewControllerAnimated:YES];
     }
 }
 
@@ -1104,7 +995,7 @@
             if ([self.metadataDetail.typeFile isEqualToString: k_metadataTypeFile_image] == NO) {
             
                 // exit
-                [self backNavigationController];
+                [self.navigationController popViewControllerAnimated:YES];
             
             } else {
                 
@@ -1120,7 +1011,7 @@
                         
                         // exit
                         if ([self.photoDataSource count] == 0) {
-                            [self backNavigationController];
+                            [self.navigationController popViewControllerAnimated:YES];
                         }
                     }
                 }

+ 39 - 15
iOSClient/Main/CCMain.m

@@ -1112,6 +1112,7 @@
     
     for (PHAsset *asset in assets) {
         
+        tableMetadata *metadata;
         NSString *fileName = [CCUtility createFileName:[asset valueForKey:@"filename"] fileDate:asset.creationDate fileType:asset.mediaType keyFileName:k_keyFileNameMask keyFileNameType:k_keyFileNameType keyFileNameOriginal:k_keyFileNameOriginal];
         
         NSDate *assetDate = asset.creationDate;
@@ -1150,11 +1151,20 @@
         metadataForUpload.size = [[NCUtility sharedInstance] getFileSizeWithAsset:asset];
         metadataForUpload.status = k_metadataStatusWaitUpload;
         
+        NSString *fileNameExtension = [fileName pathExtension];
+        NSString *fileNameWithoutExtension = [fileName stringByDeletingPathExtension];
+        
+        if ([[fileNameExtension lowercaseString] isEqualToString:@"heic"] && [CCUtility getFormatCompatibility]) {
+            NSString *fileNameCompatibility = [fileNameWithoutExtension stringByAppendingString:@".jpg"];
+            metadata = [[NCManageDatabase sharedInstance] getMetadataWithPredicate:[NSPredicate predicateWithFormat:@"directoryID == %@ AND fileNameView == %@", directoryID, fileNameCompatibility]];
+        } else {
+            metadata = [[NCManageDatabase sharedInstance] getMetadataWithPredicate:[NSPredicate predicateWithFormat:@"directoryID == %@ AND fileNameView == %@", directoryID, fileName]];
+        }
+        
         // Check il file already exists
-        tableMetadata *metadata = [[NCManageDatabase sharedInstance] getMetadataWithPredicate:[NSPredicate predicateWithFormat:@"directoryID == %@ AND fileNameView == %@", directoryID, fileName]];
         if (metadata) {
             
-            UIAlertController *alertController = [UIAlertController alertControllerWithTitle:fileName message:NSLocalizedString(@"_file_already_exists_", nil) preferredStyle:UIAlertControllerStyleAlert];
+            UIAlertController *alertController = [UIAlertController alertControllerWithTitle:fileNameWithoutExtension message:NSLocalizedString(@"_file_already_exists_", nil) preferredStyle:UIAlertControllerStyleAlert];
             
             UIAlertAction *cancelAction = [UIAlertAction actionWithTitle:NSLocalizedString(@"_cancel_", nil) style:UIAlertActionStyleCancel handler:^(UIAlertAction *action) {
                 // NO OVERWITE
@@ -2752,14 +2762,22 @@
     appDelegate.deleteItem = [[REMenuItem alloc] initWithTitle:NSLocalizedString(@"_delete_selected_files_", nil) subtitle:@"" image:[CCGraphics changeThemingColorImage:[UIImage imageNamed:@"delete"] multiplier:2 color:[NCBrandColor sharedInstance].icon] highlightedImage:nil action:^(REMenuItem *item) {
         [self deleteFile];
     }];
-
+    
     // E2EE
     if (_metadataFolder.e2eEncrypted) {
-        appDelegate.reSelectMenu = [[REMenu alloc] initWithItems:@[appDelegate.selectAllItem, appDelegate.downloadItem, appDelegate.saveItem, appDelegate.deleteItem]];
+        if ([NCBrandOptions sharedInstance].disable_openin_file) {
+            appDelegate.reSelectMenu = [[REMenu alloc] initWithItems:@[appDelegate.selectAllItem, appDelegate.downloadItem, appDelegate.deleteItem]];
+        } else {
+            appDelegate.reSelectMenu = [[REMenu alloc] initWithItems:@[appDelegate.selectAllItem, appDelegate.downloadItem, appDelegate.saveItem, appDelegate.deleteItem]];
+        }
     } else {
-        appDelegate.reSelectMenu = [[REMenu alloc] initWithItems:@[appDelegate.selectAllItem, appDelegate.moveItem, appDelegate.downloadItem, appDelegate.saveItem, appDelegate.deleteItem]];
+        if ([NCBrandOptions sharedInstance].disable_openin_file) {
+            appDelegate.reSelectMenu = [[REMenu alloc] initWithItems:@[appDelegate.selectAllItem, appDelegate.moveItem, appDelegate.downloadItem, appDelegate.deleteItem]];
+        } else {
+            appDelegate.reSelectMenu = [[REMenu alloc] initWithItems:@[appDelegate.selectAllItem, appDelegate.moveItem, appDelegate.downloadItem, appDelegate.saveItem, appDelegate.deleteItem]];
+        }
     }
-    
+
     appDelegate.reSelectMenu.imageOffset = CGSizeMake(5, -1);
     
     appDelegate.reSelectMenu.separatorOffset = CGSizeMake(50.0, 0.0);
@@ -2858,7 +2876,11 @@
         
         UIMenuItem *pasteFilesItem = [[UIMenuItem alloc] initWithTitle:NSLocalizedString(@"_paste_files_", nil) action:@selector(pasteFiles:)];
         
-        [menuController setMenuItems:[NSArray arrayWithObjects:copyFileItem, copyFilesItem, openinFileItem, pasteFileItem, pasteFilesItem, nil]];
+        if ([NCBrandOptions sharedInstance].disable_openin_file) {
+            [menuController setMenuItems:[NSArray arrayWithObjects:copyFileItem, copyFilesItem, pasteFileItem, pasteFilesItem, nil]];
+        } else {
+            [menuController setMenuItems:[NSArray arrayWithObjects:copyFileItem, copyFilesItem, openinFileItem, pasteFileItem, pasteFilesItem, nil]];
+        }
         
         [menuController setTargetRect:CGRectMake(touchPoint.x, touchPoint.y, 0.0f, 0.0f) inView:self.tableView];
         [menuController setMenuVisible:YES animated:YES];
@@ -3625,15 +3647,17 @@
                                         }];
         }
         
-        [actionSheet addButtonWithTitle:NSLocalizedString(@"_open_in_", nil)
-                                  image:[CCGraphics changeThemingColorImage:[UIImage imageNamed:@"openFile"] multiplier:2 color:[NCBrandColor sharedInstance].icon]
-                        backgroundColor:[NCBrandColor sharedInstance].backgroundView
-                                 height: 50.0
-                                   type:AHKActionSheetButtonTypeDefault
-                                handler:^(AHKActionSheet *as) {
-                                    [self performSelector:@selector(DownloadOpenIn:) withObject:self.metadata];
-                                }];
+        if (![NCBrandOptions sharedInstance].disable_openin_file) {
         
+            [actionSheet addButtonWithTitle:NSLocalizedString(@"_open_in_", nil)
+                                      image:[CCGraphics changeThemingColorImage:[UIImage imageNamed:@"openFile"] multiplier:2 color:[NCBrandColor sharedInstance].icon]
+                            backgroundColor:[NCBrandColor sharedInstance].backgroundView
+                                     height: 50.0
+                                       type:AHKActionSheetButtonTypeDefault
+                                    handler:^(AHKActionSheet *as) {
+                                        [self performSelector:@selector(DownloadOpenIn:) withObject:self.metadata];
+                                    }];
+        }
         
         [actionSheet addButtonWithTitle:NSLocalizedString(@"_rename_", nil)
                                   image:[CCGraphics changeThemingColorImage:[UIImage imageNamed:@"rename"] multiplier:2 color:[NCBrandColor sharedInstance].icon]

+ 1 - 1
iOSClient/Main/CCMore.swift

@@ -324,7 +324,7 @@ class CCMore: UIViewController, UITableViewDelegate, UITableViewDataSource, CCLo
         selectionColor.backgroundColor = NCBrandColor.sharedInstance.getColorSelectBackgrond()
         cell.selectedBackgroundView = selectionColor
         
-        cell.accessoryType = UITableViewCellAccessoryType.disclosureIndicator
+        cell.accessoryType = UITableViewCell.AccessoryType.disclosureIndicator
         
         // Menu Normal
         if (indexPath.section == 0) {

+ 2 - 2
iOSClient/Main/Main.storyboard

@@ -444,11 +444,11 @@
         <scene sceneID="zJM-E9-jgK">
             <objects>
                 <viewController storyboardIdentifier="CCDetailVC" extendedLayoutIncludesOpaqueBars="YES" id="zg6-hy-EbU" customClass="CCDetail" sceneMemberID="viewController">
-                    <view key="view" 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="812"/>
                         <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
                         <subviews>
-                            <imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" preservesSuperviewLayoutMargins="YES" image="backgroundDetail" translatesAutoresizingMaskIntoConstraints="NO" id="zlU-MP-ZVs">
+                            <imageView userInteractionEnabled="NO" tag="999" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" preservesSuperviewLayoutMargins="YES" image="backgroundDetail" translatesAutoresizingMaskIntoConstraints="NO" id="zlU-MP-ZVs">
                                 <rect key="frame" x="76" y="327.66666666666669" width="223" height="157"/>
                             </imageView>
                         </subviews>

+ 7 - 7
iOSClient/Main/NCMainCommon.swift

@@ -199,8 +199,8 @@ class NCMainCommon: NSObject {
             // NORMAL
             
             let cell = tableView.dequeueReusableCell(withIdentifier: "CellMain", for: indexPath) as! CCCellMain
-            cell.separatorInset = UIEdgeInsetsMake(0, 60, 0, 0)
-            cell.accessoryType = UITableViewCellAccessoryType.none
+            cell.separatorInset = UIEdgeInsets.init(top: 0, left: 60, bottom: 0, right: 0)
+            cell.accessoryType = UITableViewCell.AccessoryType.none
             cell.file.image = nil
             cell.status.image = nil
             cell.favorite.image = nil
@@ -327,8 +327,8 @@ class NCMainCommon: NSObject {
             // TRASNFER
             
             let cell = tableView.dequeueReusableCell(withIdentifier: "CellMainTransfer", for: indexPath) as! CCCellMainTransfer
-            cell.separatorInset = UIEdgeInsetsMake(0, 60, 0, 0)
-            cell.accessoryType = UITableViewCellAccessoryType.none
+            cell.separatorInset = UIEdgeInsets.init(top: 0, left: 60, bottom: 0, right: 0)
+            cell.accessoryType = UITableViewCell.AccessoryType.none
             cell.file.image = nil
             cell.status.image = nil
             
@@ -653,7 +653,7 @@ class CCMainTabBarController : UITabBarController, UITabBarControllerDelegate {
         // Disable interaction during animation
         view.isUserInteractionEnabled = false
             
-        UIView.animate(withDuration: 0.3, delay: 0.0, usingSpringWithDamping: 1, initialSpringVelocity: 0, options: UIViewAnimationOptions.curveEaseOut, animations: {
+        UIView.animate(withDuration: 0.3, delay: 0.0, usingSpringWithDamping: 1, initialSpringVelocity: 0, options: UIView.AnimationOptions.curveEaseOut, animations: {
                 
             // Slide the views by -offset
             fromView.center = CGPoint(x: fromView.center.x - offset, y: fromView.center.y);
@@ -716,7 +716,7 @@ class NCNetworkingMain: NSObject, CCNetworkingDelegate {
             }
             
             // open View File
-            if selector == selectorLoadFileView && UIApplication.shared.applicationState == UIApplicationState.active {
+            if selector == selectorLoadFileView && UIApplication.shared.applicationState == UIApplication.State.active {
             
                 if metadata.typeFile == k_metadataTypeFile_compress || metadata.typeFile == k_metadataTypeFile_unknown {
                 
@@ -741,7 +741,7 @@ class NCNetworkingMain: NSObject, CCNetworkingDelegate {
             }
             
             // Open in...
-            if selector == selectorOpenIn && UIApplication.shared.applicationState == UIApplicationState.active {
+            if selector == selectorOpenIn && UIApplication.shared.applicationState == UIApplication.State.active {
 
                 if appDelegate.activeMain.view.window != nil {
                     appDelegate.activeMain.open(in: metadata)

+ 8 - 2
iOSClient/Move/CCMove.h

@@ -38,8 +38,14 @@
 
 @property (nonatomic, weak) id <CCMoveDelegate> delegate;
 @property (nonatomic, strong) NSOperationQueue *networkingOperationQueue;
+
 @property BOOL includeDirectoryE2EEncryption;
+@property BOOL includeImages;
+
 @property BOOL hideCreateFolder;
+@property BOOL hideMoveutton;
+
+@property BOOL selectFile;
 
 @property (nonatomic, strong) NSString *serverUrl;
 @property (nonatomic, strong) tableMetadata *passMetadata;
@@ -61,8 +67,8 @@
 
 @protocol CCMoveDelegate <NSObject>
 
-- (void)moveServerUrlTo:(NSString *)serverUrlTo title:(NSString *)title;
-
+@optional - (void)moveServerUrlTo:(NSString *)serverUrlTo title:(NSString *)title;
 @optional - (void)dismissMove;
+@optional - (void)selectMetadata:(tableMetadata *)metadata serverUrl:(NSString *)serverUrl;
 
 @end

+ 59 - 28
iOSClient/Move/CCMove.m

@@ -37,6 +37,8 @@
     // Automatic Upload Folder
     NSString *_autoUploadFileName;
     NSString *_autoUploadDirectory;
+    
+    NSPredicate *predicateDataSource;
 }
 @end
 
@@ -127,6 +129,11 @@
         [self.create setEnabled:NO];
         [self.create setTintColor: [UIColor clearColor]];
     }
+    
+    if (self.hideMoveutton) {
+        [self.move setEnabled:NO];
+        [self.move setTintColor: [UIColor clearColor]];
+    }
 }
 
 #pragma --------------------------------------------------------------------------------------------
@@ -363,12 +370,11 @@
 {
     NSString *directoryID = [[NCManageDatabase sharedInstance] getDirectoryID:_serverUrl];
     if (!directoryID) return 0;
-    NSPredicate *predicate;
-    
-    if (self.includeDirectoryE2EEncryption) predicate = [NSPredicate predicateWithFormat:@"directoryID == %@ AND directory == true", directoryID];
-    else predicate = [NSPredicate predicateWithFormat:@"directoryID == %@ AND directory == true AND e2eEncrypted == false", directoryID];
+
+    if (self.includeImages) predicateDataSource = [NSPredicate predicateWithFormat:@"directoryID == %@ AND e2eEncrypted == %@ AND (directory == true OR typeFile == 'image')", directoryID, [NSNumber numberWithBool:self.includeDirectoryE2EEncryption]];
+    else predicateDataSource = [NSPredicate predicateWithFormat:@"directoryID == %@ AND e2eEncrypted == %@ AND directory == true", directoryID, [NSNumber numberWithBool:self.includeDirectoryE2EEncryption]];
     
-    NSArray *result = [[NCManageDatabase sharedInstance] getMetadatasWithPredicate:predicate sorted:nil ascending:NO];
+    NSArray *result = [[NCManageDatabase sharedInstance] getMetadatasWithPredicate:predicateDataSource sorted:nil ascending:NO];
     
     if (result)
         return [result count];
@@ -378,8 +384,6 @@
 
 - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
 {
-    NSPredicate *predicate;
-    
     static NSString *CellIdentifier = @"MyCustomCell";
     
     UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
@@ -387,14 +391,7 @@
         cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier];
     }
     
-    NSString *directoryID = [[NCManageDatabase sharedInstance] getDirectoryID:_serverUrl];
-    if (!directoryID)
-        return cell;
-    
-    if (self.includeDirectoryE2EEncryption) predicate = [NSPredicate predicateWithFormat:@"directoryID == %@ AND directory == true", directoryID];
-    else predicate = [NSPredicate predicateWithFormat:@"directoryID == %@ AND directory == true AND e2eEncrypted == false", directoryID];
-    
-    tableMetadata *metadata = [[NCManageDatabase sharedInstance] getMetadataAtIndexWithPredicate:predicate sorted:@"fileName" ascending:YES index:indexPath.row];
+    tableMetadata *metadata = [[NCManageDatabase sharedInstance] getMetadataAtIndexWithPredicate:predicateDataSource sorted:@"fileName" ascending:YES index:indexPath.row];
     
     // Create Directory Provider Storage FileID
     [CCUtility getDirectoryProviderStorageFileID:metadata.fileID];
@@ -404,13 +401,30 @@
     
     cell.detailTextLabel.text = @"";
     
-    if (metadata.e2eEncrypted)
-        cell.imageView.image = [CCGraphics changeThemingColorImage:[UIImage imageNamed:@"folderEncrypted"] multiplier:2 color:[NCBrandColor sharedInstance].brandElement];
-    else if ([metadata.fileName isEqualToString:_autoUploadFileName] && [self.serverUrl isEqualToString:_autoUploadDirectory])
-        cell.imageView.image = [CCGraphics changeThemingColorImage:[UIImage imageNamed:@"folderMedia"] multiplier:2 color:[NCBrandColor sharedInstance].brandElement];
-    else
-        cell.imageView.image = [CCGraphics changeThemingColorImage:[UIImage imageNamed:@"folder"] multiplier:2 color:[NCBrandColor sharedInstance].brandElement];
+    if (metadata.directory) {
     
+        if (metadata.e2eEncrypted)
+            cell.imageView.image = [CCGraphics changeThemingColorImage:[UIImage imageNamed:@"folderEncrypted"] multiplier:2 color:[NCBrandColor sharedInstance].brandElement];
+        else if ([metadata.fileName isEqualToString:_autoUploadFileName] && [self.serverUrl isEqualToString:_autoUploadDirectory])
+            cell.imageView.image = [CCGraphics changeThemingColorImage:[UIImage imageNamed:@"folderMedia"] multiplier:2 color:[NCBrandColor sharedInstance].brandElement];
+        else
+            cell.imageView.image = [CCGraphics changeThemingColorImage:[UIImage imageNamed:@"folder"] multiplier:2 color:[NCBrandColor sharedInstance].brandElement];
+        
+    } else {
+        
+        UIImage *thumb = [UIImage imageWithContentsOfFile:[CCUtility getDirectoryProviderStorageIconFileID:metadata.fileID fileNameView:metadata.fileNameView]];
+        
+        if (thumb) {
+            cell.imageView.image = thumb;
+        } else {
+            if (metadata.iconName.length > 0) {
+                cell.imageView.image = [UIImage imageNamed:metadata.iconName];
+            } else {
+                cell.imageView.image = [UIImage imageNamed:@"file"];
+            }
+        }
+    }
+
     cell.textLabel.text = metadata.fileNameView;
     cell.accessoryType = UITableViewCellAccessoryNone;
     
@@ -419,7 +433,25 @@
 
 - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
 {
-    [self performSegueDirectoryWithControlPasscode:YES];
+    tableMetadata *metadata = [[NCManageDatabase sharedInstance] getMetadataAtIndexWithPredicate:predicateDataSource sorted:@"fileName" ascending:YES index:indexPath.row];
+    
+    if (metadata.directory) {
+        
+        [self performSegueDirectoryWithControlPasscode:YES];
+        
+    } else {
+        
+        if (self.selectFile) {
+            
+            if ([self.delegate respondsToSelector:@selector(dismissMove)])
+                [self.delegate dismissMove];
+            
+            if ([self.delegate respondsToSelector:@selector(selectMetadata:serverUrl:)])
+                [self.delegate selectMetadata:metadata serverUrl:_serverUrl];
+            
+            [self dismissViewControllerAnimated:YES completion:nil];
+        }
+    }
 }
 
 // MARK: - Navigation
@@ -427,16 +459,12 @@
 - (void)performSegueDirectoryWithControlPasscode:(BOOL)controlPasscode
 {
     NSString *nomeDir;
-    NSPredicate *predicate;
 
     NSIndexPath *index = [self.tableView indexPathForSelectedRow];
     NSString *directoryID = [[NCManageDatabase sharedInstance] getDirectoryID:_serverUrl];
     if (!directoryID) return;
     
-    if (self.includeDirectoryE2EEncryption) predicate = [NSPredicate predicateWithFormat:@"directoryID == %@ AND directory == true", directoryID];
-    else predicate = [NSPredicate predicateWithFormat:@"directoryID == %@ AND directory == true AND e2eEncrypted == false", directoryID];
-    
-    tableMetadata *metadata = [[NCManageDatabase sharedInstance] getMetadataAtIndexWithPredicate:predicate sorted:@"fileName" ascending:YES index:index.row];
+    tableMetadata *metadata = [[NCManageDatabase sharedInstance] getMetadataAtIndexWithPredicate:predicateDataSource sorted:@"fileName" ascending:YES index:index.row];
     
     // lockServerUrl
     NSString *lockServerUrl = [CCUtility stringAppendServerUrl:_serverUrl addFileName:metadata.fileName];
@@ -484,9 +512,12 @@
     
     viewController.delegate = self.delegate;
     viewController.includeDirectoryE2EEncryption = self.includeDirectoryE2EEncryption;
+    viewController.includeImages = self.includeImages;
     viewController.move.title = self.move.title;
     viewController.hideCreateFolder = self.hideCreateFolder;
-    viewController.networkingOperationQueue = _networkingOperationQueue;
+    viewController.hideMoveutton = self.hideMoveutton;
+    viewController.selectFile = self.selectFile;
+    viewController.networkingOperationQueue = self.networkingOperationQueue;
 
     viewController.passMetadata = metadata;
     viewController.serverUrl = [CCUtility stringAppendServerUrl:_serverUrl addFileName:nomeDir];

+ 6 - 6
iOSClient/Move/CCMove.storyboard

@@ -1,11 +1,11 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="11762" systemVersion="16C67" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
+<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="14113" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
     <device id="retina4_7" orientation="portrait">
         <adaptation id="fullscreen"/>
     </device>
     <dependencies>
         <deployment identifier="iOS"/>
-        <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="11757"/>
+        <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14088"/>
         <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
     </dependencies>
     <scenes>
@@ -14,7 +14,7 @@
             <objects>
                 <tableViewController storyboardIdentifier="CCMoveVC" id="r57-Y0-NGA" customClass="CCMove" sceneMemberID="viewController">
                     <tableView key="view" clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" separatorStyle="default" rowHeight="50" sectionHeaderHeight="22" sectionFooterHeight="22" id="McT-Wl-5yC">
-                        <rect key="frame" x="0.0" y="64" width="375" height="559"/>
+                        <rect key="frame" x="0.0" y="0.0" width="375" height="559"/>
                         <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
                         <color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
                         <prototypes>
@@ -22,11 +22,11 @@
                                 <rect key="frame" x="0.0" y="22" width="375" height="60"/>
                                 <autoresizingMask key="autoresizingMask"/>
                                 <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="w3K-MH-HTI" id="o7i-Tv-3Dy">
-                                    <rect key="frame" x="0.0" y="0.0" width="342" height="59"/>
+                                    <rect key="frame" x="0.0" y="0.0" width="341" height="59.5"/>
                                     <autoresizingMask key="autoresizingMask"/>
                                     <subviews>
                                         <label opaque="NO" multipleTouchEnabled="YES" contentMode="left" text="Title" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="Z3y-WW-606">
-                                            <rect key="frame" x="15" y="0.0" width="325" height="59"/>
+                                            <rect key="frame" x="16" y="0.0" width="324" height="59.5"/>
                                             <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
                                             <fontDescription key="fontDescription" type="system" pointSize="13"/>
                                             <color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
@@ -78,7 +78,7 @@
                     <toolbarItems/>
                     <navigationItem key="navigationItem" id="uMb-zy-0sS"/>
                     <navigationBar key="navigationBar" alpha="0.89999997615814209" contentMode="scaleToFill" misplaced="YES" translucent="NO" id="emo-5L-Jsr">
-                        <rect key="frame" x="0.0" y="0.0" width="320" height="44"/>
+                        <rect key="frame" x="0.0" y="20" width="375" height="44"/>
                         <autoresizingMask key="autoresizingMask"/>
                     </navigationBar>
                     <nil name="viewControllers"/>

+ 2 - 2
iOSClient/Networking/NCService.swift

@@ -164,7 +164,7 @@ class NCService: NSObject, OCNetworkingDelegate {
                             return
                         }
                     
-                        if let data = UIImagePNGRepresentation(image) {
+                        if let data = image.pngData() {
                             try? data.write(to: URL(fileURLWithPath: fileNamePath))
                         }
                     
@@ -282,7 +282,7 @@ class NCService: NSObject, OCNetworkingDelegate {
                         return
                     }
                 
-                    if let data = UIImagePNGRepresentation(image) {
+                    if let data = image.pngData() {
                         try? data.write(to: URL(fileURLWithPath: fileNamePath))
                     }
                 

+ 1 - 0
iOSClient/Networking/OCNetworking.h

@@ -74,6 +74,7 @@
 - (void)unsubscribingPushNotificationServer:(NSString *)url deviceIdentifier:(NSString *)deviceIdentifier deviceIdentifierSignature:(NSString *)deviceIdentifierSignature publicKey:(NSString *)publicKey success:(void (^)(void))success failure:(void (^)(NSString *message, NSInteger errorCode))failure;
 
 - (void)createLinkRichdocumentsWithFileID:(NSString *)fileID success:(void(^)(NSString *link))success failure:(void (^)(NSString *message, NSInteger errorCode))failure;
+- (void)createAssetRichdocumentsWithFileName:(NSString *)fileName serverUrl:(NSString *)serverUrl success:(void(^)(NSString *link))success failure:(void (^)(NSString *message, NSInteger errorCode))failure;
 
 @end
 

+ 85 - 51
iOSClient/Networking/OCNetworking.m

@@ -181,60 +181,60 @@
     
     NSURLSessionDataTask *task = [session dataTaskWithRequest:request completionHandler: ^(NSData *data, NSURLResponse *response, NSError *error) {
         
-        if (error) {
-            
-            NSString *message;
-            NSInteger errorCode;
-            
-            NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse*)response;
-            errorCode = httpResponse.statusCode;
-            
-            if (errorCode == 0 || (errorCode >= 200 && errorCode < 300))
-                errorCode = error.code;
-            
-            // Error
-            if (errorCode == 503)
-                message = NSLocalizedStringFromTable(@"_server_error_retry_", @"Error", nil);
-            else
-                message = [error.userInfo valueForKey:@"NSLocalizedDescription"];
-            
-            dispatch_async(dispatch_get_main_queue(), ^{
-                failure(message, errorCode);
-            });
-            
-        } else {
-            
-            NSString *serverProductName = @"";
-            NSString *serverVersion = @"0.0.0";
-            NSString *serverVersionString = @"0.0.0";
-            
-            NSInteger versionMajor = 0;
-            NSInteger versionMicro = 0;
-            NSInteger versionMinor = 0;
-            
-            NSError *error;
-            NSDictionary *jsongParsed = [NSJSONSerialization JSONObjectWithData:data options:NSJSONReadingMutableContainers error:&error];
+        dispatch_sync(dispatch_get_main_queue(), ^{
             
             if (error) {
-                failure(error.description, error.code);
-                return;
-            }
-            
-            serverProductName = [[jsongParsed valueForKey:@"productname"] lowercaseString];
-            serverVersion = [jsongParsed valueForKey:@"version"];
-            serverVersionString = [jsongParsed valueForKey:@"versionstring"];
-            
-            NSArray *arrayVersion = [serverVersionString componentsSeparatedByString:@"."];
-            if (arrayVersion.count >= 3) {
-                versionMajor = [arrayVersion[0] integerValue];
-                versionMicro = [arrayVersion[1] integerValue];
-                versionMinor = [arrayVersion[2] integerValue];
-            }
-            
-            dispatch_async(dispatch_get_main_queue(), ^{
+                
+                NSString *message;
+                NSInteger errorCode;
+                
+                NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse*)response;
+                errorCode = httpResponse.statusCode;
+                
+                if (errorCode == 0 || (errorCode >= 200 && errorCode < 300))
+                    errorCode = error.code;
+                
+                // Error
+                if (errorCode == 503)
+                    message = NSLocalizedStringFromTable(@"_server_error_retry_", @"Error", nil);
+                else
+                    message = [error.userInfo valueForKey:@"NSLocalizedDescription"];
+                
+                failure(message, errorCode);
+                
+            } else {
+                
+                NSString *serverProductName = @"";
+                NSString *serverVersion = @"0.0.0";
+                NSString *serverVersionString = @"0.0.0";
+                
+                NSInteger versionMajor = 0;
+                NSInteger versionMicro = 0;
+                NSInteger versionMinor = 0;
+                
+                NSError *error;
+                NSDictionary *jsongParsed = [NSJSONSerialization JSONObjectWithData:data options:NSJSONReadingMutableContainers error:&error];
+                
+                if (error) {
+                    failure(error.description, error.code);
+                    return;
+                }
+                
+                serverProductName = [[jsongParsed valueForKey:@"productname"] lowercaseString];
+                serverVersion = [jsongParsed valueForKey:@"version"];
+                serverVersionString = [jsongParsed valueForKey:@"versionstring"];
+                
+                NSArray *arrayVersion = [serverVersionString componentsSeparatedByString:@"."];
+                if (arrayVersion.count >= 3) {
+                    versionMajor = [arrayVersion[0] integerValue];
+                    versionMicro = [arrayVersion[1] integerValue];
+                    versionMinor = [arrayVersion[2] integerValue];
+                }
+                
                 success(serverProductName, versionMajor, versionMicro, versionMinor);
-            });
-        }
+            }
+        });
+        
     }];
     
     [task resume];
@@ -2229,6 +2229,40 @@
     }];
 }
 
+- (void)createAssetRichdocumentsWithFileName:(NSString *)fileName serverUrl:(NSString *)serverUrl success:(void(^)(NSString *link))success failure:(void (^)(NSString *message, NSInteger errorCode))failure
+{
+    OCCommunication *communication = [CCNetworking sharedNetworking].sharedOCCommunication;
+    
+    [communication setCredentialsWithUser:_activeUser andUserID:_activeUserID andPassword:_activePassword];
+    [communication setUserAgent:[CCUtility getUserAgent]];
+    
+    NSString *fileNamePath = [CCUtility returnFileNamePathFromFileName:fileName serverUrl:serverUrl activeUrl:_activeUrl];
+    
+    [communication createAssetRichdocuments:[_activeUrl stringByAppendingString:@"/"] path:fileNamePath onCommunication:communication successRequest:^(NSHTTPURLResponse *response, NSString *url, NSString *redirectedServer) {
+        
+        success(url);
+        
+    } failureRequest:^(NSHTTPURLResponse *response, NSError *error, NSString *redirectedServer) {
+        
+        NSString *message;
+        
+        NSInteger errorCode = response.statusCode;
+        if (errorCode == 0 || (errorCode >= 200 && errorCode < 300))
+            errorCode = error.code;
+        
+        // Error
+        if (errorCode == 503)
+            message = NSLocalizedStringFromTable(@"_server_error_retry_", @"Error", nil);
+        else
+            message = [error.userInfo valueForKey:@"NSLocalizedDescription"];
+        
+        // Activity
+        [[NCManageDatabase sharedInstance] addActivityClient:_activeUrl fileID:@"" action:k_activityDebugActionUnsubscribingServerPush selector:@"" note:[error.userInfo valueForKey:@"NSLocalizedDescription"] type:k_activityTypeFailure verbose:k_activityVerboseHigh activeUrl:_activeUrl];
+        
+        failure(message, errorCode);
+    }];
+}
+
 @end
 
 #pragma --------------------------------------------------------------------------------------------

+ 2 - 2
iOSClient/Notification/CCNotification.swift

@@ -35,14 +35,14 @@ class CCNotification: UITableViewController, OCNetworkingDelegate {
         self.navigationController?.navigationBar.topItem?.title = NSLocalizedString("_notification_", comment: "")
         self.navigationController?.navigationBar.barTintColor = NCBrandColor.sharedInstance.brand
         self.navigationController?.navigationBar.tintColor = NCBrandColor.sharedInstance.brandText
-        self.navigationController?.navigationBar.titleTextAttributes = [NSAttributedStringKey.foregroundColor: NCBrandColor.sharedInstance.brandText]
+        self.navigationController?.navigationBar.titleTextAttributes = [NSAttributedString.Key.foregroundColor: NCBrandColor.sharedInstance.brandText]
         self.navigationController?.navigationBar.isTranslucent = false
 
         self.navigationItem.setRightBarButton(UIBarButtonItem(barButtonSystemItem: .done, target: self, action: #selector(viewClose)), animated: true)
         
         self.tableView.separatorColor = NCBrandColor.sharedInstance.seperator
         self.tableView.tableFooterView = UIView()
-        self.tableView.rowHeight = UITableViewAutomaticDimension
+        self.tableView.rowHeight = UITableView.automaticDimension
         self.tableView.estimatedRowHeight = 50.0
 
         // Register to receive notification reload data

+ 0 - 65
iOSClient/Richdocument/NCRichdocument.swift

@@ -1,65 +0,0 @@
-//
-//  NCRichdocument.swift
-//  Nextcloud
-//
-//  Created by Marino Faggiana on 06/09/18.
-//  Copyright © 2018 TWS. All rights reserved.
-//
-//  Author Marino Faggiana <m.faggiana@twsweb.it>
-//
-//  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
-
-class NCRichdocument: NSObject, SwiftWebVCDelegate {
-    
-    @objc static let sharedInstance: NCRichdocument = {
-        let instance = NCRichdocument()
-        return instance
-    }()
-    
-    let appDelegate = UIApplication.shared.delegate as! AppDelegate
-
-    @objc func viewRichDocumentAt(_ link: String, navigationViewController: UINavigationController) {
-        
-        let webVC = SwiftWebVC(urlString: link, hideToolbar: true)
-        webVC.delegate = self
-        navigationViewController.setViewControllers([webVC], animated: false)
-    }
-    
-    func didStartLoading() {
-        print("Started loading.")
-    }
-    
-    func didReceiveServerRedirectForProvisionalNavigation(url: URL) {
-        
-    }
-    
-    func didFinishLoading(success: Bool) {
-        print("Finished loading. Success: \(success).")
-    }
-    
-    func didFinishLoading(success: Bool, url: URL) {
-        print("Finished loading. Success: \(success).")
-    }
-    
-    func webDismiss() {
-        print("Web dismiss.")
-    }
-    
-    func decidePolicyForNavigationAction(_ webView: WKWebView, decidePolicyFor navigationAction: WKNavigationAction, decisionHandler: @escaping (WKNavigationActionPolicy) -> Void) {
-        decisionHandler(.allow)
-    }
-}

+ 2 - 2
iOSClient/Scan/ScanCollectionView.swift

@@ -281,7 +281,7 @@ class DragDropViewController: UIViewController {
     
     @objc func handleLongPressGesture(recognizer: UIGestureRecognizer) {
         
-        if recognizer.state == UIGestureRecognizerState.began {
+        if recognizer.state == UIGestureRecognizer.State.began {
         
             self.becomeFirstResponder()
             
@@ -326,7 +326,7 @@ class DragDropViewController: UIViewController {
             }
             
             do {
-                try UIImagePNGRepresentation(image)?.write(to: NSURL.fileURL(withPath: fileNamePath), options: .atomic)
+                try image.pngData()?.write(to: NSURL.fileURL(withPath: fileNamePath), options: .atomic)
             } catch {
                 return
             }

+ 1 - 1
iOSClient/Scan/WeScan/Common/QuadrilateralView.swift

@@ -60,7 +60,7 @@ final class QuadrilateralView: UIView {
                 return
             }
             quadLayer.fillColor = isHighlighted ? UIColor.clear.cgColor : UIColor(white: 0.0, alpha: 0.6).cgColor
-            isHighlighted ? bringSubview(toFront: quadView) : sendSubview(toBack: quadView)
+            isHighlighted ? bringSubviewToFront(quadView) : sendSubviewToBack(quadView)
         }
     }
     

+ 1 - 1
iOSClient/Scan/WeScan/Extensions/CGPoint+Utils.swift

@@ -26,7 +26,7 @@ extension CGPoint {
     ///   - point: The second point to compare this instance with.
     /// - Returns: True if the given `CGPoint` is within the given distance of this instance of `CGPoint`.
     func isWithin(delta: CGFloat, ofPoint point: CGPoint) -> Bool {
-        return (fabs(x - point.x) <= delta) && (fabs(y - point.y) <= delta)
+        return (abs(x - point.x) <= delta) && (abs(y - point.y) <= delta)
     }
     
     /// Returns the same `CGPoint` in the cartesian coordinate system.

+ 1 - 1
iOSClient/Scan/WeScan/ImageScannerController.swift

@@ -93,7 +93,7 @@ public final class ImageScannerController: UINavigationController {
     }
     
     internal func flashToBlack() {
-        view.bringSubview(toFront: blackFlashView)
+        view.bringSubviewToFront(blackFlashView)
         blackFlashView.isHidden = false
         let flashDuration = DispatchTime.now() + 0.05
         DispatchQueue.main.asyncAfter(deadline: flashDuration) {

+ 2 - 2
iOSClient/Scan/WeScan/Scan/CloseButton.swift

@@ -18,7 +18,7 @@ final class CloseButton: UIControl {
         layer.addSublayer(xLayer)
         backgroundColor = .clear
         isAccessibilityElement = true
-        accessibilityTraits = UIAccessibilityTraitButton
+        accessibilityTraits = UIAccessibilityTraits.button
     }
     
     required init?(coder aDecoder: NSCoder) {
@@ -32,7 +32,7 @@ final class CloseButton: UIControl {
         xLayer.path = pathForX(inRect: rect.insetBy(dx: xLayer.lineWidth / 2, dy: xLayer.lineWidth / 2)).cgPath
         xLayer.fillColor = UIColor.clear.cgColor
         xLayer.strokeColor = NCBrandColor.sharedInstance.brandText.cgColor
-        xLayer.lineCap = kCALineCapRound
+        xLayer.lineCap = CAShapeLayerLineCap.round
     }
     
     private func pathForX(inRect rect: CGRect) -> UIBezierPath {

+ 2 - 2
iOSClient/Scan/WeScan/Scan/ScannerViewController.swift

@@ -28,7 +28,7 @@ final class ScannerViewController: UIViewController {
     }()
     
     lazy private var activityIndicator: UIActivityIndicatorView = {
-        let activityIndicator = UIActivityIndicatorView(activityIndicatorStyle: .gray)
+        let activityIndicator = UIActivityIndicatorView(style: .gray)
         activityIndicator.hidesWhenStopped = true
         activityIndicator.translatesAutoresizingMaskIntoConstraints = false
         return activityIndicator
@@ -61,7 +61,7 @@ final class ScannerViewController: UIViewController {
         captureSessionManager?.start()
         UIApplication.shared.isIdleTimerDisabled = true
         
-        self.navigationController?.navigationBar.titleTextAttributes = [NSAttributedStringKey.foregroundColor: NCBrandColor.sharedInstance.brandText]
+        self.navigationController?.navigationBar.titleTextAttributes = [NSAttributedString.Key.foregroundColor: NCBrandColor.sharedInstance.brandText]
         self.navigationController?.navigationBar.barTintColor = NCBrandColor.sharedInstance.brand
     }
     

+ 2 - 2
iOSClient/Scan/WeScan/Scan/ShutterButton.swift

@@ -37,7 +37,7 @@ final class ShutterButton: UIControl {
         layer.addSublayer(innerCircleLayer)
         backgroundColor = .clear
         isAccessibilityElement = true
-        accessibilityTraits = UIAccessibilityTraitButton
+        accessibilityTraits = UIAccessibilityTraits.button
         impactFeedbackGenerator.prepare()
     }
     
@@ -71,7 +71,7 @@ final class ShutterButton: UIControl {
         }
         animation.values = values
         animation.isRemovedOnCompletion = false
-        animation.fillMode = kCAFillModeForwards
+        animation.fillMode = CAMediaTimingFillMode.forwards
         animation.duration = isHighlighted ? 0.35 : 0.10
         
         innerCircleLayer.add(animation, forKey: "transform")

+ 13 - 10
iOSClient/Settings/CCAdvanced.m

@@ -112,16 +112,19 @@
     
     // Section : Files App --------------------------------------------------------------
     
-    section = [XLFormSectionDescriptor formSection];
-    [form addFormSection:section];
-    section.footerTitle = NSLocalizedString(@"_disable_files_app_footer_", nil);
-
-    // Disable Files App
-    row = [XLFormRowDescriptor formRowDescriptorWithTag:@"disablefilesapp" rowType:XLFormRowDescriptorTypeBooleanSwitch title:NSLocalizedString(@"_disable_files_app_", nil)];
-    if ([CCUtility getDisableFilesApp]) row.value = @"1";
-    else row.value = @"0";
-    [row.cellConfig setObject:[UIFont systemFontOfSize:15.0]forKey:@"textLabel.font"];
-    [section addFormRow:row];
+    if (![NCBrandOptions sharedInstance].disable_openin_file) {
+    
+        section = [XLFormSectionDescriptor formSection];
+        [form addFormSection:section];
+        section.footerTitle = NSLocalizedString(@"_disable_files_app_footer_", nil);
+
+        // Disable Files App
+        row = [XLFormRowDescriptor formRowDescriptorWithTag:@"disablefilesapp" rowType:XLFormRowDescriptorTypeBooleanSwitch title:NSLocalizedString(@"_disable_files_app_", nil)];
+        if ([CCUtility getDisableFilesApp]) row.value = @"1";
+        else row.value = @"0";
+        [row.cellConfig setObject:[UIFont systemFontOfSize:15.0]forKey:@"textLabel.font"];
+        [section addFormRow:row];
+    }
     
     // Section CLEAR CACHE -------------------------------------------------
     

+ 2 - 2
iOSClient/Settings/NCManageAutoUploadFileName.swift

@@ -154,9 +154,9 @@ class NCManageAutoUploadFileName: XLFormViewController {
         self.navigationController?.navigationBar.isTranslucent = false
         self.navigationController?.navigationBar.barTintColor = NCBrandColor.sharedInstance.brand
         self.navigationController?.navigationBar.tintColor = NCBrandColor.sharedInstance.brandText
-        self.navigationController?.navigationBar.titleTextAttributes = [NSAttributedStringKey.foregroundColor: NCBrandColor.sharedInstance.brandText]
+        self.navigationController?.navigationBar.titleTextAttributes = [NSAttributedString.Key.foregroundColor: NCBrandColor.sharedInstance.brandText]
         
-        self.tableView.separatorStyle = UITableViewCellSeparatorStyle.none
+        self.tableView.separatorStyle = UITableViewCell.SeparatorStyle.none
                 
         self.reloadForm()
     }

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


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


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


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


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


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


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


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


+ 4 - 4
iOSClient/Text/NCText.swift

@@ -46,13 +46,13 @@ class NCText: UIViewController, UITextViewDelegate {
         
         super.viewDidLoad()
         
-        NotificationCenter.default.addObserver(self, selector: #selector(self.keyboardWillShowHandle(info:)), name: .UIKeyboardWillShow, object: nil)
-        NotificationCenter.default.addObserver(self, selector:#selector(self.keyboardWillHideHandle), name: .UIKeyboardWillHide, object: nil)
+        NotificationCenter.default.addObserver(self, selector: #selector(self.keyboardWillShowHandle(info:)), name: UIResponder.keyboardWillShowNotification, object: nil)
+        NotificationCenter.default.addObserver(self, selector:#selector(self.keyboardWillHideHandle), name: UIResponder.keyboardWillHideNotification, object: nil)
 
         self.navigationController?.navigationBar.topItem?.title = NSLocalizedString("_untitled_txt_", comment: "")
         self.navigationController?.navigationBar.barTintColor = NCBrandColor.sharedInstance.brand
         self.navigationController?.navigationBar.tintColor = NCBrandColor.sharedInstance.brandText
-        self.navigationController?.navigationBar.titleTextAttributes = [NSAttributedStringKey.foregroundColor: NCBrandColor.sharedInstance.brandText]
+        self.navigationController?.navigationBar.titleTextAttributes = [NSAttributedString.Key.foregroundColor: NCBrandColor.sharedInstance.brandText]
         self.navigationController?.navigationBar.isTranslucent = false
 
         self.navigationController?.toolbar.barTintColor = NCBrandColor.sharedInstance.brandText
@@ -99,7 +99,7 @@ class NCText: UIViewController, UITextViewDelegate {
         let frameView = self.view.convert(self.view.bounds, to: self.view.window)
         let endView = frameView.origin.y + frameView.size.height
         
-        if let keyboardSize = (info.userInfo?[UIKeyboardFrameEndUserInfoKey] as? NSValue)?.cgRectValue, let _ = self.view.window?.frame {
+        if let keyboardSize = (info.userInfo?[UIResponder.keyboardFrameEndUserInfoKey] as? NSValue)?.cgRectValue, let _ = self.view.window?.frame {
             
             if endView - keyboardSize.origin.y > 0 {
                 bottomConstraint.constant = endView - keyboardSize.origin.y

+ 2 - 1
iOSClient/Utility/CCUtility.h

@@ -169,7 +169,8 @@
 + (NSString *)stringAppendServerUrl:(NSString *)serverUrl addFileName:(NSString *)addFileName;
 
 + (NSString *)createRandomString:(int)numChars;
-+ (NSString *)createFileName:fileName fileDate:(NSDate *)fileDate fileType:(PHAssetMediaType)fileType keyFileName:(NSString *)keyFileName keyFileNameType:(NSString *)keyFileNameType keyFileNameOriginal:(NSString *)keyFileNameOriginal;
++ (NSString *)createFileNameDate:(NSString *)fileName extension:(NSString *)extension;
++ (NSString *)createFileName:(NSString *)fileName fileDate:(NSDate *)fileDate fileType:(PHAssetMediaType)fileType keyFileName:(NSString *)keyFileName keyFileNameType:(NSString *)keyFileNameType keyFileNameOriginal:(NSString *)keyFileNameOriginal;
 
 + (NSURL *)getDirectoryGroup;
 + (NSString *)getHomeServerUrlActiveUrl:(NSString *)activeUrl;

+ 10 - 1
iOSClient/Utility/CCUtility.m

@@ -685,7 +685,16 @@
     return [NSString stringWithFormat:@"%@", randomString];
 }
 
-+ (NSString *)createFileName:fileName fileDate:(NSDate *)fileDate fileType:(PHAssetMediaType)fileType keyFileName:(NSString *)keyFileName keyFileNameType:(NSString *)keyFileNameType keyFileNameOriginal:(NSString *)keyFileNameOriginal
++ (NSString *)createFileNameDate:(NSString *)fileName extension:(NSString *)extension
+{
+    NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
+    [formatter setDateFormat:@"yy-MM-dd HH-mm-ss"];
+    NSString *fileNameDate = [formatter stringFromDate:[NSDate date]];
+    
+    return [NSString stringWithFormat:@"%@ %@.%@", fileName, fileNameDate, extension];
+}
+
++ (NSString *)createFileName:(NSString *)fileName fileDate:(NSDate *)fileDate fileType:(PHAssetMediaType)fileType keyFileName:(NSString *)keyFileName keyFileNameType:(NSString *)keyFileNameType keyFileNameOriginal:(NSString *)keyFileNameOriginal
 {
     BOOL addFileNameType = NO;
     

+ 145 - 0
iOSClient/Viewer/NCViewerMedia.swift

@@ -0,0 +1,145 @@
+//
+//  NCViewerMedia.swift
+//  Nextcloud
+//
+//  Created by Marino Faggiana on 21/09/18.
+//  Copyright © 2018 TWS. All rights reserved.
+//
+
+import Foundation
+import KTVHTTPCache
+
+class NCViewerMedia: NSObject {
+    
+    @objc static let sharedInstance: NCViewerMedia = {
+        let viewMedia = NCViewerMedia()
+        viewMedia.setupHTTPCache()
+        return viewMedia
+    }()
+
+    var viewDetail: CCDetail!
+    var metadata: tableMetadata!
+    var videoURL: URL!
+    let appDelegate = UIApplication.shared.delegate as! AppDelegate
+    
+    @objc func viewMedia(_ metadata: tableMetadata, viewDetail: CCDetail, width: Int, height: Int) {
+        
+        var videoURLProxy: URL!
+
+        self.viewDetail = viewDetail
+        self.metadata = metadata
+        
+        guard let serverUrl = NCManageDatabase.sharedInstance.getServerUrl(metadata.directoryID) else {
+            return
+        }
+        
+        if CCUtility.fileProviderStorageExists(metadata.fileID, fileNameView: metadata.fileNameView) {
+        
+            self.videoURL = URL(fileURLWithPath: CCUtility.getDirectoryProviderStorageFileID(metadata.fileID, fileNameView: metadata.fileNameView))
+            videoURLProxy = videoURL
+        
+        } else {
+            
+            guard let stringURL = (serverUrl + "/" + metadata.fileName).addingPercentEncoding(withAllowedCharacters: .urlQueryAllowed) else {
+                return
+            }
+            
+            self.videoURL = URL(string: stringURL)
+            videoURLProxy = KTVHTTPCache.proxyURL(withOriginalURL: self.videoURL)
+            
+            guard let authData = (appDelegate.activeUser + ":" + appDelegate.activePassword).data(using: .utf8) else {
+                return
+            }
+            
+            let authValue = "Basic " + authData.base64EncodedString(options: [])
+            KTVHTTPCache.downloadSetAdditionalHeaders(["Authorization":authValue, "User-Agent":CCUtility.getUserAgent()])
+            
+            // Disable Button Action (the file is in download via Proxy Server)
+            viewDetail.buttonAction.isEnabled = false
+        }
+        
+        appDelegate.player = AVPlayer(url: videoURLProxy)
+        appDelegate.playerController = AVPlayerViewController()
+        
+        appDelegate.playerController.player = appDelegate.player
+        appDelegate.playerController.view.frame = CGRect(x: 0, y: 0, width: width, height: height)
+        appDelegate.playerController.allowsPictureInPicturePlayback = false
+        viewDetail.addChild(appDelegate.playerController)
+        viewDetail.view.addSubview(appDelegate.playerController.view)
+        appDelegate.playerController.didMove(toParent: viewDetail)
+        
+        NotificationCenter.default.addObserver(forName: .AVPlayerItemDidPlayToEndTime, object: nil, queue: nil) { (notification) in
+            let player = notification.object as! AVPlayerItem
+            player.seek(to: CMTime.zero)
+        }
+        
+        appDelegate.player.addObserver(self, forKeyPath: "rate", options: [], context: nil)
+        
+        viewDetail.isMediaObserver = true
+        
+        appDelegate.player.play()
+    }
+    
+    override func observeValue(forKeyPath keyPath: String?, of object: Any?, change: [NSKeyValueChangeKey : Any]?, context: UnsafeMutableRawPointer?) {
+        
+        if keyPath != nil && keyPath == "rate" {
+            
+            if appDelegate.player.rate == 1 {
+                print("start")
+            } else {
+                print("stop")
+            }
+            
+            // Save cache
+            if !CCUtility.fileProviderStorageExists(self.metadata.fileID, fileNameView:self.metadata.fileNameView) {
+                guard let url = KTVHTTPCache.cacheCompleteFileURLIfExisted(with: self.videoURL) else {
+                    return
+                }
+                
+                CCUtility.copyFile(atPath: url.path, toPath: CCUtility.getDirectoryProviderStorageFileID(self.metadata.fileID, fileNameView: self.metadata.fileNameView))
+                NCManageDatabase.sharedInstance.addLocalFile(metadata: self.metadata)
+                KTVHTTPCache.cacheDelete(with: self.videoURL)
+                
+                // reload Data Source
+                NCMainCommon.sharedInstance.reloadDatasource(ServerUrl: NCManageDatabase.sharedInstance.getServerUrl(self.metadata.directoryID), fileID: self.metadata.fileID, action: k_action_MOD)
+                
+                // Enabled Button Action (the file is in local)
+                self.viewDetail.buttonAction.isEnabled = true
+            }
+        }
+    }
+    
+    @objc func removeObserver() {
+        
+        appDelegate.player.removeObserver(self, forKeyPath: "rate", context: nil)
+        NotificationCenter.default.removeObserver(self, name: NSNotification.Name.AVPlayerItemDidPlayToEndTime, object: nil)
+    }
+    
+    @objc func setupHTTPCache() {
+        
+        var error: NSError?
+
+        KTVHTTPCache.cacheSetMaxCacheLength(Int64(k_maxHTTPCache))
+        
+        if ProcessInfo.processInfo.environment["SIMULATOR_DEVICE_NAME"] != nil {
+            KTVHTTPCache.logSetConsoleLogEnable(true)
+        }
+        
+        KTVHTTPCache.proxyStart(&error)
+        if error == nil {
+            print("Proxy Start Success")
+        } else {
+            print("Proxy Start error : \(error!)")
+        }
+    
+        KTVHTTPCache.tokenSetURLFilter { (url) -> URL? in
+            print("URL Filter reviced URL : " + String(describing: url))
+            return url
+        }
+        
+        KTVHTTPCache.downloadSetUnsupportContentTypeFilter { (url, contentType) -> Bool in
+            print("Unsupport Content-Type Filter reviced URL : " + String(describing: url) + " " + String(describing: contentType))
+            return false
+        }
+    }
+}

+ 142 - 0
iOSClient/Viewer/NCViewerRichdocument.swift

@@ -0,0 +1,142 @@
+//
+//  NCViewerRichdocument.swift
+//  Nextcloud
+//
+//  Created by Marino Faggiana on 06/09/18.
+//  Copyright © 2018 TWS. All rights reserved.
+//
+//  Author Marino Faggiana <m.faggiana@twsweb.it>
+//
+//  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
+
+class NCViewerRichdocument: NSObject, WKNavigationDelegate, WKScriptMessageHandler, CCMoveDelegate {
+    
+    @objc static let sharedInstance: NCViewerRichdocument = {
+        let instance = NCViewerRichdocument()
+        return instance
+    }()
+    
+    var viewDetail: CCDetail!
+    var webView: WKWebView!
+    let appDelegate = UIApplication.shared.delegate as! AppDelegate
+
+    @objc func viewRichDocumentAt(_ link: String, viewDetail: CCDetail) {
+        
+        self.viewDetail = viewDetail
+        
+        let contentController = WKUserContentController()
+        contentController.add(self, name: "RichDocumentsMobileInterface")
+        let configuration = WKWebViewConfiguration()
+        configuration.userContentController = contentController
+        
+        webView = WKWebView(frame: viewDetail.view.bounds, configuration: configuration)
+        webView.autoresizingMask = [.flexibleWidth, .flexibleHeight]
+//        webView.scrollView.showsHorizontalScrollIndicator = true
+//        webView.scrollView.showsVerticalScrollIndicator = true
+        webView.navigationDelegate = self
+        
+        var request = URLRequest(url: URL(string: link)!)
+        request.addValue("true", forHTTPHeaderField: "OCS-APIRequest")
+        let language = NSLocale.preferredLanguages[0] as String
+        request.addValue(language, forHTTPHeaderField: "Accept-Language")
+        
+        let userAgent : String = CCUtility.getUserAgent()
+        webView.customUserAgent = userAgent
+        webView.load(request)
+        
+        viewDetail.view.addSubview(webView)
+    }
+    
+    //MARK: -
+
+    public func userContentController(_ userContentController: WKUserContentController, didReceive message: WKScriptMessage) {
+        
+        if (message.name == "RichDocumentsMobileInterface") {
+            
+            if message.body as! String == "close" {
+
+                self.webView.removeFromSuperview()
+                
+                self.viewDetail.navigationController?.popToRootViewController(animated: true)
+                self.viewDetail.navigationController?.navigationBar.topItem?.title = ""
+            }
+            
+            if message.body as! String == "insertGraphic" {
+                
+                let storyboard = UIStoryboard(name: "CCMove", bundle: nil)
+                let movieNavigationController = storyboard.instantiateViewController(withIdentifier: "CCMove") as! UINavigationController
+                let moveViewController = movieNavigationController.topViewController as! CCMove
+                
+                moveViewController.delegate = self
+                moveViewController.hideMoveutton = true
+                moveViewController.hideCreateFolder = true
+                moveViewController.tintColor = NCBrandColor.sharedInstance.brandText
+                moveViewController.barTintColor = NCBrandColor.sharedInstance.brand
+                moveViewController.tintColorTitle = NCBrandColor.sharedInstance.brandText
+                moveViewController.networkingOperationQueue = appDelegate.netQueue
+                moveViewController.includeImages = true
+                moveViewController.includeDirectoryE2EEncryption = false
+                moveViewController.selectFile = true
+                
+                movieNavigationController.modalPresentationStyle = UIModalPresentationStyle.formSheet
+                self.viewDetail.present(movieNavigationController, animated: true, completion: nil)
+            }
+            
+            if message.body as! String == "share" {
+                appDelegate.activeMain.openWindowShare(viewDetail.metadataDetail)
+            }
+        }
+    }
+    
+    //MARK: -
+    
+    func select(_ metadata: tableMetadata!, serverUrl: String!) {
+        
+        let ocNetworking = OCnetworking.init(delegate: self, metadataNet: nil, withUser: appDelegate.activeUser, withUserID: appDelegate.activeUserID, withPassword: appDelegate.activePassword, withUrl: appDelegate.activeUrl)
+        ocNetworking?.createAssetRichdocuments(withFileName: metadata.fileName, serverUrl: serverUrl, success: { (url) in
+
+            let functionJS = "OCA.RichDocuments.documentsMain.postAsset('\(metadata.fileNameView)', '\(url!)')"
+            self.webView.evaluateJavaScript(functionJS, completionHandler: { (result, error) in })
+            
+        }, failure: { (message, errorCode) in
+            self.appDelegate.messageNotification("_error_", description: message, visible: true, delay: TimeInterval(k_dismissAfterSecond), type: TWMessageBarMessageType.error, errorCode: Int(k_CCErrorInternalError))
+        })
+    }
+    
+    //MARK: -
+
+    public func webView(_ webView: WKWebView, didReceive challenge: URLAuthenticationChallenge, completionHandler: @escaping (URLSession.AuthChallengeDisposition, URLCredential?) -> Void) {
+        if let serverTrust = challenge.protectionSpace.serverTrust {
+            completionHandler(Foundation.URLSession.AuthChallengeDisposition.useCredential, URLCredential(trust: serverTrust))
+        } else {
+            completionHandler(URLSession.AuthChallengeDisposition.useCredential, nil);
+        }
+    }
+    
+    public func webView(_ webView: WKWebView, didStartProvisionalNavigation navigation: WKNavigation!) {
+        print("didStartProvisionalNavigation");
+    }
+    
+    public func webView(_ webView: WKWebView, didReceiveServerRedirectForProvisionalNavigation navigation: WKNavigation!) {
+        print("didReceiveServerRedirectForProvisionalNavigation");
+    }
+    
+    public func webView(_ webView: WKWebView, didFinish navigation: WKNavigation!) {
+        print("didFinish");
+    }
+    
+}

Энэ ялгаанд хэт олон файл өөрчлөгдсөн тул зарим файлыг харуулаагүй болно