New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

nativescript-version-update

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

nativescript-version-update

Keep your {N} App updated.

latest
npmnpm
Version
2.0.2
Version published
Maintainers
1
Created
Source

nativescript-version-update

npm npm

NPM

This plugin allows you to define a notification strategy regarding your app updates. You are able to specify if you want to force, offer or ignore an update based on the new version available in the platform store.

For example, you could want to force all major version update, but offer the option to your user to chose to update or skip a minor or patch version.

You can also specify how many days after the update release you want to display the alert.

Prerequisites

You need to add appversion plugins for this one to work:

tns plugin add @nativescript/appversion

Installation

tns plugin add nativescript-version-update

Usage

In your main.ts or app.ts file, before app start, call StoreUpdate.init with desired options like so:

    import { StoreUpdate, AlertTypesConstants } from "nativescript-version-update";

    StoreUpdate.init({
        notifyNbDaysAfterRelease: 1,
        majorUpdateAlertType: AlertTypesConstants.OPTION
    })

Localization

The plugin contains some default translations inside json files located in src/i18n folder and required by hand in the src/helpers/locales.helper.ts file. You can also specify a custom translation in the plugin initialization through the configuraiton options. If you want to contribute a regionalized translation, you must use the lang-regionCode format specified in Apple doc, but with the country lowercased (ex: fr-ca, en-us)

API

Configuration options

PropertyDefaultDescription
majorUpdateAlertTypeFORCEAlert type for major version change (e.g: A.b.c.d)
minorUpdateAlertTypeOPTIONAlert type for minor version change (e.g: a.B.c.d)
patchUpdateAlertTypeNONEAlert type for major version change (e.g: a.b.C.d)
revisionUpdateAlertTypeNONEAlert type for revision version change (e.g: a.b.c.D)
notifyNbDaysAfterRelease1Delays the update prompt by a specific number of days
countryCodeencountry store code
alertOptionsnullCustomize alert dialog text, bypasses the Locale json

Alert types

KeyValueDescription
FORCE1Show an alert that can't be skipped
OPTION2Show an alert that can be skipped
NONE3Don't display alert at all

AlertOptions configuration (Optional)

PropertyDefaultDescription
titleLocaleTextDialog title, fallback to the locale json
messageLocaleTextDialog body text, fallback to the locale json
updateButtonLocaleTextDialog update button, fallback to the locale json
skipButtonLocaleTextDialog skip button, fallback to the locale json

Development

Clone this repository, go in the src folder then run the command npm run setup You can then use:

  • npm run demo.ios or npm run demo.android to start the demo
  • npm run plugin.tscwatch to watch plugin file and start developing!

The repo contains 2 demos folder, one with angular, and one without. Demos use the bundleId com.bitstrips.imoji as their App version contains Major, Minor and Patch numbers, and they update their app really often. You can change parameters passed ton package init in main.ts or app.ts files and change app version in android app.gradle and ios info.plist config files to test the feature.

License

Apache License Version 2.0, January 2004

Contributors

Keywords

NativeScript

FAQs

Package last updated on 13 Apr 2021

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