Merge pull request #2796 from NoelDeMartin/MOBILE-3567

MOBILE-3567 course: Open course after enrollment
main
Dani Palou 2021-05-27 13:27:12 +02:00 committed by GitHub
commit e8f3976510
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 2 deletions

View File

@ -331,7 +331,7 @@ export class CoreCoursePreviewPage implements OnInit, OnDestroy {
// Sometimes the list of enrolled courses takes a while to be updated. Wait for it.
await this.waitForEnrolled(true);
this.refreshData().finally(() => {
await this.refreshData().finally(() => {
// My courses have been updated, trigger event.
CoreEvents.trigger(CoreCoursesProvider.EVENT_MY_COURSES_UPDATED, {
courseId: this.course!.id,
@ -340,6 +340,8 @@ export class CoreCoursePreviewPage implements OnInit, OnDestroy {
}, CoreSites.getCurrentSiteId());
});
this.openCourse();
modal?.dismiss();
} catch (error) {
modal?.dismiss();
@ -422,7 +424,7 @@ export class CoreCoursePreviewPage implements OnInit, OnDestroy {
}
try {
CoreCourses.getUserCourse(this.course!.id);
await CoreCourses.getUserCourse(this.course!.id);
} catch {
// Not enrolled, wait a bit and try again.
if (this.pageDestroyed || (Date.now() - this.waitStart > 60000)) {