Giter VIP home page Giter VIP logo

android's Introduction

Build Setup

Java Prerequisites

  1. You should have Java SE 8u101 or a newer version of Java SE 8 installed. (Java SE 7u111 and newer versions of Java SE 7 may also work but have not been tested.) This is because older versions of Java do not trust Let's Encrypt which provides our SSL certificate.

  2. The JAVA_HOME environment variable must be set correctly. You can check what it is set to in most shells with echo $JAVA_HOME. If that command does not show anything, adding the following line to ~/.profile (assuming you are on macOS) and then executing source ~/.profile or opening a new shell should suffice:

# Replace NNN with your particular version of 1.8.0.
export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_NNN.jdk/Contents/Home
  1. You can verify that everything is set up correctly by inspecting the results of both java -version and javac -version.

Android Studio Prerequisites

The latest version of Android Studio is strongly recommended. Versions older than 2.3.3 have not been tested.

Nexus Setup

Our application currently needs packages that are only available from our Nexus server in order to build correctly. (This will be changed in the future when non-DRM-enabled variants of the app are officially supported.) Nexus credentials can be obtained by emailing [email protected] or by asking in the #simplified-android channel of librarysimplified.slack.com.

Once you have your credentials, the following lines must be added to ~/.gradle/gradle.properties:

# Replace USERNAME and PASSWORD appropriately.
# Do NOT use quotes around either value.
org.librarysimplified.nexus.username=USERNAME
org.librarysimplified.nexus.password=PASSWORD

Adobe Certificate Setup

The correct certificate file must be placed at simplified-app-simplye/src/main/assets/ReaderClientCert.sig in order for Adobe DRM to work. The app will function correctly without this file so long as only non-DRM-protected books are opened.

HelpStack Setup

NOTE: Care should always be taken to ensure HelpStack is functioning correctly after making any configuration changes. Configuration errors or a lack of configuration may result in errors that only appear at runtime.

If HelpStack is to be used, a configuration file must be placed at simplified-app-simplye/src/main/assets/helpstack.conf.

For Zendesk, you should use the following configuration:

helpstack.gear = zendesk
helpstack.zendesk.instance_url = ...
helpstack.zendesk.staff_email = ...
helpstack.zendesk.api_token = ...

For Salesforce Desk, use the following instead:

helpstack.gear = desk
helpstack.desk.instance_url = ...
helpstack.desk.to_help_email = ...
helpstack.desk.staff_login_email = ...
helpstack.desk.staff_login_password =  ...

Generating Signed APKs

If you wish to generate a signed APK for publishing the application, you will need to set the following values correctly in ~/.gradle/gradle.properties:

org.librarysimplified.simplye.keyAlias=
org.librarysimplified.simplye.keyPassword=
org.librarysimplified.simplye.storePassword=

In addition, you will need to obtain the correct Java keystore and either place it in the project at simplified-app-simplye/keystore.jks or create a symbolic link at the same location appropriately. All files matching *.jks are set to be ignored by Git, but care should always be taken to ensure keystores and other secrets are never committed regardless.

Once the above has been completed, executing ./gradlew assembleRelease will generate the signed APK and place it at ./simplified-app-simplye/build/outputs/apk/simplified-app-simplye-release.apk.

Branding And Configurable Features

See simplified-app-shared/README-Branding.md for documentation on how to customize branding of the application.

Building

NOTE: Due to an unknown issue, you must execute ./gradlew assembleDebug one time before opening the project in Android Studio. This will pull in all dependencies that, for whatever reason, are not fetched if Gradle is executed via Android Studio.

After setup is complete, the project can be opened in Android Studio and built as normal.

android's People

Contributors

aferditamuriqi avatar benanderman avatar datalogics-cgreen avatar datalogics-dans avatar datalogics-tarar avatar datalogics-tsmith avatar gioneill avatar io7m avatar mattniehoff avatar skullbonez avatar winniequinn avatar

Watchers

 avatar  avatar  avatar  avatar

android's Issues

Split `books-core` into separate packages

The org.nypl.simplified.books.core package is rather large. It would be better to split the core package into multiple subpackages to make it slightly easier to digest.

Bring unit tests back to life, modernize tests

Currently, many tests fail. Many tests aren't run as part of the build.

Additionally, the tests are structured such that the junit4 and android frontends for each set of tests both delegate to implementations that don't refer to junit at all. This used to be necessary because there was no way to write tests such that they could be executed both locally (for quick testing) and/or on a real device (for testing in an Android environment). This is no longer necessary: Android can now run JUnit 4 tests and the code required to support both can be essentially thrown away.

Handle failures to open the profiles database more gracefully

Right now, if an account/profile exists with an account provider that has been removed, any attempt to open the profiles database will result in an exception. This exception is propagated to the main thread and as such the app will crash.

I'm not exactly sure what would be a reasonable way to handle a failure here; not being able to open the profiles database is not something that the app can recover from, but at the same time, perhaps the above shouldn't be a fatal error. Removing an account provider is something that can only occur by modifying the app and recompiling it, so it's hardly urgent, but it is something that will need to be handled in future once the account providers come from a remote server.

Adobe credentials are a mess

The previously immutable AccountCredentials type has been transformed into a mutable type with six Option fields. Those fields have causal relationships between each other; when you have one of them, you must also have at least two more, but as they're encoded as a pile of unrelated optional fields, the type system can't tell you this and can't enforce that fact. This leads to a lot of unpleasant checks throughout the code, and it's unclear without a detailed study of the execution path of the program when some fields can be set and not others. I've managed to work out the relationships, so this type needs to be completely replaced with an immutable credentials type as part of the accounts/profiles update.

DRMLicensors overwritten in feeds

The current code scans OPDS feeds one entry at a time and ends up using whichever DRM licensor it encounters last. The code should instead be storing a list of the licensors it encounters: A silent assumption that all DRM licensors in a feed are the same licensor sounds like an incredibly nasty bug to track down when that assumption later turns out to be incorrect.

Publish book states instantly

Right now if a book operation (borrowing, for example) is in progress, clicking another book button in the UI will enqueue an operation but this won't be reflected in the UI right away. The reason for this is that state changes are published when the background task starts, and the task may not start for a while if another task is already in progress.

Easy fix: Publish book state changes to the registry immediately (such as setting the state of a book to "download requested") and then let the background tasks update those states when the tasks start running.

Replace all startActivity calls with a better API

Right now, all over the project, activities are starting new activities by calling startActivity on themselves. Need to replace all startActivity calls with a call to a method defined in the project so that we can be confident that activities are being started with the right flags (such as the flag that prevents the user going back to previous activities with the back button).

Set Demarque Logo

A logo is needed for the navigation drawer and for the account settings.

Upgrade simplified-books to understand multiple accounts and profiles

The current application abuses the books API by simply deleting and recreating the book controller every time an account changes. This has the side effect of leaking a couple of thread pools in the process.

The right way to do this from the start would have been to change the books API to make it understand the concept of multiple accounts and profiles.

This is the bulk of the work required to get the application to work with profiles. Need to document the way that data is currently stored on the device, the way that it will be stored with multiple accounts and profiles, and write a basic migration strategy to update the stores of existing users.

HTTP auth copy/paste

This same bit of code has been copied and pasted repeatedly throughout the codebase:

    final AccountAuthenticationCredentials credentials = this.getAccountCredentials();
    final AccountBarcode barcode = credentials.getBarcode();
    final AccountPIN pin = credentials.getPin();

    HTTPAuthType auth = HTTPAuthBasic.create(barcode.toString(), pin.toString());
    if (credentials.getOAuthToken().isSome()) {
      final HTTPOAuthToken token = ((Some<HTTPOAuthToken>) credentials.getOAuthToken()).get();
      if (token != null) {
        auth = HTTPAuthOAuth.create(token);
      }
    }

    return auth;

This needs to go in a method somewhere instead of being endlessly replicated.

Update unit tests for OPDS availability

Someone changed how OPDS availability is calculated and didn't bother to update any of the unit tests. Now, all of the OPDS availability-related unit tests fail and it's not clear if it's because the code is wrong, or because the OPDS entry specimens need to be changed to match what's actually served now.

Determine if the cardcreator is to survive

It has some dependencies on some code that needs to be removed and/or modified. The card creator appears to be disabled in the code currently, so if it's not going to be used, I'll delete it (that way I don't need to update it to accomodate the account changes).

Replace splash screen

The current splash screen needs replacing with one that leads to the profile selection screen (or straight to the catalog if the anonymous profile is enabled).

Remove last traces of account-specific branding

It no longer makes sense for different accounts to get different action bar and text colors. Any reference to mainColor from the account provider configuration should be audited and most likely removed.

Set LFA logo

A logo is needed for the app and the splash screen.

Make activity animations consistent

Some activities use the default animation, some use no animation. Most use no animation on creation but then use the default animation on closing.

Make this consistent!

Related to #16

Replace org.nypl.simplified.app.reader.ReaderBookmarks

The org.nypl.simplified.app.reader.ReaderBookmarks type uses Android's SharedPreferences to store bookmarks. This was fine for the old single-account no-profiles case, but bookmarks now need to be stored in a profile-specific persistent store.

Remove action bars from activities that shouldn't have them

Ripping out the existing account handling with regards to branding also removed the logic that picks an ActionBar or NoActionBar theme variant. Putting that back in is trivial, but the original sources need to be inspected to determine which activities had action bars and which didn't.

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.