Coder Social home page Coder Social logo

redux-android-sample's Introduction

redux-android-sample

Build Status

An Android sample that implements Redux architecture (using Fluxxan and Anvil) and NoSQL (using SnappyDB)

Architecture

Gif Sample Redux Architecture

#App State Example

{
    hasMoreGifs: true,
    gifs: [{
        path: "path",
        url: "url",
        title: "string",
        watched: false,
        status: PAUSED //PAUSED, LOOPING, DOWNLOADING, DOWNLOADED, NOT_DOWNLOADED, DOWNLOAD_FAILED
    }]
}

#Tests

###Integration tests

  • The integration tests are running on top of espresso framework, and using mockito to handle mocks.

To setup a CI or run tests in command line use this command:

adb shell am instrument -w br.com.catbag.gifreduxsample.test/android.support.test.runner.AndroidJUnitRunner

###Unit tests

  • The unit tests are running with roboeletric, that is a android test framework with builtin mock capabilities of android sdk. The roboeletric give us the power to run some unit tests with functions from android SDK without the requirement of an emulator running, what results in very fast tests.

To run unit tests through a CI or command line:

./gradlew  clean test --daemon --continue

Drone CI

Running drone build locally

  • Install drone CLI

      curl http://downloads.drone.io/drone-cli/drone_linux_amd64.tar.gz | tar zx
     sudo install -t /usr/local/bin drone
    
  • Run drone build inside project dir

      drone exec --trusted
    

CI last build reports

#Good Practices

###Actions Creators

  • Pay attention on action creation UI calls that do something async and dispatch action, the main action has to be dispatched before other async created actions, and its not a good practice dispatch two actions on the same synchronous cycle.

CODE INSPECT

How to use

  1. Run check task on Gradle Tasks -> verification

  2. After this attention on Android Studio Run console or on gradle output if you run on terminal.

  3. The reports are inside app/build/reports/tool_name folders. eg. flux-android-sample/app/build/reports/lint

  4. The inspect tools custom configurations are inside app/inspect/ folder.

  5. Problems found by inspect tools stops the check task.

References

Summary

Checkstyle

FindBugs

PMD

Android Lint

redux-android-sample's People

Contributors

catbag avatar fpbitencourt avatar niltonvasques avatar raulccabreu 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

Watchers

 avatar  avatar  avatar  avatar  avatar

redux-android-sample's Issues

Activate proguard on project because methods limit

Project + dependencies are passing the methods limit of dex

I think your dex file is reached to its maximum method count. Try to use multiDexEnabled true
in your deafault config or try to minmize your playservices from your dependencies. Use only required > packages. Try changing your version or exclude unwanted packages

Project stop to fetch gifs from net

We need a control flow inside DataManager to decide when to fetch gifs...or a direct action from user using a gesture or a button on activity

Some UI Tests are not sufiently robust to run conditions

This test for example:

    @Test
    public void whenGifIsDownloadingTest() {
        Gif gif = gifBuilder()
                .status(Gif.Status.DOWNLOADING)
                .build();

        dispatchFakeReduceAction(createStateFromGif(gif));

        /** On activity create the Fluxxan calls onStateChanged synchronously.
         * So isn't required to use idling resources or others wait conditions **/
        mActivityTestRule.launchActivity(new Intent());

        onView(withId(R.id.gif_loading)).check(matches(isDisplayed()));
    }

must be:

    @Test
    public void whenGifIsDownloadingTest() {
        Gif gif = gifBuilder()
                .status(Gif.Status.DOWNLOADING)
                .build();

        dispatchFakeReduceAction(createStateFromGif(gif));

        mActivityTestRule.launchActivity(new Intent());
        
        UiTestLocker locker = new UiTestLocker(getGifComponent(0));
        locker.registerIdlingResource();

        onView(withId(R.id.gif_loading)).check(matches(isDisplayed()));

        locker.unregisterIdlingResource();
    }

All other tests have to be fixed too, including this locker after mActivityTestRule.launchActivity(new Intent());

Espresso waits the activity launch to continue the tests...i make some tests with sleep here, but we have to investigate more...

Refactor retrofit used on FileDownloader

Extract RoutesGenerator from FileDownloader and make a singleton class that will be used by others. Only routes will stay inside FileDownloader and any Retrofit resource.

Pass AndroidSudio inspect tool and fix problems

Actually the automatized inspect tools process don't have all desirable rules because lack of configuration and update, so to solve for now a one pass on AndroidStudio inspect and soon resolve issue #72

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.