MOBILE-3320 course: Fix some prefetchs never ending
parent
a0a0385c95
commit
c5d18dffdc
|
@ -211,13 +211,9 @@ export class AddonModAssignPrefetchHandlerService extends CoreCourseActivityPref
|
|||
}
|
||||
|
||||
/**
|
||||
* Prefetch a module.
|
||||
*
|
||||
* @param module Module.
|
||||
* @param courseId Course ID the module belongs to.
|
||||
* @return Promise resolved when done.
|
||||
* @inheritdoc
|
||||
*/
|
||||
prefetch(module: CoreCourseAnyModuleData, courseId?: number): Promise<void> {
|
||||
prefetch(module: CoreCourseAnyModuleData, courseId: number): Promise<void> {
|
||||
return this.prefetchPackage(module, courseId, this.prefetchAssign.bind(this, module, courseId));
|
||||
}
|
||||
|
||||
|
@ -226,12 +222,11 @@ export class AddonModAssignPrefetchHandlerService extends CoreCourseActivityPref
|
|||
*
|
||||
* @param module Module.
|
||||
* @param courseId Course ID the module belongs to.
|
||||
* @param siteId Site ID.
|
||||
* @return Promise resolved when done.
|
||||
*/
|
||||
protected async prefetchAssign(module: CoreCourseAnyModuleData, courseId?: number): Promise<void> {
|
||||
protected async prefetchAssign(module: CoreCourseAnyModuleData, courseId: number, siteId: string): Promise<void> {
|
||||
const userId = CoreSites.getCurrentSiteUserId();
|
||||
courseId = courseId || module.course || CoreSites.getCurrentSiteHomeId();
|
||||
const siteId = CoreSites.getCurrentSiteId();
|
||||
|
||||
const options: CoreSitesCommonWSOptions = {
|
||||
readingStrategy: CoreSitesReadingStrategy.ONLY_NETWORK,
|
||||
|
|
|
@ -17,7 +17,7 @@ import { CoreCourseActivityPrefetchHandlerBase } from '@features/course/classes/
|
|||
import { CoreCourse, CoreCourseAnyModuleData, CoreCourseCommonModWSOptions } from '@features/course/services/course';
|
||||
import { CoreUser } from '@features/user/services/user';
|
||||
import { CoreGroups } from '@services/groups';
|
||||
import { CoreSites, CoreSitesReadingStrategy } from '@services/sites';
|
||||
import { CoreSitesReadingStrategy } from '@services/sites';
|
||||
import { CoreUtils } from '@services/utils/utils';
|
||||
import { makeSingleton } from '@singletons';
|
||||
import { AddonModChat, AddonModChatProvider, AddonModChatSession } from '../chat';
|
||||
|
@ -64,7 +64,7 @@ export class AddonModChatPrefetchHandlerService extends CoreCourseActivityPrefet
|
|||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
prefetch(module: CoreCourseAnyModuleData, courseId?: number): Promise<void> {
|
||||
prefetch(module: CoreCourseAnyModuleData, courseId: number): Promise<void> {
|
||||
return this.prefetchPackage(module, courseId, this.prefetchChat.bind(this, module, courseId));
|
||||
}
|
||||
|
||||
|
@ -73,10 +73,10 @@ export class AddonModChatPrefetchHandlerService extends CoreCourseActivityPrefet
|
|||
*
|
||||
* @param module The module object returned by WS.
|
||||
* @param courseId Course ID the module belongs to.
|
||||
* @param siteId Site ID.
|
||||
* @return Promise resolved when done.
|
||||
*/
|
||||
protected async prefetchChat(module: CoreCourseAnyModuleData, courseId: number): Promise<void> {
|
||||
const siteId = CoreSites.getCurrentSiteId();
|
||||
protected async prefetchChat(module: CoreCourseAnyModuleData, courseId: number, siteId: string): Promise<void> {
|
||||
const options = {
|
||||
readingStrategy: CoreSitesReadingStrategy.ONLY_NETWORK,
|
||||
siteId,
|
||||
|
|
|
@ -17,7 +17,7 @@ import { CoreCourseActivityPrefetchHandlerBase } from '@features/course/classes/
|
|||
import { CoreCourseAnyModuleData, CoreCourseCommonModWSOptions } from '@features/course/services/course';
|
||||
import { CoreUser } from '@features/user/services/user';
|
||||
import { CoreFilepool } from '@services/filepool';
|
||||
import { CoreSites, CoreSitesReadingStrategy } from '@services/sites';
|
||||
import { CoreSitesReadingStrategy } from '@services/sites';
|
||||
import { CoreUtils } from '@services/utils/utils';
|
||||
import { CoreWSFile } from '@services/ws';
|
||||
import { makeSingleton } from '@singletons';
|
||||
|
@ -38,7 +38,7 @@ export class AddonModChoicePrefetchHandlerService extends CoreCourseActivityPref
|
|||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
prefetch(module: CoreCourseAnyModuleData, courseId?: number, single?: boolean): Promise<void> {
|
||||
prefetch(module: CoreCourseAnyModuleData, courseId: number, single?: boolean): Promise<void> {
|
||||
return this.prefetchPackage(module, courseId, this.prefetchChoice.bind(this, module, courseId, !!single));
|
||||
}
|
||||
|
||||
|
@ -55,10 +55,8 @@ export class AddonModChoicePrefetchHandlerService extends CoreCourseActivityPref
|
|||
module: CoreCourseAnyModuleData,
|
||||
courseId: number,
|
||||
single: boolean,
|
||||
siteId?: string,
|
||||
siteId: string,
|
||||
): Promise<void> {
|
||||
siteId = siteId || CoreSites.getCurrentSiteId();
|
||||
|
||||
const commonOptions = {
|
||||
readingStrategy: CoreSitesReadingStrategy.ONLY_NETWORK,
|
||||
siteId,
|
||||
|
|
|
@ -212,7 +212,7 @@ export class AddonModDataPrefetchHandlerService extends CoreCourseActivityPrefet
|
|||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
prefetch(module: CoreCourseAnyModuleData, courseId?: number): Promise<void> {
|
||||
prefetch(module: CoreCourseAnyModuleData, courseId: number): Promise<void> {
|
||||
return this.prefetchPackage(module, courseId, this.prefetchDatabase.bind(this, module, courseId));
|
||||
}
|
||||
|
||||
|
@ -221,12 +221,10 @@ export class AddonModDataPrefetchHandlerService extends CoreCourseActivityPrefet
|
|||
*
|
||||
* @param module Module.
|
||||
* @param courseId Course ID the module belongs to.
|
||||
* @param siteId Site ID.
|
||||
* @return Promise resolved when done.
|
||||
*/
|
||||
protected async prefetchDatabase(module: CoreCourseAnyModuleData, courseId?: number): Promise<void> {
|
||||
const siteId = CoreSites.getCurrentSiteId();
|
||||
courseId = courseId || module.course || CoreSites.getCurrentSiteHomeId();
|
||||
|
||||
protected async prefetchDatabase(module: CoreCourseAnyModuleData, courseId: number, siteId: string): Promise<void> {
|
||||
const options = {
|
||||
cmId: module.id,
|
||||
readingStrategy: CoreSitesReadingStrategy.ONLY_NETWORK,
|
||||
|
|
|
@ -17,7 +17,7 @@ import { CoreCourseActivityPrefetchHandlerBase } from '@features/course/classes/
|
|||
import { CoreCourseAnyModuleData, CoreCourseCommonModWSOptions } from '@features/course/services/course';
|
||||
import { CoreFilepool } from '@services/filepool';
|
||||
import { CoreGroups } from '@services/groups';
|
||||
import { CoreSites, CoreSitesReadingStrategy } from '@services/sites';
|
||||
import { CoreSitesReadingStrategy } from '@services/sites';
|
||||
import { CoreTimeUtils } from '@services/utils/time';
|
||||
import { CoreUtils } from '@services/utils/utils';
|
||||
import { CoreWSFile } from '@services/ws';
|
||||
|
@ -122,7 +122,7 @@ export class AddonModFeedbackPrefetchHandlerService extends CoreCourseActivityPr
|
|||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
prefetch(module: CoreCourseAnyModuleData, courseId?: number): Promise<void> {
|
||||
prefetch(module: CoreCourseAnyModuleData, courseId: number): Promise<void> {
|
||||
return this.prefetchPackage(module, courseId, this.prefetchFeedback.bind(this, module, courseId));
|
||||
}
|
||||
|
||||
|
@ -131,10 +131,10 @@ export class AddonModFeedbackPrefetchHandlerService extends CoreCourseActivityPr
|
|||
*
|
||||
* @param module Module.
|
||||
* @param courseId Course ID the module belongs to.
|
||||
* @param siteId Site ID.
|
||||
* @return Promise resolved when done.
|
||||
*/
|
||||
protected async prefetchFeedback(module: CoreCourseAnyModuleData, courseId: number): Promise<void> {
|
||||
const siteId = CoreSites.getCurrentSiteId();
|
||||
protected async prefetchFeedback(module: CoreCourseAnyModuleData, courseId: number, siteId: string): Promise<void> {
|
||||
const commonOptions = {
|
||||
readingStrategy: CoreSitesReadingStrategy.ONLY_NETWORK,
|
||||
siteId,
|
||||
|
|
|
@ -171,15 +171,9 @@ export class AddonModForumPrefetchHandlerService extends CoreCourseActivityPrefe
|
|||
}
|
||||
|
||||
/**
|
||||
* Prefetch a module.
|
||||
*
|
||||
* @param module Module.
|
||||
* @param courseId Course ID the module belongs to.
|
||||
* @param single True if we're downloading a single module, false if we're downloading a whole section.
|
||||
* @param dirPath Path of the directory where to store all the content files.
|
||||
* @return Promise resolved when done.
|
||||
* @inheritdoc
|
||||
*/
|
||||
prefetch(module: CoreCourseAnyModuleData, courseId?: number, single?: boolean): Promise<void> {
|
||||
prefetch(module: CoreCourseAnyModuleData, courseId: number, single?: boolean): Promise<void> {
|
||||
return this.prefetchPackage(module, courseId, this.prefetchForum.bind(this, module, courseId, single));
|
||||
}
|
||||
|
||||
|
|
|
@ -97,7 +97,7 @@ export class AddonModGlossaryPrefetchHandlerService extends CoreCourseActivityPr
|
|||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
prefetch(module: CoreCourseAnyModuleData, courseId?: number): Promise<void> {
|
||||
prefetch(module: CoreCourseAnyModuleData, courseId: number): Promise<void> {
|
||||
return this.prefetchPackage(module, courseId, this.prefetchGlossary.bind(this, module, courseId));
|
||||
}
|
||||
|
||||
|
@ -110,8 +110,6 @@ export class AddonModGlossaryPrefetchHandlerService extends CoreCourseActivityPr
|
|||
* @return Promise resolved when done.
|
||||
*/
|
||||
protected async prefetchGlossary(module: CoreCourseAnyModuleData, courseId: number, siteId: string): Promise<void> {
|
||||
siteId = siteId || CoreSites.getCurrentSiteId();
|
||||
|
||||
const options = {
|
||||
cmId: module.id,
|
||||
readingStrategy: CoreSitesReadingStrategy.ONLY_NETWORK,
|
||||
|
|
|
@ -76,7 +76,7 @@ export class AddonModH5PActivityPrefetchHandlerService extends CoreCourseActivit
|
|||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
prefetch(module: CoreCourseAnyModuleData, courseId?: number): Promise<void> {
|
||||
prefetch(module: CoreCourseAnyModuleData, courseId: number): Promise<void> {
|
||||
return this.prefetchPackage(module, courseId, this.prefetchActivity.bind(this, module, courseId));
|
||||
}
|
||||
|
||||
|
@ -91,10 +91,8 @@ export class AddonModH5PActivityPrefetchHandlerService extends CoreCourseActivit
|
|||
protected async prefetchActivity(
|
||||
module: CoreCourseAnyModuleData,
|
||||
courseId: number,
|
||||
siteId?: string,
|
||||
siteId: string,
|
||||
): Promise<void> {
|
||||
siteId = siteId || CoreSites.getCurrentSiteId();
|
||||
|
||||
const h5pActivity = await AddonModH5PActivity.getH5PActivity(courseId, module.id, {
|
||||
readingStrategy: CoreSitesReadingStrategy.ONLY_NETWORK,
|
||||
siteId,
|
||||
|
|
|
@ -231,17 +231,10 @@ export class AddonModLessonPrefetchHandlerService extends CoreCourseActivityPref
|
|||
}
|
||||
|
||||
/**
|
||||
* Prefetch a module.
|
||||
*
|
||||
* @param module Module.
|
||||
* @param courseId Course ID the module belongs to.
|
||||
* @param single True if we're downloading a single module, false if we're downloading a whole section.
|
||||
* @param dirPath Path of the directory where to store all the content files.
|
||||
* @return Promise resolved when done.
|
||||
* @inheritdoc
|
||||
*/
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
prefetch(module: CoreCourseAnyModuleData, courseId?: number, single?: boolean, dirPath?: string): Promise<void> {
|
||||
return this.prefetchPackage(module, courseId, this.prefetchLesson.bind(this, module, courseId, single));
|
||||
prefetch(module: CoreCourseAnyModuleData, courseId: number, single?: boolean): Promise<void> {
|
||||
return this.prefetchPackage(module, courseId, this.prefetchLesson.bind(this, module, courseId, !!single));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -250,12 +243,15 @@ export class AddonModLessonPrefetchHandlerService extends CoreCourseActivityPref
|
|||
* @param module Module.
|
||||
* @param courseId Course ID the module belongs to.
|
||||
* @param single True if we're downloading a single module, false if we're downloading a whole section.
|
||||
* @param siteId Site ID.
|
||||
* @return Promise resolved when done.
|
||||
*/
|
||||
protected async prefetchLesson(module: CoreCourseAnyModuleData, courseId?: number, single?: boolean): Promise<void> {
|
||||
const siteId = CoreSites.getCurrentSiteId();
|
||||
courseId = courseId || module.course || CoreSites.getCurrentSiteHomeId();
|
||||
|
||||
protected async prefetchLesson(
|
||||
module: CoreCourseAnyModuleData,
|
||||
courseId: number,
|
||||
single: boolean,
|
||||
siteId: string,
|
||||
): Promise<void> {
|
||||
const commonOptions = {
|
||||
readingStrategy: CoreSitesReadingStrategy.ONLY_NETWORK,
|
||||
siteId,
|
||||
|
|
|
@ -269,7 +269,7 @@ export class AddonModQuizPrefetchHandlerService extends CoreCourseActivityPrefet
|
|||
*/
|
||||
async prefetch(
|
||||
module: SyncedModule,
|
||||
courseId?: number,
|
||||
courseId: number,
|
||||
single?: boolean,
|
||||
dirPath?: string,
|
||||
canStart: boolean = true,
|
||||
|
@ -282,9 +282,7 @@ export class AddonModQuizPrefetchHandlerService extends CoreCourseActivityPrefet
|
|||
return;
|
||||
}
|
||||
|
||||
const siteId = CoreSites.getCurrentSiteId();
|
||||
|
||||
return this.prefetchPackage(module, courseId, this.prefetchQuiz.bind(this, module, courseId, single, siteId, canStart));
|
||||
return this.prefetchPackage(module, courseId, this.prefetchQuiz.bind(this, module, courseId, !!single, canStart));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -293,16 +291,16 @@ export class AddonModQuizPrefetchHandlerService extends CoreCourseActivityPrefet
|
|||
* @param module Module.
|
||||
* @param courseId Course ID the module belongs to.
|
||||
* @param single True if we're downloading a single module, false if we're downloading a whole section.
|
||||
* @param siteId Site ID.
|
||||
* @param canStart If true, start a new attempt if needed.
|
||||
* @param siteId Site ID.
|
||||
* @return Promise resolved when done.
|
||||
*/
|
||||
protected async prefetchQuiz(
|
||||
module: CoreCourseAnyModuleData,
|
||||
courseId: number,
|
||||
single: boolean,
|
||||
siteId: string,
|
||||
canStart: boolean,
|
||||
siteId: string,
|
||||
): Promise<void> {
|
||||
const commonOptions = {
|
||||
readingStrategy: CoreSitesReadingStrategy.ONLY_NETWORK,
|
||||
|
|
|
@ -47,12 +47,10 @@ export class AddonModScormPrefetchHandlerService extends CoreCourseActivityPrefe
|
|||
dirPath?: string,
|
||||
onProgress?: AddonModScormProgressCallback,
|
||||
): Promise<void> {
|
||||
const siteId = CoreSites.getCurrentSiteId();
|
||||
|
||||
return this.prefetchPackage(
|
||||
module,
|
||||
courseId,
|
||||
this.downloadOrPrefetchScorm.bind(this, module, courseId, true, siteId, false, onProgress),
|
||||
this.downloadOrPrefetchScorm.bind(this, module, courseId, true, false, onProgress),
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -62,18 +60,18 @@ export class AddonModScormPrefetchHandlerService extends CoreCourseActivityPrefe
|
|||
* @param module Module.
|
||||
* @param courseId Course ID the module belongs to.
|
||||
* @param single True if we're downloading a single module, false if we're downloading a whole section.
|
||||
* @param siteId Site ID.
|
||||
* @param prefetch True to prefetch, false to download right away.
|
||||
* @param onProgress Function to call on progress.
|
||||
* @param siteId Site ID.
|
||||
* @return Promise resolved with the "extra" data to store: the hash of the file.
|
||||
*/
|
||||
protected async downloadOrPrefetchScorm(
|
||||
module: CoreCourseAnyModuleData,
|
||||
courseId: number,
|
||||
single: boolean,
|
||||
siteId: string,
|
||||
prefetch: boolean,
|
||||
onProgress?: AddonModScormProgressCallback,
|
||||
onProgress: AddonModScormProgressCallback | undefined,
|
||||
siteId: string,
|
||||
): Promise<string> {
|
||||
|
||||
const scorm = await this.getScorm(module, courseId, siteId);
|
||||
|
@ -370,12 +368,10 @@ export class AddonModScormPrefetchHandlerService extends CoreCourseActivityPrefe
|
|||
dirPath?: string,
|
||||
onProgress?: AddonModScormProgressCallback,
|
||||
): Promise<void> {
|
||||
const siteId = CoreSites.getCurrentSiteId();
|
||||
|
||||
return this.prefetchPackage(
|
||||
module,
|
||||
courseId,
|
||||
this.downloadOrPrefetchScorm.bind(this, module, courseId, single, siteId, true, onProgress),
|
||||
this.downloadOrPrefetchScorm.bind(this, module, courseId, single, true, onProgress),
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -67,7 +67,7 @@ export class AddonModSurveyPrefetchHandlerService extends CoreCourseActivityPref
|
|||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
prefetch(module: CoreCourseAnyModuleData, courseId?: number): Promise<void> {
|
||||
prefetch(module: CoreCourseAnyModuleData, courseId: number): Promise<void> {
|
||||
return this.prefetchPackage(module, courseId, this.prefetchSurvey.bind(this, module, courseId));
|
||||
}
|
||||
|
||||
|
|
|
@ -130,7 +130,7 @@ export class AddonModWikiPrefetchHandlerService extends CoreCourseActivityPrefet
|
|||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
async prefetch(module: CoreCourseAnyModuleData, courseId?: number, single?: boolean): Promise<void> {
|
||||
async prefetch(module: CoreCourseAnyModuleData, courseId: number, single?: boolean): Promise<void> {
|
||||
// Get the download time of the package before starting the download (otherwise we'd always get current time).
|
||||
const siteId = CoreSites.getCurrentSiteId();
|
||||
|
||||
|
@ -138,7 +138,12 @@ export class AddonModWikiPrefetchHandlerService extends CoreCourseActivityPrefet
|
|||
|
||||
const downloadTime = data?.downloadTime || 0;
|
||||
|
||||
return this.prefetchPackage(module, courseId, this.prefetchWiki.bind(this, module, courseId, single, downloadTime, siteId));
|
||||
return this.prefetchPackage(
|
||||
module,
|
||||
courseId,
|
||||
this.prefetchWiki.bind(this, module, courseId, !!single, downloadTime),
|
||||
siteId,
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -210,7 +210,7 @@ export class AddonModWorkshopPrefetchHandlerService extends CoreCourseActivityPr
|
|||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
prefetch(module: CoreCourseAnyModuleData, courseId?: number): Promise<void> {
|
||||
prefetch(module: CoreCourseAnyModuleData, courseId: number): Promise<void> {
|
||||
return this.prefetchPackage(module, courseId, this.prefetchWorkshop.bind(this, module, courseId));
|
||||
}
|
||||
|
||||
|
@ -258,9 +258,6 @@ export class AddonModWorkshopPrefetchHandlerService extends CoreCourseActivityPr
|
|||
* @return Promise resolved when done.
|
||||
*/
|
||||
protected async prefetchWorkshop(module: CoreCourseAnyModuleData, courseId: number, siteId: string): Promise<void> {
|
||||
|
||||
siteId = siteId || CoreSites.getCurrentSiteId();
|
||||
|
||||
const userIds: number[] = [];
|
||||
const commonOptions = {
|
||||
readingStrategy: CoreSitesReadingStrategy.ONLY_NETWORK,
|
||||
|
|
|
@ -78,8 +78,8 @@ export class CoreCourseActivityPrefetchHandlerBase extends CoreCourseModulePrefe
|
|||
*/
|
||||
async prefetchPackage(
|
||||
module: CoreCourseAnyModuleData,
|
||||
courseId: number | undefined,
|
||||
downloadFunction: () => Promise<string>,
|
||||
courseId: number,
|
||||
downloadFunction: (siteId: string) => Promise<string>,
|
||||
siteId?: string,
|
||||
): Promise<void> {
|
||||
siteId = siteId || CoreSites.getCurrentSiteId();
|
||||
|
@ -111,8 +111,8 @@ export class CoreCourseActivityPrefetchHandlerBase extends CoreCourseModulePrefe
|
|||
protected async changeStatusAndPrefetch(
|
||||
module: CoreCourseAnyModuleData,
|
||||
courseId: number | undefined,
|
||||
downloadFunction: () => Promise<string>,
|
||||
siteId?: string,
|
||||
downloadFunction: (siteId: string) => Promise<string>,
|
||||
siteId: string,
|
||||
): Promise<void> {
|
||||
try {
|
||||
await this.setDownloading(module.id, siteId);
|
||||
|
@ -125,7 +125,7 @@ export class CoreCourseActivityPrefetchHandlerBase extends CoreCourseModulePrefe
|
|||
]);
|
||||
|
||||
// Call the download function.
|
||||
let extra = await downloadFunction();
|
||||
let extra = await downloadFunction(siteId);
|
||||
|
||||
// Only accept string types.
|
||||
if (typeof extra != 'string') {
|
||||
|
|
|
@ -12,7 +12,6 @@
|
|||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
import { CoreError } from '@classes/errors/error';
|
||||
import { CoreNetworkError } from '@classes/errors/network-error';
|
||||
import { CoreFilterHelper } from '@features/filter/services/filter-helper';
|
||||
import { CoreApp } from '@services/app';
|
||||
|
@ -191,12 +190,7 @@ export class CoreCourseResourcePrefetchHandlerBase extends CoreCourseModulePrefe
|
|||
* @param dirPath Path of the directory where to store all the content files.
|
||||
* @return Promise resolved when done.
|
||||
*/
|
||||
prefetch(module: CoreCourseWSModule, courseId?: number, single?: boolean, dirPath?: string): Promise<void> {
|
||||
courseId = courseId || module.course;
|
||||
if (!courseId) {
|
||||
throw new CoreError('Course ID not supplied.');
|
||||
}
|
||||
|
||||
prefetch(module: CoreCourseWSModule, courseId: number, single?: boolean, dirPath?: string): Promise<void> {
|
||||
return this.downloadOrPrefetch(module, courseId, true, dirPath);
|
||||
}
|
||||
|
||||
|
|
|
@ -182,7 +182,7 @@ export class CoreCourseModulePrefetchDelegateService extends CoreDelegate<CoreCo
|
|||
if (!CoreFilepool.getPackageDownloadPromise(siteId, handler.component, module.id)) {
|
||||
// Not handled, the app was probably restarted or something weird happened.
|
||||
// Re-start download (files already on queue or already downloaded will be skipped).
|
||||
handler.prefetch(module);
|
||||
handler.prefetch(module, module.course!);
|
||||
}
|
||||
} else if (handler.determineStatus) {
|
||||
// The handler implements a determineStatus function. Apply it.
|
||||
|
@ -1403,7 +1403,7 @@ export interface CoreCourseModulePrefetchHandler extends CoreDelegateHandler {
|
|||
* @param dirPath Path of the directory where to store all the content files.
|
||||
* @return Promise resolved when done.
|
||||
*/
|
||||
prefetch(module: CoreCourseAnyModuleData, courseId?: number, single?: boolean, dirPath?: string): Promise<void>;
|
||||
prefetch(module: CoreCourseAnyModuleData, courseId: number, single?: boolean, dirPath?: string): Promise<void>;
|
||||
|
||||
/**
|
||||
* Download the module.
|
||||
|
|
|
@ -222,14 +222,11 @@ export class CoreSitePluginsModulePrefetchHandler extends CoreCourseActivityPref
|
|||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
prefetch(module: CoreCourseAnyModuleData, courseId?: number, single?: boolean, dirPath?: string): Promise<void> {
|
||||
const siteId = CoreSites.getCurrentSiteId();
|
||||
|
||||
prefetch(module: CoreCourseAnyModuleData, courseId: number, single?: boolean, dirPath?: string): Promise<void> {
|
||||
return this.prefetchPackage(
|
||||
module,
|
||||
courseId,
|
||||
this.downloadPrefetchPlugin.bind(this, module, courseId, true, dirPath, siteId),
|
||||
siteId,
|
||||
this.downloadPrefetchPlugin.bind(this, module, courseId, true, dirPath),
|
||||
);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue