-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1c51994
commit e444dd7
Showing
2 changed files
with
54 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,53 @@ | ||
# version-check-kotlin | ||
# Version Check | ||
|
||
A library for doing checking of supported versions for a network service | ||
|
||
Example basic usage: | ||
|
||
``` | ||
class App: Application() { | ||
override fun onCreate() { | ||
super.onCreate() | ||
setupVersionCheck() | ||
} | ||
private fun setupVersionCheck() { | ||
val versionChecker = VersionCheck( | ||
VersionCheckConfig( | ||
appVersionName = BuildConfig.VERSION_NAME, | ||
appVersionCode = BuildConfig.VERSION_CODE, | ||
url = "https://myservice.com/api/version" // <-- Change this URL | ||
) | ||
) | ||
// If you wish the VersionCheck to be automatically ran on the Application's OnStart | ||
// lifecycle call, add the following line: | ||
ProcessLifecycleOwner.get().lifecycle.addObserver(versionChecker) | ||
// If you wish to use the default alert dialog, add the following 2 lines: | ||
val upgradeDialog = DefaultUpgradeDialog(versionChecker.displayStateFlow) | ||
registerActivityLifecycleCallbacks(upgradeDialog) | ||
} | ||
} | ||
``` | ||
If you wish to handle the call and results manually, you will need to call `versionCheck.runVersionCheck()` and collect from the StateFlows `statusFlow` and `displayStateFlow`. | ||
|
||
Expected JSON format: | ||
``` | ||
{ | ||
"ios" : { | ||
"minimumVersion": "1.1", | ||
"blockedVersions": ["1.2.0", "1.2.1", "@301"], | ||
"latestTestVersion": "1.4.2@400" | ||
}, | ||
"android" : { | ||
"minimumVersion": "1.1", | ||
"blockedVersions": ["1.2.0", "1.2.1", "@301"], | ||
"latestTestVersion": "1.4.2@400" | ||
}, | ||
"serverForceVersionFailure": false, | ||
"serverMaintenance": false | ||
} | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters