package o;

import android.content.Context;
import android.os.Bundle;
import com.google.firebase.messaging.FirebaseMessaging;
import java.io.IOException;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.ScheduledThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;

/* compiled from: r8-map-id-3b7cc9102578c509342fa2f0fabed2bfc72239cd258d579fc679bfcbc198b048 */
/* renamed from: o.dg0, reason: case insensitive filesystem */
/* loaded from: classes.dex */
public final class C1022dg0 {
    public static final long i = TimeUnit.HOURS.toSeconds(8);
    public static final /* synthetic */ int j = 0;
    public final Context a;
    public final C2805wP b;
    public final U7 c;
    public final FirebaseMessaging d;
    public final ScheduledThreadPoolExecutor f;
    public final C0831bg0 h;
    public final C1839m9 e = new C1839m9(0);
    public boolean g = false;

    public C1022dg0(FirebaseMessaging firebaseMessaging, C2805wP c2805wP, C0831bg0 c0831bg0, U7 u7, Context context, ScheduledThreadPoolExecutor scheduledThreadPoolExecutor) {
        this.d = firebaseMessaging;
        this.b = c2805wP;
        this.h = c0831bg0;
        this.c = u7;
        this.a = context;
        this.f = scheduledThreadPoolExecutor;
    }

    public static void a(Hw0 hw0) throws IOException {
        try {
            AbstractC0752ap.q(hw0, 30L, TimeUnit.SECONDS);
        } catch (InterruptedException | TimeoutException e) {
            throw new IOException("SERVICE_NOT_AVAILABLE", e);
        } catch (ExecutionException e2) {
            Throwable cause = e2.getCause();
            if (cause instanceof IOException) {
                throw ((IOException) cause);
            }
            if (!(cause instanceof RuntimeException)) {
                throw new IOException(e2);
            }
            throw ((RuntimeException) cause);
        }
    }

    public final void b(String str) throws IOException {
        String strA = this.d.a();
        Bundle bundle = new Bundle();
        bundle.putString("gcm.topic", "/topics/" + str);
        U7 u7 = this.c;
        a(u7.o(u7.x(strA, "/topics/" + str, bundle)));
    }

    public final void c(String str) throws IOException {
        String strA = this.d.a();
        Bundle bundle = new Bundle();
        bundle.putString("gcm.topic", "/topics/" + str);
        bundle.putString("delete", "1");
        U7 u7 = this.c;
        a(u7.o(u7.x(strA, "/topics/" + str, bundle)));
    }

    public final synchronized void d(boolean z) {
        this.g = z;
    }

    /* JADX WARN: Removed duplicated region for block: B:24:0x004c A[Catch: IOException -> 0x0038, TRY_LEAVE, TryCatch #2 {IOException -> 0x0038, blocks: (B:11:0x0016, B:24:0x004c, B:16:0x0027, B:18:0x002f, B:21:0x003b, B:23:0x0043), top: B:78:0x0016 }] */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
        To view partially-correct add '--show-bad-code' argument
    */
    public final boolean e() throws java.io.IOException {
        /*
            Method dump skipped, instructions count: 231
            To view this dump add '--comments-level debug' option
        */
        throw new UnsupportedOperationException("Method not decompiled: o.C1022dg0.e():boolean");
    }

    public final void f(long j2) {
        this.f.schedule(new RunnableC1213fg0(this, this.a, this.b, Math.min(Math.max(30L, 2 * j2), i)), j2, TimeUnit.SECONDS);
        d(true);
    }
}
