<?xml version='1.0' encoding='utf-8'?>
<!--
 * Copyright 2021 TripodWorks
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
-->
<plugin id="cordova-plugin-mlkit-facedetection" version="0.2.2"
  xmlns="http://apache.org/cordova/ns/plugins/1.0"
  xmlns:android="http://schemas.android.com/apk/res/android">

  <name>cordova-plugin-mlkit-facedetection</name>

  <description>face Detection</description>

  <engines>
      <engine name="cordova" version=">=9.0.0"/>
  </engines>

  <js-module name="faceDetection" src="www/faceDetection.js">
      <clobbers target="faceDetection" />
  </js-module>

  <platform name="android">
    <config-file parent="/*" target="res/xml/config.xml">
      <feature name="faceDetection">
        <param name="android-package" value="jp.co.tripodw.iot.facedetection.faceDetection" />
        <param name="onload" value="true" />
      </feature>
    </config-file>

    <framework src="build-extras.gradle" custom="true" type="gradleReference"/>

    <!-- <config-file target="AndroidManifest.xml" parent="/manifest/application">
        <activity android:label="cameraX Activity" android:name="jp.co.tripodw.iot.facedetection.CameraXLivePreviewActivity"></activity>
    </config-file> -->

    <config-file target="AndroidManifest.xml" parent="/manifest">
      <uses-feature android:name="android.hardware.camera"/>
      <uses-feature android:name="android.hardware.camera.autofocus"/>
      <uses-permission android:name="android.permission.CAMERA" />
      <uses-permission android:name="android.permission.RECORD_AUDIO" />
      <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    </config-file>

    <source-file src="src/android/faceDetection.java" target-dir="src/jp/co/tripodw/iot/facedetection/" />
    <source-file src="src/android/LivePreviewActivity.java" target-dir="src/jp/co/tripodw/iot/facedetection/" />
    <source-file src="src/android/CameraXLivePreviewActivity.java" target-dir="src/jp/co/tripodw/iot/facedetection/" />

    <source-file src="src/android/preference/PreferenceUtils.java" target-dir="src/jp/co/tripodw/iot/facedetection/preference/" />
    <source-file src="src/android/preference/LivePreviewPreferenceFragment.java" target-dir="src/jp/co/tripodw/iot/facedetection/preference/" />

    <source-file src="src/android/facedetector/FaceDetectorProcessor.java" target-dir="src/jp/co/tripodw/iot/facedetection/facedetector/" />
    <source-file src="src/android/facedetector/FaceGraphic.java" target-dir="src/jp/co/tripodw/iot/facedetection/facedetector/" />

    <source-file src="src/android/common/BitmapUtils.java" target-dir="src/jp/co/tripodw/iot/facedetection/common" />
    <source-file src="src/android/common/CameraImageGraphic.java" target-dir="src/jp/co/tripodw/iot/facedetection/common" />
    <source-file src="src/android/common/CameraSource.java" target-dir="src/jp/co/tripodw/iot/facedetection/common" />
    <source-file src="src/android/common/CameraSourcePreview.java" target-dir="src/jp/co/tripodw/iot/facedetection/common" />
    <source-file src="src/android/common/FrameMetadata.java" target-dir="src/jp/co/tripodw/iot/facedetection/common" />
    <source-file src="src/android/common/GraphicOverlay.java" target-dir="src/jp/co/tripodw/iot/facedetection/common" />
    <source-file src="src/android/common/InferenceInfoGraphic.java" target-dir="src/jp/co/tripodw/iot/facedetection/common" />
    <source-file src="src/android/common/ScopedExecutor.java" target-dir="src/jp/co/tripodw/iot/facedetection/common" />
    <source-file src="src/android/common/VisionImageProcessor.java" target-dir="src/jp/co/tripodw/iot/facedetection/common" />
    <source-file src="src/android/common/VisionProcessorBase.java" target-dir="src/jp/co/tripodw/iot/facedetection/common" />

    <source-file src="src/android/common/CameraXViewModel.java" target-dir="src/jp/co/tripodw/iot/facedetection/common" />

    <source-file src="src/android/live_preview_activity.xml" target-dir="res/layout" />
    <source-file src="src/android/live_preview_x_activity.xml" target-dir="res/layout" />
  </platform>

  <platform name="ios">
    <config-file parent="/*" target="config.xml">
      <feature name="faceDetection">
        <param name="ios-package" value="faceDetection" />
      </feature>
    </config-file>
    <source-file src="src/ios/faceDetection.m" />
  </platform>
</plugin>
