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

@wyplay/react-native-wycdn

v0.1.2

Published

A React Native module that allows integration of WyCDN into mobile and TV applications.

Downloads

8

Readme

@wyplay/react-native-wycdn

A React Native module that allows integration of WyCDN into mobile and TV applications.

Dependencies

  • Node.js LTS 20 (or compatible release)

For Android:

  • A minSdkVersion greater than or equal to API level 28.

Installation

yarn add @wyplay/react-native-wycdn

Configuration for Android

1. Ensure minSdkVersion is compatible with WyCDN service

At the start of your app root build.gradle file (not the one near the src directory), ensure minSdkVersion is greater than or equal to API level 28.

buildscript {
    ext {
        ...
        minSdkVersion = 28 // or greater
        ...
    }
    ...
}

2. Add Wyplay maven repository to root build.gradle

At the end of your app root build.gradle file, add the following block to declare Wyplay Maven repository:

allprojects {
  repositories {
    maven {
      name "wyplayRepositoryReleases"
      url "https://maven.wyplay.com/releases"
      credentials(PasswordCredentials)
    }
  }
}

3. Declare properties in gradle.properties

In your application gradle.properties file, declare the following properties for WyCDN version and repository credentials:

# Set the version of WyCDN service below or using command-line
# (eg: `./gradlew build -P wycdnServiceVersion=x.y.z).
wycdnServiceVersion=VERSION_PLACEHOLDER

# Set wyplayRepositoryReleases repository username and password below or using command-line
# (eg: `./gradlew build -P wyplayRepositoryReleasesUsername=username -P wyplayRepositoryReleasesPassword=password`).
wyplayRepositoryReleasesUsername=USERNAME_PLACEHOLDER
wyplayRepositoryReleasesPassword=PASSWORD_PLACEHOLDER

Replace VERSION_PLACEHOLDER, USERNAME_PLACEHOLDER, PASSWORD_PLACEHOLDER with values given by Wyplay.

This ensures that your project can download the required WyCDN service dependencies from Wyplay Maven repository.

4. Allow cleartext traffic

In order to communicate with the WyCDN proxy, you app need to allow cleartext traffic to localhost.

Add a networkSecurityConfig to AndroidManifest.xml

To enable the network security configuration, you need to add the following attribute to your application's tag in the AndroidManifest.xml file in the src/main directory.

src/main/AndroidManifest.xml content:

<application
    ...
    android:networkSecurityConfig="@xml/network_security_config">
    ...
</application>

Create network_security_config.xml file

Next, you need to create a new XML file named network_security_config.xml in the src/main/res/xml directory of your project. If the res/xml directory does not exist, create it.

src/main/res/xml/network_security_config.xml content:

<?xml version="1.0" encoding="utf-8"?>
<network-security-config>
    <domain-config cleartextTrafficPermitted="true">
        <domain includeSubdomains="false">127.0.0.1</domain>
    </domain-config>
</network-security-config>

To allow debugging your app with Metro, you need to create another network_security_config.xml file in the src/debug/res/xml directory of your project. This configuration will only be used for debug builds.

src/debug/res/xml/network_security_config.xml content:

<?xml version="1.0" encoding="utf-8"?>
<network-security-config>
    <base-config cleartextTrafficPermitted="true">
    </base-config>
</network-security-config>

Integration example

Getting the example app

In the source code of this module, you can refer to the example app for a quick sample code integrating the WyCDN service.

For a more advanced example, you may refer to the sample code of the WyCDN React Native sample app.

Running the example app

Get the source code of this module.

In a shell, run from the root of the project:

yarn start

In another shell, prepare the example app:

yarn

Run the example app on Android:

yarn example android

Run the example app on iOS (not yet supported):

yarn example ios

License

Please refer to the LICENSE file.