<?xml version="1.0" encoding="UTF-8"?>
<plugin xmlns="http://apache.org/cordova/ns/plugins/1.0"
        xmlns:android="http://schemas.android.com/apk/res/android"
        id="cordova-plugin-x-socialsharing"
        version="6.0.2">

  <name>SocialSharing</name>

  <description>
    Share text, images (and other files), or a link via the native sharing widget of your device.
    Android is fully supported, as well as iOS 6 and up. WP8 has somewhat limited support.
  </description>

  <author>Eddy Verbruggen</author>

  <license>MIT</license>

  <keywords>Social, Share, Twitter, Facebook, Email, SMS, WhatsApp, Tumblr, Pocket, LinkedIn</keywords>

  <repo>https://github.com/EddyVerbruggen/SocialSharing-PhoneGap-Plugin.git</repo>

  <issue>https://github.com/EddyVerbruggen/SocialSharing-PhoneGap-Plugin/issues</issue>

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

  <dependency id="es6-promise-plugin" version="^4.1.0" />

  <js-module src="www/SocialSharing.js" name="SocialSharing">
    <clobbers target="window.plugins.socialsharing" />
  </js-module>

  <!-- ios -->
  <platform name="ios">

    <config-file target="config.xml" parent="/*">
      <feature name="SocialSharing">
        <param name="ios-package" value="SocialSharing"/>
        <param name="onload" value="true" />
      </feature>
    </config-file>

    <preference name="PHOTO_LIBRARY_ADD_USAGE_DESCRIPTION" default="This app requires photo library access to function properly." />
    <config-file target="*-Info.plist" parent="NSPhotoLibraryAddUsageDescription">
      <string>$PHOTO_LIBRARY_ADD_USAGE_DESCRIPTION</string>
    </config-file>

    <preference name="PHOTO_LIBRARY_USAGE_DESCRIPTION" default="This app requires photo library access to function properly." />
    <config-file target ="*-Info.plist" parent="NSPhotoLibraryUsageDescription">
      <string>$PHOTO_LIBRARY_USAGE_DESCRIPTION</string>
    </config-file>

    <header-file src="src/ios/NSString+SSURLEncoding.h"/>
    <source-file src="src/ios/NSString+SSURLEncoding.m"/>
    <header-file src="src/ios/SocialSharing.h"/>
    <source-file src="src/ios/SocialSharing.m"/>

    <framework src="Social.framework" weak="true" />
    <framework src="MessageUI.framework" weak="true" />
  </platform>

  <!-- android -->
  <platform name="android">

    <config-file target="res/xml/config.xml" parent="/*">
      <feature name="SocialSharing">
        <param name="android-package" value="nl.xservices.plugins.SocialSharing" />
      </feature>
    </config-file>



    <config-file target="AndroidManifest.xml" parent="/*/application">
      <receiver android:name="nl.xservices.plugins.ShareChooserPendingIntent" android:enabled="true">
        <intent-filter>
          <action android:name="android.intent.action.SEND"/>
        </intent-filter>
      </receiver>
    </config-file>

    <config-file target="AndroidManifest.xml" parent="/*">
      <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
    </config-file>

    <config-file target="AndroidManifest.xml" parent="/manifest/application">
      <provider android:authorities="${applicationId}.sharing.provider" android:exported="false" android:grantUriPermissions="true" android:name="nl.xservices.plugins.FileProvider">
        <meta-data android:name="android.support.FILE_PROVIDER_PATHS" android:resource="@xml/sharing_paths" />
      </provider>
    </config-file>

    <source-file src="src/android/nl/xservices/plugins/SocialSharing.java" target-dir="src/nl/xservices/plugins"/>
    <source-file src="src/android/nl/xservices/plugins/ShareChooserPendingIntent.java" target-dir="src/nl/xservices/plugins"/>
    <source-file src="src/android/nl/xservices/plugins/FileProvider.java" target-dir="src/nl/xservices/plugins"/>
    <source-file src="src/android/res/xml/sharing_paths.xml" target-dir="res/xml"/>

    <framework src="androidx.legacy:legacy-support-v4:1.0.0" />
  </platform>

  <!-- wp8 -->
  <platform name="wp8">
    <config-file target="config.xml" parent="/*">
      <feature name="SocialSharing">
        <param name="wp-package" value="SocialSharing"/>
      </feature>
    </config-file>

    <source-file src="src/wp8/SocialSharing.cs" />
    <framework src="src/wp8/Newtonsoft.Json.dll" custom="true"/>
  </platform>

  <!-- windows -->
  <platform name="windows">
    <js-module src="src/windows/SocialSharingProxy.js" name="SocialSharingProxy">
      <runs />
    </js-module>
  </platform>

</plugin>
