Skip to content

Instantly share code, notes, and snippets.

@kmmraj
Last active May 31, 2017 08:39
Show Gist options
  • Save kmmraj/31eeadb7d1f2c8b08ec10a8c6929b8c9 to your computer and use it in GitHub Desktop.
Save kmmraj/31eeadb7d1f2c8b08ec10a8c6929b8c9 to your computer and use it in GitHub Desktop.
interface HomeInteractorInput {
public void fetchHomeMetaData(HomeRequest request);
}
public class HomeInteractor implements HomeInteractorInput{
public HomePresenterInput output;
public FlightWorkerInput flightWorkerInput;
public FlightWorkerInput getFlightWorkerInput() {
if (flightWorkerInput == null) return new FlightWorker();
return flightWorkerInput;
}
public void setFlightWorkerInput(FlightWorkerInput flightWorkerInput) {
this.flightWorkerInput = flightWorkerInput;
}
public static String TAG = HomeInteractor.class.getSimpleName();
@Override
public void fetchHomeMetaData(HomeRequest request) {
flightWorkerInput = getFlightWorkerInput();
HomeResponse homeResponse = new HomeResponse();
if(request.isFutureTrips == true) {
homeResponse.listOfFlights = flightWorkerInput.getFutureFlights();
} else {
homeResponse.listOfFlights = flightWorkerInput.getPastFlights();
}
//TODO : Add failure case here
Log.e(TAG,"In method fetchHomeMetaData");
output.presentHomeMetaData(homeResponse);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment