// Path: app/src/main/java/com/example/offline/App.java
// public class App extends Application implements HasActivityInjector {
//     @Inject
//     DispatchingAndroidInjector<Activity> dispatchingAndroidInjector;
// 
//     @Override
//     public void onCreate() {
//         super.onCreate();
// 
//         if (BuildConfig.DEBUG) {
//             Timber.plant(new Timber.DebugTree());
//         }
// 
//         DaggerAppComponent
//                 .builder()
//                 .application(this)
//                 .build()
//                 .inject(this);
// 
//         JobManagerFactory.getJobManager(this);
//     }
// 
//     @Override
//     public AndroidInjector<Activity> activityInjector() {
//         return dispatchingAndroidInjector;
//     }
// }
// 
// Path: app/src/main/java/com/example/offline/data/CommentDao.java
// @Dao
// public interface CommentDao {
//     @Insert(onConflict = OnConflictStrategy.REPLACE)
//     long add(Comment comment);
// 
//     @Update
//     void update(Comment comment);
// 
//     @Delete
//     void delete(Comment comment);
// 
//     @Query("SELECT * FROM comment WHERE photo_id = :photoId ORDER BY timestamp DESC")
//     Flowable<List<Comment>> getComments(long photoId);
// }
// 
// Path: app/src/main/java/com/example/offline/data/CommentDatabase.java
// @Database(entities = {Comment.class}, version = 1, exportSchema = false)
// public abstract class CommentDatabase extends RoomDatabase {
//     private static CommentDatabase instance;
// 
//     public static synchronized CommentDatabase getInstance(Context context) {
//         if (instance == null) {
//             instance = Room
//                     .databaseBuilder(context.getApplicationContext(), CommentDatabase.class, ModelConstants.DB_NAME)
//                     .build();
//         }
//         return instance;
//     }
// 
//     public abstract CommentDao commentDao();
// }
// 
// Path: app/src/main/java/com/example/offline/data/LocalCommentDataStore.java
// public class LocalCommentDataStore implements LocalCommentRepository {
// 
//     private final CommentDao commentDao;
// 
//     public LocalCommentDataStore(CommentDao commentDao) {
//         this.commentDao = commentDao;
//     }
// 
//     /**
//      * Adds a comment to a given photo
//      */
//     public Single<Comment> add(long photoId, String commentText) {
//         Timber.d("creating comment for photo id %s, comment text %s", photoId, commentText);
//         Comment comment = new Comment(photoId, commentText);
// 
//         return Single.fromCallable(() -> {
//             long rowId = commentDao.add(comment);
//             Timber.d("comment stored " + rowId);
//             return CommentUtils.clone(comment, rowId);
//         });
//     }
// 
//     /**
//      * Updates a comment
//      */
//     public Completable update(Comment comment) {
//         Timber.d("updating comment sync status for comment id %s", comment.getId());
// 
//         return Completable.fromAction(() -> commentDao.update(comment));
//     }
// 
//     /**
//      * Deletes a comment
//      */
//     public Completable delete(Comment comment) {
//         Timber.d("deleting comment with id %s", comment.getId());
// 
//         return Completable.fromAction(() -> commentDao.delete(comment));
//     }
// 
//     /**
//      * Returns Flowable stream of comments for a given photo
//      */
//     public Flowable<List<Comment>> getComments(long photoId) {
//         Timber.d("getting comments for photo id %s", photoId);
//         return commentDao.getComments(photoId);
//     }
// }
// 
// Path: app/src/main/java/com/example/offline/data/RemoteCommentDataStore.java
// public class RemoteCommentDataStore implements RemoteCommentRepository {
// 
//     @Override
//     public Completable sync(Comment comment) {
//         return Completable.fromAction(() ->
//                 JobManagerFactory.getJobManager().addJobInBackground(new SyncCommentJob(comment)));
//     }
// }
// 
// Path: app/src/main/java/com/example/offline/domain/LocalCommentRepository.java
// public interface LocalCommentRepository {
//     Single<Comment> add(long photoId, String commentText);
//     Completable update(Comment comment);
//     Completable delete(Comment comment);
//     Flowable<List<Comment>> getComments(long photoId);
// }
// 
// Path: app/src/main/java/com/example/offline/domain/RemoteCommentRepository.java
// public interface RemoteCommentRepository {
//     Completable sync(Comment comment);
// }
// 
// Path: app/src/main/java/com/example/offline/domain/services/jobs/GcmJobService.java
// public class GcmJobService extends GcmJobSchedulerService {
//     @NonNull
//     @Override
//     protected JobManager getJobManager() {
//         return JobManagerFactory.getJobManager();
//     }
// }
// 
// Path: app/src/main/java/com/example/offline/domain/services/jobs/SchedulerJobService.java
// public class SchedulerJobService extends FrameworkJobSchedulerService {
// 
//     @NonNull
//     @Override
//     protected JobManager getJobManager() {
//         return JobManagerFactory.getJobManager();
//     }
// }


import android.content.Context;
import com.example.offline.App;
import com.example.offline.data.CommentDao;
import com.example.offline.data.CommentDatabase;
import com.example.offline.data.LocalCommentDataStore;
import com.example.offline.data.RemoteCommentDataStore;
import com.example.offline.domain.LocalCommentRepository;
import com.example.offline.domain.RemoteCommentRepository;
import com.example.offline.domain.services.jobs.GcmJobService;
import com.example.offline.domain.services.jobs.SchedulerJobService;
import javax.inject.Singleton;
import dagger.Module;
import dagger.Provides;
package com.example.offline.di;





/**
 * This is where you will inject application-wide dependencies.
 */
@Module
public class AppModule {

    @Provides
    Context provideContext(App application) {
        return application.getApplicationContext();
    }

    @Singleton
    @Provides
    SchedulerJobService provideSchedulerJobService() {
        return new SchedulerJobService();
    }

    @Singleton
    @Provides
// Path: app/src/main/java/com/example/offline/App.java
// public class App extends Application implements HasActivityInjector {
//     @Inject
//     DispatchingAndroidInjector<Activity> dispatchingAndroidInjector;
// 
//     @Override
//     public void onCreate() {
//         super.onCreate();
// 
//         if (BuildConfig.DEBUG) {
//             Timber.plant(new Timber.DebugTree());
//         }
// 
//         DaggerAppComponent
//                 .builder()
//                 .application(this)
//                 .build()
//                 .inject(this);
// 
//         JobManagerFactory.getJobManager(this);
//     }
// 
//     @Override
//     public AndroidInjector<Activity> activityInjector() {
//         return dispatchingAndroidInjector;
//     }
// }
// 
// Path: app/src/main/java/com/example/offline/data/CommentDao.java
// @Dao
// public interface CommentDao {
//     @Insert(onConflict = OnConflictStrategy.REPLACE)
//     long add(Comment comment);
// 
//     @Update
//     void update(Comment comment);
// 
//     @Delete
//     void delete(Comment comment);
// 
//     @Query("SELECT * FROM comment WHERE photo_id = :photoId ORDER BY timestamp DESC")
//     Flowable<List<Comment>> getComments(long photoId);
// }
// 
// Path: app/src/main/java/com/example/offline/data/CommentDatabase.java
// @Database(entities = {Comment.class}, version = 1, exportSchema = false)
// public abstract class CommentDatabase extends RoomDatabase {
//     private static CommentDatabase instance;
// 
//     public static synchronized CommentDatabase getInstance(Context context) {
//         if (instance == null) {
//             instance = Room
//                     .databaseBuilder(context.getApplicationContext(), CommentDatabase.class, ModelConstants.DB_NAME)
//                     .build();
//         }
//         return instance;
//     }
// 
//     public abstract CommentDao commentDao();
// }
// 
// Path: app/src/main/java/com/example/offline/data/LocalCommentDataStore.java
// public class LocalCommentDataStore implements LocalCommentRepository {
// 
//     private final CommentDao commentDao;
// 
//     public LocalCommentDataStore(CommentDao commentDao) {
//         this.commentDao = commentDao;
//     }
// 
//     /**
//      * Adds a comment to a given photo
//      */
//     public Single<Comment> add(long photoId, String commentText) {
//         Timber.d("creating comment for photo id %s, comment text %s", photoId, commentText);
//         Comment comment = new Comment(photoId, commentText);
// 
//         return Single.fromCallable(() -> {
//             long rowId = commentDao.add(comment);
//             Timber.d("comment stored " + rowId);
//             return CommentUtils.clone(comment, rowId);
//         });
//     }
// 
//     /**
//      * Updates a comment
//      */
//     public Completable update(Comment comment) {
//         Timber.d("updating comment sync status for comment id %s", comment.getId());
// 
//         return Completable.fromAction(() -> commentDao.update(comment));
//     }
// 
//     /**
//      * Deletes a comment
//      */
//     public Completable delete(Comment comment) {
//         Timber.d("deleting comment with id %s", comment.getId());
// 
//         return Completable.fromAction(() -> commentDao.delete(comment));
//     }
// 
//     /**
//      * Returns Flowable stream of comments for a given photo
//      */
//     public Flowable<List<Comment>> getComments(long photoId) {
//         Timber.d("getting comments for photo id %s", photoId);
//         return commentDao.getComments(photoId);
//     }
// }
// 
// Path: app/src/main/java/com/example/offline/data/RemoteCommentDataStore.java
// public class RemoteCommentDataStore implements RemoteCommentRepository {
// 
//     @Override
//     public Completable sync(Comment comment) {
//         return Completable.fromAction(() ->
//                 JobManagerFactory.getJobManager().addJobInBackground(new SyncCommentJob(comment)));
//     }
// }
// 
// Path: app/src/main/java/com/example/offline/domain/LocalCommentRepository.java
// public interface LocalCommentRepository {
//     Single<Comment> add(long photoId, String commentText);
//     Completable update(Comment comment);
//     Completable delete(Comment comment);
//     Flowable<List<Comment>> getComments(long photoId);
// }
// 
// Path: app/src/main/java/com/example/offline/domain/RemoteCommentRepository.java
// public interface RemoteCommentRepository {
//     Completable sync(Comment comment);
// }
// 
// Path: app/src/main/java/com/example/offline/domain/services/jobs/GcmJobService.java
// public class GcmJobService extends GcmJobSchedulerService {
//     @NonNull
//     @Override
//     protected JobManager getJobManager() {
//         return JobManagerFactory.getJobManager();
//     }
// }
// 
// Path: app/src/main/java/com/example/offline/domain/services/jobs/SchedulerJobService.java
// public class SchedulerJobService extends FrameworkJobSchedulerService {
// 
//     @NonNull
//     @Override
//     protected JobManager getJobManager() {
//         return JobManagerFactory.getJobManager();
//     }
// }


// Path: app/src/main/java/com/example/offline/di/AppModule.java
import android.content.Context;
import com.example.offline.App;
import com.example.offline.data.CommentDao;
import com.example.offline.data.CommentDatabase;
import com.example.offline.data.LocalCommentDataStore;
import com.example.offline.data.RemoteCommentDataStore;
import com.example.offline.domain.LocalCommentRepository;
import com.example.offline.domain.RemoteCommentRepository;
import com.example.offline.domain.services.jobs.GcmJobService;
import com.example.offline.domain.services.jobs.SchedulerJobService;
import javax.inject.Singleton;
import dagger.Module;
import dagger.Provides;

package com.example.offline.di;





/**
 * This is where you will inject application-wide dependencies.
 */
@Module
public class AppModule {

    @Provides
    Context provideContext(App application) {
        return application.getApplicationContext();
    }

    @Singleton
    @Provides
    SchedulerJobService provideSchedulerJobService() {
        return new SchedulerJobService();
    }

    @Singleton
    @Provides
    GcmJobService provideGcmJobService() {