0.1.1 • Published 1 year ago

@yplabs-ltd/react-native-detector v0.1.1

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

@yplabs-ltd/react-native-detector

a simply and easy to use screenshot detector for react native.

Installation

yarn

yarn add @yplabs-ltd/react-native-detector

npm

npm install @yplabs-ltd/react-native-detector

iOS

cd ios && pod install

android

for Android you need to have access for READ_EXTERNAL_STORAGE to detect screenshots by user to do that you just need to add this line in AndroidManifest.xml

    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />

and get user permission

import { PermissionsAndroid } from 'react-native';

//...
const requestPermission = async () => {
  await PermissionsAndroid.request(
    PermissionsAndroid.PERMISSIONS.READ_EXTERNAL_STORAGE,
    {
      title: 'Get Read External Storage Access',
      message: 'get read external storage access for detecting screenshots',
      buttonNeutral: 'Ask Me Later',
      buttonNegative: 'Cancel',
      buttonPositive: 'OK',
    }
  );
};

Usage

import {
  addScreenshotListener,
  addScreenrecordListener,
} from '@yplabs-ltd/react-native-detector';

// ...
React.useEffect(() => {
  const userDidScreenshot = () => {
    console.log('User took screenshot');
  };
  const unsubscribe = addScreenshotListener(userDidScreenshot);
  return () => {
    unsubscribe();
  };
}, []);

Roadmap

StatusGoal
iOS version of screenshot detector
✅ (Thanks to @mhssn95)Android version of screenshot detector
IOS Screen recording detecting
Android Screen recording detecting
🚧Calls detector

Contributing

Based on the project react-native-detector to develop more. See the contributing guide to learn how to contribute to the repository and the development workflow.

License

MIT

acceptsJSONStreamabsolute-pathacornababacorn-globalsacorn-walkabort-controlleracorn-jsxaggregate-errorajvansi-alignansi-colorsansi-fragmentsansi-escapesansi-grayansi-cyanansi-regexansi-redadd-streamansi-wrapanymatcharr-flattenargparseansi-stylesarr-diffarr-unionarray-filterarray-find-indexarray-includesarray-ifyarray-slicearray-maparray-reduceartarray-uniquearray-unionarrifyasapassert-plusastral-regexassign-symbolsasyncasync-limiterasynckitasn1aws4at-least-nodeasync-retryatobbabel-eslintbabel-plugin-dynamic-import-nodeaws-sign2babel-jestbabel-plugin-jest-hoistbabel-plugin-syntax-trailing-function-commasbabel-polyfillbabel-plugin-istanbulbabel-preset-current-node-syntaxbabel-preset-fbjsbabel-preset-jestbabel-runtimebalanced-matchbasebasic-authbefore-after-hookbindingsbig-integerboxenbplist-creatorbracesbrace-expansionbplist-parserbrowserslistbrowser-process-hrtimebserbcrypt-pbkdfbuffer-crc32builtinsbytesbase64-jsbuffer-fromcacheable-lookupcallsitescaller-pathcacheable-requestcache-basecamelcasecamelcase-keyscaniuse-litecaller-callsitecapture-exitchangelog-filename-regexchalkchar-regexchardetclass-utilsci-infoclean-stackcli-boxescli-cursorcli-widthcliuicocloneclone-responsecode-point-atcollect-v8-coveragecollection-visitcolor-convertcolor-namecolorettecolor-supportcombined-streamcommandercaselesscommand-existscommondircli-spinnerscompare-versionscompare-funccompressiblecompressionconfigstoreconnectcomponent-emitterconventional-changelogconventional-changelog-atomconventional-changelog-angularconventional-changelog-codemirrorconcat-mapconventional-changelog-conventionalcommitsconventional-changelog-emberconventional-changelog-eslintconventional-changelog-expressconventional-changelog-jqueryconventional-changelog-writerconcat-streamconventional-changelog-jshintconventional-changelog-coreconventional-changelog-preset-loaderconventional-commits-filterconventional-commits-parserconventional-recommended-bumpcopy-descriptorcore-js-compatcore-util-iscore-js-pureconvert-source-mapcosmiconfigcore-jscreate-react-classcrypto-random-stringcross-spawncssomcssstyledata-urlscsstypedargsdashdashdebugcurrently-unhandleddateformatdayjsdecamelizedecimal.jsdecamelize-keysdecompress-responsededentdeep-extenddecode-uri-componentdefaultsdeep-isdefine-propertiesdeepmergedeldefine-propertydepddefer-to-connectdestroydeprecated-objdeprecationdetect-newlinedelayed-streamdetect-repo-changelogdir-globdoctrinedidyoumeandomexceptiondiff-sequencesdot-propduplexer3ecc-jsbnee-firstejselectron-to-chromiumemoji-regexdenodeifyencodeurlenvinfoencodingend-of-streamerror-exes-abstracterrorhandleres-to-primitiveescape-htmlescodegenescape-goateslint-plugin-eslint-commentseslint-plugin-flowtypeeslint-plugin-jestescape-string-regexpeslint-plugin-reacteslint-plugin-react-hookseslint-scopeeslint-plugin-react-native-globalseslint-plugin-react-nativeespreeeslint-visitor-keysesrecurseesprimaesqueryeslint-utilsestraverseetagevent-target-shimesutilseventemitter3exec-shexecaexpectextendexpand-bracketsextglobextend-shallowexternal-editorextsprintfexitfancy-logfast-difffast-levenshteinfast-deep-equalfast-globfastqfast-json-stable-stringifyfb-watchmanfbjs-css-varsfbjsfiguresfbjs-scriptsfile-entry-cachefile-uri-to-pathfilelistfinalhandlerfill-rangefind-upfind-cache-dirflat-cacheflattedfor-inforever-agentfragment-cachefreshfs-extrafind-versionsform-datafunction-bindfs.realpathfseventsflatget-caller-filefunctional-red-black-treegensyncget-pkg-repoget-streamget-valueget-stdingetpassgit-remote-origin-urlget-package-typegit-upgit-url-parsegh-gotgit-semver-tagsgitconfiglocalgit-raw-commitsgithub-usernameglobal-dirsglob-parentglobalsglobbygrowlygotgraceful-fshandlebarshar-validatorhar-schemahard-rejectionhashas-flaghas-symbolshas-valuehas-valueshas-yarnglobhermes-enginehosted-git-infohtml-encoding-snifferhtml-escaperhttp-errorshttp-signatureiconv-litehuman-signalshttp-cache-semanticsignoreimage-sizeimport-cwdhttp2-wrapperimport-freshimport-lazyimport-fromimport-localimurmurhashinheritsiniindent-stringinternal-slotinterpretinvariantinquirerip-regexis-accessor-descriptoris-arrayishinvert-kvis-bufferis-callableis-data-descriptorinflightis-date-objectis-ciis-descriptoris-extendableis-dockeris-directoryis-extglobis-fullwidth-code-pointis-git-dirtyis-installed-globallyis-generator-fnis-finiteis-interactiveis-globis-npmis-objis-path-insideis-numberis-plain-objis-git-repositoryis-plain-objectis-potential-custom-element-nameis-regular-fileis-path-cwdis-regexis-stringis-streamis-symbolis-sshis-text-pathis-windowsis-typedarrayis-utf8isexeis-wslis-yarn-globalisobjectisarrayistanbul-lib-coverageisomorphic-fetchisstreamistanbul-lib-reportistanbul-lib-instrumentistanbul-reportsjest-changed-filesjakeistanbul-lib-source-mapsjest-clijest-configjest-docblockjest-environment-nodejest-diffjest-environment-jsdomjest-eachjest-matcher-utilsjest-jasmine2jest-haste-mapjest-leak-detectorjest-message-utiljest-mockjest-get-typejest-resolvejest-pnp-resolverjest-regex-utiljest-resolve-dependenciesjest-runtimejest-utiljest-runnerjest-validatejest-serializerjetifierjest-watcherjest-snapshotjest-workerjsdomjs-tokensjsbnjs-yamljsescjsc-androidjson-stable-stringifyjson-schemajson-bufferjson-stable-stringify-without-jsonifyjson-parse-better-errorsjsonfilejson5json-schema-traversekeyvkind-ofjsonparsejsprimjsonifyklawlatest-versionkleurlevenjsx-ast-utilslevenarylevnlines-and-columnslcidjson-stringify-safeload-json-filelodash._reinterpolatelodash.findlodash.templatelodashlocate-pathlodash.sortbylodash.ismatchlodash.templatesettingsloose-envifylodash.throttlelru-cachelogkittymacos-releaselowercase-keyslog-symbolsloud-rejectionmake-dirmakeerrormap-objmap-cachememmap-age-cleanermeowmerge-streammerge2map-visitmetro-babel-registermetro-babel-transformermetro-configmetrometro-cachemetro-minify-uglifymetro-coremetro-resolvermetro-react-native-babel-presetmetro-inspector-proxymetro-react-native-babel-transformermetro-source-mapmetro-symbolicatemimemime-dbmimic-responseminimatchmicromatchmimic-fnminimistmin-indentmime-typesminimist-optionsmodify-valuesmixin-deepmkdirpmorganmsmute-streamnannanomatchnode-fetchnatural-comparenegotiatornice-trynode-int64neo-asyncnode-releasesnormalize-pathnormalize-package-datanpm-run-pathnullthrowsnumber-is-nannormalize-urlnwsapioauth-signob1object-assignobject-inspectobject-copyobject-keysobject-visitobject.fromentriesobject.assignobject.pickon-headersobject.entrieson-finishedobject.valuesonceonetimeopenopencollective-postinstalloptionatoros-localeoraos-nameos-tmpdirp-cancelablep-each-seriesp-deferp-finallyp-limitp-is-promisep-locateoptionsp-trypackage-jsonparent-moduleparse-github-repo-urlp-mapparse-node-versionparse-jsonparse-pathparse-urlparseurlpascalcaseparse5path-is-absolutepath-parsepath-typepath-keypicomatchperformance-nowpath-existspifypinkiepkg-dirpinkie-promiseplease-upgrade-nodepkg-upplugin-errorpiratesposix-character-classesplistprelude-lsprepend-httpprepend-fileprivateprettier-linter-helperspretty-formatprogresspromptsprop-typesnode-notifierprotocolsprocess-nextick-argspumppseudomappupapslqqsquick-lrupunycoderange-parserrcreact-devtools-corereact-isreact-refreshread-pkg-upread-pkgreadable-streamrechoirregenerateredentregenerate-unicode-propertiesregenerator-runtimeregenerator-transformregex-notregexppregexp.prototype.flagsregexpu-coreregistry-auth-tokenregistry-urlregjsgenremove-trailing-separatorregjsparserrepeat-stringrepeatingrepeat-elementrequest-promise-corerequestrequest-promise-nativerequire-directoryrequire-main-filenameresolveresolve-alpnresolve-cwdresolve-frompromiseresolve-globalnode-modules-regexpretresponselikerestore-cursorrimrafretryreusifyrun-asyncrsvprx-literx-lite-aggregatesresolve-pkgrun-parallelrxjsresolve-urlsanesafer-buffersaxsaxesschedulersemver-comparesemver-diffsemver-regexsafe-regexsemverserve-staticsendset-blockingset-valueshebang-commandsafe-buffersetimmediatesetprototypeofshellwordssignal-exitshell-quoteshelljssisteransislashsimple-plistserialize-errorslice-ansislideshebang-regexsource-mapsource-map-resolvesource-map-supportspdx-exceptionssnapdragon-utilspdx-correctside-channelsource-map-urlspdx-expression-parsespdx-license-idssplit-stringsplit2sshpksplitstack-utilsstacktrace-parsersnapdragonsprintf-jsstatic-extendstring-lengthsnapdragon-nodestring-widthstream-buffersstring.prototype.trimleftstealthy-requirestring.prototype.trimendstring.prototype.trimstartstring_decoderstrip-ansistring.prototype.matchallstrip-eofstring.prototype.trimrightstrip-bomstrip-final-newlinestrip-json-commentsstrip-indentsupports-hyperlinkssupports-colortablestatusesterm-sizesymbol-treesudo-promptterminal-linktext-tabletext-extensionstest-excludethroughsymbol-observablethroattime-stamptmpto-fast-propertiesthrough2to-readable-streamtmplto-regex-rangetoidentifierto-regextrim-newlinestrim-off-newlinestr46tough-cookietunnel-agenttsutilstslibtemptype-checktype-festtype-detecttypedarrayua-parser-jstypedarray-to-bufferuglify-jsultronunicode-canonical-property-names-ecmascriptunicode-match-property-ecmascriptunicode-match-property-value-ecmascripttweetnaclunicode-property-aliases-ecmascriptunion-valueuniversal-user-agentuglify-esunpipeto-object-pathuniversalifyupdate-notifierunset-valueuri-jsurixunique-stringuseurl-joinurl-parse-laxutils-mergeuuidv8-to-istanbulvalidate-npm-package-licensevalidate-npm-package-namevaryverrorv8-compile-cachew3c-hr-timew3c-xmlserializerutil-deprecatewcwidthvlqwhatwg-fetchwebidl-conversionswhatwg-encodingwhichwhatwg-urlwhich-modulewhich-pm-runswhatwg-mimetypewidest-linewindow-sizewindows-releasewordwrapword-wrapwrap-ansiwritewrappywalkerwrite-file-atomicxdg-basedirwsxcodexmlbuilderxmlcharsxmldomxml-name-validatorxregexpxmldocy18nyargs-parseryallistyargsxpipextendyaml
0.1.1

1 year ago

0.1.0

1 year ago