注册的官博进行优化

This commit is contained in:
ningwenqiang 2024-11-05 15:46:02 +08:00
parent 09f763dc2e
commit bd791dcc56

View File

@ -3,7 +3,9 @@ package com.yunbao.share;
import android.content.Context;
import android.content.IntentFilter;
import android.net.Uri;
import android.os.Build;
import androidx.annotation.RequiresApi;
import androidx.core.content.FileProvider;
import com.twitter.sdk.android.tweetcomposer.TweetUploadService;
@ -15,12 +17,22 @@ import java.io.File;
public abstract class AbsShareInterface {
protected final Context mContext;
public AbsShareInterface(Context context) {
this.mContext = context;
IntentFilter filter = new IntentFilter(TweetUploadService.UPLOAD_SUCCESS);
filter.addAction(TweetUploadService.UPLOAD_FAILURE);
filter.addAction(TweetUploadService.TWEET_COMPOSE_CANCEL);
context.registerReceiver(new TwitterResultReceiver(), filter);
TwitterResultReceiver receiver = new TwitterResultReceiver();
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
// Android 12 (API 33) 及以上版本
context.registerReceiver(receiver, filter, Context.RECEIVER_NOT_EXPORTED);
} else {
// Android 12 (API 33) 以下版本
context.registerReceiver(receiver, filter);
}
}
public abstract void share(ShareBean builder, ICallback callback);