package com.pichillilorenzo.flutter_inappwebview_android.print_job;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.RequiresApi;
import com.pichillilorenzo.flutter_inappwebview_android.types.ChannelDelegateImpl;
import com.pichillilorenzo.flutter_inappwebview_android.types.PrintJobInfoExt;
import ed.q;
import ed.t;
import ed.u;

/* JADX INFO: loaded from: classes.dex */
@RequiresApi(api = 19)
public class PrintJobChannelDelegate extends ChannelDelegateImpl {

    @Nullable
    private PrintJobController printJobController;

    public PrintJobChannelDelegate(@NonNull PrintJobController printJobController, @NonNull u uVar) {
        super(uVar);
        this.printJobController = printJobController;
    }

    @Override // com.pichillilorenzo.flutter_inappwebview_android.types.ChannelDelegateImpl, com.pichillilorenzo.flutter_inappwebview_android.types.Disposable
    public void dispose() {
        super.dispose();
        this.printJobController = null;
    }

    @Override // com.pichillilorenzo.flutter_inappwebview_android.types.ChannelDelegateImpl, com.pichillilorenzo.flutter_inappwebview_android.types.IChannelDelegate, ed.s
    public void onMethodCall(@NonNull q qVar, @NonNull t tVar) {
        String str = qVar.f25842a;
        str.getClass();
        switch (str) {
            case "cancel":
                PrintJobController printJobController = this.printJobController;
                if (printJobController == null) {
                    tVar.success(Boolean.FALSE);
                    break;
                } else {
                    printJobController.cancel();
                    tVar.success(Boolean.TRUE);
                    break;
                }
                break;
            case "getInfo":
                PrintJobController printJobController2 = this.printJobController;
                if (printJobController2 == null) {
                    tVar.success(null);
                    break;
                } else {
                    PrintJobInfoExt info = printJobController2.getInfo();
                    tVar.success(info != null ? info.toMap() : null);
                    break;
                }
                break;
            case "restart":
                PrintJobController printJobController3 = this.printJobController;
                if (printJobController3 == null) {
                    tVar.success(Boolean.FALSE);
                    break;
                } else {
                    printJobController3.restart();
                    tVar.success(Boolean.TRUE);
                    break;
                }
                break;
            case "dispose":
                PrintJobController printJobController4 = this.printJobController;
                if (printJobController4 == null) {
                    tVar.success(Boolean.FALSE);
                    break;
                } else {
                    printJobController4.dispose();
                    tVar.success(Boolean.TRUE);
                    break;
                }
                break;
            default:
                tVar.notImplemented();
                break;
        }
    }
}
