-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Alert for outdated course calendars on the course home screen #416
Changes from 1 commit
8887034
c2e5a41
fbbcade
631dab4
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -93,6 +93,7 @@ public class CourseContainerViewModel: BaseCourseViewModel { | |
private let authInteractor: AuthInteractorProtocol | ||
let analytics: CourseAnalytics | ||
let coreAnalytics: CoreAnalytics | ||
var courseDatesViewModel: CourseDatesViewModel | ||
private(set) var storage: CourseStorage | ||
|
||
public init( | ||
|
@@ -109,7 +110,8 @@ public class CourseContainerViewModel: BaseCourseViewModel { | |
courseEnd: Date?, | ||
enrollmentStart: Date?, | ||
enrollmentEnd: Date?, | ||
coreAnalytics: CoreAnalytics | ||
coreAnalytics: CoreAnalytics, | ||
courseDatesViewModel: CourseDatesViewModel | ||
) { | ||
self.interactor = interactor | ||
self.authInteractor = authInteractor | ||
|
@@ -126,6 +128,7 @@ public class CourseContainerViewModel: BaseCourseViewModel { | |
self.userSettings = storage.userSettings | ||
self.isInternetAvaliable = connectivity.isInternetAvaliable | ||
self.coreAnalytics = coreAnalytics | ||
self.courseDatesViewModel = courseDatesViewModel | ||
|
||
super.init(manager: manager) | ||
addObservers() | ||
|
@@ -140,6 +143,9 @@ public class CourseContainerViewModel: BaseCourseViewModel { | |
do { | ||
if isInternetAvaliable { | ||
courseStructure = try await interactor.getCourseBlocks(courseID: courseID) | ||
Task { | ||
await courseDatesViewModel.getCourseDates(courseID: courseID) | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @shafqat-muneer, I don't know if this can be tested. We can't check what's going on inside the Task. In any case, the calendar flow will be heavily modified in FC-0047, so we can probably make do with this approach for now. |
||
isShowProgress = false | ||
isShowRefresh = false | ||
if let courseStructure { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
getCourseBlocks
is async function, why are you usingTask
there? Don't we need to wait for dates before will setisShowProgress
andisShowRefresh
to false?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On the course home screen, we are executing the
getCourseDates
API call solely to determine whether to display an outdated calendar alert or not. There is no UI population involving dates at this stage. Hence, we can optimize the loading time of this screen by running thegetCourseDates
API call on a separate thread. Once we receive the response regarding the dates, we can then decide whether to present the outdated alert or not.Additionally, it's essential to populate
getCourseBlocks
before invokinggetCourseDates
because thegetCourseDates
method involves offline population ofcourseStructure
.