TIM v2.3.1版本的 MD5 值为:d6957e3ee7ce901ccc491cefdea0da8c

以下内容为反编译后的 QZoneShareManager.java 源代码,内容仅作参考


package cooperation.qzone;

import NS_MOBILE_FEEDS.e_attribute;
import android.app.Activity;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.os.Bundle;
import android.text.TextUtils;
import com.tencent.biz.common.util.HttpUtil;
import com.tencent.common.app.AppInterface;
import com.tencent.mobileqq.app.AppConstants;
import com.tencent.mobileqq.app.BusinessObserver;
import com.tencent.mobileqq.app.PhoneContactManagerImp;
import com.tencent.mobileqq.data.OpenID;
import com.tencent.mobileqq.filemanager.util.FileUtil;
import com.tencent.mobileqq.msf.core.auth.h;
import com.tencent.mobileqq.msf.sdk.MsfSdkUtils;
import com.tencent.mobileqq.troop.utils.HttpWebCgiAsyncTask;
import com.tencent.msf.service.protocol.security.RequestCustomSig;
import com.tencent.qphone.base.util.QLog;
import common.config.service.QzoneConfig;
import cooperation.qzone.QZoneHelper;
import cooperation.qzone.share.QZoneShareActivity;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.concurrent.ConcurrentHashMap;
import mqq.app.AppRuntime;
import mqq.manager.AccountManager;
import org.json.JSONException;
import org.json.JSONObject;
public class QZoneShareManager {
    public static final int f98406a = 2020014;
    public static final String f70232a = "QZoneShare";
    private static ConcurrentHashMap f70233a = new ConcurrentHashMap();
    public static final int f98407b = 9;
    public static final String f70234b = "1103584836";
    public static final int f98408c = 55555;
    public static final String f70235c = "qzone_uin";
    public static final int d = 55556;
    public static final String f70236d = "share_data";
    public static final int e = 55557;
    public static final String f70237e = "key_share_is_third_party";
    public static final int f = 55558;
    public static final String f70238f = "summary";
    public static final int g = 30;
    public static final String f70239g = "images";
    public static final int h = 40;
    public static final String f70240h = "hulian_appid";
    public static final int i = -1;
    public static final String f70241i = "share_action";
    public static final int j = -11210;
    public static final String f70242j = "file_send_path";
    public static final int k = -11207;
    public static final String f70243k = "defaultText";
    public static final int l = -11215;
    public static final String f70244l = "app_name";
    public static final int m = -2;
    public static final String f70245m = "from_web";
    public static final int n = 3;
    public static final int o = 4;
    public static final int p = 5;
    public static final int q = 15790320;

    public interface ShareResultCallBack {
        void a(boolean z, int i, String str);
    }

    public static final void a(Context context, String str, DialogInterface.OnDismissListener onDismissListener, int i2, String str2, String str3) {
        QZoneShareData qZoneShareData = new QZoneShareData();
        qZoneShareData.f70225b = str2 + "正在发放红包";
        qZoneShareData.f70226c = "快来我的空间领取";
        qZoneShareData.f70223a = new ArrayList();
        qZoneShareData.f70223a.add("http://qzonestyle.gtimg.cn/aoi/sola/20161111222053_4wlQcl1Eta.png");
        qZoneShareData.f70227d = "https://h5.qzone.qq.com/redpacket/share?_wv=1&_ws=1&uin=" + str;
        qZoneShareData.g = 0;
        qZoneShareData.f70229f = str;
        a(context, str, qZoneShareData, onDismissListener, i2);
    }

    public static final void a(Context context, String str, QZoneShareData qZoneShareData, DialogInterface.OnDismissListener onDismissListener, int i2) {
        if (QLog.isColorLevel()) {
            QLog.d("QZoneShare", 2, "shareToQzone()");
        }
        if (context == null || qZoneShareData == null) {
            QLog.e("QZoneShare", 1, "shareToQzone() params error");
            return;
        }
        PhoneContactManagerImp.f18190f = true;
        try {
            Intent intent = new Intent(context, QZoneShareActivity.class);
            intent.putExtra("qzone_uin", str);
            intent.putExtra("extraIntentKeyParcelable", qZoneShareData);
            ((Activity) context).startActivityForResult(intent, i2);
        } catch (Exception e2) {
            Intent intent2 = new Intent(context, QZoneShareActivity.class);
            intent2.putExtra("qzone_uin", str);
            intent2.putExtra("extraIntentKeyParcelable", qZoneShareData);
            intent2.addFlags(e_attribute._IsFrdCommentFamousFeed);
            context.startActivity(intent2);
        }
    }

    public static final void a(AppInterface appInterface, Context context, Bundle bundle, DialogInterface.OnDismissListener onDismissListener) {
        a(appInterface, context, bundle, onDismissListener, -1);
    }

    public static final void a(AppInterface appInterface, Context context, Bundle bundle, DialogInterface.OnDismissListener onDismissListener, int i2) {
        String str;
        if (QLog.isColorLevel()) {
            QLog.d("QZoneShare", 2, "publishToQzone()");
        }
        if (bundle == null || appInterface == null) {
            QLog.d("QZoneShare", 1, "publishToQzone() params error");
            return;
        }
        Intent intent = new Intent();
        intent.putExtra("qzone_uin", appInterface.getAccount());
        intent.putExtra(f70237e, true);
        ArrayList<String> stringArrayList = bundle.getStringArrayList(f70239g);
        if (stringArrayList != null && stringArrayList.size() > 9) {
            str = QZoneHelper.am;
        } else {
            str = QZoneHelper.ak;
        }
        if (!a(bundle.getString(f70240h))) {
            String string = bundle.getString("file_send_path");
            if ((stringArrayList != null && stringArrayList.size() > 0) || !TextUtils.isEmpty(string)) {
                bundle.putString("summary", "");
                bundle.putString(f70243k, "");
            }
        }
        intent.putExtras(bundle);
        QzonePluginProxyActivity.a(intent, str);
        PhoneContactManagerImp.f18190f = true;
        try {
            QZoneHelper.UserInfo a2 = QZoneHelper.UserInfo.a();
            a2.f70173a = appInterface.getCurrentAccountUin();
            QZoneHelper.a((Activity) context, a2, intent, i2, onDismissListener);
        } catch (Exception e2) {
            Intent intent2 = new Intent(context, TranslucentActivity.class);
            intent2.addFlags(e_attribute._IsFrdCommentFamousFeed);
            intent2.putExtras(intent);
            context.startActivity(intent2);
        }
    }

    @Deprecated
    public static final boolean m10877a(AppInterface appInterface, Context context, Bundle bundle, DialogInterface.OnDismissListener onDismissListener) {
        return m10878a(appInterface, context, bundle, onDismissListener, -1);
    }

    @Deprecated
    public static final boolean m10878a(AppInterface appInterface, Context context, Bundle bundle, DialogInterface.OnDismissListener onDismissListener, int i2) {
        if (bundle == null || appInterface == null) {
            return false;
        }
        String string = bundle.getString("title");
        String string2 = bundle.getString("desc");
        if (TextUtils.isEmpty(string) && TextUtils.isEmpty(string2)) {
            Intent intent = new Intent();
            intent.putExtra("qzone_uin", appInterface.getAccount());
            intent.putExtra(f70237e, true);
            intent.putExtra("share_data", bundle);
            intent.addFlags(67108864);
            intent.addFlags(e_attribute._IsFrdCommentFamousFeed);
            QzonePluginProxyActivity.a(intent, QZoneHelper.ay);
            PhoneContactManagerImp.f18190f = true;
            try {
                QZoneHelper.UserInfo a2 = QZoneHelper.UserInfo.a();
                a2.f70173a = appInterface.getCurrentAccountUin();
                QZoneHelper.a((Activity) context, a2, intent, i2, onDismissListener);
            } catch (Exception e2) {
                Intent intent2 = new Intent(context, TranslucentActivity.class);
                intent2.addFlags(e_attribute._IsFrdCommentFamousFeed);
                intent2.putExtras(intent);
                context.startActivity(intent2);
            }
            return true;
        }
        b(bundle);
        QZoneShareData qZoneShareData = new QZoneShareData();
        qZoneShareData.f70225b = bundle.getString("title");
        qZoneShareData.f70226c = bundle.getString("desc");
        qZoneShareData.f70223a = bundle.getStringArrayList("image_url");
        qZoneShareData.f70230g = bundle.getString("share_qq_ext_str");
        qZoneShareData.f70221a = bundle.getLong(AppConstants.Key.aU);
        qZoneShareData.f70222a = bundle.getString("open_id");
        qZoneShareData.f70228e = bundle.getString("app_name");
        qZoneShareData.f70227d = bundle.getString(AppConstants.Key.bf);
        qZoneShareData.f = bundle.getInt(AppConstants.Key.bs, -1);
        qZoneShareData.f70224b = bundle.getLong(AppConstants.Key.bt, 0L);
        if (bundle.getBoolean(AppConstants.Key.bu)) {
            qZoneShareData.g = 1;
        } else if (bundle.getBoolean("from_web")) {
            qZoneShareData.g = 2;
        } else {
            qZoneShareData.g = 0;
        }
        qZoneShareData.f70231h = bundle.getString(f70241i);
        qZoneShareData.j = bundle.getString("jfrom");
        qZoneShareData.i = bundle.getString(AppConstants.Key.aS);
        qZoneShareData.f70229f = bundle.getString("share_uin");
        qZoneShareData.m = bundle.getString(AppConstants.Key.ba);
        a(context, appInterface.getCurrentAccountUin(), qZoneShareData, onDismissListener, i2);
        return true;
    }

    public static OpenID a(AppRuntime appRuntime, String str, BusinessObserver businessObserver) {
        OpenID openID = (OpenID) f70233a.get(str);
        if (openID == null) {
            if (QLog.isColorLevel()) {
                QLog.d("QZoneShare", 2, "get openid key = " + str);
            }
            HashMap<String, Object> hashMap = new HashMap<>();
            RequestCustomSig requestCustomSig = new RequestCustomSig();
            requestCustomSig.ulCustumFlag = 8192L;
            requestCustomSig.ulSType = 1L;
            requestCustomSig.reserved = new byte[0];
            hashMap.put(h.k, requestCustomSig);
            hashMap.put("OpenAppid", str);
            ((AccountManager) appRuntime.getManager(0)).changeToken(hashMap, new xzr(str, businessObserver));
            return null;
        }
        return openID;
    }

    public static final long a(Intent intent) {
        Bundle bundleExtra;
        if (intent == null || (bundleExtra = intent.getBundleExtra("share_data")) == null) {
            return 0L;
        }
        return bundleExtra.getLong(AppConstants.Key.aU, 0L);
    }

    public static int a(BitmapFactory.Options options, int i2, int i3) {
        int round;
        int i4 = options.outHeight;
        int i5 = options.outWidth;
        if (i4 > i3 || i5 > i2) {
            round = Math.round(i4 / i3);
            int round2 = Math.round(i5 / i2);
            if (round >= round2) {
                round = round2;
            }
        } else {
            round = 2;
        }
        if (round <= 0) {
            return 2;
        }
        return round;
    }

    public static File a(String str, int i2, int i3, int i4, int i5) {
        Bitmap bitmap;
        Throwable th;
        FileOutputStream fileOutputStream;
        File file = null;
        ?? b2 = FileUtil.b(str);
        String m6628a = FileUtil.m6628a(str);
        try {
            try {
                BitmapFactory.Options options = new BitmapFactory.Options();
                options.inJustDecodeBounds = true;
                BitmapFactory.decodeFile(str, options);
                if (i3 == 0 || i4 == 0) {
                    options.inSampleSize = a(options, 640, 640);
                } else {
                    options.inSampleSize = a(options, i3, i4);
                }
                options.inJustDecodeBounds = false;
                bitmap = BitmapFactory.decodeFile(str, options);
                if (bitmap == null || b2 == 0) {
                    fileOutputStream = null;
                } else {
                    try {
                        File file2 = new File((String) b2, i2 + m6628a);
                        fileOutputStream = new FileOutputStream(file2);
                        try {
                            if (bitmap.compress(Bitmap.CompressFormat.PNG, i5, fileOutputStream)) {
                                fileOutputStream.flush();
                            }
                            file = file2;
                        } catch (Exception e2) {
                            e = e2;
                            if (QLog.isColorLevel()) {
                                QLog.e("QZoneShare", 2, "CompressImage Failed", e);
                            }
                            if (fileOutputStream != null) {
                                try {
                                    fileOutputStream.close();
                                } catch (IOException e3) {
                                }
                            }
                            if (bitmap != null && !bitmap.isRecycled()) {
                                bitmap.recycle();
                                System.gc();
                            }
                            return file;
                        } catch (OutOfMemoryError e4) {
                            e = e4;
                            if (QLog.isColorLevel()) {
                                QLog.e("QZoneShare", 2, "OutOfMemoryError Has Occurred When Compress The Image", e);
                            }
                            if (fileOutputStream != null) {
                                try {
                                    fileOutputStream.close();
                                } catch (IOException e5) {
                                }
                            }
                            if (bitmap != null && !bitmap.isRecycled()) {
                                bitmap.recycle();
                                System.gc();
                            }
                            return file;
                        }
                    } catch (Exception e6) {
                        e = e6;
                        fileOutputStream = null;
                    } catch (OutOfMemoryError e7) {
                        e = e7;
                        fileOutputStream = null;
                    } catch (Throwable th2) {
                        b2 = 0;
                        th = th2;
                        if (b2 != 0) {
                            try {
                                b2.close();
                            } catch (IOException e8) {
                            }
                        }
                        if (bitmap != null && !bitmap.isRecycled()) {
                            bitmap.recycle();
                            System.gc();
                        }
                        throw th;
                    }
                }
                if (fileOutputStream != null) {
                    try {
                        fileOutputStream.close();
                    } catch (IOException e9) {
                    }
                }
                if (bitmap != null && !bitmap.isRecycled()) {
                    bitmap.recycle();
                    System.gc();
                }
            } catch (Throwable th3) {
                th = th3;
            }
        } catch (Exception e10) {
            e = e10;
            fileOutputStream = null;
            bitmap = null;
        } catch (OutOfMemoryError e11) {
            e = e11;
            fileOutputStream = null;
            bitmap = null;
        } catch (Throwable th4) {
            b2 = 0;
            bitmap = null;
            th = th4;
        }
        return file;
    }

    public static void a(ArrayList arrayList) {
        if (arrayList != null && arrayList.size() > 0) {
            Iterator it = arrayList.iterator();
            while (it.hasNext()) {
                FileUtil.m6630a((File) it.next());
            }
            arrayList.clear();
        }
    }

    public static final ArrayList a(ArrayList arrayList, String str, String str2, String str3) {
        JSONObject jSONObject;
        if (arrayList != null && !arrayList.isEmpty()) {
            ArrayList arrayList2 = new ArrayList();
            int i2 = 0;
            while (true) {
                if (i2 < arrayList.size()) {
                    String str4 = (String) arrayList.get(i2);
                    if (FileUtil.m6632b(str4)) {
                        if (QLog.isColorLevel()) {
                            QLog.d("QZoneShare", 4, "local url:" + str4);
                        }
                        if (FileUtil.a(str4) > 2097152) {
                            if (QLog.isColorLevel()) {
                                QLog.d("QZoneShare", 4, "file length:" + FileUtil.a(str4));
                            }
                            File a2 = a(str4, i2, 0, 0, 50);
                            if (a2 == null) {
                                break;
                            }
                            str4 = a2.getAbsolutePath();
                            arrayList2.add(a2);
                        }
                        HashMap hashMap = new HashMap();
                        hashMap.put("Connection", "keep-alive");
                        hashMap.put("Referer", "http://www.qq.com");
                        HashMap hashMap2 = new HashMap();
                        hashMap2.put("type", str3);
                        HashMap hashMap3 = new HashMap();
                        hashMap3.put("share_image", str4);
                        String a3 = HttpUtil.a(MsfSdkUtils.insertMtype(AppConstants.eO, HttpUtil.d), str, str2, hashMap2, hashMap3, hashMap);
                        if (a3 != null) {
                            try {
                                JSONObject jSONObject2 = new JSONObject(a3);
                                if (jSONObject2.getInt(HttpWebCgiAsyncTask.f94008b) == 0 && (jSONObject = jSONObject2.getJSONObject("result")) != null) {
                                    arrayList.set(i2, jSONObject.getString("url"));
                                    if (QLog.isColorLevel()) {
                                        QLog.d("QZoneShare", 4, "target url:" + jSONObject.getString("url"));
                                    }
                                }
                            } catch (JSONException e2) {
                                if (QLog.isColorLevel()) {
                                    QLog.d("QZoneShare", 4, e2.getMessage());
                                }
                            }
                        }
                    }
                    i2++;
                } else {
                    a(arrayList2);
                    break;
                }
            }
        }
        return arrayList;
    }

    public static final Bundle a(Bundle bundle) {
        ArrayList<String> stringArrayList = bundle.getStringArrayList("image_url");
        if (stringArrayList != null) {
            for (int size = stringArrayList.size() - 1; size >= 0; size--) {
                String str = stringArrayList.get(size);
                if (!HttpUtil.m931a(str) && !FileUtil.m6632b(str)) {
                    stringArrayList.remove(size);
                }
            }
            while (stringArrayList.size() > 9) {
                stringArrayList.remove(9);
            }
            if (stringArrayList.size() > 0) {
                if (HttpUtil.m931a(stringArrayList.get(0))) {
                    for (int size2 = stringArrayList.size() - 1; size2 >= 0; size2--) {
                        if (!HttpUtil.m931a(stringArrayList.get(size2))) {
                            stringArrayList.remove(size2);
                        }
                    }
                } else {
                    for (int size3 = stringArrayList.size() - 1; size3 >= 0; size3--) {
                        if (size3 != 0) {
                            stringArrayList.remove(size3);
                        }
                    }
                }
            }
            bundle.putStringArrayList("image_url", stringArrayList);
        }
        return bundle;
    }

    public static final Bundle b(Bundle bundle) {
        if (bundle == null) {
            return null;
        }
        String string = bundle.getString("title");
        String string2 = bundle.getString("desc");
        ArrayList<String> stringArrayList = bundle.getStringArrayList("image_url");
        if (TextUtils.isEmpty(string) && TextUtils.isEmpty(string2) && stringArrayList != null && !stringArrayList.isEmpty()) {
            bundle.remove(AppConstants.Key.bf);
        }
        a(bundle);
        return bundle;
    }

    public static boolean a(String str) {
        if (TextUtils.isEmpty(str)) {
            return false;
        }
        String config = QzoneConfig.getInstance().getConfig("QZoneSetting", QzoneConfig.SECONDARY_SHARE_WHITE_LIST, QzoneConfig.DefaultValue.f68983an);
        if (TextUtils.isEmpty(config)) {
            return false;
        }
        String[] split = config.split(",");
        for (String str2 : split) {
            if (str.equals(str2)) {
                return true;
            }
        }
        return false;
    }
}