MOBILE-2901 file: Support offline files for Nextcloud
parent
13a9dab037
commit
38b1308f0b
|
@ -113,7 +113,8 @@ export class AddonModResourceHelperProvider {
|
||||||
* @return {boolean} Whether the resource should be displayed embeded.
|
* @return {boolean} Whether the resource should be displayed embeded.
|
||||||
*/
|
*/
|
||||||
isDisplayedEmbedded(module: any, display: number): boolean {
|
isDisplayedEmbedded(module: any, display: number): boolean {
|
||||||
if (!module.contents.length || !this.fileProvider.isAvailable() || this.isNextcloudFile(module)) {
|
if (!module.contents.length || !this.fileProvider.isAvailable() ||
|
||||||
|
(!this.sitesProvider.getCurrentSite().isVersionGreaterEqualThan('3.7') && this.isNextcloudFile(module))) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -130,7 +130,12 @@ export class AddonModResourcePrefetchHandler extends CoreCourseResourcePrefetchH
|
||||||
* @return {Promise<boolean>} Promise resolved with true if downloadable, resolved with false otherwise.
|
* @return {Promise<boolean>} Promise resolved with true if downloadable, resolved with false otherwise.
|
||||||
*/
|
*/
|
||||||
isDownloadable(module: any, courseId: number): Promise<boolean> {
|
isDownloadable(module: any, courseId: number): Promise<boolean> {
|
||||||
// Don't allow downloading Nextcloud files for now.
|
if (this.sitesProvider.getCurrentSite().isVersionGreaterEqualThan('3.7')) {
|
||||||
|
// Nextcloud files are downloadable from 3.7 onwards.
|
||||||
|
return Promise.resolve(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Don't allow downloading Nextcloud files in older sites.
|
||||||
return this.loadContents(module, courseId, false).then(() => {
|
return this.loadContents(module, courseId, false).then(() => {
|
||||||
return !this.resourceHelper.isNextcloudFile(module);
|
return !this.resourceHelper.isNextcloudFile(module);
|
||||||
});
|
});
|
||||||
|
|
|
@ -1342,6 +1342,7 @@
|
||||||
"core.favourites": "Starred",
|
"core.favourites": "Starred",
|
||||||
"core.filename": "Filename",
|
"core.filename": "Filename",
|
||||||
"core.filenameexist": "File name already exists: {{$a}}",
|
"core.filenameexist": "File name already exists: {{$a}}",
|
||||||
|
"core.filenotfound": "File not found, sorry.",
|
||||||
"core.fileuploader.addfiletext": "Add file",
|
"core.fileuploader.addfiletext": "Add file",
|
||||||
"core.fileuploader.audio": "Audio",
|
"core.fileuploader.audio": "Audio",
|
||||||
"core.fileuploader.camera": "Camera",
|
"core.fileuploader.camera": "Camera",
|
||||||
|
|
|
@ -176,7 +176,8 @@ export class CoreSite {
|
||||||
3.3: 2017051503,
|
3.3: 2017051503,
|
||||||
3.4: 2017111300,
|
3.4: 2017111300,
|
||||||
3.5: 2018051700,
|
3.5: 2018051700,
|
||||||
3.6: 2018120300
|
3.6: 2018120300,
|
||||||
|
3.7: 2019030700 // @todo: Replace it with the right 3.7 date when released
|
||||||
};
|
};
|
||||||
|
|
||||||
// Rest of variables.
|
// Rest of variables.
|
||||||
|
|
|
@ -86,12 +86,15 @@ export class CoreCourseModuleComponent implements OnInit, OnDestroy {
|
||||||
if (data.componentId === this.module.id && this.prefetchHandler &&
|
if (data.componentId === this.module.id && this.prefetchHandler &&
|
||||||
data.component === this.prefetchHandler.component) {
|
data.component === this.prefetchHandler.component) {
|
||||||
|
|
||||||
|
// Call determineModuleStatus to get the right status to display.
|
||||||
|
const status = this.prefetchDelegate.determineModuleStatus(this.module, data.status);
|
||||||
|
|
||||||
if (this.downloadEnabled) {
|
if (this.downloadEnabled) {
|
||||||
// Download is enabled, show the status.
|
// Download is enabled, show the status.
|
||||||
this.showStatus(data.status);
|
this.showStatus(status);
|
||||||
} else if (this.module.handlerData.updateStatus) {
|
} else if (this.module.handlerData.updateStatus) {
|
||||||
// Download isn't enabled but the handler defines a updateStatus function, call it anyway.
|
// Download isn't enabled but the handler defines a updateStatus function, call it anyway.
|
||||||
this.module.handlerData.updateStatus(data.status);
|
this.module.handlerData.updateStatus(status);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, this.sitesProvider.getCurrentSiteId());
|
}, this.sitesProvider.getCurrentSiteId());
|
||||||
|
|
|
@ -377,6 +377,8 @@ export class CoreCourseModulePrefetchDelegate extends CoreDelegate {
|
||||||
}
|
}
|
||||||
} else if (handler.determineStatus) {
|
} else if (handler.determineStatus) {
|
||||||
// The handler implements a determineStatus function. Apply it.
|
// The handler implements a determineStatus function. Apply it.
|
||||||
|
canCheck = canCheck || this.canCheckUpdates();
|
||||||
|
|
||||||
return handler.determineStatus(module, status, canCheck);
|
return handler.determineStatus(module, status, canCheck);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue