<div dir="ltr"><div>Following email contains proposition for new RainCatcher functionality.<br>Contents of this email will be also moved to public jira and open for discussion.</div><div><b><br></b></div><div><b>Introduction </b><br></div><div><br></div><div>RainCatcher users can build processes using steps. </div><div>When working with the steps results are saved as JSON file in workorders.</div><div><br>There are some situations when saving data in JSON format may not be efficient. <br>For example binary files like images/pdfs needs to be encoded and can lead to really big JSON payloads.<br><br><b>Top Level Functionality</b></div><div><br>RainCatcher as solution should support file (initially photos only) upload that can be used when building steps.<br>Developers should be able to build their steps that can interact with the files. </div><div>Server side should support file storage using interface - storage agnostic.</div><div><br></div><div><img src="cid:ii_15f110920aaf060b" alt="Inline image 1" width="562" height="335"><br></div><div><br></div><div><br></div><div><br></div><div>App flow</div><div><br></div><div>1. Step can use client api to create photo requests.</div><div>2. As result client is calling camera plugin and photo is stored in local storage.</div><div>3. Step retrieves link to local file that contains image </div><div><br></div><div>File Sync flow<br></div><div><br>1. All files that are created are put on sync queue. </div><div>Queue supports two types of sync (syncing local file, fetching file from server)</div><div>2.1 When online, files are synced to server</div><div>2.2 When online, files are fetched from server. Step is notified and retrieves link to new file.</div><div>3. When offline queue is holding reference.</div><div>Queue needs to be persisted to survive application restarts.</div><div><br></div><div>Note: Sync implementation will not use FeedHenry Sync.</div><div><br></div><div><b>Client side support</b><br></div><div><br>Client side (plain javascript) will contain queue implementation that will interact with the cordova network state plugin.</div><div>Queue will hold references to local file and sync them when online.</div><div>Client will interact with the cordova camera plugin. </div><div>Client will be available as separate npm module that can be required by any step implementation.</div><div><br></div><div><b>Server side support</b></div><div><b><br></b></div><div>New module that will expose file upload/download api.</div><div><br></div><div>Proposed api endpoints</div><div><br></div><div><i>GET /api/files/{ID}</i> - retrieve specific file</div><div><i>POST /api/files</i> - create file</div><div><br></div><div>Endpoints will be used by client to sync needed files</div><div><b><br></b></div><div><b>Functional requirements</b><br><br>Both client and server should be configurable:</div><div><br></div><div>- supporting different storage locations and other cordova parameters like thumbnails support etc.</div><div>- supporting different storage engines on the server (interface)</div><div><br></div><div><b>Examples</b></div><div><br></div><div>Example step will be provided that will implement file sync functionality</div><div><b><br></b></div><div><b>Relation to Beta Version functionality</b></div><div><br></div><div>Provided API in beta was missing required functionalities like full offline support, configurable authentication etc.<br></div><div>With that in mind I personally suggest to not reuse any of the functionalities from previous versions. </div><div><br><b>Notes</b><br><br>As this functionality is not WFM specific I suggest to done it in the way so it will be reusable by others who wants to implement Cordova offline file sync.</div><div><br></div><div>Regards</div><div><br></div>-- <br><div class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div style="font-size:12.8px"><p style="color:rgb(0,0,0);font-family:overpass,sans-serif;font-weight:bold;margin:0px;padding:0px;font-size:14px;text-transform:uppercase"><span>WOJCIECH</span> <span>TROCKI</span></p><p style="font-family:overpass,sans-serif;margin:0px;font-size:10px;color:rgb(153,153,153)"><a href="https://www.redhat.com/" style="color:rgb(0,136,206);margin:0px;text-decoration:none" target="_blank">Red Hat <span>Mobile</span></a></p><p style="font-family:overpass,sans-serif;margin:0px 0px 6px;font-size:10px;color:rgb(153,153,153)"><span>IM: <span>wtrocki</span></span></p><table border="0" style="color:rgb(0,0,0);font-family:overpass,sans-serif;font-size:medium"><tbody><tr><td width="100px"><a href="https://red.ht/sig" target="_blank"><img src="https://www.redhat.com/files/brand/email/sig-redhat.png" width="90" height="auto"></a></td></tr></tbody></table></div></div></div></div></div></div></div></div></div>
</div>