Skip to content
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

Reload rich document edition on reload event from webview (triggered … #13247

Merged
merged 1 commit into from
Jul 8, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
import com.owncloud.android.datamodel.OCFile;
import com.owncloud.android.datamodel.SyncedFolderProvider;
import com.owncloud.android.datamodel.ThumbnailsCacheManager;
import com.owncloud.android.ui.asynctasks.TextEditorLoadUrlTask;
import com.owncloud.android.utils.DisplayUtils;
import com.owncloud.android.utils.MimeTypeUtil;
import com.owncloud.android.utils.WebViewUtil;
Expand Down Expand Up @@ -99,6 +100,23 @@ public void closeView() {
finish();
}

public void reload() {
if (getWebView().getVisibility() != View.VISIBLE) {
return;
}

Optional<User> user = getUser();
if (!user.isPresent()) {
return;
}

OCFile file = getFile();
if (file != null) {
TextEditorLoadUrlTask task = new TextEditorLoadUrlTask(this, user.get(), file, editorUtils);
task.execute();
}
}

@Override
protected void bindView() {
binding = RichdocumentsWebviewBinding.inflate(getLayoutInflater());
Expand Down Expand Up @@ -281,6 +299,11 @@ public void share() {
public void loaded() {
runOnUiThread(EditorWebView.this::hideLoading);
}

@JavascriptInterface
public void reload() {
EditorWebView.this.reload();
}
}

}
Loading