All Projects → kimxogus → React Native Version Check

kimxogus / React Native Version Check

Licence: mit
A version checker for react-native applications

Programming Languages

java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to React Native Version Check

webapp-wordlists
This repository contains wordlists for each versions of common web applications and content management systems (CMS). Each version contains a wordlist of all the files directories for this version.
Stars: ✭ 306 (-15.93%)
Mutual labels:  version
VersionCompare
Supports compare version in a very simple & comprehensive way.
Stars: ✭ 31 (-91.48%)
Mutual labels:  version
Cli
🆑📍 Setup automated semver compliant package publishing
Stars: ✭ 272 (-25.27%)
Mutual labels:  version
SSAppUpdater
SSAppUpdater is an open-source framework that compares the current version of the app with the store version and returns the essential details of it like app URL, new app version number, new release note, etc. So you can either redirect or notify the user to update their app.
Stars: ✭ 58 (-84.07%)
Mutual labels:  version
version-check
An action that allows you to check whether your npm package version has been updated
Stars: ✭ 65 (-82.14%)
Mutual labels:  version
semver
Semantic version object for Perl
Stars: ✭ 12 (-96.7%)
Mutual labels:  version
exec
🐚 semantic-release plugin to execute custom shell commands
Stars: ✭ 94 (-74.18%)
Mutual labels:  version
Repology Updater
Repology backend service to update repository and package data
Stars: ✭ 348 (-4.4%)
Mutual labels:  version
dotnet-version-cli
dotnet version cli (similar to npm version cli)
Stars: ✭ 30 (-91.76%)
Mutual labels:  version
Calver
📅 The web's go-to resource for Calendar Versioning info.
Stars: ✭ 271 (-25.55%)
Mutual labels:  version
shenv
Simple shell version management
Stars: ✭ 27 (-92.58%)
Mutual labels:  version
perfekt
Release, changelog and version your packages with perfe(k)t 👌 ease!
Stars: ✭ 15 (-95.88%)
Mutual labels:  version
Python Semver
Python package to work with Semantic Versioning (http://semver.org/)
Stars: ✭ 264 (-27.47%)
Mutual labels:  version
node-compat-require
Easily allow your Node program to run in a target node version range to maximize compatibility.
Stars: ✭ 22 (-93.96%)
Mutual labels:  version
Luminous
Luminous provides you a lot of information about the system and a lot of handy methods to quickly get useful data on the iOS platform.
Stars: ✭ 298 (-18.13%)
Mutual labels:  version
repology-rules
Package normalization ruleset for Repology
Stars: ✭ 67 (-81.59%)
Mutual labels:  version
react-native-appstore-version-checker
[Deprecated] A react native module to fetch the version of latest app from android playstore or apple app store
Stars: ✭ 88 (-75.82%)
Mutual labels:  version
Fnm
🚀 Fast and simple Node.js version manager, built in Rust
Stars: ✭ 6,102 (+1576.37%)
Mutual labels:  version
Bump
Bump updates the project's version, updates/creates the changelog, makes the bump commit, tags the bump commit and makes the release to GitHub. Opinionated but configurable.
Stars: ✭ 327 (-10.16%)
Mutual labels:  version
Dvm
Deno Version Manager - Easy way to manage multiple active deno versions.
Stars: ✭ 271 (-25.55%)
Mutual labels:  version

react-native-version-check

npm version npm downloads Build Status DevDependencies Status Known Vulnerabilities

A version checker for react-native applications. This library gets the latest app version by parsing google play store, apple app store's app information or custom url. Parsing code is referenced from here

Looking for maintainers!

I have almost zero experience in ios development, and I am no longer working on mobile app development(doing backend and devops works mainly and some web frontend). It makes me hard to maintain this library actively. Hope to have someone to help maintaining react-native-version-check!

expo

react-native-version-check supports expo! with react-native-version-check-expo

  • usage
// import
import VersionCheck from 'react-native-version-check-expo'

VersionCheck.getCountry().then(country => console.log(country))

Getting started

  • npm
$ npm install react-native-version-check
  • yarn
$ yarn add react-native-version-check

Example

$ git clone https://github.com/kimxogus/react-native-version-check.git
$ cd react-native-version-check/example
$ yarn # or npm install
$ react-native run-android # or react-native run-ios

Automatic Installation

$ react-native link react-native-version-check

Manual Installation

- iOS - Link Manually

  • Add .xcodeproj file as library to XCode project.

    1. In project navigator, right click Libraries
    2. Select Add Files to [PROJECT_NAME]
    3. Add the node_modules/react-native-version-check/ios/RNVersionCheck.xcodeproj file
  • Add the libRNVersionCheck.a from the RNVersionCheck project to your project's Build Phases > Link Binary With Libraries

iOS - CocoaPods Package Manager

  • Add to your Podfile (assuming it's in ios/Podfile):
    pod 'react-native-version-check', :path => '../node_modules/react-native-version-check'
    
  • Reinstall pod with cd ios && pod install && cd ..

- Android

  • Append the following lines to android/settings.gradle:
...
include ':react-native-version-check'
project(':react-native-version-check').projectDir = new File(rootProject.projectDir, 	'../node_modules/react-native-version-check/android')
  • Insert the following lines inside the dependencies block in android/app/build.gradle:
...
dependencies {
   ...
   compile project(':react-native-version-check')
}
  • Open up android/app/src/main/java/[...]/MainApplication.java
......
import io.xogus.reactnative.versioncheck.RNVersionCheckPackage;  // <--- HERE

......

@Override
protected List<ReactPackage> getPackages() {
   ......
   new RNVersionCheckPackage()            // <------ HERE
   ......
}

Usage

import { Linking } from 'react-native';
import VersionCheck from 'react-native-version-check';

VersionCheck.getCountry()
  .then(country => console.log(country));          // KR
console.log(VersionCheck.getPackageName());        // com.reactnative.app
console.log(VersionCheck.getCurrentBuildNumber()); // 10
console.log(VersionCheck.getCurrentVersion());     // 0.1.1

VersionCheck.getLatestVersion()
  .then(latestVersion => {
    console.log(latestVersion);    // 0.1.2
  });

VersionCheck.getLatestVersion({
    provider: 'appStore'  // for iOS
  })
  .then(latestVersion => {
    console.log(latestVersion);    // 0.1.2
  });

VersionCheck.getLatestVersion({
    provider: 'playStore'  // for Android
  })
  .then(latestVersion => {
    console.log(latestVersion);    // 0.1.2
  });

VersionCheck.getLatestVersion()    // Automatically choose profer provider using `Platform.select` by device platform.
  .then(latestVersion => {
    console.log(latestVersion);    // 0.1.2
  });

VersionCheck.getLatestVersion({
  forceUpdate: true,
  provider: () => fetch('http://your.own/api')
    .then(r => r.json())
    .then(({version}) => version),   // You can get latest version from your own api.
}).then(latestVersion =>{
  console.log(latestVersion);
});

VersionCheck.needUpdate()
  .then(async res => {
    console.log(res.isNeeded);    // true
    if (res.isNeeded) {
      Linking.openURL(res.storeUrl);  // open store if update is needed.
    }
  });

VersionCheck.needUpdate({
  depth: 2
}).then(res => {
  console.log(res.isNeeded);
  // false; because first two fields of current and the latest versions are the same as "0.1".
});

VersionCheck.needUpdate({
  currentVersion: "1.0",
  latestVersion: "2.0"
}).then(res => {
  console.log(res.isNeeded);  // true
});

VersionCheck.needUpdate({
  depth: 1,
  currentVersion: "2.1",
  latestVersion: "2.0",
}).then(res => {
  console.log(res.isNeeded);  // false
});

Methods

  • #getCountry() (Promise<country: String>) - Returns device's country code of 2 characters.

  • #getPackageName() (packageName: String) - Returns package name of app.

  • #getCurrentBuildNumber() (buildNumber: Number) - Returns current app build number.

  • #getStoreUrl([option: Object]) (Promise<storeUrl: String>) - Returns url of Play Market or App Store of app.

  • #getAppStoreUrl([option: Object]) (Promise<storeUrl: String>) - Returns url of App Store of app.

    • Option

      Field Type Default
      appID string App ID
      ignoreErrors boolean true
  • #getPlayStoreUrl([option: Object]) (Promise<storeUrl: String>) - Returns url of Play Store of app.

    • Option

      Field Type Default
      packageName string Package Name
      ignoreErrors boolean true
  • #getCurrentVersion() (currentVersion: String) - Returns current app version.

  • #getLatestVersion([option: Object]) (Promise<latestVersion: String>) - Returns the latest app version parsed from url. Returns null when parsing error occurs.

    • Option

      Field Type Default
      forceUpdate boolean false
      provider string or function provider name or function that returns promise or value of the latest version
      fetchOptions object isomorphic-fetch options (https://github.github.io/fetch/)
      ignoreErrors boolean true
  • #needUpdate([option: Object]) (Promise<result: Object>) - Returns an object contains with boolean value whether update needed, current version and latest version. Current and the latest app versions are first split by delimiter, and check each split numbers into depth.

    • Option

      Field Type Default
      currentVersion string app's current version from getCurrentVersion()
      latestVersion string app's latest version from getLatestVersion()
      depth number Infinity
      forceUpdate boolean false
      provider string or function provider name or function that returns promise or value of the latest version
      fetchOptions object isomorphic-fetch options (https://github.github.io/fetch/)
      ignoreErrors boolean true
    • Result

      Field Type
      isNeeded boolean
      storeUrl string
      currentVersion string
      latestVersion string

License

MIT

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].