During a document scan, the mobile operating system can kill the mespapiers webview if the phone is on low memory. When the document scan end, the flagship app detect that mespapiers has been killed and start it again from scratch. So we loose everything we did on the form and we loose the scan.
So here we make it more resilient by :
remembering before a document scan the state of the form browser side
remembering after a document scan the result of the scan native side
when mespapiers is started, mespapiers can check if it needs to restore a form with the data from 1. and 2. to go back to the paper creation modal as if nothing happened :tada:
During a document scan, the mobile operating system can kill the mespapiers webview if the phone is on low memory. When the document scan end, the flagship app detect that mespapiers has been killed and start it again from scratch. So we loose everything we did on the form and we loose the scan.
So here we make it more resilient by :
Linked PR on cozy-flagship-app : https://github.com/cozy/cozy-flagship-app/pull/1208
See it in action (a click on "Cancel" simulate a successful scan in the iOS simulator)
https://github.com/cozy/cozy-libs/assets/10849491/09eed2bc-f5c6-4554-b1c9-aa8305eacc63
Todo