Merge pull request #4093 from dpalou/MOBILE-4470

Mobile 4470
main
Pau Ferrer Ocaña 2024-06-12 11:49:54 +02:00 committed by GitHub
commit 70a02ba702
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 24 additions and 16 deletions

View File

@ -1,5 +1,5 @@
<?xml version='1.0' encoding='utf-8'?>
<widget android-versionCode="44000" id="com.moodle.moodlemobile" ios-CFBundleVersion="4.4.0.0" version="4.4.0" versionCode="44000" xmlns="http://www.w3.org/ns/widgets" xmlns:android="http://schemas.android.com/apk/res/android" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<widget android-versionCode="44001" id="com.moodle.moodlemobile" ios-CFBundleVersion="4.4.0.1" version="4.4.0" versionCode="44001" xmlns="http://www.w3.org/ns/widgets" xmlns:android="http://schemas.android.com/apk/res/android" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<name>Moodle</name>
<description>Moodle official app</description>
<author email="mobile@moodle.com" href="http://moodle.com">Moodle Mobile team</author>
@ -28,7 +28,7 @@
<preference name="UIWebViewBounce" value="false" />
<preference name="DisallowOverscroll" value="true" />
<preference name="prerendered-icon" value="true" />
<preference name="AppendUserAgent" value="MoodleMobile 4.4.0 (44000)" />
<preference name="AppendUserAgent" value="MoodleMobile 4.4.0 (44001)" />
<preference name="BackupWebStorage" value="none" />
<preference name="ScrollEnabled" value="false" />
<preference name="KeyboardDisplayRequiresUserAction" value="false" />

View File

@ -1,7 +1,7 @@
{
"app_id": "com.moodle.moodlemobile",
"appname": "Moodle Mobile",
"versioncode": 44000,
"versioncode": 44001,
"versionname": "4.4.0",
"cache_update_frequency_usually": 420000,
"cache_update_frequency_often": 1200000,

View File

@ -166,7 +166,7 @@ export class AddonModChatChatPage implements OnInit, OnDestroy, CanLeave {
const message = this.messages[index];
if (message.beep && message.beep != String(this.currentUserId)) {
if (message.beep && message.beep !== this.currentUserId) {
this.loadMessageBeepWho(message);
}
}
@ -212,11 +212,11 @@ export class AddonModChatChatPage implements OnInit, OnDestroy, CanLeave {
* @param id User Id before parsing.
* @returns User fullname.
*/
protected async getUserFullname(id: string): Promise<string> {
const idNumber = parseInt(id, 10);
protected async getUserFullname(id: string | number): Promise<string> {
const idNumber = Number(id);
if (isNaN(idNumber)) {
return id;
return String(id);
}
const user = this.users.find((user) => user.id == idNumber);
@ -235,10 +235,10 @@ export class AddonModChatChatPage implements OnInit, OnDestroy, CanLeave {
return user.fullname;
}
return id;
return String(id);
} catch {
// Ignore errors.
return id;
return String(id);
}
}

View File

@ -112,7 +112,7 @@ export class AddonModChatSessionMessagesPage implements OnInit {
const message = this.messages[index];
if (message.beep && message.beep != String(this.currentUserId)) {
if (message.beep && message.beep !== this.currentUserId) {
this.loadMessageBeepWho(message);
}
}
@ -135,11 +135,11 @@ export class AddonModChatSessionMessagesPage implements OnInit {
* @param id User Id before parsing.
* @returns User fullname.
*/
protected async getUserFullname(id: string): Promise<string> {
const idNumber = parseInt(id, 10);
protected async getUserFullname(id: string | number): Promise<string> {
const idNumber = Number(id);
if (isNaN(idNumber)) {
return id;
return String(id);
}
try {
@ -148,7 +148,7 @@ export class AddonModChatSessionMessagesPage implements OnInit {
return user.fullname;
} catch {
// Error getting profile.
return id;
return String(id);
}
}

View File

@ -54,6 +54,9 @@ export class AddonModChatHelperProvider {
formattedMessage.showDate = this.showDate(message, prevMessage);
formattedMessage.beep = (message.message.substring(0, 5) == 'beep ' && message.message.substring(5).trim()) || undefined;
if (formattedMessage.beep && !isNaN(Number(formattedMessage.beep))) {
formattedMessage.beep = Number(formattedMessage.beep);
}
formattedMessage.special = !!formattedMessage.beep || (<AddonModChatSessionMessage> message).issystem ||
(<AddonModChatMessage> message).system;
@ -133,7 +136,7 @@ export const AddonModChatHelper = makeSingleton(AddonModChatHelperProvider);
*/
type AddonModChatInfoForView = {
showDate?: boolean; // If date should be displayed before the message.
beep?: string; // User id of the beeped user or 'all'.
beep?: string | number; // User id of the beeped user or 'all'.
special?: boolean; // True if is an special message (system, beep or command).
showUserData?: boolean; // If user data should be displayed.
showTail?: boolean; // If tail should be displayed (decoration).

View File

@ -20,6 +20,8 @@ import { CoreLogger } from '@singletons/logger';
import { AddonQtypeDdMarkerQuestionData } from '../component/ddmarker';
import { AddonQtypeDdMarkerGraphicsApi } from './graphics_api';
import { CoreUtils } from '@services/utils/utils';
import { CoreDirectivesRegistry } from '@singletons/directives-registry';
import { CoreExternalContentDirective } from '@directives/external-content';
/**
* Class to make a question of ddmarker type work.
@ -678,7 +680,7 @@ export class AddonQtypeDdMarkerQuestion {
/**
* Wait for the background image to be loaded.
*/
pollForImageLoad(): void {
async pollForImageLoad(): Promise<void> {
if (this.afterImageLoadDone) {
// Already treated.
return;
@ -689,6 +691,9 @@ export class AddonQtypeDdMarkerQuestion {
return;
}
// Wait for external-content to finish, otherwise the image doesn't have a src and the calculations are wrong.
await CoreDirectivesRegistry.waitDirectivesReady(bgImg, undefined, CoreExternalContentDirective);
if (!bgImg.src && this.imgSrc) {
bgImg.src = this.imgSrc;
}