// Path: app/src/main/java/pt/passarola/services/dagger/Daggerable.java
// public interface Daggerable {
//     void inject(Object object);
//     void inject(Object object, Object... modules);
// }
// 
// Path: app/src/main/java/pt/passarola/services/rest/RestApi.java
// @Singleton
// public class RestApi {
// 
//     public static boolean DEBUG = true;
//     private ApiServices apiServices;
// 
//     @Inject
//     public RestApi() {
//         RestAdapter restAdapter = build(Endpoints.baseUrl);
//         apiServices = restAdapter.create(ApiServices.class);
//     }
// 
//     public RestAdapter build(String baseUrl) {
//         RestAdapter adapter = new RestAdapter.Builder()
//                 .setEndpoint(baseUrl)
//                 .build();
// 
//         if (DEBUG) {
//             adapter.setLogLevel(RestAdapter.LogLevel.FULL);
//         }
// 
//         return adapter;
//     }
// 
//     public ApiServices getApiServices() {
//         return apiServices;
//     }
// }


import android.app.Application;
import android.content.Context;
import com.crashlytics.android.Crashlytics;
import io.fabric.sdk.android.Fabric;
import java.util.Arrays;
import java.util.List;
import dagger.ObjectGraph;
import pt.passarola.services.dagger.Daggerable;
import pt.passarola.services.rest.RestApi;
import timber.log.Timber;
package pt.passarola;





/**
 * Created by ruigoncalo on 22/10/15.
 */
public class App extends Application implements Daggerable {

    private ObjectGraph objectGraph;


    public static App obtain(Context context) {
        return (App) context.getApplicationContext();
    }

    @Override
    public void onCreate() {
        super.onCreate();
        Fabric.with(this, new Crashlytics());
        buildDebugOptions();
        buildObjectGraph();
    }

    @Override
    public void inject(Object object) {
        objectGraph.inject(object);
    }

    @Override
    public void inject(Object object, Object... modules) {
        objectGraph.plus(modules).inject(object);
    }

    private void buildObjectGraph() {
        objectGraph = ObjectGraph.create(getModules().toArray());
        objectGraph.inject(this);
    }

    private List<Object> getModules() {
        return Arrays.<Object>asList(new AppModule(this));
    }

    private void buildDebugOptions() {
        if (BuildConfig.DEBUG) {
// Path: app/src/main/java/pt/passarola/services/dagger/Daggerable.java
// public interface Daggerable {
//     void inject(Object object);
//     void inject(Object object, Object... modules);
// }
// 
// Path: app/src/main/java/pt/passarola/services/rest/RestApi.java
// @Singleton
// public class RestApi {
// 
//     public static boolean DEBUG = true;
//     private ApiServices apiServices;
// 
//     @Inject
//     public RestApi() {
//         RestAdapter restAdapter = build(Endpoints.baseUrl);
//         apiServices = restAdapter.create(ApiServices.class);
//     }
// 
//     public RestAdapter build(String baseUrl) {
//         RestAdapter adapter = new RestAdapter.Builder()
//                 .setEndpoint(baseUrl)
//                 .build();
// 
//         if (DEBUG) {
//             adapter.setLogLevel(RestAdapter.LogLevel.FULL);
//         }
// 
//         return adapter;
//     }
// 
//     public ApiServices getApiServices() {
//         return apiServices;
//     }
// }


// Path: app/src/main/java/pt/passarola/App.java
import android.app.Application;
import android.content.Context;
import com.crashlytics.android.Crashlytics;
import io.fabric.sdk.android.Fabric;
import java.util.Arrays;
import java.util.List;
import dagger.ObjectGraph;
import pt.passarola.services.dagger.Daggerable;
import pt.passarola.services.rest.RestApi;
import timber.log.Timber;

package pt.passarola;





/**
 * Created by ruigoncalo on 22/10/15.
 */
public class App extends Application implements Daggerable {

    private ObjectGraph objectGraph;


    public static App obtain(Context context) {
        return (App) context.getApplicationContext();
    }

    @Override
    public void onCreate() {
        super.onCreate();
        Fabric.with(this, new Crashlytics());
        buildDebugOptions();
        buildObjectGraph();
    }

    @Override
    public void inject(Object object) {
        objectGraph.inject(object);
    }

    @Override
    public void inject(Object object, Object... modules) {
        objectGraph.plus(modules).inject(object);
    }

    private void buildObjectGraph() {
        objectGraph = ObjectGraph.create(getModules().toArray());
        objectGraph.inject(this);
    }

    private List<Object> getModules() {
        return Arrays.<Object>asList(new AppModule(this));
    }

    private void buildDebugOptions() {
        if (BuildConfig.DEBUG) {
            RestApi.DEBUG = true;