Open matejbart opened 3 years ago
Thanks! The migration plans sound plausible and I think we should discuss them in a meeting. I have answered your general questions inline:
Some general open questions that are unanswered:
1. What happens with the document, if an upload has succeeded? Can it be uploaded twice or should this be restricted?
No, I think we should prevent a duplicate upload.
- After a successful upload, should it be possible to add new images and re-upload the same document again? Yes, it should be possible to re-upload the document again.
- Is it ok, to "lock" the document until the images are uploaded? This would probably prevent some weird states, where a big upload is ongoing and the user starts to delete/modify or add new images. I guess it is OK, but then it should be possible to cancel the current upload, because otherwise the user cannot take new pictures until a big upload is finished.
- If the user would logout and then re-login (let's assume with another account) should the document/data be still marked as uploaded? I think it would be better to clear then the upload information and it should be marked as not uploaded.
- Is it ok to drop the currently unused
isFocused
flag for pages/document? Definitely, this is legacy code.- Is there anything else to maybe also consider at the migration? (Like adding new fields for e.g. using a new API) I do not think so.
- Is there any specific reason why some image related data has been saved in the image file itself and not in the json? Like the cropping points etc. Would it be ok to move this into the DB? And if necessary, incorporate it into the files only for the export? The reason is that we wanted to make this data also usable in Transkribus, but it has not been used there. So basically it is OK. However, I would always save Exif orientation in the images itself and not in the DB, because otherwise the images will not be rotated correctly in other applications (image viewers, Transkribus).
As already mentioned, the bottom navigation is maybe not the best approach for the document viewer, because those fragments should be independent (data) from each other. However, the images fragment always depends on the selection of the document which is shown before - there will be always the problem when the active document is deleted and then the user navigates to the images fragment in the bottom nav. Is there maybe a possibility to re-work this?
- I could imagine to use only two bottom nav fragments, documents and exports (currently PDFs), when the user selects a document, the images fragment will be hierarchly shown in a new activity.
- The navigation drawer could be also dropped, and maybe replaced by a third fragment called "More" where everything else is listed. The drawer from the camera activity is not really necessary, because the document viewer can be still accessed and the settings could be extended so that every previous use-case is covered. It is possible yes, but I think this should be done at a future point.
The main task is to migrate the existing json data into an android room database, some main reasons of performing this task:
Flow
s if manipulated exif data is saved in the DB.DocumentStorage
,SyncFile
andSyncStorage
are somehow very hard to maintain, they need to be updated manually and there is clearly a missing single-source of truth.-1
.The migration steps:
Document
(which then consists of oneMetaData
and multiplePage
s).Flow
support, the main advantage is that whenever something changes in the DB, the currently instantiated flows would emit the new data and all associated UI would update. There is no need to do this manually anymore. If for example, background jobs are used for uploading, then the uploaded state can be saved in the DB and when the file is uploaded the view would be updated, there is no need for a broadcastReceiver with intents to inform the UI./documents/documentId/imageId
, so by dropping the whole documentId folder all associated images can be also removed recursively.DocumentMigrator
would be entirely dropped.Some general open questions that are unanswered:
isFocused
flag for pages/document?