-
-
Notifications
You must be signed in to change notification settings - Fork 27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Auto-Save Form on Pause #2802
Auto-Save Form on Pause #2802
Conversation
public String getSerializedFormIndex() { | ||
try{ | ||
byte[] serializedFormIndex = SerializationUtil.serialize(getFormIndex()); | ||
return Base64.encodeToString(serializedFormIndex, Base64.DEFAULT); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can the value for Base64.DEFAULT
change with OS updates ? If so, I would like to pass a concrete encoding here like Charset.forName("UTF-8")
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's a good point, I'm not sure, let's lean to the safe side (but I will take note and look into that later)
byte[] serializedFormIndex = SerializationUtil.serialize(getFormIndex()); | ||
return Base64.encodeToString(serializedFormIndex, Base64.DEFAULT); | ||
} catch (Exception e){ | ||
return null; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Think it's better to fail fast here instead of swallowing the errors here unless there is a strong reason to do otherwise. At the very least we should be logging the exceptions encountered here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually think again it makes sense to catch any errors here as we would not want to loose on saving form because of an error here.
53033e5
to
40789ed
Compare
40789ed
to
cff229f
Compare
Summary
Context Doc
Feature Flag
None at the moment, will be behind a custom property when merged to
master
Product Description
Auto-Saves a CC form when CC goes in background
Safety Assurance
Automated test coverage
None
Safety story
We call an existing method we already use to save form session at the time of user session expiry
cross-request: dimagi/commcare-core#1426