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

cordova-plugin-permissionScope

v2.1.1

Published

Cordova plugin description

Downloads

9

Readme

Twitter: @alexiskofman License Build Status

cordova-plugin-permissionScope

This plugin is a wrapper of the very helpful Swift framework PermissionScope. It defines a global PermissionScope object, which permits to requesting permissions from users.

Installation

cordova plugin add cordova-plugin-permissionScope --save

The iOS part is written in Swift and the Swift support plugin is configured as a dependency.

:warning: Because this plugin doesn't support Swift 3 at the moment, the following preference has to be added in your project :

<preference name="UseLegacySwiftLanguageVersion" value="true" />

Supported Platforms

  • iOS

Methods

PermissionScope.init(config, success, error)

Inits and customizes the dialog and all the alerts displayed from direct requests. If called without any parameter then the default config is restored.

The following properties are available:

Property | Comment ----- | ------- headerLabel | Header UILabel with the message "Hey, listen!" by default. bodyLabel | Header UILabel with the message "We need a couple things\r\nbefore you get started." by default. closeButtonTitle | Title for the close button. "Close" by default. closeButtonTextColor | Hex color code for the close button's text color (ie: #cccccc). closeOffset | Offset used to position the Close button (ie: {-200,0}). permissionButtonTextColor | Hex color code for the permission buttons' text color (ie: #cccccc). permissionButtonBorderColor | Hex color code for the permission buttons' border color (ie: #cccccc). permissionButtonΒorderWidth | Border width for the permission buttons. permissionButtonCornerRadius | Corner radius for the permission buttons. permissionLabelColor | Hex color code for the permission labels' text color (ie: #cccccc). authorizedButtonColor | Hex color code used for permission buttons with authorized status (ie: #cccccc). unauthorizedButtonColor | Hex color code used for permission buttons with unauthorized status. By default, inverse of authorizedButtonColor (ie: #cccccc). deniedAlertTitle | Title for the denied alert. deniedAlertMessage | Message for the denied alert. deniedCancelActionTitle | Title for the denied alert's cancel button. "OK" by default. deniedDefaultActionTitle | Title for the denied alert's default button. "Show me" by default. disabledAlertTitle | Title for the disabled alert. disabledAlertMessage | Message for the disabled alert. disabledCancelActionTitle | Title for the disabled alert's cancel button. "OK" by default. disabledDefaultActionTitle | Title for the disabled alert's default button. "Show me" by default.

PermissionScope.show(success, error)

Displays the permissions dialog if permissions have to be approved else does nothing.

PermissionScope.add<TYPE>Permission(message, success, error)

The following methods permit to set up permissions asked from the dialog :

  • PermissionScope.addNotificationsPermission(message, success, error)
  • PermissionScope.addLocationInUsePermission(message, success, error)
  • PermissionScope.addLocationAlwaysPermission(message, success, error)
  • PermissionScope.addContactsPermission(message, success, error)
  • PermissionScope.addEventsPermission(message, success, error)
  • PermissionScope.addMicrophonePermission(message, success, error)
  • PermissionScope.addCameraPermission(message, success, error)
  • PermissionScope.addPhotosPermission(message, success, error)
  • PermissionScope.addRemindersPermission(message, success, error)
  • PermissionScope.addBluetoothPermission(message, success, error)
  • PermissionScope.addMotionPermission(message, success, error)

Message is a label displayed below the permission button. Its goal is to explain why a permission has to be approved.

PermissionScope.request<TYPE>Permission(success, error)

The following methods permit to check whether a particular permission has been granted else it displays an alert :

  • PermissionScope.requestNotificationsPermission(success, error)
  • PermissionScope.requestLocationInUsePermission(success, error)
  • PermissionScope.requestLocationAlwaysPermission(success, error)
  • PermissionScope.requestContactsPermission(success, error)
  • PermissionScope.requestEventsPermission(success, error)
  • PermissionScope.requestMicrophonePermission(success, error)
  • PermissionScope.requestCameraPermission(success, error)
  • PermissionScope.requestPhotosPermission(success, error)
  • PermissionScope.requestRemindersPermission(success, error)
  • PermissionScope.requestBluetoothPermission(success, error)
  • PermissionScope.requestMotionPermission(success, error)

Examples

PermissionScope.init({
  headerLabel: 'Hello',
  bodyLabel: 'Before you get started',
  closeButtonTextColor: '#cccccc',
  closeButtonTitle: 'Return',
  permissionButtonTextColor: '#30ab7d',
  permissionButtonBorderColor: '#30ab7d',
  closeOffset: '{-200, 0}',
  authorizedButtonColor: '#cccccc',
  unauthorizedButtonColor: '#c2262d',
  permissionButtonCornerRadius: '20',
  permissionLabelColor: '#ff5500',
  permissionButtonΒorderWidth: '5',
  deniedCancelActionTitle: 'Cancel',
  deniedDefaultActionTitle: 'Settings',
  deniedAlertTitle: 'Permission',
  deniedAlertMessage: 'Please enable all the permissions',
  disabledCancelActionTitle: 'Cancel',
  disabledDefaultActionTitle: 'Settings',
});

PermissionScope.addBluetoothPermission('Please enable access to your Bluetooth');
PermissionScope.addCameraPermission('Please enable access to your Camera');
PermissionScope.addPhotosPermission('Please enable access to your Photos');

PermissionScope.show();

The result could be something like this :

Here is the default version :

PermissionScope.init({
  denieddDefaultActionTitle: 'Settings'
});

PermissionScope.requestEventsPermission();

Here is what you should obtain if the permission has not been granted :

App

An app is available in the tests/app folder and is generated from the Cordova Plugin TestFramework. It permits to launch auto tests and manual tests.

To install it, please follow these steps :

npm run install && cordova run --device