package com.dbs.mplus.fatima.consent;

import android.util.Log;

import kr.co.clipsoft.eform.event.ExitEventArgs;
import kr.co.clipsoft.eform.event.IEventHandler;

public class EformExitEventHandler implements IEventHandler<ExitEventArgs> {

  private static final String TAG = "EformExitEventHandler";

  @Override
  public void eventReceived(Object o, ExitEventArgs exitEventArgs) {
    switch (exitEventArgs.getResultCode()) {
      case EXIT:
        Log.e(TAG, "EXIT");

//        String path = Environment.getExternalStorageDirectory().getAbsolutePath() + "/CLIPe-Form/AudioTemp/";
//        File directory = new File(path);
//        File[] files = directory.listFiles();
//        File tempFile = null;
//
//        if (files != null) {
//          if (files.length > 0) {
//            for (int i = 0; i < files.length; i++) {
//              String tempFilePath = path + files[i].getName();
//              tempFile = new File(tempFilePath);
//              tempFile.delete();
//            }
//          }
//        }

        break;
      case ERROR_EXIT:
        Log.e(TAG, "ERROR_EXIT");
        break;
    }
  }
}
