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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@sigx/lynx-permissions

v0.8.0

Published

Shared Android permission helper for sigx-lynx native modules

Readme

@sigx/lynx-permissions

Android-only infrastructure. Apps typically don't need to install this directly — every permission-using module (@sigx/lynx-audio, @sigx/lynx-camera, @sigx/lynx-file-picker, @sigx/lynx-image-picker, @sigx/lynx-location, @sigx/lynx-notifications) declares it as a dependency, and the auto-linker walks transitive dependencies, so it links automatically. This README is for native-module authors.

Provides the shared PermissionHelper + MediaCapture Kotlin classes that the listed modules dispatch through to show OS permission dialogs and receive Activity Result callbacks. iOS doesn't need this — UIImagePickerController/CLLocationManager/etc. handle their own prompts.

📚 Documentation

Full guides, API reference and live examples → https://sigx.dev/lynx/modules/permissions/overview/

Install

Normally nothing to do — installing any of the modules above brings this in transitively, and sigx prebuild auto-discovers it and copies the Kotlin sources (PermissionHelper.kt + MediaCapture.kt) into your Android source tree. A direct pnpm add @sigx/lynx-permissions also works (e.g. when authoring a native module against it) and links the same way.

How it works

The app template's MainActivity.kt reflectively wires this module on lifecycle hooks:

  • onResumePermissionHelper.setActivity(this)
  • onPausePermissionHelper.clearActivity()
  • onCreateMediaCapture.register(this) (Activity Result API launchers — must be wired before STARTED state)
  • onRequestPermissionsResultPermissionHelper.onRequestPermissionsResult(...)

The try { Class.forName(...).getDeclaredField("INSTANCE").get(null) } catch { /* not present */ } pattern means the wiring silently no-ops in apps that don't have this module on the classpath — so adding/removing it is a one-line pnpm add/pnpm remove away.

Public API

The Kotlin classes are consumed by other native modules, not by JS. There's no index.ts export here — JS callers go through @sigx/lynx-camera.requestPermission() etc.

If you're authoring a new native module that needs runtime permissions on Android, reach into:

import com.sigx.permissions.PermissionHelper

// In a coroutine-friendly context:
val granted = PermissionHelper.request(arrayOf(Manifest.permission.CAMERA))

…and for ActivityResultContracts:

import com.sigx.permissions.MediaCapture

// MediaCapture.takePicture(uri) etc. — wraps the system intents through
// pre-registered launchers so the call site doesn't need to deal with
// Activity Result lifecycle.

Why a separate module

Audio + Camera + FilePicker + ImagePicker + Location + Notifications all need the same requestPermissions() / Activity Result plumbing on Android. Without a shared layer, each module would re-implement Activity Result wiring, hold its own static Activity reference, and fight over onRequestPermissionsResult request codes. Centralizing it here keeps each consumer module trivially small and avoids overlapping request-code namespaces.

iOS has no equivalent because the OS-level pickers (UIImagePickerController, PHPickerViewController, CLLocationManager) all handle their own permission flows internally.

Reference

packages/lynx-cli/templates/android/app/src/main/kotlin/__package__/MainActivity.kt is the canonical example of how an Activity integrates with this module via reflection.