Skip to content
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

Fix iOS 12 navigation controller crash #387

Merged
merged 4 commits into from
Oct 17, 2018
Merged
Changes from 2 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
19 changes: 8 additions & 11 deletions Stepic/Modules/CourseList/CourseListInteractor.swift
Original file line number Diff line number Diff line change
Expand Up @@ -176,13 +176,13 @@ final class CourseListInteractor: CourseListInteractorProtocol {

if targetCourse.enrolled {
// Enrolled course -> open last step
self.presenter.dismissWaitingState()
self.moduleOutput?.presentLastStep(
course: targetCourse,
isAdaptive: self.adaptiveStorageManager.canOpenInAdaptiveMode(
courseId: targetCourse.id
)
)
self.presenter.dismissWaitingState()
} else {
// Unenrolled course -> join, open last step
self.courseSubscriber.join(course: targetCourse, source: .widget).done { course in
Expand All @@ -195,15 +195,16 @@ final class CourseListInteractor: CourseListInteractorProtocol {
courseTitle: course.title
).send()

self.presenter.dismissWaitingState()
self.moduleOutput?.presentLastStep(
course: targetCourse,
isAdaptive: self.adaptiveStorageManager.canOpenInAdaptiveMode(
courseId: targetCourse.id
)
)
self.presenter.dismissWaitingState()
}.catch { _ in

// FIXME: use dismiss with error
self.presenter.dismissWaitingState()
kvld marked this conversation as resolved.
Show resolved Hide resolved
}
}
}
Expand All @@ -216,14 +217,11 @@ final class CourseListInteractor: CourseListInteractorProtocol {
fatalError("Invalid module state")
}

defer {
self.presenter.dismissWaitingState()
}

if targetCourse.enrolled {
// Enrolled course
// - adaptive -> info
// - normal -> syllabus
self.presenter.dismissWaitingState()
if self.adaptiveStorageManager.canOpenInAdaptiveMode(courseId: targetCourse.id) {
self.moduleOutput?.presentCourseInfo(course: targetCourse)
} else {
Expand All @@ -233,6 +231,7 @@ final class CourseListInteractor: CourseListInteractorProtocol {
// Unenrolled course
// - adaptive -> info
// - normal -> info
self.presenter.dismissWaitingState()
kvld marked this conversation as resolved.
Show resolved Hide resolved
self.moduleOutput?.presentCourseInfo(course: targetCourse)
}
}
Expand All @@ -245,12 +244,9 @@ final class CourseListInteractor: CourseListInteractorProtocol {
fatalError("Invalid module state")
}

defer {
self.presenter.dismissWaitingState()
}

if targetCourse.enrolled && self.userAccountService.isAuthorized {
// Enrolled course -> open last step
self.presenter.dismissWaitingState()
self.moduleOutput?.presentLastStep(
course: targetCourse,
isAdaptive: self.adaptiveStorageManager.canOpenInAdaptiveMode(
Expand All @@ -259,6 +255,7 @@ final class CourseListInteractor: CourseListInteractorProtocol {
)
} else {
// Unenrolled course -> info
self.presenter.dismissWaitingState()
self.moduleOutput?.presentCourseInfo(course: targetCourse)
}
}
Expand Down