导航菜单

页面标题

页面副标题

Zepto v25.1.4 - GenericShare.java 源代码

正在查看: Zepto v25.1.4 应用的 GenericShare.java JAVA 源代码文件

本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。


package cl.json.social;

import android.app.Activity;
import android.content.ComponentName;
import android.content.Intent;
import android.content.IntentSender;
import android.content.pm.ActivityInfo;
import android.content.pm.ResolveInfo;
import android.net.Uri;
import android.os.Build;
import android.os.Parcelable;
import cl.json.social.ShareIntent;
import com.facebook.react.bridge.Arguments;
import com.facebook.react.bridge.ReactApplicationContext;
import com.facebook.react.bridge.ReadableArray;
import com.facebook.react.bridge.ReadableMap;
import com.facebook.react.bridge.WritableMap;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;

public class GenericShare extends ShareIntent {
    @Override
    public final void f(ReadableMap readableMap) {
        Intent createChooser;
        IntentSender intentSender;
        Intent createChooser2;
        ComponentName[] componentNameArr;
        super.f(readableMap);
        ReactApplicationContext reactApplicationContext = this.f6842a;
        Activity currentActivity = reactApplicationContext.getCurrentActivity();
        if (currentActivity == null) {
            TargetChosenReceiver.a("Something went wrong");
            return;
        }
        Object obj = TargetChosenReceiver.f6845a;
        if (Build.VERSION.SDK_INT >= 22) {
            intentSender = TargetChosenReceiver.c(reactApplicationContext);
            createChooser = Intent.createChooser(this.f6843b, this.f6844c, intentSender);
        } else {
            createChooser = Intent.createChooser(this.f6843b, this.f6844c);
            intentSender = null;
        }
        createChooser.addFlags(1073741824);
        if (ShareIntent.e(this.e, "showAppsToView") && ShareIntent.e(this.e, "url")) {
            Intent intent = new Intent("android.intent.action.VIEW");
            String str = this.d.d;
            if (str == null) {
                str = "*/*";
            }
            intent.setType(str);
            Uri a2 = this.d.a();
            List<ResolveInfo> queryIntentActivities = reactApplicationContext.getPackageManager().queryIntentActivities(intent, 0);
            Intent[] intentArr = new Intent[queryIntentActivities.size()];
            for (int i = 0; i < queryIntentActivities.size(); i++) {
                ResolveInfo resolveInfo = queryIntentActivities.get(i);
                String str2 = resolveInfo.activityInfo.packageName;
                Intent intent2 = new Intent();
                intent2.setComponent(new ComponentName(str2, resolveInfo.activityInfo.name));
                intent2.setAction("android.intent.action.VIEW");
                intent2.setDataAndType(a2, intent.getType());
                intent2.addFlags(1);
                intentArr[i] = new Intent(intent2);
            }
            createChooser.putExtra("android.intent.extra.INITIAL_INTENTS", intentArr);
        }
        if (!ShareIntent.e(this.e, "excludedActivityTypes")) {
            currentActivity.startActivityForResult(createChooser, 16845);
        } else if (Build.VERSION.SDK_INT >= 24) {
            ReadableArray array = this.e.getArray("excludedActivityTypes");
            if (array == null) {
                componentNameArr = null;
            } else {
                Intent intent3 = new Intent(this.f6843b.getAction());
                intent3.setType(this.f6843b.getType());
                ArrayList arrayList = new ArrayList();
                List<ResolveInfo> queryIntentActivities2 = reactApplicationContext.getPackageManager().queryIntentActivities(intent3, 0);
                for (int i2 = 0; i2 < array.size(); i2++) {
                    String string = array.getString(i2);
                    for (ResolveInfo resolveInfo2 : queryIntentActivities2) {
                        if (resolveInfo2.activityInfo.packageName.equals(string)) {
                            ActivityInfo activityInfo = resolveInfo2.activityInfo;
                            arrayList.add(new ComponentName(activityInfo.packageName, activityInfo.name));
                        }
                    }
                }
                componentNameArr = (ComponentName[]) arrayList.toArray(new ComponentName[0]);
            }
            createChooser.putExtra("android.intent.extra.EXCLUDE_COMPONENTS", componentNameArr);
            currentActivity.startActivityForResult(createChooser, 16845);
        } else {
            Intent intent4 = this.f6843b;
            ReadableMap readableMap2 = this.e;
            ArrayList arrayList2 = new ArrayList();
            ArrayList arrayList3 = new ArrayList();
            Intent intent5 = new Intent(intent4.getAction());
            intent5.setType(intent4.getType());
            List<ResolveInfo> queryIntentActivities3 = reactApplicationContext.getPackageManager().queryIntentActivities(intent5, 0);
            if (!queryIntentActivities3.isEmpty()) {
                for (ResolveInfo resolveInfo3 : queryIntentActivities3) {
                    if (resolveInfo3.activityInfo != null) {
                        if (!readableMap2.getArray("excludedActivityTypes").toString().contains(resolveInfo3.activityInfo.packageName)) {
                            HashMap hashMap = new HashMap();
                            hashMap.put("packageName", resolveInfo3.activityInfo.packageName);
                            hashMap.put("className", resolveInfo3.activityInfo.name);
                            hashMap.put("simpleName", String.valueOf(resolveInfo3.activityInfo.loadLabel(reactApplicationContext.getPackageManager())));
                            arrayList3.add(hashMap);
                        }
                    }
                }
                if (!arrayList3.isEmpty()) {
                    Collections.sort(arrayList3, new ShareIntent.AnonymousClass1());
                    Iterator it = arrayList3.iterator();
                    while (it.hasNext()) {
                        HashMap hashMap2 = (HashMap) it.next();
                        Intent intent6 = (Intent) intent4.clone();
                        intent6.setPackage((String) hashMap2.get("packageName"));
                        intent6.setClassName((String) hashMap2.get("packageName"), (String) hashMap2.get("className"));
                        arrayList2.add(intent6);
                    }
                    createChooser2 = Intent.createChooser((Intent) arrayList2.remove(arrayList2.size() - 1), "share");
                    createChooser2.putExtra("android.intent.extra.INITIAL_INTENTS", (Parcelable[]) arrayList2.toArray(new Parcelable[0]));
                    currentActivity.startActivityForResult(createChooser2, 16845);
                }
            }
            createChooser2 = Intent.createChooser(intent4, "Share");
            currentActivity.startActivityForResult(createChooser2, 16845);
        }
        if (intentSender == null) {
            WritableMap createMap = Arguments.createMap();
            createMap.putBoolean("success", true);
            createMap.putString("message", "OK");
            TargetChosenReceiver.b(createMap);
        }
    }
}