Swiftpack.co - Package - spothero/cordova-plugin-spothero

cordova-plugin-spothero

This Cordova plugin will install the SpotHero Partner SDK iOS (https://github.com/spothero/Partner-SDK-iOS) and provide a Cordova JavaScript API.

Getting Started

Requirements

  • Cordova >= 5.1
  • Xcode >= 9
  • iOS Target >= 10.0 (may be linked to previous versions but not offically supported)
  • Cocoapods gem sudo gem install cocoapods

Installation

Navigate to your project directory and using the latest Cordova CLI:

cordova plugin add https://github.com/spothero/cordova-plugin-spothero

Project Configuration

Add the following preferences to your ios platform configuration within your project's root config.xml.

...
<platform name="ios">
    <preference name="pods_ios_min_version" value="10.0"/>
    <preference name="pods_use_frameworks" value="true"/>
    ...

Add the following npm dependencies within the project's root package.json. Create this file if it does not already exist (more info).

"dependencies": {
    ...
    "command-exists": "^1.0.2",
    "lodash": "^4.16.2",
    "xml2js": "^0.4.17"
 }

Run npm install to install the new npm dependencies.

Usage

At a minimum the SpotHeroSDK requires a PARTNER_API_KEY to launch.

if (window.cordova && window.cordova.plugins.SpotHeroSDK) {
    window.cordova.plugins.SpotHeroSDK.init({
        partnerApplicationKey: 'PARTNER_API_KEY'
    });
}

All options...

window.cordova.plugins.SpotHeroSDK.init({
    partnerApplicationKey: 'PARTNER_API_KEY', // Partner API key (required)
    tintColor: '#1459ff', // SDK UI tint color in hex string format (optional)
    textColor: '#ffffff', // SDK UI text color in hex string format (optional)
    success: successCallback, // SDK launch success callback (optional)
    error: errorCallback // SDK launch error callback (optional)
});

Building

Build your Ionic/Cordova project first to fetch plugin dependencies (with Ionic CLI)...

ionic build ios

or without Ionic...

cordova build ios

Next open your project .xcworkspace file and build in Xcode 8. This is typically located at your-project/platforms/ios/yourProject.xcworkspace.

More Info

macOS Sierra users may experience issues building on Xcode < 8.

Due to the cocoapods dependencies, after adding this plugin be sure to open the .xcworkspace in Xcode instead of the .xcodeproj.

For more information on setting up Cordova see the documentation.

For more info on plugins see the Plugin Development Guide.

Github

link
Stars: 0
Help us keep the lights on

Dependencies

Used By

Total: 0

Releases

2.1.1 - May 29, 2018

2.0.0 - Apr 3, 2018

1.0.0 - Apr 3, 2018

0.1.3 - Apr 3, 2018