diff --git a/src/app/app.module.ts b/src/app/app.module.ts index cf1e0c66..6784c731 100644 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -5,7 +5,7 @@ import { AppRoutingModule } from './app-routing.module'; import { HttpClientModule, HTTP_INTERCEPTORS } from '@angular/common/http'; import { ToastModule } from 'primeng/toast'; import { ConfirmDialogModule } from 'primeng/confirmdialog'; -import { ConfirmationService } from 'primeng/api'; +import { ConfirmationService, MessageService } from 'primeng/api'; import { BrowserAnimationsModule } from '@angular/platform-browser/animations'; import { OAuthModule, OAuthStorage } from 'angular-oauth2-oidc'; import { InputTextModule } from 'primeng/inputtext'; @@ -37,7 +37,6 @@ import { SuggestAgendaComponent } from './pages/suggest-agenda/suggest-agenda.co import { ParticipateComponent } from './pages/participate/participate.component'; import { GridComponent } from './pages/grid/grid.component'; import { GridDaysComponent } from './pages/grid-days/grid-days.component'; -import { MessageService } from 'primeng/api'; import { ProgressSpinnerModule } from 'primeng/progressspinner'; @NgModule({ @@ -92,4 +91,4 @@ import { ProgressSpinnerModule } from 'primeng/progressspinner'; ], bootstrap: [AppComponent], }) -export class AppModule { } +export class AppModule {} diff --git a/src/app/components/background/background.component.html b/src/app/components/background/background.component.html index 58118799..313d363e 100644 --- a/src/app/components/background/background.component.html +++ b/src/app/components/background/background.component.html @@ -32,44 +32,71 @@ -
+
-
-
- - form-unb - -
- diff --git a/src/app/components/background/background.component.spec.ts b/src/app/components/background/background.component.spec.ts index ef9c0a4c..a9058ab1 100644 --- a/src/app/components/background/background.component.spec.ts +++ b/src/app/components/background/background.component.spec.ts @@ -11,9 +11,8 @@ describe('BackgroundComponent', () => { beforeEach(async () => { await TestBed.configureTestingModule({ declarations: [BackgroundComponent], - imports: [RouterTestingModule, MenuModule] - }) - .compileComponents(); + imports: [RouterTestingModule, MenuModule], + }).compileComponents(); fixture = TestBed.createComponent(BackgroundComponent); component = fixture.componentInstance; @@ -23,4 +22,97 @@ describe('BackgroundComponent', () => { it('should create', () => { expect(component).toBeTruthy(); }); + + describe('Identifies User Device', () => { + it('should identify a mobile device - Android', () => { + // mock userAgent for Android + Object.defineProperty(navigator, 'userAgent', { + value: + 'Mozilla/5.0 (Linux; Android 10; Pixel 3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Mobile Safari/537.36', + configurable: true, + writable: true, + }); + + component.identifiesUserDevice(); + expect(component.mobileDevide).toBeTruthy(); + }); + + it('should identify a mobile device - iPhone', () => { + // mock userAgent for iPhone + Object.defineProperty(navigator, 'userAgent', { + value: + 'Mozilla/5.0 (iPhone; CPU iPhone OS 15_7_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/15.6.3 Mobile/15E148 Safari/604.1', + configurable: true, + writable: true, + }); + + component.identifiesUserDevice(); + expect(component.mobileDevide).toBeTruthy(); + }); + + it('should identify a mobile device - iPad', () => { + // mock userAgent for iPad + Object.defineProperty(navigator, 'userAgent', { + value: + 'Mozilla/5.0 (iPad; CPU OS 14_7 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.1 Mobile/15E148 Safari/604.1', + configurable: true, + writable: true, + }); + + component.identifiesUserDevice(); + expect(component.mobileDevide).toBeTruthy(); + }); + + it('should identify a mobile device - iPod', () => { + // mock userAgent for iPod + Object.defineProperty(navigator, 'userAgent', { + value: + 'Mozilla/5.0 (iPod; CPU iPhone OS 14_7 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.1 Mobile/15E148 Safari/604.1', + configurable: true, + writable: true, + }); + + component.identifiesUserDevice(); + expect(component.mobileDevide).toBeTruthy(); + }); + + it('should identify a mobile device - Windows Phone', () => { + // mock userAgent for Windows Phone + Object.defineProperty(navigator, 'userAgent', { + value: + 'Mozilla/5.0 (Windows Phone 10.0; Android 6.0.1; Microsoft; Lumia 950 XL) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Mobile Safari/537.36 Edge/13.10586', + configurable: true, + writable: true, + }); + + component.identifiesUserDevice(); + expect(component.mobileDevide).toBeTruthy(); + }); + + it('should identify a mobile device - BlackBerry', () => { + // mock userAgent for BlackBerry + Object.defineProperty(navigator, 'userAgent', { + value: + 'Mozilla/5.0 (BlackBerry; U; BlackBerry 9900; en) AppleWebKit/534.11+ (KHTML, like Gecko) Version/7.1.0.346 Mobile Safari/534.11+', + configurable: true, + writable: true, + }); + + component.identifiesUserDevice(); + expect(component.mobileDevide).toBeTruthy(); + }); + + it('should identify a non-mobile device', () => { + // mock userAgent + Object.defineProperty(navigator, 'userAgent', { + value: + 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/118.0.0.0 Safari/537.36 OPR/104.0.0.0 (Edition std-1)', + configurable: true, + writable: true, + }); + + component.identifiesUserDevice(); + expect(component.mobileDevide).toBeFalsy(); + }); + }); }); diff --git a/src/app/components/background/background.component.ts b/src/app/components/background/background.component.ts index 80ce1d0e..34f00dee 100644 --- a/src/app/components/background/background.component.ts +++ b/src/app/components/background/background.component.ts @@ -1,26 +1,40 @@ import { Component, OnInit } from '@angular/core'; import { MenuItem, MessageService } from 'primeng/api'; - @Component({ selector: 'app-background', templateUrl: './background.component.html', styleUrls: ['./background.component.css'], - providers: [MessageService] + providers: [MessageService], }) export class BackgroundComponent implements OnInit { items: MenuItem[] = []; + mobileDevide: boolean = true; - constructor( - ) { } + constructor() {} ngOnInit(): void { this.items = [ { label: 'Perfil', - routerLink: '/profile' - } - ] + routerLink: '/profile', + }, + ]; + this.identifiesUserDevice(); } + identifiesUserDevice(): void { + if ( + RegExp(/Android/i).exec(navigator.userAgent) || + RegExp(/iPhone/i).exec(navigator.userAgent) || + RegExp(/iPad/i).exec(navigator.userAgent) || + RegExp(/iPod/i).exec(navigator.userAgent) || + RegExp(/BlackBerry/i).exec(navigator.userAgent) || + RegExp(/Windows Phone/i).exec(navigator.userAgent) + ) { + this.mobileDevide = true; // está utilizando dispositivo móvel + } else { + this.mobileDevide = false; + } + } } diff --git a/src/app/pages/agora/agora.component.css b/src/app/pages/agora/agora.component.css new file mode 100644 index 00000000..e69de29b diff --git a/src/app/pages/agora/agora.component.html b/src/app/pages/agora/agora.component.html new file mode 100644 index 00000000..48b60c14 --- /dev/null +++ b/src/app/pages/agora/agora.component.html @@ -0,0 +1 @@ +

agora works!

diff --git a/src/app/pages/agora/agora.component.spec.ts b/src/app/pages/agora/agora.component.spec.ts new file mode 100644 index 00000000..a11174b6 --- /dev/null +++ b/src/app/pages/agora/agora.component.spec.ts @@ -0,0 +1,23 @@ +import { ComponentFixture, TestBed } from '@angular/core/testing'; + +import { AgoraComponent } from './agora.component'; + +describe('AgoraComponent', () => { + let component: AgoraComponent; + let fixture: ComponentFixture; + + beforeEach(async () => { + await TestBed.configureTestingModule({ + declarations: [ AgoraComponent ] + }) + .compileComponents(); + + fixture = TestBed.createComponent(AgoraComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/pages/agora/agora.component.ts b/src/app/pages/agora/agora.component.ts new file mode 100644 index 00000000..4ee9c175 --- /dev/null +++ b/src/app/pages/agora/agora.component.ts @@ -0,0 +1,10 @@ +import { Component } from '@angular/core'; + +@Component({ + selector: 'app-agora', + templateUrl: './agora.component.html', + styleUrls: ['./agora.component.css'] +}) +export class AgoraComponent { + +} diff --git a/src/app/pages/programacao/programacao.component.css b/src/app/pages/programacao/programacao.component.css new file mode 100644 index 00000000..e69de29b diff --git a/src/app/pages/programacao/programacao.component.html b/src/app/pages/programacao/programacao.component.html new file mode 100644 index 00000000..a1c2dc60 --- /dev/null +++ b/src/app/pages/programacao/programacao.component.html @@ -0,0 +1 @@ +

programacao works!

diff --git a/src/app/pages/programacao/programacao.component.spec.ts b/src/app/pages/programacao/programacao.component.spec.ts new file mode 100644 index 00000000..dc125793 --- /dev/null +++ b/src/app/pages/programacao/programacao.component.spec.ts @@ -0,0 +1,23 @@ +import { ComponentFixture, TestBed } from '@angular/core/testing'; + +import { ProgramacaoComponent } from './programacao.component'; + +describe('ProgramacaoComponent', () => { + let component: ProgramacaoComponent; + let fixture: ComponentFixture; + + beforeEach(async () => { + await TestBed.configureTestingModule({ + declarations: [ ProgramacaoComponent ] + }) + .compileComponents(); + + fixture = TestBed.createComponent(ProgramacaoComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/pages/programacao/programacao.component.ts b/src/app/pages/programacao/programacao.component.ts new file mode 100644 index 00000000..cf1bf82d --- /dev/null +++ b/src/app/pages/programacao/programacao.component.ts @@ -0,0 +1,10 @@ +import { Component } from '@angular/core'; + +@Component({ + selector: 'app-programacao', + templateUrl: './programacao.component.html', + styleUrls: ['./programacao.component.css'] +}) +export class ProgramacaoComponent { + +}