MOBILE-3980 book: Log book viewed in entry page
This commit is contained in:
		
							parent
							
								
									7f34da3462
								
							
						
					
					
						commit
						328b39a541
					
				| @ -18,6 +18,7 @@ import { AddonModBook, AddonModBookBookWSData, AddonModBookNumbering, AddonModBo | ||||
| import { CoreCourseContentsPage } from '@features/course/pages/contents/contents'; | ||||
| import { CoreCourse } from '@features/course/services/course'; | ||||
| import { CoreNavigator } from '@services/navigator'; | ||||
| import { CoreUtils } from '@services/utils/utils'; | ||||
| 
 | ||||
| /** | ||||
|  * Component that displays a book entry page. | ||||
| @ -47,6 +48,9 @@ export class AddonModBookIndexComponent extends CoreCourseModuleMainResourceComp | ||||
|         super.ngOnInit(); | ||||
| 
 | ||||
|         this.loadContent(); | ||||
| 
 | ||||
|         // Log book viewed.
 | ||||
|         await CoreUtils.ignoreErrors(AddonModBook.logView(this.module.instance, undefined, this.module.name)); | ||||
|     } | ||||
| 
 | ||||
|     /** | ||||
|  | ||||
| @ -69,7 +69,6 @@ export class AddonModBookContentsPage implements OnInit, OnDestroy { | ||||
| 
 | ||||
|     loaded = false; | ||||
| 
 | ||||
|     protected firstLoad = true; | ||||
|     protected managerUnsubscribe?: () => void; | ||||
| 
 | ||||
|     /** | ||||
| @ -272,10 +271,6 @@ export class AddonModBookContentsPage implements OnInit, OnDestroy { | ||||
|      * @return Promise resolved when done. | ||||
|      */ | ||||
|     protected async onChapterViewed(chapterId: number): Promise<void> { | ||||
|         // Don't log the chapter ID when the user has just opened the book.
 | ||||
|         const logChapterId = this.firstLoad; | ||||
|         this.firstLoad = false; | ||||
| 
 | ||||
|         if (this.displayNavBar) { | ||||
|             this.navigationItems = this.getNavigationItems(chapterId); | ||||
|         } | ||||
| @ -289,11 +284,7 @@ export class AddonModBookContentsPage implements OnInit, OnDestroy { | ||||
|         } | ||||
| 
 | ||||
|         // Chapter loaded, log view.
 | ||||
|         await CoreUtils.ignoreErrors(AddonModBook.logView( | ||||
|             this.module.instance, | ||||
|             logChapterId ? chapterId : undefined, | ||||
|             this.module.name, | ||||
|         )); | ||||
|         await CoreUtils.ignoreErrors(AddonModBook.logView(this.module.instance, chapterId, this.module.name)); | ||||
| 
 | ||||
|         const currentChapterIndex = this.chapters.findIndex((chapter) => chapter.id == chapterId); | ||||
|         const isLastChapter = currentChapterIndex < 0 || this.chapters[currentChapterIndex + 1] === undefined; | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user