Merge pull request #3728 from NoelDeMartin/MOBILE-4362

MOBILE-4362: Tweaks
main
Pau Ferrer Ocaña 2023-07-11 15:11:26 +02:00 committed by GitHub
commit 2c881793e9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
19 changed files with 36 additions and 16 deletions

View File

@ -110,4 +110,13 @@
],
"description": "[Moodle] Create a Pure Singleton"
},
"Innherit doc": {
"prefix": "inheritdoc",
"body": [
"/**",
" * @inheritdoc",
" */"
],
"description": "Add @inheritdoc documentation block"
}
}

View File

@ -156,6 +156,7 @@
}
},
"cli": {
"analytics": false,
"defaultCollection": "@ionic/angular-toolkit"
},
"schematics": {

View File

@ -18,6 +18,7 @@
<allow-intent href="sms:*" />
<allow-intent href="mailto:*" />
<allow-intent href="geo:*" />
<hook src="scripts/cordova-hooks/before_plugin_add.sh" type="before_plugin_add" />
<preference name="permissions" value="none" />
<preference name="orientation" value="default" />
<preference name="target-device" value="universal" />

View File

@ -39,7 +39,7 @@
"ionic:serve:before": "gulp",
"ionic:serve": "cross-env-shell ./scripts/serve.sh",
"ionic:build:before": "gulp",
"postinstall": "patch-package",
"postinstall": "patch-package && cd cordova-plugin-moodleapp && npm install",
"lang:update-langpacks": "./scripts/update_langpacks.sh",
"lang:detect-langpacks": "./scripts/update_langpacks.sh detect",
"lang:create-langindex": "./scripts/create_langindex.sh"

View File

@ -0,0 +1,8 @@
#!/bin/bash
if [[ $CORDOVA_PLUGINS == *cordova-plugin-moodleapp* ]]; then
echo "Building cordova-plugin-moodleapp"
cd cordova-plugin-moodleapp
npm run prod
fi

View File

@ -22,7 +22,7 @@ function copy_lang {
lang=$1
index_keys=$(jq -r 'to_entries[] | "\"\(.key)\","' langindex.json)
index_keys=$(echo "$index_keys" | sed 's/,*$//')
index_keys=${index_keys:0:-1}
hyphenlang=${lang/_/-}
langfilepath=$LANG_PATH/$hyphenlang.json

View File

@ -447,7 +447,7 @@ export class AddonModQuizPrefetchHandlerService extends CoreCourseActivityPrefet
if (attempt.state == AddonModQuizProvider.ATTEMPT_IN_PROGRESS) {
// Get data for each page.
promises = promises.concat(pages.map(async (page) => {
if (isSequential && attempt.currentpage && page < attempt.currentpage) {
if (isSequential && typeof attempt.currentpage === 'number' && page < attempt.currentpage) {
// Sequential quiz, cannot get pages before the current one.
return;
}

View File

@ -24,7 +24,7 @@ import { CoreCaptureError } from './captureerror';
import { CoreNetworkError } from './network-error';
import { CoreSiteError } from './siteerror';
import { CoreLoginError } from './loginerror';
import { CoreErrorWithOptions } from './errorwithtitle';
import { CoreErrorWithOptions } from './errorwithoptions';
import { CoreHttpError } from './httperror';
export const CORE_ERRORS_CLASSES: Type<unknown>[] = [

View File

@ -7,8 +7,7 @@
<core-navbar-buttons slot="end" prepend *ngIf="initialized && showFullscreenOnToolbar && !loading">
<ion-button fill="clear" (click)="toggleFullscreen()"
[attr.aria-label]="(fullscreen ? 'core.disablefullscreen' : 'core.fullscreen') | translate">
<ion-icon *ngIf="!fullscreen" name="fas-expand" slot="icon-only" aria-hidden="true"></ion-icon>
<ion-icon *ngIf="fullscreen" name="fas-compress" slot="icon-only" aria-hidden="true"></ion-icon>
<ion-icon [name]="fullscreen ? 'fas-compress' : 'fas-expand'" slot="icon-only" aria-hidden="true"></ion-icon>
</ion-button>
</core-navbar-buttons>

View File

@ -144,7 +144,7 @@ export class CoreCourseSummaryPage implements OnInit, OnDestroy {
// Don't allow guest access if it requires a password if not supported.
this.guestAccessPasswordRequired = info.passwordrequired;
return info.status === true && (!info.passwordrequired || CoreCourses.isValidateGuestAccessPasswordAvailable());
return info.status && (!info.passwordrequired || CoreCourses.isValidateGuestAccessPasswordAvailable());
}
/**
@ -193,7 +193,7 @@ export class CoreCourseSummaryPage implements OnInit, OnDestroy {
const enrolmentMethods = await CoreCourses.getCourseEnrolmentMethods(this.courseId);
enrolmentMethods.forEach((method) => {
if (!method.status) {
if (!CoreUtils.isTrueOrOne(method.status)) {
return;
}

View File

@ -634,8 +634,7 @@ export class CoreCourseHelperProvider {
// Don't allow guest access if it requires a password and it's available.
return {
guestAccess: info.status === true &&
(!info.passwordrequired || CoreCourses.isValidateGuestAccessPasswordAvailable()),
guestAccess: info.status && (!info.passwordrequired || CoreCourses.isValidateGuestAccessPasswordAvailable()),
passwordRequired: info.passwordrequired,
};
} catch {

View File

@ -98,8 +98,8 @@ Feature: Test basic usage of one course in app
And I should find "Test scorm name" in the app
And I should find "Test workshop name" in the app
When I set "page-core-course-index .core-course-thumb" styles to "--course-color" "lightblue"
And I set "page-core-course-index .core-course-thumb" styles to "--course-color-tint" "white"
When I set "page-core-course-index .core-course-thumb" styles to "background" "lightblue"
And I set "page-core-course-index .core-course-thumb img" styles to "display" "none"
Then the UI should match the snapshot
When I press "Choice course 1" in the app

Binary file not shown.

Before

Width:  |  Height:  |  Size: 37 KiB

After

Width:  |  Height:  |  Size: 34 KiB

View File

@ -1827,7 +1827,6 @@ export type CoreCourseEnrolmentInfo = {
courseid: number; // Id of course.
type: string; // Type of enrolment plugin.
name: string; // Name of enrolment plugin.
status: boolean | string; // Available status of enrolment plugin. True if successful, else error message or false.
};
/**
@ -1835,6 +1834,7 @@ export type CoreCourseEnrolmentInfo = {
*/
export type CoreCourseEnrolmentMethod = CoreCourseEnrolmentInfo & {
wsfunction?: string; // Webservice function to get more information.
status: string; // Status of enrolment plugin. True if successful, else error message or false.
};
/**
@ -1877,6 +1877,7 @@ export type CoreCourseGetRecentCoursesOptions = CoreSitesCommonWSOptions & {
*/
export type CoreCourseEnrolmentGuestMethod = CoreCourseEnrolmentInfo & {
passwordrequired: boolean; // Is a password required?
status: boolean; // Is the enrolment enabled?
};
/**

View File

@ -241,7 +241,7 @@ export class CoreCoursesCourseLinkHandlerService extends CoreContentLinksHandler
let isSelfEnrolEnabled = false;
let instances = 0;
methods.forEach((method) => {
if (method.type == 'self' && method.status) {
if (method.type == 'self' && CoreUtils.isTrueOrOne(method.status)) {
isSelfEnrolEnabled = true;
instances++;
}

View File

@ -47,6 +47,8 @@ export class CoreLoginSitesPage implements OnInit {
async ngOnInit(): Promise<void> {
if (CoreNavigator.getRouteBooleanParam('openAddSite')) {
this.add();
return;
}
this.accountsList = await CoreLoginHelper.getAccountsList();

View File

@ -51,7 +51,7 @@ import { CoreRedirectPayload } from './navigator';
import { CoreSitesFactory } from './sites-factory';
import { CoreText } from '@singletons/text';
import { CoreLoginHelper } from '@features/login/services/login-helper';
import { CoreErrorWithOptions } from '@classes/errors/errorwithtitle';
import { CoreErrorWithOptions } from '@classes/errors/errorwithoptions';
import { CoreAjaxError } from '@classes/errors/ajaxerror';
import { CoreAjaxWSError } from '@classes/errors/ajaxwserror';
import { CoreSitePlugins } from '@features/siteplugins/services/siteplugins';

View File

@ -35,7 +35,7 @@ import { CoreWindow } from '@singletons/window';
import { CoreColors } from '@singletons/colors';
import { CorePromisedValue } from '@classes/promised-value';
import { CorePlatform } from '@services/platform';
import { CoreErrorWithOptions } from '@classes/errors/errorwithtitle';
import { CoreErrorWithOptions } from '@classes/errors/errorwithoptions';
import { CoreFilepool } from '@services/filepool';
import { CoreSites } from '@services/sites';
import { CoreCancellablePromise } from '@classes/cancellable-promise';