Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

react-native-on-app-version-upgrade

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-native-on-app-version-upgrade

React Native util to check app version upgrade

  • 2.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1
Maintainers
1
Weekly downloads
 
Created
Source

react-native-on-app-version-upgrade

React native utility to check first session after an app was upgraded, e.g from Google Play or Apple Store.

Install

Install react-native-device-info. All versions are supported.

npm install react-native-on-app-version-upgrade

Usage

Users must pass their storage engine in, e.g async-storage or redux-persist-fs-storage.

IMPORTANT! checkAppVersionUpgrade have to be invoked at least once on every app start.

import AsyncStorage from '@react-native-community/async-storage';
import { checkAppVersionUpgrade } from 'react-native-on-app-version-upgrade';

checkAppVersionUpgrade({ storage: AsyncStorage, considerInstallAsUpgrade: true }).then(
  ({ wasUpgraded }) => {
    if (wasUpgraded) {
      // for example copy asserts
    }
  },
);

checkAppVersionUpgrade({ storage: AsyncStorage }).then(
  ({ prevBuildNumber, buildNumber }) => {
    if (prevBuildNumber < 10 && buildNumber >= 10) {
      // for example do migrations on app upgrade
    }
  },
);

API

Signature:

checkAppVersionUpgrade({{ storage: object, considerInstallAsUpgrade: bool }}): Promise

storage is required.

considerInstallAsUpgrade is optional. Default is false. true value sets wasUpgraded to true when the app has just been installed.

Returns: Promise with object { wasUpgraded, version, buildNumber, prevVersion, prevBuildNumber}.

wasUpgraded is true on first session after app upgrade.

Keywords

FAQs

Package last updated on 15 Nov 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc