RRCaptureContentUploader

Objective-C

@interface RRCaptureContentUploader : NSObject

Swift

class RRCaptureContentUploader : NSObject

A class providing upload functionality for captured content. The data gets uploaded to the content service.

  • RRCaptureContentUploader delegate methods—defined by the RRCaptureContentUploaderDelegate protocol—allow an object to receive callbacks regarding the success or failure of an operation and progress from uploader as it occurs.

    Declaration

    Objective-C

    @property (nonatomic, weak) id<RRCaptureContentUploaderDelegate> _Nullable delegate;

    Swift

    weak var delegate: RRCaptureContentUploaderDelegate? { get set }
  • Initializer based on an RRContentUploadAPIConfig instance.

    Declaration

    Objective-C

    - (instancetype _Nonnull)initWithConfig:
        (RRContentUploadAPIConfig *_Nonnull)config;

    Swift

    init(config: RRContentUploadAPIConfig)

    Parameters

    config

    The configuration that should be used for uploading the captured content.

  • The RRCaptureContentUploader class manages the execution of upload operations. Before upload operation begin executing, class uploader will create product and configuration for the capture session using content service base on RRCaptureUploadInfo and RRCapturePhotos metadata. Operation objects (defined by the RRCaptureUploadPhotoOperation class) are added to a queue and remain there until they are explicitly cancelled or finish executing. It also has a quota for retry attempts, which if exceeded will entail -didFailWithError() delegate call at the same time it will store unsuccessful images into disk for the future upload

    Declaration

    Objective-C

    - (void)upload:(NSArray<RRUploadFile *> *_Nonnull)files
          withInfo:(RRCaptureUploadInfo *_Nonnull)info;

    Swift

    func upload(_ files: [RRUploadFile], with info: RRCaptureUploadInfo)

    Parameters

    files

    captured files collection

    info

    captured product metadata

  • Set a configuration to ready for processing. Is called by the customer after providing all of the necessary raw data

    Declaration

    Objective-C

    - (void)setUploadFinishedForConfiguration:(NSString *_Nonnull)identifier;

    Swift

    func setUploadFinishedForConfiguration(_ identifier: String)

    Parameters

    identifier

    configuration unique id

  • Call this action to cancel the latest upload files session with cleaning local directory

    Declaration

    Objective-C

    - (void)cancelLatestCleaningLocalFiles:(BOOL)cleanFiles;

    Swift

    func cancelLatestCleaningLocalFiles(_ cleanFiles: Bool)

    Parameters

    cleanFiles

    flag signalizing whether content uploader should clean directory for deffered upload

  • Detect whether any unfinished upload session is present on disk

    Declaration

    Objective-C

    + (BOOL)hasUnfinishedUploads;

    Swift

    class func hasUnfinishedUploads() -> Bool

    Return Value

    flag defining whether you have unsuccessfull uploads

  • Restores latest unsuccessful session RRCapturePhotos and retries uploading it.

    Declaration

    Objective-C

    - (void)tryUploadPreviousSessionFiles;

    Swift

    func tryUploadPreviousSessionFiles()
  • Clear all persisted metadata information as well as erases photos for deferred upload from disk

    Declaration

    Objective-C

    + (void)resetAllUnfinishedUploads;

    Swift

    class func resetAllUnfinishedUploads()