Problem
When the user clicks on choose file, I intercept that click natively and I call the native view (screen 3 in the mockup).
After the user select the file he wants to upload, I need to "reload" the view in order to add the name of the file in the form, so the user can get the feedback that he selected the file correctly.
In order to do this, I'm calling onRestart
with the following code:
@Override
protected void onRestart() {
super.onRestart();
// mCM is a variable to detect when the user is choosing a file.
if (null == mCM) {
// Since the webView is shared between activities, we need to tell Turbolinks
// to load the location from the previous activity upon restarting
TurbolinksSession.getDefault(this)
.activity(this)
.adapter(this)
.restoreWithCachedSnapshot(true)
.view(turbolinksView)
.visit(location);
}
}
As you can see, in this method when is uploading a file I do NOT reload the view using TurbolinksSession
.
But if I don't call TurbolinksSession
, Turbolinks never calls visitProposedToLocationWithAction
.
Scenario
NOTE: Download the image if you want to see the image bigger.
What am I missing? Is there a way to solve this problem and get the expected result?
In this 2 issues you can find a solution and resolution of the problem (read it in this order):