MOBILE-2334 assign: Fix errors with file submission plugin
parent
6ca648c46d
commit
88c05ac157
|
@ -224,7 +224,7 @@ export class AddonModAssignSubmissionDelegate extends CoreDelegate {
|
|||
* @param {any} inputData Data entered by the user for the submission.
|
||||
*/
|
||||
clearTmpData(assign: any, submission: any, plugin: any, inputData: any): void {
|
||||
return this.executeFunctionOnEnabled(plugin.type, 'return', [assign, submission, plugin, inputData]);
|
||||
return this.executeFunctionOnEnabled(plugin.type, 'clearTmpData', [assign, submission, plugin, inputData]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -212,7 +212,7 @@ export const CORE_PROVIDERS: any[] = [
|
|||
})
|
||||
export class AppModule {
|
||||
constructor(platform: Platform, initDelegate: CoreInitDelegate, updateManager: CoreUpdateManagerProvider,
|
||||
sitesProvider: CoreSitesProvider) {
|
||||
sitesProvider: CoreSitesProvider, fileProvider: CoreFileProvider) {
|
||||
// Register a handler for platform ready.
|
||||
initDelegate.registerProcess({
|
||||
name: 'CorePlatformReady',
|
||||
|
@ -232,6 +232,14 @@ export class AppModule {
|
|||
load: sitesProvider.restoreSession.bind(sitesProvider)
|
||||
});
|
||||
|
||||
// Register clear app tmp folder.
|
||||
initDelegate.registerProcess({
|
||||
name: 'CoreClearTmpFolder',
|
||||
priority: CoreInitDelegate.MAX_RECOMMENDED_PRIORITY + 150,
|
||||
blocking: false,
|
||||
load: fileProvider.clearTmpFolder.bind(fileProvider)
|
||||
});
|
||||
|
||||
// Execute the init processes.
|
||||
initDelegate.executeInitProcesses();
|
||||
}
|
||||
|
|
|
@ -127,9 +127,9 @@ export class CoreAttachmentsComponent implements OnInit {
|
|||
* A file was renamed.
|
||||
*
|
||||
* @param {number} index Index of the file.
|
||||
* @param {any} file The new file entry.
|
||||
* @param {any} data The data received.
|
||||
*/
|
||||
renamed(index: number, file: any): void {
|
||||
this.files[index] = file;
|
||||
renamed(index: number, data: any): void {
|
||||
this.files[index] = data.file;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -120,11 +120,6 @@ export class CoreLocalFileComponent implements OnInit {
|
|||
e.stopPropagation();
|
||||
this.editMode = true;
|
||||
this.newFileName = this.file.name;
|
||||
|
||||
// @todo For some reason core-auto-focus isn't working right. Focus the input manually.
|
||||
// $timeout(function() {
|
||||
// $mmUtil.focusElement(element[0].querySelector('input'));
|
||||
// });
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -159,8 +154,8 @@ export class CoreLocalFileComponent implements OnInit {
|
|||
this.file = fileEntry;
|
||||
this.loadFileBasicData();
|
||||
this.onRename.emit({ file: this.file });
|
||||
}).catch(() => {
|
||||
this.domUtils.showErrorModal('core.errorrenamefile', true);
|
||||
}).catch((error) => {
|
||||
this.domUtils.showErrorModalDefault(error, 'core.errorrenamefile', true);
|
||||
});
|
||||
}).finally(() => {
|
||||
modal.dismiss();
|
||||
|
|
|
@ -74,6 +74,8 @@ export class FileMock extends File {
|
|||
*/
|
||||
private copyMock(srce: Entry, destDir: DirectoryEntry, newName: string): Promise<Entry> {
|
||||
return new Promise<Entry>((resolve, reject): void => {
|
||||
newName = newName.replace(/%20/g, ' '); // Replace all %20 with spaces.
|
||||
|
||||
srce.copyTo(destDir, newName, (deste) => {
|
||||
resolve(deste);
|
||||
}, (err) => {
|
||||
|
@ -212,6 +214,8 @@ export class FileMock extends File {
|
|||
getDirectory(directoryEntry: DirectoryEntry, directoryName: string, flags: Flags): Promise<DirectoryEntry> {
|
||||
return new Promise<DirectoryEntry>((resolve, reject): void => {
|
||||
try {
|
||||
directoryName = directoryName.replace(/%20/g, ' '); // Replace all %20 with spaces.
|
||||
|
||||
directoryEntry.getDirectory(directoryName, flags, (de) => {
|
||||
resolve(de);
|
||||
}, (err) => {
|
||||
|
@ -235,6 +239,8 @@ export class FileMock extends File {
|
|||
getFile(directoryEntry: DirectoryEntry, fileName: string, flags: Flags): Promise<FileEntry> {
|
||||
return new Promise<FileEntry>((resolve, reject): void => {
|
||||
try {
|
||||
fileName = fileName.replace(/%20/g, ' '); // Replace all %20 with spaces.
|
||||
|
||||
directoryEntry.getFile(fileName, flags, resolve, (err) => {
|
||||
this.fillErrorMessageMock(err);
|
||||
reject(err);
|
||||
|
@ -375,6 +381,8 @@ export class FileMock extends File {
|
|||
*/
|
||||
private moveMock(srce: Entry, destDir: DirectoryEntry, newName: string): Promise<Entry> {
|
||||
return new Promise<Entry>((resolve, reject): void => {
|
||||
newName = newName.replace(/%20/g, ' '); // Replace all %20 with spaces.
|
||||
|
||||
srce.moveTo(destDir, newName, (deste) => {
|
||||
resolve(deste);
|
||||
}, (err) => {
|
||||
|
|
|
@ -56,16 +56,16 @@ export class CoreAutoFocusDirective implements OnInit {
|
|||
protected autoFocus(): void {
|
||||
const autoFocus = this.utils.isTrueOrOne(this.coreAutoFocus);
|
||||
if (autoFocus) {
|
||||
// If it's a ion-input or ion-textarea, search the right input to use.
|
||||
let element = this.element;
|
||||
if (this.element.tagName == 'ION-INPUT') {
|
||||
element = this.element.querySelector('input') || element;
|
||||
} else if (this.element.tagName == 'ION-TEXTAREA') {
|
||||
element = this.element.querySelector('textarea') || element;
|
||||
}
|
||||
|
||||
// Wait a bit to make sure the view is loaded.
|
||||
setTimeout(() => {
|
||||
// If it's a ion-input or ion-textarea, search the right input to use.
|
||||
let element = this.element;
|
||||
if (this.element.tagName == 'ION-INPUT') {
|
||||
element = this.element.querySelector('input') || element;
|
||||
} else if (this.element.tagName == 'ION-TEXTAREA') {
|
||||
element = this.element.querySelector('textarea') || element;
|
||||
}
|
||||
|
||||
this.domUtils.focusElement(element);
|
||||
}, 200);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue