Browse Source

Merge branch 'develop'

# Conflicts:
#	README.md
Marino Faggiana 7 years ago
parent
commit
c2bdd79cb3
100 changed files with 2468 additions and 2304 deletions
  1. BIN
      Libraries external/Fabric/Crashlytics.framework/Crashlytics
  2. 3 3
      Libraries external/Fabric/Crashlytics.framework/Headers/Answers.h
  3. 1 1
      Libraries external/Fabric/Crashlytics.framework/Headers/CLSReport.h
  4. 1 1
      Libraries external/Fabric/Crashlytics.framework/Headers/Crashlytics.h
  5. BIN
      Libraries external/Fabric/Crashlytics.framework/Info.plist
  6. BIN
      Libraries external/Fabric/Crashlytics.framework/submit
  7. BIN
      Libraries external/Fabric/Crashlytics.framework/uploadDSYM
  8. BIN
      Libraries external/Fabric/Fabric.framework/Fabric
  9. BIN
      Libraries external/Fabric/Fabric.framework/Info.plist
  10. BIN
      Libraries external/Fabric/Fabric.framework/uploadDSYM
  11. 217 210
      Libraries external/Realm/Realm.framework/CCC01789-DF7D-3342-BCD7-8FA8E534B0C1.bcsymbolmap
  12. 452 0
      Libraries external/Realm/Realm.framework/CHANGELOG.md
  13. 222 213
      Libraries external/Realm/Realm.framework/E685B084-64C0-3CB5-B4F7-A049D36D911A.bcsymbolmap
  14. 7 11
      Libraries external/Realm/Realm.framework/Headers/NSError+RLMSync.h
  15. 24 23
      Libraries external/Realm/Realm.framework/Headers/RLMArray.h
  16. 23 34
      Libraries external/Realm/Realm.framework/Headers/RLMCollection.h
  17. 17 5
      Libraries external/Realm/Realm.framework/Headers/RLMConstants.h
  18. 6 6
      Libraries external/Realm/Realm.framework/Headers/RLMObject.h
  19. 5 0
      Libraries external/Realm/Realm.framework/Headers/RLMProperty.h
  20. 49 0
      Libraries external/Realm/Realm.framework/Headers/RLMRealm+Sync.h
  21. 23 24
      Libraries external/Realm/Realm.framework/Headers/RLMRealm.h
  22. 4 4
      Libraries external/Realm/Realm.framework/Headers/RLMRealm_Dynamic.h
  23. 26 26
      Libraries external/Realm/Realm.framework/Headers/RLMResults.h
  24. 9 0
      Libraries external/Realm/Realm.framework/Headers/RLMSyncConfiguration.h
  25. 0 12
      Libraries external/Realm/Realm.framework/Headers/RLMSyncManager.h
  26. 135 22
      Libraries external/Realm/Realm.framework/Headers/RLMSyncPermission.h
  27. 0 90
      Libraries external/Realm/Realm.framework/Headers/RLMSyncPermissionChange.h
  28. 0 91
      Libraries external/Realm/Realm.framework/Headers/RLMSyncPermissionOffer.h
  29. 0 73
      Libraries external/Realm/Realm.framework/Headers/RLMSyncPermissionOfferResponse.h
  30. 0 112
      Libraries external/Realm/Realm.framework/Headers/RLMSyncPermissionResults.h
  31. 0 141
      Libraries external/Realm/Realm.framework/Headers/RLMSyncPermissionValue.h
  32. 35 8
      Libraries external/Realm/Realm.framework/Headers/RLMSyncSession.h
  33. 99 48
      Libraries external/Realm/Realm.framework/Headers/RLMSyncUser.h
  34. 34 41
      Libraries external/Realm/Realm.framework/Headers/RLMSyncUtil.h
  35. 1 5
      Libraries external/Realm/Realm.framework/Headers/Realm.h
  36. BIN
      Libraries external/Realm/Realm.framework/Info.plist
  37. 4 0
      Libraries external/Realm/Realm.framework/PrivateHeaders/RLMArray_Private.h
  38. 36 3
      Libraries external/Realm/Realm.framework/PrivateHeaders/RLMObject_Private.h
  39. 0 2
      Libraries external/Realm/Realm.framework/PrivateHeaders/RLMProperty_Private.h
  40. 2 2
      Libraries external/Realm/Realm.framework/PrivateHeaders/RLMRealm_Private.h
  41. 0 39
      Libraries external/Realm/Realm.framework/PrivateHeaders/RLMSyncPermissionChange_Private.h
  42. 0 36
      Libraries external/Realm/Realm.framework/PrivateHeaders/RLMSyncPermissionOfferResponse_Private.h
  43. 0 42
      Libraries external/Realm/Realm.framework/PrivateHeaders/RLMSyncPermissionOffer_Private.h
  44. 6 14
      Libraries external/Realm/Realm.framework/PrivateHeaders/RLMSyncPermissionResults.h
  45. 18 9
      Libraries external/Realm/Realm.framework/PrivateHeaders/RLMSyncUtil_Private.h
  46. BIN
      Libraries external/Realm/Realm.framework/Realm
  47. 69 9
      Libraries external/Realm/RealmSwift.framework/4DCF9A64-5566-3707-8650-C190D326B91D.bcsymbolmap
  48. 69 9
      Libraries external/Realm/RealmSwift.framework/AA452621-74A4-393C-9670-BBA49D7D49CD.bcsymbolmap
  49. 217 210
      Libraries external/Realm/RealmSwift.framework/CCC01789-DF7D-3342-BCD7-8FA8E534B0C1.bcsymbolmap
  50. 222 213
      Libraries external/Realm/RealmSwift.framework/E685B084-64C0-3CB5-B4F7-A049D36D911A.bcsymbolmap
  51. 7 140
      Libraries external/Realm/RealmSwift.framework/Headers/RealmSwift-Swift.h
  52. BIN
      Libraries external/Realm/RealmSwift.framework/Info.plist
  53. BIN
      Libraries external/Realm/RealmSwift.framework/Modules/RealmSwift.swiftmodule/arm.swiftdoc
  54. BIN
      Libraries external/Realm/RealmSwift.framework/Modules/RealmSwift.swiftmodule/arm.swiftmodule
  55. BIN
      Libraries external/Realm/RealmSwift.framework/Modules/RealmSwift.swiftmodule/arm64.swiftdoc
  56. BIN
      Libraries external/Realm/RealmSwift.framework/Modules/RealmSwift.swiftmodule/arm64.swiftmodule
  57. BIN
      Libraries external/Realm/RealmSwift.framework/Modules/RealmSwift.swiftmodule/i386.swiftdoc
  58. BIN
      Libraries external/Realm/RealmSwift.framework/Modules/RealmSwift.swiftmodule/i386.swiftmodule
  59. BIN
      Libraries external/Realm/RealmSwift.framework/Modules/RealmSwift.swiftmodule/x86_64.swiftdoc
  60. BIN
      Libraries external/Realm/RealmSwift.framework/Modules/RealmSwift.swiftmodule/x86_64.swiftmodule
  61. BIN
      Libraries external/Realm/RealmSwift.framework/RealmSwift
  62. 18 6
      Nextcloud.xcodeproj/project.pbxproj
  63. 4 0
      README.md
  64. 1 1
      iOSClient/Actions/CCActions.swift
  65. 2 2
      iOSClient/Brand/Picker.plist
  66. 2 2
      iOSClient/Brand/PickerFileProvider.plist
  67. 2 2
      iOSClient/Brand/Share.plist
  68. 2 2
      iOSClient/Brand/iOSClient.plist
  69. 0 4
      iOSClient/CCGlobal.h
  70. 2 2
      iOSClient/Create/CCCreateCloud.swift
  71. 19 0
      iOSClient/Database/NCDatabase.swift
  72. 166 31
      iOSClient/Database/NCManageDatabase.swift
  73. 1 1
      iOSClient/Favorites/CCFavorites.m
  74. 0 23
      iOSClient/Images.xcassets/bancomat.imageset/Contents.json
  75. BIN
      iOSClient/Images.xcassets/bancomat.imageset/bancomat.png
  76. BIN
      iOSClient/Images.xcassets/bancomat.imageset/bancomat@2x.png
  77. BIN
      iOSClient/Images.xcassets/bancomat.imageset/bancomat@3x.png
  78. 0 23
      iOSClient/Images.xcassets/cartadicredito.imageset/Contents.json
  79. BIN
      iOSClient/Images.xcassets/cartadicredito.imageset/cartadicredito.png
  80. BIN
      iOSClient/Images.xcassets/cartadicredito.imageset/cartadicredito@2x.png
  81. BIN
      iOSClient/Images.xcassets/cartadicredito.imageset/cartadicredito@3x.png
  82. 0 23
      iOSClient/Images.xcassets/cartaidentita.imageset/Contents.json
  83. BIN
      iOSClient/Images.xcassets/cartaidentita.imageset/cartaidentita.png
  84. BIN
      iOSClient/Images.xcassets/cartaidentita.imageset/cartaidentita@2x.png
  85. BIN
      iOSClient/Images.xcassets/cartaidentita.imageset/cartaidentita@3x.png
  86. 0 23
      iOSClient/Images.xcassets/foldercrypto.imageset/Contents.json
  87. BIN
      iOSClient/Images.xcassets/foldercrypto.imageset/foldercrypto.png
  88. BIN
      iOSClient/Images.xcassets/foldercrypto.imageset/foldercrypto@2x.png
  89. BIN
      iOSClient/Images.xcassets/foldercrypto.imageset/foldercrypto@3x.png
  90. 2 3
      iOSClient/Library/AHKActionSheet/AHKActionSheet.m
  91. 1 1
      iOSClient/Library/OCCommunicationLib/OCCommunication.h
  92. 7 7
      iOSClient/Library/OCCommunicationLib/OCCommunication.m
  93. 1 1
      iOSClient/Library/OCCommunicationLib/OCWebDavClient/OCWebDAVClient.h
  94. 63 79
      iOSClient/Library/OCCommunicationLib/OCWebDavClient/OCWebDAVClient.m
  95. 2 0
      iOSClient/Library/OCCommunicationLib/OCWebDavClient/Parsers/OCXMLParser.m
  96. 33 27
      iOSClient/Login/CCLogin.m
  97. 3 1
      iOSClient/Login/CCLoginWeb.swift
  98. 1 1
      iOSClient/Main/CCDetail.m
  99. 3 0
      iOSClient/Main/CCMain.h
  100. 90 107
      iOSClient/Main/CCMain.m

BIN
Libraries external/Fabric/Crashlytics.framework/Crashlytics


+ 3 - 3
Libraries external/Fabric/Crashlytics.framework/Headers/Answers.h

@@ -72,7 +72,7 @@ NS_ASSUME_NONNULL_BEGIN
  *
  *  @param itemPriceOrNil         The purchased item's price.
  *  @param currencyOrNil          The ISO4217 currency code. Example: USD
- *  @param purchaseSucceededOrNil Was the purchase succesful or unsuccesful
+ *  @param purchaseSucceededOrNil Was the purchase successful or unsuccessful
  *  @param itemNameOrNil          The human-readable form of the item's name. Example:
  *  @param itemTypeOrNil          The type, or genre of the item. Example: Song
  *  @param itemIdOrNil            The machine-readable, unique item identifier Example: SKU
@@ -100,7 +100,7 @@ NS_ASSUME_NONNULL_BEGIN
  *
  *  @param levelNameOrNil                 The name of the level completed, E.G. "1" or "Training"
  *  @param scoreOrNil                     The score the user completed the level with.
- *  @param levelCompletedSuccesfullyOrNil A boolean representing whether or not the level was completed succesfully.
+ *  @param levelCompletedSuccesfullyOrNil A boolean representing whether or not the level was completed successfully.
  *  @param customAttributesOrNil          A dictionary of custom attributes to associate with this event.
  */
 + (void)logLevelEnd:(nullable NSString *)levelNameOrNil
@@ -189,7 +189,7 @@ NS_ASSUME_NONNULL_BEGIN
  *
  *  @param eventName             The human-readable name for the event.
  *  @param customAttributesOrNil A dictionary of custom attributes to associate with this event. Attribute keys
- *                               must be <code>NSString</code> and and values must be <code>NSNumber</code> or <code>NSString</code>.
+ *                               must be <code>NSString</code> and values must be <code>NSNumber</code> or <code>NSString</code>.
  *  @discussion                  How we treat <code>NSNumbers</code>:
  *                               We will provide information about the distribution of values over time.
  *

+ 1 - 1
Libraries external/Fabric/Crashlytics.framework/Headers/CLSReport.h

@@ -28,7 +28,7 @@ NS_ASSUME_NONNULL_BEGIN
 /**
  * The CLSReport exposes an interface to the phsyical report that Crashlytics has created. You can
  * use this class to get information about the event, and can also set some values after the
- * event has occured.
+ * event has occurred.
  **/
 @interface CLSReport : NSObject <CLSCrashReport>
 

+ 1 - 1
Libraries external/Fabric/Crashlytics.framework/Headers/Crashlytics.h

@@ -179,7 +179,7 @@ NS_ASSUME_NONNULL_BEGIN
  *  Crashlytics.
  *
  *  @param name       The name of the custom exception
- *  @param reason     The reason this exception occured
+ *  @param reason     The reason this exception occurred
  *  @param frameArray An array of CLSStackFrame objects
  */
 - (void)recordCustomExceptionName:(NSString *)name reason:(nullable NSString *)reason frameArray:(CLS_GENERIC_NSARRAY(CLSStackFrame *) *)frameArray;

BIN
Libraries external/Fabric/Crashlytics.framework/Info.plist


BIN
Libraries external/Fabric/Crashlytics.framework/submit


BIN
Libraries external/Fabric/Crashlytics.framework/uploadDSYM


BIN
Libraries external/Fabric/Fabric.framework/Fabric


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


BIN
Libraries external/Fabric/Fabric.framework/uploadDSYM


File diff suppressed because it is too large
+ 217 - 210
Libraries external/Realm/Realm.framework/CCC01789-DF7D-3342-BCD7-8FA8E534B0C1.bcsymbolmap


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

@@ -1,3 +1,455 @@
+3.0.1 Release notes (2017-10-26)
+=============================================================
+
+### Bugfixes
+
+* Explicitly exclude KVO-generated object subclasses from the schema.
+* Fix regression where the type of a Realm model class is not properly determined, causing crashes
+  when a type value derived at runtime by `type(of:)` is passed into certain APIs.
+* Fix a crash when an `Object` subclass has implicitly ignored `let`
+  properties.
+* Fix several cases where adding a notification block from within a
+  notification callback could produce incorrect results.
+
+3.0.0 Release notes (2017-10-16)
+=============================================================
+
+### Breaking Changes
+* iOS 7 is no longer supported.
+* Synchronized Realms require a server running Realm Object Server v2.0 or higher.
+* Computed properties on Realm object types are detected and no
+  longer added to the automatically generated schema.
+* The Objective-C and Swift `create(_:, value: update:)` APIs now
+  correctly nil out nullable properties when updating an existing
+  object when the `value` argument specifies nil or `NSNull` for
+  the property value.
+* `-[RLMRealm addOrUpdateObjects:]` and `-[RLMRealm deleteObjects:]` now
+  require their argument to conform to `NSFastEnumeration`, to match similar
+  APIs that also take collections.
+* The way interactive sync errors (client reset and permission denied)
+  are delivered to the user has been changed. Instead of a block which can
+  be invoked to immediately delete the offending Realm file, an opaque
+  token object of type `RLMSyncErrorActionToken` will be returned in the
+  error object's `userInfo` dictionary. This error object can be passed
+  into the new `+[RLMSyncSession immediatelyHandleError:]` API to delete
+  the files.
+* The return types of the `SyncError.clientResetInfo()` and
+  `SyncError.deleteRealmUserInfo()` APIs have been changed. They now return
+  `RLMSyncErrorActionToken`s or `SyncError.ActionToken`s instead of closures.
+* The class methods `Object.className()`, `Object.objectUtilClass()`, and
+  the property `Object.isInvalidated` can no longer be overriden.
+* The callback which runs when a sync user login succeeds or fails
+  now runs on the main queue by default, or can be explicitly specified
+  by a new `callbackQueue` parameter on the `{RLM}SyncUser.logIn(...)` API.
+* Fix empty strings, binary data, and null on the right side of `BEGINSWITH`,
+  `ENDSWITH` and `CONTAINS` operators in predicates to match Foundation's
+  semantics of never matching any strings or data.
+* Swift `Object` comparison and hashing behavior now works the same way as
+  that of `RLMObject` (objects are now only considered equatable if their
+  model class defines a primary key).
+* Fix the way the hash property works on `Object` when the object model has
+  no primary key.
+* Fix an issue where if a Swift model class defined non-generic managed
+  properties after generic Realm properties (like `List<T>`), the schema
+  would be constructed incorrectly. Fixes an issue where creating such
+  models from an array could fail.
+* Loosen `RLMArray` and `RLMResults`'s generic constraint from `RLMObject` to
+  `NSObject`. This may result in having to add some casts to disambiguate
+  types.
+* Remove `RLMSyncPermissionResults`. `RLMSyncPermission`s are now vended out
+  using a `RLMResults`. This results collection supports all normal collection
+  operations except for setting values using key-value coding (since
+  `RLMSyncPermission`s are immutable) and the property aggregation operations.
+* `RLMSyncUserInfo` has been significantly enhanced. It now contains metadata
+  about a user stored on the Realm Object Server, as well as a list of all user account
+  data associated with that user.
+* Starting with Swift 4, `List` now conforms to `MutableCollection` instead of
+  `RangeReplaceableCollection`. For Swift 4, the empty collection initializer has been
+  removed, and default implementations of range replaceable collection methods that
+  make sense for `List` have been added.
+* `List.removeLast()` now throws an exception if the list is empty, to more closely match
+  the behavior of the standard library's `Collection.removeLast()` implementation.
+* `RealmCollection`'s associated type `Element` has been renamed `ElementType`.
+* The following APIs have been renamed:
+
+| Old API                                                     | New API                                                        |
+|:------------------------------------------------------------|:---------------------------------------------------------------|
+| `NotificationToken.stop()`                                  | `NotificationToken.invalidate()`                               |
+| `-[RLMNotificationToken stop]`                              | `-[RLMNotificationToken invalidate]`                           |
+| `RealmCollection.addNotificationBlock(_:)`                  | `RealmCollection.observe(_:)`                                  |
+| `RLMSyncProgress`                                           | `RLMSyncProgressMode`                                          |
+| `List.remove(objectAtIndex:)`                               | `List.remove(at:)`                                             |
+| `List.swap(_:_:)`                                           | `List.swapAt(_:_:)`                                            |
+| `SyncPermissionValue`                                       | `SyncPermission`                                               |
+| `RLMSyncPermissionValue`                                    | `RLMSyncPermission`                                            |
+| `-[RLMSyncPermission initWithRealmPath:userID:accessLevel]` | `-[RLMSyncPermission initWithRealmPath:identity:accessLevel:]` |
+| `RLMSyncPermission.userId`                                  | `RLMSyncPermission.identity`                                   |
+| `-[RLMRealm addOrUpdateObjectsInArray:]`                    | `-[RLMRealm addOrUpdateObjects:]`                              |
+
+* The following APIs have been removed:
+
+| Removed API                                                  | Replacement                                                                               |
+|:-------------------------------------------------------------|:------------------------------------------------------------------------------------------|
+| `Object.className`                                           | None, was erroneously present.                                                            |
+| `RLMPropertyTypeArray`                                       | `RLMProperty.array`                                                                       |
+| `PropertyType.array`                                         | `Property.array`                                                                          |
+| `-[RLMArray sortedResultsUsingProperty:ascending:]`          | `-[RLMArray sortedResultsUsingKeyPath:ascending:]`                                        |
+| `-[RLMCollection sortedResultsUsingProperty:ascending:]`     | `-[RLMCollection sortedResultsUsingKeyPath:ascending:]`                                   |
+| `-[RLMResults sortedResultsUsingProperty:ascending:]`        | `-[RLMResults sortedResultsUsingKeyPath:ascending:]`                                      |
+| `+[RLMSortDescriptor sortDescriptorWithProperty:ascending:]` | `+[RLMSortDescriptor sortDescriptorWithKeyPath:ascending:]`                               |
+| `RLMSortDescriptor.property`                                 | `RLMSortDescriptor.keyPath`                                                               |
+| `AnyRealmCollection.sorted(byProperty:ascending:)`           | `AnyRealmCollection.sorted(byKeyPath:ascending:)`                                         |
+| `List.sorted(byProperty:ascending:)`                         | `List.sorted(byKeyPath:ascending:)`                                                       |
+| `LinkingObjects.sorted(byProperty:ascending:)`               | `LinkingObjects.sorted(byKeyPath:ascending:)`                                             |
+| `Results.sorted(byProperty:ascending:)`                      | `Results.sorted(byKeyPath:ascending:)`                                                    |
+| `SortDescriptor.init(property:ascending:)`                   | `SortDescriptor.init(keyPath:ascending:)`                                                 |
+| `SortDescriptor.property`                                    | `SortDescriptor.keyPath`                                                                  |
+| `+[RLMRealm migrateRealm:configuration:]`                    | `+[RLMRealm performMigrationForConfiguration:error:]`                                     |
+| `RLMSyncManager.disableSSLValidation`                        | `RLMSyncConfiguration.enableSSLValidation`                                                |
+| `SyncManager.disableSSLValidation`                           | `SyncConfiguration.enableSSLValidation`                                                   |
+| `RLMSyncErrorBadResponse`                                    | `RLMSyncAuthErrorBadResponse`                                                             |
+| `RLMSyncPermissionResults`                                   | `RLMResults`                                                                              |
+| `SyncPermissionResults`                                      | `Results`                                                                                 |
+| `RLMSyncPermissionChange`                                    | `-[RLMSyncUser applyPermission:callback]` / `-[RLMSyncUser deletePermission:callback:]`   |
+| `-[RLMSyncUser permissionRealmWithError:]`                   | `-[RLMSyncUser retrievePermissionsWithCallback:]`                                         |
+| `RLMSyncPermissionOffer`                                     | `-[RLMSyncUser createOfferForRealmAtURL:accessLevel:expiration:callback:]`                |
+| `RLMSyncPermissionOfferResponse`                             | `-[RLMSyncUser acceptOfferForToken:callback:]`                                            |
+| `-[NSError rlmSync_clientResetBlock]`                        | `-[NSError rlmSync_errorActionToken]` / `-[NSError rlmSync_clientResetBackedUpRealmPath]` |
+| `-[NSError rlmSync_deleteRealmBlock]`                        | `-[NSError rlmSync_errorActionToken]`                                                     |
+
+### Enhancements
+* `List` can now contain values of types `Bool`, `Int`, `Int8`, `Int16`,
+  `Int32`, `Int64`, `Float`, `Double`, `String`, `Data`, and `Date` (and
+  optional versions of all of these) in addition to `Object` subclasses.
+  Querying `List`s containing values other than `Object` subclasses is not yet
+  implemented.
+* `RLMArray` can now be constrained with the protocols `RLMBool`, `RLMInt`,
+  `RLMFloat`, `RLMDouble`, `RLMString`, `RLMData`, and `RLMDate` in addition to
+  protocols defined with `RLM_ARRAY_TYPE`. By default `RLMArray`s of
+  non-`RLMObject` types can contain null. Indicating that the property is
+  required (by overriding `+requiredProperties:`) will instead make the values
+  within the array required. Querying `RLMArray`s containing values other than
+  `RLMObject` subclasses is not yet implemented.
+* Add a new error code to denote 'permission denied' errors when working
+  with synchronized Realms, as well as an accompanying block that can be
+  called to inform the binding that the offending Realm's files should be
+  deleted immediately. This allows recovering from 'permission denied'
+  errors in a more robust manner. See the documentation for
+  `RLMSyncErrorPermissionDeniedError` for more information.
+* Add Swift `Object.isSameObject(as:_)` API to perform the same function as
+  the existing Objective-C API `-[RLMObject isEqualToObject:]`.
+* Opening a synced Realm whose local copy was created with an older version of
+  Realm Mobile Platfrom when a migration is not possible to the current version
+  will result in an `RLMErrorIncompatibleSyncedFile` / `incompatibleSyncedFile`
+  error. When such an error occurs, the original file is moved to a backup
+  location, and future attempts to open the synchronized Realm will result in a new
+  file being created. If you wish to migrate any data from the backup Realm you can
+  open it using the backup Realm configuration available on the error object.
+* Add a preview of partial synchronization. Partial synchronization allows a
+  synchronized Realm to be opened in such a way that only objects requested by
+  the user are synchronized to the device. You can use it by setting the
+  `isPartial` property on a `SyncConfiguration`, opening the Realm, and then
+  calling `Realm.subscribe(to:where:callback:)` with the type of object you're
+  interested in, a string containing a query determining which objects you want
+  to subscribe to, and a callback which will report the results. You may add as
+  many subscriptions to a synced Realm as necessary.
+
+### Bugfixes
+* Realm no longer throws an "unsupported instruction" exception in some cases
+  when opening a synced Realm asynchronously.
+* Realm Swift APIs that filter or look up the index of an object based on a
+  format string now properly handle optional arguments in their variadic argument
+  list.
+* `-[RLMResults<RLMSyncPermission *> indexOfObject:]` now properly accounts for access
+  level.
+* Fix a race condition that could lead to a crash accessing to the freed configuration object
+  if a default configuration was set from a different thread.
+* Fixed an issue that crash when enumerating after clearing data during migration.
+* Fix a bug where a synced Realm couldn't be reopened even after a successful client reset
+  in some cases.
+* Fix a bug where the sync subsystem waited too long in certain cases to reconnect to the server.
+* Fix a bug where encrypted sync-related metadata was incorrectly deleted from upgrading users,
+  resulting in all users being logged out.
+* Fix a bug where permission-related data continued to be synced to a client even after the user
+  that data belonged to logged out.
+* Fix an issue where collection notifications might be delivered inconsistently if a notification
+  callback was added within another callback for the same collection.
+
+3.0.0-rc.2 Release notes (2017-10-14)
+=============================================================
+
+### Enhancements
+* Reinstate `RLMSyncPermissionSortPropertyUserID` to allow users to sort permissions
+  to their own Realms they've granted to others.
+
+### Bugfixes
+* `-[RLMResults<RLMSyncPermission *> indexOfObject:]` now properly accounts for access
+  level.
+* Fix a race condition that could lead to a crash accessing to the freed configuration object
+  if a default configuration was set from a different thread.
+* Fixed an issue that crash when enumerating after clearing data during migration.
+* Fix a bug where a synced Realm couldn't be reopened even after a successful client reset
+  in some cases.
+* Fix a bug where the sync subsystem waited too long in certain cases to reconnect to the server.
+* Fix a bug where encrypted sync-related metadata was incorrectly deleted from upgrading users,
+  resulting in all users being logged out.
+* Fix a bug where permission-related data continued to be synced to a client even after the user
+  that data belonged to logged out.
+* Fix an issue where collection notifications might be delivered inconsistently if a notification
+  callback was added within another callback for the same collection.
+
+3.0.0-rc.1 Release notes (2017-10-03)
+=============================================================
+
+### Breaking Changes
+* Remove `RLMSyncPermissionSortPropertyUserID` to reflect changes in how the
+  Realm Object Server reports permissions for a user.
+* Remove `RLMSyncPermissionOffer` and `RLMSyncPermissionOfferResponse` classes
+  and associated helper methods and functions. Use the
+  `-[RLMSyncUser createOfferForRealmAtURL:accessLevel:expiration:callback:]`
+  and `-[RLMSyncUser acceptOfferForToken:callback:]` methods instead.
+
+### Bugfixes
+
+* The keychain item name used by Realm to manage the encryption keys for
+  sync-related metadata is now set to a per-app name based on the bundle
+  identifier. Keys that were previously stored within the single, shared Realm
+  keychain item will be transparently migrated to the per-application keychain
+  item.
+* Fix downloading of the Realm core binaries when Xcode's command-line tools are
+  set as the active developer directory for command-line interactions.
+* Fix a crash that could occur when resolving a ThreadSafeReference to a `List`
+  whose parent object had since been deleted.
+
+3.0.0-beta.4 Release notes (2017-09-22)
+=============================================================
+
+### Breaking Changes
+
+* Rename `List.remove(objectAtIndex:)` to `List.remove(at:)` to match the name
+  used by 'RangeReplaceableCollection'.
+* Rename `List.swap()` to `List.swapAt()` to match the name used by 'Array'.
+* Loosen `RLMArray` and `RLMResults`'s generic constraint from `RLMObject` to
+  `NSObject`. This may result in having to add some casts to disambiguate
+  types.
+* Remove `RLMPropertyTypeArray` in favor of a separate bool `array` property on
+  `RLMProperty`/`Property`.
+* Remove `RLMSyncPermissionResults`. `RLMSyncPermission`s are now vended out
+  using a `RLMResults`. This results collection supports all normal collection
+  operations except for setting values using KVO (since `RLMSyncPermission`s are
+  immutable) and the property aggregation operations.
+* `RealmCollection`'s associated type `Element` has been renamed `ElementType`.
+* Realm Swift collection types (`List`, `Results`, `AnyRealmCollection`, and
+  `LinkingObjects` have had their generic type parameter changed from `T` to
+  `Element`).
+* `RealmOptional`'s generic type parameter has been changed from `T` to `Value`.
+* `RLMSyncUserInfo` has been significantly enhanced. It now contains metadata
+  about a user stored on the Realm Object Server, as well as a list of all user account
+  data associated with that user.
+* Starting with Swift 4, `List` now conforms to `MutableCollection` instead of
+  `RangeReplaceableCollection`. For Swift 4, the empty collection initializer has been
+  removed, and default implementations of range replaceable collection methods that
+  make sense for `List` have been added.
+* `List.removeLast()` now throws an exception if the list is empty, to more closely match
+  the behavior of the standard library's `Collection.removeLast()` implementation.
+
+### Enhancements
+
+* `List` can now contain values of types `Bool`, `Int`, `Int8`, `Int16`,
+  `Int32`, `Int64`, `Float`, `Double`, `String`, `Data`, and `Date` (and
+  optional versions of all of these) in addition to `Object` subclasses.
+  Querying `List`s containing values other than `Object` subclasses is not yet
+  implemented.
+* `RLMArray` can now be constrained with the protocols `RLMBool`, `RLMInt`,
+  `RLMFloat`, `RLMDouble`, `RLMString`, `RLMData`, and `RLMDate` in addition to
+  protocols defined with `RLM_ARRAY_TYPE`. By default `RLMArray`s of
+  non-`RLMObject` types can contain null. Indicating that the property is
+  required (by overriding `+requiredProperties:`) will instead make the values
+  within the array required. Querying `RLMArray`s containing values other than
+  `RLMObject` subclasses is not yet implemented.
+* Opening a synced Realm whose local copy was created with an older version of
+  Realm Mobile Platfrom when a migration is not possible to the current version
+  will result in an `RLMErrorIncompatibleSyncedFile` / `incompatibleSyncedFile`
+  error. When such an error occurs, the original file is moved to a backup
+  location, and future attempts to open the synchronized Realm will result in a new
+  file being created. If you wish to migrate any data from the backup Realm you can
+  open it using the backup Realm configuration available on the error object.
+* Add preview support for partial synchronization. Partial synchronization is
+  allows a synchronized Realm to be opened in such a way that only objects
+  requested by the user are synchronized to the device. You can use it by setting
+  the `isPartial` property on a `SyncConfiguration`, opening the Realm, and then
+  calling `Realm.subscribe(to:where:callback:)` with the type of object you're
+  interested in, a string containing a query determining which objects you want
+  to subscribe to, and a callback which will report the results. You may add as
+  many subscriptions to a synced Realm as necessary.
+
+### Bugfixes
+
+* Realm Swift APIs that filter or look up the index of an object based on a
+  format string now properly handle optional arguments in their variadic argument
+  list.
+
+3.0.0-beta.3 Release notes (2017-08-23)
+=============================================================
+
+### Breaking Changes
+
+* iOS 7 is no longer supported.
+* Computed properties on Realm object types are detected and no
+  longer added to the automatically generated schema.
+* `-[RLMRealm addOrUpdateObjectsInArray:]` has been renamed to
+  `-[RLMRealm addOrUpdateObjects:]` for consistency with similar methods
+  that add or delete objects.
+* `-[RLMRealm addOrUpdateObjects:]` and `-[RLMRealm deleteObjects:]` now
+  require their argument to conform to `NSFastEnumeration`, to match similar
+  APIs that also take collections.
+* Remove deprecated `{RLM}SyncPermission` and `{RLM}SyncPermissionChange`
+  classes.
+* `{RLM}SyncPermissionValue` has been renamed to just `{RLM}SyncPermission`.
+  Its `userId` property has been renamed `identity`, and its
+  `-initWithRealmPath:userID:accessLevel:` initializer has been renamed
+  `-initWithRealmPath:identity:accessLevel:`.
+* Remove deprecated `-[RLMSyncUser permissionRealmWithError:]` and
+  `SyncUser.permissionRealm()` APIs. Use the new permissions system.
+* Remove deprecated error `RLMSyncErrorBadResponse`. Use
+  `RLMSyncAuthErrorBadResponse` instead.
+* The way interactive sync errors (client reset and permission denied)
+  are delivered to the user has been changed. Instead of a block which can
+  be invoked to immediately delete the offending Realm file, an opaque
+  token object of type `RLMSyncErrorActionToken` will be returned in the
+  error object's `userInfo` dictionary. This error object can be passed
+  into the new `+[RLMSyncSession immediatelyHandleError:]` API to delete
+  the files.
+* Remove `-[NSError rlmSync_clientResetBlock]` and
+  `-[NSError rlmSync_deleteRealmBlock]` APIs.
+* The return types of the `SyncError.clientResetInfo()` and
+  `SyncError.deleteRealmUserInfo()` APIs have been changed. They now return
+  `RLMSyncErrorActionToken`s or `SyncError.ActionToken`s instead of closures.
+* The (erroneously added) instance property `Object.className` has been
+  removed.
+* The class methods `Object.className()`, `Object.objectUtilClass()`, and
+  the property `Object.isInvalidated` can no longer be overriden.
+* The callback which runs when a sync user login succeeds or fails
+  now runs on the main queue by default, or can be explicitly specified
+  by a new `callbackQueue` parameter on the `{RLM}SyncUser.logIn(...)` API.
+* Rename `{RLM}NotificationToken.stop()` to `invalidate()` and
+  `{RealmCollection,SyncPermissionResults}.addNotificationBlock(_:)` to
+  `observe(_:)` to mirror Foundation's new KVO APIs.
+* The `RLMSyncProgress` enum has been renamed `RLMSyncProgressMode`.
+* Remove deprecated `{RLM}SyncManager.disableSSLValidation` property. Disable
+  SSL validation on a per-Realm basis by setting the `enableSSLValidation`
+  property on `{RLM}SyncConfiguration` instead.
+* Fix empty strings, binary data, and null on the right side of `BEGINSWITH`,
+  `ENDSWITH` and `CONTAINS` operators in predicates to match Foundation's
+  semantics of never matching any strings or data.
+* Swift `Object` comparison and hashing behavior now works the same way as
+  that of `RLMObject` (objects are now only considered equatable if their
+  model class defines a primary key).
+* Fix the way the hash property works on `Object` when the object model has
+  no primary key.
+* Fix an issue where if a Swift model class defined non-generic managed
+  properties after generic Realm properties (like `List<T>`), the schema
+  would be constructed incorrectly. Fixes an issue where creating such
+  models from an array could fail.
+
+### Enhancements
+
+* Add Swift `Object.isSameObject(as:_)` API to perform the same function as
+  the existing Objective-C API `-[RLMObject isEqualToObject:]`.
+* Expose additional authentication-related errors that might be reported by
+  a Realm Object Server.
+* An error handler can now be registered on `{RLM}SyncUser`s in order to
+  report authentication-related errors that affect the user.
+
+### Bugfixes
+
+* Sync users are now automatically logged out upon receiving certain types
+  of errors that indicate they are no longer logged into the server. For
+  example, users who are authenticated using third-party credentials will find
+  themselves logged out of the Realm Object Server if the third-party identity
+  service indicates that their credential is no longer valid.
+* Address high CPU usage and hangs in certain cases when processing collection
+  notifications in highly-connected object graphs.
+
+3.0.0-beta.2 Release notes (2017-07-26)
+=============================================================
+
+### Breaking Changes
+
+* Remove the following deprecated Objective-C APIs:
+  `-[RLMArray sortedResultsUsingProperty:ascending:]`,
+  `-[RLMCollection sortedResultsUsingProperty:ascending:]`,
+  `-[RLMResults sortedResultsUsingProperty:ascending:]`,
+  `+[RLMSortDescriptor sortDescriptorWithProperty:ascending:]`,
+  `RLMSortDescriptor.property`.
+  These APIs have been superseded by equivalent APIs that take
+  or return key paths instead of property names.
+* Remove the following deprecated Objective-C API:
+  `+[RLMRealm migrateRealm:configuration:]`.
+  Please use `+[RLMRealm performMigrationForConfiguration:error:]` instead.
+* Remove the following deprecated Swift APIs:
+  `AnyRealmCollection.sorted(byProperty:, ascending:)`,
+  `LinkingObjects.sorted(byProperty:, ascending:)`,
+  `List.sorted(byProperty:, ascending:)`,
+  `Results.sorted(byProperty:, ascending:)`,
+  `SortDescriptor.init(property:, ascending:)`,
+  `SortDescriptor.property`.
+  These APIs have been superseded by equivalent APIs that take
+  or return key paths instead of property names.
+* The Objective-C and Swift `create(_:, value: update:)` APIs now
+  correctly nil out nullable properties when updating an existing
+  object when the `value` argument specifies nil or `NSNull` for
+  the property value.
+
+### Enhancements
+
+* It is now possible to create and log in multiple Realm Object Server users
+  with the same identity if they originate from different servers. Note that
+  if the URLs are different aliases for the same authentication server each
+  user will still be treated as separate (e.g. they will have their own copy
+  of each synchronized Realm opened using them). It is highly encouraged that
+  users defined using the access token credential type be logged in with an
+  authentication server URL specified; this parameter will become mandatory
+  in a future version of the SDK.
+* Add `-[RLMSyncUser retrieveInfoForUser:identityProvider:completion:]`
+  API allowing administrator users to retrieve information about a user based
+  on their provider identity (for example, a username). Requires any edition
+  of the Realm Object Server 1.8.2 or later.
+
+### Bugfixes
+
+* Realm no longer throws an "unsupported instruction" exception in some cases
+  when opening a synced Realm asynchronously.
+
+3.0.0-beta Release notes (2017-07-14)
+=============================================================
+
+### Breaking Changes
+
+* Synchronized Realms require a server running Realm Object Server v2.0 or higher.
+
+### Enhancements
+
+* Add a new error code to denote 'permission denied' errors when working
+  with synchronized Realms, as well as an accompanying block that can be
+  called to inform the binding that the offending Realm's files should be
+  deleted immediately. This allows recovering from 'permission denied'
+  errors in a more robust manner. See the documentation for
+  `RLMSyncErrorPermissionDeniedError` for more information.
+* Add `-[RLMSyncPermissionValue initWithRealmPath:username:accessLevel:]`
+  API allowing permissions to be applied to a user based on their username
+  (usually, an email address). Requires any edition of the Realm Object
+  Server 1.6.0 or later.
+* Improve performance of creating Swift objects which contain at least one List
+  property.
+
+### Bugfixes
+
+* `List.description` now reports the correct types for nested lists.
+* Fix unmanaged object initialization when a nested property type returned
+  `false` from `Object.shouldIncludeInDefaultSchema()`.
+* Don't clear RLMArrays on self-assignment.
+
 2.10.2 Release notes (2017-09-27)
 =============================================================
 

File diff suppressed because it is too large
+ 222 - 213
Libraries external/Realm/Realm.framework/E685B084-64C0-3CB5-B4F7-A049D36D911A.bcsymbolmap


+ 7 - 11
Libraries external/Realm/Realm.framework/Headers/NSError+RLMSync.h

@@ -20,23 +20,19 @@
 
 NS_ASSUME_NONNULL_BEGIN
 
+@class RLMSyncErrorActionToken;
+
 /// NSError category extension providing methods to get data out of Realm's
 /// "client reset" error.
 @interface NSError (RLMSync)
 
 /**
- Given a Realm Object Server client reset error, return the block that can
- be called to manually initiate the client reset process, or nil if the
- error isn't a client reset error.
- */
-- (nullable void(^)(void))rlmSync_clientResetBlock NS_REFINED_FOR_SWIFT;
-
-/**
- Given a Realm Object Server permission denied error, return the block that
- can be called to manually initiate the Realm file deletion process, or nil
- if the error isn't a permission denied error.
+ Given an appropriate Realm Object Server error, return the token that
+ can be passed into `+[RLMSyncSession immediatelyHandleError:]` to
+ immediately perform error clean-up work, or nil if the error isn't of
+ a type that provides a token.
  */
-- (nullable void(^)(void))rlmSync_deleteRealmBlock NS_REFINED_FOR_SWIFT;
+- (nullable RLMSyncErrorActionToken *)rlmSync_errorActionToken NS_REFINED_FOR_SWIFT;
 
 /**
  Given a Realm Object Server client reset error, return the path where the

+ 24 - 23
Libraries external/Realm/Realm.framework/Headers/RLMArray.h

@@ -16,13 +16,11 @@
 //
 ////////////////////////////////////////////////////////////////////////////
 
-#import <Foundation/Foundation.h>
-
 #import <Realm/RLMCollection.h>
 
 NS_ASSUME_NONNULL_BEGIN
 
-@class RLMObject, RLMRealm, RLMResults<RLMObjectType: RLMObject *>, RLMNotificationToken;
+@class RLMObject, RLMResults<RLMObjectType>;
 
 /**
  `RLMArray` is the container type in Realm used to define to-many relationships.
@@ -57,7 +55,7 @@ NS_ASSUME_NONNULL_BEGIN
  object. Instead, you can call the mutation methods on the `RLMArray` directly.
  */
 
-@interface RLMArray<RLMObjectType: RLMObject *> : NSObject<RLMCollection, NSFastEnumeration>
+@interface RLMArray<RLMObjectType> : NSObject<RLMCollection, NSFastEnumeration>
 
 #pragma mark - Properties
 
@@ -67,9 +65,21 @@ NS_ASSUME_NONNULL_BEGIN
 @property (nonatomic, readonly, assign) NSUInteger count;
 
 /**
- The class name (i.e. type) of the `RLMObject`s contained in the array.
+ The type of the objects in the array.
+ */
+@property (nonatomic, readonly, assign) RLMPropertyType type;
+
+/**
+ Indicates whether the objects in the collection can be `nil`.
+ */
+@property (nonatomic, readonly, getter = isOptional) BOOL optional;
+
+/**
+ The class name  of the objects contained in the array.
+
+ Will be `nil` if `type` is not RLMPropertyTypeObject.
  */
-@property (nonatomic, readonly, copy) NSString *objectClassName;
+@property (nonatomic, readonly, copy, nullable) NSString *objectClassName;
 
 /**
  The Realm which manages the array. Returns `nil` for unmanaged arrays.
@@ -88,7 +98,7 @@ NS_ASSUME_NONNULL_BEGIN
 
  @param index   The index to look up.
 
- @return An `RLMObject` of the type contained in the array.
+ @return An object of the type contained in the array.
  */
 - (RLMObjectType)objectAtIndex:(NSUInteger)index;
 
@@ -97,7 +107,7 @@ NS_ASSUME_NONNULL_BEGIN
 
  Returns `nil` if called on an empty array.
 
- @return An `RLMObject` of the type contained in the array.
+ @return An object of the type contained in the array.
  */
 - (nullable RLMObjectType)firstObject;
 
@@ -106,7 +116,7 @@ NS_ASSUME_NONNULL_BEGIN
 
  Returns `nil` if called on an empty array.
 
- @return An `RLMObject` of the type contained in the array.
+ @return An object of the type contained in the array.
  */
 - (nullable RLMObjectType)lastObject;
 
@@ -119,7 +129,7 @@ NS_ASSUME_NONNULL_BEGIN
 
  @warning This method may only be called during a write transaction.
 
- @param object  An `RLMObject` of the type contained in the array.
+ @param object  An object of the type contained in the array.
  */
 - (void)addObject:(RLMObjectType)object;
 
@@ -140,7 +150,7 @@ NS_ASSUME_NONNULL_BEGIN
 
  @warning This method may only be called during a write transaction.
 
- @param anObject  An `RLMObject` of the type contained in the array.
+ @param anObject  An object of the type contained in the array.
  @param index   The index at which to insert the object.
  */
 - (void)insertObject:(RLMObjectType)anObject atIndex:(NSUInteger)index;
@@ -159,6 +169,8 @@ NS_ASSUME_NONNULL_BEGIN
 /**
  Removes the last object in the array.
 
+ This is a no-op if the array is already empty.
+
  @warning This method may only be called during a write transaction.
 */
 - (void)removeLastObject;
@@ -269,17 +281,6 @@ NS_ASSUME_NONNULL_BEGIN
  */
 - (RLMResults<RLMObjectType> *)sortedResultsUsingKeyPath:(NSString *)keyPath ascending:(BOOL)ascending;
 
-/**
- Returns a sorted `RLMResults` from the array.
-
- @param property    The property name to sort by.
- @param ascending   The direction to sort in.
-
- @return    An `RLMResults` sorted by the specified property.
- */
-- (RLMResults<RLMObjectType> *)sortedResultsUsingProperty:(NSString *)property ascending:(BOOL)ascending
-    __deprecated_msg("Use `-sortedResultsUsingKeyPath:ascending:`");
-
 /**
  Returns a sorted `RLMResults` from the array.
 
@@ -342,7 +343,7 @@ NS_ASSUME_NONNULL_BEGIN
      // end of run loop execution context
 
  You must retain the returned token for as long as you want updates to continue
- to be sent to the block. To stop receiving updates, call `-stop` on the token.
+ to be sent to the block. To stop receiving updates, call `-invalidate` on the token.
 
  @warning This method cannot be called during a write transaction, or when the
           containing Realm is read-only.

+ 23 - 34
Libraries external/Realm/Realm.framework/Headers/RLMCollection.h

@@ -22,11 +22,12 @@
 
 NS_ASSUME_NONNULL_BEGIN
 
-@class RLMRealm, RLMResults, RLMObject, RLMSortDescriptor, RLMNotificationToken, RLMCollectionChange;
+@class RLMRealm, RLMResults, RLMSortDescriptor, RLMNotificationToken, RLMCollectionChange;
+typedef NS_ENUM(int32_t, RLMPropertyType);
 
 /**
- A homogenous collection of `RLMObject` instances. Examples of conforming types include `RLMArray`,
- `RLMResults`, and `RLMLinkingObjects`.
+ A homogenous collection of Realm-managed objects. Examples of conforming types
+ include `RLMArray`, `RLMResults`, and `RLMLinkingObjects`.
  */
 @protocol RLMCollection <NSFastEnumeration, RLMThreadConfined>
 
@@ -40,9 +41,21 @@ NS_ASSUME_NONNULL_BEGIN
 @property (nonatomic, readonly, assign) NSUInteger count;
 
 /**
- The class name (i.e. type) of the `RLMObject`s contained in the collection.
+ The type of the objects in the collection.
  */
-@property (nonatomic, readonly, copy) NSString *objectClassName;
+@property (nonatomic, readonly, assign) RLMPropertyType type;
+
+/**
+ Indicates whether the objects in the collection can be `nil`.
+ */
+@property (nonatomic, readonly, getter = isOptional) BOOL optional;
+
+/**
+ The class name  of the objects contained in the collection.
+
+ Will be `nil` if `type` is not RLMPropertyTypeObject.
+ */
+@property (nonatomic, readonly, copy, nullable) NSString *objectClassName;
 
 /**
  The Realm which manages the collection, or `nil` for unmanaged collections.
@@ -56,7 +69,7 @@ NS_ASSUME_NONNULL_BEGIN
 
  @param index   The index to look up.
 
- @return An `RLMObject` of the type contained in the collection.
+ @return An object of the type contained in the collection.
  */
 - (id)objectAtIndex:(NSUInteger)index;
 
@@ -65,7 +78,7 @@ NS_ASSUME_NONNULL_BEGIN
 
  Returns `nil` if called on an empty collection.
 
- @return An `RLMObject` of the type contained in the collection.
+ @return An object of the type contained in the collection.
  */
 - (nullable id)firstObject;
 
@@ -74,7 +87,7 @@ NS_ASSUME_NONNULL_BEGIN
 
  Returns `nil` if called on an empty collection.
 
- @return An `RLMObject` of the type contained in the collection.
+ @return An object of the type contained in the collection.
  */
 - (nullable id)lastObject;
 
@@ -87,7 +100,7 @@ NS_ASSUME_NONNULL_BEGIN
 
  @param object  An object (of the same type as returned from the `objectClassName` selector).
  */
-- (NSUInteger)indexOfObject:(RLMObject *)object;
+- (NSUInteger)indexOfObject:(id)object;
 
 /**
  Returns the index of the first object in the collection matching the predicate.
@@ -141,17 +154,6 @@ NS_ASSUME_NONNULL_BEGIN
  */
 - (RLMResults *)sortedResultsUsingKeyPath:(NSString *)keyPath ascending:(BOOL)ascending;
 
-/**
- Returns a sorted `RLMResults` from the collection.
-
- @param property    The property name to sort by.
- @param ascending   The direction to sort in.
-
- @return    An `RLMResults` sorted by the specified property.
- */
-- (RLMResults *)sortedResultsUsingProperty:(NSString *)property ascending:(BOOL)ascending
-    __deprecated_msg("Use `-sortedResultsUsingKeyPath:ascending:`");
-
 /**
  Returns a sorted `RLMResults` from the collection.
 
@@ -234,7 +236,7 @@ NS_ASSUME_NONNULL_BEGIN
      // end of run loop execution context
 
  You must retain the returned token for as long as you want updates to continue
- to be sent to the block. To stop receiving updates, call `-stop` on the token.
+ to be sent to the block. To stop receiving updates, call `-invalidate` on the token.
 
  @warning This method cannot be called during a write transaction, or when the
           containing Realm is read-only.
@@ -342,19 +344,6 @@ NS_ASSUME_NONNULL_BEGIN
  */
 - (instancetype)reversedSortDescriptor;
 
-#pragma mark - Deprecated
-
-/**
- The name of the property which the sort descriptor orders results by.
- */
-@property (nonatomic, readonly) NSString *property __deprecated_msg("Use `-keyPath`");
-
-/**
- Returns a new sort descriptor for the given property name and sort direction.
- */
-+ (instancetype)sortDescriptorWithProperty:(NSString *)propertyName ascending:(BOOL)ascending
-    __deprecated_msg("Use `+sortDescriptorWithKeyPath:ascending:`");
-
 @end
 
 /**

+ 17 - 5
Libraries external/Realm/Realm.framework/Headers/RLMConstants.h

@@ -69,19 +69,17 @@ typedef NS_ENUM(int32_t, RLMPropertyType) {
     /**
      Any object: `id`.
 
-     This property type is no longer supported for new models. However, old models with any-typed properties are still
-     supported for migration purposes.
+     This property type is no longer supported for new models. However, old files
+     with any-typed properties are still supported for migration purposes.
      */
     RLMPropertyTypeAny    = 9,
     /** Dates: `NSDate` */
     RLMPropertyTypeDate   = 4,
 
-#pragma mark - Array/Linked object types
+#pragma mark - Linked object types
 
     /** Realm model objects. See [Realm Models](https://realm.io/docs/objc/latest/#models) for more information. */
     RLMPropertyTypeObject = 7,
-    /** Realm arrays. See [Realm Models](https://realm.io/docs/objc/latest/#models) for more information. */
-    RLMPropertyTypeArray  = 128,
     /** Realm linking objects. See [Realm Models](https://realm.io/docs/objc/latest/#models) for more information. */
     RLMPropertyTypeLinkingObjects = 8,
 };
@@ -145,6 +143,15 @@ typedef RLM_ERROR_ENUM(NSInteger, RLMError, RLMErrorDomain) {
 
     /** Denotes an error that occurs if there is a schema version mismatch, so that a migration is required. */
     RLMErrorSchemaMismatch = 10,
+
+    /** Denotes an error that occurs when attempting to open an incompatible synchronized Realm file.
+
+     This error occurs when the Realm file was created with an older version of Realm and an automatic migration
+     to the current version is not possible. When such an error occurs, the original file is moved to a backup
+     location, and future attempts to open the synchronized Realm will result in a new file being created.
+     If you wish to migrate any data from the backup Realm, you can open it using the provided Realm configuration.
+     */
+    RLMErrorIncompatibleSyncedFile = 11,
 };
 
 #pragma mark - Constants
@@ -183,6 +190,11 @@ RLM_EXTENSIBLE_STRING_ENUM_CASE_SWIFT_NAME(RLMRealmRefreshRequiredNotification,
 extern RLMNotification const RLMRealmDidChangeNotification
 RLM_EXTENSIBLE_STRING_ENUM_CASE_SWIFT_NAME(RLMRealmDidChangeNotification, DidChange);
 
+#pragma mark - Error keys
+
+/** Key to identify the associated backup Realm configuration in an error's `userInfo` dictionary */
+extern NSString * const RLMBackupRealmConfigurationErrorKey;
+
 #pragma mark - Other Constants
 
 /** The schema version used for uninitialized Realms */

+ 6 - 6
Libraries external/Realm/Realm.framework/Headers/RLMObject.h

@@ -28,7 +28,7 @@ NS_ASSUME_NONNULL_BEGIN
 @class RLMPropertyChange;
 @class RLMPropertyDescriptor;
 @class RLMRealm;
-@class RLMResults;
+@class RLMResults<RLMObjectType>;
 
 /**
  `RLMObject` is a base class for model objects representing data stored in Realms.
@@ -350,7 +350,7 @@ NS_ASSUME_NONNULL_BEGIN
 + (RLMResults *)objectsWhere:(NSString *)predicateFormat, ...;
 
 /// :nodoc:
-+ (RLMResults *)objectsWhere:(NSString *)predicateFormat args:(va_list)args;
++ (RLMResults<__kindof RLMObject *> *)objectsWhere:(NSString *)predicateFormat args:(va_list)args;
 
 
 /**
@@ -399,7 +399,7 @@ NS_ASSUME_NONNULL_BEGIN
 + (RLMResults *)objectsInRealm:(RLMRealm *)realm where:(NSString *)predicateFormat, ...;
 
 /// :nodoc:
-+ (RLMResults *)objectsInRealm:(RLMRealm *)realm where:(NSString *)predicateFormat args:(va_list)args;
++ (RLMResults<__kindof RLMObject *> *)objectsInRealm:(RLMRealm *)realm where:(NSString *)predicateFormat args:(va_list)args;
 
 /**
  Returns all objects of this object type matching the given predicate from the specified Realm.
@@ -469,7 +469,7 @@ typedef void (^RLMObjectChangeBlock)(BOOL deleted,
 
  Only objects which are managed by a Realm can be observed in this way. You
  must retain the returned token for as long as you want updates to be sent to
- the block. To stop receiving updates, call `stop` on the token.
+ the block. To stop receiving updates, call `-invalidate` on the token.
 
  It is safe to capture a strong reference to the observed object within the
  callback block. There is no retain cycle due to that the callback is retained
@@ -489,8 +489,8 @@ typedef void (^RLMObjectChangeBlock)(BOOL deleted,
  Returns YES if another Realm object instance points to the same object as the receiver in the Realm managing
  the receiver.
 
- For object types with a primary, key, `isEqual:` is overridden to use this method (along with a corresponding
- implementation for `hash`).
+ For object types with a primary, key, `isEqual:` is overridden to use the same logic as this
+ method (along with a corresponding implementation for `hash`).
 
  @param object  The object to compare the receiver to.
 

+ 5 - 0
Libraries external/Realm/Realm.framework/Headers/RLMProperty.h

@@ -87,6 +87,11 @@ NS_ASSUME_NONNULL_BEGIN
  */
 @property (nonatomic, readonly) BOOL optional;
 
+/**
+ Indicates whether this property is an array.
+ */
+@property (nonatomic, readonly) BOOL array;
+
 #pragma mark - Methods
 
 /**

+ 49 - 0
Libraries external/Realm/Realm.framework/Headers/RLMRealm+Sync.h

@@ -0,0 +1,49 @@
+////////////////////////////////////////////////////////////////////////////
+//
+// Copyright 2017 Realm Inc.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////
+
+#import <Foundation/Foundation.h>
+
+#import "RLMRealm.h"
+
+@class RLMResults;
+
+/**
+ A callback used to vend the results of a partial sync fetch.
+ */
+typedef void(^RLMPartialSyncFetchCallback)(RLMResults * _Nullable results, NSError * _Nullable error);
+
+NS_ASSUME_NONNULL_BEGIN
+
+///
+@interface RLMRealm (Sync)
+
+/**
+ If the Realm is a partially synchronized Realm, fetch and synchronize the objects
+ of a given object type that match the given query (in string format).
+
+ The results will be returned asynchronously in the callback.
+ Use `-[RLMResults addNotificationBlock:]` to be notified to changes to the set of
+ synchronized objects.
+
+ @warning Partial synchronization is a tech preview. Its APIs are subject to change.
+*/
+- (void)subscribeToObjects:(Class)type where:(NSString *)query callback:(RLMPartialSyncFetchCallback)callback;
+
+@end
+
+NS_ASSUME_NONNULL_END

+ 23 - 24
Libraries external/Realm/Realm.framework/Headers/RLMRealm.h

@@ -490,12 +490,12 @@ NS_REFINED_FOR_SWIFT;
 
  @warning This method may only be called during a write transaction.
 
- @param array   An enumerable object such as `NSArray` or `RLMResults` which contains objects to be added to
-                the Realm.
+ @param objects   An enumerable collection such as `NSArray`, `RLMArray`, or `RLMResults`,
+                  containing Realm objects to be added to the Realm.
 
  @see   `addObject:`
  */
-- (void)addObjects:(id<NSFastEnumeration>)array;
+- (void)addObjects:(id<NSFastEnumeration>)objects;
 
 /**
  Adds or updates an existing object into the Realm.
@@ -507,6 +507,10 @@ NS_REFINED_FOR_SWIFT;
  As with `addObject:`, the object cannot already be managed by a different
  Realm. Use `-[RLMObject createOrUpdateInRealm:withValue:]` to copy values to
  a different Realm.
+ 
+ If there is a property or KVC value on `object` whose value is nil, and it corresponds
+ to a nullable property on an existing object being updated, that nullable property will
+ be set to nil.
 
  @warning This method may only be called during a write transaction.
 
@@ -521,11 +525,12 @@ NS_REFINED_FOR_SWIFT;
 
  @warning This method may only be called during a write transaction.
 
- @param array  An `NSArray`, `RLMArray`, or `RLMResults` of `RLMObject`s (or subclasses) to be added to the Realm.
+ @param objects  An enumerable collection such as `NSArray`, `RLMArray`, or `RLMResults`,
+                 containing Realm objects to be added to or updated within the Realm.
 
  @see   `addOrUpdateObject:`
  */
-- (void)addOrUpdateObjectsFromArray:(id)array;
+- (void)addOrUpdateObjects:(id<NSFastEnumeration>)objects;
 
 /**
  Deletes an object from the Realm. Once the object is deleted it is considered invalidated.
@@ -543,11 +548,12 @@ NS_REFINED_FOR_SWIFT;
 
  @warning This method may only be called during a write transaction.
 
- @param array  An `RLMArray`, `NSArray`, or `RLMResults` of `RLMObject`s (or subclasses) to be deleted.
+ @param objects  An enumerable collection such as `NSArray`, `RLMArray`, or `RLMResults`,
+                 containing objects to be deleted from the Realm.
 
  @see `deleteObject:`
  */
-- (void)deleteObjects:(id)array;
+- (void)deleteObjects:(id<NSFastEnumeration>)objects;
 
 /**
  Deletes all objects from the Realm.
@@ -586,21 +592,6 @@ typedef void (^RLMMigrationBlock)(RLMMigration *migration, uint64_t oldSchemaVer
 + (uint64_t)schemaVersionAtURL:(NSURL *)fileURL encryptionKey:(nullable NSData *)key error:(NSError **)error
 NS_REFINED_FOR_SWIFT;
 
-/**
- Performs the given Realm configuration's migration block on a Realm at the given path.
-
- This method is called automatically when opening a Realm for the first time and does
- not need to be called explicitly. You can choose to call this method to control
- exactly when and how migrations are performed.
-
- @param configuration The Realm configuration used to open and migrate the Realm.
- @return              The error that occurred while applying the migration, if any.
-
- @see                 RLMMigration
- */
-+ (nullable NSError *)migrateRealm:(RLMRealmConfiguration *)configuration
-__deprecated_msg("Use `performMigrationForConfiguration:error:`") NS_REFINED_FOR_SWIFT;
-
 /**
  Performs the given Realm configuration's migration block on a Realm at the given path.
 
@@ -633,20 +624,28 @@ __deprecated_msg("Use `performMigrationForConfiguration:error:`") NS_REFINED_FOR
  */
 + (instancetype)new __attribute__((unavailable("Use +defaultRealm, +realmWithConfiguration: or +realmWithURL:.")));
 
+/// :nodoc:
+- (void)addOrUpdateObjectsFromArray:(id)array __attribute__((unavailable("Renamed to -addOrUpdateObjects:.")));
+
 @end
 
+// MARK: - RLMNotificationToken
+
 /**
  A token which is returned from methods which subscribe to changes to a Realm.
 
  Change subscriptions in Realm return an `RLMNotificationToken` instance,
  which can be used to unsubscribe from the changes. You must store a strong
  reference to the token for as long as you want to continue to receive notifications.
- When you wish to stop, call the `-stop` method. Notifications are also stopped if
+ When you wish to stop, call the `-invalidate` method. Notifications are also stopped if
  the token is deallocated.
  */
 @interface RLMNotificationToken : NSObject
 /// Stops notifications for the change subscription that returned this token.
-- (void)stop;
+- (void)invalidate;
+
+/// Stops notifications for the change subscription that returned this token.
+- (void)stop __attribute__((unavailable("Renamed to -invalidate."))) NS_REFINED_FOR_SWIFT;
 @end
 
 NS_ASSUME_NONNULL_END

+ 4 - 4
Libraries external/Realm/Realm.framework/Headers/RLMRealm_Dynamic.h

@@ -21,7 +21,7 @@
 #import <Realm/RLMObjectSchema.h>
 #import <Realm/RLMProperty.h>
 
-@class RLMResults;
+@class RLMResults<RLMObjectType>;
 
 NS_ASSUME_NONNULL_BEGIN
 
@@ -42,7 +42,7 @@ NS_ASSUME_NONNULL_BEGIN
 
  @see       `+[RLMObject allObjects]`
  */
-- (RLMResults *)allObjects:(NSString *)className;
+- (RLMResults<RLMObject *> *)allObjects:(NSString *)className;
 
 /**
  Returns all objects matching the given predicate from the Realm.
@@ -58,7 +58,7 @@ NS_ASSUME_NONNULL_BEGIN
 
  @see       `+[RLMObject objectsWhere:]`
  */
-- (RLMResults *)objects:(NSString *)className where:(NSString *)predicateFormat, ...;
+- (RLMResults<RLMObject *> *)objects:(NSString *)className where:(NSString *)predicateFormat, ...;
 
 /**
  Returns all objects matching the given predicate from the Realm.
@@ -74,7 +74,7 @@ NS_ASSUME_NONNULL_BEGIN
 
  @see       `+[RLMObject objectsWhere:]`
  */
-- (RLMResults *)objects:(NSString *)className withPredicate:(NSPredicate *)predicate;
+- (RLMResults<RLMObject *> *)objects:(NSString *)className withPredicate:(NSPredicate *)predicate;
 
 /**
  Returns the object of the given type with the given primary key from the Realm.

+ 26 - 26
Libraries external/Realm/Realm.framework/Headers/RLMResults.h

@@ -16,12 +16,11 @@
 //
 ////////////////////////////////////////////////////////////////////////////
 
-#import <Foundation/Foundation.h>
 #import <Realm/RLMCollection.h>
 
 NS_ASSUME_NONNULL_BEGIN
 
-@class RLMObject, RLMRealm, RLMNotificationToken;
+@class RLMObject;
 
 /**
  `RLMResults` is an auto-updating container type in Realm returned from object
@@ -48,7 +47,7 @@ NS_ASSUME_NONNULL_BEGIN
 
  `RLMResults` cannot be directly instantiated.
  */
-@interface RLMResults<RLMObjectType: RLMObject *> : NSObject<RLMCollection, NSFastEnumeration>
+@interface RLMResults<RLMObjectType> : NSObject<RLMCollection, NSFastEnumeration>
 
 #pragma mark - Properties
 
@@ -58,9 +57,21 @@ NS_ASSUME_NONNULL_BEGIN
 @property (nonatomic, readonly, assign) NSUInteger count;
 
 /**
- The class name (i.e. type) of the `RLMObject`s contained in the results collection.
+ The type of the objects in the results collection.
  */
-@property (nonatomic, readonly, copy) NSString *objectClassName;
+@property (nonatomic, readonly, assign) RLMPropertyType type;
+
+/**
+ Indicates whether the objects in the collection can be `nil`.
+ */
+@property (nonatomic, readwrite, getter = isOptional) BOOL optional;
+
+/**
+ The class name  of the objects contained in the results collection.
+
+ Will be `nil` if `type` is not RLMPropertyTypeObject.
+ */
+@property (nonatomic, readonly, copy, nullable) NSString *objectClassName;
 
 /**
  The Realm which manages this results collection.
@@ -82,7 +93,7 @@ NS_ASSUME_NONNULL_BEGIN
 
  @param index   The index to look up.
 
- @return An `RLMObject` of the type contained in the results collection.
+ @return An object of the type contained in the results collection.
  */
 - (RLMObjectType)objectAtIndex:(NSUInteger)index;
 
@@ -91,7 +102,7 @@ NS_ASSUME_NONNULL_BEGIN
 
  Returns `nil` if called on an empty results collection.
 
- @return An `RLMObject` of the type contained in the results collection.
+ @return An object of the type contained in the results collection.
  */
 - (nullable RLMObjectType)firstObject;
 
@@ -100,7 +111,7 @@ NS_ASSUME_NONNULL_BEGIN
 
  Returns `nil` if called on an empty results collection.
 
- @return An `RLMObject` of the type contained in the results collection.
+ @return An object of the type contained in the results collection.
  */
 - (nullable RLMObjectType)lastObject;
 
@@ -167,17 +178,6 @@ NS_ASSUME_NONNULL_BEGIN
  */
 - (RLMResults<RLMObjectType> *)sortedResultsUsingKeyPath:(NSString *)keyPath ascending:(BOOL)ascending;
 
-/**
- Returns a sorted `RLMResults` from an existing results collection.
-
- @param property    The property name to sort by.
- @param ascending   The direction to sort in.
-
- @return    An `RLMResults` sorted by the specified property.
- */
-- (RLMResults<RLMObjectType> *)sortedResultsUsingProperty:(NSString *)property ascending:(BOOL)ascending
-    __deprecated_msg("Use `-sortedResultsUsingKeyPath:ascending:`");
-
 /**
  Returns a sorted `RLMResults` from an existing results collection.
 
@@ -239,7 +239,7 @@ NS_ASSUME_NONNULL_BEGIN
      // end of run loop execution context
 
  You must retain the returned token for as long as you want updates to continue
- to be sent to the block. To stop receiving updates, call `-stop` on the token.
+ to be sent to the block. To stop receiving updates, call `-invalidate` on the token.
 
  @warning This method cannot be called during a write transaction, or when the
           containing Realm is read-only.
@@ -275,8 +275,8 @@ NS_ASSUME_NONNULL_BEGIN
 
  @warning You cannot use this method on `RLMObject`, `RLMArray`, and `NSData` properties.
 
- @param property The property whose maximum value is desired. Only properties of types `int`, `float`, `double`, and
-                 `NSDate` are supported.
+ @param property The property whose maximum value is desired. Only properties of
+                 types `int`, `float`, `double`, and `NSDate` are supported.
 
  @return The maximum value of the property, or `nil` if the Results are empty.
  */
@@ -289,8 +289,8 @@ NS_ASSUME_NONNULL_BEGIN
 
  @warning You cannot use this method on `RLMObject`, `RLMArray`, and `NSData` properties.
 
- @param property The property whose values should be summed. Only properties of types `int`, `float`, and `double` are
-                 supported.
+ @param property The property whose values should be summed. Only properties of
+                 types `int`, `float`, and `double` are supported.
 
  @return The sum of the given property.
  */
@@ -303,8 +303,8 @@ NS_ASSUME_NONNULL_BEGIN
 
  @warning You cannot use this method on `RLMObject`, `RLMArray`, and `NSData` properties.
 
- @param property The property whose average value should be calculated. Only properties of types `int`, `float`, and
-                 `double` are supported.
+ @param property The property whose average value should be calculated. Only
+                 properties of types `int`, `float`, and `double` are supported.
 
  @return    The average value of the given property, or `nil` if the Results are empty.
  */

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

@@ -47,6 +47,15 @@ NS_ASSUME_NONNULL_BEGIN
  */
 @property (nonatomic) BOOL enableSSLValidation;
 
+/**
+ Whether this Realm should be opened in 'partial synchronization' mode.
+ Partial synchronization mode means that no objects are synchronized from the remote Realm
+ except those matching queries that the user explicitly specifies.
+
+ @warning Partial synchronization is a tech preview. Its APIs are subject to change.
+*/
+@property (nonatomic) BOOL isPartial;
+
 /**
  Create a sync configuration instance.
 

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

@@ -81,18 +81,6 @@ typedef void(^RLMSyncErrorReportingBlock)(NSError *, RLMSyncSession * _Nullable)
  */
 @property (nonatomic, copy) NSString *appID;
 
-/**
- Whether SSL certificate validation should be disabled.
-
- Once this value is set (either way), it will be used as the default value for SSL
- validation when initializing new sync configuration values. A given configuration's
- SSL validation setting can still be overriden from the global default by setting it
- explicitly.
-
- @warning NEVER disable certificate validation for clients and servers in production.
- */
-@property (nonatomic) BOOL disableSSLValidation __deprecated_msg("Set `enableSSLValidation` on individual configurations instead.");
-
 /**
  The logging threshold which newly opened synced Realms will use. Defaults to
  `RLMSyncLogLevelInfo`.

+ 135 - 22
Libraries external/Realm/Realm.framework/Headers/RLMSyncPermission.h

@@ -1,6 +1,6 @@
 ////////////////////////////////////////////////////////////////////////////
 //
-// Copyright 2016 Realm Inc.
+// Copyright 2017 Realm Inc.
 //
 // Licensed under the Apache License, Version 2.0 (the "License");
 // you may not use this file except in compliance with the License.
@@ -17,38 +17,151 @@
 ////////////////////////////////////////////////////////////////////////////
 
 #import <Foundation/Foundation.h>
-#import <Realm/RLMObject.h>
+
+/**
+ Access levels which can be granted to Realm Mobile Platform users
+ for specific synchronized Realms, using the permissions APIs.
+
+ Note that each access level guarantees all allowed actions provided
+ by less permissive access levels. Specifically, users with write
+ access to a Realm can always read from that Realm, and users with
+ administrative access can always read or write from the Realm.
+ */
+typedef NS_ENUM(NSUInteger, RLMSyncAccessLevel) {
+    /// No access whatsoever.
+    RLMSyncAccessLevelNone          = 0,
+    /**
+     User can only read the contents of the Realm.
+
+     @warning Users who have read-only access to a Realm should open the
+              Realm using `+[RLMRealm asyncOpenWithConfiguration:callbackQueue:callback:]`.
+              Attempting to directly open the Realm is an error; in this
+              case the Realm must be deleted and re-opened.
+     */
+    RLMSyncAccessLevelRead          = 1,
+    /// User can read and write the contents of the Realm.
+    RLMSyncAccessLevelWrite         = 2,
+    /// User can read, write, and administer the Realm, including
+    /// granting permissions to other users.
+    RLMSyncAccessLevelAdmin         = 3,
+};
 
 NS_ASSUME_NONNULL_BEGIN
 
 /**
- This model is used to reflect permissions.
+ A property on which a `RLMResults<RLMSyncPermission *>` can be queried or filtered.
 
- It should be used in conjunction with a `RLMSyncUser`'s Permission Realm.
- You can only read this Realm. Use the objects in Management Realm to
- make request for modifications of permissions.
+ @warning If building `NSPredicate`s using format strings including these string
+          constants, use %K instead of %@ as the substitution parameter.
+ */
+typedef NSString * RLMSyncPermissionSortProperty NS_STRING_ENUM;
 
- See https://realm.io/docs/realm-object-server/#permissions for general
- documentation.
+/// Sort by the Realm Object Server path to the Realm to which the permission applies.
+extern RLMSyncPermissionSortProperty const RLMSyncPermissionSortPropertyPath;
+/// Sort by the identity of the user to whom the permission applies.
+extern RLMSyncPermissionSortProperty const RLMSyncPermissionSortPropertyUserID;
+/// Sort by the date the permissions were last updated.
+extern RLMSyncPermissionSortProperty const RLMSyncPermissionSortPropertyUpdated;
+
+/**
+ A value representing a permission granted to the specified user(s) to access the specified Realm(s).
+
+ `RLMSyncPermission` is immutable and can be accessed from any thread.
+
+ See https://realm.io/docs/realm-object-server/#permissions for general documentation.
  */
-__deprecated_msg("Use `RLMSyncPermissionValue`")
-@interface RLMSyncPermission : RLMObject
+@interface RLMSyncPermission : NSObject
+
+/**
+ The Realm Object Server path to the Realm to which this permission applies (e.g. "/path/to/realm").
+
+ Specify "*" if this permission applies to all Realms managed by the server.
+ */
+@property (nonatomic, readonly) NSString *path;
+
+/**
+ The access level described by this permission.
+ */
+@property (nonatomic, readonly) RLMSyncAccessLevel accessLevel;
+
+/// Whether the access level allows the user to read from the Realm.
+@property (nonatomic, readonly) BOOL mayRead;
+
+/// Whether the access level allows the user to write to the Realm.
+@property (nonatomic, readonly) BOOL mayWrite;
+
+/// Whether the access level allows the user to administer the Realm.
+@property (nonatomic, readonly) BOOL mayManage;
+
+/**
+ Create a new sync permission value, for use with permission APIs.
+
+ @param path        The Realm Object Server path to the Realm whose permission should be modified
+                    (e.g. "/path/to/realm"). Pass "*" to apply to all Realms managed by the user.
+ @param identity    The Realm Object Server identity of the user who should be granted access to
+                    the Realm at `path`.
+                    Pass "*" to apply to all users managed by the server.
+ @param accessLevel The access level to grant.
+ */
+- (instancetype)initWithRealmPath:(NSString *)path
+                         identity:(NSString *)identity
+                      accessLevel:(RLMSyncAccessLevel)accessLevel;
+
+/**
+ Create a new sync permission value, for use with permission APIs.
+
+ @param path        The Realm Object Server path to the Realm whose permission should be modified
+                    (e.g. "/path/to/realm"). Pass "*" to apply to all Realms managed by the user.
+ @param username    The username (often an email address) of the user who should be granted access
+                    to the Realm at `path`.
+ @param accessLevel The access level to grant.
+ */
+- (instancetype)initWithRealmPath:(NSString *)path
+                         username:(NSString *)username
+                      accessLevel:(RLMSyncAccessLevel)accessLevel;
+
+/**
+ The identity of the user to whom this permission is granted, or "*"
+ if all users are granted this permission. Nil if the permission is
+ defined in terms of a key-value pair.
+ */
+@property (nullable, nonatomic, readonly) NSString *identity;
+
+/**
+ If the permission is defined in terms of a key-value pair, the key
+ describing the type of criterion used to determine what users the
+ permission applies to. Otherwise, nil.
+ */
+@property (nullable, nonatomic, readonly) NSString *key;
+
+/**
+ If the permission is defined in terms of a key-value pair, a string
+ describing the criterion value used to determine what users the
+ permission applies to. Otherwise, nil.
+ */
+@property (nullable, nonatomic, readonly) NSString *value;
+
+/**
+ When this permission was last updated.
+ */
+@property (nonatomic, readonly) NSDate *updatedAt;
+
+/// :nodoc:
+- (instancetype)init __attribute__((unavailable("Use the designated initializer")));
 
-/// The date this object was last modified.
-@property (readonly) NSDate *updatedAt;
+/// :nodoc:
++ (instancetype)new __attribute__((unavailable("Use the designated initializer")));
 
-/// The identity of a user affected by this permission.
-@property (readonly) NSString *userId;
+// MARK: - Migration assistance
 
-/// The path to the realm.
-@property (readonly) NSString *path;
+/// :nodoc:
+@property (nullable, nonatomic, readonly) NSString *userId __attribute__((unavailable("Renamed to `identity`")));
 
-/// Whether the affected user is allowed to read from the Realm.
-@property (readonly) BOOL mayRead;
-/// Whether the affected user is allowed to write to the Realm.
-@property (readonly) BOOL mayWrite;
-/// Whether the affected user is allowed to manage the access rights for others.
-@property (readonly) BOOL mayManage;
+/// :nodoc:
+- (instancetype)initWithRealmPath:(NSString *)path
+                           userID:(NSString *)identity
+                      accessLevel:(RLMSyncAccessLevel)accessLevel
+__attribute__((unavailable("Renamed to `-initWithRealmPath:identity:accessLevel:`")));
 
 @end
 

+ 0 - 90
Libraries external/Realm/Realm.framework/Headers/RLMSyncPermissionChange.h

@@ -1,90 +0,0 @@
-////////////////////////////////////////////////////////////////////////////
-//
-// Copyright 2016 Realm Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-////////////////////////////////////////////////////////////////////////////
-
-#import <Foundation/Foundation.h>
-#import <Realm/RLMObject.h>
-#import <Realm/RLMProperty.h>
-#import <Realm/RLMSyncUtil.h>
-
-NS_ASSUME_NONNULL_BEGIN
-
-/**
- This model is used for requesting changes to a Realm's permissions.
-
- It should be used in conjunction with an `RLMSyncUser`'s Management Realm.
-
- See https://realm.io/docs/realm-object-server/#permissions for general
- documentation.
- */
-__deprecated_msg("Use `-[RLMSyncUser applyPermission:callback:]` and `-[RLMSyncUser revokePermission:callback:]`")
-@interface RLMSyncPermissionChange : RLMObject
-
-/// The globally unique ID string of this permission change object.
-@property (readonly) NSString *id;
-
-/// The date this object was initially created.
-@property (readonly) NSDate *createdAt;
-
-/// The date this object was last modified.
-@property (readonly) NSDate *updatedAt;
-
-/// The status code of the object that was processed by Realm Object Server.
-@property (nullable, readonly) NSNumber<RLMInt> *statusCode;
-
-/// An error or informational message, typically written to by the Realm Object Server.
-@property (nullable, readonly) NSString *statusMessage;
-
-/// Sync management object status.
-@property (readonly) RLMSyncManagementObjectStatus status;
-
-/// The remote URL to the realm.
-@property (readonly) NSString *realmUrl;
-
-/// The identity of a user affected by this permission change.
-@property (readonly) NSString *userId;
-
-/// Define read access. Set to `YES` or `NO` to update this value. Leave unset to preserve the existing setting.
-@property (nullable, readonly) NSNumber<RLMBool> *mayRead;
-/// Define write access. Set to `YES` or `NO` to update this value. Leave unset to preserve the existing setting.
-@property (nullable, readonly) NSNumber<RLMBool> *mayWrite;
-/// Define management access. Set to `YES` or `NO` to update this value. Leave unset to preserve the existing setting.
-@property (nullable, readonly) NSNumber<RLMBool> *mayManage;
-
-/**
- Construct a permission change object used to change the access permissions for a user on a Realm.
-
- @param realmURL  The Realm URL whose permissions settings should be changed.
-                  Use `*` to change the permissions of all Realms managed by the Management Realm's `RLMSyncUser`.
- @param userID    The user or users who should be granted these permission changes.
-                  Use `*` to change the permissions for all users.
- @param mayRead   Define read access. Set to `YES` or `NO` to update this value.
-                  Leave unset to preserve the existing setting.
- @param mayWrite  Define write access. Set to `YES` or `NO` to update this value.
-                  Leave unset to preserve the existing setting.
- @param mayManage Define management access. Set to `YES` or `NO` to update this value.
-                  Leave unset to preserve the existing setting.
- */
-+ (instancetype)permissionChangeWithRealmURL:(NSString *)realmURL
-                                      userID:(NSString *)userID
-                                        read:(nullable NSNumber<RLMBool> *)mayRead
-                                       write:(nullable NSNumber<RLMBool> *)mayWrite
-                                      manage:(nullable NSNumber<RLMBool> *)mayManage;
-
-@end
-
-NS_ASSUME_NONNULL_END

+ 0 - 91
Libraries external/Realm/Realm.framework/Headers/RLMSyncPermissionOffer.h

@@ -1,91 +0,0 @@
-////////////////////////////////////////////////////////////////////////////
-//
-// Copyright 2016 Realm Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-////////////////////////////////////////////////////////////////////////////
-
-#import <Foundation/Foundation.h>
-#import <Realm/RLMObject.h>
-#import <Realm/RLMProperty.h>
-#import <Realm/RLMSyncUtil.h>
-
-NS_ASSUME_NONNULL_BEGIN
-
-/**
- This model is used for offering permission changes to other users.
-
- It should be used in conjunction with an `RLMSyncUser`'s Management Realm.
-
- See https://realm.io/docs/realm-object-server/#permissions for general
- documentation.
- */
-@interface RLMSyncPermissionOffer : RLMObject
-
-/// The globally unique ID string of this permission offer object.
-@property (readonly) NSString *id;
-
-/// The date this object was initially created.
-@property (readonly) NSDate *createdAt;
-
-/// The date this object was last modified.
-@property (readonly) NSDate *updatedAt;
-
-/// The status code of the object that was processed by Realm Object Server.
-@property (nullable, readonly) NSNumber<RLMInt> *statusCode;
-
-/// An error or informational message, typically written to by the Realm Object Server.
-@property (nullable, readonly) NSString *statusMessage;
-
-/// Sync management object status.
-@property (readonly) RLMSyncManagementObjectStatus status;
-
-/// A token which uniquely identifies this offer. Generated by the server.
-@property (nullable, readonly) NSString *token;
-
-/// The remote URL to the realm.
-@property (readonly) NSString *realmUrl;
-
-/// Whether this offer allows the receiver to read from the Realm.
-@property (readonly) BOOL mayRead;
-
-/// Whether this offer allows the receiver to write to the Realm.
-@property (readonly) BOOL mayWrite;
-
-/// Whether this offer allows the receiver to manage the access rights for others.
-@property (readonly) BOOL mayManage;
-
-/// When this token will expire and become invalid.
-@property (nullable, readonly) NSDate *expiresAt;
-
-/**
- Construct a permission offer object used to offer permission changes to other users.
-
- @param realmURL  The URL to the Realm on which to apply these permission changes
-                  to, once the offer is accepted.
- @param expiresAt When this token will expire and become invalid.
-                  Pass `nil` if this offer should not expire.
- @param mayRead   Grant or revoke read access.
- @param mayWrite  Grant or revoked read-write access.
- @param mayManage Grant or revoke administrative access.
- */
-+ (instancetype)permissionOfferWithRealmURL:(NSString *)realmURL
-                                  expiresAt:(nullable NSDate *)expiresAt
-                                       read:(BOOL)mayRead
-                                      write:(BOOL)mayWrite
-                                     manage:(BOOL)mayManage;
-
-@end
-
-NS_ASSUME_NONNULL_END

+ 0 - 73
Libraries external/Realm/Realm.framework/Headers/RLMSyncPermissionOfferResponse.h

@@ -1,73 +0,0 @@
-////////////////////////////////////////////////////////////////////////////
-//
-// Copyright 2016 Realm Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-////////////////////////////////////////////////////////////////////////////
-
-#import <Realm/Realm.h>
-#import <Realm/RLMSyncUtil.h>
-
-NS_ASSUME_NONNULL_BEGIN
-
-/**
- This model is used to apply permission changes defined in the permission offer
- object represented by the specified token, which was created by another user's
- `RLMSyncPermissionOffer` object.
-
- It should be used in conjunction with an `RLMSyncUser`'s Management Realm.
-
- See https://realm.io/docs/realm-object-server/#permissions for general
- documentation.
- */
-@interface RLMSyncPermissionOfferResponse : RLMObject
-
-/// The globally unique ID string of this permission offer response object.
-@property (readonly) NSString *id;
-
-/// The date this object was initially created.
-@property (readonly) NSDate *createdAt;
-
-/// The date this object was last modified.
-@property (readonly) NSDate *updatedAt;
-
-/// The status code of the object that was processed by Realm Object Server.
-@property (nullable, readonly) NSNumber<RLMInt> *statusCode;
-
-/// An error or informational message, typically written to by the Realm Object Server.
-@property (nullable, readonly) NSString *statusMessage;
-
-/// Sync management object status.
-@property (readonly) RLMSyncManagementObjectStatus status;
-
-/// The received token which uniquely identifies another user's `RLMSyncPermissionOffer`.
-@property (readonly) NSString *token;
-
-/// The remote URL to the realm on which these permission changes were applied.
-/// Generated by the server.
-@property (nullable, readonly) NSString *realmUrl;
-
-/**
- Construct a permission offer response object used to apply permission changes
- defined in the permission offer object represented by the specified token,
- which was created by another user's `RLMSyncPermissionOffer` object.
-
- @param token The received token which uniquely identifies another user's
-              `RLMSyncPermissionOffer`.
- */
-+ (instancetype)permissionOfferResponseWithToken:(NSString *)token;
-
-@end
-
-NS_ASSUME_NONNULL_END

+ 0 - 112
Libraries external/Realm/Realm.framework/Headers/RLMSyncPermissionResults.h

@@ -1,112 +0,0 @@
-////////////////////////////////////////////////////////////////////////////
-//
-// Copyright 2017 Realm Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-////////////////////////////////////////////////////////////////////////////
-
-#import <Foundation/Foundation.h>
-
-#import "RLMSyncUser.h"
-
-NS_ASSUME_NONNULL_BEGIN
-
-/// Properties which a sync permission results collection can be sorted by.
-typedef NS_ENUM(NSUInteger, RLMSyncPermissionResultsSortProperty) {
-    /// Sort by the Realm Object Server path to the Realm to which the permission applies.
-    RLMSyncPermissionResultsSortPropertyPath,
-    /// Sort by the identity of the user to whom the permission applies.
-    RLMSyncPermissionResultsSortPropertyUserID,
-    /// Sort by the date the permissions were last updated.
-    RLMSyncPermissionResultsSortDateUpdated,
-};
-
-@class RLMSyncPermissionValue, RLMNotificationToken;
-
-/**
- A collection object representing the results of a permissions query.
-
- This collection will automatically update its contents at the start of each runloop
- iteration, but the objects it vends are immutable.
-
- Permission results objects are thread-confined, and should not be shared across
- threads.
-
- @warning Permission results must only be fetched on threads that have an active
-          run loop. In most cases this will be the main thread.
- */
-@interface RLMSyncPermissionResults : NSObject<NSFastEnumeration>
-
-/// The number of results contained within the object.
-@property (nonatomic, readonly) NSInteger count;
-
-/**
- Return the first permission, or nil if the collection is empty.
- */
-- (nullable RLMSyncPermissionValue *)firstObject NS_SWIFT_UNAVAILABLE("Use the `first` property.");
-
-/**
- Return the last permission, or nil if the collection is empty.
- */
-- (nullable RLMSyncPermissionValue *)lastObject NS_SWIFT_UNAVAILABLE("Use the `last` property.");
-
-/**
- Retrieve the permission value at the given index. Throws an exception if the index
- is out of bounds.
- */
-- (RLMSyncPermissionValue *)objectAtIndex:(NSInteger)index;
-
-/**
- Returns the index of the permission in the collection, or `NSNotFound` if the permission
- is not found in the collection.
- */
-- (NSInteger)indexOfObject:(RLMSyncPermissionValue *)object;
-
-/**
- Register to be notified when the contents of the results object change.
-
- This method returns a token. Hold on to the token for as long as notifications
- are desired. Call `-stop` on the token to stop notifications, and before
- deallocating the token.
- */
-- (RLMNotificationToken *)addNotificationBlock:(RLMPermissionStatusBlock)block;
-
-#pragma mark - Queries
-
-/**
- Return all permissions matching the given predicate in the collection.
-
- @note Valid properties to filter on are `path` and `userId`, as well as
-       the boolean properties `mayRead`, `mayWrite`, and `mayManage`.
- */
-- (RLMSyncPermissionResults *)objectsWithPredicate:(NSPredicate *)predicate;
-
-/**
- Return a sorted `RLMSyncPermissionResults` from the collection, sorted based on
- the given property.
- */
-- (RLMSyncPermissionResults *)sortedResultsUsingProperty:(RLMSyncPermissionResultsSortProperty)property
-                                               ascending:(BOOL)ascending;
-
-#pragma mark - Misc
-
-/// :nodoc:
-- (instancetype)init __attribute__((unavailable("RLMSyncPermissionResults cannot be created directly")));
-
-/// :nodoc:
-+ (instancetype)new __attribute__((unavailable("RLMSyncPermissionResults cannot be created directly")));
-
-@end
-
-NS_ASSUME_NONNULL_END

+ 0 - 141
Libraries external/Realm/Realm.framework/Headers/RLMSyncPermissionValue.h

@@ -1,141 +0,0 @@
-////////////////////////////////////////////////////////////////////////////
-//
-// Copyright 2017 Realm Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-////////////////////////////////////////////////////////////////////////////
-
-#import <Foundation/Foundation.h>
-
-/**
- Access levels which can be granted to Realm Mobile Platform users
- for specific synchronized Realms, using the permissions APIs.
-
- Note that each access level guarantees all allowed actions provided
- by less permissive access levels. Specifically, users with write
- access to a Realm can always read from that Realm, and users with
- administrative access can always read or write from the Realm.
- */
-typedef NS_ENUM(NSUInteger, RLMSyncAccessLevel) {
-    /// No access whatsoever.
-    RLMSyncAccessLevelNone          = 0,
-    /**
-     User can only read the contents of the Realm.
-
-     @warning Users who have read-only access to a Realm should open the
-              Realm using `+[RLMRealm asyncOpenWithConfiguration:callbackQueue:callback:]`.
-              Attempting to directly open the Realm is an error; in this
-              case the Realm must be deleted and re-opened.
-     */
-    RLMSyncAccessLevelRead          = 1,
-    /// User can read and write the contents of the Realm.
-    RLMSyncAccessLevelWrite         = 2,
-    /// User can read, write, and administer the Realm, including
-    /// granting permissions to other users.
-    RLMSyncAccessLevelAdmin         = 3,
-};
-
-NS_ASSUME_NONNULL_BEGIN
-
-/**
- A value representing a permission granted to the specified user(s) to access the specified Realm(s).
-
- `RLMSyncPermissionValue` is immutable and can be accessed from any thread.
-
- See https://realm.io/docs/realm-object-server/#permissions for general documentation.
- */
-@interface RLMSyncPermissionValue : NSObject
-
-/**
- The Realm Object Server path to the Realm to which this permission applies (e.g. "/path/to/realm").
-
- Specify "*" if this permission applies to all Realms managed by the server.
- */
-@property (nonatomic, readonly) NSString *path;
-
-/**
- The access level described by this permission.
- */
-@property (nonatomic, readonly) RLMSyncAccessLevel accessLevel;
-
-/// Whether the access level allows the user to read from the Realm.
-@property (nonatomic, readonly) BOOL mayRead;
-
-/// Whether the access level allows the user to write to the Realm.
-@property (nonatomic, readonly) BOOL mayWrite;
-
-/// Whether the access level allows the user to administer the Realm.
-@property (nonatomic, readonly) BOOL mayManage;
-
-/**
- Create a new sync permission value, for use with permission APIs.
-
- @param path        The Realm Object Server path to the Realm whose permission should be modified
-                    (e.g. "/path/to/realm"). Pass "*" to apply to all Realms managed by the user.
- @param userID      The identity of the user who should be granted access to the Realm at `path`.
-                    Pass "*" to apply to all users managed by the server.
- @param accessLevel The access level to grant.
- */
-- (instancetype)initWithRealmPath:(NSString *)path
-                           userID:(NSString *)userID
-                      accessLevel:(RLMSyncAccessLevel)accessLevel;
-
-/**
- Create a new sync permission value, for use with permission APIs.
-
- @param path        The Realm Object Server path to the Realm whose permission should be modified
-                    (e.g. "/path/to/realm"). Pass "*" to apply to all Realms managed by the user.
- @param username    The username (often an email address) of the user who should be granted access
-                    to the Realm at `path`.
- @param accessLevel The access level to grant.
- */
-- (instancetype)initWithRealmPath:(NSString *)path
-                         username:(NSString *)username
-                      accessLevel:(RLMSyncAccessLevel)accessLevel;
-
-/**
- The identity of the user to whom this permission is granted, or "*"
- if all users are granted this permission. Nil if the permission is
- defined in terms of a key-value pair.
- */
-@property (nullable, nonatomic, readonly) NSString *userId;
-
-/**
- If the permission is defined in terms of a key-value pair, the key
- describing the type of criterion used to determine what users the
- permission applies to. Otherwise, nil.
- */
-@property (nullable, nonatomic, readonly) NSString *key;
-
-/**
- If the permission is defined in terms of a key-value pair, a string
- describing the criterion value used to determine what users the
- permission applies to. Otherwise, nil.
- */
-@property (nullable, nonatomic, readonly) NSString *value;
-
-/**
- When this permission object was last updated.
- */
-@property (nonatomic, readonly) NSDate *updatedAt;
-
-/// :nodoc:
-- (instancetype)init __attribute__((unavailable("Use the designated initializer")));
-
-/// :nodoc:
-+ (instancetype)new __attribute__((unavailable("Use the designated initializer")));
-
-@end
-
-NS_ASSUME_NONNULL_END

+ 35 - 8
Libraries external/Realm/Realm.framework/Headers/RLMSyncSession.h

@@ -51,15 +51,15 @@ typedef NS_ENUM(NSUInteger, RLMSyncProgressDirection) {
  Progress notification blocks can be registered on sessions if your app wishes to be informed
  how many bytes have been uploaded or downloaded, for example to show progress indicator UIs.
  */
-typedef NS_ENUM(NSUInteger, RLMSyncProgress) {
+typedef NS_ENUM(NSUInteger, RLMSyncProgressMode) {
     /**
      The block will be called indefinitely, or until it is unregistered by calling
-     `-[RLMProgressNotificationToken stop]`.
+     `-[RLMProgressNotificationToken invalidate]`.
 
      Notifications will always report the latest number of transferred bytes, and the
      most up-to-date number of total transferrable bytes.
      */
-    RLMSyncProgressReportIndefinitely,
+    RLMSyncProgressModeReportIndefinitely,
     /**
      The block will, upon registration, store the total number of bytes
      to be transferred. When invoked, it will always report the most up-to-date number
@@ -68,10 +68,10 @@ typedef NS_ENUM(NSUInteger, RLMSyncProgress) {
      When the number of transferred bytes reaches or exceeds the
      number of transferrable bytes, the block will be unregistered.
      */
-    RLMSyncProgressForCurrentlyOutstandingWork,
+    RLMSyncProgressModeForCurrentlyOutstandingWork,
 };
 
-@class RLMSyncUser, RLMSyncConfiguration;
+@class RLMSyncUser, RLMSyncConfiguration, RLMSyncErrorActionToken;
 
 /**
  The type of a progress notification block intended for reporting a session's network
@@ -87,7 +87,7 @@ NS_ASSUME_NONNULL_BEGIN
 /**
  A token object corresponding to a progress notification block on a session object.
 
- To stop notifications manually, call `-stop` on it. Notifications should be stopped before
+ To stop notifications manually, call `-invalidate` on it. Notifications should be stopped before
  the token goes out of scope or is destroyed.
  */
 @interface RLMProgressNotificationToken : RLMNotificationToken
@@ -130,7 +130,7 @@ NS_ASSUME_NONNULL_BEGIN
  will be called as soon as progress information becomes available.
 
  The token returned by this method must be retained as long as progress
- notifications are desired, and the `-stop` method should be called on it
+ notifications are desired, and the `-invalidate` method should be called on it
  when notifications are no longer needed and before the token is destroyed.
 
  If no token is returned, the notification block will never be called again.
@@ -150,10 +150,37 @@ NS_ASSUME_NONNULL_BEGIN
  @see `RLMSyncProgressDirection`, `RLMSyncProgress`, `RLMProgressNotificationBlock`, `RLMProgressNotificationToken`
  */
 - (nullable RLMProgressNotificationToken *)addProgressNotificationForDirection:(RLMSyncProgressDirection)direction
-                                                                          mode:(RLMSyncProgress)mode
+                                                                          mode:(RLMSyncProgressMode)mode
                                                                          block:(RLMProgressNotificationBlock)block
 NS_REFINED_FOR_SWIFT;
 
+/**
+ Given an error action token, immediately handle the corresponding action.
+ 
+ @see `RLMSyncErrorClientResetError`, `RLMSyncErrorPermissionDeniedError`
+ */
++ (void)immediatelyHandleError:(RLMSyncErrorActionToken *)token;
+
+@end
+
+// MARK: - Error action token
+
+#pragma mark - Error action token
+
+/**
+ An opaque token returned as part of certain errors. It can be
+ passed into certain APIs to perform certain actions.
+
+ @see `RLMSyncErrorClientResetError`, `RLMSyncErrorPermissionDeniedError`
+ */
+@interface RLMSyncErrorActionToken : NSObject
+
+/// :nodoc:
+- (instancetype)init __attribute__((unavailable("This type cannot be created directly")));
+
+/// :nodoc:
++ (instancetype)new __attribute__((unavailable("This type cannot be created directly")));
+
 @end
 
 NS_ASSUME_NONNULL_END

+ 99 - 48
Libraries external/Realm/Realm.framework/Headers/RLMSyncUser.h

@@ -18,9 +18,11 @@
 
 #import <Foundation/Foundation.h>
 
+#import "RLMResults.h"
 #import "RLMSyncCredentials.h"
+#import "RLMSyncPermission.h"
 
-@class RLMSyncUser, RLMSyncUserInfo, RLMSyncCredentials, RLMSyncPermissionValue, RLMSyncPermissionResults, RLMSyncSession, RLMRealm;
+@class RLMSyncUser, RLMSyncUserInfo, RLMSyncCredentials, RLMSyncPermission, RLMSyncSession, RLMRealm;
 
 /**
  The state of the user object.
@@ -45,9 +47,15 @@ typedef void(^RLMPasswordChangeStatusBlock)(NSError * _Nullable);
 /// If the `NSError` argument is nil, the operation succeeded.
 typedef void(^RLMPermissionStatusBlock)(NSError * _Nullable);
 
+/// A block type used to report the status of a permission offer operation.
+typedef void(^RLMPermissionOfferStatusBlock)(NSString * _Nullable, NSError * _Nullable);
+
+/// A block type used to report the status of a permission offer response operation.
+typedef void(^RLMPermissionOfferResponseStatusBlock)(NSURL * _Nullable, NSError * _Nullable);
+
 /// A block type used to asynchronously report results of a permissions get operation.
 /// Exactly one of the two arguments will be populated.
-typedef void(^RLMPermissionResultsBlock)(RLMSyncPermissionResults * _Nullable, NSError * _Nullable);
+typedef void(^RLMPermissionResultsBlock)(RLMResults<RLMSyncPermission *> * _Nullable, NSError * _Nullable);
 
 /// A block type used to asynchronously report results of a user info retrieval.
 /// Exactly one of the two arguments will be populated.
@@ -106,18 +114,31 @@ NS_ASSUME_NONNULL_BEGIN
 #pragma mark - Lifecycle
 
 /**
- Create, log in, and asynchronously return a new user object, specifying a custom timeout for the network request.
- Credentials identifying the user must be passed in. The user becomes available in the completion block, at which point
- it is ready for use.
+ Create, log in, and asynchronously return a new user object, specifying a custom
+ timeout for the network request and a custom queue to run the callback upon.
+ Credentials identifying the user must be passed in. The user becomes available in
+ the completion block, at which point it is ready for use.
  */
 + (void)logInWithCredentials:(RLMSyncCredentials *)credentials
                authServerURL:(NSURL *)authServerURL
                      timeout:(NSTimeInterval)timeout
+               callbackQueue:(dispatch_queue_t)callbackQueue
                 onCompletion:(RLMUserCompletionBlock)completion NS_REFINED_FOR_SWIFT;
 
 /**
- Create, log in, and asynchronously return a new user object. Credentials identifying the user must be passed in. The
- user becomes available in the completion block, at which point it is ready for use.
+ Create, log in, and asynchronously return a new user object.
+
+ If the login completes successfully, the completion block will invoked with
+ a `RLMSyncUser` object representing the logged-in user. This object can be
+ used to open synchronized Realms. If the login fails, the completion block
+ will be invoked with an error.
+
+ The completion block always runs on the main queue.
+
+ @param credentials     A credentials value identifying the user to be logged in.
+ @param authServerURL   The URL of the authentication server (e.g. "http://realm.example.org:9080").
+ @param completion      A callback block that returns a user object or an error,
+                        indicating the completion of the login operation.
  */
 + (void)logInWithCredentials:(RLMSyncCredentials *)credentials
                authServerURL:(NSURL *)authServerURL
@@ -147,7 +168,7 @@ NS_SWIFT_UNAVAILABLE("Use the full version of this API.");
        third party authentication service providing the user's identity has
        logged the user out.
 
- @warning Regardless of whether an error handler is defined, certain user errors
+ @warning Regardless of whether an error handler is installed, certain user errors
           will automatically cause the user to enter the logged out state.
  */
 @property (nullable, nonatomic) RLMUserErrorReportingBlock errorHandler NS_REFINED_FOR_SWIFT;
@@ -155,7 +176,8 @@ NS_SWIFT_UNAVAILABLE("Use the full version of this API.");
 #pragma mark - Sessions
 
 /**
- Retrieve a valid session object belonging to this user for a given URL, or `nil` if no such object exists.
+ Retrieve a valid session object belonging to this user for a given URL, or `nil`
+ if no such object exists.
  */
 - (nullable RLMSyncSession *)sessionForURL:(NSURL *)url;
 
@@ -197,7 +219,7 @@ NS_SWIFT_UNAVAILABLE("Use the full version of this API.");
  */
 - (void)changePassword:(NSString *)newPassword forUserID:(NSString *)userID completion:(RLMPasswordChangeStatusBlock)completion;
 
-#pragma mark - Administrator API
+#pragma mark - Administrator
 
 /**
  Given a Realm Object Server authentication provider and a provider identifier for a user
@@ -214,10 +236,7 @@ NS_SWIFT_UNAVAILABLE("Use the full version of this API.");
            identityProvider:(RLMIdentityProvider)provider
                  completion:(RLMRetrieveUserBlock)completion;
 
-// This set of permissions APIs uses immutable `RLMSyncPermissionValue` objects to
-// retrieve and apply permissions. It is intended to replace the set of APIs which
-// directly access Realms and Realm model objects to work with permissions.
-#pragma mark - Value-based Permissions API
+#pragma mark - Permissions
 
 /**
  Asynchronously retrieve all permissions associated with the user calling this method.
@@ -228,10 +247,8 @@ NS_SWIFT_UNAVAILABLE("Use the full version of this API.");
  @warning This method must be called from a thread with a currently active run loop. Unless
           you have manually configured a run loop on a side thread, this will usually be the
           main thread.
-
- @see `RLMSyncPermissionResults`
  */
-- (void)retrievePermissionsWithCallback:(RLMPermissionResultsBlock)callback;
+- (void)retrievePermissionsWithCallback:(RLMPermissionResultsBlock)callback NS_REFINED_FOR_SWIFT;
 
 /**
  Apply a given permission.
@@ -240,9 +257,9 @@ NS_SWIFT_UNAVAILABLE("Use the full version of this API.");
  the permission change succeeded or failed. The user calling this method must have the right
  to grant the given permission, or else the operation will fail.
 
- @see `RLMSyncPermissionValue`
+ @see `RLMSyncPermission`
  */
-- (void)applyPermission:(RLMSyncPermissionValue *)permission callback:(RLMPermissionStatusBlock)callback;
+- (void)applyPermission:(RLMSyncPermission *)permission callback:(RLMPermissionStatusBlock)callback;
 
 /**
  Revoke a given permission.
@@ -251,73 +268,107 @@ NS_SWIFT_UNAVAILABLE("Use the full version of this API.");
  the permission change succeeded or failed. The user calling this method must have the right
  to grant the given permission, or else the operation will fail.
 
- @see `RLMSyncPermissionValue`
+ @see `RLMSyncPermission`
  */
-- (void)revokePermission:(RLMSyncPermissionValue *)permission callback:(RLMPermissionStatusBlock)callback;
-
-// These permission APIs access Realms and Realm model objects representing
-// various permission states and actions, as well as standard Realm
-// affordances, to work with permissions. It is being deprecated in favor of
-// the `retrievePermissionsWithCallback:`, `applyPermission:callback:`, and
-// `revokePermission:callback:` APIs.
-#pragma mark - Realm Object-based Permissions API
+- (void)revokePermission:(RLMSyncPermission *)permission callback:(RLMPermissionStatusBlock)callback;
 
 /**
- Returns an instance of the Management Realm owned by the user.
+ Create a permission offer for a Realm.
+
+ A permission offer is used to grant access to a Realm this user manages to another
+ user. Creating a permission offer produces a string token which can be passed to the
+ recepient in any suitable way (for example, via e-mail).
+
+ The operation will take place asynchronously. The token can be accepted by the recepient
+ using the `-[RLMSyncUser acceptOfferForToken:callback:]` method.
 
- This Realm can be used to control access permissions for Realms managed by the user.
- This includes granting other users access to Realms.
+ @param url             The URL of the Realm for which the permission offer should pertain. This
+                        may be the URL of any Realm which this user is allowed to manage. If the URL
+                        has a `~` wildcard it will be replaced with this user's user identity.
+ @param accessLevel     What access level to grant to whoever accepts the token.
+ @param expirationDate  Optionally, a date which indicates when the offer expires. If the
+                        recepient attempts to accept the offer after the date it will be rejected.
+ @param callback        A callback indicating whether the operation succeeded or failed. If it
+                        succeeded the token will be passed in as a string.
+
+ @see `acceptOfferForToken:callback:`
  */
-- (RLMRealm *)managementRealmWithError:(NSError **)error NS_REFINED_FOR_SWIFT;
+- (void)createOfferForRealmAtURL:(NSURL *)url
+                     accessLevel:(RLMSyncAccessLevel)accessLevel
+                      expiration:(nullable NSDate *)expirationDate
+                        callback:(RLMPermissionOfferStatusBlock)callback NS_REFINED_FOR_SWIFT;
 
 /**
- Returns an instance of the Permission Realm owned by the user.
+ Accept a permission offer.
 
- This read-only Realm contains `RLMSyncPermission` objects reflecting the
- synchronized Realms and permission details this user has access to.
- */
-- (RLMRealm *)permissionRealmWithError:(NSError **)error __deprecated_msg("Use `-retrievePermissionsWithCallback:`") NS_REFINED_FOR_SWIFT;
+ Pass in a token representing a permission offer. The operation will take place asynchronously.
+ If the operation succeeds, the callback will be passed the URL of the Realm for which the
+ offer applied, so the Realm can be opened.
 
-#pragma mark - Miscellaneous
+ The token this method accepts can be created by the offering user through the
+ `-[RLMSyncUser createOfferForRealmAtURL:accessLevel:expiration:callback:]` method.
+
+ @see `createOfferForRealmAtURL:accessLevel:expiration:callback:`
+ */
+- (void)acceptOfferForToken:(NSString *)token
+                   callback:(RLMPermissionOfferResponseStatusBlock)callback;
 
 /// :nodoc:
 - (instancetype)init __attribute__((unavailable("RLMSyncUser cannot be created directly")));
-
 /// :nodoc:
 + (instancetype)new __attribute__((unavailable("RLMSyncUser cannot be created directly")));
 
 @end
 
+#pragma mark - User info classes
+
 /**
- A data object representing information about a user that was retrieved from a user lookup call.
+ A data object representing a user account associated with a user.
+
+ @see `RLMSyncUserInfo`
  */
-@interface RLMSyncUserInfo : NSObject
+@interface RLMSyncUserAccountInfo : NSObject
+
+/// The authentication provider which manages this user account.
+@property (nonatomic, readonly) RLMIdentityProvider provider;
+
+/// The username or identity of this user account.
+@property (nonatomic, readonly) NSString *providerUserIdentity;
+
+/// :nodoc:
+- (instancetype)init __attribute__((unavailable("RLMSyncUserAccountInfo cannot be created directly")));
+/// :nodoc:
++ (instancetype)new __attribute__((unavailable("RLMSyncUserAccountInfo cannot be created directly")));
+
+@end
 
 /**
- The authentication provider which manages the user represented by this user info instance.
+ A data object representing information about a user that was retrieved from a user lookup call.
  */
-@property (nonatomic, readonly) RLMIdentityProvider provider;
+@interface RLMSyncUserInfo : NSObject
 
 /**
- The username or identity issued to this user by the authentication provider.
+ An array of all the user accounts associated with this user.
  */
-@property (nonatomic, readonly) NSString *providerUserIdentity;
+@property (nonatomic, readonly) NSArray<RLMSyncUserAccountInfo *> *accounts;
 
 /**
  The identity issued to this user by the Realm Object Server.
  */
 @property (nonatomic, readonly) NSString *identity;
 
+/**
+ Metadata about this user stored on the Realm Object Server.
+ */
+@property (nonatomic, readonly) NSDictionary<NSString *, NSString *> *metadata;
+
 /**
  Whether the user is flagged on the Realm Object Server as an administrator.
  */
 @property (nonatomic, readonly) BOOL isAdmin;
 
-#pragma mark - Miscellaneous
-
 /// :nodoc:
 - (instancetype)init __attribute__((unavailable("RLMSyncUserInfo cannot be created directly")));
-
 /// :nodoc:
 + (instancetype)new __attribute__((unavailable("RLMSyncUserInfo cannot be created directly")));
 

+ 34 - 41
Libraries external/Realm/Realm.framework/Headers/RLMSyncUtil.h

@@ -26,11 +26,8 @@ NS_ASSUME_NONNULL_BEGIN
 /// A user info key for use with `RLMSyncErrorClientResetError`.
 extern NSString *const kRLMSyncPathOfRealmBackupCopyKey;
 
-/// A user info key for use with `RLMSyncErrorClientResetError`.
-extern NSString *const kRLMSyncInitiateClientResetBlockKey;
-
-/// A user info key for use with `RLMSyncErrorPermissionDeniedError`.
-extern NSString *const kRLMSyncInitiateDeleteRealmBlockKey;
+/// A user info key for use with certain error types.
+extern NSString *const kRLMSyncErrorActionTokenKey;
 
 /**
  The error domain string for all SDK errors related to errors reported
@@ -56,14 +53,6 @@ extern NSString *const RLMSyncPermissionErrorDomain;
  error handler, or a callback on a sync-related API that performs asynchronous work.
  */
 typedef RLM_ERROR_ENUM(NSInteger, RLMSyncError, RLMSyncErrorDomain) {
-    /**
-     An error that indicates that the response received from the
-     authentication server was malformed.
-
-     @warning This error is deprecated, and has been replaced by
-              `RLMSyncAuthErrorBadResponse`.
-     */
-    RLMSyncErrorBadResponse __deprecated_msg("This error has been replaced by 'RLMSyncAuthErrorBadResponse'") = 1,
 
     /// An error that indicates a problem with the session (a specific Realm opened for sync).
     RLMSyncErrorClientSessionError      = 4,
@@ -95,21 +84,24 @@ typedef RLM_ERROR_ENUM(NSInteger, RLMSyncError, RLMSyncErrorDomain) {
      re-downloaded Realm will initially contain only the data present at the time the Realm
      was backed up on the server.
 
-     The client reset process can be initiated in one of two ways. The block provided in the
-     `userInfo` dictionary under `kRLMSyncInitiateClientResetBlockKey` can be called to
-     initiate the reset process. This block can be called any time after the error is
-     received, but should only be called after your app closes and invalidates every
+     The client reset process can be initiated in one of two ways.
+     
+     The `userInfo` dictionary contains an opaque token object under the key
+     `kRLMSyncErrorActionTokenKey`. This token can be passed into
+     `+[RLMSyncSession immediatelyHandleError:]` in order to immediately perform the client
+     reset process. This should only be done after your app closes and invalidates every
      instance of the offending Realm on all threads (note that autorelease pools may make this
      difficult to guarantee).
 
-     If the block is not called, the client reset process will be automatically carried out
-     the next time the app is launched and the `RLMSyncManager` singleton is accessed.
+     If `+[RLMSyncSession immediatelyHandleError:]` is not called, the client reset process
+     will be automatically carried out the next time the app is launched and the
+     `RLMSyncManager` singleton is accessed.
 
      The value for the `kRLMSyncPathOfRealmBackupCopyKey` key in the `userInfo` dictionary
      describes the path of the recovered copy of the Realm. This copy will not actually be
      created until the client reset process is initiated.
 
-     @see `-[NSError rlmSync_clientResetBlock]`, `-[NSError rlmSync_clientResetBackedUpRealmPath]`
+     @see `-[NSError rlmSync_errorActionToken]`, `-[NSError rlmSync_clientResetBackedUpRealmPath]`
      */
     RLMSyncErrorClientResetError        = 7,
 
@@ -134,15 +126,17 @@ typedef RLM_ERROR_ENUM(NSInteger, RLMSyncError, RLMSyncErrorDomain) {
      A Realm that suffers a permission denied error is, by default, flagged so that its
      local copy will be deleted the next time the application starts.
      
-     The `userInfo` dictionary contains a block under the key
-     `kRLMSyncInitiateDeleteRealmBlockKey`, which can be used to request that the file be
-     deleted immediately instead. This block can be called any time after the error is
-     received to immediately delete the Realm file, but should only be called after your
-     app closes and invalidates every instance of the offending Realm on all threads (note
-     that autorelease pools may make this difficult to guarantee).
+     The `userInfo` dictionary contains an opaque token object under the key
+     `kRLMSyncErrorActionTokenKey`. This token can be passed into
+     `+[RLMSyncSession immediatelyHandleError:]` in order to immediately delete the local
+     copy. This should only be done after your app closes and invalidates every instance
+     of the offending Realm on all threads (note that autorelease pools may make this
+     difficult to guarantee).
 
      @warning It is strongly recommended that, if a Realm has encountered a permission denied
               error, its files be deleted before attempting to re-open it.
+     
+     @see `-[NSError rlmSync_errorActionToken]`
      */
     RLMSyncErrorPermissionDeniedError   = 9,
 };
@@ -196,28 +190,27 @@ typedef RLM_ERROR_ENUM(NSInteger, RLMSyncPermissionError, RLMSyncPermissionError
      An error that indicates a permission change operation failed. The `userInfo`
      dictionary contains the underlying error code and a message (if any).
      */
-    RLMSyncPermissionErrorChangeFailed  = 1,
+    RLMSyncPermissionErrorChangeFailed          = 1,
 
     /**
      An error that indicates that attempting to retrieve permissions failed.
      */
-    RLMSyncPermissionErrorGetFailed     = 2,
-};
+    RLMSyncPermissionErrorGetFailed             = 2,
+
+    /**
+     An error that indicates that trying to create a permission offer failed.
+     */
+    RLMSyncPermissionErrorOfferFailed           = 3,
+
+    /**
+     An error that indicates that trying to accept a permission offer failed.
+     */
+    RLMSyncPermissionErrorAcceptOfferFailed     = 4,
 
-/// An enum representing the different states a sync management object can take.
-typedef NS_ENUM(NSUInteger, RLMSyncManagementObjectStatus) {
-    /// The management object has not yet been processed by the object server.
-    RLMSyncManagementObjectStatusNotProcessed,
-    /// The operations encoded in the management object have been successfully
-    /// performed by the object server.
-    RLMSyncManagementObjectStatusSuccess,
     /**
-     The operations encoded in the management object were not successfully
-     performed by the object server.
-     Refer to the `statusCode` and `statusMessage` properties for more details
-     about the error.
+     An error that indicates that an internal error occurred.
      */
-    RLMSyncManagementObjectStatusError,
+    RLMSyncPermissionErrorInternal              = 5,
 };
 
 NS_ASSUME_NONNULL_END

+ 1 - 5
Libraries external/Realm/Realm.framework/Headers/Realm.h

@@ -25,6 +25,7 @@
 #import <Realm/RLMPlatform.h>
 #import <Realm/RLMProperty.h>
 #import <Realm/RLMRealm.h>
+#import <Realm/RLMRealm+Sync.h>
 #import <Realm/RLMRealmConfiguration.h>
 #import <Realm/RLMRealmConfiguration+Sync.h>
 #import <Realm/RLMResults.h>
@@ -33,11 +34,6 @@
 #import <Realm/RLMSyncCredentials.h>
 #import <Realm/RLMSyncManager.h>
 #import <Realm/RLMSyncPermission.h>
-#import <Realm/RLMSyncPermissionChange.h>
-#import <Realm/RLMSyncPermissionOffer.h>
-#import <Realm/RLMSyncPermissionOfferResponse.h>
-#import <Realm/RLMSyncPermissionResults.h>
-#import <Realm/RLMSyncPermissionValue.h>
 #import <Realm/RLMSyncSession.h>
 #import <Realm/RLMSyncUser.h>
 #import <Realm/RLMSyncUtil.h>

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


+ 4 - 0
Libraries external/Realm/Realm.framework/PrivateHeaders/RLMArray_Private.h

@@ -17,12 +17,16 @@
 ////////////////////////////////////////////////////////////////////////////
 
 #import <Realm/RLMArray.h>
+#import <Realm/RLMConstants.h>
 
 NS_ASSUME_NONNULL_BEGIN
 
 @interface RLMArray ()
 - (instancetype)initWithObjectClassName:(NSString *)objectClassName;
+- (instancetype)initWithObjectType:(RLMPropertyType)type optional:(BOOL)optional;
 - (NSString *)descriptionWithMaxDepth:(NSUInteger)depth;
 @end
 
+void RLMArrayValidateMatchingObjectType(RLMArray *array, id value);
+
 NS_ASSUME_NONNULL_END

+ 36 - 3
Libraries external/Realm/Realm.framework/PrivateHeaders/RLMObject_Private.h

@@ -20,6 +20,9 @@
 
 NS_ASSUME_NONNULL_BEGIN
 
+@class RLMProperty, RLMArray, RLMSwiftPropertyMetadata;
+typedef NS_ENUM(int32_t, RLMPropertyType);
+
 // RLMObject accessor and read/write realm
 @interface RLMObjectBase () {
 @public
@@ -96,19 +99,49 @@ FOUNDATION_EXTERN Class RLMObjectUtilClass(BOOL isSwift);
 
 FOUNDATION_EXTERN const NSUInteger RLMDescriptionMaxDepth;
 
-@class RLMProperty, RLMArray;
 @interface RLMObjectUtil : NSObject
 
 + (nullable NSArray<NSString *> *)ignoredPropertiesForClass:(Class)cls;
 + (nullable NSArray<NSString *> *)indexedPropertiesForClass:(Class)cls;
 + (nullable NSDictionary<NSString *, NSDictionary<NSString *, NSString *> *> *)linkingObjectsPropertiesForClass:(Class)cls;
 
-+ (nullable NSArray<NSString *> *)getGenericListPropertyNames:(id)obj;
-+ (nullable NSDictionary<NSString *, NSDictionary<NSString *, NSString *> *> *)getLinkingObjectsProperties:(id)object;
+// Precondition: these must be returned in ascending order.
++ (nullable NSArray<RLMSwiftPropertyMetadata *> *)getSwiftProperties:(id)obj;
 
 + (nullable NSDictionary<NSString *, NSNumber *> *)getOptionalProperties:(id)obj;
 + (nullable NSArray<NSString *> *)requiredPropertiesForClass:(Class)cls;
 
 @end
 
+typedef NS_ENUM(NSUInteger, RLMSwiftPropertyKind) {
+    RLMSwiftPropertyKindList,
+    RLMSwiftPropertyKindLinkingObjects,
+    RLMSwiftPropertyKindOptional,
+    RLMSwiftPropertyKindNilLiteralOptional,   // For Swift optional properties that reflect as nil
+    RLMSwiftPropertyKindOther,
+};
+
+// Metadata that describes a Swift generic property.
+@interface RLMSwiftPropertyMetadata : NSObject
+
+@property (nonatomic, strong) NSString *propertyName;
+@property (nullable, nonatomic, strong) NSString *className;
+@property (nullable, nonatomic, strong) NSString *linkedPropertyName;
+@property (nonatomic) RLMPropertyType propertyType;
+@property (nonatomic) RLMSwiftPropertyKind kind;
+
++ (instancetype)metadataForOtherProperty:(NSString *)propertyName;
+
++ (instancetype)metadataForListProperty:(NSString *)propertyName;
+
++ (instancetype)metadataForLinkingObjectsProperty:(NSString *)propertyName
+                                        className:(NSString *)className
+                               linkedPropertyName:(NSString *)linkedPropertyName;
+
++ (instancetype)metadataForOptionalProperty:(NSString *)propertyName type:(RLMPropertyType)type;
+
++ (instancetype)metadataForNilLiteralOptionalProperty:(NSString *)propertyName;
+
+@end
+
 NS_ASSUME_NONNULL_END

+ 0 - 2
Libraries external/Realm/Realm.framework/PrivateHeaders/RLMProperty_Private.h

@@ -48,8 +48,6 @@ static inline NSString *RLMTypeToString(RLMPropertyType type) {
             return @"any";
         case RLMPropertyTypeObject:
             return @"object";
-        case RLMPropertyTypeArray:
-            return @"array";
         case RLMPropertyTypeLinkingObjects:
             return @"linking objects";
     }

+ 2 - 2
Libraries external/Realm/Realm.framework/PrivateHeaders/RLMRealm_Private.h

@@ -27,7 +27,7 @@ FOUNDATION_EXTERN void RLMDisableSyncToDisk(void);
 
 FOUNDATION_EXTERN NSData * _Nullable RLMRealmValidatedEncryptionKey(NSData *key);
 
-// Translate an in-flight exception resulting from opening a SharedGroup to
+// Translate an in-flight exception resulting from an operation on a SharedGroup to
 // an NSError or NSException (if error is nil)
 void RLMRealmTranslateException(NSError **error);
 
@@ -45,7 +45,7 @@ void RLMRealmTranslateException(NSError **error);
 
 - (void)sendNotifications:(RLMNotification)notification;
 - (void)verifyThread;
-- (void)verifyNotificationsAreSupported;
+- (void)verifyNotificationsAreSupported:(bool)isCollection;
 
 @end
 

+ 0 - 39
Libraries external/Realm/Realm.framework/PrivateHeaders/RLMSyncPermissionChange_Private.h

@@ -1,39 +0,0 @@
-////////////////////////////////////////////////////////////////////////////
-//
-// Copyright 2016 Realm Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-////////////////////////////////////////////////////////////////////////////
-
-#import "RLMSyncPermissionChange.h"
-
-NS_ASSUME_NONNULL_BEGIN
-
-@interface RLMSyncPermissionChange()
-
-@property (readwrite) NSString *id;
-@property (readwrite) NSDate *createdAt;
-@property (readwrite) NSDate *updatedAt;
-@property (nullable, readwrite) NSNumber<RLMInt> *statusCode;
-@property (nullable, readwrite) NSString *statusMessage;
-@property (readwrite) NSString *realmUrl;
-@property (readwrite) NSString *userId;
-
-@property (nullable, readwrite) NSNumber<RLMBool> *mayRead;
-@property (nullable, readwrite) NSNumber<RLMBool> *mayWrite;
-@property (nullable, readwrite) NSNumber<RLMBool> *mayManage;
-
-@end
-
-NS_ASSUME_NONNULL_END

+ 0 - 36
Libraries external/Realm/Realm.framework/PrivateHeaders/RLMSyncPermissionOfferResponse_Private.h

@@ -1,36 +0,0 @@
-////////////////////////////////////////////////////////////////////////////
-//
-// Copyright 2016 Realm Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-////////////////////////////////////////////////////////////////////////////
-
-#import "RLMSyncPermissionOfferResponse.h"
-
-NS_ASSUME_NONNULL_BEGIN
-
-@interface RLMSyncPermissionOfferResponse()
-
-@property (readwrite) NSString *id;
-@property (readwrite) NSDate *createdAt;
-@property (readwrite) NSDate *updatedAt;
-@property (nullable, readwrite) NSNumber<RLMInt> *statusCode;
-@property (nullable, readwrite) NSString *statusMessage;
-
-@property (readwrite) NSString *token;
-@property (nullable, readwrite) NSString *realmUrl;
-
-@end
-
-NS_ASSUME_NONNULL_END

+ 0 - 42
Libraries external/Realm/Realm.framework/PrivateHeaders/RLMSyncPermissionOffer_Private.h

@@ -1,42 +0,0 @@
-////////////////////////////////////////////////////////////////////////////
-//
-// Copyright 2016 Realm Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-////////////////////////////////////////////////////////////////////////////
-
-#import "RLMSyncPermissionOffer.h"
-
-NS_ASSUME_NONNULL_BEGIN
-
-@interface RLMSyncPermissionOffer()
-
-@property (readwrite) NSString *id;
-@property (readwrite) NSDate *createdAt;
-@property (readwrite) NSDate *updatedAt;
-@property (nullable, readwrite) NSNumber<RLMInt> *statusCode;
-@property (nullable, readwrite) NSString *statusMessage;
-
-@property (nullable, readwrite) NSString *token;
-@property (readwrite) NSString *realmUrl;
-
-@property (readwrite) BOOL mayRead;
-@property (readwrite) BOOL mayWrite;
-@property (readwrite) BOOL mayManage;
-
-@property (nullable, readwrite) NSDate *expiresAt;
-
-@end
-
-NS_ASSUME_NONNULL_END

+ 6 - 14
Libraries external/Realm/Realm.framework/PrivateHeaders/RLMSyncPermission_Private.h → Libraries external/Realm/Realm.framework/PrivateHeaders/RLMSyncPermissionResults.h

@@ -1,6 +1,6 @@
 ////////////////////////////////////////////////////////////////////////////
 //
-// Copyright 2016 Realm Inc.
+// Copyright 2017 Realm Inc.
 //
 // Licensed under the Apache License, Version 2.0 (the "License");
 // you may not use this file except in compliance with the License.
@@ -16,20 +16,12 @@
 //
 ////////////////////////////////////////////////////////////////////////////
 
-#import "RLMSyncPermission.h"
+#import <Foundation/Foundation.h>
 
-NS_ASSUME_NONNULL_BEGIN
+#import "RLMResults.h"
 
-@interface RLMSyncPermission()
-
-@property (readwrite) NSDate *updatedAt;
-@property (readwrite) NSString *userId;
-@property (readwrite) NSString *path;
-
-@property (readwrite) BOOL mayRead;
-@property (readwrite) BOOL mayWrite;
-@property (readwrite) BOOL mayManage;
+@class RLMSyncPermission;
 
+// A private subclass of `RLMResults`.
+@interface RLMSyncPermissionResults : RLMResults<RLMSyncPermission *>
 @end
-
-NS_ASSUME_NONNULL_END

+ 18 - 9
Libraries external/Realm/Realm.framework/PrivateHeaders/RLMSyncUtil_Private.h

@@ -43,11 +43,6 @@ typedef NSString* RLMServerPath;
 
 NS_ASSUME_NONNULL_BEGIN
 
-@interface RLMRealmConfiguration (RealmSync)
-+ (instancetype)managementConfigurationForUser:(RLMSyncUser *)user;
-+ (instancetype)permissionConfigurationForUser:(RLMSyncUser *)user;
-@end
-
 extern RLMIdentityProvider const RLMIdentityProviderAccessToken;
 extern RLMIdentityProvider const RLMIdentityProviderRealm;
 
@@ -56,6 +51,8 @@ extern NSString *const kRLMSyncDataKey;
 extern NSString *const kRLMSyncErrorJSONKey;
 extern NSString *const kRLMSyncErrorStatusCodeKey;
 extern NSString *const kRLMSyncIdentityKey;
+extern NSString *const kRLMSyncIsAdminKey;
+extern NSString *const kRLMSyncNewPasswordKey;
 extern NSString *const kRLMSyncPasswordKey;
 extern NSString *const kRLMSyncPathKey;
 extern NSString *const kRLMSyncTokenKey;
@@ -63,10 +60,7 @@ extern NSString *const kRLMSyncProviderKey;
 extern NSString *const kRLMSyncProviderIDKey;
 extern NSString *const kRLMSyncRegisterKey;
 extern NSString *const kRLMSyncUnderlyingErrorKey;
-
-/// Convert sync management object status code (nil, 0 and others) to
-/// RLMSyncManagementObjectStatus enum
-FOUNDATION_EXTERN RLMSyncManagementObjectStatus RLMMakeSyncManagementObjectStatus(NSNumber<RLMInt> * _Nullable statusCode);
+extern NSString *const kRLMSyncUserIDKey;
 
 #define RLM_SYNC_UNINITIALIZABLE \
 - (instancetype)init __attribute__((unavailable("This type cannot be created directly"))); \
@@ -114,6 +108,21 @@ if (!model) { return nil; } \
 self.prop_macro_val = model; \
 } \
 
+/// A macro to build an array of sub-models out of a JSON dictionary, or return nil.
+#define RLM_SYNC_PARSE_MODEL_ARRAY_OR_ABORT(json_macro_val, key_macro_val, class_macro_val, prop_macro_val) \
+{ \
+NSArray *jsonArray = json_macro_val[key_macro_val]; \
+if (![jsonArray isKindOfClass:[NSArray class]]) { return nil; } \
+NSMutableArray *buffer = [NSMutableArray array]; \
+for (id value in jsonArray) { \
+id next = nil; \
+if ([value isKindOfClass:[NSDictionary class]]) { next = [[class_macro_val alloc] initWithDictionary:value]; } \
+if (!next) { return nil; } \
+[buffer addObject:next]; \
+} \
+self.prop_macro_val = [buffer copy]; \
+} \
+
 #define RLM_SYNC_PARSE_OPTIONAL_MODEL(json_macro_val, key_macro_val, class_macro_val, prop_macro_val) \
 { \
 id model; \

BIN
Libraries external/Realm/Realm.framework/Realm


File diff suppressed because it is too large
+ 69 - 9
Libraries external/Realm/RealmSwift.framework/4DCF9A64-5566-3707-8650-C190D326B91D.bcsymbolmap


File diff suppressed because it is too large
+ 69 - 9
Libraries external/Realm/RealmSwift.framework/AA452621-74A4-393C-9670-BBA49D7D49CD.bcsymbolmap


File diff suppressed because it is too large
+ 217 - 210
Libraries external/Realm/RealmSwift.framework/CCC01789-DF7D-3342-BCD7-8FA8E534B0C1.bcsymbolmap


File diff suppressed because it is too large
+ 222 - 213
Libraries external/Realm/RealmSwift.framework/E685B084-64C0-3CB5-B4F7-A049D36D911A.bcsymbolmap


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

@@ -1,4 +1,4 @@
-// Generated by Apple Swift version 4.0 (swiftlang-900.0.65 clang-900.0.37)
+// Generated by Apple Swift version 4.0.2 (swiftlang-900.0.69.2 clang-900.0.38)
 #pragma clang diagnostic push
 #pragma clang diagnostic ignored "-Wgcc-compat"
 
@@ -228,13 +228,13 @@ SWIFT_MODULE_NAMESPACE_PUSH("RealmSwift")
 ///     <code>Data</code>, <code>NSData</code>
 ///   </li>
 ///   <li>
-///     <code>RealmOptional<T></code> for optional numeric properties
+///     <code>RealmOptional<Value></code> for optional numeric properties
 ///   </li>
 ///   <li>
 ///     <code>Object</code> subclasses, to model many-to-one relationships
 ///   </li>
 ///   <li>
-///     <code>List<T></code>, to model many-to-many relationships
+///     <code>List<Element></code>, to model many-to-many relationships
 ///   </li>
 /// </ul>
 /// <code>String</code>, <code>NSString</code>, <code>Date</code>, <code>NSDate</code>, <code>Data</code>, <code>NSData</code> and <code>Object</code> subclass properties can be declared as optional.
@@ -265,6 +265,7 @@ SWIFT_CLASS_NAMED("Object")
 /// A human-readable description of the object.
 @property (nonatomic, readonly, copy) NSString * _Nonnull description;
 /// WARNING: This is an internal helper method not intended for public use.
+/// It is not considered part of the public API.
 /// :nodoc:
 + (Class _Nonnull)objectUtilClass:(BOOL)isSwift SWIFT_WARN_UNUSED_RESULT;
 /// Override this method to specify the name of a property to be used as the primary key.
@@ -289,12 +290,6 @@ SWIFT_CLASS_NAMED("Object")
 + (NSArray<NSString *> * _Nonnull)indexedProperties SWIFT_WARN_UNUSED_RESULT;
 - (id _Nullable)objectForKeyedSubscript:(NSString * _Nonnull)key SWIFT_WARN_UNUSED_RESULT;
 - (void)setObject:(id _Nullable)value forKeyedSubscript:(NSString * _Nonnull)key;
-/// Returns whether two Realm objects are equal.
-/// Objects are considered equal if and only if they are both managed by the same Realm and point to the same
-/// underlying object in the database.
-/// \param object The object to compare the receiver to.
-///
-- (BOOL)isEqual:(id _Nullable)object SWIFT_WARN_UNUSED_RESULT;
 /// WARNING: This is an internal initializer not intended for public use.
 /// :nodoc:
 - (nonnull instancetype)initWithRealm:(RLMRealm * _Nonnull)realm schema:(RLMObjectSchema * _Nonnull)schema OBJC_DESIGNATED_INITIALIZER;
@@ -337,7 +332,7 @@ SWIFT_CLASS("_TtC10RealmSwift8ListBase")
 @interface ListBase : RLMListBase
 /// Returns a human-readable description of the objects contained in the List.
 @property (nonatomic, readonly, copy) NSString * _Nonnull description;
-- (nonnull instancetype)initWithArray:(RLMArray<RLMObject *> * _Nonnull)array OBJC_DESIGNATED_INITIALIZER;
+- (nonnull instancetype)initWithArray:(RLMArray<id> * _Nonnull)array OBJC_DESIGNATED_INITIALIZER;
 - (nonnull instancetype)init OBJC_DESIGNATED_INITIALIZER;
 @end
 
@@ -353,6 +348,8 @@ SWIFT_CLASS("_TtC10RealmSwift8ListBase")
 
 
 
+
+
 /// :nodoc:
 /// Internal class. Do not use directly.
 SWIFT_CLASS_NAMED("ObjectUtil")
@@ -371,136 +368,6 @@ SWIFT_CLASS_NAMED("ObjectUtil")
 
 
 
-/// This model is used to reflect permissions.
-/// It should be used in conjunction with a <code>SyncUser</code>’s Permission Realm.
-/// You can only read this Realm. Use the objects in Management Realm to
-/// make request for modifications of permissions.
-/// See https://realm.io/docs/realm-object-server/#permissions for general
-/// documentation.
-SWIFT_CLASS("_TtC10RealmSwift14SyncPermission")
-@interface SyncPermission : RealmSwiftObject
-/// The date this object was last modified.
-@property (nonatomic, copy) NSDate * _Nonnull updatedAt;
-/// The ID of the affected user by the permission.
-@property (nonatomic, copy) NSString * _Nonnull userId;
-/// The path to the realm.
-@property (nonatomic, copy) NSString * _Nonnull path;
-/// Whether the affected user is allowed to read from the Realm.
-@property (nonatomic) BOOL mayRead;
-/// Whether the affected user is allowed to write to the Realm.
-@property (nonatomic) BOOL mayWrite;
-/// Whether the affected user is allowed to manage the access rights for others.
-@property (nonatomic) BOOL mayManage;
-/// :nodoc:
-+ (BOOL)shouldIncludeInDefaultSchema SWIFT_WARN_UNUSED_RESULT;
-/// :nodoc:
-+ (NSString * _Nullable)_realmObjectName SWIFT_WARN_UNUSED_RESULT;
-- (nonnull instancetype)init OBJC_DESIGNATED_INITIALIZER;
-- (nonnull instancetype)initWithRealm:(RLMRealm * _Nonnull)realm schema:(RLMObjectSchema * _Nonnull)schema OBJC_DESIGNATED_INITIALIZER;
-- (nonnull instancetype)initWithValue:(id _Nonnull)value schema:(RLMSchema * _Nonnull)schema OBJC_DESIGNATED_INITIALIZER;
-@end
-
-
-/// This model is used for requesting changes to a Realm’s permissions.
-/// It should be used in conjunction with a <code>SyncUser</code>’s Management Realm.
-/// See https://realm.io/docs/realm-object-server/#permissions for general
-/// documentation.
-SWIFT_CLASS("_TtC10RealmSwift20SyncPermissionChange")
-@interface SyncPermissionChange : RealmSwiftObject
-/// The globally unique ID string of this permission change object.
-@property (nonatomic, copy) NSString * _Nonnull id;
-/// The date this object was initially created.
-@property (nonatomic, copy) NSDate * _Nonnull createdAt;
-/// The date this object was last modified.
-@property (nonatomic, copy) NSDate * _Nonnull updatedAt;
-/// An error or informational message, typically written to by the Realm Object Server.
-@property (nonatomic, copy) NSString * _Nullable statusMessage;
-/// The remote URL to the realm.
-@property (nonatomic, copy) NSString * _Nonnull realmUrl;
-/// The identity of a user affected by this permission change.
-@property (nonatomic, copy) NSString * _Nonnull userId;
-/// :nodoc:
-+ (NSString * _Nullable)primaryKey SWIFT_WARN_UNUSED_RESULT;
-/// :nodoc:
-+ (BOOL)shouldIncludeInDefaultSchema SWIFT_WARN_UNUSED_RESULT;
-/// :nodoc:
-+ (NSString * _Nullable)_realmObjectName SWIFT_WARN_UNUSED_RESULT;
-- (nonnull instancetype)init OBJC_DESIGNATED_INITIALIZER;
-- (nonnull instancetype)initWithRealm:(RLMRealm * _Nonnull)realm schema:(RLMObjectSchema * _Nonnull)schema OBJC_DESIGNATED_INITIALIZER;
-- (nonnull instancetype)initWithValue:(id _Nonnull)value schema:(RLMSchema * _Nonnull)schema OBJC_DESIGNATED_INITIALIZER;
-@end
-
-
-/// This model is used for offering permission changes to other users.
-/// It should be used in conjunction with a <code>SyncUser</code>’s Management Realm.
-/// See https://realm.io/docs/realm-object-server/#permissions for general
-/// documentation.
-SWIFT_CLASS("_TtC10RealmSwift19SyncPermissionOffer")
-@interface SyncPermissionOffer : RealmSwiftObject
-/// The globally unique ID string of this permission offer object.
-@property (nonatomic, copy) NSString * _Nonnull id;
-/// The date this object was initially created.
-@property (nonatomic, copy) NSDate * _Nonnull createdAt;
-/// The date this object was last modified.
-@property (nonatomic, copy) NSDate * _Nonnull updatedAt;
-/// An error or informational message, typically written to by the Realm Object Server.
-@property (nonatomic, copy) NSString * _Nullable statusMessage;
-/// A token which uniquely identifies this offer. Generated by the server.
-@property (nonatomic, copy) NSString * _Nullable token;
-/// The remote URL to the realm.
-@property (nonatomic, copy) NSString * _Nonnull realmUrl;
-/// Whether this offer allows the receiver to read from the Realm.
-@property (nonatomic) BOOL mayRead;
-/// Whether this offer allows the receiver to write to the Realm.
-@property (nonatomic) BOOL mayWrite;
-/// Whether this offer allows the receiver to manage the access rights for others.
-@property (nonatomic) BOOL mayManage;
-/// When this token will expire and become invalid.
-@property (nonatomic, copy) NSDate * _Nullable expiresAt;
-/// :nodoc:
-+ (NSArray<NSString *> * _Nonnull)indexedProperties SWIFT_WARN_UNUSED_RESULT;
-/// :nodoc:
-+ (NSString * _Nullable)primaryKey SWIFT_WARN_UNUSED_RESULT;
-/// :nodoc:
-+ (BOOL)shouldIncludeInDefaultSchema SWIFT_WARN_UNUSED_RESULT;
-/// :nodoc:
-+ (NSString * _Nullable)_realmObjectName SWIFT_WARN_UNUSED_RESULT;
-- (nonnull instancetype)init OBJC_DESIGNATED_INITIALIZER;
-- (nonnull instancetype)initWithRealm:(RLMRealm * _Nonnull)realm schema:(RLMObjectSchema * _Nonnull)schema OBJC_DESIGNATED_INITIALIZER;
-- (nonnull instancetype)initWithValue:(id _Nonnull)value schema:(RLMSchema * _Nonnull)schema OBJC_DESIGNATED_INITIALIZER;
-@end
-
-
-/// This model is used to apply permission changes defined in the permission offer
-/// object represented by the specified token, which was created by another user’s
-/// <code>SyncPermissionOffer</code> object.
-/// It should be used in conjunction with a <code>SyncUser</code>’s Management Realm.
-/// See https://realm.io/docs/realm-object-server/#permissions for general
-/// documentation.
-SWIFT_CLASS("_TtC10RealmSwift27SyncPermissionOfferResponse")
-@interface SyncPermissionOfferResponse : RealmSwiftObject
-/// The globally unique ID string of this permission offer response object.
-@property (nonatomic, copy) NSString * _Nonnull id;
-/// The date this object was initially created.
-@property (nonatomic, copy) NSDate * _Nonnull createdAt;
-/// The date this object was last modified.
-@property (nonatomic, copy) NSDate * _Nonnull updatedAt;
-/// An error or informational message, typically written to by the Realm Object Server.
-@property (nonatomic, copy) NSString * _Nullable statusMessage;
-/// The received token which uniquely identifies another user’s <code>SyncPermissionOffer</code>.
-@property (nonatomic, copy) NSString * _Nonnull token;
-/// The remote URL to the realm on which these permission changes were applied.
-@property (nonatomic, copy) NSString * _Nullable realmUrl;
-/// :nodoc:
-+ (NSString * _Nullable)primaryKey SWIFT_WARN_UNUSED_RESULT;
-/// :nodoc:
-+ (BOOL)shouldIncludeInDefaultSchema SWIFT_WARN_UNUSED_RESULT;
-/// :nodoc:
-+ (NSString * _Nullable)_realmObjectName SWIFT_WARN_UNUSED_RESULT;
-- (nonnull instancetype)init OBJC_DESIGNATED_INITIALIZER;
-- (nonnull instancetype)initWithRealm:(RLMRealm * _Nonnull)realm schema:(RLMObjectSchema * _Nonnull)schema OBJC_DESIGNATED_INITIALIZER;
-- (nonnull instancetype)initWithValue:(id _Nonnull)value schema:(RLMSchema * _Nonnull)schema OBJC_DESIGNATED_INITIALIZER;
-@end
 
 SWIFT_MODULE_NAMESPACE_POP
 #pragma clang diagnostic pop

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


BIN
Libraries external/Realm/RealmSwift.framework/RealmSwift


+ 18 - 6
Nextcloud.xcodeproj/project.pbxproj

@@ -229,6 +229,10 @@
 		F750374D1DBFA91A008FB480 /* ALView+PureLayout.m in Sources */ = {isa = PBXBuildFile; fileRef = F75037441DBFA91A008FB480 /* ALView+PureLayout.m */; };
 		F750374F1DBFA91A008FB480 /* NSArray+PureLayout.m in Sources */ = {isa = PBXBuildFile; fileRef = F75037461DBFA91A008FB480 /* NSArray+PureLayout.m */; };
 		F75037511DBFA91A008FB480 /* NSLayoutConstraint+PureLayout.m in Sources */ = {isa = PBXBuildFile; fileRef = F75037481DBFA91A008FB480 /* NSLayoutConstraint+PureLayout.m */; };
+		F75131631FA5EFF4002BB4D1 /* NCNetworkingSync.m in Sources */ = {isa = PBXBuildFile; fileRef = F75131621FA5EFF4002BB4D1 /* NCNetworkingSync.m */; };
+		F75131641FA5EFF4002BB4D1 /* NCNetworkingSync.m in Sources */ = {isa = PBXBuildFile; fileRef = F75131621FA5EFF4002BB4D1 /* NCNetworkingSync.m */; };
+		F75131651FA5EFF4002BB4D1 /* NCNetworkingSync.m in Sources */ = {isa = PBXBuildFile; fileRef = F75131621FA5EFF4002BB4D1 /* NCNetworkingSync.m */; };
+		F75131661FA5EFF4002BB4D1 /* NCNetworkingSync.m in Sources */ = {isa = PBXBuildFile; fileRef = F75131621FA5EFF4002BB4D1 /* NCNetworkingSync.m */; };
 		F75797AE1E81356C00187A1B /* CTAssetsPicker.strings in Resources */ = {isa = PBXBuildFile; fileRef = F75797AC1E81356C00187A1B /* CTAssetsPicker.strings */; };
 		F75AC2431F1F62450073EC19 /* NCManageAutoUploadFileName.swift in Sources */ = {isa = PBXBuildFile; fileRef = F75AC2421F1F62450073EC19 /* NCManageAutoUploadFileName.swift */; };
 		F75ADF451DC75FFE008A7347 /* CCLogin.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = F75ADF441DC75FFE008A7347 /* CCLogin.storyboard */; };
@@ -901,6 +905,8 @@
 		F75037491DBFA91A008FB480 /* PureLayout+Internal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "PureLayout+Internal.h"; sourceTree = "<group>"; };
 		F750374A1DBFA91A008FB480 /* PureLayout.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PureLayout.h; sourceTree = "<group>"; };
 		F750374B1DBFA91A008FB480 /* PureLayoutDefines.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PureLayoutDefines.h; sourceTree = "<group>"; };
+		F75131611FA5EFF4002BB4D1 /* NCNetworkingSync.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = NCNetworkingSync.h; sourceTree = "<group>"; };
+		F75131621FA5EFF4002BB4D1 /* NCNetworkingSync.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = NCNetworkingSync.m; sourceTree = "<group>"; };
 		F7514EDA1C7B1336008F3338 /* CCHud.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCHud.h; sourceTree = "<group>"; };
 		F7514EDB1C7B1336008F3338 /* CCHud.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CCHud.m; sourceTree = "<group>"; };
 		F7540EE21D5B238600C3FFA8 /* aes.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = aes.h; sourceTree = "<group>"; };
@@ -1988,6 +1994,8 @@
 				F732BA041D76CE1500E9878B /* CCNetworking.m */,
 				F74D3DBD1BAC1941000BAE4B /* OCNetworking.h */,
 				F74D3DBE1BAC1941000BAE4B /* OCNetworking.m */,
+				F75131611FA5EFF4002BB4D1 /* NCNetworkingSync.h */,
+				F75131621FA5EFF4002BB4D1 /* NCNetworkingSync.m */,
 			);
 			path = Networking;
 			sourceTree = "<group>";
@@ -2518,20 +2526,20 @@
 		F7BFFA991A24D7BB0044ED85 /* Utility */ = {
 			isa = PBXGroup;
 			children = (
-				F7A54C341C6267B500E2C8BF /* CCExifGeo.h */,
-				F7A54C351C6267B500E2C8BF /* CCExifGeo.m */,
 				F76C3B871C638A4C00DC4301 /* CCError.h */,
 				F76C3B881C638A4C00DC4301 /* CCError.m */,
-				F7514EDA1C7B1336008F3338 /* CCHud.h */,
-				F7514EDB1C7B1336008F3338 /* CCHud.m */,
+				F7A54C341C6267B500E2C8BF /* CCExifGeo.h */,
+				F7A54C351C6267B500E2C8BF /* CCExifGeo.m */,
 				F76C3B831C6388BC00DC4301 /* CCGraphics.h */,
 				F76C3B841C6388BC00DC4301 /* CCGraphics.m */,
+				F7514EDA1C7B1336008F3338 /* CCHud.h */,
+				F7514EDB1C7B1336008F3338 /* CCHud.m */,
 				F7053E3C1C639DF500741EA5 /* CCUtility.h */,
 				F7053E3D1C639DF500741EA5 /* CCUtility.m */,
-				F73049B81CB567F000C7C320 /* NSString+TruncateToWidth.h */,
-				F73049B91CB567F000C7C320 /* NSString+TruncateToWidth.m */,
 				F78071071EDAB65800EAFFF6 /* NSNotificationCenter+MainThread.h */,
 				F78071081EDAB65800EAFFF6 /* NSNotificationCenter+MainThread.m */,
+				F73049B81CB567F000C7C320 /* NSString+TruncateToWidth.h */,
+				F73049B91CB567F000C7C320 /* NSString+TruncateToWidth.m */,
 			);
 			path = Utility;
 			sourceTree = "<group>";
@@ -3423,6 +3431,7 @@
 				F70022C91EC4C9100080073F /* OCRichObjectStrings.m in Sources */,
 				F71459F11D12E3B700CAFEEC /* CCMove.m in Sources */,
 				F70022C31EC4C9100080073F /* OCNotifications.m in Sources */,
+				F75131641FA5EFF4002BB4D1 /* NCNetworkingSync.m in Sources */,
 				F71459F71D12E3B700CAFEEC /* CCGraphics.m in Sources */,
 				F7BAADC91ED5A87C00B7EAD4 /* NCDatabase.swift in Sources */,
 				F70022BD1EC4C9100080073F /* OCExternalSites.m in Sources */,
@@ -3471,6 +3480,7 @@
 				F73CC0741E813DFF006E3047 /* BKPasscodeLockScreenManager.m in Sources */,
 				F77EB62B1EC0B50B003F814F /* CCCertificate.m in Sources */,
 				F7E718B01EB0FBE700FA58C9 /* CCGraphics.m in Sources */,
+				F75131651FA5EFF4002BB4D1 /* NCNetworkingSync.m in Sources */,
 				F74344171E1264EE001CC831 /* DocumentPickerViewController.swift in Sources */,
 				F70022D61EC4C9100080073F /* NSDate+ISO8601.m in Sources */,
 				F74344811E127F49001CC831 /* AFViewShaker.m in Sources */,
@@ -3540,6 +3550,7 @@
 				F7BB50C11F22378E00C47094 /* CCHud.m in Sources */,
 				F7BB50DE1F2238B700C47094 /* UtilsFramework.m in Sources */,
 				F7BB50D61F22389900C47094 /* OCHTTPRequestOperation.m in Sources */,
+				F75131661FA5EFF4002BB4D1 /* NCNetworkingSync.m in Sources */,
 				F7BB50BD1F22376000C47094 /* CCCertificate.m in Sources */,
 				F7BB50DA1F2238A600C47094 /* OCXMLServerErrorsParser.m in Sources */,
 				F7BB50C51F22379B00C47094 /* NSNotificationCenter+MainThread.m in Sources */,
@@ -3758,6 +3769,7 @@
 				F7B1FBC81E72E3D1001781FE /* SwiftWebVCActivity.swift in Sources */,
 				F7D424741F063B82009C9782 /* CTAssetThumbnailView.m in Sources */,
 				F77B0E981D118A16002130FE /* CCManageAccount.m in Sources */,
+				F75131631FA5EFF4002BB4D1 /* NCNetworkingSync.m in Sources */,
 				F762CB011EACB66200B38484 /* XLFormSelectorCell.m in Sources */,
 				F70022AD1EC4C9100080073F /* AFURLResponseSerialization.m in Sources */,
 				F7D424531F063B82009C9782 /* NSBundle+CTAssetsPickerController.m in Sources */,

+ 4 - 0
README.md

@@ -1,4 +1,8 @@
+<<<<<<< HEAD
 # [Nextcloud](https://nextcloud.com)  iOS app V 2.18.0
+=======
+# [Nextcloud](https://nextcloud.com)  iOS app V 2.18.1
+>>>>>>> develop
 
 [<img src="Animation.gif"
 alt="Download from App Storey"

+ 1 - 1
iOSClient/Actions/CCActions.swift

@@ -205,7 +205,7 @@ class CCActions: NSObject {
             let directory = CCUtility.stringAppendServerUrl(metadataNet.serverUrl, addFileName: metadataNet.fileName)
             let directoryTo = CCUtility.stringAppendServerUrl(metadataNet.serverUrl, addFileName: metadataNet.fileNameTo)
 
-            NCManageDatabase.sharedInstance.setDirectory(serverUrl: directory!, serverUrlTo: directoryTo!, etag: nil)
+            NCManageDatabase.sharedInstance.setDirectory(serverUrl: directory!, serverUrlTo: directoryTo!, etag: nil, fileID: nil)
             
         } else {
             

+ 2 - 2
iOSClient/Brand/Picker.plist

@@ -17,9 +17,9 @@
 	<key>CFBundlePackageType</key>
 	<string>XPC!</string>
 	<key>CFBundleShortVersionString</key>
-	<string>2.18.0</string>
+	<string>2.18.1</string>
 	<key>CFBundleVersion</key>
-	<string>00017</string>
+	<string>00001</string>
 	<key>NSAppTransportSecurity</key>
 	<dict>
 		<key>NSAllowsArbitraryLoads</key>

+ 2 - 2
iOSClient/Brand/PickerFileProvider.plist

@@ -17,9 +17,9 @@
 	<key>CFBundlePackageType</key>
 	<string>XPC!</string>
 	<key>CFBundleShortVersionString</key>
-	<string>2.18.0</string>
+	<string>2.18.1</string>
 	<key>CFBundleVersion</key>
-	<string>00017</string>
+	<string>00001</string>
 	<key>NSExtension</key>
 	<dict>
 		<key>NSExtensionFileProviderDocumentGroup</key>

+ 2 - 2
iOSClient/Brand/Share.plist

@@ -17,9 +17,9 @@
 	<key>CFBundlePackageType</key>
 	<string>XPC!</string>
 	<key>CFBundleShortVersionString</key>
-	<string>2.18.0</string>
+	<string>2.18.1</string>
 	<key>CFBundleVersion</key>
-	<string>00017</string>
+	<string>00001</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.18.0</string>
+	<string>2.18.1</string>
 	<key>CFBundleSignature</key>
 	<string>????</string>
 	<key>CFBundleURLTypes</key>
@@ -69,7 +69,7 @@
 		</dict>
 	</array>
 	<key>CFBundleVersion</key>
-	<string>00017</string>
+	<string>00001</string>
 	<key>Fabric</key>
 	<dict>
 		<key>APIKey</key>

+ 0 - 4
iOSClient/CCGlobal.h

@@ -209,10 +209,6 @@ extern NSString *const dav;
 #define actionDeleteEndToEndPublicKey                   @"deleteEndToEndPublicKey"
 #define actionDeleteEndToEndPrivateKey                  @"deleteEndToEndPrivateKey"
 #define actionGetEndToEndServerPublicKey                @"getEndToEndServerPublicKey"
-#define actionMarkEndToEndFolderEncrypted               @"markEndToEndFolderEncrypted"
-#define actionDeletemarkEndToEndFolderEncrypted         @"deletemarkEndToEndFolderEncrypted"
-#define actionLockEndToEndFolderEncrypted               @"lockEndToEndFolderEncrypted"
-#define actionUnlockEndToEndFolderEncrypted             @"unlockEndToEndFolderEncrypted"
 #define actionStoreEndToEndMetadata                     @"storeEndToEndMetadata"
 #define actionGetEndToEndMetadata                       @"getEndToEndMetadata"
 #define actionUpdateEndToEndMetadata                    @"updateEndToEndMetadata"

+ 2 - 2
iOSClient/Create/CCCreateCloud.swift

@@ -380,7 +380,7 @@ class CreateFormUploadAssets: XLFormViewController, CCMoveDelegate {
         case 3:
             return "    " + NSLocalizedString("_rename_filename_", comment: "")
         case 4:
-            return NSLocalizedString("_preview_filename_", comment: "")
+            return String(format: NSLocalizedString("_preview_filename_", comment: ""), "MM,MMM,DD,YY,YYYY and HH,hh,mm,ss,ampm")
         default:
             return ""
         }
@@ -473,7 +473,7 @@ class CreateFormUploadAssets: XLFormViewController, CCMoveDelegate {
             returnString = CCUtility.createFileName(asset.value(forKey: "filename"), fileDate: asset.creationDate, fileType: asset.mediaType, keyFileName: nil, keyFileNameType: k_keyFileNameType)
         }
         
-        return NSLocalizedString("_preview_filename_", comment: "") + ":" + "\n\n" + returnString
+        return String(format: NSLocalizedString("_preview_filename_", comment: ""), "MM,MMM,DD,YY,YYYY and HH,hh,mm,ss,ampm") + ":" + "\n\n" + returnString
     }
     
     @objc func changeDestinationFolder(_ sender: XLFormRowDescriptor) {

+ 19 - 0
iOSClient/Database/NCDatabase.swift

@@ -111,6 +111,25 @@ class tableDirectory: Object {
     }
 }
 
+class tableE2eEncryption: Object {
+    
+    @objc dynamic var account = ""
+    @objc dynamic var authenticationTag = ""
+    @objc dynamic var fileName = ""
+    @objc dynamic var fileNameIdentifier = ""
+    @objc dynamic var key = ""
+    @objc dynamic var initializationVector = ""
+    @objc dynamic var metadataKey: Int = 0
+    @objc dynamic var mimeType = ""
+    @objc dynamic var serverUrl = ""
+    @objc dynamic var tokenLock = ""
+    @objc dynamic var version: Int = 0
+    
+    override static func primaryKey() -> String {
+        return "fileName"
+    }
+}
+
 class tableExternalSites: Object {
     
     @objc dynamic var account = ""

+ 166 - 31
iOSClient/Database/NCManageDatabase.swift

@@ -57,7 +57,10 @@ class NCManageDatabase: NSObject {
         let config = Realm.Configuration(
         
             fileURL: dirGroup?.appendingPathComponent("\(appDatabaseNextcloud)/\(k_databaseDefault)"),
-            schemaVersion: 10,
+            schemaVersion: 11,
+            
+            // 10 : Version 2.18.0
+            // 11 : Add object tableE2eEncryption
             
             migrationBlock: { migration, oldSchemaVersion in
                 // We haven’t migrated anything yet, so oldSchemaVersion == 0
@@ -289,7 +292,7 @@ class NCManageDatabase: NSObject {
         return folderPhotos
     }
     
-    @objc func setAccountActive(_ account: String) -> tableAccount {
+    @objc func setAccountActive(_ account: String) -> tableAccount? {
         
         let realm = try! Realm()
         
@@ -314,7 +317,8 @@ class NCManageDatabase: NSObject {
                 }
             }
         } catch let error {
-            print("Could not write to database: ", error)
+            print("[LOG] Could not write to database: ", error)
+            return nil
         }
         
         return activeAccount
@@ -341,7 +345,7 @@ class NCManageDatabase: NSObject {
                 print("[LOG] Could not write to database: ", error)
             }
         } else {
-            print("property not found")
+            print("[LOG] property not found")
         }
     }
     
@@ -365,7 +369,7 @@ class NCManageDatabase: NSObject {
                 }
             }
         } catch let error {
-            print("Could not write to database: ", error)
+            print("[LOG] Could not write to database: ", error)
         }
     }
 
@@ -389,7 +393,7 @@ class NCManageDatabase: NSObject {
                 }
             }
         } catch let error {
-            print("Could not write to database: ", error)
+            print("[LOG] Could not write to database: ", error)
         }
     }
     
@@ -430,7 +434,7 @@ class NCManageDatabase: NSObject {
                 result.quotaUsed = userProfile.quotaUsed
             }
         } catch let error {
-            print("Could not write to database: ", error)
+            print("[LOG] Could not write to database: ", error)
         }
     }
     
@@ -572,7 +576,7 @@ class NCManageDatabase: NSObject {
                 }
             }
         } catch let error {
-            print("Could not write to database: ", error)
+            print("[LOG] Could not write to database: ", error)
         }
     }
     
@@ -602,6 +606,21 @@ class NCManageDatabase: NSObject {
         return result.versionMajor
     }
 
+    @objc func getEndToEndEncryptionVersion() -> Float {
+        
+        guard let tableAccount = self.getAccountActive() else {
+            return 0
+        }
+        
+        let realm = try! Realm()
+        
+        guard let result = realm.objects(tableCapabilities.self).filter("account = %@", tableAccount.account).first else {
+            return 0
+        }
+        
+        return Float(result.endToEndEncryptionVersion)!
+    }
+    
     @objc func compareServerVersion(_ versionCompare: String) -> Int {
         
         guard let tableAccount = self.getAccountActive() else {
@@ -652,7 +671,7 @@ class NCManageDatabase: NSObject {
                 realm.add(addObject)
             }
         } catch let error {
-            print("Could not write to database: ", error)
+            print("[LOG] Could not write to database: ", error)
         }
     }
     
@@ -662,7 +681,7 @@ class NCManageDatabase: NSObject {
         
         let results = realm.objects(tableCertificates.self)
     
-        return Array(results.map { "\(localCertificatesFolder)\($0.certificateLocation)" })
+        return Array(results.map { "\(localCertificatesFolder)/\($0.certificateLocation)" })
     }
     
     //MARK: -
@@ -707,7 +726,8 @@ class NCManageDatabase: NSObject {
                 }
             }
         } catch let error {
-            print("Could not write to database: ", error)
+            print("[LOG] Could not write to database: ", error)
+            return ""
         }
         
         return directoryID
@@ -737,11 +757,11 @@ class NCManageDatabase: NSObject {
                 realm.delete(results)
             }
         } catch let error {
-            print("Could not write to database: ", error)
+            print("[LOG] Could not write to database: ", error)
         }
     }
     
-    @objc func setDirectory(serverUrl: String, serverUrlTo: String?, etag: String?) {
+    @objc func setDirectory(serverUrl: String, serverUrlTo: String?, etag: String?, fileID: String?) {
         
         guard let tableAccount = self.getAccountActive() else {
             return
@@ -763,9 +783,12 @@ class NCManageDatabase: NSObject {
                 if let etag = etag {
                     result.etag = etag
                 }
+                if let fileID = fileID {
+                    result.fileID = fileID
+                }
             }
         } catch let error {
-            print("Could not write to database: ", error)
+            print("[LOG] Could not write to database: ", error)
         }
     }
     
@@ -799,7 +822,7 @@ class NCManageDatabase: NSObject {
                 realm.add(result, update: true)
             }
         } catch let error {
-            print("Could not write to database: ", error)
+            print("[LOG] Could not write to database: ", error)
         }
     }
     
@@ -915,7 +938,7 @@ class NCManageDatabase: NSObject {
                 }
             }
         } catch let error {
-            print("Could not write to database: ", error)
+            print("[LOG] Could not write to database: ", error)
         }
     }
     
@@ -941,7 +964,7 @@ class NCManageDatabase: NSObject {
                 update = true
             }
         } catch let error {
-            print("Could not write to database: ", error)
+            print("[LOG] Could not write to database: ", error)
             return false
         }
         
@@ -966,10 +989,108 @@ class NCManageDatabase: NSObject {
                 }
             }
         } catch let error {
-            print("Could not write to database: ", error)
+            print("[LOG] Could not write to database: ", error)
         }
     }
 
+    //MARK: -
+    //MARK: Table e2e Encryption
+    
+    @objc func addE2eEncryption(_ e2e: tableE2eEncryption) -> Bool {
+
+        guard self.getAccountActive() != nil else {
+            return false
+        }
+        
+        let realm = try! Realm()
+        
+        do {
+            try realm.write {
+                realm.add(e2e, update: true)
+            }
+        } catch let error {
+            print("[LOG] Could not write to database: ", error)
+            return false
+        }
+        
+        return true
+    }
+    
+    @objc func deleteE2eEncryption(predicate: NSPredicate) {
+        
+        let realm = try! Realm()
+        
+        realm.beginWrite()
+        
+        guard let result = realm.objects(tableE2eEncryption.self).filter(predicate).first else {
+            realm.cancelWrite()
+            return
+        }
+        
+        realm.delete(result)
+        
+        do {
+            try realm.commitWrite()
+        } catch let error {
+            print("[LOG] Could not write to database: ", error)
+        }
+    }
+    
+    @objc func getE2eEncryption(predicate: NSPredicate) -> tableE2eEncryption? {
+        
+        guard self.getAccountActive() != nil else {
+            return nil
+        }
+        
+        let realm = try! Realm()
+        
+        guard let result = realm.objects(tableE2eEncryption.self).filter(predicate).first else {
+            return nil
+        }
+        
+        return tableE2eEncryption.init(value: result)
+    }
+    
+    @objc func getE2eEncryptionTokenLock(serverUrl: String) -> String? {
+        
+        guard let tableAccount = self.getAccountActive() else {
+            return nil
+        }
+        
+        let realm = try! Realm()
+        
+        guard let result = realm.objects(tableE2eEncryption.self).filter("account = %@ AND serverUrl = %@ AND tokenLock != ''", tableAccount.account, serverUrl).first else {
+            return nil
+        }
+        
+        return result.tokenLock
+    }
+    
+    @objc func setE2eEncryptionTokenLock(fileName: String, token: String) {
+        
+        guard let tableAccount = self.getAccountActive() else {
+            return
+        }
+        
+        let realm = try! Realm()
+        
+        realm.beginWrite()
+        
+        guard let result = realm.objects(tableE2eEncryption.self).filter("account = %@ AND fileName = %@", tableAccount.account, fileName).first else {
+            realm.cancelWrite()
+            return
+        }
+        
+        result.tokenLock = token
+        
+        do {
+            try realm.commitWrite()
+        } catch let error {
+            print("[LOG] Could not write to database: ", error)
+            return
+        }
+    }
+    
     //MARK: -
     //MARK: Table External Sites
     
@@ -997,7 +1118,7 @@ class NCManageDatabase: NSObject {
                 realm.add(addObject)
             }
         } catch let error {
-            print("Could not write to database: ", error)
+            print("[LOG] Could not write to database: ", error)
         }
     }
 
@@ -1017,7 +1138,7 @@ class NCManageDatabase: NSObject {
                 realm.delete(results)
             }
         } catch let error {
-            print("Could not write to database: ", error)
+            print("[LOG] Could not write to database: ", error)
         }
     }
     
@@ -1106,7 +1227,7 @@ class NCManageDatabase: NSObject {
                 realm.add(addObject, update: true)
             }
         } catch let error {
-            print("Could not write to database: ", error)
+            print("[LOG] Could not write to database: ", error)
         }
     }
     
@@ -1126,7 +1247,7 @@ class NCManageDatabase: NSObject {
                 realm.delete(results)
             }
         } catch let error {
-            print("Could not write to database: ", error)
+            print("[LOG] Could not write to database: ", error)
         }
     }
     
@@ -1163,7 +1284,7 @@ class NCManageDatabase: NSObject {
                 }
             }
         } catch let error {
-            print("Could not write to database: ", error)
+            print("[LOG] Could not write to database: ", error)
         }
     }
     
@@ -1203,7 +1324,8 @@ class NCManageDatabase: NSObject {
                 realm.add(metadata, update: true)
             }
         } catch let error {
-            print("Could not write to database: ", error)
+            print("[LOG] Could not write to database: ", error)
+            return nil
         }
         
         self.setDateReadDirectory(directoryID: directoryID)
@@ -1226,7 +1348,8 @@ class NCManageDatabase: NSObject {
                 }
             }
         } catch let error {
-            print("Could not write to database: ", error)
+            print("[LOG] Could not write to database: ", error)
+            return nil
         }
         
         if let serverUrl = serverUrl {
@@ -1266,6 +1389,7 @@ class NCManageDatabase: NSObject {
             try realm.commitWrite()
         } catch let error {
             print("[LOG] Could not write to database: ", error)
+            return
         }
         
         for directoryID in directoriesID {
@@ -1291,7 +1415,8 @@ class NCManageDatabase: NSObject {
                 }
             }
         } catch let error {
-            print("Could not write to database: ", error)
+            print("[LOG] Could not write to database: ", error)
+            return
         }
         
         self.setDateReadDirectory(directoryID: directoryID)
@@ -1309,7 +1434,7 @@ class NCManageDatabase: NSObject {
                 realm.add(metadata, update: true)
             }
         } catch let error {
-            print("Could not write to database: ", error)
+            print("[LOG] Could not write to database: ", error)
             return nil
         }
         
@@ -1355,6 +1480,7 @@ class NCManageDatabase: NSObject {
             try realm.commitWrite()
         } catch let error {
             print("[LOG] Could not write to database: ", error)
+            return
         }
         
         if let directoryID = directoryID {
@@ -1386,6 +1512,7 @@ class NCManageDatabase: NSObject {
             try realm.commitWrite()
         } catch let error {
             print("[LOG] Could not write to database: ", error)
+            return
         }
         
         if let directoryID = directoryID {
@@ -1417,6 +1544,7 @@ class NCManageDatabase: NSObject {
             try realm.commitWrite()
         } catch let error {
             print("[LOG] Could not write to database: ", error)
+            return
         }
         
         if let directoryID = directoryID {
@@ -1609,7 +1737,7 @@ class NCManageDatabase: NSObject {
                     }
                 }
             } catch let error {
-                print("Could not write to database: ", error)
+                print("[LOG] Could not write to database: ", error)
                 return false
             }
         }
@@ -1659,7 +1787,8 @@ class NCManageDatabase: NSObject {
     //MARK: -
     //MARK: Table Queue Download
     
-    @objc func addQueueDownload(fileID: String, selector: String, selectorPost: String?, serverUrl: String, session: String) -> Bool {
+    /*
+    @objc func addQueueDownload(fileID: String, encrypted: Bool, selector: String, selectorPost: String?, serverUrl: String, session: String) -> Bool {
         
         guard let tableAccount = self.getAccountActive() else {
             return false
@@ -1681,6 +1810,7 @@ class NCManageDatabase: NSObject {
                     let addObject = tableQueueDownload()
                         
                     addObject.account = tableAccount.account
+                    addObject.encrypted = encrypted
                     addObject.fileID = fileID
                     addObject.selector = selector
                         
@@ -1701,6 +1831,7 @@ class NCManageDatabase: NSObject {
         
         return true
     }
+    */
     
     @objc func addQueueDownload(metadatasNet: [CCMetadataNet]) {
         
@@ -1754,6 +1885,7 @@ class NCManageDatabase: NSObject {
         
         let metadataNet = CCMetadataNet()
         
+        metadataNet.account = result.account
         metadataNet.fileID = result.fileID
         metadataNet.selector = result.selector
         metadataNet.selectorPost = result.selectorPost
@@ -1901,6 +2033,7 @@ class NCManageDatabase: NSObject {
         
         let metadataNet = CCMetadataNet()
         
+        metadataNet.account = result.account
         metadataNet.assetLocalIdentifier = result.assetLocalIdentifier
         metadataNet.fileName = result.fileName
         metadataNet.priority = result.priority
@@ -2024,7 +2157,7 @@ class NCManageDatabase: NSObject {
                 }
             }
         } catch let error {
-            print("Could not write to database: ", error)
+            print("[LOG] Could not write to database: ", error)
         }
     }
     
@@ -2123,6 +2256,7 @@ class NCManageDatabase: NSObject {
             try realm.commitWrite()
         } catch let error {
             print("[LOG] Could not write to database: ", error)
+            return nil
         }
         
         return ["\(serverUrl)\(fileName)" : share]
@@ -2181,6 +2315,7 @@ class NCManageDatabase: NSObject {
             try realm.commitWrite()
         } catch let error {
             print("[LOG] Could not write to database: ", error)
+            return nil
         }
 
         return [sharesLink, sharesUserAndGroup]
@@ -2202,7 +2337,7 @@ class NCManageDatabase: NSObject {
                 realm.delete(results)
             }
         } catch let error {
-            print("Could not write to database: ", error)
+            print("[LOG] Could not write to database: ", error)
         }
     }
     

+ 1 - 1
iOSClient/Favorites/CCFavorites.m

@@ -388,7 +388,7 @@
     } else {
         
         if (metadata.directory)
-            iconHeader = [CCGraphics changeThemingColorImage:[UIImage imageNamed:metadata.iconName] color:[NCBrandColor sharedInstance].brand];
+            iconHeader = [CCGraphics changeThemingColorImage:[UIImage imageNamed:@"folder"] color:[NCBrandColor sharedInstance].brand];
         else
             iconHeader = [UIImage imageNamed:metadata.iconName];
     }

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

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

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


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


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


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

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

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


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


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


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

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

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


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


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


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

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

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


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


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


+ 2 - 3
iOSClient/Library/AHKActionSheet/AHKActionSheet.m

@@ -93,7 +93,6 @@ static const CGFloat maxWidth = 414.0f;
         if (@available(iOS 11, *)) {
             _bottomPadding = view.safeAreaInsets.bottom;
         }
-        [_view setFrame:CGRectMake(_view.frame.origin.x, _view.frame.origin.y+_bottomPadding, _view.frame.size.width, _view.frame.size.height-_bottomPadding)];
     }
     
     return self;
@@ -349,7 +348,7 @@ static const CGFloat maxWidth = 414.0f;
         CGFloat width = CGRectGetWidth(self.view.bounds);
         if (width > maxWidth) width = maxWidth;
         
-        self.cancelButton.frame = CGRectMake(10 + (CGRectGetWidth(self.view.bounds)/2 - width/2), CGRectGetMaxY(self.view.bounds) - self.cancelButtonHeight, width - 20, self.cancelButtonHeight - kSpaceDivide);
+        self.cancelButton.frame = CGRectMake(10 + (CGRectGetWidth(self.view.bounds)/2 - width/2), CGRectGetMaxY(self.view.bounds) - self.cancelButtonHeight - _bottomPadding, width - 20, self.cancelButtonHeight - kSpaceDivide);
     
         // Corner Radius
         self.cancelButton.layer.cornerRadius = 10;
@@ -523,7 +522,7 @@ static const CGFloat maxWidth = 414.0f;
     CGRect statusBarViewRect = [self convertRect:[UIApplication sharedApplication].statusBarFrame fromView:nil];
     CGFloat statusBarHeight = CGRectGetHeight(statusBarViewRect);
     
-    CGRect frame = CGRectMake((CGRectGetWidth(self.view.bounds)/2 - width/2), statusBarHeight, width, CGRectGetHeight(self.view.bounds) - statusBarHeight - self.cancelButtonHeight - self.separatorHeight);
+    CGRect frame = CGRectMake((CGRectGetWidth(self.view.bounds)/2 - width/2), statusBarHeight, width, CGRectGetHeight(self.view.bounds) - statusBarHeight - self.cancelButtonHeight - self.separatorHeight - _bottomPadding);
 
     UITableView *tableView = [[UITableView alloc] initWithFrame:frame];
     

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

@@ -926,7 +926,7 @@ typedef enum {
 
 - (void)lockEndToEndFolderEncrypted:(NSString*)serverPath fileID:(NSString *)fileID token:(NSString *)token onCommunication:(OCCommunication *)sharedOCComunication successRequest:(void(^)(NSHTTPURLResponse *response, NSString *token, NSString *redirectedServer)) successRequest failureRequest:(void(^)(NSHTTPURLResponse *response, NSError *error, NSString *redirectedServer)) failureRequest;
 
-- (void)unlockEndToEndFolderEncrypted:(NSString*)serverPath fileID:(NSString *)fileID onCommunication:(OCCommunication *)sharedOCComunication successRequest:(void(^)(NSHTTPURLResponse *response, NSString *redirectedServer)) successRequest failureRequest:(void(^)(NSHTTPURLResponse *response, NSError *error, NSString *redirectedServer)) failureRequest;
+- (void)unlockEndToEndFolderEncrypted:(NSString*)serverPath fileID:(NSString *)fileID token:(NSString *)token onCommunication:(OCCommunication *)sharedOCComunication successRequest:(void(^)(NSHTTPURLResponse *response, NSString *redirectedServer)) successRequest failureRequest:(void(^)(NSHTTPURLResponse *response, NSError *error, NSString *redirectedServer)) failureRequest;
 
 
 - (void)storeEndToEndMetadata:(NSString*)serverPath fileID:(NSString *)fileID encryptedMetadata:(NSString *)encryptedMetadata onCommunication:(OCCommunication *)sharedOCComunication successRequest:(void(^)(NSHTTPURLResponse *response, NSString *encryptedMetadata, NSString *redirectedServer)) successRequest failureRequest:(void(^)(NSHTTPURLResponse *response, NSError *error, NSString *redirectedServer)) failureRequest;

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

@@ -2382,16 +2382,16 @@
     }];
 }
 
-- (void)unlockEndToEndFolderEncrypted:(NSString*)serverPath fileID:(NSString *)fileID onCommunication:(OCCommunication *)sharedOCComunication successRequest:(void(^)(NSHTTPURLResponse *response, NSString *redirectedServer)) successRequest failureRequest:(void(^)(NSHTTPURLResponse *response, NSError *error, NSString *redirectedServer)) failureRequest {
+- (void)unlockEndToEndFolderEncrypted:(NSString*)serverPath fileID:(NSString *)fileID token:(NSString *)token onCommunication:(OCCommunication *)sharedOCComunication successRequest:(void(^)(NSHTTPURLResponse *response, NSString *redirectedServer)) successRequest failureRequest:(void(^)(NSHTTPURLResponse *response, NSError *error, NSString *redirectedServer)) failureRequest {
     
     serverPath = [serverPath stringByAppendingString:k_url_client_side_encryption];
-    serverPath = [NSString stringWithFormat:@"%@/encrypted/%@", serverPath, fileID];
+    serverPath = [NSString stringWithFormat:@"%@/lock/%@", serverPath, fileID];
     serverPath = [serverPath encodeString:NSUTF8StringEncoding];
     
     OCWebDAVClient *request = [OCWebDAVClient new];
     request = [self getRequestWithCredentials:request];
     
-    [request unlockEndToEndFolderEncrypted:serverPath onCommunication:sharedOCComunication success:^(NSHTTPURLResponse *response, id responseObject) {
+    [request unlockEndToEndFolderEncrypted:serverPath token:token onCommunication:sharedOCComunication success:^(NSHTTPURLResponse *response, id responseObject) {
         
         //Return success
         successRequest(response, request.redirectedServer);
@@ -2489,9 +2489,9 @@
             
             if (statusCode == kOCUserProfileAPISuccessful) {
                 
-                if ([data valueForKey:@"encrypted-meta-data"] && ![[data valueForKey:@"encrypted-meta-data"] isKindOfClass:[NSNull class]]) {
+                if ([data valueForKey:@"meta-data"] && ![[data valueForKey:@"meta-data"] isKindOfClass:[NSNull class]]) {
                     
-                    encryptedMetadata = [data valueForKey:@"encrypted-meta-data"];
+                    encryptedMetadata = [data valueForKey:@"meta-data"];
                 }
                 
             } else {
@@ -2546,9 +2546,9 @@
             
             if (statusCode == kOCUserProfileAPISuccessful) {
                 
-                if ([data valueForKey:@"encrypted-meta-data"] && ![[data valueForKey:@"encrypted-meta-data"] isKindOfClass:[NSNull class]]) {
+                if ([data valueForKey:@"meta-data"] && ![[data valueForKey:@"meta-data"] isKindOfClass:[NSNull class]]) {
                     
-                    encryptedMetadata = [data valueForKey:@"encrypted-meta-data"];
+                    encryptedMetadata = [data valueForKey:@"meta-data"];
                 }
                 
             } else {

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

@@ -624,7 +624,7 @@ extern NSString * _Nullable OCWebDAVModificationDateKey;
 
 - (void)lockEndToEndFolderEncrypted:(NSString * _Nonnull)serverPath onCommunication:(OCCommunication * _Nonnull)sharedOCComunication success:(void(^ _Nonnull)(NSHTTPURLResponse * _Nonnull operation, id _Nonnull response))success failure:(void(^ _Nonnull)(NSHTTPURLResponse * _Nonnull operation, id  _Nullable responseObject, NSError * _Nonnull error))failure;
 
-- (void)unlockEndToEndFolderEncrypted:(NSString * _Nonnull)serverPath onCommunication:(OCCommunication * _Nonnull)sharedOCComunication success:(void(^ _Nonnull)(NSHTTPURLResponse * _Nonnull operation, id _Nonnull response))success failure:(void(^ _Nonnull)(NSHTTPURLResponse * _Nonnull operation, id  _Nullable responseObject, NSError * _Nonnull error))failure;
+- (void)unlockEndToEndFolderEncrypted:(NSString * _Nonnull)serverPath token:(NSString * _Nonnull)token onCommunication:(OCCommunication * _Nonnull)sharedOCComunication success:(void(^ _Nonnull)(NSHTTPURLResponse * _Nonnull operation, id _Nonnull response))success failure:(void(^ _Nonnull)(NSHTTPURLResponse * _Nonnull operation, id  _Nullable responseObject, NSError * _Nonnull error))failure;
 
 
 - (void)storeEndToEndMetadata:(NSString * _Nonnull)serverPath encryptedMetadata:(NSString * _Nonnull)encryptedMetadata onCommunication:(OCCommunication * _Nonnull)sharedOCComunication success:(void(^ _Nonnull)(NSHTTPURLResponse * _Nonnull operation, id _Nonnull response))success failure:(void(^ _Nonnull)(NSHTTPURLResponse * _Nonnull operation, id  _Nullable responseObject, NSError * _Nonnull error))failure;

+ 63 - 79
iOSClient/Library/OCCommunicationLib/OCWebDavClient/OCWebDAVClient.m

@@ -724,8 +724,7 @@ NSString const *OCWebDAVModificationDateKey	= @"modificationdate";
                          failure:(void(^)(NSHTTPURLResponse *operation, id  _Nullable responseObject, NSError *error))failure{
     _requestMethod = @"GET";
     
-    NSString *jsonQuery = [NSString stringWithFormat:@"?format=json"];
-    serverPath = [serverPath stringByAppendingString:jsonQuery];
+    serverPath = [serverPath stringByAppendingString:[NSString stringWithFormat:@"?format=json"]];
     
     NSMutableURLRequest *request = [self sharedRequestWithMethod:_requestMethod path:serverPath parameters:nil];
     
@@ -760,8 +759,7 @@ NSString const *OCWebDAVModificationDateKey	= @"modificationdate";
     
     _requestMethod = @"GET";
 
-    NSString *jsonQuery = [NSString stringWithFormat:@"?format=json"];
-    serverPath = [serverPath stringByAppendingString:jsonQuery];
+    serverPath = [serverPath stringByAppendingString:[NSString stringWithFormat:@"?format=json"]];
     
     NSMutableURLRequest *request = [self sharedRequestWithMethod:_requestMethod path:serverPath parameters:nil];
     
@@ -837,11 +835,7 @@ NSString const *OCWebDAVModificationDateKey	= @"modificationdate";
     
     _requestMethod = @"GET";
     
-    NSString *jsonQuery = [NSString stringWithFormat:@"?format=json"];
-    //NSString *startParamater = [NSString stringWithFormat:@"&start=%@", start];
-
-    serverPath = [serverPath stringByAppendingString:jsonQuery];
-    //serverPath = [serverPath stringByAppendingString:startParamater];
+    serverPath = [serverPath stringByAppendingString:[NSString stringWithFormat:@"?format=json"]];
     
     NSMutableURLRequest *request = [self sharedRequestWithMethod:_requestMethod path:serverPath parameters:nil];
     
@@ -857,8 +851,7 @@ NSString const *OCWebDAVModificationDateKey	= @"modificationdate";
     
     _requestMethod = @"GET";
     
-    NSString *jsonQuery = [NSString stringWithFormat:@"?format=json"];    
-    serverPath = [serverPath stringByAppendingString:jsonQuery];
+    serverPath = [serverPath stringByAppendingString:[NSString stringWithFormat:@"?format=json"]];
     
     NSMutableURLRequest *request = [self sharedRequestWithMethod:_requestMethod path:serverPath parameters:nil];
     
@@ -874,13 +867,12 @@ NSString const *OCWebDAVModificationDateKey	= @"modificationdate";
     
     _requestMethod = @"GET";
     
-    NSString *jsonQuery = [NSString stringWithFormat:@"?format=json"];
-    serverPath = [serverPath stringByAppendingString:jsonQuery];
+    serverPath = [serverPath stringByAppendingString:[NSString stringWithFormat:@"?format=json"]];
     
     NSMutableURLRequest *request = [self sharedRequestWithMethod:_requestMethod path:serverPath parameters:nil];
-    
     OCHTTPRequestOperation *operation = [self mr_operationWithRequest:request onCommunication:sharedOCCommunication success:success failure:failure];
     [self setRedirectionBlockOnDatataskWithOCCommunication:sharedOCCommunication andSessionManager:sharedOCCommunication.networkSessionManager];
+
     [operation resume];
 }
 
@@ -891,13 +883,14 @@ NSString const *OCWebDAVModificationDateKey	= @"modificationdate";
     
     _requestMethod = @"GET";
     
-    NSString *jsonQuery = [NSString stringWithFormat:@"?format=json"];
-    serverPath = [serverPath stringByAppendingString:jsonQuery];
+    serverPath = [serverPath stringByAppendingString:@"?format=json"];
     
     NSMutableURLRequest *request = [self sharedRequestWithMethod:_requestMethod path:serverPath parameters:nil];
-    
+    [request setValue:@"true" forHTTPHeaderField:@"OCS-APIRequest"];
+
     OCHTTPRequestOperation *operation = [self mr_operationWithRequest:request onCommunication:sharedOCCommunication success:success failure:failure];
     [self setRedirectionBlockOnDatataskWithOCCommunication:sharedOCCommunication andSessionManager:sharedOCCommunication.networkSessionManager];
+
     [operation resume];
 }
 
@@ -906,13 +899,14 @@ NSString const *OCWebDAVModificationDateKey	= @"modificationdate";
     
     _requestMethod = @"GET";
     
-    NSString *jsonQuery = [NSString stringWithFormat:@"?format=json"];
-    serverPath = [serverPath stringByAppendingString:jsonQuery];
+    serverPath = [serverPath stringByAppendingString:@"?format=json"];
     
     NSMutableURLRequest *request = [self sharedRequestWithMethod:_requestMethod path:serverPath parameters:nil];
-    
+    [request setValue:@"true" forHTTPHeaderField:@"OCS-APIRequest"];
+
     OCHTTPRequestOperation *operation = [self mr_operationWithRequest:request onCommunication:sharedOCCommunication success:success failure:failure];
     [self setRedirectionBlockOnDatataskWithOCCommunication:sharedOCCommunication andSessionManager:sharedOCCommunication.networkSessionManager];
+
     [operation resume];
 }
 
@@ -921,13 +915,14 @@ NSString const *OCWebDAVModificationDateKey	= @"modificationdate";
     
     _requestMethod = @"GET";
     
-    NSString *jsonQuery = [NSString stringWithFormat:@"?format=json"];
-    serverPath = [serverPath stringByAppendingString:jsonQuery];
+    serverPath = [serverPath stringByAppendingString:@"?format=json"];
     
     NSMutableURLRequest *request = [self sharedRequestWithMethod:_requestMethod path:serverPath parameters:nil];
-    
+    [request setValue:@"true" forHTTPHeaderField:@"OCS-APIRequest"];
+
     OCHTTPRequestOperation *operation = [self mr_operationWithRequest:request onCommunication:sharedOCCommunication success:success failure:failure];
     [self setRedirectionBlockOnDatataskWithOCCommunication:sharedOCCommunication andSessionManager:sharedOCCommunication.networkSessionManager];
+
     [operation resume];
 }
 
@@ -938,16 +933,13 @@ NSString const *OCWebDAVModificationDateKey	= @"modificationdate";
     
     _requestMethod = @"POST";
     
-    publicKey = [NSString stringWithFormat:@"?csr=%@",publicKey];
-    serverPath = [serverPath stringByAppendingString:publicKey];
+    serverPath = [serverPath stringByAppendingString:[NSString stringWithFormat:@"?csr=%@",publicKey]];
     serverPath = [serverPath stringByAppendingString:@"&format=json"];
     
     NSMutableURLRequest *request = [self sharedRequestWithMethod:_requestMethod path:serverPath parameters:nil];
-    
-    [request setValue:@"application/x-www-form-urlencoded" forHTTPHeaderField:@"Content-Type"];
-    
+    [request setValue:@"true" forHTTPHeaderField:@"OCS-APIRequest"];
+
     OCHTTPRequestOperation *operation = [self mr_operationWithRequest:request onCommunication:sharedOCCommunication success:success failure:failure];
-    
     [self setRedirectionBlockOnDatataskWithOCCommunication:sharedOCCommunication andSessionManager:sharedOCCommunication.networkSessionManager];
     
     [operation resume];
@@ -960,16 +952,13 @@ NSString const *OCWebDAVModificationDateKey	= @"modificationdate";
     
     _requestMethod = @"POST";
     
-    privateKeyChiper = [NSString stringWithFormat:@"?privateKey=%@",privateKeyChiper];
-    serverPath = [serverPath stringByAppendingString:privateKeyChiper];
+    serverPath = [serverPath stringByAppendingString:[NSString stringWithFormat:@"?privateKey=%@",privateKeyChiper]];
     serverPath = [serverPath stringByAppendingString:@"&format=json"];
     
     NSMutableURLRequest *request = [self sharedRequestWithMethod:_requestMethod path:serverPath parameters:nil];
-    
-    [request setValue:@"application/x-www-form-urlencoded" forHTTPHeaderField:@"Content-Type"];
-    
+    [request setValue:@"true" forHTTPHeaderField:@"OCS-APIRequest"];
+
     OCHTTPRequestOperation *operation = [self mr_operationWithRequest:request onCommunication:sharedOCCommunication success:success failure:failure];
-    
     [self setRedirectionBlockOnDatataskWithOCCommunication:sharedOCCommunication andSessionManager:sharedOCCommunication.networkSessionManager];
     
     [operation resume];
@@ -980,13 +969,14 @@ NSString const *OCWebDAVModificationDateKey	= @"modificationdate";
     
     _requestMethod = @"DELETE";
     
-    NSString *jsonQuery = [NSString stringWithFormat:@"?format=json"];
-    serverPath = [serverPath stringByAppendingString:jsonQuery];
+    serverPath = [serverPath stringByAppendingString:@"?format=json"];
     
     NSMutableURLRequest *request = [self sharedRequestWithMethod:_requestMethod path:serverPath parameters:nil];
-    
+    [request setValue:@"true" forHTTPHeaderField:@"OCS-APIRequest"];
+
     OCHTTPRequestOperation *operation = [self mr_operationWithRequest:request onCommunication:sharedOCCommunication success:success failure:failure];
     [self setRedirectionBlockOnDatataskWithOCCommunication:sharedOCCommunication andSessionManager:sharedOCCommunication.networkSessionManager];
+
     [operation resume];
 }
 
@@ -995,13 +985,14 @@ NSString const *OCWebDAVModificationDateKey	= @"modificationdate";
     
     _requestMethod = @"DELETE";
     
-    NSString *jsonQuery = [NSString stringWithFormat:@"?format=json"];
-    serverPath = [serverPath stringByAppendingString:jsonQuery];
+    serverPath = [serverPath stringByAppendingString:@"?format=json"];
     
     NSMutableURLRequest *request = [self sharedRequestWithMethod:_requestMethod path:serverPath parameters:nil];
-    
+    [request setValue:@"true" forHTTPHeaderField:@"OCS-APIRequest"];
+
     OCHTTPRequestOperation *operation = [self mr_operationWithRequest:request onCommunication:sharedOCCommunication success:success failure:failure];
     [self setRedirectionBlockOnDatataskWithOCCommunication:sharedOCCommunication andSessionManager:sharedOCCommunication.networkSessionManager];
+
     [operation resume];
 }
 
@@ -1010,13 +1001,14 @@ NSString const *OCWebDAVModificationDateKey	= @"modificationdate";
     
     _requestMethod = @"PUT";
     
-    NSString *jsonQuery = [NSString stringWithFormat:@"?format=json"];
-    serverPath = [serverPath stringByAppendingString:jsonQuery];
+    serverPath = [serverPath stringByAppendingString:@"?format=json"];
     
     NSMutableURLRequest *request = [self sharedRequestWithMethod:_requestMethod path:serverPath parameters:nil];
-    
+    [request setValue:@"true" forHTTPHeaderField:@"OCS-APIRequest"];
+
     OCHTTPRequestOperation *operation = [self mr_operationWithRequest:request onCommunication:sharedOCCommunication success:success failure:failure];
     [self setRedirectionBlockOnDatataskWithOCCommunication:sharedOCCommunication andSessionManager:sharedOCCommunication.networkSessionManager];
+
     [operation resume];
 }
 
@@ -1025,13 +1017,14 @@ NSString const *OCWebDAVModificationDateKey	= @"modificationdate";
     
     _requestMethod = @"DELETE";
     
-    NSString *jsonQuery = [NSString stringWithFormat:@"?format=json"];
-    serverPath = [serverPath stringByAppendingString:jsonQuery];
+    serverPath = [serverPath stringByAppendingString:@"?format=json"];
     
     NSMutableURLRequest *request = [self sharedRequestWithMethod:_requestMethod path:serverPath parameters:nil];
-    
+    [request setValue:@"true" forHTTPHeaderField:@"OCS-APIRequest"];
+
     OCHTTPRequestOperation *operation = [self mr_operationWithRequest:request onCommunication:sharedOCCommunication success:success failure:failure];
     [self setRedirectionBlockOnDatataskWithOCCommunication:sharedOCCommunication andSessionManager:sharedOCCommunication.networkSessionManager];
+
     [operation resume];
 }
 
@@ -1040,28 +1033,31 @@ NSString const *OCWebDAVModificationDateKey	= @"modificationdate";
     
     _requestMethod = @"POST";
     
-    NSString *jsonQuery = [NSString stringWithFormat:@"?format=json"];
-    serverPath = [serverPath stringByAppendingString:jsonQuery];
+    serverPath = [serverPath stringByAppendingString:@"?format=json"];
     
     NSMutableURLRequest *request = [self sharedRequestWithMethod:_requestMethod path:serverPath parameters:nil];
-    
+    [request setValue:@"true" forHTTPHeaderField:@"OCS-APIRequest"];
+
     OCHTTPRequestOperation *operation = [self mr_operationWithRequest:request onCommunication:sharedOCCommunication success:success failure:failure];
     [self setRedirectionBlockOnDatataskWithOCCommunication:sharedOCCommunication andSessionManager:sharedOCCommunication.networkSessionManager];
+
     [operation resume];
 }
 
-- (void)unlockEndToEndFolderEncrypted:(NSString*)serverPath onCommunication:(OCCommunication *)sharedOCCommunication success:(void(^)(NSHTTPURLResponse *operation, id response))success
+- (void)unlockEndToEndFolderEncrypted:(NSString*)serverPath token:(NSString *)token onCommunication:(OCCommunication *)sharedOCCommunication success:(void(^)(NSHTTPURLResponse *operation, id response))success
                                   failure:(void(^)(NSHTTPURLResponse *operation, id  _Nullable responseObject, NSError *error))failure{
     
     _requestMethod = @"DELETE";
     
-    NSString *jsonQuery = [NSString stringWithFormat:@"?format=json"];
-    serverPath = [serverPath stringByAppendingString:jsonQuery];
+    serverPath = [serverPath stringByAppendingString:[NSString stringWithFormat:@"?token=%@", token]];
+    serverPath = [serverPath stringByAppendingString:@"&format=json"];
     
     NSMutableURLRequest *request = [self sharedRequestWithMethod:_requestMethod path:serverPath parameters:nil];
-    
+    [request setValue:@"true" forHTTPHeaderField:@"OCS-APIRequest"];
+
     OCHTTPRequestOperation *operation = [self mr_operationWithRequest:request onCommunication:sharedOCCommunication success:success failure:failure];
     [self setRedirectionBlockOnDatataskWithOCCommunication:sharedOCCommunication andSessionManager:sharedOCCommunication.networkSessionManager];
+
     [operation resume];
 }
 
@@ -1072,16 +1068,13 @@ NSString const *OCWebDAVModificationDateKey	= @"modificationdate";
     
     _requestMethod = @"POST";
     
-    encryptedMetadata = [NSString stringWithFormat:@"?metaData=%@", encryptedMetadata];
-    serverPath = [serverPath stringByAppendingString:encryptedMetadata];
+    serverPath = [serverPath stringByAppendingString:[NSString stringWithFormat:@"?metaData=%@", encryptedMetadata]];
     serverPath = [serverPath stringByAppendingString:@"&format=json"];
     
     NSMutableURLRequest *request = [self sharedRequestWithMethod:_requestMethod path:serverPath parameters:nil];
-    
-    [request setValue:@"application/x-www-form-urlencoded" forHTTPHeaderField:@"Content-Type"];
-    
+    [request setValue:@"true" forHTTPHeaderField:@"OCS-APIRequest"];
+
     OCHTTPRequestOperation *operation = [self mr_operationWithRequest:request onCommunication:sharedOCCommunication success:success failure:failure];
-    
     [self setRedirectionBlockOnDatataskWithOCCommunication:sharedOCCommunication andSessionManager:sharedOCCommunication.networkSessionManager];
     
     [operation resume];
@@ -1094,17 +1087,14 @@ NSString const *OCWebDAVModificationDateKey	= @"modificationdate";
     
     _requestMethod = @"GET";
     
-    NSString *jsonQuery = [NSString stringWithFormat:@"?format=json"];
-    serverPath = [serverPath stringByAppendingString:jsonQuery];
+    serverPath = [serverPath stringByAppendingString:@"?format=json"];
     
     NSMutableURLRequest *request = [self sharedRequestWithMethod:_requestMethod path:serverPath parameters:nil];
-    
-    [request setValue:@"application/x-www-form-urlencoded" forHTTPHeaderField:@"Content-Type"];
-    
+    [request setValue:@"true" forHTTPHeaderField:@"OCS-APIRequest"];
+
     OCHTTPRequestOperation *operation = [self mr_operationWithRequest:request onCommunication:sharedOCCommunication success:success failure:failure];
-    
     [self setRedirectionBlockOnDatataskWithOCCommunication:sharedOCCommunication andSessionManager:sharedOCCommunication.networkSessionManager];
-    
+
     [operation resume];
 }
 
@@ -1115,16 +1105,13 @@ NSString const *OCWebDAVModificationDateKey	= @"modificationdate";
     
     _requestMethod = @"PUT";
     
-    encryptedMetadata = [NSString stringWithFormat:@"?metaData=%@", encryptedMetadata];
-    serverPath = [serverPath stringByAppendingString:encryptedMetadata];
+    serverPath = [serverPath stringByAppendingString:[NSString stringWithFormat:@"?metaData=%@", encryptedMetadata]];
     serverPath = [serverPath stringByAppendingString:@"&format=json"];
     
     NSMutableURLRequest *request = [self sharedRequestWithMethod:_requestMethod path:serverPath parameters:nil];
-    
-    [request setValue:@"application/x-www-form-urlencoded" forHTTPHeaderField:@"Content-Type"];
-    
+    [request setValue:@"true" forHTTPHeaderField:@"OCS-APIRequest"];
+
     OCHTTPRequestOperation *operation = [self mr_operationWithRequest:request onCommunication:sharedOCCommunication success:success failure:failure];
-    
     [self setRedirectionBlockOnDatataskWithOCCommunication:sharedOCCommunication andSessionManager:sharedOCCommunication.networkSessionManager];
     
     [operation resume];
@@ -1137,15 +1124,12 @@ NSString const *OCWebDAVModificationDateKey	= @"modificationdate";
     
     _requestMethod = @"DELETE";
     
-    NSString *jsonQuery = [NSString stringWithFormat:@"?format=json"];
-    serverPath = [serverPath stringByAppendingString:jsonQuery];
+    serverPath = [serverPath stringByAppendingString:@"?format=json"];
     
     NSMutableURLRequest *request = [self sharedRequestWithMethod:_requestMethod path:serverPath parameters:nil];
-    
-    [request setValue:@"application/x-www-form-urlencoded" forHTTPHeaderField:@"Content-Type"];
-    
+    [request setValue:@"true" forHTTPHeaderField:@"OCS-APIRequest"];
+
     OCHTTPRequestOperation *operation = [self mr_operationWithRequest:request onCommunication:sharedOCCommunication success:success failure:failure];
-    
     [self setRedirectionBlockOnDatataskWithOCCommunication:sharedOCCommunication andSessionManager:sharedOCCommunication.networkSessionManager];
     
     [operation resume];

+ 2 - 0
iOSClient/Library/OCCommunicationLib/OCWebDavClient/Parsers/OCXMLParser.m

@@ -239,6 +239,8 @@ NSString *OCCWebDAVURIKey           = @"uri";
         _currentFile.isFavorite = [_xmlChars boolValue];
     } else if ([elementName isEqualToString:@"x1:share-permissions"]) {
         _currentFile.permissions = _xmlChars;
+    } else if ([elementName isEqualToString:@"nc:is-encrypted"]) {
+        _currentFile.isEncrypted = [_xmlChars boolValue];
     }
 }
 

+ 33 - 27
iOSClient/Login/CCLogin.m

@@ -25,6 +25,7 @@
 #import "AppDelegate.h"
 #import "CCUtility.h"
 #import "NCBridgeSwift.h"
+#import "NCNetworkingSync.h"
 
 @interface CCLogin ()
 {
@@ -47,22 +48,23 @@
     
     if ([NCBrandOptions sharedInstance].disable_linkLoginProvider) {
         self.bottomLabel.hidden = YES;
-    }
-
-    UITapGestureRecognizer *tapGesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tabBottomLabel)];
-    [self.bottomLabel addGestureRecognizer:tapGesture];
+    } else {
     
-    if (self.view.frame.size.width == ([[UIScreen mainScreen] bounds].size.width*([[UIScreen mainScreen] bounds].size.width<[[UIScreen mainScreen] bounds].size.height))+([[UIScreen mainScreen] bounds].size.height*([[UIScreen mainScreen] bounds].size.width>[[UIScreen mainScreen] bounds].size.height))) {
+        if (self.view.frame.size.width == ([[UIScreen mainScreen] bounds].size.width*([[UIScreen mainScreen] bounds].size.width<[[UIScreen mainScreen] bounds].size.height))+([[UIScreen mainScreen] bounds].size.height*([[UIScreen mainScreen] bounds].size.width>[[UIScreen mainScreen] bounds].size.height))) {
         
-        // Portrait
-        self.bottomLabel.hidden = NO;
+            // Portrait
+            self.bottomLabel.hidden = NO;
         
-    } else {
+        } else {
         
-        // Landscape
-        self.bottomLabel.hidden = YES;
+            // Landscape
+            self.bottomLabel.hidden = YES;
+        }
     }
     
+    UITapGestureRecognizer *tapGesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tabBottomLabel)];
+    [self.bottomLabel addGestureRecognizer:tapGesture];
+    
     self.annulla.tintColor = [NCBrandColor sharedInstance].customer;
     
     [self.baseUrl setDelegate:self];
@@ -148,15 +150,18 @@
 {
     [coordinator animateAlongsideTransition:nil completion:^(id<UIViewControllerTransitionCoordinatorContext> context) {
         
-        if (self.view.frame.size.width == ([[UIScreen mainScreen] bounds].size.width*([[UIScreen mainScreen] bounds].size.width<[[UIScreen mainScreen] bounds].size.height))+([[UIScreen mainScreen] bounds].size.height*([[UIScreen mainScreen] bounds].size.width>[[UIScreen mainScreen] bounds].size.height))) {
+        if (![NCBrandOptions sharedInstance].disable_linkLoginProvider) {
+        
+            if (self.view.frame.size.width == ([[UIScreen mainScreen] bounds].size.width*([[UIScreen mainScreen] bounds].size.width<[[UIScreen mainScreen] bounds].size.height))+([[UIScreen mainScreen] bounds].size.height*([[UIScreen mainScreen] bounds].size.width>[[UIScreen mainScreen] bounds].size.height))) {
             
-            // Portrait
-            self.bottomLabel.hidden = NO;
+                // Portrait
+                self.bottomLabel.hidden = NO;
             
-        } else {
+            } else {
             
-            // Landscape
-            self.bottomLabel.hidden = YES;
+                // Landscape
+                self.bottomLabel.hidden = YES;
+            }
         }
     }];
     
@@ -255,9 +260,8 @@
     if ([[self.baseUrl.text substringFromIndex:[self.baseUrl.text length] - 1] isEqualToString:@"/"])
         self.baseUrl.text = [self.baseUrl.text substringToIndex:[self.baseUrl.text length] - 1];
     
-    OCnetworking *ocNet = [[OCnetworking alloc] initWithDelegate:self metadataNet:nil withUser:self.user.text withUserID:self.user.text withPassword:self.password.text withUrl:nil];
-    NSError *error = [ocNet checkServerSync:[NSString stringWithFormat:@"%@%@", self.baseUrl.text, webDAV]];
-    
+    NSError *error = [[NCNetworkingSync sharedManager] checkServer:[NSString stringWithFormat:@"%@%@", self.baseUrl.text, webDAV] user:self.user.text userID:self.user.text password:self.password.text];
+
     if (!error) {
         
         // account
@@ -353,17 +357,19 @@
         
         // Set this account as default
         tableAccount *account = [[NCManageDatabase sharedInstance] setAccountActive:metadataNet.account];
+        if (account) {
         
-        // Setting App active account
-        [app settingActiveAccount:account.account activeUrl:account.url activeUser:account.user activeUserID:account.userID activePassword:account.password];
+            // Setting App active account
+            [app settingActiveAccount:account.account activeUrl:account.url activeUser:account.user activeUserID:account.userID activePassword:account.password];
     
-        // Ok ! Dismiss
-        if ([self.delegate respondsToSelector:@selector(loginSuccess:)])        
-            [self.delegate loginSuccess:_loginType];
+            // Ok ! Dismiss
+            if ([self.delegate respondsToSelector:@selector(loginSuccess:)])
+                [self.delegate loginSuccess:_loginType];
         
-        dispatch_after(dispatch_time(DISPATCH_TIME_NOW, 1 * NSEC_PER_SEC), dispatch_get_main_queue(), ^{
-            [self dismissViewControllerAnimated:YES completion:nil];
-        });
+            dispatch_after(dispatch_time(DISPATCH_TIME_NOW, 1 * NSEC_PER_SEC), dispatch_get_main_queue(), ^{
+                [self dismissViewControllerAnimated:YES completion:nil];
+            });
+        }
     }
 }
 

+ 3 - 1
iOSClient/Login/CCLoginWeb.swift

@@ -76,7 +76,9 @@ extension CCLoginWeb: SwiftModalWebVCDelegate {
                     NCManageDatabase.sharedInstance.deleteAccount(account)
                     NCManageDatabase.sharedInstance.addAccount(account, url: serverUrl, user: username, password: password)
                                     
-                    let tableAccount : tableAccount = NCManageDatabase.sharedInstance.setAccountActive(account)
+                    guard let tableAccount = NCManageDatabase.sharedInstance.setAccountActive(account) else {
+                        return
+                    }
                 
                     if (tableAccount.account == account) {
                     

+ 1 - 1
iOSClient/Main/CCDetail.m

@@ -298,7 +298,7 @@
     NSURL *url = [NSURL fileURLWithPath:fileName];
 
     WKPreferences *wkPreferences = [[WKPreferences alloc] init];
-    wkPreferences.javaScriptEnabled = false;
+    wkPreferences.javaScriptEnabled = true;
     WKWebViewConfiguration *wkConfig = [[WKWebViewConfiguration alloc] init];
     wkConfig.preferences = wkPreferences;
     

+ 3 - 0
iOSClient/Main/CCMain.h

@@ -64,6 +64,9 @@
 @property (nonatomic, weak) CCDetail *detailViewController;
 @property (nonatomic, strong) UISearchController *searchController;
 
+@property (nonatomic, strong) NSString *e2eMetaDataJSON;
+
+
 - (void)closeAllMenu;
 - (void)returnCreate:(NSInteger)type;
 

+ 90 - 107
iOSClient/Main/CCMain.m

@@ -35,6 +35,7 @@
 #import "JDStatusBarNotification.h"
 #import "NCAutoUpload.h"
 #import "NCBridgeSwift.h"
+#import "NCNetworkingSync.h"
 
 @interface CCMain () <CCActionsDeleteDelegate, CCActionsRenameDelegate, CCActionsSearchDelegate, CCActionsDownloadThumbnailDelegate, CCActionsSettingFavoriteDelegate, UITextViewDelegate, createFormUploadAssetsDelegate, MGSwipeTableCellDelegate, CCLoginDelegate, CCLoginDelegateWeb>
 {
@@ -85,6 +86,10 @@
     CCLoginWeb *_loginWeb;
     CCLogin *_loginVC;
     
+    // Automatic Upload Folder
+    NSString *_autoUploadFileName;
+    NSString *_autoUploadDirectory;
+    
     BOOL _loadingFolder;
 }
 @end
@@ -520,7 +525,7 @@
 {
     _refreshControl = [UIRefreshControl new];
     
-    if (@available(iOS 11.0, *)) {
+    if (@available(iOS 11, *)) {
         [self.tableView setRefreshControl:_refreshControl];
         _refreshControl.tintColor = [UIColor whiteColor];
     } else {
@@ -776,12 +781,12 @@
         
         CreateFormUploadAssets *form = [[CreateFormUploadAssets alloc] initWithServerUrl:serverUrl assets:assets cryptated:NO session:k_upload_session delegate:self];
         form.title = NSLocalizedString(@"_upload_photos_videos_", nil);
-        
+            
         UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:form];
-        
+            
         [navigationController setModalPresentationStyle:UIModalPresentationFormSheet];
-                
-        [self presentViewController:navigationController animated:YES completion:nil];        
+        
+        [self presentViewController:navigationController animated:YES completion:nil];
     }];
 }
 
@@ -1349,8 +1354,9 @@
     if ([selector isEqualToString:selectorSave] && [[UIApplication sharedApplication] applicationState] == UIApplicationStateActive) {
         
         NSString *file = [NSString stringWithFormat:@"%@/%@", app.directoryUser, metadata.fileID];
+        PHAuthorizationStatus status = [PHPhotoLibrary authorizationStatus];
         
-        if ([metadata.typeFile isEqualToString: k_metadataTypeFile_image]) {
+        if ([metadata.typeFile isEqualToString: k_metadataTypeFile_image] && status == PHAuthorizationStatusAuthorized) {
             
             UIImage *image = [UIImage imageWithContentsOfFile:file];
             
@@ -1360,7 +1366,7 @@
                 [app messageNotification:@"_save_selected_files_" description:@"_file_not_saved_cameraroll_" visible:YES delay:k_dismissAfterSecond type:TWMessageBarMessageTypeError errorCode:0];
         }
         
-        if ([metadata.typeFile isEqualToString: k_metadataTypeFile_video]) {
+        if ([metadata.typeFile isEqualToString: k_metadataTypeFile_video] && status == PHAuthorizationStatusAuthorized) {
                         
             [[NSFileManager defaultManager] linkItemAtPath:file toPath:[NSTemporaryDirectory() stringByAppendingString:metadata.fileName] error:nil];
             
@@ -1372,6 +1378,15 @@
             }
         }
         
+        if (status != PHAuthorizationStatusAuthorized) {
+            
+            UIAlertController *alertController = [UIAlertController alertControllerWithTitle:NSLocalizedString(@"_access_photo_not_enabled_", nil) message:NSLocalizedString(@"_access_photo_not_enabled_msg_", nil) preferredStyle:UIAlertControllerStyleAlert];
+            UIAlertAction *okAction = [UIAlertAction actionWithTitle:NSLocalizedString(@"_ok_", nil) style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) {}];
+            
+            [alertController addAction:okAction];
+            [self presentViewController:alertController animated:YES completion:nil];
+        }
+        
         [self reloadDatasource:serverUrl];
     }
     
@@ -1575,6 +1590,7 @@
     BOOL useSubFolder = [[arguments objectAtIndex:2] boolValue];
     NSString *session = [arguments objectAtIndex:3];
     
+    
     NSString *autoUploadPath = [[NCManageDatabase sharedInstance] getAccountAutoUploadPath:app.activeUrl];
     NSString *directoryID = [[NCManageDatabase sharedInstance] getDirectoryID:serverUrl];
     if (!directoryID) return;
@@ -1759,7 +1775,7 @@
         
     } else {
         
-        [[NCManageDatabase sharedInstance] setDirectoryWithServerUrl:metadataNet.serverUrl serverUrlTo:nil etag:metadataFolder.etag];
+        [[NCManageDatabase sharedInstance] setDirectoryWithServerUrl:metadataNet.serverUrl serverUrlTo:nil etag:metadataFolder.etag fileID:metadataFolder.fileID];
         
         [[NCManageDatabase sharedInstance] deleteMetadataWithPredicate:[NSPredicate predicateWithFormat:@"account = %@ AND directoryID = %@ AND session = ''", metadataNet.account, metadataNet.directoryID] clearDateReadDirectoryID:metadataNet.directoryID];
         
@@ -1821,6 +1837,11 @@
         _loadingFolder = NO;
         [self tableViewReloadData];
     }
+    
+    // Is encrypted folder get metadata
+    if (metadataFolder.encrypted == true) {
+        [app.endToEndInterface getEndToEndMetadata:metadataFolder];
+    }
 }
 
 - (void)readFolder:(NSString *)serverUrl
@@ -2296,9 +2317,6 @@
     fileNameFolder = [CCUtility removeForbiddenCharactersServer:fileNameFolder];
     if (![fileNameFolder length]) return;
     
-    //if (autoUploadDirectory) metadataNet.serverUrl = [[NCManageDatabase sharedInstance] getAccountAutoUploadDirectory:app.activeUrl];
-    //else  metadataNet.serverUrl = _serverUrl;
-    
     NSString *directoryID = [[NCManageDatabase sharedInstance] getDirectoryID:_serverUrl];
     if (!directoryID) return;
     
@@ -2977,13 +2995,15 @@
     dispatch_after(dispatch_time(DISPATCH_TIME_NOW, 0.2 * NSEC_PER_SEC), dispatch_get_main_queue(), ^{
             
         tableAccount *tableAccount = [[NCManageDatabase sharedInstance] setAccountActive:[sender argument]];
-        if (tableAccount)
+        if (tableAccount) {
+            
             [app settingActiveAccount:tableAccount.account activeUrl:tableAccount.url activeUser:tableAccount.user activeUserID:tableAccount.userID activePassword:tableAccount.password];
     
-        // go to home sweet home
-        [[NSNotificationCenter defaultCenter] postNotificationOnMainThreadName:@"initializeMain" object:nil];
+            // go to home sweet home
+            [[NSNotificationCenter defaultCenter] postNotificationOnMainThreadName:@"initializeMain" object:nil];
         
-        [_ImageTitleHomeCryptoCloud setUserInteractionEnabled:YES];
+            [_ImageTitleHomeCryptoCloud setUserInteractionEnabled:YES];
+        }
     });
 }
 
@@ -3877,15 +3897,12 @@
         
         if (directory.lock && [[CCUtility getBlockCode] length] && app.sessionePasscodeLock == nil) lockDirectory = YES;
         
-        NSString *autoUploadFileName = [[NCManageDatabase sharedInstance] getAccountAutoUploadFileName];
-        NSString *autoUploadDirectory = [[NCManageDatabase sharedInstance] getAccountAutoUploadDirectory:app.activeUrl];
-        
-        [actionSheet addButtonWithTitle: _metadata.fileName
-                                  image: [CCGraphics changeThemingColorImage:[UIImage imageNamed:_metadata.iconName] color:[NCBrandColor sharedInstance].brand]
-                        backgroundColor: [NCBrandColor sharedInstance].tabBar
-                                 height: 50.0
-                                   type: AHKActionSheetButtonTypeDisabled
-                                handler: nil
+        [actionSheet addButtonWithTitle:_metadata.fileName
+                                  image:[CCGraphics changeThemingColorImage:[UIImage imageNamed:_metadata.iconName] color:[NCBrandColor sharedInstance].brand]
+                        backgroundColor:[NCBrandColor sharedInstance].tabBar
+                                 height:50.0
+                                   type:AHKActionSheetButtonTypeDisabled
+                                handler:nil
         ];
         
         if (!lockDirectory) {
@@ -3893,7 +3910,7 @@
             [actionSheet addButtonWithTitle:NSLocalizedString(@"_share_", nil)
                                       image:[CCGraphics changeThemingColorImage:[UIImage imageNamed:@"actionSheetShare"] color:[NCBrandColor sharedInstance].brand]
                             backgroundColor:[UIColor whiteColor]
-                                     height: 50.0
+                                     height:50.0
                                        type:AHKActionSheetButtonTypeDefault
                                     handler:^(AHKActionSheet *as) {
                                         
@@ -3901,12 +3918,12 @@
                                     }];
         }
         
-        if (!([_metadata.fileName isEqualToString:autoUploadFileName] == YES && [serverUrl isEqualToString:autoUploadDirectory] == YES) && !lockDirectory) {
+        if (!([_metadata.fileName isEqualToString:_autoUploadFileName] == YES && [serverUrl isEqualToString:_autoUploadDirectory] == YES) && !lockDirectory) {
             
             [actionSheet addButtonWithTitle:NSLocalizedString(@"_rename_", nil)
                                       image:[CCGraphics changeThemingColorImage:[UIImage imageNamed:@"actionSheetRename"] color:[NCBrandColor sharedInstance].brand]
                             backgroundColor:[UIColor whiteColor]
-                                     height: 50.0
+                                     height:50.0
                                        type:AHKActionSheetButtonTypeDefault
                                     handler:^(AHKActionSheet *as) {
                                         
@@ -3939,12 +3956,12 @@
                                     }];
         }
         
-        if (!([_metadata.fileName isEqualToString:autoUploadFileName] == YES && [serverUrl isEqualToString:autoUploadDirectory] == YES) && !lockDirectory) {
+        if (!([_metadata.fileName isEqualToString:_autoUploadFileName] == YES && [serverUrl isEqualToString:_autoUploadDirectory] == YES) && !lockDirectory) {
             
             [actionSheet addButtonWithTitle:NSLocalizedString(@"_move_", nil)
                                       image:[CCGraphics changeThemingColorImage:[UIImage imageNamed:@"actionSheetMove"] color:[NCBrandColor sharedInstance].brand]
                             backgroundColor:[UIColor whiteColor]
-                                     height: 50.0
+                                     height:50.0
                                        type:AHKActionSheetButtonTypeDefault
                                     handler:^(AHKActionSheet *as) {
                                         
@@ -3952,22 +3969,21 @@
                                     }];
         }
         
-        if (!([_metadata.fileName isEqualToString:autoUploadFileName] == YES && [serverUrl isEqualToString:autoUploadDirectory] == YES)) {
+        if (!([_metadata.fileName isEqualToString:_autoUploadFileName] == YES && [serverUrl isEqualToString:_autoUploadDirectory] == YES)) {
             
             [actionSheet addButtonWithTitle:NSLocalizedString(@"_folder_automatic_upload_", nil)
                                       image:[CCGraphics changeThemingColorImage:[UIImage imageNamed:@"folderphotocamera"] color:[NCBrandColor sharedInstance].brand]
                             backgroundColor:[UIColor whiteColor]
-                                     height: 50.0
+                                     height:50.0
                                        type:AHKActionSheetButtonTypeDefault
                                     handler:^(AHKActionSheet *as) {
                                         
                                         // Settings new folder Automatatic upload
-                                        NSString *oldAutoUploadDirectory = [[NCManageDatabase sharedInstance] getAccountAutoUploadDirectory:app.activeUrl];
-                                        
                                         [[NCManageDatabase sharedInstance] setAccountAutoUploadFileName:_metadata.fileName];
                                         [[NCManageDatabase sharedInstance] setAccountAutoUploadDirectory:serverUrl activeUrl:app.activeUrl];
                                         
-                                        [[NCManageDatabase sharedInstance] clearDateReadWithServerUrl:oldAutoUploadDirectory directoryID:nil];
+                                        // Clear data (old) Auto Upload
+                                        [[NCManageDatabase sharedInstance] clearDateReadWithServerUrl:_autoUploadDirectory directoryID:nil];
                                         
                                         if (app.activeAccount.length > 0 && app.activePhotos)
                                             [app.activePhotos reloadDatasourceForced];
@@ -3982,88 +3998,53 @@
                                     }];
         }
 
-#ifdef DEBUG
-        if ([CCUtility isEndToEndEnabled:app.activeAccount]) {
-            
-            [actionSheet addButtonWithTitle:@"Mark as encrypted"
-                                      image:[UIImage imageNamed:@"actionSheetCrypto"]
-                            backgroundColor:[UIColor whiteColor]
-                                     height: 50.0
-                                       type:AHKActionSheetButtonTypeEncrypted
-                                    handler:^(AHKActionSheet *as) {
-                                        
-                                        [app.endToEndInterface markEndToEndFolderEncrypted:_metadata];                                        
-                                    }];
-        }
-        
-        if ([CCUtility isEndToEndEnabled:app.activeAccount]) {
+        if (!([_metadata.fileName isEqualToString:_autoUploadFileName] == YES && [serverUrl isEqualToString:_autoUploadDirectory] == YES)) {
             
-            [actionSheet addButtonWithTitle:@"Delete mark as encrypted"
-                                      image:[UIImage imageNamed:@"actionSheetCrypto"]
-                            backgroundColor:[UIColor whiteColor]
-                                     height: 50.0
-                                       type:AHKActionSheetButtonTypeEncrypted
-                                    handler:^(AHKActionSheet *as) {
-                                        
-                                        [app.endToEndInterface deletemarkEndToEndFolderEncrypted:_metadata];
-                                    }];
-        }
-        
-        if ([CCUtility isEndToEndEnabled:app.activeAccount]) {
-            
-            [actionSheet addButtonWithTitle:@"Lock file"
-                                      image:[UIImage imageNamed:@"actionSheetCrypto"]
+            [actionSheet addButtonWithTitle:titoloLock
+                                      image:[CCGraphics changeThemingColorImage:[UIImage imageNamed:@"settingsPasscodeYES"] color:[NCBrandColor sharedInstance].brand]
                             backgroundColor:[UIColor whiteColor]
-                                     height: 50.0
-                                       type:AHKActionSheetButtonTypeEncrypted
+                                     height:50.0
+                                       type:AHKActionSheetButtonTypeDefault
                                     handler:^(AHKActionSheet *as) {
                                         
-                                        [app.endToEndInterface lockEndToEndFolderEncrypted:_metadata];
+                                        [self performSelector:@selector(comandoLockPassword) withObject:nil];
                                     }];
         }
         
-        if ([CCUtility isEndToEndEnabled:app.activeAccount]) {
+#ifdef DEBUG
+        if ([CCUtility isEndToEndEnabled:app.activeAccount] && !_metadata.encrypted) {
             
-            [actionSheet addButtonWithTitle:@"Unlock file"
-                                      image:[UIImage imageNamed:@"actionSheetCrypto"]
+            [actionSheet addButtonWithTitle:NSLocalizedString(@"_e2e_set_folder_encrypted_", nil)
+                                      image:[UIImage imageNamed:@"encrypted_empty"]
                             backgroundColor:[UIColor whiteColor]
-                                     height: 50.0
+                                     height:50.0
                                        type:AHKActionSheetButtonTypeEncrypted
                                     handler:^(AHKActionSheet *as) {
                                         
-                                        [app.endToEndInterface unlockEndToEndFolderEncrypted:_metadata];
+                                        dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0), ^{
+                                           if ([app.endToEndInterface markEndToEndFolderEncrypted:app.activeUrl fileID:_metadata.fileID token:nil])
+                                               [self readFolder:self.serverUrl];
+                                        });
                                     }];
         }
         
-        if ([CCUtility isEndToEndEnabled:app.activeAccount]) {
+        if ([CCUtility isEndToEndEnabled:app.activeAccount] && _metadata.encrypted) {
             
-            [actionSheet addButtonWithTitle:@"Get metadata file"
-                                      image:[UIImage imageNamed:@"actionSheetCrypto"]
+            [actionSheet addButtonWithTitle:NSLocalizedString(@"_e2e_remove_folder_encrypted_", nil)
+                                      image:[UIImage imageNamed:@"encrypted_empty"]
                             backgroundColor:[UIColor whiteColor]
-                                     height: 50.0
+                                     height:50.0
                                        type:AHKActionSheetButtonTypeEncrypted
                                     handler:^(AHKActionSheet *as) {
                                         
-                                        [app.endToEndInterface getEndToEndMetadata:_metadata];
+                                        dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0), ^{
+                                            if ([app.endToEndInterface deletemarkEndToEndFolderEncrypted:app.activeUrl fileID:_metadata.fileID token:nil])
+                                                [self readFolder:self.serverUrl];
+                                        });
                                     }];
         }
-        
-        
 #endif
         
-        if (!([_metadata.fileName isEqualToString:autoUploadFileName] == YES && [serverUrl isEqualToString:autoUploadDirectory] == YES)) {
-            
-            [actionSheet addButtonWithTitle:titoloLock
-                                      image:[UIImage imageNamed:@"actionSheetLock"]
-                            backgroundColor:[UIColor whiteColor]
-                                     height: 50.0
-                                       type:AHKActionSheetButtonTypeEncrypted
-                                    handler:^(AHKActionSheet *as) {
-                                        
-                                        [self performSelector:@selector(comandoLockPassword) withObject:nil];
-                                    }];
-        }
-        
         [actionSheet show];
     }
     
@@ -4259,6 +4240,10 @@
         
             _sectionDataSource = [CCSectionDataSourceMetadata new];
             _sectionDataSource = [CCSectionMetadata creataDataSourseSectionMetadata:recordsTableMetadata listProgressMetadata:nil groupByField:_directoryGroupBy activeAccount:app.activeAccount];
+            
+            // get auto upload folder
+            _autoUploadFileName = [[NCManageDatabase sharedInstance] getAccountAutoUploadFileName];
+            _autoUploadDirectory = [[NCManageDatabase sharedInstance] getAccountAutoUploadDirectory:app.activeUrl];
         }
         
     } else {
@@ -4653,10 +4638,12 @@
         if (metadata.directory) {
             
             if (metadata.encrypted)
-                cell.file.image = [CCGraphics changeThemingColorImage:[UIImage imageNamed:metadata.iconName] color:[UIColor redColor]];
+                cell.file.image = [CCGraphics changeThemingColorImage:[UIImage imageNamed:@"folderEncrypted"] color:[NCBrandColor sharedInstance].brand];
+            else if ([metadata.fileName isEqualToString:_autoUploadFileName] && [self.serverUrl isEqualToString:_autoUploadDirectory])
+                cell.file.image = [CCGraphics changeThemingColorImage:[UIImage imageNamed:@"folderphotocamera"] color:[NCBrandColor sharedInstance].brand];
             else
-                cell.file.image = [CCGraphics changeThemingColorImage:[UIImage imageNamed:metadata.iconName] color:[NCBrandColor sharedInstance].brand];
-
+                cell.file.image = [CCGraphics changeThemingColorImage:[UIImage imageNamed:@"folder"] color:[NCBrandColor sharedInstance].brand];
+            
         } else {
             cell.file.image = [UIImage imageNamed:metadata.iconName];
         }
@@ -4665,7 +4652,7 @@
     }
     
     // ----------------------------------------------------------------------------------------------------------
-    // Image Status cyptated & Lock Passcode
+    // Image Status Lock Passcode
     // ----------------------------------------------------------------------------------------------------------
     
     // Directory con passcode lock attivato
@@ -4676,6 +4663,13 @@
     if (metadata.directory && (directory.lock && [[CCUtility getBlockCode] length]))
         cell.status.image = [UIImage imageNamed:@"passcode"];
     
+    // ----------------------------------------------------------------------------------------------------------
+    // Image Status Encrypted
+    // ----------------------------------------------------------------------------------------------------------
+    
+   // if (metadata.encrypted)
+   //     cell.status.image = [UIImage imageNamed:@"encrypted"];
+    
     // ----------------------------------------------------------------------------------------------------------
     // Favorite
     // ----------------------------------------------------------------------------------------------------------
@@ -4993,17 +4987,6 @@
         // se il file esiste andiamo direttamente al delegato altrimenti carichiamolo
         if ([[NSFileManager defaultManager] fileExistsAtPath:[NSString stringWithFormat:@"%@/%@", app.directoryUser, _metadata.fileID]]) {
             
-#ifdef DEBUG
-            // TEST ENCRYPTED/DECRYPTED
-            if ([_metadata.fileName containsString:@".dms"]) {
-                [[NCEndToEndEncryption sharedManager] decryptMetadata:_metadata activeUrl:app.directoryUser];
-            }
-            
-            if ([_metadata.fileName containsString:@"test_encry_marino.jpg"]) {
-                [[NCEndToEndEncryption sharedManager] encryptMetadata:_metadata activeUrl:app.directoryUser];
-            }
-#endif
-            
             [self downloadFileSuccess:_metadata.fileID serverUrl:serverUrl selector:selectorLoadFileView selectorPost:nil];
             
         } else {

Some files were not shown because too many files changed in this diff