<?xml version="1.0" encoding="utf-8"?>
<plugin xmlns="http://www.phonegap.com/ns/plugins/1.0"
        xmlns:android="http://schemas.android.com/apk/res/android"
        id="cordova-plugin-mobile-ocr-scp"
        version="3.4.2">

  <name>Textocr</name>

  <dependency id="cordova-plugin-cocoapod-supportx"/>

  <engines>
    <engine name="cordova-android" version=">=6.3.0" />
    <engine name="cordova-ios" version=">=4.3.0" />
  </engines>

  <asset src="www/rectext.js" target="js/rectext.js"/>
  
  <js-module src="www/rectext.js" name="rectext">
    <clobbers target="textocr" />
  </js-module>

  <platform name="android">

    <config-file target="res/xml/config.xml" parent="/*">
      <feature name="Textocr">
        <param name="android-package" value="com.neutrinos.ocrplugin.Textocr"/>
      </feature>
    </config-file> 

    <config-file target="AndroidManifest.xml" parent="/*">
            <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
            <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
            <meta-data
            android:name="com.google.android.gms.vision.DEPENDENCIES"
            android:value="ocr"/>
    </config-file>
   
    <source-file src="src/android/Textocr.java" target-dir="src/com/neutrinos/ocrplugin/" />
    <framework src="com.google.android.gms:play-services-vision:17.0.2" />
    
  </platform>
  
  <!-- <dependency id="cordova-plugin-cocoapod-support"/> -->

  <platform name="ios">
    <!-- <pods-config ios-min-version="6.0" use-frameworks="true" />
    <pod name="GoogleMobileVision/TextDetector"/>  -->

    <config-file target="config.xml" parent="/*">
      <feature name="Textocr">
        <param name="ios-package" value="Textocr" />
      </feature>
    </config-file>
    
    <config-file target="*-Info.plist">
        <array>
            <string>NSPhotoLibraryUsageDescription</string>
            <string>need photo library access to save pictures there</string>
        </array>
    </config-file>

  <header-file src="src/ios/Textocr.h" target-dir="OcrPlugin"/>
  <source-file src="src/ios/Textocr.m" target-dir="OcrPlugin"/>

  <podspec>
    <config>
      <source url="https://github.com/CocoaPods/Specs.git"/>
    </config>
    <pods>
      <pod name="GoogleMobileVision/TextDetector" spec="~> 1.6.0"/>
    </pods>
	</podspec>
  
  <!--<pod name="GoogleMobileVision/TextDetector" spec="~> 1.3.2"/> -->
  <!--<framework src="GTMSessionFetcher" type="podspec" spec="~> 1.1.15"/>-->
  <!--<framework src="Protobuf" type="podspec" spec="~> 3.6.0"/>-->
  <!--<framework src="GoogleToolboxForMac" type="podspec" spec="~> 2.1.4"/>-->

  
</platform>

</plugin>
