OfflineRequestManagerDelegate

protocol OfflineRequestManagerDelegate : AnyObject

Protocol for receiving callbacaks from OfflineRequestManager and reconfiguring a new OfflineRequestManager from dictionaries saved to disk in the case of previous requests that never completed

  • offlineRequest(withDictionary:) Default implementation

    Method that the delegate uses to generate OfflineRequest objects from dictionaries written to disk

    Default Implementation

    Declaration

    Swift

    func offlineRequest(withDictionary dictionary: [String : Any]) -> OfflineRequest?

    Parameters

    dictionary

    dictionary saved to disk associated with an unfinished request

    Return Value

    OfflineRequest object to be queued

  • Callback indicating the OfflineRequestManager’s current progress

    Default Implementation

    Declaration

    Swift

    func offlineRequestManager(_ manager: OfflineRequestManager, didUpdateProgress progress: Double)

    Parameters

    manager

    OfflineRequestManager instance

    progress

    current progress for all ongoing requests (ranges from 0 to 1)

  • Callback indicating the OfflineRequestManager’s current connection status

    Default Implementation

    Declaration

    Swift

    func offlineRequestManager(_ manager: OfflineRequestManager, didUpdateConnectionStatus connected: Bool)

    Parameters

    manager

    OfflineRequestManager instance

    connected

    value indicating whether there is currently connectivity

  • Callback that can be used to block a request attempt

    • manager: OfflineRequestManager instance
    • request: OfflineRequest to be performed

    Default Implementation

    Declaration

    Swift

    func offlineRequestManager(_ manager: OfflineRequestManager, shouldAttemptRequest request: OfflineRequest) -> Bool

    Return Value

    value indicating whether the OfflineRequestManager should move forward with the request attempt

  • Callback to reconfigure and reattempt an OfflineRequest after a failure not related to connectivity issues

    Default Implementation

    Declaration

    Swift

    func offlineRequestManager(_ manager: OfflineRequestManager, shouldReattemptRequest request: OfflineRequest, withError error: Error) -> Bool

    Parameters

    manager

    OfflineRequestManager instance

    request

    OfflineRequest that failed

    error

    NSError associated with the failure

    Return Value

    value indicating whether the OfflineRequestManager should reattempt the OfflineRequest action

  • Callback indicating that the OfflineRequest action has started

    Default Implementation

    Declaration

    Swift

    func offlineRequestManager(_ manager: OfflineRequestManager, didStartRequest request: OfflineRequest)

    Parameters

    manager

    OfflineRequestManager instance

    request

    OfflineRequest that started its action

  • Callback indicating that the OfflineRequest status has changed

    Declaration

    Swift

    func offlineRequestManager(_ manager: OfflineRequestManager, didUpdateRequest request: OfflineRequest)

    Parameters

    manager

    OfflineRequestManager instance

    request

    OfflineRequest that changed its subtitle

  • Callback indicating that the OfflineRequest action has successfully finished

    Default Implementation

    Declaration

    Swift

    func offlineRequestManager(_ manager: OfflineRequestManager, didFinishRequest request: OfflineRequest)

    Parameters

    manager

    OfflineRequestManager instance

    request

    OfflineRequest that finished its action

  • Callback indicating that the OfflineRequest action has failed for reasons unrelated to connectivity

    Default Implementation

    Declaration

    Swift

    func offlineRequestManager(_ manager: OfflineRequestManager, requestDidFail request: OfflineRequest, withError error: Error)

    Parameters

    manager

    OfflineRequestManager instance

    request

    OfflineRequest that failed

    error

    NSError associated with the failure