activation improve

This commit is contained in:
Peter Maquiran
2023-02-08 09:53:21 +01:00
parent 4682371286
commit 7652db7063
6 changed files with 84 additions and 21 deletions
+10 -10
View File
@@ -5,34 +5,34 @@
<ion-tab-button *ngIf="SessionStore.user.OwnerCalendars.length >= 1 || p.userPermission([permissionList.Gabinete.access])" (click)="goto('/home/events')" tab="events" [class.active]="pathname === '/home/events'"> <ion-tab-button *ngIf="SessionStore.user.OwnerCalendars.length >= 1 || p.userPermission([permissionList.Gabinete.access])" (click)="goto('/home/events')" tab="events" [class.active]="pathname === '/home/events'">
<!-- <ion-icon name="home"></ion-icon> --> <!-- <ion-icon name="home"></ion-icon> -->
<ion-icon *ngIf="pathname != '/home/events'" class="nav-icon" src="assets/images/icons-nav-home.svg"></ion-icon> <ion-icon *ngIf="!ActiveTabService.pages.home" class="nav-icon" src="assets/images/icons-nav-home.svg"></ion-icon>
<ion-icon *ngIf="pathname == '/home/events'" class="nav-icon" src="assets/images/nav-hover/icons-nav-home-active.svg"></ion-icon> <ion-icon *ngIf="ActiveTabService.pages.home" class="nav-icon" src="assets/images/nav-hover/icons-nav-home-active.svg"></ion-icon>
<ion-label>Início</ion-label> <ion-label>Início</ion-label>
</ion-tab-button> </ion-tab-button>
<ion-tab-button *ngIf="p.userPermission([permissionList.Agenda.access])" (click)="goto('/home/agenda')" tab="agenda" [class.active]="pathname === '/home/agenda' "> <ion-tab-button *ngIf="p.userPermission([permissionList.Agenda.access])" (click)="goto('/home/agenda')" tab="agenda" [class.active]="pathname === '/home/agenda' ">
<!-- <ion-icon name="calendar"></ion-icon> --> <!-- <ion-icon name="calendar"></ion-icon> -->
<ion-icon *ngIf="pathname != '/home/agenda'" class="nav-icon" src="assets/images/icons-nav-calendar.svg"></ion-icon> <ion-icon *ngIf="!ActiveTabService.pages.agenda" class="nav-icon" src="assets/images/icons-nav-calendar.svg"></ion-icon>
<ion-icon *ngIf="pathname == '/home/agenda'" class="nav-icon" src="assets/images/nav-hover/icons-nav-agenda-active.svg"></ion-icon> <ion-icon *ngIf="ActiveTabService.pages.agenda" class="nav-icon" src="assets/images/nav-hover/icons-nav-agenda-active.svg"></ion-icon>
<ion-label style="margin-bottom: 2px;" class="overflow-visible">Agenda</ion-label> <ion-label style="margin-bottom: 2px;" class="overflow-visible">Agenda</ion-label>
</ion-tab-button> </ion-tab-button>
<ion-tab-button *ngIf="p.userPermission([permissionList.Gabinete.access])" (click)="goto('/home/gabinete-digital')" [class.active]="pathname === '/home/gabinete-digital' "> <ion-tab-button *ngIf="p.userPermission([permissionList.Gabinete.access])" (click)="goto('/home/gabinete-digital')" [class.active]="pathname === '/home/gabinete-digital' ">
<!-- <ion-icon name="file-tray-stacked"></ion-icon> --> <!-- <ion-icon name="file-tray-stacked"></ion-icon> -->
<ion-icon *ngIf="pathname != '/home/gabinete-digital'" class="nav-icon" src="assets/images/icons-nav-gabinete-inactive.svg"></ion-icon> <ion-icon *ngIf="!ActiveTabService.pages.gabinete" class="nav-icon" src="assets/images/icons-nav-gabinete-inactive.svg"></ion-icon>
<ion-icon *ngIf="pathname == '/home/gabinete-digital'" class="nav-icon" src="assets/images/nav-hover/icons-nav-gabinete-active.svg"></ion-icon> <ion-icon *ngIf="ActiveTabService.pages.gabinete" class="nav-icon" src="assets/images/nav-hover/icons-nav-gabinete-active.svg"></ion-icon>
<ion-label>Gabinete</ion-label> <ion-label>Gabinete</ion-label>
</ion-tab-button> </ion-tab-button>
<ion-tab-button *ngIf="p.userPermission([permissionList.Actions.access])" tab="publications" [class.active]="pathname === '/home/publications' "> <ion-tab-button *ngIf="p.userPermission([permissionList.Actions.access])" tab="publications" [class.active]="pathname === '/home/publications' ">
<ion-icon *ngIf="pathname != '/home/publications'" class="nav-icon" src="assets/images/icons-nav-actions.svg"></ion-icon> <ion-icon *ngIf="!ActiveTabService.pages.publication" class="nav-icon" src="assets/images/icons-nav-actions.svg"></ion-icon>
<ion-icon *ngIf="pathname == '/home/publications'" class="nav-icon" src="assets/images/nav-hover/icons-nav-actions-active.svg"></ion-icon> <ion-icon *ngIf="ActiveTabService.pages.publication" class="nav-icon" src="assets/images/nav-hover/icons-nav-actions-active.svg"></ion-icon>
<ion-label style="margin-bottom: 2px;" class="overflow-visible">Acções</ion-label> <ion-label style="margin-bottom: 2px;" class="overflow-visible">Acções</ion-label>
</ion-tab-button> </ion-tab-button>
<ion-tab-button *ngIf="p.userPermission([permissionList.Chat.access])" tab="chat" [class.active]="pathname === '/home/chat' "> <ion-tab-button *ngIf="p.userPermission([permissionList.Chat.access])" tab="chat" [class.active]="pathname === '/home/chat' ">
<ion-icon *ngIf="pathname != '/home/chat'" class="nav-icon" src="assets/images/icons-nav-chat-inactive.svg"></ion-icon> <ion-icon *ngIf="!ActiveTabService.pages.chat" class="nav-icon" src="assets/images/icons-nav-chat-inactive.svg"></ion-icon>
<ion-icon *ngIf="pathname == '/home/chat'" class="nav-icon" src="assets/images/nav-hover/icons-nav-chat-active.svg"></ion-icon> <ion-icon *ngIf="ActiveTabService.pages.chat" class="nav-icon" src="assets/images/nav-hover/icons-nav-chat-active.svg"></ion-icon>
<ion-label>Chat</ion-label> <ion-label>Chat</ion-label>
</ion-tab-button> </ion-tab-button>
+2 -4
View File
@@ -14,6 +14,7 @@ import { EventsService } from 'src/app/services/events.service';
import { RochetChatConnectorService } from 'src/app/services/chat/rochet-chat-connector.service'; import { RochetChatConnectorService } from 'src/app/services/chat/rochet-chat-connector.service';
import { ProcessesService } from 'src/app/services/processes.service'; import { ProcessesService } from 'src/app/services/processes.service';
import { SqliteService } from 'src/app/services/sqlite.service'; import { SqliteService } from 'src/app/services/sqlite.service';
import { ActiveTabService } from 'src/app/services/active-tab.service';
import { Device } from '@capacitor/device'; import { Device } from '@capacitor/device';
import { RouteService } from 'src/app/services/route.service'; import { RouteService } from 'src/app/services/route.service';
import { NetworkServiceService, ConnectionStatus } from 'src/app/services/network-service.service'; import { NetworkServiceService, ConnectionStatus } from 'src/app/services/network-service.service';
@@ -89,6 +90,7 @@ export class HomePage implements OnInit {
private RochetChatConnectorService: RochetChatConnectorService, private RochetChatConnectorService: RochetChatConnectorService,
private NetworkServiceService: NetworkServiceService, private NetworkServiceService: NetworkServiceService,
public eventService: EventsService, public eventService: EventsService,
public ActiveTabService: ActiveTabService
) { ) {
if (SessionStore.exist) { if (SessionStore.exist) {
this.user = SessionStore.user; this.user = SessionStore.user;
@@ -223,10 +225,6 @@ export class HomePage implements OnInit {
const info = await Device.getInfo(); const info = await Device.getInfo();
} }
get pathname() {
return window.location.pathname
}
updateList() { updateList() {
document.addEventListener('pause', function () { document.addEventListener('pause', function () {
@@ -0,0 +1,16 @@
import { TestBed } from '@angular/core/testing';
import { ActiveTabService } from './active-tab.service';
describe('ActiveTabService', () => {
let service: ActiveTabService;
beforeEach(() => {
TestBed.configureTestingModule({});
service = TestBed.inject(ActiveTabService);
});
it('should be created', () => {
expect(service).toBeTruthy();
});
});
+49
View File
@@ -0,0 +1,49 @@
import { Injectable } from '@angular/core';
import { Router } from '@angular/router';
@Injectable({
providedIn: 'root'
})
export class ActiveTabService {
pages = {
chat: false,
agenda: false,
publication: false,
home: false,
gabinete: false
}
constructor(private router: Router) {
this.detectActiveTab()
this.router.events.subscribe((val) => {
this.detectActiveTab()
});
}
detectActiveTab() {
this.setFalseToAllPage();
const pathName = window.location.pathname
if(pathName.startsWith('/home/agenda')) {
this.pages.agenda = true
} else if (pathName.startsWith('/home/events')) {
this.pages.home = true
} else if (pathName.startsWith('/home/gabinete-digital')) {
this.pages.gabinete = true
} else if (pathName.startsWith('/home/publications')) {
this.pages.publication = true
} else if (pathName.startsWith('/home/chat')) {
this.pages.chat = true
}
}
setFalseToAllPage() {
for( const page in this.pages) {
this.pages[page] = false
}
}
}
+1 -1
View File
@@ -3,4 +3,4 @@ import { oaprDev } from './suport/oapr'
import { doneITDev } from './suport/doneIt' import { doneITDev } from './suport/doneIt'
export const environment: Environment = oaprDev; export const environment: Environment = doneITDev;
+6 -6
View File
@@ -1,12 +1,12 @@
export let versionData = { export let versionData = {
"shortSHA": "976f9cbf2", "shortSHA": "468237128",
"SHA": "976f9cbf2c3bd09c8ab08beb9f4d5044a3709a81", "SHA": "46823712867f8a5685047185c2104dd362a038cf",
"branch": "no_bug_movemente", "branch": "no_bug_movemente",
"lastCommitAuthor": "'Peter Maquiran'", "lastCommitAuthor": "'Peter Maquiran'",
"lastCommitTime": "'Tue Feb 7 16:10:11 2023 +0100'", "lastCommitTime": "'Tue Feb 7 17:24:26 2023 +0100'",
"lastCommitMessage": "Fix", "lastCommitMessage": "fix",
"lastCommitNumber": "4749", "lastCommitNumber": "4752",
"change": "", "change": "",
"changeStatus": "On branch no_bug_movemente\nAll conflicts fixed but you are still merging.\n (use \"git commit\" to conclude merge)\n\nChanges to be committed:\n\tmodified: src/environments/environment.ts\n\tmodified: version/git-version.ts", "changeStatus": "On branch no_bug_movemente\nChanges to be committed:\n (use \"git restore --staged <file>...\" to unstage)\n\tmodified: src/app/home/home.page.html\n\tmodified: src/app/home/home.page.ts\n\tnew file: src/app/services/active-tab.service.spec.ts\n\tnew file: src/app/services/active-tab.service.ts\n\tmodified: src/environments/environment.ts",
"changeAuthor": "peter.maquiran" "changeAuthor": "peter.maquiran"
} }