diff --git a/Share/src/main/java/com/yunbao/share/platform/Line.java b/Share/src/main/java/com/yunbao/share/platform/Line.java index d3a081b47..67c2e46b5 100644 --- a/Share/src/main/java/com/yunbao/share/platform/Line.java +++ b/Share/src/main/java/com/yunbao/share/platform/Line.java @@ -21,10 +21,10 @@ public class Line extends AbsShareInterface { @Override public void share(ShareBuilder builder, ICallback callback) { try { - Intent share = new Intent(Intent.ACTION_VIEW, Uri.parse("https://line.me/R/share?text=" + URLEncoder.encode(builder.getLink(), "UTF-8"))); + Intent share = new Intent(Intent.ACTION_VIEW, Uri.parse("https://line.me/R/share?text=" + URLEncoder.encode(builder.getText(), "UTF-8"))); mContext.startActivity(share); callback.onSuccess(); - } catch (UnsupportedEncodingException e) { + } catch (Exception e) { callback.onFailure(); throw new RuntimeException(e); } diff --git a/Share/src/main/java/com/yunbao/share/platform/MessengerShare.java b/Share/src/main/java/com/yunbao/share/platform/MessengerShare.java index b84e7aad7..e0efe6a86 100644 --- a/Share/src/main/java/com/yunbao/share/platform/MessengerShare.java +++ b/Share/src/main/java/com/yunbao/share/platform/MessengerShare.java @@ -40,6 +40,7 @@ public class MessengerShare extends AbsShareInterface { @Override public void onSuccess(Sharer.Result result) { ToastUtil.show("Messenger分享成功:"+result.getPostId()); + callback.onSuccess(); } @Override @@ -53,6 +54,10 @@ public class MessengerShare extends AbsShareInterface { e.printStackTrace(); } }); - dialog.show(content); + if(dialog.canShow(content)) { + dialog.show(content); + }else{ + callback.onFailure(); + } } } diff --git a/Share/src/main/java/com/yunbao/share/platform/WhatsApp.java b/Share/src/main/java/com/yunbao/share/platform/WhatsApp.java index d8002d32c..e662d9caa 100644 --- a/Share/src/main/java/com/yunbao/share/platform/WhatsApp.java +++ b/Share/src/main/java/com/yunbao/share/platform/WhatsApp.java @@ -14,11 +14,17 @@ public class WhatsApp extends AbsShareInterface { @Override public void share(ShareBuilder builder, ICallback callback) { - Intent sendIntent = new Intent(); - sendIntent.setAction(Intent.ACTION_SEND); - sendIntent.putExtra(Intent.EXTRA_TEXT, builder.getText()); - sendIntent.setType("text/plain"); - sendIntent.setPackage("com.whatsapp"); - mContext.startActivity(sendIntent); + try { + Intent sendIntent = new Intent(); + sendIntent.setAction(Intent.ACTION_SEND); + sendIntent.putExtra(Intent.EXTRA_TEXT, builder.getText()); + sendIntent.setType("text/plain"); + sendIntent.setPackage("com.whatsapp"); + mContext.startActivity(sendIntent); + callback.onSuccess(); + } catch (Exception e) { + callback.onFailure(); + } + } } diff --git a/config.gradle b/config.gradle index 2a10a28f4..980717524 100644 --- a/config.gradle +++ b/config.gradle @@ -10,9 +10,9 @@ ext { manifestPlaceholders = [ //正式 - serverHost : "https://napi.yaoulive.com", +// serverHost : "https://napi.yaoulive.com", // -// serverHost : "https://ceshi.yaoulive.com", + serverHost : "https://ceshi.yaoulive.com", //腾讯地图 txMapAppKey : "EOZBZ-ASLCU-4XPV3-BDCHZ-4E3Q7-H4BWB", diff --git a/main/src/main/java/com/yunbao/main/activity/TestActivity.java b/main/src/main/java/com/yunbao/main/activity/TestActivity.java index cdda47aa8..21ff40fd2 100644 --- a/main/src/main/java/com/yunbao/main/activity/TestActivity.java +++ b/main/src/main/java/com/yunbao/main/activity/TestActivity.java @@ -13,6 +13,7 @@ import android.widget.TextView; import androidx.appcompat.app.AppCompatActivity; +import com.yunbao.common.utils.ToastUtil; import com.yunbao.main.R; import com.yunbao.share.ICallback; import com.yunbao.share.ShareBuilder; @@ -55,7 +56,7 @@ public class TestActivity extends AppCompatActivity { @Override public void onFailure() { - + ToastUtil.show("分享失败,应用未安装"); } }; listView.setAdapter(new ArrayAdapter(this, android.R.layout.simple_expandable_list_item_1, strs));