Iterable / swift-sdk

Iterable's iOS SDK. Receive and track pushes to Iterable from your iOS app.
https://iterable.com/
MIT License
86 stars 68 forks source link

Add OnSuccessHandler and OnFailureHandler to logoutUser() function #765

Open yungkienpoh-prestolabs opened 2 months ago

yungkienpoh-prestolabs commented 2 months ago

Hi, I noticed in logoutUser() function, there are no OnSuccessHandler and OnFailureHandler parameters for us to handle the cases where calling disableDevice API returns error. disableDeviceForCurrentUser already has these 2 parameters for handling such case. So, my request is to add these 2 parameters to logoutUser() and logoutPreviousUser() function, so that we can handle the error cases when logging out the user.

The end result should be something like this:

func logoutUser(withOnSuccess onSuccess: OnSuccessHandler? = nil, onFailure: OnFailureHandler? = nil) {
    logoutPreviousUser(withOnSuccess: onSuccess, onFailure: onFailure)
}
private func logoutPreviousUser(withOnSuccess onSuccess: OnSuccessHandler? = nil, onFailure: OnFailureHandler? = nil) {
    ...
    if config.autoPushRegistration {
        disableDeviceForCurrentUser(withOnSuccess: onSuccess, onFailure: onFailure)
    }
    ...
}
jena-chakour commented 2 months ago

Hi @yungkienpoh-prestolabs thanks for surfacing this! Our team will take this into consideration for future work :)