PTBaseCollaborationManager


@interface PTBaseCollaborationManager : NSObject

The PTBaseCollaborationManager is an abstract base class that is responsible for sending local annotation changes to a remote server, and for receiving remote changes from the server.

  • Initializes a newly created PTBaseCollaborationManager instance.

    Declaration

    Objective-C

    - (nonnull instancetype)initWithToolManager:(nonnull PTToolManager *)toolManager
                                         userId:(nonnull NSString *)userId;

    Swift

    init(toolManager: PTToolManager, userId: String)

    Parameters

    toolManager

    The tool manager that this object uses to register for annotation change events that occur locally, and to push back changes that happen remotely (via its annotManager).

    userId

    The identifier for the current collaboration user.

    Return Value

    an initialized PTBaseCollaborationManager instance.

  • The tool manager used by this object to receive local annotation change events.

    Declaration

    Objective-C

    @property (nonatomic, strong, readonly) PTToolManager *_Nonnull toolManager;

    Swift

    var toolManager: PTToolManager { get }
  • The annotation manager used by this object.

    Declaration

    Objective-C

    @property (nonatomic, strong, readwrite)
        PTAnnotationManager *_Nonnull annotationManager;

    Swift

    var annotationManager: PTAnnotationManager { get set }
  • Call this method to load an initial remote annotation. This should generally be done immediately after the document itself is loaded.

    Declaration

    Objective-C

    - (void)loadInitialRemoteAnnotation:
        (nonnull PTCollaborationAnnotation *)collaborationAnnotation;

    Swift

    func loadInitialRemoteAnnotation(_ collaborationAnnotation: PTCollaborationAnnotation)

    Parameters

    collaborationAnnotation

    an object representing the collaboration annotation.

  • Call this method to load a list of initial remote annotations. This should generally be done immediately after the document itself is loaded.

    Declaration

    Objective-C

    - (void)loadInitialRemoteAnnotations:
        (nonnull NSArray<PTCollaborationAnnotation *> *)collaborationAnnotations;

    Swift

    func loadInitialRemoteAnnotations(_ collaborationAnnotations: [PTCollaborationAnnotation])

    Parameters

    collaborationAnnotations

    an array of objects representing the collaboration annotations.

  • Imports the annotations specified by the XFDF string. The imported annotations are considered to be part of the initial set of annotations.

    Declaration

    Objective-C

    - (void)importAnnotationsWithXFDFString:(nonnull NSString *)xfdfString;

    Swift

    func importAnnotations(withXFDFString xfdfString: String)

    Parameters

    xfdfString

    the XFDF string to import

  • Imports the annotations specified by the XFDF string.

    Declaration

    Objective-C

    - (void)importAnnotationsWithXFDFString:(nonnull NSString *)xfdfString
                                  isInitial:(BOOL)isInitial;

    Swift

    func importAnnotations(withXFDFString xfdfString: String, isInitial: Bool)

    Parameters

    xfdfString

    the XFDF string to import

    isInitial

    whether the imported annotations should be considered to be part of the initial set of annotations.

  • Imports the annotations specified by the XFDF command string. The command string can contain , , and tags. The imported annotations are considered to be part of the initial set of annotations.

    Declaration

    Objective-C

    - (void)importAnnotationsWithXFDFCommand:(nonnull NSString *)xfdfCommand;

    Swift

    func importAnnotations(withXFDFCommand xfdfCommand: String)

    Parameters

    xfdfCommand

    the XFDF command string to import

  • Imports the annotations specified by the XFDF command string. The command string can contain , , and tags.

    Declaration

    Objective-C

    - (void)importAnnotationsWithXFDFCommand:(nonnull NSString *)xfdfCommand
                                   isInitial:(BOOL)isInitial;

    Swift

    func importAnnotations(withXFDFCommand xfdfCommand: String, isInitial: Bool)

    Parameters

    xfdfCommand

    the XFDF command string to import

    isInitial

    whether the imported annotations should be considered to be part of the initial set of annotations.

  • Call this method to communicate a change that occured remotely that needs to be reflected on the device.

    Declaration

    Objective-C

    - (void)remoteAnnotationAdded:
        (nonnull PTCollaborationAnnotation *)collaborationAnnotation;

    Swift

    func remoteAnnotationAdded(_ collaborationAnnotation: PTCollaborationAnnotation)

    Parameters

    collaborationAnnotation

    an object representing the collaboration annotation.

  • Call this method to communicate a change that occured remotely that needs to be reflected on the device.

    Declaration

    Objective-C

    - (void)remoteAnnotationsAdded:
        (nonnull NSArray<PTCollaborationAnnotation *> *)collaborationAnnotations;

    Swift

    func remoteAnnotationsAdded(_ collaborationAnnotations: [PTCollaborationAnnotation])

    Parameters

    collaborationAnnotations

    an array of objects representing the collaboration annotations.

  • Call this method to communicate a change that occured remotely that needs to be reflected on the device.

    Declaration

    Objective-C

    - (void)remoteAnnotationModified:
        (nonnull PTCollaborationAnnotation *)collaborationAnnotation;

    Swift

    func remoteAnnotationModified(_ collaborationAnnotation: PTCollaborationAnnotation)

    Parameters

    collaborationAnnotation

    an object representing the collaboration annotation.

  • Call this method to communicate a change that occured remotely that needs to be reflected on the device.

    Declaration

    Objective-C

    - (void)remoteAnnotationsModified:
        (nonnull NSArray<PTCollaborationAnnotation *> *)collaborationAnnotations;

    Swift

    func remoteAnnotationsModified(_ collaborationAnnotations: [PTCollaborationAnnotation])

    Parameters

    collaborationAnnotations

    an array of objects representing the collaboration annotations.

  • Call this method to communicate a change that occured remotely that needs to be reflected on the device.

    Declaration

    Objective-C

    - (void)remoteAnnotationRemoved:
        (nonnull PTCollaborationAnnotation *)collaborationAnnotation;

    Swift

    func remoteAnnotationRemoved(_ collaborationAnnotation: PTCollaborationAnnotation)

    Parameters

    collaborationAnnotation

    an object representing the collaboration annotation.

  • Call this method to communicate a change that occured remotely that needs to be reflected on the device.

    Declaration

    Objective-C

    - (void)remoteAnnotationsRemoved:
        (nonnull NSArray<PTCollaborationAnnotation *> *)collaborationAnnotations;

    Swift

    func remoteAnnotationsRemoved(_ collaborationAnnotations: [PTCollaborationAnnotation])

    Parameters

    collaborationAnnotations

    an array of objects representing the collaboration annotations.

  • Establishes a “connection” between the collaboration manager, that sends local changes to and receives remote changes from the communicationComponent.

    Declaration

    Objective-C

    - (void)registerServerCommunicationComponent:
        (nonnull id<PTCollaborationServerCommunication>)communicationComponent;

    Swift

    func registerServerCommunicationComponent(_ communicationComponent: PTCollaborationServerCommunication)

    Parameters

    communicationComponent

    The object that the collaboration manager uses to inform the server that a local change occured, and likewise is used by the communicationComponent to inform the device that a remote change occured.

  • De-registers the service

    Declaration

    Objective-C

    - (void)deRegisterServerCommunicationComponent;

    Swift

    func deRegisterServerCommunicationComponent()
  • Called when a local annotation has been added. Subclasses can override this method to perform additional actions such as ensuring that the result returned from -GetLastXFDFCommand reflects this annotation change.

    Declaration

    Objective-C

    - (void)didAddlocalAnnotation:(nonnull PTAnnot *)annotation
                     onPageNumber:(int)pageNumber;

    Swift

    func didAddlocalAnnotation(_ annotation: PTAnnot, onPageNumber pageNumber: Int32)

    Parameters

    annotation

    the annotation that was added

    pageNumber

    the page number of the annotation

  • Called when a local annotation will be modified. Subclasses can override this method to perform additional actions such as ensuring that the result returned from -GetLastXFDFCommand reflects this annotation change.

    Declaration

    Objective-C

    - (void)willModifyLocalAnnotation:(nonnull PTAnnot *)annotation
                         onPageNumber:(int)pageNumber;

    Swift

    func willModifyLocalAnnotation(_ annotation: PTAnnot, onPageNumber pageNumber: Int32)

    Parameters

    annotation

    the annotation that will be modified

    pageNumber

    the page number of the annotation

  • Called when a local annotation has been modified. Subclasses can override this method to perform additional actions such as ensuring that the result returned from -GetLastXFDFCommand reflects this annotation change.

    Declaration

    Objective-C

    - (void)didModifyLocalAnnotation:(nonnull PTAnnot *)annotation
                        onPageNumber:(int)pageNumber;

    Swift

    func didModifyLocalAnnotation(_ annotation: PTAnnot, onPageNumber pageNumber: Int32)

    Parameters

    annotation

    the annotation that was modified

    pageNumber

    the page number of the annotation

  • Called when a local annotation will be removed from the document. Subclasses can override this method to perform additional actions such as ensuring that the result returned from -GetLastXFDFCommand reflects this annotation change.

    Declaration

    Objective-C

    - (void)willRemoveLocalAnnotation:(nonnull PTAnnot *)annotation
                         onPageNumber:(int)pageNumber;

    Swift

    func willRemoveLocalAnnotation(_ annotation: PTAnnot, onPageNumber pageNumber: Int32)

    Parameters

    annotation

    the annotation that will be removed from the document

    pageNumber

    the page number of the annotation

  • Called when a local annotation has been removed. Subclasses can override this method to perform additional actions such as ensuring that the result returned from -GetLastXFDFCommand reflects this annotation change.

    Declaration

    Objective-C

    - (void)didRemoveLocalAnnotation:(nonnull PTAnnot *)annotation
                        onPageNumber:(int)pageNumber;

    Swift

    func didRemoveLocalAnnotation(_ annotation: PTAnnot, onPageNumber pageNumber: Int32)

    Parameters

    annotation

    the annotation that was removed from the document

    pageNumber

    the page number of the annotation

  • Retrieve the last XFDF command string produced by the last local annotation change (annotation add, modify, or remove).

    Note

    Subclasses must override this method and return an appropriate result.

    Declaration

    Objective-C

    - (nullable NSString *)GetLastXFDFCommand;

    Swift

    func getLastXFDFCommand() -> String?
  • Retrieve the last XFDF command string produced by the last local annotation change (annotation add, modify, or remove).

    @deprecated

    Declaration

    Objective-C

    - (nullable NSString *)GetLastXFDF;

    Swift

    func getLastXFDF() -> String?
  • Merges the given XFDF string into the document. For the purposes of annotation replies/ comments, the merged annotations are all considered to be marked as “read”.

    Note

    Subclasses must override this method to provide an implementation. Calling super is not required.

    Declaration

    Objective-C

    - (void)mergeInitialXFDFString:(nonnull NSString *)xfdfString;

    Swift

    func mergeInitialXFDFString(_ xfdfString: String)

    Parameters

    xfdfString

    the XFDF string to be merged into the document.

  • Merges the given XFDF string into the document.

    Note

    Subclasses must override this method to provide an implementation. Calling super is not required.

    Declaration

    Objective-C

    - (void)mergeXFDFString:(nonnull NSString *)xfdfString;

    Swift

    func mergeXFDFString(_ xfdfString: String)

    Parameters

    xfdfString

    the XFDF string to be merged into the document.

  • Merges the given XFDF command string into the document. For the purposes of annotation replies/ comments, the merged annotations are all considered to be marked as “read”.

    Note

    Subclasses must override this method to provide an implementation. Calling super is not required.

    Declaration

    Objective-C

    - (void)mergeInitialXFDFCommand:(nonnull NSString *)xfdfCommand;

    Swift

    func mergeInitialXFDFCommand(_ xfdfCommand: String)

    Parameters

    xfdfCommand

    the XFDF command string to be merged into the document

  • Merges the given XFDF command string into the document.

    Note

    Subclasses must override this method to provide an implementation. Calling super is not required.

    Declaration

    Objective-C

    - (void)mergeXFDFCommand:(nonnull NSString *)xfdfCommand;

    Swift

    func mergeXFDFCommand(_ xfdfCommand: String)

    Parameters

    xfdfCommand

    the XFDF command string to be merged into the document

  • Exports all local and remote annotations as an XFDF string.

    Note

    Subclasses must override this method to provide an implementation. Calling super is not required.

    Declaration

    Objective-C

    - (nullable NSString *)exportXFDFStringWithError:
        (NSError *_Nullable *_Nullable)error;

    Swift

    func exportXFDFString() throws -> String

    Parameters

    error

    On input, a pointer to an error object. If an error occurs , this pointer is set to an actual error object containing the error information. You may specify nil for this parameter if you do not want the error information.

    Return Value

    an XFDF string containing all local and remote annotations, or nil if an error occurred