package com.atmob.custom_notification;

import android.content.Context;
import android.util.Log;

import io.flutter.plugin.common.MethodCall;
import io.flutter.plugin.common.MethodChannel;

public class MethodCallDistribute {
    public static void handleMethodCall(Context context,MethodCall call, MethodChannel.Result result) {
        switch (call.method){
            case "showRecordNotification":
                showRecordNotification(context,call,result);
                break;
        }
    }

    private static void showRecordNotification(Context context, MethodCall call, MethodChannel.Result result){
        try {
            Boolean isRecording = call.argument("isRecording");
            Integer notificationId =  call.argument("notificationId");
            String timeDesc =  call.argument("timeDesc");
            String channelId =  call.argument("channelId");
            String channelName =  call.argument("channelName");
            if (isRecording == null || notificationId == null || timeDesc == null || channelId == null || channelName == null) {
                result.error("-1", "Arguments are invalid", null);
            }
//            Log.d("showRecordNotification", "isRecording: " + isRecording + " notificationId: " + notificationId + " timeDesc: " + timeDesc + " channelId: " + channelId + " channelName: " + channelName);
            NotificationUtil.showRecordNotification(context,notificationId,channelId,channelName,timeDesc,isRecording);
        } catch (Exception e) {
            result.error("-1", e.getMessage(), null);
        }
    }
}
