package com.appsflyer.internal;

import X.AnonymousClass0L4;
import X.AnonymousClass0L8;
import X.C05320Kk;
import com.android.billingclient.api.Purchase;
import com.appsflyer.AFLogger;
import com.bytedance.covode.number.Covode;
import java.util.List;

public final class aw implements AnonymousClass0L4 {
    public /* synthetic */ av values;

    static {
        Covode.recordClassIndex(2630);
    }

    public final void onBillingServiceDisconnected() {
    }

    public aw(av avVar) {
        this.values = avVar;
    }

    public final void onBillingSetupFinished(AnonymousClass0L8 r4) {
        av avVar = this.values;
        avVar.values.submit(new Runnable(r4) {
            public /* synthetic */ AnonymousClass0L8 AFKeystoreWrapper;

            static {
                Covode.recordClassIndex(2629);
            }

            public final void run() {
                try {
                    if (this.AFKeystoreWrapper.LIZ == 0 && !av.this.valueOf.AFInAppEventType("ars_history_sent")) {
                        C05320Kk LIZIZ = av.this.AFInAppEventType.LIZIZ("subs");
                        List<Purchase> list = LIZIZ.LIZ;
                        if (LIZIZ.LIZIZ.LIZ != 0 || list == null || list.isEmpty()) {
                            AFLogger.AFLogger$LogLevel("Failed to query purchases history");
                        } else {
                            av.AFKeystoreWrapper(av.this, true, list);
                        }
                    }
                } catch (Throwable th) {
                    if ((th instanceof NoSuchMethodError) || (th instanceof NoClassDefFoundError)) {
                        AFLogger.AFLogger$LogLevel("It seems your app uses different Play Billing library version than the SDK. Please use v.3.0.3");
                    }
                    AFLogger.values("Failed to log purchases history", th);
                }
            }

            {
                this.AFKeystoreWrapper = r2;
            }
        });
    }
}
