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

@capacitor-community/privacy-screen

v5.0.0

Published

Capacitor plugin that protects your app from displaying a screenshot in Recents screen/App Switcher.

Downloads

10,998

Readme

Introduction

⚡️ Capacitor plugin that protects your app from displaying a screenshot in Recents screen/App Switcher.

On Android, this plugin sets the FLAG_SECURE flag to treat the content of the window as secure, preventing it from appearing in screenshots or from being viewed on non-secure displays.
On iOS, this plugin hides the webview window when the app is no longer active and loses focus (UIApplicationWillResignActiveNotification) so that a gray screen is shown instead. It also prevents screenshots (a black screen will be captured).

Using the Camera Plugin

Disabling screenshots can interfere with plugins that hide the WebView like the Camera plugin. To avoid issues call disable before using a plugin and then enable after you are finished.

Maintainers

| Maintainer | GitHub | Social | | ---------- | ----------------------------------------- | --------------------------------------------- | | Robin Genz | robingenz | @robin_genz |

Installation

npm install @capacitor-community/privacy-screen
npx cap sync

Configuration

These configuration values are available:

| Prop | Type | Description | Default | | --------------- | -------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------- | | enable | boolean | Configure whether the plugin should be enabled from startup. Only available for Android and iOS. | true | | imageName | string | Configure whether the plugin should display a custom image from assets instead of a default background gray for the privacy screen. Only available for iOS. | "" |

Examples

In capacitor.config.json:

{
  "plugins": {
    "PrivacyScreen": {
      "enable": true,
      "imageName": "Splashscreen"
    }
  }
}

In capacitor.config.ts:

/// <reference types="@capacitor/privacy-screen" />

import { CapacitorConfig } from '@capacitor/cli';

const config: CapacitorConfig = {
  plugins: {
    PrivacyScreen: {
      enable: true,
      imageName: "Splashscreen",
    },
  },
};

export default config;

Demo

A working example can be found here: robingenz/capacitor-plugin-demo

Usage

The plugin only needs to be installed. The protection is enabled by default.
However, you have the option to enable/disable the protection:

import { PrivacyScreen } from '@capacitor-community/privacy-screen';

const enable = async () => {
  await PrivacyScreen.enable();
};

const disable = async () => {
  await PrivacyScreen.disable();
};

API

enable()

enable() => Promise<void>

Enables the privacy screen protection.

Only available for Android and iOS.

Since: 1.1.0


disable()

disable() => Promise<void>

Disables the privacy screen protection.

Only available for Android and iOS.

Since: 1.1.0


addListener('screenRecordingStarted', ...)

addListener(eventName: 'screenRecordingStarted', listenerFunc: () => void) => Promise<PluginListenerHandle>

Called when the screen recording is started.

Only available on iOS for now.

| Param | Type | | ------------------ | ------------------------------------- | | eventName | 'screenRecordingStarted' | | listenerFunc | () => void |

Returns: Promise<PluginListenerHandle>

Since: 3.0.2


addListener('screenRecordingStopped', ...)

addListener(eventName: 'screenRecordingStopped', listenerFunc: () => void) => Promise<PluginListenerHandle>

Called when the screen recording is stopped.

Only available on iOS for now.

| Param | Type | | ------------------ | ------------------------------------- | | eventName | 'screenRecordingStopped' | | listenerFunc | () => void |

Returns: Promise<PluginListenerHandle>

Since: 3.0.2


addListener('screenshotTaken', ...)

addListener(eventName: 'screenshotTaken', listenerFunc: () => void) => Promise<PluginListenerHandle>

Called when the screenshot is taken.

Only available on iOS for now.

| Param | Type | | ------------------ | ------------------------------ | | eventName | 'screenshotTaken' | | listenerFunc | () => void |

Returns: Promise<PluginListenerHandle>

Since: 3.2.0


removeAllListeners()

removeAllListeners() => Promise<void>

Remove all listeners for this plugin.

Since: 3.0.2


Interfaces

PluginListenerHandle

| Prop | Type | | ------------ | ----------------------------------------- | | remove | () => Promise<void> |

Changelog

See CHANGELOG.md.

License

See LICENSE.