This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public Single<Pair<List<Restaurant>, Boolean>> getRestaurantList(int userId) { | |
Single<List<Restaurant>> restaurantListSingle = | |
ddApi.getUserInfo(userId).flatMap(user -> { | |
return ddApi.getAvailableRestaurant(user.defaultAddress.lat, user.defaultAddress.lng); | |
}); | |
Single<Boolean> showPhotoExperimentSingle = | |
ddApi.getShowPhotosExperiment(userId); | |
return restaurantListSingle.zipWith(showPhotoExperimentSingle, Pair::new); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public Single<List<Restaurant>> getRestaurants(int userId) { | |
return ddApi.getUserInfo(userId).flapMap(user -> { | |
return ddApi.getAvailableRestaurants(user.defaultAddress.lat, user.defaultAddress.lng); | |
}); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Fetch the current user's default address | |
*/ | |
public void getUserInfo(int userId) { | |
ddApi.getUserInfo(userId, new Callback<User>() { | |
@Override | |
public void onResponse(@NonNull Call<User> call, | |
@NonNull Response<User> response) { | |
if (response.isSuccessful() && response.body() != null) { | |
User user = response.body(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void getRestaurants(double lat, double lng) { | |
ddApi.getRestaurants(lat, lng, new Callback<List<Restaurant>>() { | |
@Override | |
public void onResponse(@NonNull Call<List<Restaurant>> call, | |
@NonNull Response<List<Restaurant>> response) { | |
if (response.isSuccessful() && response.body() != null) { | |
// update adapter with restaurants | |
} else { | |
// display the error message contained in response.errorBody() | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.dd.doordash; | |
import android.app.Activity; | |
import android.support.test.InstrumentationRegistry; | |
import android.support.test.espresso.IdlingResource; | |
import com.dd.doordash.activities.main.DashboardActivity; | |
public class LoginIdlingResource implements IdlingResource { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.doordash.mvpexample.data; | |
import android.support.annotation.NonNull; | |
import android.support.annotation.VisibleForTesting; | |
import com.doordash.mvpexample.api.AuthenticationApi; | |
import com.doordash.mvpexample.helpers.SharedPreferencesHelper; | |
import com.doordash.mvpexample.models.Token; | |
import javax.inject.Inject; |