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


package com.tencent.mm.plugin.webview.ui.tools.jsapi;

import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import com.tencent.map.lib.models.AccessibleTouchItem;
import com.tencent.mm.plugin.webview.ui.tools.jsapi.t0;
import com.tencent.mm.sdk.platformtools.Log;
import com.tencent.mm.sdk.platformtools.Util;
import com.tencent.mm.ui.MMActivity;
import java.lang.ref.WeakReference;
import java.net.URLEncoder;
import java.util.HashMap;

public final class z3 implements MMActivity.d {

    /* renamed from: d  reason: collision with root package name */
    public int f167993d;

    /* renamed from: e  reason: collision with root package name */
    public boolean f167994e = false;

    /* renamed from: f  reason: collision with root package name */
    public int f167995f;

    /* renamed from: g  reason: collision with root package name */
    public f f167996g;

    /* renamed from: h  reason: collision with root package name */
    public String f167997h;

    /* renamed from: i  reason: collision with root package name */
    public WeakReference<Context> f167998i;

    /* renamed from: j  reason: collision with root package name */
    public e f167999j;

    public class a implements Runnable {
    }

    public static final class b extends g {
        public b(a aVar) {
            super(null);
        }

        @Override // com.tencent.mm.plugin.webview.ui.tools.jsapi.z3.g
        public String a() {
            return jn.d.BaiduMap.h();
        }

        @Override // com.tencent.mm.plugin.webview.ui.tools.jsapi.z3.g
        public void b(Context context, f fVar, f fVar2, String str) {
            if (context == null) {
                super.b(context, fVar, fVar2, str);
                return;
            }
            String format = String.format("baidumap://map/direction?destination=%f,%f&mode=driving", Double.valueOf(fVar2.f168000a), Double.valueOf(fVar2.f168001b));
            if (fVar != null) {
                format = format + String.format("origin=%f,%f", Double.valueOf(fVar.f168000a), Double.valueOf(fVar.f168001b));
            }
            try {
                Intent intent = new Intent("android.intent.action.VIEW", Uri.parse(format + "&src=webapp.car.carroutelistmappg.weixindrivenav"));
                k30.a aVar = new k30.a();
                aVar.c(intent);
                j30.a.d(context, aVar.b(), "com/tencent/mm/plugin/webview/ui/tools/jsapi/OpenMapNavigator$BaiduNavigateJumper", "goNavigate", "(Landroid/content/Context;Lcom/tencent/mm/plugin/webview/ui/tools/jsapi/OpenMapNavigator$Location;Lcom/tencent/mm/plugin/webview/ui/tools/jsapi/OpenMapNavigator$Location;Ljava/lang/String;)V", "Undefined", "startActivity", "(Landroid/content/Intent;)V");
                context.startActivity((Intent) aVar.a(0));
                j30.a.e(context, "com/tencent/mm/plugin/webview/ui/tools/jsapi/OpenMapNavigator$BaiduNavigateJumper", "goNavigate", "(Landroid/content/Context;Lcom/tencent/mm/plugin/webview/ui/tools/jsapi/OpenMapNavigator$Location;Lcom/tencent/mm/plugin/webview/ui/tools/jsapi/OpenMapNavigator$Location;Ljava/lang/String;)V", "Undefined", "startActivity", "(Landroid/content/Intent;)V");
            } catch (Exception e15) {
                Log.printErrStackTrace("MicroMsg.OpenMapNavigator", e15, "", new Object[0]);
            }
        }
    }

    public static final class c extends g {
        public c(a aVar) {
            super(null);
        }

        @Override // com.tencent.mm.plugin.webview.ui.tools.jsapi.z3.g
        public String a() {
            return jn.d.AutonaviMap.h();
        }

        @Override // com.tencent.mm.plugin.webview.ui.tools.jsapi.z3.g
        public void b(Context context, f fVar, f fVar2, String str) {
            if (context == null) {
                super.b(context, fVar, fVar2, str);
                return;
            }
            Intent intent = new Intent("android.intent.action.VIEW", Uri.parse(String.format("androidamap://navi?sourceApplication=%s&lat=%f&lon=%f&dev=1&style=2", "MicroMessager", Double.valueOf(fVar2.f168000a), Double.valueOf(fVar2.f168001b))));
            intent.addCategory("android.intent.category.DEFAULT");
            intent.setPackage(a());
            k30.a aVar = new k30.a();
            aVar.c(intent);
            j30.a.d(context, aVar.b(), "com/tencent/mm/plugin/webview/ui/tools/jsapi/OpenMapNavigator$GaodeNavigateJumper", "goNavigate", "(Landroid/content/Context;Lcom/tencent/mm/plugin/webview/ui/tools/jsapi/OpenMapNavigator$Location;Lcom/tencent/mm/plugin/webview/ui/tools/jsapi/OpenMapNavigator$Location;Ljava/lang/String;)V", "Undefined", "startActivity", "(Landroid/content/Intent;)V");
            context.startActivity((Intent) aVar.a(0));
            j30.a.e(context, "com/tencent/mm/plugin/webview/ui/tools/jsapi/OpenMapNavigator$GaodeNavigateJumper", "goNavigate", "(Landroid/content/Context;Lcom/tencent/mm/plugin/webview/ui/tools/jsapi/OpenMapNavigator$Location;Lcom/tencent/mm/plugin/webview/ui/tools/jsapi/OpenMapNavigator$Location;Ljava/lang/String;)V", "Undefined", "startActivity", "(Landroid/content/Intent;)V");
        }
    }

    public static final class d extends g {
        public d(a aVar) {
            super(null);
        }

        @Override // com.tencent.mm.plugin.webview.ui.tools.jsapi.z3.g
        public String a() {
            return jn.d.GoogleMap.h();
        }

        @Override // com.tencent.mm.plugin.webview.ui.tools.jsapi.z3.g
        public void b(Context context, f fVar, f fVar2, String str) {
            if (context == null) {
                super.b(context, fVar, fVar2, str);
                return;
            }
            String format = String.format("http://maps.google.com/maps?f=d&daddr=%f,%f", Double.valueOf(fVar2.f168000a), Double.valueOf(fVar2.f168001b));
            if (fVar != null) {
                format = format + String.format("&saddr=%f,%f", Double.valueOf(fVar.f168000a), Double.valueOf(fVar.f168001b));
            }
            Intent intent = new Intent("android.intent.action.VIEW", Uri.parse(format));
            intent.setClassName("com.google.android.apps.maps", "com.google.android.maps.MapsActivity");
            k30.a aVar = new k30.a();
            aVar.c(intent);
            j30.a.d(context, aVar.b(), "com/tencent/mm/plugin/webview/ui/tools/jsapi/OpenMapNavigator$GoogleNavigateJumper", "goNavigate", "(Landroid/content/Context;Lcom/tencent/mm/plugin/webview/ui/tools/jsapi/OpenMapNavigator$Location;Lcom/tencent/mm/plugin/webview/ui/tools/jsapi/OpenMapNavigator$Location;Ljava/lang/String;)V", "Undefined", "startActivity", "(Landroid/content/Intent;)V");
            context.startActivity((Intent) aVar.a(0));
            j30.a.e(context, "com/tencent/mm/plugin/webview/ui/tools/jsapi/OpenMapNavigator$GoogleNavigateJumper", "goNavigate", "(Landroid/content/Context;Lcom/tencent/mm/plugin/webview/ui/tools/jsapi/OpenMapNavigator$Location;Lcom/tencent/mm/plugin/webview/ui/tools/jsapi/OpenMapNavigator$Location;Ljava/lang/String;)V", "Undefined", "startActivity", "(Landroid/content/Intent;)V");
        }
    }

    public interface e {
    }

    public static final class f {

        /* renamed from: a  reason: collision with root package name */
        public double f168000a;

        /* renamed from: b  reason: collision with root package name */
        public double f168001b;

        public f(double d15, double d16, a aVar) {
            this.f168000a = d15;
            this.f168001b = d16;
        }
    }

    public static abstract class g {
        public g(a aVar) {
        }

        public abstract String a();

        public void b(Context context, f fVar, f fVar2, String str) {
            if (context != null) {
                Intent intent = new Intent("android.intent.action.VIEW", Uri.parse("geo:" + fVar2.f168000a + "," + fVar2.f168001b));
                intent.setPackage(a());
                intent.addFlags(268435456);
                k30.a aVar = new k30.a();
                aVar.c(intent);
                j30.a.d(context, aVar.b(), "com/tencent/mm/plugin/webview/ui/tools/jsapi/OpenMapNavigator$NavigateJumper", "goNavigate", "(Landroid/content/Context;Lcom/tencent/mm/plugin/webview/ui/tools/jsapi/OpenMapNavigator$Location;Lcom/tencent/mm/plugin/webview/ui/tools/jsapi/OpenMapNavigator$Location;Ljava/lang/String;)V", "Undefined", "startActivity", "(Landroid/content/Intent;)V");
                context.startActivity((Intent) aVar.a(0));
                j30.a.e(context, "com/tencent/mm/plugin/webview/ui/tools/jsapi/OpenMapNavigator$NavigateJumper", "goNavigate", "(Landroid/content/Context;Lcom/tencent/mm/plugin/webview/ui/tools/jsapi/OpenMapNavigator$Location;Lcom/tencent/mm/plugin/webview/ui/tools/jsapi/OpenMapNavigator$Location;Ljava/lang/String;)V", "Undefined", "startActivity", "(Landroid/content/Intent;)V");
            }
        }
    }

    public static final class h extends g {
        public h(a aVar) {
            super(null);
        }

        @Override // com.tencent.mm.plugin.webview.ui.tools.jsapi.z3.g
        public String a() {
            return jn.d.SogouMap.h();
        }

        @Override // com.tencent.mm.plugin.webview.ui.tools.jsapi.z3.g
        public void b(Context context, f fVar, f fVar2, String str) {
            String str2;
            String str3;
            if (context == null) {
                super.b(context, fVar, fVar2, str);
                return;
            }
            String format = String.format("wechatnav://type=nav&tocoord=%f,%f", Double.valueOf(fVar2.f168000a), Double.valueOf(fVar2.f168001b));
            if (fVar != null) {
                str2 = format + String.format("&fromcoord=%f,%f", Double.valueOf(fVar.f168000a), Double.valueOf(fVar.f168001b));
                if (!Util.isNullOrNil((String) null)) {
                    str2 = str2 + String.format("&from=%s", URLEncoder.encode(null));
                }
            } else {
                str2 = format + String.format("&from=%s", AccessibleTouchItem.MY_LOCATION_PREFIX);
            }
            if (!Util.isNullOrNil(str)) {
                str3 = str;
            } else if (!Util.isNullOrNil((String) null)) {
                str3 = null;
            } else {
                str3 = "目的地";
            }
            Intent intent = new Intent("android.intent.action.VIEW", Uri.parse(str2 + String.format("&to=%s", str3)));
            intent.setPackage(a());
            k30.a aVar = new k30.a();
            aVar.c(intent);
            j30.a.d(context, aVar.b(), "com/tencent/mm/plugin/webview/ui/tools/jsapi/OpenMapNavigator$SogouNavigateJumper", "goNavigate", "(Landroid/content/Context;Lcom/tencent/mm/plugin/webview/ui/tools/jsapi/OpenMapNavigator$Location;Lcom/tencent/mm/plugin/webview/ui/tools/jsapi/OpenMapNavigator$Location;Ljava/lang/String;)V", "Undefined", "startActivity", "(Landroid/content/Intent;)V");
            context.startActivity((Intent) aVar.a(0));
            j30.a.e(context, "com/tencent/mm/plugin/webview/ui/tools/jsapi/OpenMapNavigator$SogouNavigateJumper", "goNavigate", "(Landroid/content/Context;Lcom/tencent/mm/plugin/webview/ui/tools/jsapi/OpenMapNavigator$Location;Lcom/tencent/mm/plugin/webview/ui/tools/jsapi/OpenMapNavigator$Location;Ljava/lang/String;)V", "Undefined", "startActivity", "(Landroid/content/Intent;)V");
        }
    }

    public static final class i extends g {
        public i(a aVar) {
            super(null);
        }

        @Override // com.tencent.mm.plugin.webview.ui.tools.jsapi.z3.g
        public String a() {
            return jn.d.TencentMap.h();
        }

        @Override // com.tencent.mm.plugin.webview.ui.tools.jsapi.z3.g
        public void b(Context context, f fVar, f fVar2, String str) {
            String str2;
            if (context == null) {
                super.b(context, fVar, fVar2, str);
                return;
            }
            String format = String.format("sosomap://type=nav&tocoord=%f,%f", Double.valueOf(fVar2.f168001b), Double.valueOf(fVar2.f168000a));
            if (fVar != null) {
                format = format + String.format("fromcoord=%f,%f", Double.valueOf(fVar.f168001b), Double.valueOf(fVar.f168000a));
                if (!Util.isNullOrNil((String) null)) {
                    format = format + String.format("&from=%s", URLEncoder.encode(null));
                }
            }
            if (!Util.isNullOrNil(str)) {
                str2 = str;
            } else if (!Util.isNullOrNil((String) null)) {
                str2 = null;
            } else {
                str2 = "地图选点";
            }
            Intent intent = new Intent("android.intent.action.VIEW", Uri.parse((format + String.format("&to=%s", URLEncoder.encode(str2))) + "&referer=wx_client"));
            intent.setPackage(a());
            k30.a aVar = new k30.a();
            aVar.c(intent);
            j30.a.d(context, aVar.b(), "com/tencent/mm/plugin/webview/ui/tools/jsapi/OpenMapNavigator$TencentNavigateJumper", "goNavigate", "(Landroid/content/Context;Lcom/tencent/mm/plugin/webview/ui/tools/jsapi/OpenMapNavigator$Location;Lcom/tencent/mm/plugin/webview/ui/tools/jsapi/OpenMapNavigator$Location;Ljava/lang/String;)V", "Undefined", "startActivity", "(Landroid/content/Intent;)V");
            context.startActivity((Intent) aVar.a(0));
            j30.a.e(context, "com/tencent/mm/plugin/webview/ui/tools/jsapi/OpenMapNavigator$TencentNavigateJumper", "goNavigate", "(Landroid/content/Context;Lcom/tencent/mm/plugin/webview/ui/tools/jsapi/OpenMapNavigator$Location;Lcom/tencent/mm/plugin/webview/ui/tools/jsapi/OpenMapNavigator$Location;Ljava/lang/String;)V", "Undefined", "startActivity", "(Landroid/content/Intent;)V");
        }
    }

    @Override // com.tencent.mm.ui.MMActivity.d
    public void mmOnActivityResult(int i15, int i16, Intent intent) {
        e eVar;
        g gVar;
        Context context = this.f167998i.get();
        e eVar2 = this.f167999j;
        if (!(eVar2 == null || context == null)) {
            if (!this.f167994e) {
                Log.e("MicroMsg.OpenMapNavigator", "onActivityResult called without msgId attached...");
            } else if (i15 != 33) {
                Log.e("MicroMsg.OpenMapNavigator", "onActivityResult, mismatched request_code = %d", Integer.valueOf(i15));
                ((t0.a) this.f167999j).a(this.f167993d, "fail");
            } else if (i16 == 4097 || i16 == 0) {
                ((t0.a) eVar2).a(this.f167993d, "cancel");
            } else if (i16 == -1) {
                String stringExtra = intent.getStringExtra("selectpkg");
                if (Util.isNullOrNil(stringExtra)) {
                    Log.e("MicroMsg.OpenMapNavigator", "onActivityResult, get null packageName");
                    ((t0.a) this.f167999j).a(this.f167993d, "fail");
                } else {
                    if (jn.d.GoogleMap.h().equals(stringExtra)) {
                        gVar = new d(null);
                    } else if (jn.d.BaiduMap.h().equals(stringExtra)) {
                        gVar = new b(null);
                    } else if (jn.d.SogouMap.h().equals(stringExtra)) {
                        gVar = new h(null);
                    } else if (jn.d.AutonaviMap.h().equals(stringExtra)) {
                        gVar = new c(null);
                    } else {
                        gVar = new i(null);
                    }
                    gVar.b(context, null, this.f167996g, this.f167997h);
                    ((t0.a) this.f167999j).a(this.f167993d, "ok");
                }
            } else {
                Log.e("MicroMsg.OpenMapNavigator", "onActivityResult, not support result_code = %d", Integer.valueOf(i16));
                ((t0.a) this.f167999j).a(this.f167993d, "fail");
            }
        }
        if (this.f167994e && (eVar = this.f167999j) != null) {
            MsgHandler$$q0 msgHandler$$q0 = (MsgHandler$$q0) ((HashMap) t0.this.f167906i.Z).remove(Integer.valueOf(this.f167993d));
            if (msgHandler$$q0 != null) {
                msgHandler$$q0.f167493a = null;
                msgHandler$$q0.f167494b = null;
            }
        }
        this.f167994e = false;
        this.f167995f = 0;
        this.f167996g = null;
        this.f167998i = null;
        this.f167999j = null;
        this.f167997h = null;
    }
}