package com.tencent.mm.plugin.appbrand.jsapi.contact;

import android.content.Context;
import com.tencent.luggage.g.e.a;
import com.tencent.mm.plugin.appbrand.jsapi.c;

class c$1 implements a {
    final /* synthetic */ int eIl;
    final /* synthetic */ Context hIi;
    final /* synthetic */ c hIj;
    final /* synthetic */ c hxc;

    c$1(c cVar, c cVar2, int i, Context context) {
        this.hIj = cVar;
        this.hxc = cVar2;
        this.eIl = i;
        this.hIi = context;
    }

    /* JADX WARNING: Removed duplicated region for block: B:58:0x0204  */
    /* JADX WARNING: Removed duplicated region for block: B:54:0x01d9  */
    public final void b(int r13, android.content.Intent r14) {
        /*
        r12 = this;
        r11 = 0;
        r10 = 1;
        r9 = 126269; // 0x1ed3d float:1.7694E-40 double:6.2385E-319;
        r6 = 0;
        com.tencent.matrix.trace.core.AppMethodBeat.i(r9);
        if (r13 == 0) goto L_0x000d;
    L_0x000b:
        if (r13 != r10) goto L_0x0021;
    L_0x000d:
        r0 = r12.hxc;
        r1 = r12.eIl;
        r2 = r12.hIj;
        r3 = "cancel";
        r2 = r2.j(r3, r6);
        r0.M(r1, r2);
        com.tencent.matrix.trace.core.AppMethodBeat.o(r9);
    L_0x0020:
        return;
    L_0x0021:
        r0 = -1;
        if (r13 != r0) goto L_0x0220;
    L_0x0024:
        r1 = r14.getData();
        if (r1 != 0) goto L_0x0047;
    L_0x002a:
        r0 = "MicroMsg.JsApiChooseContact";
        r1 = "onActivityResult, uri == null";
        com.tencent.mm.sdk.platformtools.ab.e(r0, r1);
        r0 = r12.hxc;
        r1 = r12.eIl;
        r2 = r12.hIj;
        r3 = "fail";
        r2 = r2.j(r3, r6);
        r0.M(r1, r2);
        com.tencent.matrix.trace.core.AppMethodBeat.o(r9);
        goto L_0x0020;
    L_0x0047:
        r0 = r12.hIi;
        r2 = "android.permission.READ_CONTACTS";
        r0 = com.tencent.luggage.g.g.o(r0, r2);
        if (r0 != 0) goto L_0x006f;
    L_0x0052:
        r0 = "MicroMsg.JsApiChooseContact";
        r1 = "onActivityResult, no contact permission";
        com.tencent.mm.sdk.platformtools.ab.e(r0, r1);
        r0 = r12.hxc;
        r1 = r12.eIl;
        r2 = r12.hIj;
        r3 = "fail:system permission denied";
        r2 = r2.j(r3, r6);
        r0.M(r1, r2);
        com.tencent.matrix.trace.core.AppMethodBeat.o(r9);
        goto L_0x0020;
    L_0x006f:
        r0 = r12.hIi;	 Catch:{ SecurityException -> 0x00e0 }
        r0 = r0.getContentResolver();	 Catch:{ SecurityException -> 0x00e0 }
        r2 = 0;
        r3 = 0;
        r4 = 0;
        r5 = 0;
        r7 = r0.query(r1, r2, r3, r4, r5);	 Catch:{ SecurityException -> 0x00e0 }
        if (r7 == 0) goto L_0x0230;
    L_0x007f:
        r0 = r7.getCount();
        if (r0 <= 0) goto L_0x0230;
    L_0x0085:
        r7.moveToFirst();
        r0 = "has_phone_number";
        r0 = r7.getColumnIndex(r0);
        if (r0 <= 0) goto L_0x0097;
    L_0x0091:
        r0 = r7.getInt(r0);
        if (r0 <= 0) goto L_0x0230;
    L_0x0097:
        r0 = "_id";
        r0 = r7.getColumnIndex(r0);
        r2 = r7.getString(r0);
        r0 = r12.hIi;
        r0 = r0.getContentResolver();
        r1 = android.provider.ContactsContract.CommonDataKinds.Phone.CONTENT_URI;
        r3 = "contact_id = ";
        r2 = java.lang.String.valueOf(r2);
        r3 = r3.concat(r2);
        r2 = r6;
        r4 = r6;
        r5 = r6;
        r3 = r0.query(r1, r2, r3, r4, r5);
        r0 = "MicroMsg.JsApiChooseContact";
        r1 = "onActivityResult, queried cursor = %s";
        r2 = new java.lang.Object[r10];
        r2[r11] = r7;
        com.tencent.mm.sdk.platformtools.ab.i(r0, r1, r2);
        if (r3 != 0) goto L_0x012b;
    L_0x00cb:
        r0 = r12.hxc;
        r1 = r12.eIl;
        r2 = r12.hIj;
        r3 = "fail";
        r2 = r2.j(r3, r6);
        r0.M(r1, r2);
        com.tencent.matrix.trace.core.AppMethodBeat.o(r9);
        goto L_0x0020;
    L_0x00e0:
        r0 = move-exception;
        r1 = "MicroMsg.JsApiChooseContact";
        r2 = "onActivityResult, permission denied: %s";
        r3 = new java.lang.Object[r10];
        r0 = r0.toString();
        r3[r11] = r0;
        com.tencent.mm.sdk.platformtools.ab.e(r1, r2, r3);
        r0 = new android.app.AlertDialog$Builder;
        r1 = r12.hIi;
        r0.<init>(r1);
        r1 = com.tencent.mm.sdk.platformtools.ah.getResources();
        r2 = 2131296796; // 0x7f09021c float:1.8211519E38 double:1.053000528E-314;
        r1 = r1.getString(r2);
        r0 = r0.setMessage(r1);
        r1 = "";
        r0 = r0.setTitle(r1);
        r0 = r0.setCancelable(r10);
        r0.show();
        r0 = r12.hxc;
        r1 = r12.eIl;
        r2 = r12.hIj;
        r3 = "fail:system permission denied";
        r2 = r2.j(r3, r6);
        r0.M(r1, r2);
        com.tencent.matrix.trace.core.AppMethodBeat.o(r9);
        goto L_0x0020;
    L_0x012b:
        r0 = r3.moveToFirst();
        if (r0 == 0) goto L_0x022d;
    L_0x0131:
        r2 = r6;
        r1 = r6;
    L_0x0133:
        r0 = r3.isAfterLast();
        if (r0 != 0) goto L_0x01c4;
    L_0x0139:
        r0 = "data1";
        r0 = r3.getColumnIndex(r0);
        r2 = "display_name";
        r2 = r3.getColumnIndex(r2);
        r0 = r3.getString(r0);
        r2 = r3.getString(r2);
        r4 = "MicroMsg.JsApiChooseContact";
        r5 = "onActivityResult, username : ";
        r8 = java.lang.String.valueOf(r2);
        r5 = r5.concat(r8);
        com.tencent.mm.sdk.platformtools.ab.d(r4, r5);
        if (r0 == 0) goto L_0x022a;
    L_0x0162:
        r4 = "MicroMsg.JsApiChooseContact";
        r5 = "onActivityResult, phoneNumber : ";
        r8 = java.lang.String.valueOf(r0);
        r5 = r5.concat(r8);
        com.tencent.mm.sdk.platformtools.ab.d(r4, r5);
        if (r0 != 0) goto L_0x01ab;
    L_0x0175:
        r0 = r6;
    L_0x0176:
        r4 = "MicroMsg.JsApiChooseContact";
        r5 = "onActivityResult, phoneNumber : ";
        r8 = java.lang.String.valueOf(r0);
        r5 = r5.concat(r8);
        com.tencent.mm.sdk.platformtools.ab.d(r4, r5);
        r4 = android.telephony.PhoneNumberUtils.isGlobalPhoneNumber(r0);
        if (r4 == 0) goto L_0x0227;
    L_0x018d:
        r4 = r0.length();
        r5 = 11;
        if (r4 != r5) goto L_0x0227;
    L_0x0195:
        r1 = "MicroMsg.JsApiChooseContact";
        r4 = "onActivityResult, phoneResult : ";
        r5 = java.lang.String.valueOf(r0);
        r4 = r4.concat(r5);
        com.tencent.mm.sdk.platformtools.ab.d(r1, r4);
    L_0x01a6:
        r3.moveToNext();
        r1 = r0;
        goto L_0x0133;
    L_0x01ab:
        r4 = "\\D";
        r5 = "";
        r0 = r0.replaceAll(r4, r5);
        r4 = "86";
        r4 = r0.startsWith(r4);
        if (r4 == 0) goto L_0x0176;
    L_0x01be:
        r4 = 2;
        r0 = r0.substring(r4);
        goto L_0x0176;
    L_0x01c4:
        r0 = r2;
    L_0x01c5:
        r3.close();	 Catch:{ Exception -> 0x0225 }
    L_0x01c8:
        if (r7 == 0) goto L_0x01d3;
    L_0x01ca:
        r2 = r7.isClosed();
        if (r2 != 0) goto L_0x01d3;
    L_0x01d0:
        r7.close();
    L_0x01d3:
        r2 = com.tencent.mm.sdk.platformtools.bo.isNullOrNil(r1);
        if (r2 != 0) goto L_0x0204;
    L_0x01d9:
        r2 = new java.util.HashMap;
        r2.<init>(r10);
        r3 = "phoneNumber";
        r2.put(r3, r1);
        r1 = "displayName";
        if (r0 != 0) goto L_0x01ec;
    L_0x01e9:
        r0 = "";
    L_0x01ec:
        r2.put(r1, r0);
        r0 = r12.hxc;
        r1 = r12.eIl;
        r3 = r12.hIj;
        r4 = "ok";
        r2 = r3.j(r4, r2);
        r0.M(r1, r2);
        com.tencent.matrix.trace.core.AppMethodBeat.o(r9);
        goto L_0x0020;
    L_0x0204:
        r0 = r12.hxc;
        r1 = r12.eIl;
        r2 = r12.hIj;
        r3 = "fail";
        r2 = r2.j(r3, r6);
        r0.M(r1, r2);
        r0 = r12.hIi;
        r1 = 2131296767; // 0x7f0901ff float:1.821146E38 double:1.0530005137E-314;
        r0 = android.widget.Toast.makeText(r0, r1, r11);
        r0.show();
    L_0x0220:
        com.tencent.matrix.trace.core.AppMethodBeat.o(r9);
        goto L_0x0020;
    L_0x0225:
        r2 = move-exception;
        goto L_0x01c8;
    L_0x0227:
        r0 = r1;
        goto L_0x0195;
    L_0x022a:
        r0 = r1;
        goto L_0x01a6;
    L_0x022d:
        r0 = r6;
        r1 = r6;
        goto L_0x01c5;
    L_0x0230:
        r0 = r6;
        r1 = r6;
        goto L_0x01c8;
        */
        throw new UnsupportedOperationException("Method not decompiled: com.tencent.mm.plugin.appbrand.jsapi.contact.c$1.b(int, android.content.Intent):void");
    }
}
