Skip to content

Commit

Permalink
feat(android)!: support notifyAppReady() in manual mode
Browse files Browse the repository at this point in the history
BREAKING CHANGE: Java and TypeScript interfaces have changed for some plugin methods to support returning VersionInfo
  • Loading branch information
lincolnthree committed May 3, 2022
1 parent e08b5d2 commit b894788
Show file tree
Hide file tree
Showing 9 changed files with 1,437 additions and 529 deletions.
91 changes: 56 additions & 35 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -116,14 +116,14 @@ Do not password encrypt this file, or it will fail to unpack.
<docgen-index>

* [`download(...)`](#download)
* [`next(...)`](#next)
* [`set(...)`](#set)
* [`getId()`](#getid)
* [`delete(...)`](#delete)
* [`list()`](#list)
* [`reset(...)`](#reset)
* [`current()`](#current)
* [`reload()`](#reload)
* [`versionName()`](#versionname)
* [`notifyAppReady()`](#notifyappready)
* [`delayUpdate()`](#delayupdate)
* [`cancelDelay()`](#canceldelay)
Expand All @@ -143,16 +143,33 @@ Do not password encrypt this file, or it will fail to unpack.
### download(...)

```typescript
download(options: { url: string; }) => Promise<{ version: string; }>
download(options: { url: string; versionName?: string; }) => Promise<VersionInfo>
```

Download a new version from the provided URL, it should be a zip file, with files inside or with a unique folder inside with all your files

| Param | Type |
| ------------- | ----------------------------- |
| **`options`** | <code>{ url: string; }</code> |
| Param | Type |
| ------------- | --------------------------------------------------- |
| **`options`** | <code>{ url: string; versionName?: string; }</code> |

**Returns:** <code>Promise&lt;{ version: string; }&gt;</code>
**Returns:** <code>Promise&lt;<a href="#versioninfo">VersionInfo</a>&gt;</code>

--------------------


### next(...)

```typescript
next(options: { version: string; versionName?: string; }) => Promise<VersionInfo>
```

Set the next bundle version to be used when the app is reloaded.

| Param | Type |
| ------------- | ------------------------------------------------------- |
| **`options`** | <code>{ version: string; versionName?: string; }</code> |

**Returns:** <code>Promise&lt;<a href="#versioninfo">VersionInfo</a>&gt;</code>

--------------------

Expand All @@ -163,7 +180,7 @@ Download a new version from the provided URL, it should be a zip file, with file
set(options: { version: string; versionName?: string; }) => Promise<void>
```

Set version as current version, set will return an error if there are is no index.html file inside the version folder. `versionName` is optional and it's a custom value that will be saved for you
Set the current bundle version and immediately reloads the app.

| Param | Type |
| ------------- | ------------------------------------------------------- |
Expand Down Expand Up @@ -203,40 +220,40 @@ Delete version in storage
### list()

```typescript
list() => Promise<{ versions: string[]; }>
list() => Promise<{ versions: VersionInfo[]; }>
```

Get all available versions

**Returns:** <code>Promise&lt;{ versions: string[]; }&gt;</code>
**Returns:** <code>Promise&lt;{ versions: VersionInfo[]; }&gt;</code>

--------------------


### reset(...)

```typescript
reset(options?: { toAutoUpdate?: boolean | undefined; } | undefined) => Promise<void>
reset(options?: { toLastSuccessful?: boolean | undefined; } | undefined) => Promise<void>
```

Set the `builtin` version (the one sent to Apple store / Google play store ) as current version

| Param | Type |
| ------------- | ---------------------------------------- |
| **`options`** | <code>{ toAutoUpdate?: boolean; }</code> |
| Param | Type |
| ------------- | -------------------------------------------- |
| **`options`** | <code>{ toLastSuccessful?: boolean; }</code> |

--------------------


### current()

```typescript
current() => Promise<{ current: string; currentNative: string; }>
current() => Promise<{ bundle: VersionInfo; native: string; }>
```

Get the current version, if none are set it returns `builtin`, currentNative is the original version install on the device

**Returns:** <code>Promise&lt;{ current: string; currentNative: string; }&gt;</code>
**Returns:** <code>Promise&lt;{ bundle: <a href="#versioninfo">VersionInfo</a>; native: string; }&gt;</code>

--------------------

Expand All @@ -252,27 +269,16 @@ Reload the view
--------------------


### versionName()

```typescript
versionName() => Promise<{ versionName: string; }>
```

Get the version name, if it was set during the set phase

**Returns:** <code>Promise&lt;{ versionName: string; }&gt;</code>

--------------------


### notifyAppReady()

```typescript
notifyAppReady() => Promise<void>
notifyAppReady() => Promise<VersionInfo>
```

Notify native plugin that the update is working, only in auto-update

**Returns:** <code>Promise&lt;<a href="#versioninfo">VersionInfo</a>&gt;</code>

--------------------


Expand Down Expand Up @@ -386,6 +392,16 @@ removeAllListeners() => Promise<void>
### Interfaces


#### VersionInfo

| Prop | Type |
| ---------------- | ------------------------------------------------------- |
| **`version`** | <code>string</code> |
| **`downloaded`** | <code>string</code> |
| **`name`** | <code>string</code> |
| **`status`** | <code><a href="#versionstatus">VersionStatus</a></code> |


#### PluginListenerHandle

| Prop | Type |
Expand All @@ -402,21 +418,26 @@ removeAllListeners() => Promise<void>

#### MajorAvailableEvent

| Prop | Type | Description | Since |
| ------------- | ------------------- | ------------------------------------------- | ----- |
| **`version`** | <code>string</code> | Emit when a new major version is available. | 2.3.0 |
| Prop | Type | Description | Since |
| ------------- | --------------------------------------------------- | ------------------------------------------- | ----- |
| **`version`** | <code><a href="#versioninfo">VersionInfo</a></code> | Emit when a new major version is available. | 2.3.0 |


#### UpdateAvailableEvent

| Prop | Type | Description | Since |
| ------------- | ------------------- | ------------------------------------ | ----- |
| **`version`** | <code>string</code> | Emit when a new update is available. | 3.0.0 |
| Prop | Type | Description | Since |
| ------------- | --------------------------------------------------- | ------------------------------------ | ----- |
| **`version`** | <code><a href="#versioninfo">VersionInfo</a></code> | Emit when a new update is available. | 3.0.0 |


### Type Aliases


#### VersionStatus

<code>'success' | 'error' | 'pending'</code>


#### DownloadChangeListener

<code>(state: <a href="#downloadevent">DownloadEvent</a>): void</code>
Expand Down

0 comments on commit b894788

Please sign in to comment.