Giter Club home page Giter Club logo

dashnearby's Introduction

Dash Nearby

DEVELOPER: huhx0015

DASH NEARBY

dashnearby_preview

Description

Dash Nearby: An Android application that displays a list of DoorDash-affiliated restaurants nearby, using the DoorDash API. Dash Nearby was developed utilizing MVVM architecture, in conjunction with Databinding, Dagger 2, and Retrofit 2.

Please note that Instant Run must be disabled to run this project correctly, as this project utilizes the Sugar ORM library, which is known to have issues with Instant Run. For more details, check here: https://stackoverflow.com/questions/33031570/android-sugar-orm-no-such-table-exception

Resources

Libraries

dashnearby's People

Contributors

huhx0015 avatar

Stargazers

 avatar

Watchers

 avatar

Forkers

lovelyefyyucui

dashnearby's Issues

Enhancement: Implement Auth Token & Login Flow

A login screen that has input fields for a user's e-mail address and password would be nice to implement, as well as retrieving the auth token and storing it for later use for future sessions.

Endpoints:

Authentication

URL: POST to /v2/auth/token/
Body Params:
• "email" - email which you signed up with
• "password" - password

Response: Token which you will put in your authorization header. The format you should put in your Authorization header will be "JWT {Token}". For example, if the token returned is 'xyzls', you should have the following as your auth header: JWT xyzls

User details

URL: GET to /v2/consumer/me/

Response: JSON blurb of all the necessary metadata of an individual.

Token Refreshing

Additional Info: JWT token lasts about 6 hours and then it expires. You can refresh it with the following URL. Embedded within each JWT token, there is some metadata. You can read more at https://jwt.io/.

URL: POST to /v2/auth/token/refresh/
Body Params:
• "token" - current token you used for authorization

Response: New token that has been refreshed and has a new expiration date.

Enhancement: Implement offline user flow.

If the app loses network access, data caching strategies should be implemented, by persisting and utilizing the most recent restaurant list data, until network access is restored.

Bug: Restaurant List reload on returning to RestaurantListFragment when up arrow in RestaurantDetailsActivity is pressed.

When the up arrow in RestaurantDetailsActivity is pressed, the restaurant list is reloaded in RestaurantListFragment. This is probably due to the following line of code in onOptionsItemSelected():

NavUtils.navigateUpFromSameTask(this);

This bug is likely related to the activity task flow. See more here: https://developer.android.com/guide/components/activities/tasks-and-back-stack.html

Bug: Null pointer exception error when rotating the screen while restaurant list is loading.

The app crashes when a screen orientation change occurs while the restaurant list is still loading:

java.lang.NullPointerException: collection == null at java.util.ArrayList.<init>(ArrayList.java:94) at com.huhx0015.doordashchallenge.view.fragments.RestaurantListFragment.onSaveInstanceState(RestaurantListFragment.java:99) at android.support.v4.app.Fragment.performSaveInstanceState(Fragment.java:2356) at android.support.v4.app.FragmentManagerImpl.saveFragmentBasicState(FragmentManager.java:2607) at android.support.v4.app.FragmentManagerImpl.saveAllState(FragmentManager.java:2678) at android.support.v4.app.FragmentController.saveAllState(FragmentController.java:134) at android.support.v4.app.FragmentActivity.onSaveInstanceState(FragmentActivity.java:571) at android.support.v7.app.AppCompatActivity.onSaveInstanceState(AppCompatActivity.java:509) at com.huhx0015.doordashchallenge.view.activities.MainActivity.onSaveInstanceState(MainActivity.java:62) at android.app.Activity.performSaveInstanceState(Activity.java:1487) at android.app.Instrumentation.callActivityOnSaveInstanceState(Instrumentation.java:1318) at android.app.ActivityThread.callCallActivityOnSaveInstanceState(ActivityThread.java:5489) at android.app.ActivityThread.handleRelaunchActivity(ActivityThread.java:5440) at android.app.ActivityThread.access$1200(ActivityThread.java:229) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1827) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:148) at android.app.ActivityThread.main(ActivityThread.java:7331) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120) at de.robv.android.xposed.XposedBridge.main(XposedBridge.java:102)

This crash occurs in onSaveInstanceState() when attempting to add mRestaurantList to the Bundle outstate when it is null.

Enhancement: Implement dynamic list data loading for RestaurantListRecyclerView.

As the restaurant list data can be very large, it would probably be more efficient to dynamically update the restaurant list data as the user scrolls. We can use the existing v2/restaurant/ endpoint, in addition to the offset and limit parameters to get a specific number of restaurants, starting from the offset position.

Enhancement: Consider other database persistence libraries as an alternative to Sugar ORM.

While Sugar ORM is simple and easy to use for data persistence, it may be too basic when storing more complicated data in the future. Also, the current release of Sugar ORM is currently incompatible with Android Studio's Instant Run feature; a fix has been merged, but no word on when the next version of Sugar ORM will be released: chennaione/sugar#564

Other database persistence libraries like Realm, DBFlow, Room, GreenDAO, etc. should be considered as possible alternatives.

Reference: Performance Comparison of Database Libraries by Andrew Grozner: https://github.com/agrosner/AndroidDatabaseLibraryComparison2/tree/master/app/src/main/java/com/grosner/androiddatabaselibrarycomparison2

Enhancement: Add Location Awareness to application.

Instead of hard-coding test coordinates for the app, it would be nice to make the app location aware so that the restaurant list results loaded are appropriate to the user's actual location. Note that Android 6.0+ devices, location permissions must be requested before attempting to access location services.

Reference:
https://developer.android.com/training/location/index.html
https://guides.codepath.com/android/Retrieving-Location-with-LocationServices-API
https://developer.android.com/guide/topics/permissions/requesting.html

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.