Skip to content

Commit

Permalink
add analytics and translation
Browse files Browse the repository at this point in the history
  • Loading branch information
mumer92 committed Oct 26, 2023
1 parent 03e03f6 commit a82f9a7
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ public struct CourseContainerView: View {
enum CourseTab {
case course
case videos
case dates
case discussion
case handounds
}
Expand Down Expand Up @@ -79,9 +80,9 @@ public struct CourseContainerView: View {
argument: courseID)!)
.tabItem {
CoreAssets.bookCircle.swiftUIImage.renderingMode(.template)
Text("Dates")
Text(CourseLocalization.CourseContainer.dates)
}
.tag("Dates")
.tag(CourseTab.dates)

DiscussionTopicsView(courseID: courseID,
viewModel: Container.shared.resolve(DiscussionTopicsViewModel.self,
Expand Down Expand Up @@ -131,6 +132,8 @@ public struct CourseContainerView: View {
return DiscussionLocalization.title
case .handounds:
return CourseLocalization.CourseContainer.handouts
case .dates:
return CourseLocalization.CourseContainer.dates
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,8 @@ public class CourseContainerViewModel: BaseCourseViewModel {
analytics.courseOutlineCourseTabClicked(courseId: courseId, courseName: courseName)
case .videos:
analytics.courseOutlineVideosTabClicked(courseId: courseId, courseName: courseName)
case .dates:
analytics.courseOutlineDatesTabClicked(courseId: courseId, courseName: courseName)
case .discussion:
analytics.courseOutlineDiscussionTabClicked(courseId: courseId, courseName: courseName)
case .handounds:
Expand Down
2 changes: 2 additions & 0 deletions Course/Course/Presentation/CourseAnalytics.swift
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ public protocol CourseAnalytics {
func finishVerticalBackToOutlineClicked(courseId: String, courseName: String)
func courseOutlineCourseTabClicked(courseId: String, courseName: String)
func courseOutlineVideosTabClicked(courseId: String, courseName: String)
func courseOutlineDatesTabClicked(courseId: String, courseName: String)
func courseOutlineDiscussionTabClicked(courseId: String, courseName: String)
func courseOutlineHandoutsTabClicked(courseId: String, courseName: String)
}
Expand All @@ -46,6 +47,7 @@ class CourseAnalyticsMock: CourseAnalytics {
public func finishVerticalBackToOutlineClicked(courseId: String, courseName: String) {}
public func courseOutlineCourseTabClicked(courseId: String, courseName: String) {}
public func courseOutlineVideosTabClicked(courseId: String, courseName: String) {}
public func courseOutlineDatesTabClicked(courseId: String, courseName: String) {}
public func courseOutlineDiscussionTabClicked(courseId: String, courseName: String) {}
public func courseOutlineHandoutsTabClicked(courseId: String, courseName: String) {}
}
Expand Down
2 changes: 2 additions & 0 deletions Course/Course/SwiftGen/Strings.swift
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ public enum CourseLocalization {
public enum CourseContainer {
/// Course
public static let course = CourseLocalization.tr("Localizable", "COURSE_CONTAINER.COURSE", fallback: "Course")
/// Dates
public static let dates = CourseLocalization.tr("Localizable", "COURSE_CONTAINER.DATES", fallback: "Dates")
/// Discussion
public static let discussion = CourseLocalization.tr("Localizable", "COURSE_CONTAINER.DISCUSSION", fallback: "Discussion")
/// Handouts
Expand Down
1 change: 1 addition & 0 deletions Course/Course/en.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@

"COURSE_CONTAINER.COURSE" = "Course";
"COURSE_CONTAINER.VIDEOS" = "Videos";
"COURSE_CONTAINER.DATES" = "Dates";
"COURSE_CONTAINER.DISCUSSION" = "Discussion";
"COURSE_CONTAINER.HANDOUTS" = "Handouts";
"COURSE_CONTAINER.HANDOUTS_IN_DEVELOPING" = "Handouts In developing";
Expand Down
1 change: 1 addition & 0 deletions Course/Course/uk.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@

"COURSE_CONTAINER.COURSE" = "Курс";
"COURSE_CONTAINER.VIDEOS" = "Всі відео";
//"COURSE_CONTAINER.DATES" = "Dates";
"COURSE_CONTAINER.DISCUSSION" = "Дискусії";
"COURSE_CONTAINER.HANDOUTS" = "Матеріали";
"COURSE_CONTAINER.HANDOUTS_IN_DEVELOPING" = "Матеріали в процесі розробки";
Expand Down
9 changes: 9 additions & 0 deletions OpenEdX/AnalyticsManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,14 @@ class AnalyticsManager: AuthorizationAnalytics,
logEvent(.courseOutlineVideosTabClicked, parameters: parameters)
}

public func courseOutlineDatesTabClicked(courseId: String, courseName: String) {
let parameters = [
Key.courseID: courseId,
Key.courseName: courseName
]
logEvent(.courseOutlineDatesTabClicked, parameters: parameters)
}

public func courseOutlineDiscussionTabClicked(courseId: String, courseName: String) {
let parameters = [
Key.courseID: courseId,
Expand Down Expand Up @@ -360,6 +368,7 @@ enum Event: String {
case finishVerticalBackToOutlineClicked = "Finish_Vertical_Back_to_outline_Clicked"
case courseOutlineCourseTabClicked = "Course_Outline_Course_tab_Clicked"
case courseOutlineVideosTabClicked = "Course_Outline_Videos_tab_Clicked"
case courseOutlineDatesTabClicked = "Course_Outline_Dates_tab_Clicked"
case courseOutlineDiscussionTabClicked = "Course_Outline_Discussion_tab_Clicked"
case courseOutlineHandoutsTabClicked = "Course_Outline_Handouts_tab_Clicked"

Expand Down

0 comments on commit a82f9a7

Please sign in to comment.