Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions Core/Core/Common/CommonModels/Contexts/GetContextTabs.swift
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,13 @@ public class GetContextTabs: CollectionUseCase {
return GetTabsRequest(context: context)
}

public func makeRequest(
environment: AppEnvironment,
completionHandler: @escaping ([APITab]?, URLResponse?, Error?) -> Void
) {
environment.api.exhaust(request, callback: completionHandler)
}

public var scope: Scope {
let sort = NSSortDescriptor(key: #keyPath(Tab.position), ascending: true)
let pred = NSPredicate(format: "%K == %@", #keyPath(Tab.contextRaw), context.canvasContextID)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ public class CourseDetailsViewModel: ObservableObject {
customGradeStatuses.refresh()
course.refresh()
colors.refresh()
tabs.refresh()
}

public func retryAfterError() {
Expand Down Expand Up @@ -167,7 +168,6 @@ public class CourseDetailsViewModel: ObservableObject {
legacyHeaderViewModel.courseUpdated(course)
courseColor = course.color
setupHome(course: course)
tabs.exhaust()
}

private func setupHome(course: Course) {
Expand Down Expand Up @@ -263,11 +263,8 @@ extension CourseDetailsViewModel {
colors.refresh(force: true)
course.refresh(force: true)
return await withCheckedContinuation { continuation in
tabs.exhaust(force: true) { [weak self] _ in
if self?.tabs.hasNextPage == false {
continuation.resume()
}
return true
tabs.refresh(force: true) { _ in
continuation.resume()
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ class StudentAssignmentDetailsPresenter {
func viewIsReady() {
customGradeStatuses.refresh()
colors.refresh()
courses.refresh(force: true)
courses.refresh()
assignments.refresh(force: true)
arc.refresh()
onlineUpload.refresh()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class CourseNavigationPresenter {
func viewIsReady() {
courses.refresh()
color.refresh()
tabs.exhaust(while: { _ in true })
tabs.refresh()
}

func update() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ class GroupNavigationViewController: ScreenViewTrackableTableViewController, Col

colors.refresh()
groups.refresh()
tabs.exhaust()
tabs.refresh()
update()
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ class CourseNavigationPresenterTests: StudentTestCase {
let colorStore = presenter.color as! TestStore
let courseStore = presenter.courses as! TestStore
let tabStore = presenter.tabs as! TestStore
wait(for: [colorStore.refreshExpectation, courseStore.refreshExpectation, tabStore.exhaustExpectation], timeout: 1)
wait(for: [colorStore.refreshExpectation, courseStore.refreshExpectation, tabStore.refreshExpectation], timeout: 1)
}

func testTabsAreOrderedByPosition() {
Expand Down