Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
joaomantovani authored Feb 18, 2024
1 parent e56dd64 commit 4368324
Showing 1 changed file with 36 additions and 167 deletions.
203 changes: 36 additions & 167 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,190 +1,59 @@
# reactnative-forceupdate
# ForceUpdate

A lightweight React Native package for enforcing app version updates. Ensure users always have the latest enhancements and fixes without dependencies.
Welcome to the ForceUpdate organization! This repository contains the core library for ForceUpdate, a comprehensive solution designed to streamline the version management process for mobile applications. ForceUpdate supports multiple platforms such as React Native, Flutter, Android, Swift, and more.

<div align="center">
## What is ForceUpdate?

[![npm](https://img.shields.io/npm/dt/reactnative-forceupdate?style=for-the-badge)](https://www.npmjs.com/package/reactnative-forceupdate)
<br />
[![npm version](https://badge.fury.io/js/reactnative-forceupdate.svg)](https://badge.fury.io/js/reactnative-forceupdate)
[![Coverage Status](https://coveralls.io/repos/github/forceupdate-app/forceupdate-reactnative/badge.svg?branch=main)](https://coveralls.io/github/forceupdate-app/forceupdate-reactnative?branch=main)
[![License Status](https://img.shields.io/github/license/forceupdate-app/forceupdate-reactnative)](https://img.shields.io/github/license/forceupdate-app/forceupdate-reactnative)
[![Issues Status](https://img.shields.io/github/issues/forceupdate-app/forceupdate-reactnative)](https://img.shields.io/github/issues/forceupdate-app/forceupdate-reactnative)
[![Tag Status](https://img.shields.io/github/v/tag/forceupdate-app/forceupdate-reactnative)](https://img.shields.io/github/v/tag/forceupdate-app/forceupdate-reactnative)
[![Languages Status](https://img.shields.io/github/languages/count/forceupdate-app/forceupdate-reactnative)](https://img.shields.io/github/languages/count/forceupdate-app/forceupdate-reactnative)
[![Repo Size Status](https://img.shields.io/github/repo-size/forceupdate-app/forceupdate-reactnative)](https://img.shields.io/github/repo-size/forceupdate-app/forceupdate-reactnative)

</div>
ForceUpdate is a comprehensive solution designed to streamline the version management process for mobile applications, supporting multiple platforms such as React Native, Flutter, Android, Swift, and more. The heart of ForceUpdate lies in its core library, which allows developers to seamlessly integrate version control into their applications.

## Features

- Enforce app version updates for Android and iOS
- Ensure users have the latest enhancements and fixes
- Lightweight and native implementation
- No external dependencies
- 100% test coverage
- Made with Typescript
- Customizable forceupdate modal on forceupdate dashboard
- Callbacks for handling modal events
- Support for multiple languages
- Support for multiple platforms
- A completed [SAAS](https://forceupdate.app) to manage your versions
- **Enforce App Version Updates:** Ensure that users are always using the latest version of your app.
- **Lightweight and Native Implementation:** A minimalistic approach with native implementations for better performance.
- **No External Dependencies:** Keep your project clean and dependency-free.
- **100% Test Coverage:** Thoroughly tested to ensure reliability.
- **Made with Typescript:** Leverage the benefits of a statically-typed language.
- **Customizable Update Modal:** Tailor the update modal according to your application's design.
- **Callback Support:** Handle events with ease through provided callbacks.
- **Multi-language Support:** Reach a global audience with support for multiple languages.
- **Multi-platform Support:** Ensure consistency across various platforms.
- **SAAS Integration:** Manage your app versions effortlessly through the [ForceUpdate SAAS](https://forceupdate.app).

## Creating an account
## Getting Started

To use this package, you need to create an account on [ForceUpdate](https://forceupdate.app) and create a project. You will get an API key that you will use to check if the app is updated.
To start using ForceUpdate in your project, follow these steps:

There is a free plan that you can use to test the package!
### 1. Create an Account

## Installation
Visit [ForceUpdate](https://forceupdate.app), create an account, and set up a project. Obtain the API key required for version checks.

Install the package using:
### 2. Check our docs for your platform

npm
https://forceupdate-app.github.io/docs

```sh
npm install reactnative-forceupdate
```

or

yarn

```sh
yarn add reactnative-forceupdate
```
### 3. Usage
Integrate ForceUpdate into your application to enforce version checks. Refer to the API Reference section for customization options and callback support.

## Usage
### API Reference

Import the package
Explore the various properties and optional callbacks available in the ForceUpdate library. Customize the update modal and handle events with ease.

```tsx
import { ForceUpdate } from 'reactnative-forceupdate';
```
### Examples

Wrap your app with the `ForceUpdate` component. It will check if the app is updated and show a modal if it's not.
Find examples for integrating ForceUpdate into various platforms. Use these examples as a reference for setting up version control in your applications.

```tsx
<ForceUpdate
api_key="6bbc51d23e5938d512a62a83c230dfdef89ab7a2c75bdc1f0f42909d5e04feb5"
language={'en'}
platform={'ANDROID'}
version={'1.0.2'}
>
<View>
<FakeProvider>
<Text>My App</Text>
</FakeProvider>
</View>
</ForceUpdate>
```

## API Reference

These properties are required when instantiating the `ForceUpdate` component.

| Parameter | Explanation |
| --------- | ------------------------------------------------------------------------------- |
| Platform | It should be either 'ANDROID' or 'IOS' |
| Version | The actual version of your app |
| Api_key | The API key of your project. You can get it on your forceupdate.app dashboard |
| Language | The language of the message. The same defined on your forceupdate.app dashboard |

### Optional props (Callbacks)

These are the optional props that you can use to handle the modal events.

| Parameter | Explanation | Context |
| ---------------------- | -------------------------------------------------- | -------------------------------------------------------------------------- |
| onDismiss | Callback when the user dismisses the modal | only appliable when `force_update` is `false` |
| onForceUpdate | Callback when the user clicks on the update button | only appliable when `force_update` is `true` |
| onUpdate | Callback when the user clicks on the update button | only appliable when `force_update` is `false` and `needs_update` is `true` |
| onVersionCheck | Callback when the version check starts | always |
| onVersionCheckError | Callback when the version check fails | always when error |
| onVersionCheckSuccess | Callback when the version check succeeds | always when success |
| onVersionCheckStart | Callback when the version check starts | always |
| onVersionCheckEnd | Callback when the version check ends | always |
| onVersionCheckComplete | Callback when the version check completes | always |
| onLoadingStart | Callback when the loading starts | always |
| onLoadingEnd | Callback when the loading ends | always |

### API response

You do not manipulate the API response, but it's important to understand the properties that you can use to customize the modal on forceupdate.app dashboard.

| Parameter | Explanation | Context |
| ------------------- | ------------------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| needs_update | If the app needs an update | Defined on your version on forceupdate.app |
| force_update | If the app needs a force update | Defined on your version on forceupdate.app |
| title | The title of the modal | The title that will be shown to the user when modal appear |
| message | The message that will be shown to the user | The message that will be shown to the user when modal appear |
| store_url | The url of the app store | The url that the user will be redirected when clicking on the update button. It consider the platform that the user is using, this property is defined on when you call <ForceUpdate ... platform={'ANDROID'} /> |
| dismiss_button_text | The text of the dismiss button | The text of the dismiss button, defined on your version on forceupdate.app |
| update_button_text | The text of the update button | The text of the update button, defined on your version on forceupdate.app |

## Examples

### Expo

```tsx
import Constants from 'expo-constants';
import { Platform } from 'react-native';
### Benefits of ForceUpdate

// ...
Effortless Version Management: Streamline the process of updating app versions.
Enhanced User Experience: Ensure users always have access to the latest features and fixes.
Lightweight Integration: Integrate version control without introducing unnecessary dependencies.
Global Reach: Support for multiple languages and platforms ensures a consistent experience for users worldwide.

const version = Constants.manifest.version;
const platform = Platform.OS === 'ios' ? 'IOS' : 'ANDROID';
const language = 'en'; // or get it from any library like I18n
const apiKey =
'6bbc51d23e5938d512a62a83c230dfdef89ab7a2c75bdc1f0f42909d5e04feb5';

return (
<ForceUpdate
api_key={apiKey}
language={language}
platform={platform}
version={version}
>
<YourApp />
</ForceUpdate>
);
```

### React Native

If you are using react-native without expo, you can get the version using the [react-native-device-info](https://github.com/react-native-device-info/react-native-device-info) package.

```tsx
import DeviceInfo from 'react-native-device-info';
```

And then use it like this:

```tsx
import { Platform } from 'react-native';
// ...
const version = DeviceInfo.getVersion();
const platform = Platform.OS === 'ios' ? 'IOS' : 'ANDROID';
const language = 'en'; // or get it from any library like I18n
const apiKey =
'6bbc51d23e5938d512a62a83c230dfdef89ab7a2c75bdc1f0f42909d5e04feb5';

return (
<ForceUpdate
api_key={apiKey}
language={language}
platform={platform}
version={version}
>
<YourApp />
</ForceUpdate>
);
```

## Api key

The API key is a unique identifier for your app. You can get it by creating an account on [ForceUpdate](https://forceupdate.app) and create a project to get one.
### Contributing

We welcome contributions from the community! Feel free to submit issues, feature requests, or pull requests to help improve ForceUpdate.

---
<br />

Made with [create-react-native-library](https://github.com/callstack/react-native-builder-bob)
Made with ❤️ by the ForceUpdate Team

0 comments on commit 4368324

Please sign in to comment.