ZDCUITools

@interface ZDCUITools : NSObject

The ZDCUITools is a series of functions that simpily the user interface needed for creating, signing-in and managing ZDCLocalUsers

  • Returns a UIViewController that can be used for sign-in & sign-up.

    It walks users through the processing of either:

    • logging-in & restoring their private key
    • creating a new account

    Declaration

    Objective-C

    - (nonnull ZDCAccountSetupViewControllerProxy *)
        accountSetupViewControllerWithInitialViewController:
            (UIViewController *_Nullable)viewController
                                canDismissWithoutNewAccount:(BOOL)canDismiss
                                          completionHandler:
                                              (accountSetupViewCompletionHandler _Nullable)
                                                  completionHandler;

    Swift

    func accountSetupViewController(withInitialViewController viewController: UIViewController?, canDismissWithoutNewAccount canDismiss: Bool, completionHandler: accountSetupViewCompletionHandler? = nil) -> ZDCAccountSetupViewControllerProxy

    Parameters

    viewController

    An optional initial view controler for app customization. This is the first screen that’s displayed. If nil, then a generic view is displayed with the app name (+ sign-in & sign-up buttons).

    canDismiss

    Indicates whether or not the user can dismiss the activation view before completing activation. Typically this is set to false if there aren’t other logged-in users, and the app requires a logged-in user to work properly.

    completionHandler

    Called once the user has completed interaction with the view controller. This is always called on the main thread.

  • return a UIViewController for resuming user activation

    Declaration

    Objective-C

    - (nonnull UIViewController *)
        accountResumeSetupForLocalUserID:(nonnull NSString *)localUserID
                       completionHandler:
                           (accountSetupViewCompletionHandler _Nullable)
                               completionHandler;

    Swift

    func accountResumeSetup(forLocalUserID localUserID: String, completionHandler: accountSetupViewCompletionHandler? = nil) -> UIViewController

    Parameters

    localUserID

    The localUser for which you’re interested (localUserID == ZDCLocalUser.uuid)

    completionHandler

    The completionHandler, to call once the user has completed it’s interaction

  • Push a UIViewController for managing a ZDCLocalUser settings.

    Declaration

    Objective-C

    - (void)pushSettingsForLocalUserID:(NSString *_Nonnull)localUserID
              withNavigationController:
                  (nonnull UINavigationController *)navigationController;

    Swift

    func pushSettings(forLocalUserID localUserID: String, with navigationController: UINavigationController)

    Parameters

    localUserID

    The localUser for which you’re interested (localUserID == ZDCLocalUser.uuid)

    navigationController

    The app bar navigation controller instance that owns the view controller.

  • Push a UIViewController for managing a ZDCLocalUser socialIDs

    Declaration

    Objective-C

    - (void)pushSocialIdMgmtWithUserID:(NSString *_Nonnull)userID
              withNavigationController:
                  (nonnull UINavigationController *)navigationController;

    Swift

    func pushSocialIdMgmt(withUserID userID: String, with navigationController: UINavigationController)

    Parameters

    userID

    The localUser for which you’re interested (localUserID == ZDCLocalUser.uuid)

    navigationController

    The app bar navigation controller instance that owns the view controller.

  • Push a UIViewController for backing up a ZDCLocalUser Access Key

    Declaration

    Objective-C

    - (void)pushBackupAccessForLocalUserID:(NSString *_Nonnull)localUserID
                  withNavigationController:
                      (nonnull UINavigationController *)navigationController;

    Swift

    func pushBackupAccess(forLocalUserID localUserID: String, with navigationController: UINavigationController)

    Parameters

    localUserID

    The localUser for which you’re interested (localUserID == ZDCLocalUser.uuid)

    navigationController

    The app bar navigation controller instance that owns the view controller.

  • Push a UIViewController for veriying up a ZDCLocalUser Public key

    Declaration

    Objective-C

    - (void)pushVerifyPublicKeyForUserID:(NSString *_Nonnull)userID
                             localUserID:(NSString *_Nonnull)localUserID
                withNavigationController:
                    (nonnull UINavigationController *)navigationController;

    Swift

    func pushVerifyPublicKey(forUserID userID: String, localUserID: String, with navigationController: UINavigationController)

    Parameters

    localUserID

    The localUser for which you’re interested (localUserID == ZDCLocalUser.uuid)

    navigationController

    The app bar navigation controller instance that owns the view controller.

  • Push a UIViewController for managing the list of users that an object is shared with.

    Declaration

    Objective-C

    - (void)pushSharedUsersViewForLocalUserID:(nonnull NSString *)localUserID
                                remoteUserIDs:
                                    (NSSet<NSString *> *_Nullable)remoteUserIDs
                                        title:(NSString *_Nullable)title
                         navigationController:
                             (nonnull UINavigationController *)navigationController
                            completionHandler:
                                (nonnull SharedUsersViewCompletionHandler)
                                    completionHandler;

    Swift

    func pushSharedUsersView(forLocalUserID localUserID: String, remoteUserIDs: Set<String>?, title: String?, navigationController: UINavigationController, completionHandler: @escaping SharedUsersViewCompletionHandler)

    Parameters

    localUserID

    The localUser for which you’re interested (localUserID == ZDCLocalUser.uuid)

    remoteUserIDs

    An array of userIDs that this node is currently shared with

    title

    An optional title for the view

    navigationController

    The app bar navigation controller instance that owns the view controller.

    completionHandler

    The completionHandler, to call once the user has completed it’s interaction

  • Push a UIViewController displaying syncing activity

    Declaration

    Objective-C

    - (void)pushActivityViewForLocalUserID:(NSString *_Nullable)localUserID
                  withNavigationController:
                      (nonnull UINavigationController *)navigationController;

    Swift

    func pushActivityView(forLocalUserID localUserID: String?, with navigationController: UINavigationController)

    Parameters

    localUserID

    The localUser for which you’re interested (localUserID == ZDCLocalUser.uuid) or null for all users.

    navigationController

    The app bar navigation controller instance that owns the view controller.

  • Delete the Refresh token for a given Local User. This will effectively log the user out and require them to reauthenticate. mostly this is useful for debugging. and you would never do this.

    *

    Declaration

    Objective-C

    - (void)deleteRefreshTokenforUserID:(nonnull NSString *)localUserID
                        completionBlock:(dispatch_block_t _Nullable)completionBlock;

    Swift

    func deleteRefreshTokenforUserID(_ localUserID: String, completionBlock: (() -> Void)? = nil)

    Parameters

    localUserID

    The localUser for which you’re interested (localUserID == ZDCLocalUser.uuid)

    completionBlock

    The completionHandler, to call once the token is removed from the database

  • return a UIViewController for that simulates push notifcations for debugging

    Declaration

    Objective-C

    - (UIViewController *_Nullable)simulatePushNotificationViewController;

    Swift

    func simulatePushNotificationViewController() -> UIViewController?