Skip to content

Commit

Permalink
Implemented blocking update support
Browse files Browse the repository at this point in the history
Also replaced AsyncTask with ContentLoader
  • Loading branch information
revanmj committed Nov 2, 2018
1 parent 74cc122 commit a071786
Show file tree
Hide file tree
Showing 5 changed files with 199 additions and 88 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,12 @@ Things changed/added by this fork:
`versionManager.installAfterDownload(true);`
- Add option to force update check (by ignoring remind timer): `versionManager.checkVersion(true);`
- Instead of setting strings (like button labels) by code, let them be overridden by adding them to app's strings.xml file (list of all string ids from this library can be [seen here](https://github.com/revanmj/Android-WVersionManager/blob/master/library/wversionmanager/src/main/res/values/strings.xml))
- Implemented concept of a "blocking update" - after adding `is_blocking` field set to true in your JSON file, default update dialog will only show **Update** button (it also won't be cancelable). You also will be able to check this value by calling `versionManager.isBlockingUpdate();` after update check or using `onReceive(int status, boolean isBlocking, String result)` method from `com.winsontan520.wversionmanager.OnReceiveListener`. This will be also saved to SharedPreferences, so it will survive app restart.

Compiled .jar file can be downloaded from [releases tab](https://github.com/revanmj/Android-WVersionManager/releases) or added in build.gradle from jcenter repo:
```
dependencies {
implementation 'com.winsontan520.wversionmanager:wversionmanager:1.6.1'
implementation 'com.winsontan520.wversionmanager:wversionmanager:1.7'
}
```

Expand Down
4 changes: 2 additions & 2 deletions library/wversionmanager/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ ext {
siteUrl = 'https://github.com/revanmj/Android-WVersionManager'
gitUrl = 'https://github.com/revanmj/Android-WVersionManager.git'

libraryVersion = "1.6.1"
libraryVersion = "1.7"

developerId = 'revanmj'
developerName = 'Michal Jakubowski'
Expand All @@ -32,7 +32,7 @@ android {
defaultConfig {
minSdkVersion 14
targetSdkVersion 27
versionCode 7
versionCode 8
versionName "$libraryVersion"
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,22 @@ public interface IWVersionManager {
*/
public int getIgnoreVersionCode();

/**
* @return whenever last received update data was telling that its blocking (app won't
* function properly without it for long, for example due to server side changes).
*/
public boolean isBlockingUpdate();

/**
* @return value telling if update dialog will be cancelable or not
*/
public boolean isDialogCancelable();

/**
* @param dialogCancelable sets if update dialog should be cancelable or not
*/
public void setDialogCancelable(boolean dialogCancelable);

/**
* @return CustomTagHandler object
*/
Expand All @@ -124,7 +140,8 @@ public interface IWVersionManager {
public void setCustomTagHandler(CustomTagHandler customTagHandler);

/**
* @param listener Set your own callback listener when receiving response from server
* @param listener Set your own callback listener when receiving response from server.
* Must implement {@link OnReceiveListener} interface.
*/
public void setOnReceiveListener(OnReceiveListener listener);
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,12 @@
public interface OnReceiveListener {

/**
* Listener called once HTTP GET request for json file with update data is processed.
*
* @param status response code from HTTP request
* @param isBlocking whenever update is blocking
* @param result response data from HTTP request
* @return return true to show default library dialog
* @return return true to show default library dialog, false otherwise
*/
boolean onReceive(int status, String result);
boolean onReceive(int status, boolean isBlocking, String result);
}
Loading

0 comments on commit a071786

Please sign in to comment.