This package has been deprecated

Author message:

this package has been deprecated

nativescript-mobileiron-appconnect
TypeScript icon, indicating that this package has built-in type declarations

1.0.0 • Public • Published

NativeScript plugin for MobileIron AppConnect

Setup

tns plugin add nativescript-mobileiron-appconnect

Platform Support

Platform Supported Version
iOS Yes iOS 8.1+

Dependencies

NativeScript http and fetch modules are not supported by MobileIron AppTunnel technology, but fortunately nativescript-https is.

Nativescript-HTTPS, a drop-in replacement for the default http module, easily integrate AFNetworking and okhttp3, the most reliable native networking libraries with the latest and greatest HTTPS security features.

Methods

// Call this to get your app authorized
nsappconnect.requestConfig(args: any) : void;

Events

// This will be raised when AppConnectIsReady and config is parsed
nsappconnect.on("configParsed", function(eventData){
});

Usage (app.ts)

import * as application from 'application';
import { NsAppConnect } from 'nativescript-mobileiron-appconnect';
import { Dictionary } from 'nativescript-mobileiron-appconnect';
import * as Https from 'nativescript-https';

/*
Request configuration on application.launchEvent
*/
application.on(application.launchEvent, function (args) {
    
    let nsappconnect = new NsAppConnect();
    
    /*
    If this method is raised, the app is authorized, configuration has been parsed
    and the app is ready to load resources, like making the first http call to in-premises backend
    */
    nsappconnect.on("configParsed", function(eventData){
        
        /*
        A dictionary will be received containing the configuration flags
        */
        let nsconfig = <Dictionary<string>>eventData.object;

        console.log(eventData.eventName + ` has been raised by NsAppConnect with flag_name: ${nsconfig.Item("flag_name")}!`);

        var baseUrl = "BASE_URL";

        /*
        When this call executes, a VPN AppTunnel will be created 
        routing the request through MobileIron Sentry to In-Premises backend
        and sending the response back to the client app
        */
        Https.request({
            url: baseUrl,
            method: 'GET',
            headers: {
                'Content-Type': 'application/json'
            }
        }).then(function(response) {
            console.log('Https.request response', response.content)
        }).catch(function(error) {
            console.error('Https.request error', error)
        })

    });

    if (args.android) {

        // For Android, application.android.context will be used.
        nsappconnect.requestConfig(application.android.context);

    } else if (args.ios !== undefined) {

        // For iOS applications, args.ios NSDictionary (launchOptions).
        nsappconnect.requestConfig(args.ios);

    }
});

application.start({ moduleName: "main-page" });

Roadmap

  • Android support coming soon.

Author

Contributors

Release Notes

1.0.0

MobileIron AppConnect support for {N} iOS applications.

License

MIT.

Package Sidebar

Install

npm i nativescript-mobileiron-appconnect

Weekly Downloads

0

Version

1.0.0

License

MIT

Last publish

Collaborators

  • alexrainman