Giter Site home page Giter Site logo

yoshiyo / react-native-store-version Goto Github PK

View Code? Open in Web Editor NEW

This project forked from watanabeyu/react-native-store-version

0.0 1.0 0.0 731 KB

This module check an app's version on google playstore or ios app store.

License: MIT License

JavaScript 22.76% TypeScript 77.24%

react-native-store-version's Introduction

react-native-store-version

This module check an app's version on google playstore or ios app store.
By writing code successfully, you can make a forced update.

I've only been updating occasionally, but I'd be happy to sponsor you to keep me motivated. https://github.com/sponsors/watanabeyu

Installation

$ npm install --save react-native-store-version

CHANGELOG

v1.4.0

v1.3.0

  • if failed, throw an error.
  • add result detail.

Usage

import checkVersion from 'react-native-store-version';

export default function App() {
  useEffect(() => {
    const init = async () => {
      try {
        const check = await checkVersion({
          version: '1.0.0', // app local version
          iosStoreURL: 'ios app store url',
          androidStoreURL: 'android app store url',
          // Links allowed for android : 
          // https://play.google.com/store/apps/details?id=xxx.xxx.xxx
          // market://details?id=xxx.xxx.xxx
          country: 'jp', // default value is 'jp'
        });

        if (check.result === 'new') {
          // if app store version is new
        }
      } catch (e) {
        console.log(e);
      }
    };

    init();
  }, []);
}

Return value

// correct
{
  local: "1.0.0",
  remote: "1.1.0",
  result: "new", // "new" | "old" | "equal"
  detail: "remote > local", // "remote > local" | "remote < local" | "remote === local"
}

// catch error
{
  message: "string",
}

result compare from a local to remote.
If local(1.0.0) and remote(1.1.0), result is new.

Example

Check out example on snack

react-native-store-version's People

Contributors

watanabeyu avatar yoshiyo avatar magrinj avatar dependabot[bot] avatar tsuk29 avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.