// Path: intent-factory/src/main/java/com/jakewharton/u2020/intentfactory/IntentFactory.java
// public interface IntentFactory {
//   Intent createUrlIntent(String url);
// 
//   IntentFactory REAL = url -> {
//     Intent intent = new Intent(Intent.ACTION_VIEW);
//     intent.setData(Uri.parse(url));
//     intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
// 
//     return intent;
//   };
// }


import android.app.Application;
import android.content.SharedPreferences;
import com.f2prateek.rx.preferences.Preference;
import com.f2prateek.rx.preferences.RxSharedPreferences;
import com.jakewharton.picasso.OkHttp3Downloader;
import com.jakewharton.u2020.data.api.ApiModule;
import com.jakewharton.u2020.data.api.oauth.AccessToken;
import com.jakewharton.u2020.intentfactory.IntentFactory;
import com.squareup.moshi.Moshi;
import com.squareup.picasso.Picasso;
import dagger.Module;
import dagger.Provides;
import java.io.File;
import javax.inject.Singleton;
import okhttp3.Cache;
import okhttp3.OkHttpClient;
import org.threeten.bp.Clock;
import timber.log.Timber;
import static android.content.Context.MODE_PRIVATE;
import static com.jakewharton.byteunits.DecimalByteUnit.MEGABYTES;
package com.jakewharton.u2020.data;



@Module(
    includes = ApiModule.class,
    complete = false,
    library = true
)
public final class DataModule {
  static final long DISK_CACHE_SIZE = MEGABYTES.toBytes(50);

  @Provides @Singleton SharedPreferences provideSharedPreferences(Application app) {
    return app.getSharedPreferences("u2020", MODE_PRIVATE);
  }

  @Provides @Singleton RxSharedPreferences provideRxSharedPreferences(SharedPreferences prefs) {
    return RxSharedPreferences.create(prefs);
  }

  @Provides @Singleton @AccessToken
  Preference<String> provideAccessToken(RxSharedPreferences prefs) {
    return prefs.getString("access-token");
  }

  @Provides @Singleton Moshi provideMoshi() {
    return new Moshi.Builder()
        .add(new InstantAdapter())
        .build();
  }

  @Provides @Singleton Clock provideClock() {
    return Clock.systemDefaultZone();
  }

// Path: intent-factory/src/main/java/com/jakewharton/u2020/intentfactory/IntentFactory.java
// public interface IntentFactory {
//   Intent createUrlIntent(String url);
// 
//   IntentFactory REAL = url -> {
//     Intent intent = new Intent(Intent.ACTION_VIEW);
//     intent.setData(Uri.parse(url));
//     intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
// 
//     return intent;
//   };
// }


// Path: app/src/main/java/com/jakewharton/u2020/data/DataModule.java
import android.app.Application;
import android.content.SharedPreferences;
import com.f2prateek.rx.preferences.Preference;
import com.f2prateek.rx.preferences.RxSharedPreferences;
import com.jakewharton.picasso.OkHttp3Downloader;
import com.jakewharton.u2020.data.api.ApiModule;
import com.jakewharton.u2020.data.api.oauth.AccessToken;
import com.jakewharton.u2020.intentfactory.IntentFactory;
import com.squareup.moshi.Moshi;
import com.squareup.picasso.Picasso;
import dagger.Module;
import dagger.Provides;
import java.io.File;
import javax.inject.Singleton;
import okhttp3.Cache;
import okhttp3.OkHttpClient;
import org.threeten.bp.Clock;
import timber.log.Timber;
import static android.content.Context.MODE_PRIVATE;
import static com.jakewharton.byteunits.DecimalByteUnit.MEGABYTES;

package com.jakewharton.u2020.data;



@Module(
    includes = ApiModule.class,
    complete = false,
    library = true
)
public final class DataModule {
  static final long DISK_CACHE_SIZE = MEGABYTES.toBytes(50);

  @Provides @Singleton SharedPreferences provideSharedPreferences(Application app) {
    return app.getSharedPreferences("u2020", MODE_PRIVATE);
  }

  @Provides @Singleton RxSharedPreferences provideRxSharedPreferences(SharedPreferences prefs) {
    return RxSharedPreferences.create(prefs);
  }

  @Provides @Singleton @AccessToken
  Preference<String> provideAccessToken(RxSharedPreferences prefs) {
    return prefs.getString("access-token");
  }

  @Provides @Singleton Moshi provideMoshi() {
    return new Moshi.Builder()
        .add(new InstantAdapter())
        .build();
  }

  @Provides @Singleton Clock provideClock() {
    return Clock.systemDefaultZone();
  }

  @Provides @Singleton IntentFactory provideIntentFactory() {