得物.apk(点击下载) / CalendarHandler$getCalendarAccount$2.java


package com.shizhuang.duapp.modules.web.handlers.defaults;

import android.content.ContentUris;
import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import android.net.Uri;
import android.provider.CalendarContract;
import com.meituan.robust.ChangeQuickRedirect;
import com.meituan.robust.PatchProxy;
import com.meituan.robust.PatchProxyResult;
import ij.m;
import java.util.TimeZone;
import kotlin.Metadata;
import kotlin.ResultKt;
import kotlin.Unit;
import kotlin.coroutines.Continuation;
import kotlin.coroutines.intrinsics.IntrinsicsKt__IntrinsicsKt;
import kotlin.coroutines.jvm.internal.Boxing;
import kotlin.coroutines.jvm.internal.DebugMetadata;
import kotlin.coroutines.jvm.internal.SuspendLambda;
import kotlin.io.CloseableKt;
import kotlin.jvm.functions.Function2;
import kotlinx.coroutines.CoroutineScope;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

@Metadata(bv = {1, 0, 3}, d1 = {"\u0000\u000e\n\u0000\n\u0002\u0010\t\n\u0002\u0018\u0002\n\u0002\b\u0002\u0010\u0000\u001a\u00020\u0001*\u00020\u0002HŠ@¢\u0006\u0004\b\u0003\u0010\u0004"}, d2 = {"<anonymous>", "", "Lkotlinx/coroutines/CoroutineScope;", "invoke", "(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;"}, k = 3, mv = {1, 4, 2})
@DebugMetadata(c = "com.shizhuang.duapp.modules.web.handlers.defaults.CalendarHandler$getCalendarAccount$2", f = "CalendarHandler.kt", i = {}, l = {}, m = "invokeSuspend", n = {}, s = {})
/* compiled from: CalendarHandler.kt */
public final class CalendarHandler$getCalendarAccount$2 extends SuspendLambda implements Function2<CoroutineScope, Continuation<? super Long>, Object> {
    public static ChangeQuickRedirect changeQuickRedirect;
    public final /* synthetic */ Context $context;
    public int label;

    /* JADX INFO: super call moved to the top of the method (can break code semantics) */
    public CalendarHandler$getCalendarAccount$2(Context context, Continuation continuation) {
        super(2, continuation);
        this.$context = context;
    }

    @Override // kotlin.coroutines.jvm.internal.BaseContinuationImpl
    @NotNull
    public final Continuation<Unit> create(@Nullable Object obj, @NotNull Continuation<?> continuation) {
        PatchProxyResult proxy = PatchProxy.proxy(new Object[]{obj, continuation}, this, changeQuickRedirect, false, 332587, new Class[]{Object.class, Continuation.class}, Continuation.class);
        return proxy.isSupported ? (Continuation) proxy.result : new CalendarHandler$getCalendarAccount$2(this.$context, continuation);
    }

    /* JADX DEBUG: Method arguments types fixed to match base method, original types: [java.lang.Object, java.lang.Object] */
    @Override // kotlin.jvm.functions.Function2
    public final Object invoke(CoroutineScope coroutineScope, Continuation<? super Long> continuation) {
        PatchProxyResult proxy = PatchProxy.proxy(new Object[]{coroutineScope, continuation}, this, changeQuickRedirect, false, 332588, new Class[]{Object.class, Object.class}, Object.class);
        return proxy.isSupported ? proxy.result : ((CalendarHandler$getCalendarAccount$2) create(coroutineScope, continuation)).invokeSuspend(Unit.INSTANCE);
    }

    /* JADX WARNING: Code restructure failed: missing block: B:19:0x0067, code lost:
        r3 = move-exception;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:20:0x0068, code lost:
        kotlin.io.CloseableKt.closeFinally(r2, r0);
     */
    /* JADX WARNING: Code restructure failed: missing block: B:21:0x006b, code lost:
        throw r3;
     */
    /* JADX WARNING: Removed duplicated region for block: B:25:0x006f  */
    @Override // kotlin.coroutines.jvm.internal.BaseContinuationImpl
    @Nullable
    public final Object invokeSuspend(@NotNull Object obj) {
        Long l;
        long j;
        Long boxLong;
        PatchProxyResult proxy = PatchProxy.proxy(new Object[]{obj}, this, changeQuickRedirect, false, 332586, new Class[]{Object.class}, Object.class);
        if (proxy.isSupported) {
            return proxy.result;
        }
        IntrinsicsKt__IntrinsicsKt.getCOROUTINE_SUSPENDED();
        if (this.label == 0) {
            ResultKt.throwOnFailure(obj);
            Long l12 = null;
            try {
                m.a(m.f33469a, null, null, null, null, 15);
                Cursor query = this.$context.getContentResolver().query(CalendarContract.Calendars.CONTENT_URI, new String[]{"_id"}, null, null, null);
                if (query != null) {
                    l = query.moveToFirst() ? Boxing.boxLong(query.getLong(query.getColumnIndexOrThrow("_id"))) : null;
                    CloseableKt.closeFinally(query, null);
                    if (l != null) {
                        if (Boxing.boxBoolean(l.longValue() >= 0).booleanValue()) {
                            l12 = l;
                        }
                        if (l12 != null) {
                            j = l12.longValue();
                            return Boxing.boxLong(j);
                        }
                    }
                    ContentValues contentValues = new ContentValues();
                    contentValues.put("name", "得物");
                    contentValues.put("account_name", "dewu@shizhuang-inc.com");
                    contentValues.put("account_type", "LOCAL");
                    contentValues.put("calendar_displayName", "得物App");
                    contentValues.put("visible", Boxing.boxInt(1));
                    contentValues.put("calendar_color", Boxing.boxInt(-16776961));
                    contentValues.put("calendar_access_level", Boxing.boxInt(700));
                    contentValues.put("sync_events", Boxing.boxInt(1));
                    contentValues.put("calendar_timezone", TimeZone.getDefault().getID());
                    contentValues.put("ownerAccount", "dewu@shizhuang-inc.com");
                    contentValues.put("canOrganizerRespond", Boxing.boxInt(0));
                    Uri insert = this.$context.getContentResolver().insert(CalendarContract.Calendars.CONTENT_URI.buildUpon().appendQueryParameter("caller_is_syncadapter", "true").appendQueryParameter("account_name", "dewu@shizhuang-inc.com").appendQueryParameter("account_type", "LOCAL").build(), contentValues);
                    j = Boxing.boxLong((insert != null || (boxLong = Boxing.boxLong(ContentUris.parseId(insert))) == null) ? -1 : boxLong.longValue()).longValue();
                    return Boxing.boxLong(j);
                }
            } catch (Exception unused) {
            }
            l = null;
            if (l != null) {
            }
            ContentValues contentValues2 = new ContentValues();
            contentValues2.put("name", "得物");
            contentValues2.put("account_name", "dewu@shizhuang-inc.com");
            contentValues2.put("account_type", "LOCAL");
            contentValues2.put("calendar_displayName", "得物App");
            contentValues2.put("visible", Boxing.boxInt(1));
            contentValues2.put("calendar_color", Boxing.boxInt(-16776961));
            contentValues2.put("calendar_access_level", Boxing.boxInt(700));
            contentValues2.put("sync_events", Boxing.boxInt(1));
            contentValues2.put("calendar_timezone", TimeZone.getDefault().getID());
            contentValues2.put("ownerAccount", "dewu@shizhuang-inc.com");
            contentValues2.put("canOrganizerRespond", Boxing.boxInt(0));
            Uri insert2 = this.$context.getContentResolver().insert(CalendarContract.Calendars.CONTENT_URI.buildUpon().appendQueryParameter("caller_is_syncadapter", "true").appendQueryParameter("account_name", "dewu@shizhuang-inc.com").appendQueryParameter("account_type", "LOCAL").build(), contentValues2);
            j = Boxing.boxLong((insert2 != null || (boxLong = Boxing.boxLong(ContentUris.parseId(insert2))) == null) ? -1 : boxLong.longValue()).longValue();
            return Boxing.boxLong(j);
        }
        throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
    }
}