Skip to content

Commit

Permalink
Issue #16 feat : Updated Genie-Core.
Browse files Browse the repository at this point in the history
  • Loading branch information
RandhirGupta committed May 2, 2018
1 parent 9258aea commit 1f8349a
Show file tree
Hide file tree
Showing 18 changed files with 216 additions and 47 deletions.
6 changes: 3 additions & 3 deletions dependencies.gradle
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
ext {
genieSdkVersion = '1.0.617'
genieCanvasVersion = '2.9.1.350'
genieSdkVersion = '1.0.629'
genieCanvasVersion = '3.1.402'
supportLibraryVersion = '23.4.0'
playServicesVersion = '9.4.0'
multidexVersion = '1.0.1'
xWalkVersion = '22+'
okhttpVersion = '3.8.1'
okhttpVersion = '3.9.1'
espressoVersion = '3.0.0'
carshlyticsVersion = '2.6.8'
stethoVersion = '1.5.0'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
*/
@Retention(RetentionPolicy.SOURCE)
@StringDef({ContentType.STORY, ContentType.WORKSHEET, ContentType.GAME, ContentType.COLLECTION,
ContentType.TEXTBOOK, ContentType.TEXTBOOK, ContentType.COURSE, ContentType.LESSIONPLAN})
ContentType.TEXTBOOK, ContentType.TEXTBOOK, ContentType.COURSE, ContentType.LESSIONPLAN, ContentType.RESOURCE})
public @interface ContentType {

String STORY = "Story";
Expand All @@ -21,4 +21,5 @@
String TEXTBOOKUNIT = "TextbookUnit";
String COURSE = "Course";
String LESSIONPLAN = "LessonPlan";
String RESOURCE = "Resource";
}
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ public void onMediumClick(View view) {
@Override
public void onMediumItemClick(int position) {
mSelectedMedium = mMediumList.get(position);
mProfile.setMedium(ConfigUtil.getRelevantMasterData(mMediumList, mSelectedMedium));
mProfile.setMedium(new String[]{ConfigUtil.getRelevantMasterData(mMediumList, mSelectedMedium)});
mMediumBoardView.showMedium(mMediumList.get(position));
setMediumMarked();
}
Expand All @@ -99,7 +99,7 @@ public void onBoardClick(View view) {
@Override
public void onBoardItemClick(int position) {
mSelectedBoard = mBoardList.get(position);
mProfile.setBoard(ConfigUtil.getRelevantMasterData(mBoardList, mSelectedBoard));
mProfile.setBoard(new String[]{ConfigUtil.getRelevantMasterData(mBoardList, mSelectedBoard)});
mMediumBoardView.showBoard(mBoardList.get(position));
setBoardMarked();
}
Expand Down Expand Up @@ -147,9 +147,13 @@ public void populateMediumnBoard() {
if (mIsEditMode || mProfile != null) {
if (mProfile.getBoard() != null) {
if (mBoardList.size() > 0) {
String boardLabel = ConfigUtil.getRelevantMasterData(mBoardList, mProfile.getBoard());
mMediumBoardView.showBoard(boardLabel);
setBoardMarked();
String[] board = mProfile.getBoard();
if (board != null) {
String boardLabel = ConfigUtil.getRelevantMasterData(mBoardList, board[0]);
mMediumBoardView.showBoard(boardLabel);
setBoardMarked();
}

}
}
}
Expand All @@ -174,13 +178,17 @@ public void populateMediumnBoard() {
if (mIsEditMode || mProfile != null) {

if (mProfile.getMedium() != null) {
String label = ConfigUtil.getRelevantMasterData(mMediumList, mProfile.getMedium());
mMediumBoardView.showMedium(label);
setMediumMarked();
String[] medium = mProfile.getMedium();
if (medium != null) {
String label = ConfigUtil.getRelevantMasterData(mMediumList, medium[0]);
mMediumBoardView.showMedium(label);
setMediumMarked();
}

} else {
//Set Selected language as default medium of instruction.
String defaultMedium = getMediumofInstruction();
mProfile.setMedium(ConfigUtil.getRelevantMasterData(mMediumList, defaultMedium));
mProfile.setMedium(new String[]{ConfigUtil.getRelevantMasterData(mMediumList, defaultMedium)});
mMediumBoardView.showMedium(defaultMedium);
setMediumMarked();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,6 @@

import java.util.List;

//import org.ekstep.genie.fragment.DataSettingsFragment;

public class LandingActivity extends BaseActivity
implements LandingContract.View, IMenuItemClick {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,11 @@
import org.ekstep.genieservices.commons.utils.DateUtil;
import org.ekstep.genieservices.commons.utils.GsonUtil;
import org.ekstep.genieservices.commons.utils.StringUtil;
import org.ekstep.genieservices.content.ContentConstants;
import org.ekstep.genieservices.eventbus.EventBus;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
Expand Down Expand Up @@ -214,9 +216,11 @@ public void getOnlineContents() {
}

ContentListingCriteria.Builder listingCriteria = new ContentListingCriteria.Builder();
listingCriteria.facets(ConfigUtil.getFilterConfig(ContentConstants.CONFIG_FACETS));
String identifier = Constant.HOME_IDENTIFIER;

String partnerInfo = PreferenceUtil.getPartnerInfo();

if (!StringUtil.isNullOrEmpty(partnerInfo)) {
HashMap<String, Object> partnerMap = GsonUtil.fromJson(partnerInfo, HashMap.class);
if (partnerMap.get("mode") != null) {
Expand All @@ -241,6 +245,16 @@ public void getOnlineContents() {
listingCriteria.audience(audience.toArray(new String[audience.size()]));
}
}

//Apply pragma filter
if (partnerMap.containsKey(Constant.BUNDLE_KEY_PARTNER_PRAGMA_ARRAY)) {
ArrayList<String> pragma = (ArrayList<String>) partnerMap.get(Constant.BUNDLE_KEY_PARTNER_PRAGMA_ARRAY);
if (pragma != null) {
listingCriteria.excludePragma(pragma.toArray(new String[pragma.size()]));
}
}
} else {
listingCriteria.excludePragma(ConfigUtil.getFilterConfig(ContentConstants.CONFIG_EXCLUDE_PRAGMA));
}

listingCriteria.listingId(identifier).subject(selectedSubject);
Expand Down Expand Up @@ -567,7 +581,7 @@ public void handleSectionItemClicked(ContentData contentData, int positionClicke
}

// TelemetryHandler.saveTelemetry(TelemetryBuilder.buildGEInteract(InteractionType.TOUCH, TelemetryStageId.GENIE_HOME, TelemetryAction.CONTENT_CLICKED, contentId, map, cdata));
TelemetryHandler.saveTelemetry(TelemetryBuilder.buildInteractEvent(EnvironmentId.HOME,InteractionType.TOUCH, TelemetryAction.CONTENT_CLICKED, TelemetryStageId.GENIE_HOME, contentId, ObjectType.CONTENT, map, cdata));
TelemetryHandler.saveTelemetry(TelemetryBuilder.buildInteractEvent(EnvironmentId.HOME, InteractionType.TOUCH, TelemetryAction.CONTENT_CLICKED, TelemetryStageId.GENIE_HOME, contentId, ObjectType.CONTENT, map, cdata));

ContentUtil.navigateToContentDetails(mContext, contentData, new ArrayList<HierarchyInfo>(), false, false, false);

Expand All @@ -579,7 +593,12 @@ public void getLocalContents() {
isLocalContentsCalledAlready = true;
LogUtil.e(TAG + "@getLocalContents", "Called !");
ContentFilterCriteria.Builder contentFilterCriteria = new ContentFilterCriteria.Builder();
contentFilterCriteria.contentTypes(new String[]{ContentType.GAME, ContentType.STORY, ContentType.WORKSHEET, ContentType.COLLECTION})
contentFilterCriteria.excludePragma(ConfigUtil.getFilterConfig(ContentConstants.CONFIG_EXCLUDE_PRAGMA));
String[] contentTypesArray = ConfigUtil.getFilterConfig(ContentConstants.CONFIG_CONTENT_TYPE);
List<String> list = new ArrayList<String>(Arrays.asList(contentTypesArray));
list.remove(ContentType.TEXTBOOK);
contentTypesArray = list.toArray(new String[0]);
contentFilterCriteria.contentTypes(contentTypesArray)
.withContentAccess();
ContentUtil.applyPartnerFilter(contentFilterCriteria);

Expand Down Expand Up @@ -664,6 +683,7 @@ private void setLocalContentCache(List<Content> contentList) {

private void getLocalTextBookContent() {
ContentFilterCriteria.Builder contentFilterCriteria = new ContentFilterCriteria.Builder().contentTypes(new String[]{ContentType.TEXTBOOK})
.excludePragma(ConfigUtil.getFilterConfig(ContentConstants.CONFIG_EXCLUDE_PRAGMA))
.withContentAccess();
ContentUtil.applyPartnerFilter(contentFilterCriteria);
mContentService.getAllLocalContent(contentFilterCriteria.build(), new IResponseHandler<List<Content>>() {
Expand Down Expand Up @@ -987,7 +1007,7 @@ public void onSuccess(GenieResponse<Void> genieResponse) {
eksMap.put(TelemetryConstant.CHILDREN_ON_DEVICE, "" + size);

// TelemetryHandler.saveTelemetry(TelemetryBuilder.buildGEInteract(InteractionType.TOUCH, TelemetryStageId.GENIE_HOME, TelemetryAction.SWITCH_CHILD, profile.getUid(), eksMap));
TelemetryHandler.saveTelemetry(TelemetryBuilder.buildInteractEvent(EnvironmentId.USER,InteractionType.TOUCH, TelemetryAction.SWITCH_CHILD, TelemetryStageId.GENIE_HOME, profile.getUid(), ObjectType.USER, eksMap));
TelemetryHandler.saveTelemetry(TelemetryBuilder.buildInteractEvent(EnvironmentId.USER, InteractionType.TOUCH, TelemetryAction.SWITCH_CHILD, TelemetryStageId.GENIE_HOME, profile.getUid(), ObjectType.USER, eksMap));
getCurrentUser();
}

Expand All @@ -1014,7 +1034,7 @@ public void onSuccess(GenieResponse<String> genieResponse) {
eksMap.put(TelemetryConstant.CHILDREN_ON_DEVICE, "" + size);

// TelemetryHandler.saveTelemetry(TelemetryBuilder.buildGEInteract(InteractionType.TOUCH, TelemetryStageId.GENIE_HOME, TelemetryAction.SWITCH_CHILD, "0", eksMap));
TelemetryHandler.saveTelemetry(TelemetryBuilder.buildInteractEvent(EnvironmentId.USER,InteractionType.TOUCH, TelemetryAction.SWITCH_CHILD, TelemetryStageId.GENIE_HOME, "0", ObjectType.USER, eksMap));
TelemetryHandler.saveTelemetry(TelemetryBuilder.buildInteractEvent(EnvironmentId.USER, InteractionType.TOUCH, TelemetryAction.SWITCH_CHILD, TelemetryStageId.GENIE_HOME, "0", ObjectType.USER, eksMap));
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import org.ekstep.genie.util.PlayerUtil;
import org.ekstep.genie.util.ThemeUtility;
import org.ekstep.genie.util.Util;
import org.ekstep.genie.util.geniesdk.ConfigUtil;
import org.ekstep.genie.util.geniesdk.ContentUtil;
import org.ekstep.genie.util.preference.PreferenceUtil;
import org.ekstep.genieservices.IUserService;
Expand All @@ -48,6 +49,7 @@
import org.ekstep.genieservices.commons.bean.enums.SortOrder;
import org.ekstep.genieservices.commons.utils.CollectionUtil;
import org.ekstep.genieservices.commons.utils.StringUtil;
import org.ekstep.genieservices.content.ContentConstants;
import org.ekstep.genieservices.eventbus.EventBus;

import java.util.ArrayList;
Expand Down Expand Up @@ -170,6 +172,8 @@ public void shareContent() {
@Override
public void renderLocalContents() {
ContentFilterCriteria.Builder contentFilterCriteria = new ContentFilterCriteria.Builder();
contentFilterCriteria.excludePragma(ConfigUtil.getFilterConfig(ContentConstants.CONFIG_EXCLUDE_PRAGMA));
contentFilterCriteria.contentTypes(ConfigUtil.getFilterConfig(ContentConstants.CONFIG_CONTENT_TYPE));
contentFilterCriteria.withContentAccess().withFeedback();
contentFilterCriteria.forUser(mUserService.getCurrentUser().getResult().getUid());
ContentUtil.applyPartnerFilter(contentFilterCriteria);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,18 @@
import org.ekstep.genie.telemetry.TelemetryStageId;
import org.ekstep.genie.util.Constant;
import org.ekstep.genie.util.PlayerUtil;
import org.ekstep.genie.util.geniesdk.ConfigUtil;
import org.ekstep.genie.util.geniesdk.ContentUtil;
import org.ekstep.genieservices.async.ContentService;
import org.ekstep.genieservices.commons.IResponseHandler;
import org.ekstep.genieservices.commons.bean.Content;
import org.ekstep.genieservices.commons.bean.ContentFilterCriteria;
import org.ekstep.genieservices.commons.bean.GenieResponse;
import org.ekstep.genieservices.commons.bean.Profile;
import org.ekstep.genieservices.content.ContentConstants;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

/**
Expand Down Expand Up @@ -48,8 +52,12 @@ public void fetchLocalLessons(String lesstionType, final Profile profile, final
if (lesstionType.equalsIgnoreCase(Constant.CONTENT_TYPE_TEXTBOOK)) {
contentType = new String[]{ContentType.TEXTBOOK};
} else {
contentType = new String[]{ContentType.GAME, ContentType.STORY, ContentType.WORKSHEET, ContentType.COLLECTION};
contentType = ConfigUtil.getFilterConfig(ContentConstants.CONFIG_CONTENT_TYPE);
List<String> list = new ArrayList<String>(Arrays.asList(contentType));
list.remove(ContentType.TEXTBOOK);
contentType = list.toArray(new String[0]);
}
contentFilterCriteria.excludePragma(ConfigUtil.getFilterConfig(ContentConstants.CONFIG_EXCLUDE_PRAGMA));
contentFilterCriteria.contentTypes(contentType).withContentAccess();
ContentUtil.applyPartnerFilter(contentFilterCriteria);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
import org.ekstep.genie.util.KeyboardUtil;
import org.ekstep.genie.util.ThemeUtility;
import org.ekstep.genie.util.Util;
import org.ekstep.genie.util.geniesdk.ConfigUtil;
import org.ekstep.genie.util.geniesdk.ContentUtil;
import org.ekstep.genieservices.commons.bean.ContentData;
import org.ekstep.genieservices.commons.bean.ContentImportResponse;
Expand All @@ -49,6 +50,7 @@
import org.ekstep.genieservices.commons.bean.Profile;
import org.ekstep.genieservices.commons.bean.enums.SortOrder;
import org.ekstep.genieservices.commons.utils.CollectionUtil;
import org.ekstep.genieservices.content.ContentConstants;
import org.ekstep.genieservices.eventbus.EventBus;
import org.greenrobot.eventbus.Subscribe;
import org.greenrobot.eventbus.ThreadMode;
Expand Down Expand Up @@ -582,6 +584,8 @@ public void handleSearchClick() {
moveSearchCursortoEnd();

ContentSearchCriteria.SearchBuilder searchBuilder = new ContentSearchCriteria.SearchBuilder();
searchBuilder.contentTypes(ConfigUtil.getFilterConfig(ContentConstants.CONFIG_CONTENT_TYPE));
searchBuilder.facets(ConfigUtil.getFilterConfig(ContentConstants.CONFIG_FACETS));
searchBuilder.query(getSearchedQuery())
.limit(200);
mContentSearchCriteria = searchBuilder.build();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import org.ekstep.genie.telemetry.enums.CoRelationIdContext;
import org.ekstep.genie.telemetry.enums.ImpressionType;
import org.ekstep.genie.util.Constant;
import org.ekstep.genie.util.geniesdk.ConfigUtil;
import org.ekstep.genie.util.geniesdk.ContentUtil;
import org.ekstep.genie.util.preference.PreferenceUtil;
import org.ekstep.genieservices.async.ContentService;
Expand All @@ -36,6 +37,7 @@
import org.ekstep.genieservices.commons.utils.CollectionUtil;
import org.ekstep.genieservices.commons.utils.GsonUtil;
import org.ekstep.genieservices.commons.utils.StringUtil;
import org.ekstep.genieservices.content.ContentConstants;

import java.util.ArrayList;
import java.util.HashMap;
Expand Down Expand Up @@ -199,6 +201,8 @@ private Map<String, List<String>> getFilterCriteria(List<ContentSearchFilter> fi
}

private void applyPartnerFilter(ContentSearchCriteria.SearchBuilder searchBuilder) {
searchBuilder.facets(ConfigUtil.getFilterConfig(ContentConstants.CONFIG_FACETS));
searchBuilder.contentTypes(ConfigUtil.getFilterConfig(ContentConstants.CONFIG_CONTENT_TYPE));
String partnerInfo = PreferenceUtil.getPartnerInfo();
if (!StringUtil.isNullOrEmpty(partnerInfo)) {
HashMap<String, Object> partnerMap = GsonUtil.fromJson(partnerInfo, HashMap.class);
Expand All @@ -216,7 +220,19 @@ private void applyPartnerFilter(ContentSearchCriteria.SearchBuilder searchBuilde
searchBuilder.audience(audience.toArray(new String[audience.size()]));
}
}
//Apply pragma filter
if (partnerMap.containsKey(Constant.BUNDLE_KEY_PARTNER_PRAGMA_ARRAY)) {
ArrayList<String> pragma = (ArrayList<String>) partnerMap.get(Constant.BUNDLE_KEY_PARTNER_PRAGMA_ARRAY);
if (pragma != null) {
searchBuilder.excludePragma(pragma.toArray(new String[pragma.size()]));
}
}
} else {
//Apply pragma filter
searchBuilder.excludePragma(ConfigUtil.getFilterConfig(ContentConstants.CONFIG_EXCLUDE_PRAGMA));

}

}

private void applyProfileFilter(ContentSearchCriteria.SearchBuilder searchBuilder, Profile profile) {
Expand Down
Loading

0 comments on commit 1f8349a

Please sign in to comment.