From c611e2d2d4d4b988105f248581f6bea58e5b5c7a Mon Sep 17 00:00:00 2001
From: Dani Palou <dani@moodle.com>
Date: Mon, 13 Dec 2021 16:44:48 +0100
Subject: [PATCH] MOBILE-3873 bbb: Apply latest UI changes for activities

---
 .../components/index/index.html               | 25 ++++-----
 .../bigbluebuttonbn/components/index/index.ts |  1 -
 .../bigbluebuttonbn/pages/index/index.html    | 12 ++--
 src/assets/img/mod/bigbluebuttonbn.svg        | 55 +++++++++++++++++++
 src/core/features/course/services/course.ts   |  2 +-
 5 files changed, 73 insertions(+), 22 deletions(-)
 create mode 100644 src/assets/img/mod/bigbluebuttonbn.svg

diff --git a/src/addons/mod/bigbluebuttonbn/components/index/index.html b/src/addons/mod/bigbluebuttonbn/components/index/index.html
index dcc1e84e1..a5a2baeb8 100644
--- a/src/addons/mod/bigbluebuttonbn/components/index/index.html
+++ b/src/addons/mod/bigbluebuttonbn/components/index/index.html
@@ -1,22 +1,18 @@
 <!-- Buttons to add to the header. -->
 <core-navbar-buttons slot="end">
     <core-context-menu>
-        <core-context-menu-item *ngIf="externalUrl" [priority]="900" [content]="'core.openinbrowser' | translate"
-            [href]="externalUrl" iconAction="fas-external-link-alt">
+        <core-context-menu-item *ngIf="externalUrl" [priority]="900" [content]="'core.openinbrowser' | translate" [href]="externalUrl"
+            iconAction="fas-external-link-alt">
         </core-context-menu-item>
         <core-context-menu-item *ngIf="description" [priority]="800" [content]="'core.moduleintro' | translate"
             (action)="expandDescription()" iconAction="fas-arrow-right">
         </core-context-menu-item>
-        <core-context-menu-item *ngIf="blog" [priority]="750" content="{{'addon.blog.blog' | translate}}"
-            iconAction="far-newspaper" (action)="gotoBlog()">
+        <core-context-menu-item *ngIf="blog" [priority]="750" content="{{'addon.blog.blog' | translate}}" iconAction="far-newspaper"
+            (action)="gotoBlog()">
         </core-context-menu-item>
         <core-context-menu-item *ngIf="loaded && isOnline" [priority]="700" [content]="'core.refresh' | translate"
             (action)="doRefresh(null, $event)" [iconAction]="refreshIcon" [closeOnClick]="false">
         </core-context-menu-item>
-        <core-context-menu-item *ngIf="loaded && hasOffline && isOnline" [priority]="600"
-            [content]="'core.settings.synchronizenow' | translate" (action)="doRefresh(null, $event, true)" [iconAction]="syncIcon"
-            [closeOnClick]="false">
-        </core-context-menu-item>
         <core-context-menu-item *ngIf="prefetchStatusIcon" [priority]="500" [content]="prefetchText" (action)="prefetch($event)"
             [iconAction]="prefetchStatusIcon" [closeOnClick]="false">
         </core-context-menu-item>
@@ -27,14 +23,10 @@
 <core-loading [hideUntil]="loaded" class="safe-area-page">
 
     <!-- Activity info. -->
-    <core-course-module-info *ngIf="showCompletion" [module]="module" [showManualCompletion]="true"
-        (completionChanged)="onCompletionChange()">
+    <core-course-module-info [module]="module" (completionChanged)="onCompletionChange()" [description]="description"
+        [component]="component" [componentId]="componentId" [courseId]="courseId">
     </core-course-module-info>
 
-    <core-course-module-description [description]="description" [component]="component" [componentId]="componentId"
-        contextLevel="module" [contextInstanceId]="module.id" [courseId]="courseId">
-    </core-course-module-description>
-
     <ng-container *ngIf="groupInfo && (groupInfo.separateGroups || groupInfo.visibleGroups)">
         <ion-card class="core-info-card" *ngIf="groupInfo.groups && groupInfo.groups.length > 1">
             <ion-item>
@@ -43,7 +35,7 @@
             </ion-item>
         </ion-card>
 
-        <ion-item class="ion-text-wrap" >
+        <ion-item class="ion-text-wrap">
             <ion-label id="addon-bigbluebuttonbn-groupslabel">
                 <ng-container *ngIf="groupInfo.separateGroups">{{'core.groupsseparate' | translate }}</ng-container>
                 <ng-container *ngIf="groupInfo.visibleGroups">{{'core.groupsvisible' | translate }}</ng-container>
@@ -133,3 +125,6 @@
         </ion-card>
     </ng-container>
 </core-loading>
+
+<core-course-module-navigation [hidden]="!loaded" [courseId]="courseId" [currentModuleId]="module.id">
+</core-course-module-navigation>
diff --git a/src/addons/mod/bigbluebuttonbn/components/index/index.ts b/src/addons/mod/bigbluebuttonbn/components/index/index.ts
index b47e7b356..16ff70143 100644
--- a/src/addons/mod/bigbluebuttonbn/components/index/index.ts
+++ b/src/addons/mod/bigbluebuttonbn/components/index/index.ts
@@ -45,7 +45,6 @@ export class AddonModBBBIndexComponent extends CoreCourseModuleMainActivityCompo
         @Optional() courseContentsPage?: CoreCourseContentsPage,
     ) {
         super('AddonModBBBIndexComponent', content, courseContentsPage);
-        (<any>window).ths = this;
     }
 
     /**
diff --git a/src/addons/mod/bigbluebuttonbn/pages/index/index.html b/src/addons/mod/bigbluebuttonbn/pages/index/index.html
index f8b7babdf..5d8e5197e 100644
--- a/src/addons/mod/bigbluebuttonbn/pages/index/index.html
+++ b/src/addons/mod/bigbluebuttonbn/pages/index/index.html
@@ -1,12 +1,14 @@
-<ion-header>
+<ion-header collapsible>
     <ion-toolbar>
         <ion-buttons slot="start">
             <ion-back-button [text]="'core.back' | translate"></ion-back-button>
         </ion-buttons>
-        <h1>
-            <core-format-text [text]="title" contextLevel="module" [contextInstanceId]="module?.id" [courseId]="courseId">
-            </core-format-text>
-        </h1>
+        <ion-title>
+            <h1>
+                <core-format-text [text]="title" contextLevel="module" [contextInstanceId]="module?.id" [courseId]="courseId">
+                </core-format-text>
+            </h1>
+        </ion-title>
         <ion-buttons slot="end">
             <!-- The buttons defined by the component will be added in here. -->
         </ion-buttons>
diff --git a/src/assets/img/mod/bigbluebuttonbn.svg b/src/assets/img/mod/bigbluebuttonbn.svg
new file mode 100644
index 000000000..7b92ab21b
--- /dev/null
+++ b/src/assets/img/mod/bigbluebuttonbn.svg
@@ -0,0 +1,55 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.0.4, SVG Export Plug-In . SVG Version: 6.00 Build 0)  -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+	 width="24px" height="24px" viewBox="0 0 30 30" enable-background="new 0 0 30 30" xml:space="preserve" preserveAspectRatio="xMinYMid meet">
+		<linearGradient id="SVGID_1_" gradientUnits="userSpaceOnUse" x1="-58.9473" y1="84.1865" x2="58.9479" y2="-84.1852">
+			<stop  offset="0" style="stop-color:#283274"/>
+			<stop  offset="0.7088" style="stop-color:#293275"/>
+			<stop  offset="0.967" style="stop-color:#273F87"/>
+		</linearGradient>
+<symbol  id="New_Symbol" viewBox="-107.423 -107.423 214.847 214.846">
+	<g>
+		<path fill="url(#SVGID_1_)" stroke="#5D6AA4" stroke-width="9.3191" d="M102.765,0c0-56.755-46.009-102.764-102.765-102.764
+			c-56.754,0-102.764,46.009-102.764,102.764S-56.754,102.764,0,102.764C56.756,102.764,102.765,56.755,102.765,0z"/>
+		
+			<linearGradient id="SVGID_2_" gradientUnits="userSpaceOnUse" x1="-75.0186" y1="112.8037" x2="-15.8528" y2="28.3063" gradientTransform="matrix(1 0 0 1 18.4946 -31.9512)">
+			<stop  offset="0" style="stop-color:#BEC7E5"/>
+			<stop  offset="0.0956" style="stop-color:#B5BEDE"/>
+			<stop  offset="0.2524" style="stop-color:#9CA5CC"/>
+			<stop  offset="0.4508" style="stop-color:#747DAE"/>
+			<stop  offset="0.6809" style="stop-color:#3D4684"/>
+			<stop  offset="0.7582" style="stop-color:#293275"/>
+		</linearGradient>
+		<path fill="url(#SVGID_2_)" d="M0.282,98.502C26.323,98.31,54.293,87.893,74.49,63.84C73.631,43.207,36.703,22.057,5.886-1.229
+			c-25.857-19.538-65.427-37.86-92.487-45.059c-25.73,49.263-7.016,96.619,25.25,123.238C-46.256,90.16-23.508,98.679,0.282,98.502z
+			"/>
+	</g>
+	<g>
+		<g>
+			<path d="M55.602-25.561c0-8.678-3.055-16.072-9.16-22.179c-6.11-6.109-13.501-9.16-22.179-9.16h-37.367
+				c-8.679,0-16.073,3.051-22.179,9.16c-6.11,6.106-9.162,13.501-9.162,22.179v93.779c6.656,0,12.336-3.254,17.046-9.764
+				c4.708-6.509,7.062-14.344,7.062-23.505v-60.511c0-4.821,2.411-7.231,7.232-7.231h37.367c4.821,0,7.231,2.41,7.231,7.231V3.128
+				c0,4.66-2.41,7.07-7.231,7.232H17.03c-9.323,0.324-17.2,2.757-23.626,7.304c-6.43,4.543-9.643,10.145-9.643,16.805h40.501
+				c8.678,0,16.068-3.056,22.179-9.161c6.105-6.11,9.16-13.5,9.16-22.18V-25.561z"/>
+		</g>
+	</g>
+	<g opacity="0.46">
+		<g>
+			<path fill="#FFFFFF" d="M55.602-25.561c0-8.678-3.055-16.072-9.16-22.179c-6.11-6.109-13.501-9.16-22.179-9.16h-37.367
+				c-8.679,0-16.073,3.051-22.179,9.16c-6.11,6.106-9.162,13.501-9.162,22.179v93.779c6.656,0,12.336-3.254,17.046-9.764
+				c4.708-6.509,7.062-14.344,7.062-23.505v-60.511c0-4.821,2.411-7.231,7.232-7.231h37.367c4.821,0,7.231,2.41,7.231,7.231V3.128
+				c0,4.66-2.41,7.07-7.231,7.232H17.03c-9.323,0.324-17.2,2.757-23.626,7.304c-6.43,4.543-9.643,10.145-9.643,16.805h40.501
+				c8.678,0,16.068-3.056,22.179-9.161c6.105-6.11,9.16-13.5,9.16-22.18V-25.561z"/>
+		</g>
+	</g>
+	<g>
+		<path fill="#FFFFFF" d="M53.829-26.788c0-8.678-3.055-16.072-9.16-22.179c-6.11-6.109-13.501-9.16-22.18-9.16h-37.367
+			c-8.679,0-16.073,3.051-22.179,9.16c-6.109,6.106-9.16,13.501-9.16,22.179v93.779c6.655,0,12.336-3.255,17.045-9.764
+			c4.708-6.509,7.062-14.345,7.062-23.505v-60.511c0-4.821,2.41-7.231,7.232-7.231h37.367c4.821,0,7.232,2.41,7.232,7.231V1.901
+			c0,4.66-2.411,7.07-7.232,7.232h-7.232C5.935,9.457-1.942,11.89-8.368,16.438c-6.43,4.542-9.644,10.144-9.644,16.803h40.501
+			c8.679,0,16.069-3.055,22.18-9.16c6.105-6.109,9.16-13.5,9.16-22.179V-26.788z"/>
+	</g>
+</symbol>
+<use xlink:href="#New_Symbol"  width="214.847" height="214.846" x="-107.423" y="-107.423" transform="matrix(0.1376 0 0 -0.1376 14.9995 15)" overflow="visible"/>
+</svg>
diff --git a/src/core/features/course/services/course.ts b/src/core/features/course/services/course.ts
index acea7dd52..6d5b8ea86 100644
--- a/src/core/features/course/services/course.ts
+++ b/src/core/features/course/services/course.ts
@@ -87,7 +87,7 @@ export class CoreCourseProvider {
     readonly CORE_MODULES = [
         'assign', 'assignment', 'book', 'chat', 'choice', 'data', 'database', 'date', 'external-tool',
         'feedback', 'file', 'folder', 'forum', 'glossary', 'ims', 'imscp', 'label', 'lesson', 'lti', 'page', 'quiz',
-        'resource', 'scorm', 'survey', 'url', 'wiki', 'workshop', 'h5pactivity',
+        'resource', 'scorm', 'survey', 'url', 'wiki', 'workshop', 'h5pactivity', 'bigbluebuttonbn',
     ];
 
     protected logger: CoreLogger;