Skip to content

Commit 0ffbe69

Browse files
authored
Merge pull request #4607 from crazyserver/MOBILE-4912
MOBILE-4912 menu: Allow to indicate the order preference for the different elements in the main bottom tabs menu
2 parents c588e46 + f1fe018 commit 0ffbe69

File tree

69 files changed

+418
-104
lines changed

Some content is hidden

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

69 files changed

+418
-104
lines changed

local_moodleappbehat/tests/behat/behat_app.php

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1373,4 +1373,28 @@ public function i_wait_toast_to_dismiss_in_the_app() {
13731373
$this->runtime_js('waitToastDismiss()');
13741374
}
13751375

1376+
1377+
/**
1378+
* Override app environment variables.
1379+
*
1380+
* @Given /^the environment config is patched with:$/
1381+
* @param TableNode $data Table data
1382+
*/
1383+
public function the_environment_config_is_patched_with(TableNode $data) {
1384+
$overrides = [];
1385+
foreach ($data->getRows() as $row) {
1386+
$name = $row[0];
1387+
$value = json_decode($this->replace_wwwroot($row[1]));
1388+
$overrides[$name] = $value;
1389+
}
1390+
1391+
$json = json_encode($overrides);
1392+
1393+
$result = $this->zone_js("patchEnvironment($json)");
1394+
1395+
if ($result !== 'OK') {
1396+
throw new DriverException('Error patching environment - ' . $result);
1397+
}
1398+
}
1399+
13761400
}

src/addons/badges/constants.ts

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
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+
import { CORE_USER_FEATURE_PREFIX } from '@features/user/constants';
16+
17+
export const ADDONS_BADGES_COMPONENT_NAME = 'AddonBadges';
18+
19+
export const ADDONS_BADGES_USER_PROFILE_FEATURE_NAME = `${CORE_USER_FEATURE_PREFIX}${ADDONS_BADGES_COMPONENT_NAME}`;
20+
export const ADDONS_BADGES_USER_MENU_FEATURE_NAME = `${ADDONS_BADGES_USER_PROFILE_FEATURE_NAME}:account`;

src/addons/badges/services/handlers/mybadges-link.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import { CoreContentLinksAction } from '@features/contentlinks/services/contentl
1818
import { CoreNavigator } from '@services/navigator';
1919
import { makeSingleton } from '@singletons';
2020
import { AddonBadges } from '../badges';
21+
import { ADDONS_BADGES_USER_PROFILE_FEATURE_NAME } from '@addons/badges/constants';
2122

2223
/**
2324
* Handler to treat links to user badges page.
@@ -26,7 +27,7 @@ import { AddonBadges } from '../badges';
2627
export class AddonBadgesMyBadgesLinkHandlerService extends CoreContentLinksHandlerBase {
2728

2829
name = 'AddonBadgesMyBadgesLinkHandler';
29-
featureName = 'CoreUserDelegate_AddonBadges';
30+
featureName = ADDONS_BADGES_USER_PROFILE_FEATURE_NAME;
3031
pattern = /\/badges\/mybadges\.php/;
3132

3233
/**

src/addons/badges/services/handlers/push-click.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import { CorePushNotificationsNotificationBasicData } from '@features/pushnotifi
2222
import { CoreNavigator } from '@services/navigator';
2323
import { AddonBadgesHelper } from '../badges-helper';
2424
import { CorePromiseUtils } from '@singletons/promise-utils';
25+
import { ADDONS_BADGES_USER_PROFILE_FEATURE_NAME } from '@addons/badges/constants';
2526

2627
/**
2728
* Handler for badges push notifications clicks.
@@ -31,7 +32,7 @@ export class AddonBadgesPushClickHandlerService implements CorePushNotifications
3132

3233
name = 'AddonBadgesPushClickHandler';
3334
priority = 200;
34-
featureName = 'CoreUserDelegate_AddonBadges';
35+
featureName = ADDONS_BADGES_USER_PROFILE_FEATURE_NAME;
3536

3637
/**
3738
* @inheritdoc

src/addons/badges/services/handlers/user.ts

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,11 @@ import { CoreNavigator } from '@services/navigator';
2424
import { CoreSites } from '@services/sites';
2525
import { makeSingleton } from '@singletons';
2626
import { AddonBadges } from '../badges';
27+
import {
28+
ADDONS_BADGES_USER_MENU_FEATURE_NAME,
29+
ADDONS_BADGES_COMPONENT_NAME,
30+
ADDONS_BADGES_USER_PROFILE_FEATURE_NAME,
31+
} from '@addons/badges/constants';
2732

2833
/**
2934
* Profile badges handler.
@@ -32,7 +37,8 @@ import { AddonBadges } from '../badges';
3237
export class AddonBadgesUserHandlerService implements CoreUserProfileHandler {
3338

3439
readonly type = CoreUserProfileHandlerType.LIST_ITEM;
35-
name = 'AddonBadges:fakename'; // This name doesn't match any disabled feature, they'll be checked in isEnabledForContext.
40+
// This name doesn't match any disabled feature, they'll be checked in isEnabledForContext.
41+
name = `${ADDONS_BADGES_COMPONENT_NAME}:fakename`;
3642
priority = 300;
3743

3844
/**
@@ -57,10 +63,10 @@ export class AddonBadgesUserHandlerService implements CoreUserProfileHandler {
5763
}
5864

5965
if (context === CoreUserDelegateContext.USER_MENU) {
60-
if (currentSite.isFeatureDisabled('CoreUserDelegate_AddonBadges:account')) {
66+
if (currentSite.isFeatureDisabled(ADDONS_BADGES_USER_MENU_FEATURE_NAME)) {
6167
return false;
6268
}
63-
} else if (currentSite.isFeatureDisabled('CoreUserDelegate_AddonBadges')) {
69+
} else if (currentSite.isFeatureDisabled(ADDONS_BADGES_USER_PROFILE_FEATURE_NAME)) {
6470
return false;
6571
}
6672

src/addons/block/globalsearch/services/block-handler.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import { CoreBlockHandlerData } from '@features/block/services/block-delegate';
1717
import { CoreBlockBaseHandler } from '@features/block/classes/base-block-handler';
1818
import { makeSingleton } from '@singletons';
1919
import { CoreCourseBlock } from '@features/course/services/course';
20-
import { CORE_SEARCH_PAGE_NAME } from '@features/search/services/handlers/mainmenu';
20+
import { CORE_SEARCH_PAGE_NAME } from '@features/search/constants';
2121
import { CoreSearchGlobalSearch } from '@features/search/services/global-search';
2222
import { ContextLevel } from '@/core/constants';
2323

src/addons/blog/constants.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,20 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15+
import { CORE_USER_FEATURE_PREFIX } from '@features/user/constants';
16+
1517
export const ADDON_BLOG_MAINMENU_PAGE_NAME = 'blog';
1618
export const ADDON_BLOG_ENTRY_UPDATED = 'blog_entry_updated';
1719
export const ADDON_BLOG_AUTO_SYNCED = 'addon_blog_autom_synced';
1820
export const ADDON_BLOG_MANUAL_SYNCED = 'addon_blog_manual_synced';
1921
export const ADDON_BLOG_SYNC_ID = 'blog';
2022

23+
export const ADDONS_BLOG_COMPONENT_NAME = 'AddonBlog';
24+
25+
const ADDONS_BLOG_GLOBAL_FEATURE_NAME = `${CORE_USER_FEATURE_PREFIX}${ADDONS_BLOG_COMPONENT_NAME}`;
26+
export const ADDONS_BLOG_USER_MENU_FEATURE_NAME = `${ADDONS_BLOG_GLOBAL_FEATURE_NAME}:account`;
27+
export const ADDONS_BLOG_USER_PROFILE_FEATURE_NAME = `${ADDONS_BLOG_GLOBAL_FEATURE_NAME}:blogs`;
28+
2129
/**
2230
* Restriction level of user blog visualization.
2331
*/

src/addons/blog/services/handlers/course-option.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,15 @@ import { CoreSites } from '@services/sites';
2626
import { CoreWSFile } from '@services/ws';
2727
import { makeSingleton } from '@singletons';
2828
import { AddonBlog } from '../blog';
29-
import { ADDON_BLOG_MAINMENU_PAGE_NAME } from '@addons/blog/constants';
29+
import { ADDON_BLOG_MAINMENU_PAGE_NAME, ADDONS_BLOG_COMPONENT_NAME } from '@addons/blog/constants';
3030

3131
/**
3232
* Course nav handler.
3333
*/
3434
@Injectable({ providedIn: 'root' })
3535
export class AddonBlogCourseOptionHandlerService implements CoreCourseOptionsHandler {
3636

37-
name = 'AddonBlog';
37+
name = ADDONS_BLOG_COMPONENT_NAME;
3838
priority = 100;
3939

4040
/**

src/addons/blog/services/handlers/edit-entry-link.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import { CoreContentLinksAction } from '@features/contentlinks/services/contentl
1919
import { CoreNavigator } from '@services/navigator';
2020
import { makeSingleton } from '@singletons';
2121
import { AddonBlog } from '../blog';
22+
import { ADDONS_BLOG_USER_PROFILE_FEATURE_NAME } from '@addons/blog/constants';
2223

2324
/**
2425
* Handler to treat links to edit blog entry page.
@@ -27,7 +28,7 @@ import { AddonBlog } from '../blog';
2728
export class AddonBlogEditEntryLinkHandlerService extends CoreContentLinksHandlerBase {
2829

2930
name = 'AddonBlogEditEntryLinkHandler';
30-
featureName = 'CoreUserDelegate_AddonBlog:blogs';
31+
featureName = ADDONS_BLOG_USER_PROFILE_FEATURE_NAME;
3132
pattern = /\/blog\/(add|edit)\.php/;
3233

3334
/**

src/addons/blog/services/handlers/index-link.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import { CoreContentLinksAction } from '@features/contentlinks/services/contentl
1919
import { CoreNavigator } from '@services/navigator';
2020
import { makeSingleton } from '@singletons';
2121
import { AddonBlog } from '../blog';
22+
import { ADDONS_BLOG_USER_PROFILE_FEATURE_NAME } from '@addons/blog/constants';
2223

2324
/**
2425
* Handler to treat links to blog page.
@@ -27,7 +28,7 @@ import { AddonBlog } from '../blog';
2728
export class AddonBlogIndexLinkHandlerService extends CoreContentLinksHandlerBase {
2829

2930
name = 'AddonBlogIndexLinkHandler';
30-
featureName = 'CoreUserDelegate_AddonBlog:blogs';
31+
featureName = ADDONS_BLOG_USER_PROFILE_FEATURE_NAME;
3132
pattern = /\/blog\/index\.php/;
3233

3334
/**

0 commit comments

Comments
 (0)