blockchain-certificates / wallet-android

An Android app for Blockcerts
MIT License
38 stars 47 forks source link

learning-machine-android

Build Status

Blockcerts Android application by Learning Machine

Build variants

Gradle allows us to define different product variants. Each has a separate app id and can be installed simultaneously. Currently they all use the Bitcoin main net and do not differ all that much. Production has an empty logging tree.

Running Tests

sh scripts/run_tests.sh

At the time of writing it seems Robolectric is not compatible with JDK > 13 (https://github.com/robolectric/robolectric/issues/5863)

Building APKs

sh scripts/GenerateReleaseBuild.command Answer the prompts as they come. Blockcerts team members: password is stored in regular password manager.

Glossary

Conventions

The following are guidelines for this Android project.

Classes

public class TemplateFragment {

    private static final String ARG_CONSTANT = "TemplateFragment.Constant";

    private List<Object> mObjects;

    /* static methods */

    public static TemplateFragment newInstance() {
        return new TemplateFragment();
    }

    /* lifecycle overrides, onSavedInstanceState, options menu, onActivityResult */

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        mObjects = new ArrayList<Object>();
    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup parent, Bundle savedInstanceState) {
        // databinding & init
        initView();
    }

    /* private methods */

    private void initView() {}

    private void setupData() {}

    /* getters, setters, and other public methods */

    public List<Object> getObjects() {
        return mObjects;
    }

    public void setObjects(List<Objects> objects) {
        mObjects = objects;
    }

    /* enums */

    protected enum ObjectItemType {
        ITEM_TYPE_A,
        ITEM_TYPE_B,
    }

    /* inner classes */

    private class TemplateListAdapter extends ArrayAdapter<ObjectItemType> {

        public EnergyListAdapter(List<ObjectItemType> items) {
            super(getActivity(), 0, items);
        }
    }

    /* base class overrides */

    @Override
    protected boolean usesInjection() {
        return true;
    }
}

We suggest the following method orgainization:

  1. newInstance and other static methods

Layout files

strings.xml

Managers

Stores

Interfaces / Callbacks

Blockcerts Libraries

Cert-verifier-js

Updating cert-verifier-js to a new version

Pull down the cvjs repository:

https://github.com/blockchain-certificates/cert-verifier-js.git && cd cert-verifier-js

CVJS requires an npm token, so create one on npm

export NPM_TOKEN={insert token here}

Install

npm install

Generate build

npm run-script build

Copy content of /dist/verifier-iife.js

Paste in this android project at this location: wallet-android/LearningMachine/app/src/main/assets/www/verifier.js

External Libraries

Autolinker.js

BitcoinJ

SLF4J

Spongy Castle

Protobuf

Dagger 2

Timber

JodaTime Android

Retrofit

Okhttp

Gson

RxJava

RxLifecycle

RxLint

Picasso

Guava

JUnit

Mockito

Robolectric

JodaTime

Contact

Contact us at the Blockcerts community forum.