Fork me on GitHub
#cljsrn
<
2021-03-18
>
zendevil.eth17:03:23

In my rn app, I have making a http-xhrio request in a re-frame event handler that uploads a video to the server like so:

(reg-event-fx
 :upload-video
 (fn [{:keys [db] :as cofx} [_ video-body navigation]]
   {:http-xhrio {:method :post
                 :progress-handler #(dispatch [:upload-progress %])
                 :uri (str server-uri "/api/upload-video")
                 :body video-body
                 :on-success [:upload-success navigation]
                 :on-failure [:upload-error navigation]
                 :format (json-request-format)
                 :response-format (raw-response-format)}
    }))
The problem I’m encountering is that when I close the app (run it in the background), the :upload-error event is being triggered. This means that the upload is terminating when the app is left to be run in the background. However, I want the uploading the continue when the app is running in the background. Are there any libraries to achieve this?

zendevil.eth17:03:27

also I’m looking for support for both for iOS (preferred) and android