Skip to content

Commit

Permalink
Merge pull request #3918 from dpalou/MOBILE-4492
Browse files Browse the repository at this point in the history
Mobile 4492
  • Loading branch information
alfonso-salces authored Jan 31, 2024
2 parents c60f792 + bcbd315 commit a9cad65
Show file tree
Hide file tree
Showing 19 changed files with 146 additions and 96 deletions.
138 changes: 82 additions & 56 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 10 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,10 @@
"@ionic/angular": "^7.6.5",
"@ionic/cordova-builders": "^10.1.1",
"@moodlehq/cordova-plugin-advanced-http": "3.3.1-moodle.1",
"@moodlehq/cordova-plugin-camera": "6.0.0-moodle.2",
"@moodlehq/cordova-plugin-file-transfer": "1.7.1-moodle.5",
"@moodlehq/cordova-plugin-file-opener": "4.0.0-moodle.1",
"@moodlehq/cordova-plugin-file-transfer": "2.0.0-moodle.2",
"@moodlehq/cordova-plugin-inappbrowser": "5.0.0-moodle.3",
"@moodlehq/cordova-plugin-intent": "2.2.0-moodle.2",
"@moodlehq/cordova-plugin-intent": "2.2.0-moodle.3",
"@moodlehq/cordova-plugin-ionic-webview": "5.0.0-moodle.3",
"@moodlehq/cordova-plugin-local-notification": "0.9.0-moodle.11",
"@moodlehq/cordova-plugin-qrscanner": "3.0.1-moodle.5",
Expand All @@ -101,14 +101,14 @@
"cordova-plugin-add-swift-support": "^2.0.2",
"cordova-plugin-androidx-adapter": "^1.1.3",
"cordova-plugin-badge": "^0.8.9",
"cordova-plugin-camera": "^7.0.0",
"cordova-plugin-chooser": "^1.3.2",
"cordova-plugin-customurlscheme": "^5.0.2",
"cordova-plugin-device": "^2.1.0",
"cordova-plugin-file": "6.0.2",
"cordova-plugin-file-opener2": "^4.0.0",
"cordova-plugin-file": "^8.0.1",
"cordova-plugin-geolocation": "^5.0.0",
"cordova-plugin-ionic-keyboard": "^2.2.0",
"cordova-plugin-media-capture": "3.0.3",
"cordova-plugin-media-capture": "^5.0.0",
"cordova-plugin-network-information": "^3.0.0",
"cordova-plugin-prevent-override": "^1.0.1",
"cordova-plugin-screen-orientation": "^3.0.4",
Expand Down Expand Up @@ -196,9 +196,7 @@
"@moodlehq/cordova-plugin-advanced-http": {
"ANDROIDBLACKLISTSECURESOCKETPROTOCOLS": "SSLv3,TLSv1"
},
"@moodlehq/cordova-plugin-camera": {
"ANDROIDX_CORE_VERSION": "1.6.+"
},
"@moodlehq/cordova-plugin-file-opener": {},
"@moodlehq/cordova-plugin-file-transfer": {},
"@moodlehq/cordova-plugin-inappbrowser": {},
"@moodlehq/cordova-plugin-intent": {},
Expand All @@ -216,6 +214,9 @@
"cordova-clipboard": {},
"cordova-plugin-androidx-adapter": {},
"cordova-plugin-badge": {},
"cordova-plugin-camera": {
"ANDROIDX_CORE_VERSION": "1.6.+"
},
"cordova-plugin-chooser": {},
"cordova-plugin-customurlscheme": {
"URL_SCHEME": "moodlemobile",
Expand All @@ -224,7 +225,6 @@
"ANDROID_PATHPREFIX": "/"
},
"cordova-plugin-device": {},
"cordova-plugin-file-opener2": {},
"cordova-plugin-geolocation": {
"GPS_REQUIRED": "false"
},
Expand Down
3 changes: 2 additions & 1 deletion src/addons/mod/data/fields/picture/component/picture.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import { CoreFileEntry, CoreFileHelper } from '@services/file-helper';
import { CoreFileSession } from '@services/file-session';
import { CoreDomUtils } from '@services/utils/dom';
import { AddonModDataFieldPluginBaseComponent } from '../../../classes/base-field-plugin-component';
import { CoreFile } from '@services/file';

/**
* Component to render data picture field.
Expand Down Expand Up @@ -129,7 +130,7 @@ export class AddonModDataFieldPictureComponent extends AddonModDataFieldPluginBa
setTimeout(() => {
if (this.image) {
this.imageUrl = 'name' in this.image
? this.image.toURL() // Is Offline.
? CoreFile.getFileEntryURL(this.image) // Is Offline.
: CoreFileHelper.getFileUrl(this.image);
}
}, 1);
Expand Down
2 changes: 1 addition & 1 deletion src/addons/mod/lti/services/lti.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ export class AddonModLtiProvider {

const entry = await CoreFile.writeFile(LAUNCHER_FILE_NAME, text);

return entry.toURL();
return CoreFile.getFileEntryURL(entry);
}

/**
Expand Down
4 changes: 2 additions & 2 deletions src/core/components/local-file/local-file.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ export class CoreLocalFileComponent implements OnInit {
this.fileExtension = CoreMimetypeUtils.getFileExtension(file.name);

// Let's calculate the relative path for the file.
this.relativePath = CoreFile.removeBasePath(file.toURL());
this.relativePath = CoreFile.removeBasePath(CoreFile.getFileEntryURL(file));
if (!this.relativePath) {
// Didn't find basePath, use fullPath but if the user tries to manage the file it'll probably fail.
this.relativePath = file.fullPath;
Expand Down Expand Up @@ -139,7 +139,7 @@ export class CoreLocalFileComponent implements OnInit {
options.iOSOpenFileAction = this.defaultIsOpenWithPicker ? OpenFileAction.OPEN : OpenFileAction.OPEN_WITH;
}

CoreUtils.openFile(this.file.toURL(), options);
CoreUtils.openFile(CoreFile.getFileEntryURL(this.file), options);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,7 @@ export class CoreEmulatorCaptureMediaComponent implements OnInit, OnDestroy {
const fileEntry = await CoreFile.writeFile(this.getFilePath(), this.mediaBlob);

if (this.isImage && !this.isCaptureImage) {
this.dismissWithData(fileEntry.toURL());
this.dismissWithData(CoreFile.getFileEntryURL(fileEntry));
} else {
// The capture plugin should return a MediaFile, not a FileEntry. Convert it.
const metadata = await CoreFile.getMetadata(fileEntry);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ export class CoreFileUploaderAudioRecorderComponent extends CoreModalComponent<C

this.close({
name: fileEntry.name,
fullPath: fileEntry.toURL(),
fullPath: CoreFile.getFileEntryURL(fileEntry),
type: 'audio/mpeg',
});
} catch (error) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ export class CoreFileUploaderHelperProvider {

if (upload) {
// Pass true to delete the copy after the upload.
return this.uploadGenericFile(fileEntry.toURL(), name, file.type, true);
return this.uploadGenericFile(CoreFile.getFileEntryURL(fileEntry), name, file.type, true);
} else {
return fileEntry;
}
Expand Down Expand Up @@ -455,7 +455,7 @@ export class CoreFileUploaderHelperProvider {

await this.confirmUploadFile(file.size);

await this.uploadGenericFile(fileEntry.toURL(), file.name, file.type, deleteAfterUpload, siteId);
await this.uploadGenericFile(CoreFile.getFileEntryURL(fileEntry), file.name, file.type, deleteAfterUpload, siteId);

CoreDomUtils.showToast('core.fileuploader.fileuploaded', true, undefined, 'core-toast-success');
} catch (error) {
Expand Down
Loading

0 comments on commit a9cad65

Please sign in to comment.