package com.google.firebase.messaging;

import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import xyz.stream.download.DownloadFile;
import xyz.stream.download.DownloadManager;
import xyz.stream.download.db.DbHolder;
import xyz.stream.download.info.FileInfo;

/* JADX INFO: loaded from: classes2.dex */
public final /* synthetic */ class i implements w8.b {

    /* JADX INFO: renamed from: a, reason: collision with root package name */
    public final /* synthetic */ boolean f24183a;

    /* JADX INFO: renamed from: b, reason: collision with root package name */
    public final /* synthetic */ Object f24184b;

    /* JADX INFO: renamed from: c, reason: collision with root package name */
    public final /* synthetic */ Object f24185c;

    public /* synthetic */ i(Object obj, Object obj2, boolean z10) {
        this.f24184b = obj;
        this.f24185c = obj2;
        this.f24183a = z10;
    }

    public final void a(Object obj) {
        DownloadManager downloadManager = (DownloadManager) this.f24184b;
        DownloadFile downloadFile = (DownloadFile) this.f24185c;
        FileInfo fileInfo = (FileInfo) obj;
        downloadManager.getClass();
        if (downloadFile.getDownloadId() == null) {
            downloadFile.setDownloadId(fileInfo.getId());
        }
        downloadFile.setStatus(Integer.valueOf(fileInfo.getDownloadStatus()));
        long size = fileInfo.getSize();
        long downloadLocation = fileInfo.getDownloadLocation();
        if (size > 0) {
            downloadFile.setProgress(Integer.valueOf(Math.max(0, Math.min((int) ((100 * downloadLocation) / size), 100))));
            downloadFile.setCurrentBytes(Integer.valueOf((int) ((downloadLocation / 1024.0f) / 1024.0f)));
            downloadFile.setTotalBytes(Integer.valueOf((int) ((size / 1024.0f) / 1024.0f)));
        } else if (fileInfo.getDownloadStatus() == 46) {
            downloadFile.setProgress(100);
        }
        if (downloadFile.getStatus().intValue() != 46 && this.f24183a) {
            downloadFile.setStatus(45);
            DbHolder.getInstance(downloadManager.f36044a).updateState(downloadFile.getFilePath(), 45);
        }
        downloadManager.c(downloadFile);
    }

    @Override // w8.b
    public final Object then(w8.h hVar) {
        return (com.bumptech.glide.g.l() && ((Integer) hVar.g()).intValue() == 402) ? j.a((Context) this.f24184b, (Intent) this.f24185c, this.f24183a).e(new m.a(18), new oa.a(14)) : hVar;
    }

    public /* synthetic */ i(xyz.stream.api.y yVar, boolean z10, Activity activity) {
        this.f24184b = yVar;
        this.f24183a = z10;
        this.f24185c = activity;
    }
}
