diff --git a/Share/src/main/AndroidManifest.xml b/Share/src/main/AndroidManifest.xml index e0f407337..0f2b62f39 100644 --- a/Share/src/main/AndroidManifest.xml +++ b/Share/src/main/AndroidManifest.xml @@ -1,7 +1,31 @@ - - + + + + + + + + + + + + + + + - - - + + + 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 2d482fb85..b84e7aad7 100644 --- a/Share/src/main/java/com/yunbao/share/platform/MessengerShare.java +++ b/Share/src/main/java/com/yunbao/share/platform/MessengerShare.java @@ -9,6 +9,7 @@ import androidx.annotation.NonNull; import com.facebook.CallbackManager; import com.facebook.FacebookCallback; import com.facebook.FacebookException; +import com.facebook.FacebookSdk; import com.facebook.share.Sharer; import com.facebook.share.model.ShareLinkContent; import com.facebook.share.model.SharePhoto; @@ -25,25 +26,20 @@ public class MessengerShare extends AbsShareInterface { public MessengerShare(Context context) { super(context); + FacebookSdk.setIsDebugEnabled(true); } @Override public void share(ShareBuilder builder, ICallback callback) { callbackManager = CallbackManager.Factory.create(); - /* ShareLinkContent content = new ShareLinkContent.Builder() + ShareLinkContent content = new ShareLinkContent.Builder() .setContentUrl(Uri.parse(builder.getLink())) - .build();*/ - SharePhoto photo = new SharePhoto.Builder() - .setImageUrl(fileToUri(builder.getFile())) - .build(); - SharePhotoContent content=new SharePhotoContent.Builder() - .addPhoto(photo) .build(); MessageDialog dialog = new MessageDialog((Activity) mContext); dialog.registerCallback(callbackManager, new FacebookCallback() { @Override public void onSuccess(Sharer.Result result) { - ToastUtil.show("Messenger分享成功"); + ToastUtil.show("Messenger分享成功:"+result.getPostId()); } @Override @@ -57,7 +53,6 @@ public class MessengerShare extends AbsShareInterface { e.printStackTrace(); } }); - ToastUtil.show(dialog.canShow(content)+" <"); dialog.show(content); } } diff --git a/common/build.gradle b/common/build.gradle index bc5c7ddd9..7943cde8a 100644 --- a/common/build.gradle +++ b/common/build.gradle @@ -162,8 +162,8 @@ dependencies { api 'cn.rongcloud.sdk:im_kit:5.2.5.4' // 即时通讯 UI 基础组件 //融云小视频模块 api 'cn.rongcloud.sdk:sight:5.2.5.4' - api 'com.facebook.android:facebook-android-sdk:15.0.1' - implementation 'com.facebook.android:facebook-android-sdk:15.0.1' + api 'com.facebook.android:facebook-android-sdk:15.2.0' + implementation 'com.facebook.android:facebook-android-sdk:15.2.0' api('com.twitter.sdk.android:twitter-core:3.1.1@aar') { transitive = true 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 b2ebdd7c7..cdda47aa8 100644 --- a/main/src/main/java/com/yunbao/main/activity/TestActivity.java +++ b/main/src/main/java/com/yunbao/main/activity/TestActivity.java @@ -45,8 +45,8 @@ public class TestActivity extends AppCompatActivity { File media = new File(mediaPath); ShareBuilder builder = new ShareBuilder() .setFile(media) - .setLink("http://blog.yutou233.cn") - .setText("测试Test http://blog.yutou233.cn"); + .setLink("https://www.baidu.com") + .setText("测试Test https://www.baidu.com"); ICallback callback = new ICallback() { @Override public void onSuccess() { @@ -96,7 +96,7 @@ public class TestActivity extends AppCompatActivity { @Override protected void onActivityResult(final int requestCode, final int resultCode, final Intent data) { super.onActivityResult(requestCode, resultCode, data); - Log.i("分享log", "onActivityResult() called with: requestCode = [" + requestCode + "], resultCode = [" + resultCode + "], data = [" + data + "]"); + Log.i("分享log", "onActivityResult() called with: requestCode = [" + requestCode + "], resultCode = [" + resultCode + "], data = [" + data.getAction() + "]"); if (FacebookShare.callbackManager != null) { FacebookShare.callbackManager.onActivityResult(requestCode, resultCode, data); } else if (MessengerShare.callbackManager != null) {