cordova-plugin-in-app-updates 2.0.5 → 2.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,5 +1,4 @@
1
-
2
- ![License](https://img.shields.io/badge/license-MIT-orange.svg) ![Platform](https://img.shields.io/badge/platform-android-green.svg) [![Donate](https://img.shields.io/badge/donate-PayPal-green.svg)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=G33QACCVKYD7U)
1
+ ![npm](https://img.shields.io/npm/dt/cordova-plugin-in-app-updates) ![npm](https://img.shields.io/npm/v/cordova-plugin-in-app-updates) ![GitHub package.json version](https://img.shields.io/github/package-json/v/andreszs/cordova-plugin-in-app-updates?color=FF6D00&label=master&logo=github) ![GitHub code size in bytes](https://img.shields.io/github/languages/code-size/andreszs/cordova-plugin-in-app-updates) ![GitHub top language](https://img.shields.io/github/languages/top/andreszs/cordova-plugin-in-app-updates) ![GitHub](https://img.shields.io/github/license/andreszs/cordova-plugin-in-app-updates) ![GitHub last commit](https://img.shields.io/github/last-commit/andreszs/cordova-plugin-in-app-updates)
3
2
 
4
3
  # cordova-plugin-in-app-updates
5
4
 
@@ -8,12 +7,12 @@ Cordova Android plugin for checking for updates and auto updating app with Googl
8
7
  # Platforms
9
8
 
10
9
  - Android
11
- - Browser
10
+ - Browser (filler platform)
12
11
 
13
12
  # Features
14
13
 
15
- - AndroidX ready (plugin version 2.0.x)
16
- - Checks for updates
14
+ - AndroidX ready (plugin version 2.x.x)
15
+ - Check for updates
17
16
  - Install flexible updates
18
17
  - Install immediate updates
19
18
  - Customize snackbar message and button for Flexible updates
@@ -21,23 +20,24 @@ Cordova Android plugin for checking for updates and auto updating app with Googl
21
20
 
22
21
  # Installation
23
22
 
24
- ## Version Requirements
23
+ ## Plugin Versions
25
24
 
26
- | Plugin version | Cordova CLI | Cordova Android | AndroidX support |
27
- | --- | --- | --- | --- |
28
- | 1.0.6 | 9.0.0 | 8.0.0 | No |
29
- | 2.0.5 | 10.0.0 | 9.0.0 | Yes |
25
+ | Plugin version | Cordova >= | Cordova Android | AndroidX | targetSdkVersion |
26
+ | --- | --- | --- | --- | --- |
27
+ | 1.0.6 | 9.0.0 | 8.0.0 | No | 29 |
28
+ | 2.0.5 | 10.0.0 | 9.0.0 | Yes | 30/31 |
29
+ | 2.1.0 | 10.0.0 | 11.0.0 | Yes | 32 |
30
30
 
31
- ## Install latest version
31
+ ### Install latest version from NPM
32
32
 
33
33
  ```bash
34
34
  cordova plugin add cordova-plugin-in-app-updates
35
35
  ```
36
36
 
37
- ## Install version 1.x
37
+ ### Install latest version from master
38
38
 
39
39
  ```bash
40
- cordova plugin add cordova-plugin-in-app-updates@1.0.6
40
+ cordova plugin add https://github.com/andreszs/cordova-plugin-in-app-updates
41
41
  ```
42
42
 
43
43
  # Methods
@@ -46,6 +46,10 @@ Cordova Android plugin for checking for updates and auto updating app with Googl
46
46
 
47
47
  Invokes the AppUpdateManager and return one of the [updateAvailability](https://developer.android.com/reference/com/google/android/play/core/install/model/UpdateAvailability.html) codes as string.
48
48
 
49
+ ```javascript
50
+ cordova.plugins.InAppUpdate.getUpdateAvailability(successCallback, errorCallback)
51
+ ```
52
+
49
53
  ### Return values
50
54
 
51
55
  - **UPDATE_AVAILABLE**
@@ -73,6 +77,10 @@ cordova.plugins.InAppUpdate.getUpdateAvailability(onSuccess, onFailure);
73
77
 
74
78
  Starts a [flexible update](https://developer.android.com/guide/playcore/in-app-updates/kotlin-java#flexible "flexible update") process and prompts the user with a dialog to download the new version now or when Wi-Fi is available.
75
79
 
80
+ ```javascript
81
+ cordova.plugins.InAppUpdate.updateFlexible(successCallback, errorCallback)
82
+ ```
83
+
76
84
  :warning: The **successCallback** from this method can be triggered repeatedly according to its status.
77
85
 
78
86
  ### Return values
@@ -107,6 +115,10 @@ cordova.plugins.InAppUpdate.updateFlexible(onSuccess, onFailure);
107
115
 
108
116
  Starts an [immediate update](https://developer.android.com/guide/playcore/in-app-updates/kotlin-java#immediate "immediate update") process and prompts the user with a fullscreen dialog to download now or when Wi-Fi is available. The update is downloaded and installed in the foreground, preventing the user from interacting with your app until the installation succeeds and the app is automatically restarted.
109
117
 
118
+ ```javascript
119
+ cordova.plugins.InAppUpdate.updateImmediate(successCallback, errorCallback)
120
+ ```
121
+
110
122
  :warning: The **successCallback** from this method can be triggered repeatedly according to its status.
111
123
 
112
124
  ### Return values
@@ -138,7 +150,9 @@ cordova.plugins.InAppUpdate.updateImmediate(onSuccess, onFailure);
138
150
 
139
151
  Sets the label and the button text for the snackbar shown after downloading a flexible update. You are free to call this method at any time. You can also call it again to show different snackbar messages after the snackbar was shown.
140
152
 
141
- If not called, default messages in English will be shown.
153
+ ```javascript
154
+ cordova.plugins.InAppUpdate.setSnackbarOptions(successCallback, errorCallback, snackbarText, snackbarButton, snackbarButtonColor)
155
+ ```
142
156
 
143
157
  :information_source: Browser platform does nothing and always returns **SUCCESS**
144
158
 
@@ -157,7 +171,9 @@ var snackbarButtonColor = "#76FF03";
157
171
  cordova.plugins.InAppUpdate.setSnackbarOptions(onSuccess, onFailure, snackbarText, snackbarButton, snackbarButtonColor);
158
172
  ```
159
173
 
160
- ### Default messages when not called
174
+ ### Snackbar default values
175
+
176
+ If this method is not called, default messages in English will be shown as follows.
161
177
 
162
178
  - **snackbarText** = "An update has just been downloaded."
163
179
  - **snackbarButton** = "RESTART"
@@ -170,8 +186,27 @@ cordova.plugins.InAppUpdate.setSnackbarOptions(onSuccess, onFailure, snackbarTex
170
186
 
171
187
  # Plugin demo app
172
188
 
173
- Get the [In-App Update Plugin Demo app](https://www.andreszsogon.com/cordova-in-app-update-plugin-demo-app/ "In-App Update Plugin Demo app") to test the plugin in all possible scenarios. This app is available in the Store, please follow the linked instructions to test the update flow.
189
+ - [Compiled APK and reference](https://www.andreszsogon.com/cordova-in-app-update-plugin-demo-app/) including testing procedure instructions
190
+ - [Latest demo app version in Play Store](https://play.google.com/store/apps/details?id=com.andreszs.inappupdate.demo)
191
+ - [Source code for www folder](https://github.com/andreszs/cordova-plugin-demos)
192
+
193
+ <img src="https://github.com/andreszs/cordova-plugin-demos/blob/main/com.andreszs.inappupdate.demo/screenshots/cordova.in_app_updates_1.jpg?raw=true" width="200" /> <img src="https://github.com/andreszs/cordova-plugin-demos/blob/main/com.andreszs.inappupdate.demo/screenshots/cordova.in_app_updates_2.jpg?raw=true" width="200" /> <img src="https://github.com/andreszs/cordova-plugin-demos/blob/main/com.andreszs.inappupdate.demo/screenshots/cordova.in_app_updates_3.jpg?raw=true" width="200" /> <img src="https://github.com/andreszs/cordova-plugin-demos/blob/main/com.andreszs.inappupdate.demo/screenshots/cordova.in_app_updates_4.jpg?raw=true" width="200" />
194
+
195
+ # Changelog
196
+
197
+ ### 2.1.0
198
+
199
+ - Optimized for android-compileSdkVersion 32
200
+ - Minimum cordova-android version set to 11
201
+ - Replaced com.google.android.play:core with the standalone [Play In-App Updates Library](https://developer.android.com/reference/com/google/android/play/core/release-notes-in_app_updates "Play In-App Updates Library") 2.1.0
202
+ - Updated androidx.appcompat:appcompat to 1.5.1
203
+ - Updated com.google.android.material:material to 1.3.0
204
+ - Removed the `edit-config` rule that was setting `android:theme="@style/Theme.AppCompat.NoActionBar"`
205
+ - Tested on Android 5.1, 8.1, 10.
174
206
 
175
- # Reporting issues
207
+ ### 2.0.5
176
208
 
177
- Please report any issue with this plugin in GitHub by providing detailed context and sample code.
209
+ - Optimized for android-compileSdkVersion 30
210
+ - Updated androidx.appcompat:appcompat to 1.3.0
211
+ - Updated com.google.android.play:core to 1.8.0
212
+ - Updated com.google.android.material:material to 1.2.0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cordova-plugin-in-app-updates",
3
- "version": "2.0.5",
3
+ "version": "2.1.0",
4
4
  "description": "In-App updates from Play Store for your Apache Cordova app.",
5
5
  "cordova": {
6
6
  "id": "cordova-plugin-in-app-update",
@@ -11,13 +11,17 @@
11
11
  },
12
12
  "engines": {
13
13
  "cordovaDependencies": {
14
- "1.0.6": {
15
- "cordova": ">=9.0.0",
16
- "cordova-android": ">=8.0.0"
14
+ "2.1.0": {
15
+ "cordova": ">=10.0.0",
16
+ "cordova-android": ">=11.0.0"
17
17
  },
18
18
  "2.0.5": {
19
19
  "cordova": ">=10.0.0",
20
- "cordova-android": ">=9.0.0"
20
+ "cordova-android": ">=10.0.0"
21
+ },
22
+ "1.0.6": {
23
+ "cordova": ">=9.0.0",
24
+ "cordova-android": ">=8.0.0"
21
25
  }
22
26
  }
23
27
  },
package/plugin.xml CHANGED
@@ -1,5 +1,5 @@
1
1
  <?xml version='1.0' encoding='utf-8'?>
2
- <plugin id="cordova-plugin-in-app-updates" version="2.0.5" xmlns="http://apache.org/cordova/ns/plugins/1.0" xmlns:android="http://schemas.android.com/apk/res/android">
2
+ <plugin id="cordova-plugin-in-app-updates" version="2.1.0" xmlns="http://apache.org/cordova/ns/plugins/1.0" xmlns:android="http://schemas.android.com/apk/res/android">
3
3
  <name>InAppUpdate</name>
4
4
  <description>In-App updates from Play Store for your Apache Cordova app.</description>
5
5
  <license>MIT</license>
@@ -7,7 +7,7 @@
7
7
 
8
8
  <engines>
9
9
  <engine name="cordova" version=">=10.0.0" />
10
- <engine name="cordova-android" version=">=9.0.0" />
10
+ <engine name="cordova-android" version=">=11.0.0" />
11
11
  </engines>
12
12
 
13
13
  <js-module name="InAppUpdate" src="www/InAppUpdate.js">
@@ -19,13 +19,13 @@
19
19
  <preference name="AndroidXEnabled" value="true" />
20
20
  </config-file>
21
21
 
22
- <preference name="ANDROIDX_APPCOMPAT_VERSION" default="1.3.0" />
22
+ <preference name="ANDROIDX_APPCOMPAT_VERSION" default="1.5.1" />
23
23
  <framework src="androidx.appcompat:appcompat:$ANDROIDX_APPCOMPAT_VERSION" />
24
+
25
+ <preference name="ANDROID_PLAY_APP_UPDATE_VERSION" default="2.1.0" />
26
+ <framework src="com.google.android.play:app-update:$ANDROID_PLAY_APP_UPDATE_VERSION" />
24
27
 
25
- <preference name="ANDROID_PLAY_CORE_VERSION" default="1.8.0" />
26
- <framework src="com.google.android.play:core:$ANDROID_PLAY_CORE_VERSION" />
27
-
28
- <preference name="ANDROID_MATERIAL_VERSION" default="1.2.0" />
28
+ <preference name="ANDROID_MATERIAL_VERSION" default="1.3.0" />
29
29
  <framework src="com.google.android.material:material:$ANDROID_MATERIAL_VERSION" />
30
30
 
31
31
  <config-file target="res/xml/config.xml" parent="/*">
@@ -33,11 +33,7 @@
33
33
  <param name="android-package" value="com.andreszs.inappupdate.InAppUpdate" />
34
34
  </feature>
35
35
  </config-file>
36
-
37
- <edit-config file="AndroidManifest.xml" target="/manifest/application/activity[@android:name='MainActivity']" mode="merge">
38
- <activity android:name="MainActivity" android:theme="@style/Theme.AppCompat.NoActionBar" />
39
- </edit-config>
40
-
36
+
41
37
  <source-file src="src/android/InAppUpdate.java" target-dir="src/com/andreszs/inappupdate" />
42
38
  </platform>
43
39
 
@@ -19,7 +19,7 @@ import com.google.android.play.core.install.model.UpdateAvailability;
19
19
  import com.google.android.play.core.install.model.InstallStatus;
20
20
  import com.google.android.play.core.install.InstallState;
21
21
  import com.google.android.play.core.install.InstallStateUpdatedListener;
22
- import com.google.android.play.core.tasks.Task;
22
+ import com.google.android.gms.tasks.Task;
23
23
 
24
24
  import org.apache.cordova.CallbackContext;
25
25
  import org.apache.cordova.CordovaInterface;