ZDCLocalUserManager

@interface ZDCLocalUserManager : NSObject

The LocalUserManager simplifies many aspects of determining sync state.

  • Returns non-nil if a ZDCLocalUser exists in the database. This is primarily useful for applications that support only a single logged-in user.

    Note

    If there are multiple logged in users, the returned localUser is not guaranteed to be consistent.

    Declaration

    Objective-C

    - (nullable ZDCLocalUser *)anyLocalUser:(id)transaction;

    Swift

    func anyLocalUser(_ transaction: Any!) -> ZDCLocalUser?
  • Returns a list of all localUserIDs. (localUserID == ZDCLocalUser.uuid)

    Declaration

    Objective-C

    - (nonnull NSArray<NSString *> *)allLocalUserIDs:(id)transaction;

    Swift

    func allLocalUserIDs(_ transaction: Any!) -> [String]
  • Declaration

    Objective-C

    - (nonnull NSArray<ZDCLocalUser *> *)allLocalUsers:(id)transaction;

    Swift

    func allLocalUsers(_ transaction: Any!) -> [ZDCLocalUser]
  • Enumerates all localUserID’s. (localUserID == ZDCLocalUser.uuid)

    Declaration

    Objective-C

    - (void)enumerateLocalUserIDsWithTransaction:(id)transaction
                                      usingBlock:(nonnull void (^)(
                                                     NSString *_Nonnull,
                                                     BOOL *_Nonnull))enumBlock;

    Swift

    func enumerateLocalUserIDs(withTransaction transaction: Any!, using enumBlock: @escaping (String, UnsafeMutablePointer<ObjCBool>) -> Void)
  • Enumerates all local users.

    Declaration

    Objective-C

    - (void)enumerateLocalUsersWithTransaction:(id)transaction
                                    usingBlock:
                                        (nonnull void (^)(ZDCLocalUser *_Nonnull,
                                                          BOOL *_Nonnull))enumBlock;

    Swift

    func enumerateLocalUsers(withTransaction transaction: Any!, using enumBlock: @escaping (ZDCLocalUser, UnsafeMutablePointer<ObjCBool>) -> Void)
  • Fully deletes the local user and all associated items.

    The following items will be deleted from the database:

    • ZDCLocalUser
    • Local user’s private key
    • Local user’s access key
    • Local user’s cached authentication
    • All treesystem ZDCNode’s
    • All queued ZDCCloudOperation’s

    Declaration

    Objective-C

    - (void)deleteLocalUser:(nonnull NSString *)localUserID
                transaction:(id)transaction;

    Swift

    func deleteLocalUser(_ localUserID: String, transaction: Any!)
  • Creates a local user from a JSON file.

    Declaration

    Objective-C

    - (nullable ZDCLocalUser *)
        createLocalUserFromJSON:(nonnull NSDictionary *)json
                    transaction:(id)transaction
                          error:(NSError *_Nullable *_Nullable)outError;

    Swift

    func createLocalUser(fromJSON json: [AnyHashable : Any], transaction: Any!) throws -> ZDCLocalUser

    Parameters

    json

    A dictionary that contains all the information necessary to create a localUser.

    transaction

    The database transaction in which to create the necessary objects

    outError

    If an error occurs, this will describe what went wrong