Marino Faggiana 7 жил өмнө
parent
commit
7d970a4651
21 өөрчлөгдсөн 157 нэмэгдсэн , 60 устгасан
  1. 59 0
      Libraries external/Realm/Realm.framework/CHANGELOG.md
  2. 44 24
      Libraries external/Realm/Realm.framework/Headers/RLMObject.h
  3. 17 0
      Libraries external/Realm/Realm.framework/Headers/RLMSyncUser.h
  4. BIN
      Libraries external/Realm/Realm.framework/Info.plist
  5. 8 4
      Libraries external/Realm/Realm.framework/LICENSE
  6. 2 9
      Libraries external/Realm/Realm.framework/PrivateHeaders/RLMAccessor.h
  7. 2 18
      Libraries external/Realm/Realm.framework/PrivateHeaders/RLMObjectStore.h
  8. 1 1
      Libraries external/Realm/Realm.framework/PrivateHeaders/RLMRealm_Private.h
  9. BIN
      Libraries external/Realm/Realm.framework/Realm
  10. 4 4
      Libraries external/Realm/RealmSwift.framework/Headers/RealmSwift-Swift.h
  11. BIN
      Libraries external/Realm/RealmSwift.framework/Info.plist
  12. BIN
      Libraries external/Realm/RealmSwift.framework/Modules/RealmSwift.swiftmodule/arm.swiftdoc
  13. BIN
      Libraries external/Realm/RealmSwift.framework/Modules/RealmSwift.swiftmodule/arm.swiftmodule
  14. BIN
      Libraries external/Realm/RealmSwift.framework/Modules/RealmSwift.swiftmodule/arm64.swiftdoc
  15. BIN
      Libraries external/Realm/RealmSwift.framework/Modules/RealmSwift.swiftmodule/arm64.swiftmodule
  16. BIN
      Libraries external/Realm/RealmSwift.framework/Modules/RealmSwift.swiftmodule/i386.swiftdoc
  17. BIN
      Libraries external/Realm/RealmSwift.framework/Modules/RealmSwift.swiftmodule/i386.swiftmodule
  18. BIN
      Libraries external/Realm/RealmSwift.framework/Modules/RealmSwift.swiftmodule/x86_64.swiftdoc
  19. BIN
      Libraries external/Realm/RealmSwift.framework/Modules/RealmSwift.swiftmodule/x86_64.swiftmodule
  20. BIN
      Libraries external/Realm/RealmSwift.framework/RealmSwift
  21. 20 0
      iOSClient/Database/NCManageDatabase.swift

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

@@ -1,3 +1,62 @@
+2.8.3 Release notes (2017-06-20)
+=============================================================
+
+### Bugfixes
+
+* Properly update RealmOptional properties when adding an object with `add(update: true)`.
+* Add some missing quotes in error messages.
+* Fix a performance regression when creating objects with primary keys.
+
+2.8.2 Release notes (2017-06-16)
+=============================================================
+
+### Bugfixes
+
+* Fix an issue where synchronized Realms would eventually disconnect from the
+  remote server if the user object used to define their sync configuration
+  was destroyed.
+* Restore support for changing primary keys in migrations (broken in 2.8.0).
+* Revert handling of adding objects with nil properties to a Realm to the
+  pre-2.8.0 behavior.
+
+2.8.1 Release notes (2017-06-12)
+=============================================================
+
+Add support for building with Xcode 9 Beta 1.
+
+### Bugfixes
+
+* Fix setting a float property to NaN.
+* Fix a crash when using compact on launch in combination with collection
+  notifications.
+
+2.8.0 Release notes (2017-06-02)
+=============================================================
+
+### API Breaking Changes
+
+* None.
+
+### Enhancements
+
+* Enable encryption on watchOS.
+* Add `-[RLMSyncUser changePassword:forUserID:completion:]` API to change an
+  arbitrary user's password if the current user has administrative privileges
+  and using Realm's 'password' authentication provider.
+  Requires any edition of the Realm Object Server 1.6.0 or later.
+
+### Bugfixes
+
+* Suppress `-Wdocumentation` warnings in Realm C++ headers when using CocoaPods
+  with Xcode 8.3.2.
+* Throw an appropriate error rather than crashing when an RLMArray is assigned
+  to an RLMArray property of a different type.
+* Fix crash in large (>4GB) encrypted Realm files.
+* Improve accuracy of sync progress notifications.
+* Fix an issue where synchronized Realms did not connect to the remote server
+  in certain situations, such as when an application was offline when the Realms
+  were opened but later regained network connectivity.
+
 2.7.0 Release notes (2017-05-03)
 2.7.0 Release notes (2017-05-03)
 =============================================================
 =============================================================
 
 

+ 44 - 24
Libraries external/Realm/Realm.framework/Headers/RLMObject.h

@@ -137,11 +137,13 @@ NS_ASSUME_NONNULL_BEGIN
  on them.
  on them.
 
 
  The `value` argument can be a key-value coding compliant object, an array or dictionary returned from the methods in
  The `value` argument can be a key-value coding compliant object, an array or dictionary returned from the methods in
- `NSJSONSerialization`, or an array containing one element for each managed property. An exception will be thrown if
- any required properties are not present and those properties were not defined with default values.
+ `NSJSONSerialization`, or an array containing one element for each managed property.
+ 
+ An exception will be thrown if any required properties are not present and those properties
+ were not defined with default values.
 
 
- When passing in an array as the `value` argument, all properties must be present, valid and in the same order as the
- properties defined in the model.
+ If the `value` argument is an array, all properties must be present, valid and in the same
+ order as the properties defined in the model.
 
 
  @param value    The value used to populate the object.
  @param value    The value used to populate the object.
 
 
@@ -156,11 +158,13 @@ NS_ASSUME_NONNULL_BEGIN
  on them.
  on them.
 
 
  The `value` argument can be a key-value coding compliant object, an array or dictionary returned from the methods in
  The `value` argument can be a key-value coding compliant object, an array or dictionary returned from the methods in
- `NSJSONSerialization`, or an array containing one element for each managed property. An exception will be thrown if any
- required properties are not present and those properties were not defined with default values.
+ `NSJSONSerialization`, or an array containing one element for each managed property.
+ 
+ An exception will be thrown if any required properties are not present and those properties
+ were not defined with default values.
 
 
- When passing in an array as the `value` argument, all properties must be present, valid and in the same order as the
- properties defined in the model.
+ If the `value` argument is an array, all properties must be present, valid and in the same
+ order as the properties defined in the model.
 
 
  @param realm    The Realm which should manage the newly-created object.
  @param realm    The Realm which should manage the newly-created object.
  @param value    The value used to populate the object.
  @param value    The value used to populate the object.
@@ -179,16 +183,24 @@ NS_ASSUME_NONNULL_BEGIN
  If nested objects are included in the argument, `createOrUpdateInDefaultRealmWithValue:` will be
  If nested objects are included in the argument, `createOrUpdateInDefaultRealmWithValue:` will be
  recursively called on them if they have primary keys, `createInDefaultRealmWithValue:` if they do not.
  recursively called on them if they have primary keys, `createInDefaultRealmWithValue:` if they do not.
 
 
- If the argument is a Realm object already managed by the default Realm, the argument's type is the same
- as the receiver, and the objects have identical values for their managed properties, this method does nothing.
+ The `value` argument is used to populate the object. It can be a Realm object, a key-value coding
+ compliant object, an array or dictionary returned from the methods in `NSJSONSerialization`, or an
+ array containing one element for each managed property.
 
 
- The `value` argument is used to populate the object. It can be a key-value coding compliant object, an array or
- dictionary returned from the methods in `NSJSONSerialization`, or an array containing one element for each managed
- property. An exception will be thrown if any required properties are not present and those properties were not defined
- with default values.
+ If the object is being created, an exception will be thrown if any required properties
+ are not present and those properties were not defined with default values.
+ 
+ If the `value` argument is a Realm object already managed by the default Realm, the
+ argument's type is the same as the receiver, and the objects have identical values for
+ their managed properties, this method does nothing.
 
 
- When passing in an array as the `value` argument, all properties must be present, valid and in the same order as the
- properties defined in the model.
+ If the object is being updated, all properties defined in its schema will be set by copying from
+ `value` using key-value coding. If the `value` argument does not respond to `valueForKey:` for a
+ given property name (or getter name, if defined), that value will remain untouched.
+ Nullable properties on the object can be set to nil by using `NSNull` as the updated value.
+
+ If the `value` argument is an array, all properties must be present, valid and in the same
+ order as the properties defined in the model.
 
 
  @param value    The value used to populate the object.
  @param value    The value used to populate the object.
 
 
@@ -206,16 +218,24 @@ NS_ASSUME_NONNULL_BEGIN
  If nested objects are included in the argument, `createOrUpdateInRealm:withValue:` will be
  If nested objects are included in the argument, `createOrUpdateInRealm:withValue:` will be
  recursively called on them if they have primary keys, `createInRealm:withValue:` if they do not.
  recursively called on them if they have primary keys, `createInRealm:withValue:` if they do not.
 
 
- If the argument is a Realm object already managed by the given Realm, the argument's type is the same
- as the receiver, and the objects have identical values for their managed properties, this method does nothing.
+ The `value` argument is used to populate the object. It can be a Realm object, a key-value coding
+ compliant object, an array or dictionary returned from the methods in `NSJSONSerialization`, or an
+ array containing one element for each managed property.
+
+ If the object is being created, an exception will be thrown if any required properties
+ are not present and those properties were not defined with default values.
+
+ If the `value` argument is a Realm object already managed by the given Realm, the
+ argument's type is the same as the receiver, and the objects have identical values for
+ their managed properties, this method does nothing.
 
 
- The `value` argument is used to populate the object. It can be a key-value coding compliant object, an array or
- dictionary returned from the methods in `NSJSONSerialization`, or an array containing one element for each managed
- property. An exception will be thrown if any required properties are not present and those properties were not defined
- with default values.
+ If the object is being updated, all properties defined in its schema will be set by copying from
+ `value` using key-value coding. If the `value` argument does not respond to `valueForKey:` for a
+ given property name (or getter name, if defined), that value will remain untouched.
+ Nullable properties on the object can be set to nil by using `NSNull` as the updated value.
 
 
- When passing in an array as the `value` argument, all properties must be present, valid and in the same order as the
- properties defined in the model.
+ If the `value` argument is an array, all properties must be present, valid and in the same
+ order as the properties defined in the model.
 
 
  @param realm    The Realm which should own the object.
  @param realm    The Realm which should own the object.
  @param value    The value used to populate the object.
  @param value    The value used to populate the object.

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

@@ -156,6 +156,23 @@ NS_SWIFT_UNAVAILABLE("Use the full version of this API.");
  */
  */
 - (void)changePassword:(NSString *)newPassword completion:(RLMPasswordChangeStatusBlock)completion;
 - (void)changePassword:(NSString *)newPassword completion:(RLMPasswordChangeStatusBlock)completion;
 
 
+/**
+ Change an arbitrary user's password asynchronously.
+
+ @note    The current user must be an admin user for this operation to succeed.
+
+ @warning Changing a user's password using an authentication server that doesn't
+          use HTTPS is a major security flaw, and should only be done while
+          testing.
+
+ @param newPassword The user's new password.
+ @param userID      The identity of the user whose password should be changed.
+ @param completion  Completion block invoked when login has completed or failed.
+                    The callback will be invoked on a background queue provided
+                    by `NSURLSession`.
+ */
+- (void)changePassword:(NSString *)newPassword forUserID:(NSString *)userID completion:(RLMPasswordChangeStatusBlock)completion;
+
 // This set of permissions APIs uses immutable `RLMSyncPermissionValue` objects to
 // This set of permissions APIs uses immutable `RLMSyncPermissionValue` objects to
 // retrieve and apply permissions. It is intended to replace the set of APIs which
 // 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.
 // directly access Realms and Realm model objects to work with permissions.

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


+ 8 - 4
Libraries external/Realm/Realm.framework/LICENSE

@@ -4,7 +4,7 @@ TABLE OF CONTENTS
 2. Realm Components
 2. Realm Components
 3. Export Compliance
 3. Export Compliance
 
 
--------------------------------------------------------------------------------
+1. -------------------------------------------------------------------------------
 
 
                                  Apache License
                                  Apache License
                            Version 2.0, January 2004
                            Version 2.0, January 2004
@@ -181,17 +181,19 @@ TABLE OF CONTENTS
       incurred by, or claims asserted against, such Contributor by reason
       incurred by, or claims asserted against, such Contributor by reason
       of your accepting any such warranty or additional liability.
       of your accepting any such warranty or additional liability.
 
 
+2. -------------------------------------------------------------------------------
+
 REALM COMPONENTS
 REALM COMPONENTS
 
 
 This software contains components with separate copyright and license terms.
 This software contains components with separate copyright and license terms.
 Your use of these components is subject to the terms and conditions of the
 Your use of these components is subject to the terms and conditions of the
 following licenses.
 following licenses.
 
 
-For the Realm Core component
+For the Realm Platform Extensions component
 
 
-  Realm Core Binary License
+  Realm Platform Extensions License
 
 
-  Copyright (c) 2011-2016 Realm Inc All rights reserved
+  Copyright (c) 2011-2017 Realm Inc All rights reserved
 
 
   Redistribution and use in binary form, with or without modification, is
   Redistribution and use in binary form, with or without modification, is
   permitted provided that the following conditions are met:
   permitted provided that the following conditions are met:
@@ -222,6 +224,8 @@ For the Realm Core component
   ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
   ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
   POSSIBILITY OF SUCH DAMAGE.
   POSSIBILITY OF SUCH DAMAGE.
 
 
+3. -------------------------------------------------------------------------------
+
 EXPORT COMPLIANCE
 EXPORT COMPLIANCE
 
 
 You understand that the Software may contain cryptographic functions that may be
 You understand that the Software may contain cryptographic functions that may be

+ 2 - 9
Libraries external/Realm/Realm.framework/PrivateHeaders/RLMAccessor.h

@@ -18,14 +18,7 @@
 
 
 #import <Foundation/Foundation.h>
 #import <Foundation/Foundation.h>
 
 
-
-@class RLMObjectSchema, RLMProperty, RLMObjectBase, RLMProperty;
-
-#ifdef __cplusplus
-typedef NSUInteger RLMCreationOptions;
-#else
-typedef NS_OPTIONS(NSUInteger, RLMCreationOptions);
-#endif
+@class RLMObjectSchema, RLMProperty, RLMObjectBase;
 
 
 NS_ASSUME_NONNULL_BEGIN
 NS_ASSUME_NONNULL_BEGIN
 
 
@@ -45,7 +38,7 @@ FOUNDATION_EXTERN id __nullable RLMDynamicGet(RLMObjectBase *obj, RLMProperty *p
 FOUNDATION_EXTERN id __nullable RLMDynamicGetByName(RLMObjectBase *obj, NSString *propName, bool asList);
 FOUNDATION_EXTERN id __nullable RLMDynamicGetByName(RLMObjectBase *obj, NSString *propName, bool asList);
 
 
 // by property/column
 // by property/column
-void RLMDynamicSet(RLMObjectBase *obj, RLMProperty *prop, id val, RLMCreationOptions options);
+void RLMDynamicSet(RLMObjectBase *obj, RLMProperty *prop, id val);
 
 
 //
 //
 // Class modification
 // Class modification

+ 2 - 18
Libraries external/Realm/Realm.framework/PrivateHeaders/RLMObjectStore.h

@@ -34,23 +34,6 @@ NS_ASSUME_NONNULL_BEGIN
 void RLMRealmCreateAccessors(RLMSchema *schema);
 void RLMRealmCreateAccessors(RLMSchema *schema);
 
 
 
 
-//
-// Options for object creation
-//
-typedef NS_OPTIONS(NSUInteger, RLMCreationOptions) {
-    // Normal object creation
-    RLMCreationOptionsNone = 0,
-    // If the property is a link or array property, upsert the linked objects
-    // if they have a primary key, and insert them otherwise.
-    RLMCreationOptionsCreateOrUpdate = 1 << 0,
-    // Allow unmanaged objects to be promoted to managed objects
-    // if false objects are copied during object creation
-    RLMCreationOptionsPromoteUnmanaged = 1 << 1,
-    // Use the SetDefault instruction.
-    RLMCreationOptionsSetDefault = 1 << 2,
-};
-
-
 //
 //
 // Adding, Removing, Getting Objects
 // Adding, Removing, Getting Objects
 //
 //
@@ -72,7 +55,8 @@ NS_RETURNS_RETAINED;
 id _Nullable RLMGetObject(RLMRealm *realm, NSString *objectClassName, id _Nullable key) NS_RETURNS_RETAINED;
 id _Nullable RLMGetObject(RLMRealm *realm, NSString *objectClassName, id _Nullable key) NS_RETURNS_RETAINED;
 
 
 // create object from array or dictionary
 // create object from array or dictionary
-RLMObjectBase *RLMCreateObjectInRealmWithValue(RLMRealm *realm, NSString *className, id _Nullable value, bool createOrUpdate)
+RLMObjectBase *RLMCreateObjectInRealmWithValue(RLMRealm *realm, NSString *className,
+                                               id _Nullable value, bool createOrUpdate)
 NS_RETURNS_RETAINED;
 NS_RETURNS_RETAINED;
     
     
 
 

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

@@ -23,7 +23,7 @@
 NS_ASSUME_NONNULL_BEGIN
 NS_ASSUME_NONNULL_BEGIN
 
 
 // Disable syncing files to disk. Cannot be re-enabled. Use only for tests.
 // Disable syncing files to disk. Cannot be re-enabled. Use only for tests.
-FOUNDATION_EXTERN void RLMDisableSyncToDisk();
+FOUNDATION_EXTERN void RLMDisableSyncToDisk(void);
 
 
 FOUNDATION_EXTERN NSData * _Nullable RLMRealmValidatedEncryptionKey(NSData *key);
 FOUNDATION_EXTERN NSData * _Nullable RLMRealmValidatedEncryptionKey(NSData *key);
 
 

BIN
Libraries external/Realm/Realm.framework/Realm


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

@@ -149,8 +149,8 @@ typedef unsigned int swift_uint4  __attribute__((__ext_vector_type__(4)));
 /// You then instantiate and use your custom subclasses instead of using the <code>Object</code> class directly.
 /// You then instantiate and use your custom subclasses instead of using the <code>Object</code> class directly.
 /// \code
 /// \code
 /// class Dog: Object {
 /// class Dog: Object {
-///     dynamic var name: String = ""
-///     dynamic var adopted: Bool = false
+///     @objc dynamic var name: String = ""
+///     @objc dynamic var adopted: Bool = false
 ///     let siblings = List<Dog>()
 ///     let siblings = List<Dog>()
 /// }
 /// }
 ///
 ///
@@ -194,7 +194,7 @@ typedef unsigned int swift_uint4  __attribute__((__ext_vector_type__(4)));
 /// <code>Int</code>, <code>Int8</code>, <code>Int16</code>, <code>Int32</code>, <code>Int64</code>, <code>Float</code>, <code>Double</code>, <code>Bool</code>, and <code>List</code> properties cannot. To store an optional
 /// <code>Int</code>, <code>Int8</code>, <code>Int16</code>, <code>Int32</code>, <code>Int64</code>, <code>Float</code>, <code>Double</code>, <code>Bool</code>, and <code>List</code> properties cannot. To store an optional
 /// number, use <code>RealmOptional<Int></code>, <code>RealmOptional<Float></code>, <code>RealmOptional<Double></code>, or <code>RealmOptional<Bool></code> instead,
 /// number, use <code>RealmOptional<Int></code>, <code>RealmOptional<Float></code>, <code>RealmOptional<Double></code>, or <code>RealmOptional<Bool></code> instead,
 /// which wraps an optional numeric value.
 /// which wraps an optional numeric value.
-/// All property types except for <code>List</code> and <code>RealmOptional</code> <em>must</em> be declared as <code>dynamic var</code>. <code>List</code> and
+/// All property types except for <code>List</code> and <code>RealmOptional</code> <em>must</em> be declared as <code>@objc dynamic var</code>. <code>List</code> and
 /// <code>RealmOptional</code> properties must be declared as non-dynamic <code>let</code> properties. Swift <code>lazy</code> properties are not allowed.
 /// <code>RealmOptional</code> properties must be declared as non-dynamic <code>let</code> properties. Swift <code>lazy</code> properties are not allowed.
 /// Note that none of the restrictions listed above apply to properties that are configured to be ignored by Realm.
 /// Note that none of the restrictions listed above apply to properties that are configured to be ignored by Realm.
 /// <h3>Querying</h3>
 /// <h3>Querying</h3>
@@ -297,7 +297,7 @@ SWIFT_CLASS("_TtC10RealmSwift18LinkingObjectsBase")
 @property (nonatomic, readonly, copy) NSString * _Nonnull propertyName;
 @property (nonatomic, readonly, copy) NSString * _Nonnull propertyName;
 @property (nonatomic, readonly, strong) RLMResults<RLMObject *> * _Nonnull rlmResults;
 @property (nonatomic, readonly, strong) RLMResults<RLMObject *> * _Nonnull rlmResults;
 - (nonnull instancetype)initFromClassName:(NSString * _Nonnull)objectClassName property:(NSString * _Nonnull)propertyName OBJC_DESIGNATED_INITIALIZER;
 - (nonnull instancetype)initFromClassName:(NSString * _Nonnull)objectClassName property:(NSString * _Nonnull)propertyName OBJC_DESIGNATED_INITIALIZER;
-- (NSInteger)countByEnumeratingWithState:(NSFastEnumerationState * _Nonnull)state objects:(id _Nullable * _Null_unspecified)buffer count:(NSInteger)len SWIFT_WARN_UNUSED_RESULT;
+- (NSInteger)countByEnumeratingWithState:(NSFastEnumerationState * _Nonnull)state objects:(id _Nullable * _Nonnull)buffer count:(NSInteger)len SWIFT_WARN_UNUSED_RESULT;
 - (nonnull instancetype)init SWIFT_UNAVAILABLE;
 - (nonnull instancetype)init SWIFT_UNAVAILABLE;
 @end
 @end
 
 

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


+ 20 - 0
iOSClient/Database/NCManageDatabase.swift

@@ -33,6 +33,26 @@ class NCManageDatabase: NSObject {
     override init() {
     override init() {
         
         
         let dirGroup = FileManager.default.containerURL(forSecurityApplicationGroupIdentifier: NCBrandOptions.sharedInstance.capabilitiesGroups)
         let dirGroup = FileManager.default.containerURL(forSecurityApplicationGroupIdentifier: NCBrandOptions.sharedInstance.capabilitiesGroups)
+        
+        let configCompact = Realm.Configuration(
+            
+            fileURL: dirGroup?.appendingPathComponent("\(appDatabaseNextcloud)/\(k_databaseDefault)"),
+            
+            shouldCompactOnLaunch: { totalBytes, usedBytes in
+            // totalBytes refers to the size of the file on disk in bytes (data + free space)
+            // usedBytes refers to the number of bytes used by data in the file
+            
+            // Compact if the file is over 100MB in size and less than 50% 'used'
+            let oneHundredMB = 100 * 1024 * 1024
+            return (totalBytes > oneHundredMB) && (Double(usedBytes) / Double(totalBytes)) < 0.5
+        })
+        do {
+            // Realm is compacted on the first open if the configuration block conditions were met.
+            _ = try Realm(configuration: configCompact)
+        } catch {
+            // handle error compacting or opening Realm
+        }
+        
         let config = Realm.Configuration(
         let config = Realm.Configuration(
         
         
             fileURL: dirGroup?.appendingPathComponent("\(appDatabaseNextcloud)/\(k_databaseDefault)"),
             fileURL: dirGroup?.appendingPathComponent("\(appDatabaseNextcloud)/\(k_databaseDefault)"),