-
Notifications
You must be signed in to change notification settings - Fork 34
Fix enrollment cache for deeplinking #173
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
Conversation
Ostrenkiy
left a comment
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.
Пока, кажется, плохо будет работать, не мерджим
| // let navigation : UINavigationController = StyledNavigationViewController(rootViewController: stepsVC) | ||
| // navigation.navigationBar.topItem?.leftBarButtonItem = UIBarButtonItem(image: Images.crossBarButtonItemImage, style: UIBarButtonItemStyle.Plain, target: self, action: #selector(StepsControllerDeepLinkRouter.dismissPressed(_:))) | ||
| // navigation.navigationBar.topItem?.leftBarButtonItem?.tintColor = UIColor.whiteColor() | ||
| fileprivate func getVCForLesson(_ lesson: Lesson, stepId: Int, success successHandler: @escaping ((UIViewController) -> Void), error errorHandler: @escaping ((String) -> Void)) { |
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.
КАКОЙ ЖЕ ЭТО
АД
ААА
МНЕ БОЛЬНО
хз как это тестить
надеюсь работает
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.
Смотрю на эту елочку
Хочу включить "Last christmas I gave you my heart" и плакать
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.
Вообще, это плохо работает. Потому что надо доставать из кор даты нужные нам юниты, секции и курсы и пихать их в existing: параметр для retrieve, чтобы они обновлялись (да, это отстойный легаси). И на каждом шаге надо присваивать юниту - урок, секции - юнит, курсу - секцию
|
Сюда надо бы подмерджить dev и порешать конфликты в кор дате |
|
@Ostrenkiy посмотри. Переписал этот кусок с промисами и отдельными обёртками |
Ostrenkiy
left a comment
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.
Надо поправить
| return | ||
| fileprivate func getVCForLesson(_ lesson: Lesson, stepId: Int, success successHandler: @escaping ((UIViewController) -> Void), error errorHandler: @escaping ((String) -> Void)) { | ||
| func fetchOrLoadUnit(lesson: Lesson) -> Promise<Unit> { | ||
| return Promise { resolve, reject in |
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.
а есть какой-то сакральный смысл у resolve вместо fulfill в названии?
| } | ||
|
|
||
| ApiDataDownloader.units.retrieve(lesson: lesson.id, success: { unit in | ||
| resolve(unit) |
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.
тут, кажется, надо unit.lesson = lesson сделать
| successHandler(lessonVC) | ||
| } else { | ||
| errorHandler("No access") | ||
| func fetchOrLoadSection(_ id: Int) -> Promise<Section> { |
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.
сюда, кажется, лучше передавать unit, чтобы потом unit.section = section сделать
| } | ||
| } | ||
|
|
||
| func fetchOrLoadCourse(_ id: Int) -> Promise<Course> { |
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.
Аналогично и здесь, надо section.course = course делать
|
@Ostrenkiy померджил с dev, можно и нужно смотреть. |
| resolve(course) | ||
| func fetchOrLoadCourse(for section: Section) -> Promise<Course> { | ||
| return Promise { fulfill, reject in | ||
| if let course = Course.getCourses([section.courseId]).first { |
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.
Вот здесь courseId запросто может быть -1, если мы его не успели перезаписать после миграции. Будет крашиться.
|
@Ostrenkiy тоже можно смотреть в очередной раз. |
|
завтра посмотрю уже |
|
теперь все хорошо вроде, надо только конфликты порешать |
Задача: #APPS-1648
Коротко для Release Notes, в формате «Сделали/Добавили/Исправили N»:
Исправили проблему, когда не открывался степ по диплинку
Описание:
Для степа, который открывался по диплинку, подгружался только урок, поэтому ничего не знали о состоянии
enrollment(если он не был закеширован заранее). Из-за этого нельзя было открыть степ по диплинку, если до этого ни разу не открывался сам курс в приложении.Теперь честно подгружаем каждый раз состояние курса (не уверен, что нужно смотреть на данные в кор дате, т. к. они могут быть устаревшими).