From b19a3e32f36e01fb7b603bd1ff94c55ca12e129f Mon Sep 17 00:00:00 2001 From: "pengfei.zhou" Date: Fri, 22 Nov 2019 17:06:24 +0800 Subject: [PATCH] feat:fix Prompt bridge error --- .../java/pub/doric/plugin/ModalPlugin.java | 30 +++++++------------ 1 file changed, 10 insertions(+), 20 deletions(-) diff --git a/Android/doric/src/main/java/pub/doric/plugin/ModalPlugin.java b/Android/doric/src/main/java/pub/doric/plugin/ModalPlugin.java index 5d9f09ad..0d8cfd62 100644 --- a/Android/doric/src/main/java/pub/doric/plugin/ModalPlugin.java +++ b/Android/doric/src/main/java/pub/doric/plugin/ModalPlugin.java @@ -72,7 +72,7 @@ public class ModalPlugin extends DoricJavaPlugin { } toast.show(); - } catch (ArchiveException e) { + } catch (Exception e) { e.printStackTrace(); } } @@ -101,12 +101,8 @@ public class ModalPlugin extends DoricJavaPlugin { } }); builder.setCancelable(false); - try { - builder.show(); - } catch (Exception e) { - e.printStackTrace(); - } - } catch (ArchiveException e) { + builder.show(); + } catch (Exception e) { e.printStackTrace(); promise.reject(new JavaValue(e.getLocalizedMessage())); } @@ -148,12 +144,8 @@ public class ModalPlugin extends DoricJavaPlugin { } }); builder.setCancelable(false); - try { - builder.show(); - } catch (Exception e) { - e.printStackTrace(); - } - } catch (ArchiveException e) { + builder.show(); + } catch (Exception e) { e.printStackTrace(); promise.reject(new JavaValue(e.getLocalizedMessage())); } @@ -187,7 +179,9 @@ public class ModalPlugin extends DoricJavaPlugin { View v = LayoutInflater.from(getDoricContext().getContext()).inflate(R.layout.doric_modal_prompt, null); TextView tvMsg = v.findViewById(R.id.tv_msg); - tvMsg.setText(msgVal.asString().value()); + if (msgVal.isString()) { + tvMsg.setText(msgVal.asString().value()); + } final EditText editText = v.findViewById(R.id.edit_input); if (defaultVal.isString()) { editText.setHint(defaultVal.asString().value()); @@ -211,12 +205,8 @@ public class ModalPlugin extends DoricJavaPlugin { } }); builder.setCancelable(false); - try { - builder.show(); - } catch (Exception e) { - e.printStackTrace(); - } - } catch (ArchiveException e) { + builder.show(); + } catch (Exception e) { e.printStackTrace(); promise.reject(new JavaValue(e.getLocalizedMessage())); }