~singpolyma/cheogram-android

9dc579df155f7eb3ac51e54063786a3e05dd6585 — Stephen Paul Weber 4 months ago c5e8ca4
Allow oob webview to move the execution forward
1 files changed, 14 insertions(+), 0 deletions(-)

M src/main/java/eu/siacs/conversations/entities/Conversation.java
M src/main/java/eu/siacs/conversations/entities/Conversation.java => src/main/java/eu/siacs/conversations/entities/Conversation.java +14 -0
@@ 22,6 22,7 @@ import android.widget.CompoundButton;
import android.widget.TextView;
import android.widget.Toast;
import android.widget.Spinner;
import android.webkit.JavascriptInterface;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.webkit.WebChromeClient;


@@ 1713,8 1714,21 @@ public class Conversation extends AbstractEntity implements Blockable, Comparabl
                            ConversationPagerAdapter.this.notifyDataSetChanged();
                        }
                    });
                    binding.webview.addJavascriptInterface(new JsObject(), "xmpp_xep0050");
                    binding.webview.loadUrl(oob.el.findChildContent("url", "jabber:x:oob"));
                }

                class JsObject {
                    @JavascriptInterface
                    public void execute() { execute("execute"); }
                    public void execute(String action) {
                        getView().post(() -> {
                            if(CommandSession.this.execute(action)) {
                                removeSession(CommandSession.this);
                            }
                        });
                    }
                }
            }

            class ProgressBarViewHolder extends ViewHolder<CommandProgressBarBinding> {