Merge pull request #3123 from dpalou/MOBILE-3799

Mobile 3799
main
Pau Ferrer Ocaña 2022-02-16 14:53:20 +01:00 committed by GitHub
commit 24d2a6aa76
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 1466 additions and 971 deletions

2384
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -86,7 +86,7 @@
"@types/dom-mediacapture-record": "^1.0.7",
"chart.js": "^2.9.4",
"com-darryncampbell-cordova-plugin-intent": "^2.2.0",
"cordova": "^10.0.0",
"cordova": "^11.0.0",
"cordova-android": "^10.1.1",
"cordova-clipboard": "^1.3.0",
"cordova-ios": "^6.2.0",

View File

@ -706,6 +706,7 @@
"addon.mod_h5pactivity.attempt_success_unknown": "h5pactivity",
"addon.mod_h5pactivity.attempts": "h5pactivity",
"addon.mod_h5pactivity.attempts_none": "h5pactivity",
"addon.mod_h5pactivity.attempts_report": "h5pactivity",
"addon.mod_h5pactivity.completion": "h5pactivity",
"addon.mod_h5pactivity.downloadh5pfile": "local_moodlemobileapp",
"addon.mod_h5pactivity.duration": "h5pactivity",
@ -722,8 +723,6 @@
"addon.mod_h5pactivity.previewmode": "h5pactivity",
"addon.mod_h5pactivity.result_fill-in": "h5pactivity",
"addon.mod_h5pactivity.result_other": "h5pactivity",
"addon.mod_h5pactivity.review_attempts": "local_moodlemobileapp",
"addon.mod_h5pactivity.review_my_attempts": "h5pactivity",
"addon.mod_h5pactivity.review_user_attempts": "h5pactivity",
"addon.mod_h5pactivity.score": "h5pactivity",
"addon.mod_h5pactivity.score_out_of": "h5pactivity",

View File

@ -2,10 +2,10 @@
<core-navbar-buttons slot="end">
<core-context-menu>
<core-context-menu-item *ngIf="h5pActivity && h5pActivity.enabletracking && accessInfo && !accessInfo.canreviewattempts"
[priority]="1000" [content]="'addon.mod_h5pactivity.review_my_attempts' | translate" (action)="viewMyAttempts()"
[priority]="1000" [content]="'addon.mod_h5pactivity.attempts_report' | translate" (action)="viewMyAttempts()"
iconAction="stats-chart">
</core-context-menu-item>
<core-context-menu-item *ngIf="canViewAllAttempts" [priority]="1000" [content]="'addon.mod_h5pactivity.review_attempts' | translate"
<core-context-menu-item *ngIf="canViewAllAttempts" [priority]="1000" [content]="'addon.mod_h5pactivity.attempts_report' | translate"
(action)="viewAllAttempts()" iconAction="stats-chart">
</core-context-menu-item>
<core-context-menu-item *ngIf="externalUrl" [priority]="900" [content]="'core.openinbrowser' | translate" [href]="externalUrl"

View File

@ -13,6 +13,7 @@
"attempt_success_unknown": "Not reported",
"attempts": "Attempts",
"attempts_none": "This user has no attempts to display.",
"attempts_report": "Attempts report",
"completion": "Completion",
"downloadh5pfile": "Download H5P file",
"duration": "Duration",
@ -29,8 +30,6 @@
"previewmode": "This content is displayed in preview mode. No attempt tracking will be stored.",
"result_fill-in": "Fill-in text",
"result_other": "Unknown interaction type",
"review_attempts": "View all attempts",
"review_my_attempts": "View my attempts",
"review_user_attempts": "View user attempts ({{$a}})",
"score": "Score",
"score_out_of": "{{$a.rawscore}} out of {{$a.maxscore}}",

View File

@ -58,7 +58,7 @@ export class CoreIframeComponent implements OnChanges, OnDestroy {
protected orientationObs?: CoreEventObserver;
protected navSubscription?: Subscription;
constructor() {
constructor(protected elementRef: ElementRef<HTMLElement>) {
this.loaded = new EventEmitter<HTMLIFrameElement>();
}
@ -104,6 +104,10 @@ export class CoreIframeComponent implements OnChanges, OnDestroy {
this.toggleFullscreen(CoreScreen.isLandscape);
this.orientationObs = CoreEvents.on(CoreEvents.ORIENTATION_CHANGE, (data) => {
if (this.isInHiddenPage()) {
return;
}
this.toggleFullscreen(data.orientation == CoreScreenOrientation.LANDSCAPE);
});
}
@ -131,6 +135,16 @@ export class CoreIframeComponent implements OnChanges, OnDestroy {
}
}
/**
* Check if the element is in a hidden page.
*
* @return Whether the element is in a hidden page.
*/
protected isInHiddenPage(): boolean {
// If we can't find the parent ion-page, consider it to be hidden too.
return !this.elementRef.nativeElement.closest('.ion-page') || !!this.elementRef.nativeElement.closest('.ion-page-hidden');
}
/**
* Detect changes on input properties.
*/

View File

@ -386,10 +386,10 @@ export class CoreFilepoolProvider {
const file = await this.fixPluginfileURL(siteId, fileUrl);
fileUrl = CoreFileHelper.getFileUrl(file);
timemodified = file.timemodified || timemodified;
timemodified = file.timemodified ?? timemodified;
}
revision = revision || this.getRevisionFromUrl(fileUrl);
revision = revision ?? this.getRevisionFromUrl(fileUrl);
const fileId = this.getFileIdByUrl(fileUrl);
const primaryKey = { siteId, fileId };
@ -1032,11 +1032,10 @@ export class CoreFilepoolProvider {
const file = await this.fixPluginfileURL(siteId, fileUrl);
fileUrl = CoreFileHelper.getFileUrl(file);
timemodified = file.timemodified || timemodified;
options = Object.assign({}, options); // Create a copy to prevent modifying the original object.
options.timemodified = timemodified || 0;
options.revision = revision || this.getRevisionFromUrl(fileUrl);
options.timemodified = file.timemodified ?? timemodified ?? 0;
options.revision = revision ?? this.getRevisionFromUrl(fileUrl);
const fileId = this.getFileIdByUrl(fileUrl);
const links = this.createComponentLinks(component, componentId);
@ -1506,8 +1505,8 @@ export class CoreFilepoolProvider {
}
fileUrl = CoreUrl.removeUrlAnchor(CoreFileHelper.getFileUrl(file));
timemodified = file.timemodified || timemodified;
revision = revision || this.getRevisionFromUrl(fileUrl);
timemodified = file.timemodified ?? timemodified;
revision = revision ?? this.getRevisionFromUrl(fileUrl);
const fileId = this.getFileIdByUrl(fileUrl);
try {
@ -1592,8 +1591,8 @@ export class CoreFilepoolProvider {
const file = await this.fixPluginfileURL(siteId, fileUrl, timemodified);
fileUrl = CoreFileHelper.getFileUrl(file);
timemodified = file.timemodified || timemodified;
revision = revision || this.getRevisionFromUrl(fileUrl);
timemodified = file.timemodified ?? timemodified;
revision = revision ?? this.getRevisionFromUrl(fileUrl);
const fileId = this.getFileIdByUrl(fileUrl);
try {
@ -2566,10 +2565,10 @@ export class CoreFilepoolProvider {
const fileId = item.fileId;
const fileUrl = item.url;
const options = {
revision: item.revision || undefined,
timemodified: item.timemodified || undefined,
isexternalfile: item.isexternalfile || undefined,
repositorytype: item.repositorytype || undefined,
revision: item.revision ?? undefined,
timemodified: item.timemodified ?? undefined,
isexternalfile: item.isexternalfile ?? undefined,
repositorytype: item.repositorytype ?? undefined,
};
const filePath = item.path || undefined;
const links = item.linksUnserialized || [];