<?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="kiot-cordova-plugin-ttlock" version="0.0.22">

  <name>TTLock</name>
  <description>TTLock SDK Plugin</description>
  <license>Apache 2.0</license>
  <keywords>TTLock, bluetooth, BLE, bluetooth low energy, bluetooth smart</keywords>

  <repo>https://github.com/boomfly/cordova-plugin-ttlock.git</repo>
  <issue>https://github.com/boomfly/cordova-plugin-ttlock/issues</issue>

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

  <platform name="android">
    <framework src="com.ttlock:ttlock:3.5.0" />
    <framework src="com.google.code.gson:gson:2.8.5" />
    <!-- <lib-file src="src/android/libs/gson-2.8.6.jar" /> -->

    <config-file target="res/xml/config.xml" parent="/*">
      <feature name="TTLockPlugin">
        <param name="android-package" value="com.apartx.ttlock.TTLockPlugin" />
      </feature>
    </config-file>

    <source-file src="src/android/TTLockPlugin.java" target-dir="src/com/apartx/ttlock" />
    <source-file src="src/android/ChannelCreator.java" target-dir="src/com/apartx/ttlock" />
    <config-file target="AndroidManifest.xml" parent="/manifest">
      <uses-permission android:name="android.permission.BLUETOOTH" />
      <uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
      <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
      <uses-permission android:name="android.permission.INTERNET" />
      <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    </config-file>
  </platform>

  <platform name="ios">
    <config-file target="config.xml" parent="/*">
      <feature name="TTLockPlugin">
        <param name="ios-package" value="TTLockPlugin" />
      </feature>
    </config-file>

    <header-file src="src/ios/TTLockPlugin.h" />
    <source-file src="src/ios/TTLockPlugin.m" />
    <header-file src="src/ios/AppDelegate+TTLockPlugin.h" />
    <source-file src="src/ios/AppDelegate+TTLockPlugin.m" />

    <!-- Removing framework and adding pods deps -->

    <!-- <framework src="src/ios/TTLock.framework" custom="true" /> -->
    <!-- <framework src="src/ios/TTLockGateway.framework" custom="true" /> -->

    <podspec>
        <config>
            <source url="https://cdn.cocoapods.org/"/>
        </config>
        <pods use-frameworks="true">
            <pod name="TTLock" spec="3.4.3"/>
        </pods>
    </podspec>
     <podspec>
        <config>
            <source url="https://cdn.cocoapods.org/"/>
        </config>
        <pods use-frameworks="true">
            <pod name="TTLockGateway"/>
        </pods>
    </podspec>
    
    <framework src="CoreBluetooth.framework" />
  </platform>

  <platform name="browser">
    <js-module src="src/browser/TTLockPlugin.js" name="TTLockPlugin">
      <merges target="ttlock"/>
    </js-module>
  </platform>
</plugin>
