Last active
May 31, 2017 08:39
-
-
Save kmmraj/31eeadb7d1f2c8b08ec10a8c6929b8c9 to your computer and use it in GitHub Desktop.
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
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