WeChat.apk(点击下载) / ReadMailProxy.java


package com.tencent.mm.plugin.qqmail.stub;

import android.content.Intent;
import android.os.Bundle;
import com.tencent.mm.plugin.downloader.model.FileDownloadTaskInfo;
import com.tencent.mm.plugin.downloader.model.l;
import com.tencent.mm.plugin.qqmail.ui.ReadMailUI;
import com.tencent.mm.pluginsdk.ui.tools.o1;
import com.tencent.mm.pluginsdk.ui.tools.p1;
import com.tencent.mm.sdk.platformtools.ChannelUtil;
import com.tencent.mm.sdk.platformtools.Log;
import com.tencent.mm.sdk.platformtools.MMApplicationContext;
import com.tencent.mm.sdk.platformtools.MMHandler;
import com.tencent.mm.sdk.platformtools.Util;
import com.tencent.mm.sdk.thread.ThreadPool;
import com.tencent.mm.storage.f4;
import com.tencent.mm.storage.g4;
import com.tencent.mm.storage.w1;
import d60.z;
import gh.q;
import java.net.URI;
import java.net.URL;
import java.util.Map;
import jh2.k0;
import kq.y;
import os2.d;
import rs2.o;
import yz3.j;

public class ReadMailProxy extends com.tencent.mm.remoteservice.a {

    /* renamed from: f  reason: collision with root package name */
    public d.a f138783f;

    /* renamed from: g  reason: collision with root package name */
    public d.a f138784g;

    /* renamed from: h  reason: collision with root package name */
    public p1.e f138785h = new a();

    public class a implements p1.e {
        public a() {
        }

        @Override // com.tencent.mm.pluginsdk.ui.tools.p1.e
        public void a() {
            ReadMailProxy.this.CLIENT_CALL("onGetQQMailUnreadFailed", new Object[0]);
        }

        @Override // com.tencent.mm.pluginsdk.ui.tools.p1.e
        public void onSuccess(int i15) {
            ReadMailProxy.this.CLIENT_CALL("onGetQQMailUnreadSuccess", Integer.valueOf(i15));
        }
    }

    public class b extends d.a {
        public b() {
        }

        @Override // os2.d.a
        public void a() {
            ReadMailProxy.this.CLIENT_CALL("onComplete", new Object[0]);
        }

        @Override // os2.d.a
        public void b(int i15, String str) {
            ReadMailProxy.this.CLIENT_CALL("onError", Integer.valueOf(i15), str);
        }

        @Override // os2.d.a
        public boolean c() {
            return ((Boolean) ReadMailProxy.this.CLIENT_CALL("onReady", new Object[0])).booleanValue();
        }

        @Override // os2.d.a
        public void d(String str, Map<String, String> map) {
            ReadMailProxy.this.CLIENT_CALL("onSuccess", str, map);
        }
    }

    public class c extends d.a {
        public c() {
        }

        @Override // os2.d.a
        public void a() {
            ReadMailProxy.this.CLIENT_CALL("onComplete", new Object[0]);
        }

        @Override // os2.d.a
        public void b(int i15, String str) {
            ReadMailProxy.this.CLIENT_CALL("onError", Integer.valueOf(i15), str);
        }

        @Override // os2.d.a
        public boolean c() {
            return ((Boolean) ReadMailProxy.this.CLIENT_CALL("onReady", new Object[0])).booleanValue();
        }

        @Override // os2.d.a
        public void d(String str, Map<String, String> map) {
            ReadMailProxy.this.CLIENT_CALL("onSuccess", str, map);
        }
    }

    public class d implements Runnable {

        /* renamed from: d  reason: collision with root package name */
        public final /* synthetic */ long f138789d;

        public d(ReadMailProxy readMailProxy, long j15) {
            this.f138789d = j15;
        }

        public void run() {
            ((o) j.c(o.class)).SO().b(this.f138789d);
        }
    }

    public class e implements Runnable {

        /* renamed from: d  reason: collision with root package name */
        public final /* synthetic */ long f138790d;

        /* renamed from: e  reason: collision with root package name */
        public final /* synthetic */ String f138791e;

        public e(ReadMailProxy readMailProxy, long j15, String str) {
            this.f138790d = j15;
            this.f138791e = str;
        }

        public void run() {
            f4 tz4 = ((g4) ((k0) z.q(k0.class)).WU()).tz(this.f138790d);
            String content = tz4.getContent();
            tz4.R2(content.replaceFirst("<digest>.*</digest>", "<digest>" + this.f138791e + "</digest>"));
            ((g4) ((k0) z.q(k0.class)).WU()).CA0(this.f138790d, tz4);
        }
    }

    public ReadMailProxy(com.tencent.mm.remoteservice.d dVar, d.a aVar) {
        super(dVar);
        this.f138783f = aVar;
        this.f138784g = new b();
    }

    @mw3.b
    public void cancel(long j15) {
        new MMHandler().post(new d(this, j15));
    }

    @mw3.b
    public void deleteMsgById(long j15) {
        ((g4) ((k0) z.q(k0.class)).WU()).te(j15);
    }

    @mw3.b
    public long downloadQQMailApp(String str, String str2) {
        try {
            URL url = new URL(str);
            new URI(url.getProtocol(), url.getUserInfo(), url.getHost(), url.getPort(), url.getPath(), url.getQuery(), url.getRef()).toURL();
            Intent intent = new Intent();
            intent.putExtra("rawUrl", "https://wx.mail.qq.com/list/readtemplate?name=wxplugin_push.html");
            sv3.b.j(MMApplicationContext.getContext(), "webview", ".ui.tools.WebViewUI", intent, null);
            return -1;
        } catch (Exception e15) {
            Log.e("MicroMsg.ReadMailProxy", "dz[download qq mail error:%s]", e15.toString());
            Log.printErrStackTrace("MicroMsg.ReadMailProxy", e15, "", new Object[0]);
            return -1;
        }
    }

    @mw3.b
    public long get(String str, Map map, Bundle bundle) {
        d.b bVar = new d.b();
        bVar.f278302a = bundle.getBoolean("qqmail_httpoptions_expired");
        bVar.f278303b = bundle.getBoolean("qqmail_httpoptions_needcache");
        bVar.f278304c = bundle.getBoolean("qqmail_httpoptions_needparse");
        return ((o) j.c(o.class)).SO().g(str, 0, map, null, bVar, this.f138784g);
    }

    @mw3.b
    public String getBindUin() {
        return new q(Util.nullAsNil((Integer) z.s().i().e(9, null))).toString();
    }

    @mw3.b
    public double getMailAppDownloadProgress(long j15) {
        FileDownloadTaskInfo p15 = ((l) ((y) j.c(y.class)).fI0()).p(j15);
        long j16 = p15.f103388n;
        if (j16 <= 0) {
            return 0.0d;
        }
        return (((double) p15.f103387j) * 1.0d) / ((double) j16);
    }

    @mw3.b
    public Integer getMailAppDownloadStatus(long j15) {
        return Integer.valueOf(((l) ((y) j.c(y.class)).fI0()).p(j15).f103383f);
    }

    @mw3.b
    public String getMailAppEnterUlAndroid() {
        return ((jt3.b) z.q(jt3.b.class)).ni0().a(1, "MailApp", "MailAppEnterMailAppUrlAndroid");
    }

    @mw3.b
    public String getMailAppRedirectUrlAndroid() {
        return ((jt3.b) z.q(jt3.b.class)).ni0().a(1, "MailApp", "MailAppRedirectUrAndroid");
    }

    @mw3.b
    public String getMsgContent(long j15) {
        return ((g4) ((k0) z.q(k0.class)).WU()).tz(j15).getContent();
    }

    @mw3.b
    public Object getUneradMailCountFromConfig() {
        return z.s().i().f(w1.a.H1, -1);
    }

    @mw3.b
    public void getUnreadMailCount() {
        p1.e eVar = this.f138785h;
        String str = p1.f173326a;
        ThreadPool.post(new o1(eVar), "QQMailUnreadHelper");
    }

    @mw3.b
    public String getUserBindEmail() {
        z.h();
        return Util.nullAsNil((String) z.s().i().e(5, null));
    }

    @mw3.b
    public boolean isSDCardAvailable() {
        return z.s().n();
    }

    @mw3.a
    public void onComplete() {
        d.a aVar = this.f138783f;
        if (aVar != null) {
            aVar.a();
        }
    }

    @mw3.a
    public void onError(int i15, String str) {
        d.a aVar = this.f138783f;
        if (aVar != null) {
            aVar.b(i15, str);
        }
    }

    @mw3.a
    public boolean onReady() {
        d.a aVar = this.f138783f;
        if (aVar == null) {
            return true;
        }
        return aVar.c();
    }

    @mw3.a
    public void onSuccess(String str, Map<String, String> map) {
        d.a aVar = this.f138783f;
        if (aVar != null) {
            aVar.d(str, map);
        }
    }

    @mw3.b
    public long post(String str, Map map, Bundle bundle) {
        d.b bVar = new d.b();
        bVar.f278302a = bundle.getBoolean("qqmail_httpoptions_expired");
        bVar.f278303b = bundle.getBoolean("qqmail_httpoptions_needcache");
        bVar.f278304c = bundle.getBoolean("qqmail_httpoptions_needparse");
        return ((o) j.c(o.class)).SO().g(str, 1, map, null, bVar, this.f138784g);
    }

    @mw3.b
    public int removeDownloadQQMailAppTask(long j15) {
        return ((l) ((y) j.c(y.class)).fI0()).t(j15);
    }

    @mw3.b
    public void replaceMsgContent(long j15, String str) {
        new MMHandler().post(new e(this, j15, str));
    }

    @mw3.b
    public void reportKvState(int i15, int i16) {
        com.tencent.mm.plugin.report.service.q.INSTANCE.g(i15, Integer.valueOf(i16));
    }

    @mw3.b
    public void reportKvStates(int i15, int i16, int i17) {
        com.tencent.mm.plugin.report.service.q.INSTANCE.g(i15, Integer.valueOf(i16), Integer.valueOf(i17));
    }

    @mw3.b
    public Integer showMailAppRecommend() {
        if (ChannelUtil.channelId == 1) {
            return 0;
        }
        return Integer.valueOf(Util.getInt(((jt3.b) z.q(jt3.b.class)).ni0().a(1, "MailApp", "ShowMailAppRecommend"), 0));
    }

    public ReadMailProxy(com.tencent.mm.remoteservice.d dVar, d.a aVar, ReadMailUI.l lVar) {
        super(dVar);
        this.f138783f = aVar;
        this.f138784g = new c();
    }
}