Skip to content

Commit d171179

Browse files
authored
Merge pull request #1084 from moodlehq/desktop
Desktop
2 parents 16c9cff + 56dfbdb commit d171179

Some content is hidden

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

54 files changed

+4078
-298
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,4 @@ www/build
99
.sass-cache/
1010
www/lib
1111
e2e/build
12+
/desktop

AppXManifest.xml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Package
3+
xmlns="http://schemas.microsoft.com/appx/manifest/foundation/windows10"
4+
xmlns:uap="http://schemas.microsoft.com/appx/manifest/uap/windows10"
5+
xmlns:rescap="http://schemas.microsoft.com/appx/manifest/foundation/windows10/restrictedcapabilities">
6+
<Identity Name="3312ADB7.MoodleDesktop"
7+
ProcessorArchitecture="x64"
8+
Publisher="CN=33CDCDF6-1EB5-4827-9897-ED25C91A32F6"
9+
Version="3.3.0.0" />
10+
<Properties>
11+
<DisplayName>Moodle Desktop</DisplayName>
12+
<PublisherDisplayName>Moodle Pty Ltd.</PublisherDisplayName>
13+
<Description>The official app for Moodle.</Description>
14+
<Logo>assets\StoreLogo.png</Logo>
15+
</Properties>
16+
<Resources>
17+
<Resource Language="en" />
18+
</Resources>
19+
<Dependencies>
20+
<TargetDeviceFamily Name="Windows.Desktop" MinVersion="10.0.14316.0" MaxVersionTested="10.0.14316.0" />
21+
</Dependencies>
22+
<Capabilities>
23+
<rescap:Capability Name="runFullTrust"/>
24+
</Capabilities>
25+
<Applications>
26+
<Application Id="com.moodle.moodlemobile" Executable="app\MoodleDesktop.exe" EntryPoint="Windows.FullTrustApplication">
27+
<uap:VisualElements
28+
BackgroundColor="#464646"
29+
DisplayName="Moodle Desktop"
30+
Square150x150Logo="assets\Square150x150Logo.png"
31+
Square44x44Logo="assets\Square44x44Logo.png"
32+
Description="Moodle Desktop: The official desktop app for Moodle.">
33+
<uap:DefaultTile Wide310x150Logo="assets\Wide310x150Logo.png" />
34+
</uap:VisualElements>
35+
<Extensions>
36+
<uap:Extension Category="windows.protocol">
37+
<uap:Protocol Name="moodlemobile">
38+
<uap:DisplayName>Moodle Mobile URI Scheme</uap:DisplayName>
39+
</uap:Protocol>
40+
</uap:Extension>
41+
</Extensions>
42+
</Application>
43+
</Applications>
44+
</Package>

package.json

Lines changed: 54 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
{
2-
"name": "mm2",
3-
"version": "1.0.0",
4-
"description": "Moodle Mobile 2: The official mobile app for Moodle.",
2+
"name": "com.moodle.moodlemobile",
3+
"version": "3.3.0",
4+
"description": "The official app for Moodle.",
5+
"author": {
6+
"name": "Moodle Pty Ltd.",
7+
"email": "[email protected]"
8+
},
59
"repository": {
610
"type": "git",
711
"url": "https://github.com/moodlehq/moodlemobile2.git"
@@ -14,22 +18,25 @@
1418
}
1519
],
1620
"dependencies": {
21+
"electron-windows-notifications": "^1.1.13",
22+
"electron-builder-squirrel-windows": "^19.3.0"
1723
},
1824
"devDependencies": {
1925
"appium": "^1.6.0",
2026
"bower": "^1.3.3",
27+
"electron-rebuild": "^1.5.11",
2128
"gulp": "^3.9.1",
22-
"gulp-clean-css": "^3.0.3",
23-
"gulp-concat": "^2.6.0",
24-
"gulp-rename": "^1.2.0",
25-
"gulp-sass": "^2.3.2",
2629
"gulp-clean": "^0.3.2",
30+
"gulp-clean-css": "^3.0.3",
2731
"gulp-clip-empty-files": "^0.1.1",
32+
"gulp-concat": "^2.6.0",
2833
"gulp-concat-util": "^0.5.2",
2934
"gulp-file": "^0.3.0",
3035
"gulp-insert": "^0.5.0",
3136
"gulp-ng-annotate": "^2.0.0",
3237
"gulp-remove-empty-lines": "0.0.8",
38+
"gulp-rename": "^1.2.0",
39+
"gulp-sass": "^2.3.2",
3340
"gulp-slash": "^1.1.3",
3441
"gulp-strip-comments": "^2.4.3",
3542
"gulp-tap": "^0.1.3",
@@ -121,6 +128,45 @@
121128
"android": "ionic run android",
122129
"serve.e2e": "ionic serve -b -a",
123130
"serve.dev": "ionic serve",
124-
"e2e": "protractor e2e/build/protractor.conf.js"
131+
"e2e": "protractor e2e/build/protractor.conf.js",
132+
"desktop.pack": "build --dir",
133+
"desktop.dist": "build",
134+
"windows.store": "electron-windows-store --input-directory .\\desktop\\dist\\win-unpacked --output-directory .\\desktop\\store --flatten true -a .\\resources\\desktop -m .\\AppXManifest.xml --package-version 0.0.0.0 --package-name MoodleDesktop"
135+
},
136+
"main": "www/electron.js",
137+
"build": {
138+
"appId": "com.moodle.moodlemobile",
139+
"productName": "MoodleDesktop",
140+
"files": [
141+
"!desktop",
142+
"!**/e2e",
143+
"!hooks",
144+
"!platforms",
145+
"!plugins",
146+
"!resources",
147+
"!**/*.scss"
148+
],
149+
"directories": {
150+
"output": "desktop/dist"
151+
},
152+
"protocols": [
153+
{
154+
"name": "Moodle Mobile URL",
155+
"schemes": [
156+
"moodlemobile"
157+
],
158+
"role": "Viewer"
159+
}
160+
],
161+
"compression": "maximum",
162+
"electronVersion": "1.6.11",
163+
"mac": {
164+
"category": "public.app-category.education",
165+
"icon": "resources/desktop/icon.icns"
166+
},
167+
"win": {
168+
"target": "appx",
169+
"icon": "resources/desktop/icon.ico"
170+
}
125171
}
126172
}
11.2 KB
Loading
5.18 KB
Loading

resources/desktop/StoreLogo.png

54.9 KB
Loading
11.6 KB
Loading

resources/desktop/icon.icns

31.9 KB
Binary file not shown.

resources/desktop/icon.ico

28.8 KB
Binary file not shown.

www/addons/calendar/controllers/list.js

Lines changed: 29 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@ angular.module('mm.addons.calendar')
2121
* @ngdoc controller
2222
* @name mmaCalendarListCtrl
2323
*/
24-
.controller('mmaCalendarListCtrl', function($scope, $stateParams, $log, $state, $mmaCalendar, $mmUtil, $ionicHistory, $mmEvents,
24+
.controller('mmaCalendarListCtrl', function($scope, $stateParams, $log, $state, $mmaCalendar, $mmUtil, $timeout, $mmEvents,
2525
mmaCalendarDaysInterval, $ionicScrollDelegate, $mmLocalNotifications, $mmCourses, mmaCalendarDefaultNotifTimeChangedEvent,
26-
$ionicPopover, $q, $translate) {
26+
$ionicPopover, $q, $translate, $ionicPlatform) {
2727

2828
$log = $log.getInstance('mmaCalendarListCtrl');
2929

@@ -38,10 +38,10 @@ angular.module('mm.addons.calendar')
3838
};
3939

4040
$scope.events = [];
41+
$scope.eventToLoad = 1;
4142

42-
if ($stateParams.eventid) {
43-
// We arrived here via notification click, let's clear history and redirect to event details.
44-
$ionicHistory.clearHistory();
43+
if ($stateParams.eventid && !$ionicPlatform.isTablet()) {
44+
// There is an event to load and it's a phone device, open the event in a new state.
4545
$state.go('site.calendar-event', {id: $stateParams.eventid});
4646
}
4747

@@ -69,7 +69,6 @@ angular.module('mm.addons.calendar')
6969
emptyEventsTimes++;
7070
if (emptyEventsTimes > 5) { // Stop execution if we retrieve empty list 6 consecutive times.
7171
$scope.canLoadMore = false;
72-
$scope.eventsLoaded = true;
7372
if (refresh) {
7473
$scope.events = [];
7574
}
@@ -90,7 +89,6 @@ angular.module('mm.addons.calendar')
9089
// Filter events with same ID. Repeated events are returned once per WS call, show them only once.
9190
$scope.events = $mmUtil.mergeArraysWithoutDuplicates($scope.events, events, 'id');
9291
}
93-
$scope.eventsLoaded = true;
9492
$scope.canLoadMore = true;
9593

9694
// Schedule notifications for the events retrieved (might have new events).
@@ -101,7 +99,6 @@ angular.module('mm.addons.calendar')
10199
scrollView.resize();
102100
}, function(error) {
103101
$mmUtil.showErrorModalDefault(error, 'mma.calendar.errorloadevents', true);
104-
$scope.eventsLoaded = true;
105102
$scope.canLoadMore = false; // Set to false to prevent infinite calls with infinite-loading.
106103
});
107104
}
@@ -121,7 +118,30 @@ angular.module('mm.addons.calendar')
121118
$scope.notificationsEnabled = $mmLocalNotifications.isAvailable();
122119

123120
// Get first events.
124-
fetchData();
121+
fetchData().then(function() {
122+
if ($stateParams.eventid && $ionicPlatform.isTablet()) {
123+
// There is an event to load and it's a tablet device. Search the position of the event in the list and load it.
124+
var found = false;
125+
126+
for (var i = 0; i < $scope.events.length; i++) {
127+
if ($scope.events[i].id == $stateParams.eventid) {
128+
$scope.eventToLoad = i + 1;
129+
found = true;
130+
break;
131+
}
132+
}
133+
134+
if (!found) {
135+
// Event not found in the list, open it in a new state. Use a $timeout to open the state after the
136+
// split view is loaded.
137+
$timeout(function() {
138+
$state.go('site.calendar-event', {id: $stateParams.eventid});
139+
});
140+
}
141+
}
142+
}).finally(function() {
143+
$scope.eventsLoaded = true;
144+
});
125145

126146
// Init popover.
127147
$ionicPopover.fromTemplateUrl('addons/calendar/templates/course_picker.html', {

0 commit comments

Comments
 (0)