<?xml version='1.0' encoding='utf-8'?>
<widget id="com.company.app" version="1.0.0" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
  <name><%= props.appName %></name>
  <description>A mobile app based on Ionic and Cordova.</description>
  <author email="dev@company.com" href="http://company.com">Development Team</author>
  <content src="index.html"/>
  <access origin="*"/>
<% if (props.mobile.includes('android')) { -%>
  <allow-navigation href="http://app/*"/>
<% } -%>
<% if (props.mobile.includes('ios')) { -%>
  <allow-navigation href="httpsionic://app/*"/>
<% } -%>
  <allow-intent href="http://*/*"/>
  <allow-intent href="https://*/*"/>
  <allow-intent href="tel:*"/>
  <allow-intent href="sms:*"/>
  <allow-intent href="mailto:*"/>
  <allow-intent href="geo:*"/>

  <!-- Platforms -->
<% if (props.mobile.includes('android')) { -%>
  <engine name="android" spec="^11.0.0"/>
<% } -%>
<% if (props.mobile.includes('ios')) { -%>
  <engine name="ios" spec="^6.2.0"/>
<% } -%>

<% if (props.mobile.includes('android')) { -%>
  <!-- Android specific -->
  <platform name="android">
    <allow-intent href="market:*"/>
    <preference name="android-targetSdkVersion" value="32"/>
    <preference name="android-manifest/application/activity/@android:theme" value="@android:style/Theme.DeviceDefault"/>
    <preference name="AndroidWindowSplashScreenAnimatedIcon" value="resources/android/icon/drawable-xxxhdpi-icon.png" />
    <preference name="AndroidWindowSplashScreenBackground" value="#4487ff" />
    <!-- Copy files in the resources/android/extra folder to Android native resources -->
    <hook src="node_modules/@ngx-rocket/scripts/hooks/after_prepare/copy-android-resources.js" type="after_prepare"/>
    <icon density="ldpi" src="resources/android/icon/drawable-ldpi-icon.png"/>
    <icon density="mdpi" src="resources/android/icon/drawable-mdpi-icon.png"/>
    <icon density="hdpi" src="resources/android/icon/drawable-hdpi-icon.png"/>
    <icon density="xhdpi" src="resources/android/icon/drawable-xhdpi-icon.png"/>
    <icon density="xxhdpi" src="resources/android/icon/drawable-xxhdpi-icon.png"/>
    <icon density="xxxhdpi" src="resources/android/icon/drawable-xxxhdpi-icon.png"/>
  </platform>

<% } -%>
<% if (props.mobile.includes('ios')) { -%>
  <!-- iOS specific -->
  <platform name="ios">
    <allow-intent href="itms:*"/>
    <allow-intent href="itms-apps:*"/>
    <preference name="iosScheme" value="httpsionic" />
    <preference name="deployment-target" value="11.0"/>
    <preference name="UIWebViewBounce" value="false"/>
    <!--
      Don't store local data in an iCloud backup. Turn this to "cloud" to enable storage
      to be sent to iCloud. Note: enabling this could result in Apple rejecting your app.
    -->
    <preference name="BackupWebStorage" value="none"/>
<%   if (props.mobile.includes('ios')) { -%>
    <preference name="CordovaWebViewEngine" value="CDVWKWebViewEngine"/>
<%   } -%>
<%   if (props.ui === 'bootstrap') { -%>
    <!-- Fix Bootstrap-specific scroll issue with WKWebView -->
    <preference name="ScrollEnabled" value="true" />
<%   } -%>
    <!-- Set status bar style during splash screen -->
    <config-file parent="UIStatusBarStyle" platform="ios" target="*-Info.plist" mode="replace">
      <string>UIStatusBarStyleLightContent</string>
    </config-file>
    <!-- Unlock screen rotation on ipad -->
    <config-file parent="UISupportedInterfaceOrientations~ipad" platform="ios" target="*-Info.plist" mode="replace">
      <array>
        <string>UIInterfaceOrientationPortrait</string>
        <string>UIInterfaceOrientationPortraitUpsideDown</string>
        <string>UIInterfaceOrientationLandscapeLeft</string>
        <string>UIInterfaceOrientationLandscapeRight</string>
      </array>
    </config-file>
    <icon height="57" src="resources/ios/icon/icon.png" width="57"/>
    <icon height="114" src="resources/ios/icon/icon@2x.png" width="114"/>
    <icon height="40" src="resources/ios/icon/icon-40.png" width="40"/>
    <icon height="80" src="resources/ios/icon/icon-40@2x.png" width="80"/>
    <icon height="120" src="resources/ios/icon/icon-40@3x.png" width="120"/>
    <icon height="50" src="resources/ios/icon/icon-50.png" width="50"/>
    <icon height="100" src="resources/ios/icon/icon-50@2x.png" width="100"/>
    <icon height="60" src="resources/ios/icon/icon-60.png" width="60"/>
    <icon height="120" src="resources/ios/icon/icon-60@2x.png" width="120"/>
    <icon height="180" src="resources/ios/icon/icon-60@3x.png" width="180"/>
    <icon height="72" src="resources/ios/icon/icon-72.png" width="72"/>
    <icon height="144" src="resources/ios/icon/icon-72@2x.png" width="144"/>
    <icon height="76" src="resources/ios/icon/icon-76.png" width="76"/>
    <icon height="152" src="resources/ios/icon/icon-76@2x.png" width="152"/>
    <icon height="167" src="resources/ios/icon/icon-83.5@2x.png" width="167"/>
    <icon height="29" src="resources/ios/icon/icon-small.png" width="29"/>
    <icon height="58" src="resources/ios/icon/icon-small@2x.png" width="58"/>
    <icon height="87" src="resources/ios/icon/icon-small@3x.png" width="87"/>
    <splash src="resources/ios/splash/Default@2x~universal~anyany.png"/>
  </platform>

  <!-- Permissions -->
  <feature name="StatusBar">
    <param name="ios-package" onload="true" value="CDVStatusBar"/>
  </feature>
<%   if (props.mobile.includes('ios')) { -%>
  <feature name="CDVWKWebViewEngine">
    <param name="ios-package" value="CDVWKWebViewEngine"/>
  </feature>
<%   } -%>

<% } -%>
  <!-- Common to all platforms -->
  <preference name="Hostname" value="app" />
  <preference name="Fullscreen" value="false"/>
  <preference name="DisallowOverscroll" value="true"/>
  <preference name="Orientation" value="portrait"/>
<% if (props.ui === 'ionic') { -%>
  <preference name="StatusBarStyle" value="lightcontent"/>
<% } else { -%>
  <preference name="StatusBarOverlaysWebView" value="false"/>
  <preference name="StatusBarStyle" value="default"/>
<% } -%>
  <preference name="AutoHideSplashScreen" value="false"/>
  <preference name="SplashScreen" value="screen"/>
  <preference name="SplashScreenDelay" value="3000"/>
  <preference name="ShowSplashScreenSpinner" value="false"/>
  <preference name="SplashMaintainAspectRatio" value="true"/>
  <preference name="FadeSplashScreenDuration" value="500"/>
  <preference name="SplashShowOnlyFirstTime" value="true"/>

  <!-- Plugins -->
  <plugin name="cordova-custom-config" spec="^5.1.1"/>
  <plugin name="cordova-plugin-device" spec="^2.1.0"/>
  <plugin name="cordova-plugin-splashscreen" spec="^6.0.2"/>
  <plugin name="cordova-plugin-statusbar" spec="^3.0.0"/>
  <plugin name="cordova-plugin-ionic-webview" spec="^5.0.0" />
  <plugin name="cordova-plugin-ionic-keyboard" spec="^2.2.0" />
</widget>
