Giter Site home page Giter Site logo

infinum / android-prince-of-versions Goto Github PK

View Code? Open in Web Editor NEW
104.0 21.0 12.0 883 KB

Android library for handling application updates.

License: Apache License 2.0

Java 98.60% Kotlin 1.40%
android android-library android-development update version open-source

android-prince-of-versions's Introduction

Prince of Versions

Queen of Versions

Library checks update availability using In-App updates.

Getting via central

implementation 'co.infinum:queen-of-versions:0.3.2'

Features

  • Check update availability using In-App updates.
  • Integrate with Prince of Versions to determine required update.
  • Supports automatic and manual update type resolution.
  • Provides functionality to cancel check once started.

Prince of Versions

Library checks for updates using configuration from remote or local resource.

Getting via central

implementation 'co.infinum:prince-of-versions:4.0.4'

Features

  • Load update configuration from network resource or from generic stream resource.
  • Accepts custom loader for loading update configuration resource.
  • Use predefined parser for parsing update configuration in JSON format.
  • Accept custom parser for parsing update configuration.
  • Make asynchronous update check and use callback for notifying result.
  • Supports synchronous update check.
  • Loading and verifying versions happens outside of the UI thread.
  • Use thread pool to cap concurrent resource usage.
  • Provides functionality to cancel verification once started.

Contributing

Feedback and code contributions are very much welcome. Just make a pull request with a short description of your changes. By making contributions to this project you give permission for your code to be used under the same license.

License

Copyright 2021 Infinum

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

Credits

Maintained and sponsored by Infinum.

android-prince-of-versions's People

Contributors

antunflas avatar ikocijan avatar ilovrencic avatar jmarkovic avatar jonatanplesko avatar mladenrakonjac avatar nikopelicaric avatar pejna avatar reisub avatar sgruicic avatar skliba avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

android-prince-of-versions's Issues

Discrepancy in comment

In example app:
/* create new instance of updater associated with application context */.
The next line is:
updater = new PrinceOfVersions(this);, providing the current Activity context.

Enum or MagicConstant for NotificationType

Please, create a type (enum) or a magic constant which lists all available notification types, even if there are only two.

This will make it much more organized and easier for future development. Please, look into the code where this can be applicable.

Additional notes: this should be publicly available to the user of this library.

Add min_sdk section to README

Please add a section which describes what are min_sdk and minimum_version_min_sdk fields used for and how they work. Basically, what you explained in #61
Thanks!

Do not notify about an update if the version is equal to optional

A comment from @antunflas :

We have to check if version.isCurrentLessThanOptional() is true, we don't want to notify user about update if he already has equal version to optional.

Probably optional version less than minimum is not valid use case, but it would be better if we don't assume anything about config file maintained by client.

Debug logging

We should add some logging to the library, as it's extremely hard to debug it when we have some problems.

I suggest that we add LogUtils like in Goldfinger and log at least:

  • the response from the URL
  • how is this response parsed and processed in the lib, especially when we receive ONCE event - we'll we notify the callback listener or not.

Debugging should be enabled/disabled with a global configuration class.

Cert pinning

On some projects there is a need to pin the cert due to security reasons.
It would be nice feature to expose methods for cert pinning.

Test optional update after mandatory

The test should test the following scenario.

  1. I have version 1.0.0 installed
  2. In the meantime, 2 new versions are published: 1.1.0 (mandatory) and 1.1.1 (optional)
  3. The set minimum_version is then 1.1.0, and the update to 1.1.1 from 1.0.0 should be mandatory

Play Core 1.7.3

We need to test the library with 1.7.3 Play Core and update it

Optional update not triggered

I think that bug is line 51 of PovInteractorImpl.java file because that is way optional update is not triggered.

I had my versions like:

  • version: 2.0.0
  • min version: 1.0.1
  • SDK: 26
  • min SDK: 19

Versions on phone:

  • version: 1.2.1
  • SDK: 23

Either getNewMinSdk() method should return minimum required min SDK or last condition should be removed. In my case version on phone was lower than newest version (2.0.0 > 1.2.1) but newMinSdk was not smaller or equal to sdk on phone (26 <= 23 is false).

I solved my issue with using 2.0.3 version. Now it works as expected.

Is there an option to force user to update?

Thanks for making this library available in both platforms, can't wait to try it out! I didn't see any option to force update an app, is there a way to achieve this in both platforms?

here is my use case:

  • Version 1.0 has a security issue
  • Version 1.1 has a fix the security issue
  • We would like all users to stop using Version 1.0 and force update them to Version 1.1 when they next use the app.

Missing copyright statement

I don't see a copyright statement (Copyright (c) ) in either the README file or the LICENSE file (also, that file is spelled LICENCE - is that intentional)? This is needed to give proper attributions for OSS usage.

Custom version comparator

It would be a good idea to provide the client with a possibility to write it's own version comparator, I.E. if we would like to mark the version 1.0.0-b123 as up-to-date if PoV configuration file returns that the latest mandatory version is 1.0.0.

Add synchronous method for update check and pass Throwable in onError

As we'd like to add method for synchronous update check, we need to do some refactoring:

  1. currently we have VersionVerifier class which contains all logic for update check. That class also contains logic on which thread is executed that check. I suggest we should split those two things for easier modifications. We'd still have VersionVerifier class, but it will contain only update check logic.
  2. as we want to add 2nd method with only different thread, I think it would be better if all update logic (VersionVerifier and interactor) is executed synchronously on one thread. We would move threading then to presenter class.
  3. there should still be option to inject the thread so we probably want some type of ThreadRunner on which we will run the job.
  4. I'm not sure how clean is to have that runner injected in constructor as it currently is (by injecting VersionVerifier) because if we have synchronous method that explicitly use own thread maybe it makes more sense to move that thread definition to asynchronous method.
  5. Error handling isn't the best right now, probably it would make much more sense to pass Throwable into onError callback than int code of error as it is right now.

@reisub @ikocijan @kjurkovic @jmarkovic @Aksi0m what do you think about it?

Error while trying to read the json

Hello!
I'm having trouble with trying to read the json. I just copypasted the README code and part of the CommonUsageExample just to see if I can get a Log of the returning info but I always get this error.
Unexpected character 'DOT(.)' at position '5', expecting '[HYPHEN, PLUS, EOI]'

The JSON I'm using is the same as in the examples as well, since I'm just trying to make it work first.

Prince-of-Versions: 3.0.0

I hope someone can guide me.

Thanks

Checking for updates even if one of versions is invalid

Currently if you set invalid version for either mandatory or optional version then checking for updates notifies that version is not valid so updater cannot check if there is update or not. But looks like it could be a bit smarter. Sometimes isn't really important to have both valid versions, even one valid version can be enough to notify an update if it exists.

Here are examples (application version is 2.0.0):

  1. mandatory update is 3.0.0, while optional update is 3.1 - currently this results as an error because we have optional update that is present, but invalid. However, we'd probably want to get mandatory update notification here.
  2. optional update is 3.1.0, while mandatory update is 3.0 - this also results as an error, but we can do better. Application has optional update in this case, that's why we can notify it. We don't know anything about mandatory update in this case, but notifying optional update instead of mandatory is still better than notifying only error (ie. notifying nothing).

Of course, if both versions are invalid then we cannot check anything - notifying error is only solution in that case.

Failed to resolve: co

in build.gradle app

  • compileSdkVersion 27
  • minSdkVersion 15

dependencies {
...
implementation 'co.infinum:prince-of-versions:latest_version'
...
}
Failed to resolve: co

Unexpected character 'EOI(null)' at position '3', expecting '[DOT]

Below is the json i'm passing. Same thing happening locally
{ "ios": { "minimum_version": "1.2.3", "latest_version": { "version": "2.4.5", "notification_type": "ALWAYS" } }, "android": { "minimum_version": "1.2.3", "latest_version": { "version": "2.4.5", "notification_type": "ONCE" } } }

Wrong error code for malformed JSON

If by some mistake we receive malformed JSON (let say we've received HTML page :) ), PoV returns WRONG_VERSION error, which is not correct.

We should get something like MALFORMED_JSON error.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.