Giter VIP home page Giter VIP logo

gandalf's People

Contributors

albinpoignot avatar btkelly avatar foobar2016 avatar friederbluemle avatar jsibbold avatar pierreduchemin avatar stkent 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

gandalf's Issues

Fix Travis build issue with javadoc generation

The build is failing when trying to generate the javadocs on Travis only. This seems to be related to how the aar's are store on Travis' build system.

Seems to be a few postings about this issue (http://stackoverflow.com/questions/26488015/class-file-for-android-support-v4-widget-drawerlayoutimpl-not-found-on-travis-su)

Stack Trace:
:gandalf:generateReleaseJavadoc/home/travis/build/btkelly/gandalf/gandalf/src/main/java/io/github/btkelly/gandalf/activities/GandalfActivity.java:33: error: cannot access DrawerLayoutImpl
public abstract class GandalfActivity extends AppCompatActivity implements GandalfCallback, BootstrapDialogUtil.BootstrapDialogListener {
^
class file for android.support.v4.widget.DrawerLayoutImpl not found
java.lang.NullPointerException

Create callback interface for VersionChecker

Create a callback interface to report version check results. Should include methods such as:

void onRequiredUpdate(RequiredUpdate requiredUpdate);
void onOptionalUpdate(OptionalUpdate optionalUpdate);
void onAlert(Alert alert);

This will be a main hook for the Builder in case consumers want to completely customize the responses to these situations.

Gandalf not working in Samsung 10

Anyone else having issues with a gandalf verifying if the app is coming from the play store? I have a message coming up the app isn't the real app and blocks the users from the next process. This is only occurring in Samsung 10 devices

Gradle Error: Cannot create variant 'android-lint' after configuration ':gandalf:debugRuntimeElements' has been resolved

Hello
i have android studio 3.1.3 and dependencies classpath 'com.android.tools.build:gradle:3.1.3' and am trying to run the code but im getting this error:
Cannot create variant 'android-lint' after configuration ':gandalf:debugRuntimeElements' has been resolved.

I've checked with old gradle version (4.1) and it worked.
Seems, the current gradle 4.4 is not supported by your build scripts

any idea, how to solve it?

gandalf error

Add dialog popup for events resulting from an update

Add a utility that can show dialogs based on forced update vs optional update and a listener interface for calling code to react to user events on the dialogs. This should be dumb and only show the information in a dialog.

Technology stack we talked about

We decided on the following tech stack to get us to version 1.0, any objections or things to add to this list?

  • OkHttp for networking
  • GSON for JSON parsing
  • SharedPrefs for storage
  • AppCompat for dialog display
  • Crashlytics if possible on a library project.

Auto install apk when using FileDownloadUpdateListener

Have you consider initiating the apk install after downloading an apk using the FileDownloadUpdateListener? I have seen a few apps do this in the past so I know it can be done. If you wouldn't want to do this in the library, I can understand that, but maybe we could look into giving a callback instead of finishing the activity in onUpdateSelected. Let me know your thoughts.

Add a debug mode to the installer

Add a debug mode to the install process to set a global debug flag for Gandalf. This flag should be used to allow Gandalf to be more error tolerant during release builds. When in debug mode Gandalf should loudly throw exceptions when things are unexpected to allow a developer to resolve the issue easily. When in release mode Gandalf should swallow all exceptions if possible and log them based on the LogLevel set during install. This will remove the possibility of an error in configuration causing the app to crash or block the user from using the app completely.

Add ability for consumer defined deserializer

Add the ability to override the default JSON deserializer allowing the case of a special JSON structure. This will require the consumer to convert this to our model but allows any JSON structure to be used.

This should also included an updated README section at the bottom informing the consumer of the ability to provide a custom deserializer and thus custom JSON.

Add to the example app

After we have a working library we should add to the included example app that will show a complete working example of the library. This should use a local file so it can be ran without a hosted one, maybe a file URI or a mock web service to intercept a network request. We will have to investigate.

Create a VersionChecker

Create a class to handle checking the Bootstrap object returned from the web call. This will need to assess in a priority order, prioritizing first the Required update, then Alert and Optional. Will report results to a callback interface #23

This class will also handle writing to SharedPreferences, and comparing the response with what is currently in SharedPreferences.

Asyncronous update checking

The GandalfActivity approach blocks the UI leading to a unwanted delay on startup.

Is there any example of how to use Gandalf e.g. with a background Service/IntentService?

Create Gandalf GitHub io page

Using the GitHub page generator create a page for Gandalf and fill it with documentation, licensing info, description, funny things...

Found DiskReadViolation when strict mode enabled

In my sample app's onCreate() method i am trying to get gandalf instance as follows:

this.gandalf = Gandalf.get()
this.gandalf.shallIPass(this) 

then i found the following disk read violation and it's happening more frequently whenever i am coming back to app either from background or from back-stack.

Please find the stack trace when we enable strict mode policy in our app as follows:

2019-11-01 14:44:54.701 17750-17750/com.sample.test.ui D/StrictMode: StrictMode policy violation; ~duration=119 ms: android.os.strictmode.DiskReadViolation
        at android.os.StrictMode$AndroidBlockGuardPolicy.onReadFromDisk(StrictMode.java:1504)
        at java.io.UnixFileSystem.checkAccess(UnixFileSystem.java:251)
        at java.io.File.exists(File.java:815)
        at android.app.ContextImpl.ensurePrivateDirExists(ContextImpl.java:605)
        at android.app.ContextImpl.ensurePrivateCacheDirExists(ContextImpl.java:601)
        at android.app.ContextImpl.getCacheDir(ContextImpl.java:694)
        at android.content.ContextWrapper.getCacheDir(ContextWrapper.java:269)
        at io.github.btkelly.gandalf.network.BootstrapApi.<init>(BootstrapApi.java:70)
        at io.github.btkelly.gandalf.Gandalf.shallIPass(Gandalf.java:140)
        at com.sample.test.ui.SplashActivity.onCreate(SplashActivity.kt:54)
        at android.app.Activity.performCreate(Activity.java:7136)
        at android.app.Activity.performCreate(Activity.java:7127)
        at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1271)
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2893)
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3048)
        at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:78)
        at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:108)
        at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:68)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1808)
        at android.os.Handler.dispatchMessage(Handler.java:106)
        at android.os.Looper.loop(Looper.java:193)
        at android.app.ActivityThread.main(ActivityThread.java:6669)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)

Application label causing manifest merger issues

Gradle is failing when trying to merge manifest files. I try to use the replace attribute as suggested but it does not work. Have you come across this at all? What is the purpose of the label being defined in your library's manifest? Comparing to other popular third-party android libraries, the label attribute is not usually defined in the library manifest.

Attribute application@label value=(ClinicalKey DEBUG) from AndroidManifest.xml:20:9-41
is also present at [com.btkelly:gandalf:1.3.0] AndroidManifest.xml:15:9-41 value=(@string/app_name).
Suggestion: add 'tools:replace="android:label"' to element at AndroidManifest.xml:15:5-19:11 to override.

Add abstract Gandalf activity

Add an activity that a consumer can extend to easily add Gandalf to their app. This should mark all start lifecycle callbacks as final so the consumer cannot override their behavior. An abstract function should be called when the application should continue launching. This would be called when there isn't an applicable update or after the user has opted to skip a dialog allowing the consumer to be completely unaware the check even happened.

We discussed using an abstract getContentViewId or the Google way of messing with the theme like they do on Google Maps, might want to look into both.

Update README for custom dialog content

The newly added DialogStringsHolder provides the ability to customize the strings used for titles and buttons which is awesome. Right now this isn't mentioned in the README, we should add a section above the "Custom JSON Deserializer" showing a quick example.

Add version checking logic

The library should be able to look at various forms of version strings or version codes and deduce which version is higher / lower. This will involve major and minor numbers, ex "1.2.1 vs 1.3.0" and "1.5 vs 2.1" as well as a version code that may be only an integer. The consumer should be able to configure what the library is evaluating, the version name or the version code.

StrictMode policy violation found when doing Gson mapping from onResponse() call

I have added the following strict mode policy checks in my application onCreate() method.

private fun setStrictMode() {
        StrictMode.setThreadPolicy(
            StrictMode.ThreadPolicy.Builder()
                .detectDiskReads()
                .detectDiskWrites()
                .detectAll()   // or .detectAll() for all detectable problems
                .penaltyLog()
                .build()
        )
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
        StrictMode.setVmPolicy(
             StrictMode.VmPolicy.Builder()
                 .detectNonSdkApiUsage()
                 .detectLeakedSqlLiteObjects()
                 .detectLeakedClosableObjects()
                 .penaltyLog()
                 .build()
         )
    }
}

and found NonSdkApiUsedViolation when trying to map the results from the BootstrapApi.onResponse() callback.

2019-11-01 16:18:42.856 19210-19276/com.sample.test.ui D/StrictMode: StrictMode policy violation: android.os.strictmode.NonSdkApiUsedViolation: Lsun/misc/Unsafe;->theUnsafe:Lsun/misc/Unsafe;
        at android.os.StrictMode.lambda$static$1(StrictMode.java:428)
        at android.os.-$$Lambda$StrictMode$lu9ekkHJ2HMz0jd3F8K8MnhenxQ.accept(Unknown Source:2)
        at java.lang.Class.getDeclaredField(Native Method)
        at com.google.gson.internal.UnsafeAllocator.create(UnsafeAllocator.java:41)
        at com.google.gson.internal.ConstructorConstructor$14.<init>(ConstructorConstructor.java:221)
        at com.google.gson.internal.ConstructorConstructor.newUnsafeAllocator(ConstructorConstructor.java:220)
        at com.google.gson.internal.ConstructorConstructor.get(ConstructorConstructor.java:96)
        at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.create(ReflectiveTypeAdapterFactory.java:101)
        at com.google.gson.Gson.getAdapter(Gson.java:458)
        at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.createBoundField(ReflectiveTypeAdapterFactory.java:117)
        at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.getBoundFields(ReflectiveTypeAdapterFactory.java:166)
        at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.create(ReflectiveTypeAdapterFactory.java:102)
        at com.google.gson.Gson.getAdapter(Gson.java:458)
        at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.createBoundField(ReflectiveTypeAdapterFactory.java:117)
        at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.getBoundFields(ReflectiveTypeAdapterFactory.java:166)
        at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.create(ReflectiveTypeAdapterFactory.java:102)
        at com.google.gson.Gson.getAdapter(Gson.java:458)
        at com.google.gson.Gson.fromJson(Gson.java:926)
        at com.google.gson.Gson.fromJson(Gson.java:892)
        at com.google.gson.Gson.fromJson(Gson.java:841)
        at com.google.gson.Gson.fromJson(Gson.java:813)
        at io.github.btkelly.gandalf.network.BootstrapApi$1.onResponse(BootstrapApi.java:118)
        at okhttp3.RealCall$AsyncCall.run(RealCall.kt:138)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
        at java.lang.Thread.run(Thread.java:764)

Major versions and minor versions not supported

Looking at the source, gandalf does an Integer compare of the version numbers. It would be nice if it could do major and minor version number comparisons as well, such that:

v3.2 > v3.1
v3.12 > v3.8
v3.12.3 > v3.12.06

Create Gandalf builder to configure library in the application class

Create a builder pattern that allows the consumer to configure Gandalf for their specific use case. This will for sure include setting the url to fetch the update file. Not sure what else is required for the first release, custom JSON deserializer for sure at a later time.

Thoughts on other configurable features for the first release?

Message display manager

A simple manager that will check / update values based on a bootstrap object (JSON from server) and determine if the app should display a dialog or not. This should also be notified when a user interacts with a dialog and update the corresponding data in shared prefs.

Values to be compared against past values:

  • Optional version with optional message
  • Alerta message

Proposed update/message JSON structure

{
    "android": {
        "alert": {
            "message": "We are currently performing server maintenance. Please try again later.",
            "blocking": true
        },
        "optionalUpdate": {
            "version": "3.9.0",
            "message": "A new version of the application is available, please click below to update to the latest version."
        },
        "requiredUpdate": {
            "version": "3.8.0",
            "message": "A new version of the application is available and is required to continue, please click below to update to the latest version."
        }
    }
}

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.