package com.snapchat.kit.sdk.core.config;

import android.content.SharedPreferences;
import com.bytedance.covode.number.Covode;
import com.bytedance.frameworks.apm.trace.MethodCollector;
import java.util.ArrayList;
import java.util.Iterator;

public final class f {
    public SharedPreferences LIZ;
    public int LIZIZ = a.a;
    public ConfigClient LIZJ;
    public ArrayList<ServerSampleRateCallback> LIZLLL = new ArrayList<>();

    static {
        Covode.recordClassIndex(47400);
    }

    public static boolean LIZIZ(double d) {
        return d >= 0.0d && d <= 1.0d;
    }

    public enum a {
        ;
        
        public static final int a = 0;
        public static final int b = 0;
        public static final int c = 0;

        /* access modifiers changed from: public */
        static {
            Covode.recordClassIndex(47403);
            a = 1;
            b = 2;
            c = 3;
            LIZ = new int[]{1, 2, 3};
        }
    }

    public final synchronized void LIZ() {
        MethodCollector.i(16188);
        this.LIZIZ = a.a;
        Iterator<ServerSampleRateCallback> it = this.LIZLLL.iterator();
        while (it.hasNext()) {
            it.next().onServerSampleRateFailure();
        }
        this.LIZLLL.clear();
        MethodCollector.o(16188);
    }

    public final synchronized void LIZ(double d) {
        MethodCollector.i(16339);
        this.LIZ.edit().putFloat("com.snapchat.kit.sdk.core.config.skateSampleRate", (float) d).apply();
        this.LIZIZ = a.c;
        Iterator<ServerSampleRateCallback> it = this.LIZLLL.iterator();
        while (it.hasNext()) {
            it.next().onServerSampleRateAvailable(d);
        }
        this.LIZLLL.clear();
        MethodCollector.o(16339);
    }

    /* JADX WARNING: Can't wrap try/catch for region: R(4:11|12|13|14) */
    /* JADX WARNING: Code restructure failed: missing block: B:12:?, code lost:
        r6.onServerSampleRateFailure();
        com.bytedance.frameworks.apm.trace.MethodCollector.o(16185);
     */
    /* JADX WARNING: Code restructure failed: missing block: B:14:0x0025, code lost:
        return;
     */
    /* JADX WARNING: Missing exception handler attribute for start block: B:11:0x001e */
    /* Code decompiled incorrectly, please refer to instructions dump. */
    public final synchronized void LIZ(com.snapchat.kit.sdk.core.config.ServerSampleRateCallback r6) {
        /*
            r5 = this;
            monitor-enter(r5)
            r4 = 16185(0x3f39, float:2.268E-41)
            com.bytedance.frameworks.apm.trace.MethodCollector.i(r4)     // Catch:{ all -> 0x0059 }
            int r1 = r5.LIZIZ     // Catch:{ all -> 0x0059 }
            int r0 = com.snapchat.kit.sdk.core.config.f.a.c     // Catch:{ all -> 0x0059 }
            if (r1 != r0) goto L_0x0026
            android.content.SharedPreferences r2 = r5.LIZ     // Catch:{ ClassCastException -> 0x001e }
            java.lang.String r1 = "com.snapchat.kit.sdk.core.config.skateSampleRate"
            r0 = 0
            float r0 = r2.getFloat(r1, r0)     // Catch:{ ClassCastException -> 0x001e }
            double r0 = (double) r0     // Catch:{ ClassCastException -> 0x001e }
            r6.onServerSampleRateAvailable(r0)     // Catch:{ ClassCastException -> 0x001e }
            com.bytedance.frameworks.apm.trace.MethodCollector.o(r4)     // Catch:{ all -> 0x0059 }
            monitor-exit(r5)
            return
        L_0x001e:
            r6.onServerSampleRateFailure()     // Catch:{ all -> 0x0059 }
            com.bytedance.frameworks.apm.trace.MethodCollector.o(r4)     // Catch:{ all -> 0x0059 }
            monitor-exit(r5)
            return
        L_0x0026:
            java.util.ArrayList<com.snapchat.kit.sdk.core.config.ServerSampleRateCallback> r0 = r5.LIZLLL     // Catch:{ all -> 0x0059 }
            r0.add(r6)     // Catch:{ all -> 0x0059 }
            int r1 = r5.LIZIZ     // Catch:{ all -> 0x0059 }
            int r0 = com.snapchat.kit.sdk.core.config.f.a.b     // Catch:{ all -> 0x0059 }
            if (r1 != r0) goto L_0x0036
            com.bytedance.frameworks.apm.trace.MethodCollector.o(r4)     // Catch:{ all -> 0x0059 }
            monitor-exit(r5)
            return
        L_0x0036:
            int r0 = com.snapchat.kit.sdk.core.config.f.a.b     // Catch:{ all -> 0x0059 }
            r5.LIZIZ = r0     // Catch:{ all -> 0x0059 }
            com.snapchat.kit.sdk.core.config.f$1 r3 = new com.snapchat.kit.sdk.core.config.f$1     // Catch:{ all -> 0x0059 }
            r3.<init>()     // Catch:{ all -> 0x0059 }
            com.snapchat.kit.sdk.core.config.ConfigClient r2 = r5.LIZJ     // Catch:{ all -> 0x0059 }
            com.snapchat.kit.sdk.core.config.a r1 = new com.snapchat.kit.sdk.core.config.a     // Catch:{ all -> 0x0059 }
            java.lang.String r0 = "query($kitVersion: String!) {config(kitVersion: $kitVersion) {skateConfig{sampleRate}}}"
            r1.<init>(r0, r3)     // Catch:{ all -> 0x0059 }
            X.PTs r1 = r2.fetchConfig(r1)     // Catch:{ all -> 0x0059 }
            com.snapchat.kit.sdk.core.config.f$2 r0 = new com.snapchat.kit.sdk.core.config.f$2     // Catch:{ all -> 0x0059 }
            r0.<init>()     // Catch:{ all -> 0x0059 }
            r1.LIZ(r0)     // Catch:{ all -> 0x0059 }
            com.bytedance.frameworks.apm.trace.MethodCollector.o(r4)     // Catch:{ all -> 0x0059 }
            monitor-exit(r5)
            return
        L_0x0059:
            r0 = move-exception
            monitor-exit(r5)
            throw r0
        */
        throw new UnsupportedOperationException("Method not decompiled: com.snapchat.kit.sdk.core.config.f.LIZ(com.snapchat.kit.sdk.core.config.ServerSampleRateCallback):void");
    }

    public f(ConfigClient configClient, SharedPreferences sharedPreferences) {
        this.LIZJ = configClient;
        this.LIZ = sharedPreferences;
    }
}
