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 implementationMethod 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
-
offlineRequestManager(_:didUpdateProgress:)
Default implementationCallback 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)
-
offlineRequestManager(_:didUpdateConnectionStatus:)
Default implementationCallback 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
-
offlineRequestManager(_:shouldAttemptRequest:)
Default implementationCallback 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
-
offlineRequestManager(_:shouldReattemptRequest:withError:)
Default implementationCallback 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
-
offlineRequestManager(_:didStartRequest:)
Default implementationCallback 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
-
offlineRequestManager(_:didFinishRequest:)
Default implementationCallback 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
-
offlineRequestManager(_:requestDidFail:withError:)
Default implementationCallback 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