Skip to content

Commit 5e220c4

Browse files
authored
Merge pull request #2634 from moodlehq/integration
Integration
2 parents 84aea9a + 03c3382 commit 5e220c4

File tree

363 files changed

+23663
-16824
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

363 files changed

+23663
-16824
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,3 +46,4 @@ e2e/build
4646
!/desktop/assets/
4747
!/desktop/electron.js
4848
src/configconstants.ts
49+
.moodleapp-dev-config

.travis.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ jobs:
5252
script: scripts/aot.sh
5353
- stage: build
5454
name: "Build Android"
55-
if: env(DEPLOY) IS NOT blank AND ((env(DEPLOY) = 1 AND NOT branch = desktop) OR (env(DEPLOY) IN (2,3) AND tag IS NOT blank))
55+
if: env(DEPLOY) IS NOT blank AND ((env(DEPLOY) = 1 AND branch != desktop) OR (env(DEPLOY) IN (2,3) AND tag IS NOT blank))
5656
os: linux
5757
dist: trusty
5858
group: edge
@@ -69,9 +69,9 @@ jobs:
6969
script: scripts/aot.sh
7070
- stage: build
7171
name: "Build iOS"
72-
if: env(DEPLOY) IS NOT blank AND ((env(DEPLOY) = 1 AND NOT branch = desktop) OR (env(DEPLOY) IN (2,3) AND tag IS NOT blank))
72+
if: env(DEPLOY) IS NOT blank AND ((env(DEPLOY) = 1 AND branch != desktop) OR (env(DEPLOY) IN (2,3) AND tag IS NOT blank))
7373
os: osx
74-
osx_image: xcode11.3
74+
osx_image: xcode12u
7575
env:
7676
- BUILD_PLATFORM='ios'
7777
script: scripts/aot.sh
@@ -88,7 +88,7 @@ jobs:
8888
name: "Build MacOS"
8989
if: env(DEPLOY) IS NOT blank AND ((env(DEPLOY) = 1 AND branch = desktop) OR (env(DEPLOY) = 3 AND tag IS NOT blank))
9090
os: osx
91-
osx_image: xcode11.3
91+
osx_image: xcode12u
9292
env:
9393
- ELECTRON_CACHE=$HOME/.cache/electron
9494
- ELECTRON_BUILDER_CACHE=$HOME/.cache/electron-builder

PACKAGE_PROBLEMS.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,5 @@ jszip has problems with "lie" dependency on greater versions than 3.1
1313

1414
promise.prototype.finally has problems on greater versions than 3.1
1515

16+
cordova-ios: should remain on 5.1 because of: https://github.com/apache/cordova-ios/pull/801
17+

config.xml

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version='1.0' encoding='utf-8'?>
2-
<widget android-versionCode="39200" id="com.moodle.moodlemobile" ios-CFBundleVersion="3.9.2.0" version="3.9.2" versionCode="39200" 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">
2+
<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">
33
<name>Moodle</name>
44
<description>Moodle official app</description>
55
<author email="[email protected]" href="http://moodle.com">Moodle Mobile team</author>
@@ -56,7 +56,7 @@
5656
<resource-file src="resources/android/icon/drawable-hdpi-smallicon.png" target="app/src/main/res/mipmap-hdpi/smallicon.png" />
5757
<resource-file src="resources/android/icon/drawable-xhdpi-smallicon.png" target="app/src/main/res/mipmap-xhdpi/smallicon.png" />
5858
<edit-config file="AndroidManifest.xml" mode="merge" target="/manifest/application/activity[@android:name='MainActivity']">
59-
<activity android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale|screenLayout|smallestScreenSize" android:debuggable="true" />
59+
<activity android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale|screenLayout|smallestScreenSize" />
6060
</edit-config>
6161
<edit-config file="AndroidManifest.xml" mode="merge" target="/manifest/application">
6262
<application android:largeHeap="true" android:usesCleartextTraffic="true" />
@@ -112,11 +112,6 @@
112112
<param name="android-package" value="io.github.pwlin.cordova.plugins.fileopener2.FileOpener2" />
113113
</feature>
114114
</config-file>
115-
<config-file parent="/manifest/application" target="AndroidManifest.xml">
116-
<provider android:authorities="${applicationId}.opener.provider" android:exported="false" android:grantUriPermissions="true" android:name="io.github.pwlin.cordova.plugins.fileopener2.FileProvider">
117-
<meta-data android:name="android.support.FILE_PROVIDER_PATHS" android:resource="@xml/opener_paths" />
118-
</provider>
119-
</config-file>
120115
<config-file parent="/*" target="res/xml/config.xml">
121116
<feature name="FileTransfer">
122117
<param name="android-package" value="org.apache.cordova.filetransfer.FileTransfer" />
@@ -219,6 +214,14 @@
219214
</intent-filter>
220215
</service>
221216
</config-file>
217+
<config-file parent="/*" target="res/xml/config.xml">
218+
<feature name="Media">
219+
<param name="android-package" value="org.apache.cordova.media.AudioHandler" />
220+
</feature>
221+
</config-file>
222+
<config-file parent="/*" target="AndroidManifest.xml">
223+
<uses-feature android:name="android.hardware.bluetooth" android:required="false" />
224+
</config-file>
222225
</platform>
223226
<platform name="ios">
224227
<resource-file src="GoogleService-Info.plist" />
@@ -241,7 +244,7 @@
241244
<true />
242245
</edit-config>
243246
<edit-config file="*-Info.plist" mode="merge" target="CFBundleShortVersionString">
244-
<string>3.9.2</string>
247+
<string>3.9.3</string>
245248
</edit-config>
246249
<config-file parent="FIREBASE_ANALYTICS_COLLECTION_DEACTIVATED" target="*-Info.plist">
247250
<string>YES</string>
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<dict>
5+
<key>com.apple.security.app-sandbox</key>
6+
<true/>
7+
</dict>
8+
</plist>

desktop/assets/mac/sign.sh

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,26 @@
11
#!/bin/bash
2+
#
3+
# Script to sign macOSX pkg.
4+
# https://www.electronjs.org/docs/tutorial/mac-app-store-submission-guide
5+
#
26

37
# Name of your app.
48
APP="Moodle Desktop"
5-
# The path of your app to sign.
6-
APP_PATH="desktop/dist/mas/Moodle Desktop.app"
7-
# The path to the location you want to put the signed package.
8-
RESULT_PATH="desktop/dist/mas/$APP.pkg"
99
# The name of certificates you requested.
1010
APP_KEY="3rd Party Mac Developer Application: Moodle Pty Ltd (2NU57U5PAW)"
1111
INSTALLER_KEY="3rd Party Mac Developer Installer: Moodle Pty Ltd (2NU57U5PAW)"
12+
13+
14+
BASEPATH="desktop/dist/mas"
15+
# The path of your app to sign.
16+
APP_PATH="${BASEPATH}/${APP}.app"
17+
# The path to the location you want to put the signed package.
18+
RESULT_PATH="${BASEPATH}/${APP}.pkg"
19+
1220
# The path of your plist files.
1321
CHILD_PLIST="desktop/assets/mac/child.plist"
1422
PARENT_PLIST="desktop/assets/mac/parent.plist"
23+
LOGINHELPER_PLIST="desktop/assets/mac/loginhelper.plist"
1524

1625
FRAMEWORKS_PATH="$APP_PATH/Contents/Frameworks"
1726

@@ -21,11 +30,9 @@ codesign -s "$APP_KEY" -f --entitlements "$CHILD_PLIST" "$FRAMEWORKS_PATH/Electr
2130
codesign -s "$APP_KEY" -f --entitlements "$CHILD_PLIST" "$FRAMEWORKS_PATH/Electron Framework.framework"
2231
codesign -s "$APP_KEY" -f --entitlements "$CHILD_PLIST" "$FRAMEWORKS_PATH/$APP Helper.app/Contents/MacOS/$APP Helper"
2332
codesign -s "$APP_KEY" -f --entitlements "$CHILD_PLIST" "$FRAMEWORKS_PATH/$APP Helper.app/"
24-
codesign -s "$APP_KEY" -f --entitlements "$CHILD_PLIST" "$FRAMEWORKS_PATH/$APP Helper EH.app/Contents/MacOS/$APP Helper EH"
25-
codesign -s "$APP_KEY" -f --entitlements "$CHILD_PLIST" "$FRAMEWORKS_PATH/$APP Helper EH.app/"
26-
codesign -s "$APP_KEY" -f --entitlements "$CHILD_PLIST" "$FRAMEWORKS_PATH/$APP Helper NP.app/Contents/MacOS/$APP Helper NP"
27-
codesign -s "$APP_KEY" -f --entitlements "$CHILD_PLIST" "$FRAMEWORKS_PATH/$APP Helper NP.app/"
33+
codesign -s "$APP_KEY" -f --entitlements "$LOGINHELPER_PLIST" "$APP_PATH/Contents/Library/LoginItems/$APP Login Helper.app/Contents/MacOS/$APP Login Helper"
34+
codesign -s "$APP_KEY" -f --entitlements "$LOGINHELPER_PLIST" "$APP_PATH/Contents/Library/LoginItems/$APP Login Helper.app/"
2835
codesign -s "$APP_KEY" -f --entitlements "$CHILD_PLIST" "$APP_PATH/Contents/MacOS/$APP"
2936
codesign -s "$APP_KEY" -f --entitlements "$PARENT_PLIST" "$APP_PATH"
3037

31-
productbuild --component "$APP_PATH" /Applications --sign "$INSTALLER_KEY" "$RESULT_PATH"
38+
productbuild --component "$APP_PATH" /Applications --sign "$INSTALLER_KEY" "$RESULT_PATH"

desktop/assets/windows/AppXManifest.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<Identity Name="3312ADB7.MoodleDesktop"
77
ProcessorArchitecture="x64"
88
Publisher="CN=33CDCDF6-1EB5-4827-9897-ED25C91A32F6"
9-
Version="3.9.2.0" />
9+
Version="3.9.3.0" />
1010
<Properties>
1111
<DisplayName>Moodle Desktop</DisplayName>
1212
<PublisherDisplayName>Moodle Pty Ltd.</PublisherDisplayName>

gulp/dev-config.js

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
// (C) Copyright 2015 Moodle Pty Ltd.
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
const fs = require('fs');
16+
17+
const DEV_CONFIG_FILE = '.moodleapp-dev-config';
18+
19+
/**
20+
* Class to read and write dev-config data from a file.
21+
*/
22+
class DevConfig {
23+
24+
constructor() {
25+
this.loadFileData();
26+
}
27+
28+
/**
29+
* Get a setting.
30+
*
31+
* @param name Name of the setting to get.
32+
* @param defaultValue Value to use if not found.
33+
*/
34+
get(name, defaultValue) {
35+
return typeof this.config[name] != 'undefined' ? this.config[name] : defaultValue;
36+
}
37+
38+
/**
39+
* Load file data to memory.
40+
*/
41+
loadFileData() {
42+
if (!fs.existsSync(DEV_CONFIG_FILE)) {
43+
this.config = {};
44+
45+
return;
46+
}
47+
48+
try {
49+
this.config = JSON.parse(fs.readFileSync(DEV_CONFIG_FILE));
50+
} catch (error) {
51+
console.error('Error reading dev config file.', error);
52+
this.config = {};
53+
}
54+
}
55+
56+
/**
57+
* Save some settings.
58+
*
59+
* @param settings Object with the settings to save.
60+
*/
61+
save(settings) {
62+
this.config = Object.assign(this.config, settings);
63+
64+
// Save the data in the dev file.
65+
fs.writeFileSync(DEV_CONFIG_FILE, JSON.stringify(this.config, null, 4));
66+
}
67+
}
68+
69+
module.exports = new DevConfig();

0 commit comments

Comments
 (0)