Socket
Socket
Sign inDemoInstall

nativescript-kiip

Package Overview
Dependencies
0
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    nativescript-kiip

Integrate native kiip widgets into NativeScript


Version published
Maintainers
1
Install size
312 kB
Created

Readme

Source

Nativescript Kiip Wrapper

Setup

Add this to the app.js to run before application.start

if (application.ios) {
    //iOS
    var __extends = this.__extends || function (d, b) {
        for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
        function __() { this.constructor = d; }
        __.prototype = b.prototype;
        d.prototype = new __();
    };
    
    var appDelegate = (function (_super) {
        __extends(appDelegate, _super);
        function appDelegate() {
            _super.apply(this, arguments);
        }
        
        appDelegate.prototype.applicationDidFinishLaunchingWithOptions = function (app, launchOptions) {
            kiip.initalize({
                key: "<YOUR KEY>",
            secret: "<YOUR SECRET>",
                testMode: true
            }); 
        };
        
        appDelegate.ObjCProtocols = [UIApplicationDelegate, KiipDelegate];
        return appDelegate;
    })(UIResponder);
    application.ios.delegate = appDelegate;
}else{
    //ANDROID
    application.on(application.launchEvent, function (args) {
        kiip.initalize({
            key: "<YOUR KEY>",
            secret: "<YOUR SECRET>",
            testMode: true
        }); 
    });
}

iOS

Looks like kiip uses http, so in iOS we need to allow http in the info.plist per the guide

<key>NSAppTransportSecurity</key>
<dict>
    <key>NSAllowsArbitraryLoads</key>
    <true/>
</dict>

METHODS

var kiip = require("nativescript-kiip");
Save Moment
kiip.saveMoment({
        id: "open_app"
    }).then(function (args) {

        if (args.poptart != null) {
            if (app.android) {
                var context = app.android.currentContext;
                args.poptart.show(context); //<-- CRASH HERE
            }else if(app.ios){
                debugger;
                args.poptart.show();
            }
        }

        viewModel.debug = "Saved Moment " + new Date()
    }, function (args) {
        viewModel.debug = "Save Moment Failed";
    });
OPTIONS
exports.onSetEmail = function (args) {
    kiip.setEmail(viewModel.email);
}

exports.onSetBirthday = function (args) {
    kiip.setBirthday(viewModel.birthday);
}

exports.onSetGender = function (args) {
    kiip.setGender(viewModel.gender);
}

//iOS Only
exports.onStartSession = function (args) {
    kiip.startSession().then(function (args) {
        viewModel.debug = "Session Started " + new Date()
    }, function (args) {
        viewModel.debug = "Session Start Failed"
    });
}

//iOS Only
exports.onEndSession = function (args) {
    kiip.endSession().then(function (args) {
        viewModel.debug = "Session Ended " + new Date()
    }, function (args) {
        viewModel.debug = "Session End Failed"
    });
}

Keywords

FAQs

Last updated on 15 Mar 2017

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc