Skip to content

Commit

Permalink
feat: add video learning event - learning event util
Browse files Browse the repository at this point in the history
Refs #155
  • Loading branch information
jo-elimu committed Sep 27, 2024
1 parent 1b4de73 commit f64029b
Showing 1 changed file with 20 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import ai.elimu.model.v2.gson.content.LetterSoundGson;
import ai.elimu.model.v2.gson.content.SoundGson;
import ai.elimu.model.v2.gson.content.StoryBookGson;
import ai.elimu.model.v2.gson.content.VideoGson;
import ai.elimu.model.v2.gson.content.WordGson;

/**
Expand Down Expand Up @@ -92,4 +93,23 @@ public static void reportStoryBookLearningEvent(StoryBookGson storyBookGson, Lea
broadcastIntent.setPackage(analyticsApplicationId);
context.sendBroadcast(broadcastIntent);
}

/**
* @param videoGson The video that the student is learning from.
* @param learningEventType The type of learning (i.e. the learning format) that is presented to the student in the application ({@code packageName}).
* @param context Needed to fetch the {@code packageName} of the application where the learning event occurred.
* @param analyticsApplicationId The package name of the analytics application that will receive the Intent and store the event.
*/
public static void reportVideoLearningEvent(VideoGson videoGson, LearningEventType learningEventType, Context context, String analyticsApplicationId) {
Log.i(LearningEventUtil.class.getName(),"reportVideoLearningEvent");

Intent broadcastIntent = new Intent();
broadcastIntent.setAction("ai.elimu.intent.action.VIDEO_LEARNING_EVENT");
broadcastIntent.putExtra("packageName", context.getPackageName());
broadcastIntent.putExtra("videoId", videoGson.getId());
broadcastIntent.putExtra("videoTitle", videoGson.getTitle());
broadcastIntent.putExtra("learningEventType", learningEventType.toString());
broadcastIntent.setPackage(analyticsApplicationId);
context.sendBroadcast(broadcastIntent);
}
}

0 comments on commit f64029b

Please sign in to comment.