Skip to content

Commit

Permalink
Merge pull request #2655 from moodlehq/integration
Browse files Browse the repository at this point in the history
Integration
  • Loading branch information
jleyva authored Dec 28, 2020
2 parents 1d7b19e + 009df0d commit b93c46f
Show file tree
Hide file tree
Showing 10 changed files with 49 additions and 67 deletions.
66 changes: 13 additions & 53 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,43 +19,35 @@ git:
depth: 3

before_cache:
- rm -rf $HOME/.cache/electron-builder/wine
- rm -f $HOME/.gradle/caches/modules-2/modules-2.lock
- rm -fr $HOME/.gradle/caches/*/plugin-resolution/

cache:
directories:
- $HOME/.npm
- $HOME/.cache/electron
- $HOME/.cache/electron-builder
- $HOME/.gradle/caches/
- $HOME/.gradle/wrapper/
- $HOME/.android/build-cache

before_script:
- if [ "$TRAVIS_OS_NAME" != 'windows' ] ; then npm install npm@latest -g ; fi
- npm install npm@latest -g
- gulp

jobs:
include:
- stage: check
if: NOT branch =~ /(master|integration|desktop)$/ AND env(DEPLOY) IS blank
os: linux
script: npm run build --bailOnLintError true --typeCheckOnLint true
- stage: mirror
if: branch IN (master, integration, desktop) AND repo = moodlehq/moodleapp AND type != cron
os: linux
script: scripts/mirror.sh
- stage: prepare
if: branch =~ /(master|^integration)$/ AND env(PREPARE) IS NOT blank AND env(PREPARE) = 1 AND type != cron
os: linux
if: branch =~ /(master|^integration)$/ AND env(PREPARE) IS present AND env(PREPARE) = 1 AND type != cron AND tag IS blank
script: scripts/aot.sh
- stage: build
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))
os: linux
if: env(DEPLOY) IS present AND type != cron AND ((env(DEPLOY) = 1 AND tag IS blank) OR (env(DEPLOY) = 2 AND tag IS present))
dist: trusty
group: edge
language: android
env:
- BUILD_PLATFORM='android'
Expand All @@ -67,56 +59,24 @@ jobs:
- npm ci
- npm install -g gulp
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
name: "End to end tests (mod_forum, mod_messages and mod_comments)"
name: "End to end tests (mod_forum and mod_messages)"
services:
- docker
if: type = cron
script: scripts/test_e2e.sh "@app&&@mod_forum" "@app&&@mod_messages"
- stage: test
name: "End to end tests (mod_data and mod_survey)"
services:
- docker
if: type = cron
script: scripts/test_e2e.sh "@app&&@mod_forum" "@app&&@mod_messages" "@app&&@mod_comments"
script: scripts/test_e2e.sh "@app&&@mod_data" "@app&&@mod_survey"
- stage: test
name: "End to end tests (mod_data, mod_survey, mod_course, core_course and mod_courses)"
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_data" "@app&&@mod_survey" "@app&&@mod_course" "@app&&@core_course" "@app&&@mod_courses"
script: scripts/test_e2e.sh "@app&&@mod_comments" "@app&&@mod_course" "@app&&@core_course" "@app&&@mod_courses"
- stage: test
name: "End to end tests (others)"
services:
Expand Down
4 changes: 2 additions & 2 deletions config.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?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>
<description>Moodle official app</description>
<author email="[email protected]" href="http://moodle.com">Moodle Mobile team</author>
Expand Down Expand Up @@ -244,7 +244,7 @@
<true />
</edit-config>
<edit-config file="*-Info.plist" mode="merge" target="CFBundleShortVersionString">
<string>3.9.3</string>
<string>3.9.4</string>
</edit-config>
<config-file parent="FIREBASE_ANALYTICS_COLLECTION_DEACTIVATED" target="*-Info.plist">
<string>YES</string>
Expand Down
2 changes: 1 addition & 1 deletion desktop/assets/windows/AppXManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<Identity Name="3312ADB7.MoodleDesktop"
ProcessorArchitecture="x64"
Publisher="CN=33CDCDF6-1EB5-4827-9897-ED25C91A32F6"
Version="3.9.3.0" />
Version="3.9.4.0" />
<Properties>
<DisplayName>Moodle Desktop</DisplayName>
<PublisherDisplayName>Moodle Pty Ltd.</PublisherDisplayName>
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "moodlemobile",
"version": "3.9.3",
"version": "3.9.4",
"description": "The official app for Moodle.",
"author": {
"name": "Moodle Pty Ltd.",
Expand Down Expand Up @@ -266,7 +266,7 @@
"category": "public.app-category.education",
"icon": "resources/desktop/icon.icns",
"target": "mas",
"bundleVersion": "3.9.3",
"bundleVersion": "3.9.4",
"extendInfo": {
"ElectronTeamID": "2NU57U5PAW",
"NSLocationWhenInUseUsageDescription": "We need your location so you can attach it as part of your submissions.",
Expand Down
3 changes: 3 additions & 0 deletions scripts/lang_functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -400,6 +400,9 @@ function override_component_lang_files($keys, $translations) {
case 'assets':
$path .= $type.'/'.$component;
break;
default:
$path .= $type.'/lang';
break;

}

Expand Down
4 changes: 2 additions & 2 deletions src/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
"app_id": "com.moodle.moodlemobile",
"appname": "Moodle Mobile",
"desktopappname": "Moodle Desktop",
"versioncode": 3930,
"versionname": "3.9.3",
"versioncode": 3940,
"versionname": "3.9.4",
"cache_update_frequency_usually": 420000,
"cache_update_frequency_often": 1200000,
"cache_update_frequency_sometimes": 3600000,
Expand Down
7 changes: 5 additions & 2 deletions src/core/course/providers/course.ts
Original file line number Diff line number Diff line change
Expand Up @@ -982,7 +982,7 @@ export class CoreCourseProvider {
const loading = this.domUtils.showModalLoading();

// Wait for site plugins to be fetched.
await this.sitePluginsProvider.waitFetchPlugins();
await this.utils.ignoreErrors(this.sitePluginsProvider.waitFetchPlugins());

if (typeof course.format == 'undefined') {
// This block can be replaced by a call to CourseHelper.getCourse(), but it is circular dependant.
Expand All @@ -1006,9 +1006,10 @@ export class CoreCourseProvider {

if (!this.sitePluginsProvider.sitePluginPromiseExists('format_' + course.format)) {
// No custom format plugin. We don't need to wait for anything.
await this.courseFormatDelegate.openCourse(navCtrl, course, params);
loading.dismiss();

await this.courseFormatDelegate.openCourse(navCtrl, course, params);

return;
}

Expand Down Expand Up @@ -1041,6 +1042,8 @@ export class CoreCourseProvider {
this.domUtils.showConfirm(message, '', reload, ignore).then(() => {
window.location.reload();
});
} finally {
loading.dismiss();
}
}

Expand Down
7 changes: 3 additions & 4 deletions src/core/course/providers/helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ import { CoreCourseProvider } from './course';
import { CoreCourseOfflineProvider } from './course-offline';
import { CoreCourseModuleDelegate } from './module-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 { CoreSite } from '@classes/site';
import { CoreLoggerProvider } from '@providers/logger';
Expand Down Expand Up @@ -122,7 +122,6 @@ export class CoreCourseHelperProvider {
private timeUtils: CoreTimeUtilsProvider,
private utils: CoreUtilsProvider,
private translate: TranslateService,
private loginHelper: CoreLoginHelperProvider,
private courseOptionsDelegate: CoreCourseOptionsDelegate,
private siteHomeProvider: CoreSiteHomeProvider,
private eventsProvider: CoreEventsProvider,
Expand Down Expand Up @@ -1302,7 +1301,7 @@ export class CoreCourseHelperProvider {
if (courseId == site.getSiteHomeId()) {
// Check if site home is available.
return this.siteHomeProvider.isAvailable().then(() => {
this.loginHelper.redirect('CoreSiteHomeIndexPage', params, siteId);
CoreLoginHelper.instance.redirect('CoreSiteHomeIndexPage', params, siteId);
}).finally(() => {
modal.dismiss();
});
Expand Down Expand Up @@ -1610,7 +1609,7 @@ export class CoreCourseHelperProvider {
params = params || {};
Object.assign(params, { course: course });

return this.loginHelper.redirect(CoreLoginHelperProvider.OPEN_COURSE, params, siteId);
return CoreLoginHelper.instance.redirect(CoreLoginHelperProvider.OPEN_COURSE, params, siteId);
}
}

Expand Down
3 changes: 3 additions & 0 deletions src/core/login/providers/helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ import { CoreConstants } from '@core/constants';
import { Md5 } from 'ts-md5/dist/md5';
import { CoreSite } from '@classes/site';
import { CoreUrl } from '@singletons/url';
import { makeSingleton } from '@singletons/core.singletons';

/**
* Data related to a SSO authentication.
Expand Down Expand Up @@ -1417,3 +1418,5 @@ export class CoreLoginHelperProvider {
});
}
}

export class CoreLoginHelper extends makeSingleton(CoreLoginHelperProvider) {}
16 changes: 15 additions & 1 deletion src/core/siteplugins/providers/helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -439,7 +439,21 @@ export class CoreSitePluginsHelperProvider {
styleEl.setAttribute('id', 'siteplugin-' + uniqueName);
styleEl.innerHTML = cssCode;

document.head.appendChild(styleEl);
// 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);
}

// Styles have been loaded, now treat the CSS.
this.filepoolProvider.treatCSSCode(siteId, fileUrl, cssCode, CoreSitePluginsProvider.COMPONENT, uniqueName, version)
Expand Down

0 comments on commit b93c46f

Please sign in to comment.