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

rn-in-app-update

v0.0.1

Published

Perform in-app updates easily

Downloads

4

Readme

Generic badge Generic badge Generic badge Generic badge Ask Me Anything !

React Native In-App Update

React Native In-App Update is a library that does App updates within your app easily, making sure your users are always up to date. This library supports at the moment Android only.

🎉 Getting started

To get started and make sure to configure it well please learn more about Play Store in-app updates here first.

Install via repo

$ yarn add https://github.com/franznkemaka/react-native-in-app-update

Mostly automatic installation

$ react-native link rn-in-app-update

Manual installation

Android

  1. Open up android/app/src/main/java/[...]/MainActivity.java
  • Add import com.franznkemaka.RNInAppUpdatePackage; to the imports at the top of the file

  • Add new RNInAppUpdatePackage() to the list returned by the getPackages() method

  1. Append the following lines to android/settings.gradle:

    include ':rn-in-app-update'
    project(':rn-in-app-update').projectDir = new File(rootProject.projectDir, 	'../node_modules/rn-in-app-update/android')
  2. Insert the following lines inside the dependencies block in android/app/build.gradle:

      compile project(':rn-in-app-update')

ℹ️ Usage

import RNInAppUpdate from 'rn-in-app-update';

componentDidMount(){
   // check for updates and show modal if available
   // on iOS this displays a warning as it not supported
   InAppUpdate.checkUpdate();
}

Suggest to restart app

componentDidMount(){
  InAppUpdate.checkUpdate();
  InAppUpdate.onUpdateDownloaded(() => {
     // new update was download but not yet installed
     // reload app to apply changes

     Alert.alert(
        'Update Downloaded',
        'An update has just been downloaded. Restart app to apply changes',
        {
          text:'Restart',
          onPress: () => {
            // you can terminate the update hence restarting the app
            InAppUpdate.forceCompleteUpdate();
          }
       })
  });
}

Check out the following App example to see how it works in a real app.

Examples

🏗 API

Recap

  • FLEXIBLE means that the update is for example optional and can be downloaded in the background while the user is using the app.

  • IMMEDIATE means that the update must be downloaded and a full screen is displayed while downloading.

  • staleDays defines the number of days after which an update is not FLEXIBLE but becomes IMMEDIATE instead, hence forcing the user to update.

Methods

checkUpdate(config: UpdatesConfigObject) :void

type UpdatesConfigObject = {
    staleDays?: number; // default 5
};

onUpdateDownloaded(callback: CallableFunction) :void

Fires when the update was in FLEXIBLE mode and it finished downloading. With your callback you can show an alert to prompt the user to restart or something alike.

forceCompleteUpdate() :void

Use this function in onUpdateDownloaded to terminate the update process by restarting the app.

🤝 Authors and acknowledgment

📌 Roadmap

  • [x] 🤖 Add Android support
  • [ ] 🍏 Add iOS Support
  • [ ] ✨ Add Priority mode, as described here

❤️ Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

⚖️ License

This project is licensed under the MIT License