@@ -417,62 +417,6 @@ class CourseHomeViewModel(
417417 }
418418 }
419419
420- fun viewCertificateTappedEvent () {
421- analytics.logEvent(
422- CourseAnalyticsEvent .VIEW_CERTIFICATE .eventName,
423- buildMap {
424- put(CourseAnalyticsKey .NAME .key, CourseAnalyticsEvent .VIEW_CERTIFICATE .biValue)
425- put(CourseAnalyticsKey .COURSE_ID .key, courseId)
426- }
427- )
428- }
429-
430- private fun resumeCourseTappedEvent (blockId : String ) {
431- val currentState = uiState.value
432- if (currentState is CourseHomeUIState .CourseData ) {
433- analytics.logEvent(
434- CourseAnalyticsEvent .RESUME_COURSE_CLICKED .eventName,
435- buildMap {
436- put(
437- CourseAnalyticsKey .NAME .key,
438- CourseAnalyticsEvent .RESUME_COURSE_CLICKED .biValue
439- )
440- put(CourseAnalyticsKey .COURSE_ID .key, courseId)
441- put(CourseAnalyticsKey .COURSE_NAME .key, courseTitle)
442- put(CourseAnalyticsKey .BLOCK_ID .key, blockId)
443- }
444- )
445- }
446- }
447-
448- fun sequentialClickedEvent (blockId : String , blockName : String ) {
449- val currentState = uiState.value
450- if (currentState is CourseHomeUIState .CourseData ) {
451- analytics.sequentialClickedEvent(
452- courseId,
453- currentState.courseStructure.name,
454- blockId,
455- blockName
456- )
457- }
458- }
459-
460- fun logUnitDetailViewedEvent (blockId : String , blockName : String ) {
461- val currentState = uiState.value
462- if (currentState is CourseHomeUIState .CourseData ) {
463- analytics.logEvent(
464- CourseAnalyticsEvent .UNIT_DETAIL .eventName,
465- buildMap {
466- put(CourseAnalyticsKey .NAME .key, CourseAnalyticsEvent .UNIT_DETAIL .biValue)
467- put(CourseAnalyticsKey .COURSE_ID .key, courseId)
468- put(CourseAnalyticsKey .COURSE_NAME .key, courseTitle)
469- put(CourseAnalyticsKey .BLOCK_ID .key, blockId)
470- put(CourseAnalyticsKey .BLOCK_NAME .key, blockName)
471- }
472- )
473- }
474- }
475-
476420 fun downloadBlocks (blocksIds : List <String >, fragmentManager : FragmentManager ) {
477421 viewModelScope.launch {
478422 val courseData = _uiState .value as ? CourseHomeUIState .CourseData ? : return @launch
@@ -589,4 +533,119 @@ class CourseHomeViewModel(
589533 )
590534 }
591535 }
536+
537+ fun viewCertificateTappedEvent () {
538+ analytics.logEvent(
539+ CourseAnalyticsEvent .VIEW_CERTIFICATE .eventName,
540+ buildMap {
541+ put(CourseAnalyticsKey .NAME .key, CourseAnalyticsEvent .VIEW_CERTIFICATE .biValue)
542+ put(CourseAnalyticsKey .COURSE_ID .key, courseId)
543+ }
544+ )
545+ }
546+
547+ private fun resumeCourseTappedEvent (blockId : String ) {
548+ val currentState = uiState.value
549+ if (currentState is CourseHomeUIState .CourseData ) {
550+ analytics.logEvent(
551+ CourseAnalyticsEvent .RESUME_COURSE_CLICKED .eventName,
552+ buildMap {
553+ put(
554+ CourseAnalyticsKey .NAME .key,
555+ CourseAnalyticsEvent .RESUME_COURSE_CLICKED .biValue
556+ )
557+ put(CourseAnalyticsKey .COURSE_ID .key, courseId)
558+ put(CourseAnalyticsKey .COURSE_NAME .key, courseTitle)
559+ put(CourseAnalyticsKey .BLOCK_ID .key, blockId)
560+ }
561+ )
562+ }
563+ }
564+
565+ fun logSectionSubsectionClick (blockId : String , blockName : String ) {
566+ val currentState = uiState.value
567+ if (currentState is CourseHomeUIState .CourseData ) {
568+ analytics.logEvent(
569+ CourseAnalyticsEvent .COURSE_HOME_SECTION_SUBSECTION_CLICK .eventName,
570+ buildMap {
571+ put(
572+ CourseAnalyticsKey .NAME .key,
573+ CourseAnalyticsEvent .COURSE_HOME_SECTION_SUBSECTION_CLICK .biValue
574+ )
575+ put(CourseAnalyticsKey .COURSE_ID .key, courseId)
576+ put(CourseAnalyticsKey .COURSE_NAME .key, currentState.courseStructure.name)
577+ put(CourseAnalyticsKey .BLOCK_ID .key, blockId)
578+ put(CourseAnalyticsKey .BLOCK_NAME .key, blockName)
579+ }
580+ )
581+ }
582+ }
583+
584+ fun logViewAllContentClick () {
585+ val currentState = uiState.value
586+ if (currentState is CourseHomeUIState .CourseData ) {
587+ analytics.logEvent(
588+ CourseAnalyticsEvent .COURSE_HOME_VIEW_ALL_CONTENT .eventName,
589+ buildMap {
590+ put(
591+ CourseAnalyticsKey .NAME .key,
592+ CourseAnalyticsEvent .COURSE_HOME_VIEW_ALL_CONTENT .biValue
593+ )
594+ put(CourseAnalyticsKey .COURSE_ID .key, courseId)
595+ put(CourseAnalyticsKey .COURSE_NAME .key, currentState.courseStructure.name)
596+ }
597+ )
598+ }
599+ }
600+
601+ fun logViewAllVideosClick () {
602+ val currentState = uiState.value
603+ if (currentState is CourseHomeUIState .CourseData ) {
604+ analytics.logEvent(
605+ CourseAnalyticsEvent .COURSE_HOME_VIEW_ALL_VIDEOS .eventName,
606+ buildMap {
607+ put(
608+ CourseAnalyticsKey .NAME .key,
609+ CourseAnalyticsEvent .COURSE_HOME_VIEW_ALL_VIDEOS .biValue
610+ )
611+ put(CourseAnalyticsKey .COURSE_ID .key, courseId)
612+ put(CourseAnalyticsKey .COURSE_NAME .key, currentState.courseStructure.name)
613+ }
614+ )
615+ }
616+ }
617+
618+ fun logViewAllAssignmentsClick () {
619+ val currentState = uiState.value
620+ if (currentState is CourseHomeUIState .CourseData ) {
621+ analytics.logEvent(
622+ CourseAnalyticsEvent .COURSE_HOME_VIEW_ALL_ASSIGNMENTS .eventName,
623+ buildMap {
624+ put(
625+ CourseAnalyticsKey .NAME .key,
626+ CourseAnalyticsEvent .COURSE_HOME_VIEW_ALL_ASSIGNMENTS .biValue
627+ )
628+ put(CourseAnalyticsKey .COURSE_ID .key, courseId)
629+ put(CourseAnalyticsKey .COURSE_NAME .key, currentState.courseStructure.name)
630+ }
631+ )
632+ }
633+ }
634+
635+ fun logViewProgressClick () {
636+ val currentState = uiState.value
637+ if (currentState is CourseHomeUIState .CourseData ) {
638+ analytics.logEvent(
639+ CourseAnalyticsEvent .COURSE_HOME_GRADES_VIEW_PROGRESS .eventName,
640+ buildMap {
641+ put(
642+ CourseAnalyticsKey .NAME .key,
643+ CourseAnalyticsEvent .COURSE_HOME_GRADES_VIEW_PROGRESS .biValue
644+ )
645+ put(CourseAnalyticsKey .COURSE_ID .key, courseId)
646+ put(CourseAnalyticsKey .COURSE_NAME .key, currentState.courseStructure.name)
647+ }
648+ )
649+ }
650+ }
592651}
0 commit comments