use of com.mindorks.framework.mvp.data.db.model.Question in project android-mvp-architecture by MindorksOpenSource.
the class AppDataManager method seedDatabaseQuestions.
@Override
public Observable<Boolean> seedDatabaseQuestions() {
GsonBuilder builder = new GsonBuilder().excludeFieldsWithoutExposeAnnotation();
final Gson gson = builder.create();
return mDbHelper.isQuestionEmpty().concatMap(new Function<Boolean, ObservableSource<? extends Boolean>>() {
@Override
public ObservableSource<? extends Boolean> apply(Boolean isEmpty) throws Exception {
if (isEmpty) {
Type type = $Gson$Types.newParameterizedTypeWithOwner(null, List.class, Question.class);
List<Question> questionList = gson.fromJson(CommonUtils.loadJSONFromAsset(mContext, AppConstants.SEED_DATABASE_QUESTIONS), type);
return saveQuestionList(questionList);
}
return Observable.just(false);
}
});
}
Aggregations