Merge pull request #2655 from moodlehq/integration

Integration
main
Juan Leyva 2020-12-28 17:47:05 +01:00 committed by GitHub
commit b93c46fb9e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 49 additions and 67 deletions

View File

@ -19,43 +19,35 @@ git:
depth: 3 depth: 3
before_cache: before_cache:
- rm -rf $HOME/.cache/electron-builder/wine
- rm -f $HOME/.gradle/caches/modules-2/modules-2.lock - rm -f $HOME/.gradle/caches/modules-2/modules-2.lock
- rm -fr $HOME/.gradle/caches/*/plugin-resolution/ - rm -fr $HOME/.gradle/caches/*/plugin-resolution/
cache: cache:
directories: directories:
- $HOME/.npm - $HOME/.npm
- $HOME/.cache/electron
- $HOME/.cache/electron-builder
- $HOME/.gradle/caches/ - $HOME/.gradle/caches/
- $HOME/.gradle/wrapper/ - $HOME/.gradle/wrapper/
- $HOME/.android/build-cache - $HOME/.android/build-cache
before_script: before_script:
- if [ "$TRAVIS_OS_NAME" != 'windows' ] ; then npm install npm@latest -g ; fi - npm install npm@latest -g
- gulp - gulp
jobs: jobs:
include: include:
- stage: check - stage: check
if: NOT branch =~ /(master|integration|desktop)$/ AND env(DEPLOY) IS blank if: NOT branch =~ /(master|integration|desktop)$/ AND env(DEPLOY) IS blank
os: linux
script: npm run build --bailOnLintError true --typeCheckOnLint true script: npm run build --bailOnLintError true --typeCheckOnLint true
- stage: mirror - stage: mirror
if: branch IN (master, integration, desktop) AND repo = moodlehq/moodleapp AND type != cron if: branch IN (master, integration, desktop) AND repo = moodlehq/moodleapp AND type != cron
os: linux
script: scripts/mirror.sh script: scripts/mirror.sh
- stage: prepare - stage: prepare
if: branch =~ /(master|^integration)$/ AND env(PREPARE) IS NOT blank AND env(PREPARE) = 1 AND type != cron if: branch =~ /(master|^integration)$/ AND env(PREPARE) IS present AND env(PREPARE) = 1 AND type != cron AND tag IS blank
os: linux
script: scripts/aot.sh script: scripts/aot.sh
- stage: build - stage: build
name: "Build Android" name: "Build Android"
if: env(DEPLOY) IS NOT blank AND ((env(DEPLOY) = 1 AND branch != desktop) OR (env(DEPLOY) IN (2,3) AND tag IS NOT blank)) if: env(DEPLOY) IS present AND type != cron AND ((env(DEPLOY) = 1 AND tag IS blank) OR (env(DEPLOY) = 2 AND tag IS present))
os: linux
dist: trusty dist: trusty
group: edge
language: android language: android
env: env:
- BUILD_PLATFORM='android' - BUILD_PLATFORM='android'
@ -67,56 +59,24 @@ jobs:
- npm ci - npm ci
- npm install -g gulp - npm install -g gulp
script: scripts/aot.sh script: scripts/aot.sh
- stage: build
name: "Build iOS"
if: env(DEPLOY) IS NOT blank AND ((env(DEPLOY) = 1 AND branch != desktop) OR (env(DEPLOY) IN (2,3) AND tag IS NOT blank))
os: osx
osx_image: xcode12.2
env:
- BUILD_PLATFORM='ios'
script: scripts/aot.sh
- stage: build
name: "Build Linux"
if: env(DEPLOY) IS NOT blank AND ((env(DEPLOY) = 1 AND branch = desktop) OR (env(DEPLOY) = 3 AND tag IS NOT blank))
os: linux
env:
- ELECTRON_CACHE=$HOME/.cache/electron
- ELECTRON_BUILDER_CACHE=$HOME/.cache/electron-builder
- BUILD_PLATFORM='linux'
script: scripts/aot.sh
- stage: build
name: "Build MacOS"
if: env(DEPLOY) IS NOT blank AND ((env(DEPLOY) = 1 AND branch = desktop) OR (env(DEPLOY) = 3 AND tag IS NOT blank))
os: osx
osx_image: xcode12.2
env:
- ELECTRON_CACHE=$HOME/.cache/electron
- ELECTRON_BUILDER_CACHE=$HOME/.cache/electron-builder
- BUILD_PLATFORM='osx'
script: scripts/aot.sh
- stage: build
name: "Build Windows"
if: env(DEPLOY) IS NOT blank AND ((env(DEPLOY) = 1 AND branch = desktop) OR (env(DEPLOY) = 3 AND tag IS NOT blank))
os: windows
env:
- ELECTRON_CACHE=$HOME/.cache/electron
- ELECTRON_BUILDER_CACHE=$HOME/.cache/electron-builder
- ELECTRON_BUILDER_ALLOW_UNRESOLVED_DEPENDENCIES=true
- DEBUG=electron-windows-store
- BUILD_PLATFORM='windows'
script: scripts/aot.sh
- stage: test - stage: test
name: "End to end tests (mod_forum, mod_messages and mod_comments)" name: "End to end tests (mod_forum and mod_messages)"
services: services:
- docker - docker
if: type = cron if: type = cron
script: scripts/test_e2e.sh "@app&&@mod_forum" "@app&&@mod_messages" "@app&&@mod_comments" script: scripts/test_e2e.sh "@app&&@mod_forum" "@app&&@mod_messages"
- stage: test - stage: test
name: "End to end tests (mod_data, mod_survey, mod_course, core_course and mod_courses)" name: "End to end tests (mod_data and mod_survey)"
services: services:
- docker - docker
if: type = cron if: type = cron
script: scripts/test_e2e.sh "@app&&@mod_data" "@app&&@mod_survey" "@app&&@mod_course" "@app&&@core_course" "@app&&@mod_courses" script: scripts/test_e2e.sh "@app&&@mod_data" "@app&&@mod_survey"
- stage: test
name: "End to end tests (mod_comments, mod_course, core_course and mod_courses)"
services:
- docker
if: type = cron
script: scripts/test_e2e.sh "@app&&@mod_comments" "@app&&@mod_course" "@app&&@core_course" "@app&&@mod_courses"
- stage: test - stage: test
name: "End to end tests (others)" name: "End to end tests (others)"
services: services:

View File

@ -1,5 +1,5 @@
<?xml version='1.0' encoding='utf-8'?> <?xml version='1.0' encoding='utf-8'?>
<widget android-versionCode="39300" id="com.moodle.moodlemobile" ios-CFBundleVersion="3.9.3.0" version="3.9.3" versionCode="39300" 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="39400" id="com.moodle.moodlemobile" ios-CFBundleVersion="3.9.4.0" version="3.9.4" versionCode="39400" 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> <name>Moodle</name>
<description>Moodle official app</description> <description>Moodle official app</description>
<author email="mobile@moodle.com" href="http://moodle.com">Moodle Mobile team</author> <author email="mobile@moodle.com" href="http://moodle.com">Moodle Mobile team</author>
@ -244,7 +244,7 @@
<true /> <true />
</edit-config> </edit-config>
<edit-config file="*-Info.plist" mode="merge" target="CFBundleShortVersionString"> <edit-config file="*-Info.plist" mode="merge" target="CFBundleShortVersionString">
<string>3.9.3</string> <string>3.9.4</string>
</edit-config> </edit-config>
<config-file parent="FIREBASE_ANALYTICS_COLLECTION_DEACTIVATED" target="*-Info.plist"> <config-file parent="FIREBASE_ANALYTICS_COLLECTION_DEACTIVATED" target="*-Info.plist">
<string>YES</string> <string>YES</string>

View File

@ -6,7 +6,7 @@
<Identity Name="3312ADB7.MoodleDesktop" <Identity Name="3312ADB7.MoodleDesktop"
ProcessorArchitecture="x64" ProcessorArchitecture="x64"
Publisher="CN=33CDCDF6-1EB5-4827-9897-ED25C91A32F6" Publisher="CN=33CDCDF6-1EB5-4827-9897-ED25C91A32F6"
Version="3.9.3.0" /> Version="3.9.4.0" />
<Properties> <Properties>
<DisplayName>Moodle Desktop</DisplayName> <DisplayName>Moodle Desktop</DisplayName>
<PublisherDisplayName>Moodle Pty Ltd.</PublisherDisplayName> <PublisherDisplayName>Moodle Pty Ltd.</PublisherDisplayName>

View File

@ -1,6 +1,6 @@
{ {
"name": "moodlemobile", "name": "moodlemobile",
"version": "3.9.3", "version": "3.9.4",
"description": "The official app for Moodle.", "description": "The official app for Moodle.",
"author": { "author": {
"name": "Moodle Pty Ltd.", "name": "Moodle Pty Ltd.",
@ -266,7 +266,7 @@
"category": "public.app-category.education", "category": "public.app-category.education",
"icon": "resources/desktop/icon.icns", "icon": "resources/desktop/icon.icns",
"target": "mas", "target": "mas",
"bundleVersion": "3.9.3", "bundleVersion": "3.9.4",
"extendInfo": { "extendInfo": {
"ElectronTeamID": "2NU57U5PAW", "ElectronTeamID": "2NU57U5PAW",
"NSLocationWhenInUseUsageDescription": "We need your location so you can attach it as part of your submissions.", "NSLocationWhenInUseUsageDescription": "We need your location so you can attach it as part of your submissions.",

View File

@ -400,6 +400,9 @@ function override_component_lang_files($keys, $translations) {
case 'assets': case 'assets':
$path .= $type.'/'.$component; $path .= $type.'/'.$component;
break; break;
default:
$path .= $type.'/lang';
break;
} }

View File

@ -2,8 +2,8 @@
"app_id": "com.moodle.moodlemobile", "app_id": "com.moodle.moodlemobile",
"appname": "Moodle Mobile", "appname": "Moodle Mobile",
"desktopappname": "Moodle Desktop", "desktopappname": "Moodle Desktop",
"versioncode": 3930, "versioncode": 3940,
"versionname": "3.9.3", "versionname": "3.9.4",
"cache_update_frequency_usually": 420000, "cache_update_frequency_usually": 420000,
"cache_update_frequency_often": 1200000, "cache_update_frequency_often": 1200000,
"cache_update_frequency_sometimes": 3600000, "cache_update_frequency_sometimes": 3600000,

View File

@ -982,7 +982,7 @@ export class CoreCourseProvider {
const loading = this.domUtils.showModalLoading(); const loading = this.domUtils.showModalLoading();
// Wait for site plugins to be fetched. // Wait for site plugins to be fetched.
await this.sitePluginsProvider.waitFetchPlugins(); await this.utils.ignoreErrors(this.sitePluginsProvider.waitFetchPlugins());
if (typeof course.format == 'undefined') { if (typeof course.format == 'undefined') {
// This block can be replaced by a call to CourseHelper.getCourse(), but it is circular dependant. // This block can be replaced by a call to CourseHelper.getCourse(), but it is circular dependant.
@ -1006,9 +1006,10 @@ export class CoreCourseProvider {
if (!this.sitePluginsProvider.sitePluginPromiseExists('format_' + course.format)) { if (!this.sitePluginsProvider.sitePluginPromiseExists('format_' + course.format)) {
// No custom format plugin. We don't need to wait for anything. // No custom format plugin. We don't need to wait for anything.
await this.courseFormatDelegate.openCourse(navCtrl, course, params);
loading.dismiss(); loading.dismiss();
await this.courseFormatDelegate.openCourse(navCtrl, course, params);
return; return;
} }
@ -1041,6 +1042,8 @@ export class CoreCourseProvider {
this.domUtils.showConfirm(message, '', reload, ignore).then(() => { this.domUtils.showConfirm(message, '', reload, ignore).then(() => {
window.location.reload(); window.location.reload();
}); });
} finally {
loading.dismiss();
} }
} }

View File

@ -34,7 +34,7 @@ import { CoreCourseProvider } from './course';
import { CoreCourseOfflineProvider } from './course-offline'; import { CoreCourseOfflineProvider } from './course-offline';
import { CoreCourseModuleDelegate } from './module-delegate'; import { CoreCourseModuleDelegate } from './module-delegate';
import { CoreCourseModulePrefetchDelegate } from './module-prefetch-delegate'; import { CoreCourseModulePrefetchDelegate } from './module-prefetch-delegate';
import { CoreLoginHelperProvider } from '@core/login/providers/helper'; import { CoreLoginHelper, CoreLoginHelperProvider } from '@core/login/providers/helper';
import { CoreConstants } from '@core/constants'; import { CoreConstants } from '@core/constants';
import { CoreSite } from '@classes/site'; import { CoreSite } from '@classes/site';
import { CoreLoggerProvider } from '@providers/logger'; import { CoreLoggerProvider } from '@providers/logger';
@ -122,7 +122,6 @@ export class CoreCourseHelperProvider {
private timeUtils: CoreTimeUtilsProvider, private timeUtils: CoreTimeUtilsProvider,
private utils: CoreUtilsProvider, private utils: CoreUtilsProvider,
private translate: TranslateService, private translate: TranslateService,
private loginHelper: CoreLoginHelperProvider,
private courseOptionsDelegate: CoreCourseOptionsDelegate, private courseOptionsDelegate: CoreCourseOptionsDelegate,
private siteHomeProvider: CoreSiteHomeProvider, private siteHomeProvider: CoreSiteHomeProvider,
private eventsProvider: CoreEventsProvider, private eventsProvider: CoreEventsProvider,
@ -1302,7 +1301,7 @@ export class CoreCourseHelperProvider {
if (courseId == site.getSiteHomeId()) { if (courseId == site.getSiteHomeId()) {
// Check if site home is available. // Check if site home is available.
return this.siteHomeProvider.isAvailable().then(() => { return this.siteHomeProvider.isAvailable().then(() => {
this.loginHelper.redirect('CoreSiteHomeIndexPage', params, siteId); CoreLoginHelper.instance.redirect('CoreSiteHomeIndexPage', params, siteId);
}).finally(() => { }).finally(() => {
modal.dismiss(); modal.dismiss();
}); });
@ -1610,7 +1609,7 @@ export class CoreCourseHelperProvider {
params = params || {}; params = params || {};
Object.assign(params, { course: course }); Object.assign(params, { course: course });
return this.loginHelper.redirect(CoreLoginHelperProvider.OPEN_COURSE, params, siteId); return CoreLoginHelper.instance.redirect(CoreLoginHelperProvider.OPEN_COURSE, params, siteId);
} }
} }

View File

@ -34,6 +34,7 @@ import { CoreConstants } from '@core/constants';
import { Md5 } from 'ts-md5/dist/md5'; import { Md5 } from 'ts-md5/dist/md5';
import { CoreSite } from '@classes/site'; import { CoreSite } from '@classes/site';
import { CoreUrl } from '@singletons/url'; import { CoreUrl } from '@singletons/url';
import { makeSingleton } from '@singletons/core.singletons';
/** /**
* Data related to a SSO authentication. * Data related to a SSO authentication.
@ -1417,3 +1418,5 @@ export class CoreLoginHelperProvider {
}); });
} }
} }
export class CoreLoginHelper extends makeSingleton(CoreLoginHelperProvider) {}

View File

@ -439,7 +439,21 @@ export class CoreSitePluginsHelperProvider {
styleEl.setAttribute('id', 'siteplugin-' + uniqueName); styleEl.setAttribute('id', 'siteplugin-' + uniqueName);
styleEl.innerHTML = cssCode; styleEl.innerHTML = cssCode;
// To ensure consistency, insert in alphabetical order among other site plugin styles.
let lowestGreater = null;
Array.from(document.head.querySelectorAll('style')).forEach((other) => {
if (/^siteplugin-/.test(other.id) && other.id > styleEl.id) {
if (lowestGreater === null || other.id < lowestGreater.id) {
lowestGreater = other;
}
}
});
if (lowestGreater) {
document.head.insertBefore(styleEl, lowestGreater);
} else {
document.head.appendChild(styleEl); document.head.appendChild(styleEl);
}
// Styles have been loaded, now treat the CSS. // Styles have been loaded, now treat the CSS.
this.filepoolProvider.treatCSSCode(siteId, fileUrl, cssCode, CoreSitePluginsProvider.COMPONENT, uniqueName, version) this.filepoolProvider.treatCSSCode(siteId, fileUrl, cssCode, CoreSitePluginsProvider.COMPONENT, uniqueName, version)