最右.apk(点击下载) / a44.java


package defpackage;

import android.app.Activity;
import android.app.Application;
import android.content.Intent;
import android.text.TextUtils;
import androidx.annotation.NonNull;
import com.meituan.robust.ChangeQuickRedirect;
import com.meituan.robust.PatchProxy;
import com.meituan.robust.PatchProxyResult;
import com.sina.weibo.sdk.WbSdk;
import com.sina.weibo.sdk.api.ImageObject;
import com.sina.weibo.sdk.api.TextObject;
import com.sina.weibo.sdk.api.WeiboMultiMessage;
import com.sina.weibo.sdk.auth.AuthInfo;
import com.sina.weibo.sdk.auth.Oauth2AccessToken;
import com.sina.weibo.sdk.auth.WbAuthListener;
import com.sina.weibo.sdk.auth.WbConnectErrorMessage;
import com.sina.weibo.sdk.auth.sso.SsoHandler;
import com.sina.weibo.sdk.share.WbShareCallback;
import com.sina.weibo.sdk.share.WbShareHandler;
import com.sina.weibo.sdk.utils.WbUtils;
import org.json.JSONObject;

/* renamed from: a44  reason: default package */
public class a44 extends e34 {
    public static ChangeQuickRedirect changeQuickRedirect;
    public SsoHandler c;
    public WbShareHandler d;
    public Application e;

    /* renamed from: a44$a */
    public class a implements WbAuthListener {
        public static ChangeQuickRedirect changeQuickRedirect;

        /* renamed from: a  reason: collision with root package name */
        public final /* synthetic */ i34 f1111a;

        public a(i34 i34) {
            this.f1111a = i34;
        }

        @Override // com.sina.weibo.sdk.auth.WbAuthListener
        public void cancel() {
            if (!PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 71837, new Class[0], Void.TYPE).isSupported) {
                z44.b("SinaHandler", "authorize cancel");
                this.f1111a.onCancel(a44.this.f26125b);
                a44.this.c = null;
            }
        }

        @Override // com.sina.weibo.sdk.auth.WbAuthListener
        public void onFailure(WbConnectErrorMessage wbConnectErrorMessage) {
            if (!PatchProxy.proxy(new Object[]{wbConnectErrorMessage}, this, changeQuickRedirect, false, 71838, new Class[]{WbConnectErrorMessage.class}, Void.TYPE).isSupported) {
                String str = "errcode=" + wbConnectErrorMessage.getErrorCode() + " errmsg=" + wbConnectErrorMessage.getErrorMessage();
                z44.c("SinaHandler", str);
                this.f1111a.onError(a44.this.f26125b, str);
                a44.this.c = null;
            }
        }

        @Override // com.sina.weibo.sdk.auth.WbAuthListener
        public void onSuccess(Oauth2AccessToken oauth2AccessToken) {
            if (!PatchProxy.proxy(new Object[]{oauth2AccessToken}, this, changeQuickRedirect, false, 71836, new Class[]{Oauth2AccessToken.class}, Void.TYPE).isSupported) {
                if (a44.this.c == null) {
                    z44.b("SinaHandler", "authorize twice throw last");
                } else if (oauth2AccessToken.isSessionValid()) {
                    try {
                        JSONObject jSONObject = new JSONObject();
                        jSONObject.put(Oauth2AccessToken.KEY_UID, oauth2AccessToken.getUid());
                        jSONObject.put("access_token", oauth2AccessToken.getToken());
                        jSONObject.put(Oauth2AccessToken.KEY_REFRESH_TOKEN, oauth2AccessToken.getRefreshToken());
                        jSONObject.put("expire_time", "" + oauth2AccessToken.getExpiresTime());
                        z44.b("SinaHandler", "authorize onSuccess: " + jSONObject);
                        this.f1111a.a(a44.this.f26125b, jSONObject, null);
                        a44.this.c = null;
                    } catch (Exception e) {
                        z44.c("SinaHandler", "authorize onSuccess:accessToken is not parser");
                        z44.c("SinaHandler", e);
                        this.f1111a.onError(a44.this.f26125b, "授权失败:-902");
                        a44.this.c = null;
                    }
                } else {
                    z44.c("SinaHandler", "authorize onSuccess:accessToken is not SessionValid");
                    this.f1111a.onError(a44.this.f26125b, "授权失败:-901");
                    a44.this.c = null;
                }
            }
        }
    }

    /* renamed from: a44$b */
    public class b implements WbShareCallback {
        public static ChangeQuickRedirect changeQuickRedirect;

        /* renamed from: a  reason: collision with root package name */
        public final /* synthetic */ m34 f1113a;

        public b(m34 m34) {
            this.f1113a = m34;
        }

        @Override // com.sina.weibo.sdk.share.WbShareCallback
        public void onWbShareCancel() {
            if (!PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 71840, new Class[0], Void.TYPE).isSupported) {
                m34 m34 = this.f1113a;
                if (m34 != null) {
                    m34.onCancel(a44.this.f26124a);
                }
                a44.this.d = null;
            }
        }

        @Override // com.sina.weibo.sdk.share.WbShareCallback
        public void onWbShareFail() {
            if (!PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 71841, new Class[0], Void.TYPE).isSupported) {
                m34 m34 = this.f1113a;
                if (m34 != null) {
                    m34.onError(a44.this.f26124a, "分享失败");
                }
                a44.this.d = null;
            }
        }

        @Override // com.sina.weibo.sdk.share.WbShareCallback
        public void onWbShareSuccess() {
            if (!PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 71839, new Class[0], Void.TYPE).isSupported) {
                m34 m34 = this.f1113a;
                if (m34 != null) {
                    m34.onComplete(a44.this.f26124a);
                }
                a44.this.d = null;
            }
        }
    }

    @Override // defpackage.e34
    public void a(Activity activity, String str, @NonNull i34 i34) {
        if (!PatchProxy.proxy(new Object[]{activity, str, i34}, this, changeQuickRedirect, false, 71832, new Class[]{Activity.class, String.class, i34.class}, Void.TYPE).isSupported) {
            super.a(activity, str, i34);
            SsoHandler ssoHandler = new SsoHandler(activity);
            this.c = ssoHandler;
            ssoHandler.authorize(new a(i34));
        }
    }

    @Override // defpackage.e34
    public boolean b(Application application, h34 h34) {
        PatchProxyResult proxy = PatchProxy.proxy(new Object[]{application, h34}, this, changeQuickRedirect, false, 71830, new Class[]{Application.class, h34.class}, Boolean.TYPE);
        if (proxy.isSupported) {
            return ((Boolean) proxy.result).booleanValue();
        }
        this.e = application;
        WbSdk.install(application, new AuthInfo(this.e, h34.f27300b, "http://sns.whalecloud.com/sina2/callback", "follow_app_official_microblog"));
        return true;
    }

    @Override // defpackage.e34
    public boolean c(Activity activity) {
        PatchProxyResult proxy = PatchProxy.proxy(new Object[]{activity}, this, changeQuickRedirect, false, 71831, new Class[]{Activity.class}, Boolean.TYPE);
        return proxy.isSupported ? ((Boolean) proxy.result).booleanValue() : WbUtils.isWeiboInstall(activity);
    }

    @Override // defpackage.e34
    public void d(int i, int i2, Intent intent) {
        SsoHandler ssoHandler;
        Object[] objArr = {new Integer(i), new Integer(i2), intent};
        ChangeQuickRedirect changeQuickRedirect2 = changeQuickRedirect;
        Class cls = Integer.TYPE;
        if (!PatchProxy.proxy(objArr, this, changeQuickRedirect2, false, 71834, new Class[]{cls, cls, Intent.class}, Void.TYPE).isSupported && (ssoHandler = this.c) != null) {
            ssoHandler.authorizeCallBack(i, i2, intent);
        }
    }

    @Override // defpackage.e34
    public void e(Intent intent, m34 m34) {
        WbShareHandler wbShareHandler;
        if (!PatchProxy.proxy(new Object[]{intent, m34}, this, changeQuickRedirect, false, 71835, new Class[]{Intent.class, m34.class}, Void.TYPE).isSupported && (wbShareHandler = this.d) != null) {
            wbShareHandler.doResultIntent(intent, new b(m34));
        }
    }

    @Override // defpackage.e34
    public void f(Activity activity, String str, n34 n34, m34 m34) {
        if (!PatchProxy.proxy(new Object[]{activity, str, n34, m34}, this, changeQuickRedirect, false, 71833, new Class[]{Activity.class, String.class, n34.class, m34.class}, Void.TYPE).isSupported) {
            super.f(activity, str, n34, m34);
            if (!WbSdk.isWbInstall(activity)) {
                m34.onError(str, "分享失败,未安装微博");
                return;
            }
            this.f26124a = str;
            while (activity.getParent() != null) {
                activity = activity.getParent();
            }
            WeiboMultiMessage weiboMultiMessage = new WeiboMultiMessage();
            if (n34 instanceof t34) {
                t34 t34 = (t34) n34;
                if (t34.c().length() > 0) {
                    TextObject textObject = new TextObject();
                    textObject.text = t34.c();
                    weiboMultiMessage.textObject = textObject;
                }
                if (t34.a() != null) {
                    ImageObject imageObject = new ImageObject();
                    imageObject.setImageObject(t34.a());
                    weiboMultiMessage.imageObject = imageObject;
                } else if (!TextUtils.isEmpty(t34.b())) {
                    ImageObject imageObject2 = new ImageObject();
                    imageObject2.imagePath = t34.b();
                    weiboMultiMessage.imageObject = imageObject2;
                }
                WbShareHandler wbShareHandler = new WbShareHandler(activity);
                this.d = wbShareHandler;
                wbShareHandler.registerApp();
                this.d.setProgressColor(-13388315);
                this.d.shareMessage(weiboMultiMessage, false);
            } else if (m34 != null) {
                m34.onError(str, "weibo is not support this shareMedia");
            }
        }
    }
}