cordova-plugin-in-app-updates 2.0.5 → 2.2.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,25 @@ 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
+ | 2.2.0 | 10.0.0 | 12.0.0 | Yes | 33 |
30
31
 
31
- ## Install latest version
32
+ ### Install latest version from NPM
32
33
 
33
34
  ```bash
34
35
  cordova plugin add cordova-plugin-in-app-updates
35
36
  ```
36
37
 
37
- ## Install version 1.x
38
+ ### Install latest version from master
38
39
 
39
40
  ```bash
40
- cordova plugin add cordova-plugin-in-app-updates@1.0.6
41
+ cordova plugin add https://github.com/andreszs/cordova-plugin-in-app-updates
41
42
  ```
42
43
 
43
44
  # Methods
@@ -46,6 +47,10 @@ Cordova Android plugin for checking for updates and auto updating app with Googl
46
47
 
47
48
  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
49
 
50
+ ```javascript
51
+ cordova.plugins.InAppUpdate.getUpdateAvailability(successCallback, errorCallback)
52
+ ```
53
+
49
54
  ### Return values
50
55
 
51
56
  - **UPDATE_AVAILABLE**
@@ -73,6 +78,10 @@ cordova.plugins.InAppUpdate.getUpdateAvailability(onSuccess, onFailure);
73
78
 
74
79
  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
80
 
81
+ ```javascript
82
+ cordova.plugins.InAppUpdate.updateFlexible(successCallback, errorCallback)
83
+ ```
84
+
76
85
  :warning: The **successCallback** from this method can be triggered repeatedly according to its status.
77
86
 
78
87
  ### Return values
@@ -107,6 +116,10 @@ cordova.plugins.InAppUpdate.updateFlexible(onSuccess, onFailure);
107
116
 
108
117
  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
118
 
119
+ ```javascript
120
+ cordova.plugins.InAppUpdate.updateImmediate(successCallback, errorCallback)
121
+ ```
122
+
110
123
  :warning: The **successCallback** from this method can be triggered repeatedly according to its status.
111
124
 
112
125
  ### Return values
@@ -138,7 +151,9 @@ cordova.plugins.InAppUpdate.updateImmediate(onSuccess, onFailure);
138
151
 
139
152
  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
153
 
141
- If not called, default messages in English will be shown.
154
+ ```javascript
155
+ cordova.plugins.InAppUpdate.setSnackbarOptions(successCallback, errorCallback, snackbarText, snackbarButton, snackbarButtonColor)
156
+ ```
142
157
 
143
158
  :information_source: Browser platform does nothing and always returns **SUCCESS**
144
159
 
@@ -157,7 +172,9 @@ var snackbarButtonColor = "#76FF03";
157
172
  cordova.plugins.InAppUpdate.setSnackbarOptions(onSuccess, onFailure, snackbarText, snackbarButton, snackbarButtonColor);
158
173
  ```
159
174
 
160
- ### Default messages when not called
175
+ ### Snackbar default values
176
+
177
+ If this method is not called, default messages in English will be shown as follows.
161
178
 
162
179
  - **snackbarText** = "An update has just been downloaded."
163
180
  - **snackbarButton** = "RESTART"
@@ -170,8 +187,34 @@ cordova.plugins.InAppUpdate.setSnackbarOptions(onSuccess, onFailure, snackbarTex
170
187
 
171
188
  # Plugin demo app
172
189
 
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.
190
+ - [Compiled APK and reference](https://www.andreszsogon.com/cordova-in-app-update-plugin-demo-app/) including testing procedure instructions
191
+ - [Latest demo app version in Play Store](https://play.google.com/store/apps/details?id=com.andreszs.inappupdate.demo)
192
+ - [Source code for www folder](https://github.com/andreszs/cordova-plugin-demos)
193
+
194
+ <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" />
195
+
196
+ # Changelog
197
+
198
+ ### 2.2.0
199
+
200
+ - Optimized for android-compileSdkVersion 33
201
+ - Minimum cordova-android version set to 12
202
+ - Updated androidx.appcompat:appcompat to 1.6.1
203
+ - Updated com.google.android.material:material to 1.8.0
204
+
205
+ ### 2.1.0
206
+
207
+ - Optimized for android-compileSdkVersion 32
208
+ - Minimum cordova-android version set to 11
209
+ - 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
210
+ - Updated androidx.appcompat:appcompat to 1.5.1
211
+ - Updated com.google.android.material:material to 1.3.0
212
+ - Removed the `edit-config` rule that was setting `android:theme="@style/Theme.AppCompat.NoActionBar"`
213
+ - Tested on Android 5.1, 8.1, 10.
174
214
 
175
- # Reporting issues
215
+ ### 2.0.5
176
216
 
177
- Please report any issue with this plugin in GitHub by providing detailed context and sample code.
217
+ - Optimized for android-compileSdkVersion 30
218
+ - Updated androidx.appcompat:appcompat to 1.3.0
219
+ - Updated com.google.android.play:core to 1.8.0
220
+ - 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.2.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,21 @@
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.2.0": {
15
+ "cordova": ">=10.0.0",
16
+ "cordova-android": ">=12.0.0"
17
+ },
18
+ "2.1.0": {
19
+ "cordova": ">=10.0.0",
20
+ "cordova-android": ">=11.0.0"
17
21
  },
18
22
  "2.0.5": {
19
23
  "cordova": ">=10.0.0",
20
- "cordova-android": ">=9.0.0"
24
+ "cordova-android": ">=10.0.0"
25
+ },
26
+ "1.0.6": {
27
+ "cordova": ">=9.0.0",
28
+ "cordova-android": ">=8.0.0"
21
29
  }
22
30
  }
23
31
  },
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.2.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=">=12.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.6.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.8.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;