npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

nativescript-advanced-permissions

v1.2.0

Published

Permissions for both Android and IOS.

Downloads

46

Readme

nativescript-advanced-permissions

npm version

Build Status

This Plugin is a wrap around Nathanael's nativescript-permissions plugin, while providing IOS Permissions with a matching API.

Installation

Describe your plugin installation steps. Ideally it would be something like:

tns plugin add nativescript-advanced-permissions

Usage

Right now to request the Camera Permissions, we use it like this

    
    import { hasCameraPermission, requestCameraPermission } from 'nativescript-advanced-permissions/camera';

    // also supports 'nativescript-advanced-permissions/files';
    // also supports 'nativescript-advanced-permissions/calendar';
    // also supports 'nativescript-advanced-permissions/location';


    if( !hasCameraPermission() ) {
        requestCameraPermission().then((hasPermission) => {
            if( hasPermission ) {
                // do something cool
            } else {
                // don't do something
            }
        });
    }

API

this plugin has been split into smaller 'sub-modules', which when use give access to the specified permissions.

the sub-modules that we currently include are : files, calendar, location, camera

and for each sub-module we follow the same naming convention: requestXPermission/hasXPermission where x is the capitalised sub-module name.

Camera Module

Usage

    import { hasCameraPermission, requestCameraPermission } from 'nativescript-advanced-permissions/camera';

    if( !hasCameraPermission() ) {
        requestCameraPermission().then((hasPermission) => {
            if( hasPermission ) {
                // do something cool
            } else {
                // don't do something
            }
        });
    }

API

| Function | Return Type | Description | | --- | --- | --- | | hasCameraPermission() | boolean | returns whether or not the application has the permissions to use the camera | | requestCameraPermission() | Promise | requests the user to allow Camera Permissions, returns a truthy promise if they do, and returns falsy if they don't |

Location Module

Usage

    import { goToAppSettings } from 'nativescript-advanced-permissions/core';
    import { hasLocationPermission, requestLocationPermission, isLocationEnabled } from 'nativescript-advanced-permissions/location';

    if ( isLocationEnabled() ) {

        if( !hasCameraPermission() ) {
            requestCameraPermission().then((hasPermission) => {
                if( hasPermission ) {
                    // do something cool
                } else {
                    // don't do something
                }
            });
        }

    } else {
        // tell the user to enable Location Services.
        alert('Please Enable Location Settings...').then(() => goToAppSettings());
    }

API

| Function | Return Type | Description | | --- | --- | --- | | hasLocationPermission() | boolean | returns whether or not the application has the permissions to use the Location Services | | requestLocationPermission() | Promise | requests the user to allow Location Permissions, returns a truthy promise if they do, and returns falsy if they don't | | isLocationEnabled() | boolean | returns whether or not the location services are enabled on device. |

Calendar Module

Usage

    import { hasCalendarPermission, requestCalendarPermission } from 'nativescript-advanced-permissions/calendar';
        if( !hasCalendarPermission() ) {
            requestCalendarPermission().then((hasPermission) => {
                if( hasPermission ) {
                    // do something cool
                } else {
                    // don't do something
                }
            });
        }

API

| Function | Return Type | Description | | --- | --- | --- | | hasCalendarPermission() | boolean | returns whether or not the application has the permissions to use the Calendar | | requestCalendarPermission() | Promise | requests the user to allow Calendar Permissions, returns a truthy promise if they do, and returns falsy if they don't |

License

Apache License Version 2.0, January 2004

Special Thanks!

Thanks to the genius Nathaniel Anderson for the Android Permissions Plugin, which i make use of in this plugin Nativescript-Permissions