From 1bc34fc4266a6a2571502b8d7ba6dd8bc3ecf6ae Mon Sep 17 00:00:00 2001 From: Tristan Potgieter Date: Wed, 16 Oct 2024 21:00:38 +0200 Subject: [PATCH 1/9] sumstuff --- .../desktop/settings/display/display.component.html | 2 +- .../desktop/settings/display/display.component.ts | 5 +++++ Frontend/src/app/pages/settings/settings.component.html | 9 --------- 3 files changed, 6 insertions(+), 10 deletions(-) diff --git a/Frontend/src/app/components/templates/desktop/settings/display/display.component.html b/Frontend/src/app/components/templates/desktop/settings/display/display.component.html index 0af5684d..c5eacbfb 100644 --- a/Frontend/src/app/components/templates/desktop/settings/display/display.component.html +++ b/Frontend/src/app/components/templates/desktop/settings/display/display.component.html @@ -8,7 +8,7 @@
diff --git a/Frontend/src/app/components/templates/desktop/settings/display/display.component.ts b/Frontend/src/app/components/templates/desktop/settings/display/display.component.ts index dda196c2..3f8af548 100644 --- a/Frontend/src/app/components/templates/desktop/settings/display/display.component.ts +++ b/Frontend/src/app/components/templates/desktop/settings/display/display.component.ts @@ -21,4 +21,9 @@ export class DisplayComponent { this.currentMood = this.moodService.getCurrentMood(); this.moodComponentClasses = this.moodService.getComponentMoodClasses(); } + + public toggleAutomaticUIChange() + { + //Disable mood service tracking + } } diff --git a/Frontend/src/app/pages/settings/settings.component.html b/Frontend/src/app/pages/settings/settings.component.html index 9496c4ff..21e15fe3 100644 --- a/Frontend/src/app/pages/settings/settings.component.html +++ b/Frontend/src/app/pages/settings/settings.component.html @@ -8,18 +8,9 @@

Settings

- - -
From 72432a139ab9571b161c07996420ff9908cf508d Mon Sep 17 00:00:00 2001 From: Tristan Potgieter Date: Thu, 17 Oct 2024 10:10:11 +0200 Subject: [PATCH 2/9] removed dolphin checkbox problems -Automatic Ui change button works now --- .../deskLogin/desk-login.component.html | 18 +++++++++-------- .../settings/display/display.component.html | 2 +- .../settings/display/display.component.ts | 5 +++++ .../src/app/services/mood-service.service.ts | 20 +++++++++++++++++-- 4 files changed, 34 insertions(+), 11 deletions(-) diff --git a/Frontend/src/app/components/templates/desktop/deskLogin/desk-login.component.html b/Frontend/src/app/components/templates/desktop/deskLogin/desk-login.component.html index 970a9c6f..5c876a11 100644 --- a/Frontend/src/app/components/templates/desktop/deskLogin/desk-login.component.html +++ b/Frontend/src/app/components/templates/desktop/deskLogin/desk-login.component.html @@ -1,15 +1,17 @@
- - -
-
- Your mood. Your music. + + +
+
+ Your mood. Your music. +
+
- -
- +
diff --git a/Frontend/src/app/components/templates/desktop/settings/display/display.component.html b/Frontend/src/app/components/templates/desktop/settings/display/display.component.html index c5eacbfb..35f5bb30 100644 --- a/Frontend/src/app/components/templates/desktop/settings/display/display.component.html +++ b/Frontend/src/app/components/templates/desktop/settings/display/display.component.html @@ -8,7 +8,7 @@
diff --git a/Frontend/src/app/components/templates/desktop/settings/display/display.component.ts b/Frontend/src/app/components/templates/desktop/settings/display/display.component.ts index 3f8af548..d8b662b3 100644 --- a/Frontend/src/app/components/templates/desktop/settings/display/display.component.ts +++ b/Frontend/src/app/components/templates/desktop/settings/display/display.component.ts @@ -22,8 +22,13 @@ export class DisplayComponent { this.moodComponentClasses = this.moodService.getComponentMoodClasses(); } + public getMoodServiceToggleSetting() + { + return this.moodService.getMoodToggleSetting(); + } public toggleAutomaticUIChange() { //Disable mood service tracking + this.moodService.moodServicetoggle(); } } diff --git a/Frontend/src/app/services/mood-service.service.ts b/Frontend/src/app/services/mood-service.service.ts index f01a4f5d..0f5a282c 100644 --- a/Frontend/src/app/services/mood-service.service.ts +++ b/Frontend/src/app/services/mood-service.service.ts @@ -5,6 +5,7 @@ import { Injectable } from '@angular/core'; }) export class MoodService { private _currentMood!: string; + private _automaticMoodChange: boolean = false; private _moodColors: { [key: string]: string } = { Neutral: 'rgb(238, 2, 88)', // #EE0258 @@ -89,6 +90,7 @@ export class MoodService { private initMood(): void { if (typeof window !== 'undefined') { this._currentMood = this.getLocalStorageItem('currentMood') || 'Neutral'; + this._automaticMoodChange = this.getLocalStorageItem('moodServiceToggle') === 'true'; } } private getLocalStorageItem(key: string): string | null { @@ -135,8 +137,22 @@ export class MoodService { return this._currentMood; } setCurrentMood(mood: string): void { - this._currentMood = mood; - this.setLocalStorageItem('currentMood', mood); + if(this._automaticMoodChange) + { + this._currentMood = mood; + this.setLocalStorageItem('currentMood', mood); + } + + } + + moodServicetoggle() + { + this._automaticMoodChange = !this._automaticMoodChange; + this.setLocalStorageItem('moodServiceToggle', this._automaticMoodChange.toString()); + } + getMoodToggleSetting() + { + return this._automaticMoodChange; } getAllMoods(): string[] { return Object.keys(this._componentMoodClasses); From 63ab4187abda751c1bcaf75e94e0fe487f3c3e1c Mon Sep 17 00:00:00 2001 From: Tristan Potgieter Date: Tue, 22 Oct 2024 21:22:54 +0200 Subject: [PATCH 3/9] Some changes made further --- .../settings/account/account.component.html | 4 +-- .../settings/account/account.component.ts | 25 ++++++++++++++++++- 2 files changed, 26 insertions(+), 3 deletions(-) diff --git a/Frontend/src/app/components/templates/desktop/settings/account/account.component.html b/Frontend/src/app/components/templates/desktop/settings/account/account.component.html index 62f8ae7c..18877bcc 100644 --- a/Frontend/src/app/components/templates/desktop/settings/account/account.component.html +++ b/Frontend/src/app/components/templates/desktop/settings/account/account.component.html @@ -6,7 +6,7 @@

Change Username

- +
@@ -26,7 +26,7 @@

Change Profile Picture

- +
diff --git a/Frontend/src/app/components/templates/desktop/settings/account/account.component.ts b/Frontend/src/app/components/templates/desktop/settings/account/account.component.ts index 4e6d15b2..b104b442 100644 --- a/Frontend/src/app/components/templates/desktop/settings/account/account.component.ts +++ b/Frontend/src/app/components/templates/desktop/settings/account/account.component.ts @@ -1,6 +1,7 @@ import { Component } from '@angular/core'; import { MoodService } from '../../../../../services/mood-service.service'; import { NgClass } from '@angular/common'; +import { AuthService } from '../../../../../services/auth.service'; @Component({ selector: 'app-account', @@ -11,13 +12,35 @@ import { NgClass } from '@angular/common'; }) export class AccountComponent { currentMood!: string; + currentUser!: string; + currentPfpPath!: string; + currentProvider!: string; moodComponentClasses!:{ [key: string]: string }; backgroundMoodClasses!:{ [key: string]: string }; constructor( public moodService: MoodService, + public authService: AuthService, ) { this.currentMood = this.moodService.getCurrentMood(); - this.moodComponentClasses = this.moodService.getComponentMoodClasses(); + this.moodComponentClasses = this.moodService.getComponentMoodClasses(); + this.currentUser = 'John Doe' + this.authService.currentUser().subscribe((res) => { + this.currentUser = res.user.user_metadata.name; + this.currentPfpPath = res.user.user_metadata.picture; + }); + this.authService.checkOAuth().subscribe((res) => { + console.log(res.providers); + }); + } + + getCurrentUser() + { + + } + + getLinkedAccounts() + { + } } From 17e84cce53fbfeff6ea4fecefeedbdd8741dd9b8 Mon Sep 17 00:00:00 2001 From: 21797545 Date: Wed, 23 Oct 2024 21:21:30 +0200 Subject: [PATCH 4/9] :triangular_ruler: Adjusted UserAuhtInfo interface structure --- Backend/src/auth/services/auth.service.ts | 8 +++++--- Frontend/src/app/services/auth.service.ts | 3 ++- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/Backend/src/auth/services/auth.service.ts b/Backend/src/auth/services/auth.service.ts index 4df9734f..f77d5683 100644 --- a/Backend/src/auth/services/auth.service.ts +++ b/Backend/src/auth/services/auth.service.ts @@ -5,7 +5,8 @@ import { AuthDto } from "../../dto/auth.dto"; export interface UserAuthInfo { oAuth: boolean, - providers: string[] + providers: string[], + currentProvider: string } @@ -88,8 +89,9 @@ export class AuthService const providers = user.app_metadata.providers; const oAuth = providers.length > 0; + const currentProvider = user.app_metadata.provider; - return { oAuth, providers }; + return { oAuth, providers, currentProvider }; } @@ -112,7 +114,7 @@ export class AuthService { return { provider: "none", - message: "No user logged in" + message: "No user logged in", }; } diff --git a/Frontend/src/app/services/auth.service.ts b/Frontend/src/app/services/auth.service.ts index 03bcfe7a..65ebac8b 100644 --- a/Frontend/src/app/services/auth.service.ts +++ b/Frontend/src/app/services/auth.service.ts @@ -18,7 +18,8 @@ export interface AuthResponse export interface UserAuthInfo { oAuth: boolean, - providers: string[] + providers: string[], + currentProvider: string } @Injectable({ From 46aea72a6dabd4372db40d8d2ce254dd6ee175c6 Mon Sep 17 00:00:00 2001 From: Rueben van der Westhuizen <91849806+21434809@users.noreply.github.com> Date: Thu, 24 Oct 2024 13:31:42 +0200 Subject: [PATCH 5/9] Adjust automatic mood change to true in MoodService --- Frontend/src/app/services/mood-service.service.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Frontend/src/app/services/mood-service.service.ts b/Frontend/src/app/services/mood-service.service.ts index ba4323e3..850b8336 100644 --- a/Frontend/src/app/services/mood-service.service.ts +++ b/Frontend/src/app/services/mood-service.service.ts @@ -5,7 +5,7 @@ import { Injectable } from '@angular/core'; }) export class MoodService { private _currentMood!: string; - private _automaticMoodChange: boolean = false; + private _automaticMoodChange: boolean = true; private _moodColors: { [key: string]: string } = { Neutral: 'rgb(238, 2, 88)', // #EE0258 From 5a7fb5c720edbf2d93c401258dc195c03a8ad9e7 Mon Sep 17 00:00:00 2001 From: Rueben van der Westhuizen <91849806+21434809@users.noreply.github.com> Date: Thu, 24 Oct 2024 14:00:04 +0200 Subject: [PATCH 6/9] Adjust layout and styling in settings component --- .../pages/settings/settings.component.html | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/Frontend/src/app/pages/settings/settings.component.html b/Frontend/src/app/pages/settings/settings.component.html index 21e15fe3..9fd231f5 100644 --- a/Frontend/src/app/pages/settings/settings.component.html +++ b/Frontend/src/app/pages/settings/settings.component.html @@ -1,21 +1,22 @@ -
+
-
+
- -
-

Settings

+
+
+ +

Settings

+
-
-
+ -
-

{{ activeSetting }}

+
@@ -32,8 +33,7 @@

{{ activeSetting }}

-
+
-
-
+
\ No newline at end of file From 027651f573fe1c24656825ae6e3402a5486a8654 Mon Sep 17 00:00:00 2001 From: Rueben van der Westhuizen <91849806+21434809@users.noreply.github.com> Date: Thu, 24 Oct 2024 14:09:27 +0200 Subject: [PATCH 7/9] Adjust layout and styling in settings component --- Frontend/src/app/pages/settings/settings.component.html | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Frontend/src/app/pages/settings/settings.component.html b/Frontend/src/app/pages/settings/settings.component.html index 9fd231f5..ac826458 100644 --- a/Frontend/src/app/pages/settings/settings.component.html +++ b/Frontend/src/app/pages/settings/settings.component.html @@ -2,7 +2,7 @@
-
+

Settings

@@ -16,8 +16,8 @@

Settings

-
-
+
+
From 40ff0212c4baa7c2941bfd618dac19874ee62757 Mon Sep 17 00:00:00 2001 From: Rueben van der Westhuizen <91849806+21434809@users.noreply.github.com> Date: Thu, 24 Oct 2024 14:15:16 +0200 Subject: [PATCH 8/9] Adjust automatic mood change initialization in MoodService --- Frontend/src/app/services/mood-service.service.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Frontend/src/app/services/mood-service.service.ts b/Frontend/src/app/services/mood-service.service.ts index 850b8336..aad0cc59 100644 --- a/Frontend/src/app/services/mood-service.service.ts +++ b/Frontend/src/app/services/mood-service.service.ts @@ -5,7 +5,7 @@ import { Injectable } from '@angular/core'; }) export class MoodService { private _currentMood!: string; - private _automaticMoodChange: boolean = true; + private _automaticMoodChange: boolean = true; private _moodColors: { [key: string]: string } = { Neutral: 'rgb(238, 2, 88)', // #EE0258 @@ -90,7 +90,8 @@ export class MoodService { private initMood(): void { if (typeof window !== 'undefined') { this._currentMood = this.getLocalStorageItem('currentMood') || 'Neutral'; - this._automaticMoodChange = this.getLocalStorageItem('moodServiceToggle') === 'true'; + const moodServiceToggle = this.getLocalStorageItem('moodServiceToggle'); + this._automaticMoodChange = moodServiceToggle === null ? true : moodServiceToggle === 'true'; } } private getLocalStorageItem(key: string): string | null { From 9e2f041a2f6bce2ec01bad27f3fb2843f8a099b8 Mon Sep 17 00:00:00 2001 From: Tristan Potgieter Date: Thu, 24 Oct 2024 14:21:15 +0200 Subject: [PATCH 9/9] Changed settings to display based on provider --- .../settings/account/account.component.html | 33 +++---------------- .../settings/account/account.component.ts | 11 ++++++- 2 files changed, 15 insertions(+), 29 deletions(-) diff --git a/Frontend/src/app/components/templates/desktop/settings/account/account.component.html b/Frontend/src/app/components/templates/desktop/settings/account/account.component.html index 18877bcc..db8b4ed3 100644 --- a/Frontend/src/app/components/templates/desktop/settings/account/account.component.html +++ b/Frontend/src/app/components/templates/desktop/settings/account/account.component.html @@ -1,7 +1,7 @@
-
+

Change Username

@@ -11,7 +11,7 @@
-
+

Change Password

@@ -21,7 +21,7 @@
-
+

Change Profile Picture

@@ -30,36 +30,13 @@
- -
-
-

Enable Two-Factor Authentication

-
-
- -
-
-
-

Manage Connected Accounts

-
-
- -
-
- - -
-
-

Delete Account

+

Connected Accounts

- +
diff --git a/Frontend/src/app/components/templates/desktop/settings/account/account.component.ts b/Frontend/src/app/components/templates/desktop/settings/account/account.component.ts index b104b442..42d94ba9 100644 --- a/Frontend/src/app/components/templates/desktop/settings/account/account.component.ts +++ b/Frontend/src/app/components/templates/desktop/settings/account/account.component.ts @@ -30,10 +30,19 @@ export class AccountComponent { this.currentPfpPath = res.user.user_metadata.picture; }); this.authService.checkOAuth().subscribe((res) => { - console.log(res.providers); + console.log(res.currentProvider); + this.currentProvider = res.currentProvider; }); } + validProvider() : boolean { + if(this.currentProvider != 'spotify' && this.currentProvider != 'google') + { + return true; + } + return false; + } + getCurrentUser() {