Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Revert "feat: TT-577 get profile pic from Google account (#825)"
This reverts commit 3bee7e3.
  • Loading branch information
cxcarvaj authored Mar 16, 2022
commit 2c243f97e099937f48f97deb64c82033a08263c1
5 changes: 1 addition & 4 deletions src/app/modules/login/services/login.service.spec.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { HttpClientTestingModule, HttpTestingController } from '@angular/common/http/testing';
import { TestBed } from '@angular/core/testing';
import {SocialAuthService, SocialUser} from 'angularx-social-login';
import { SocialAuthService } from 'angularx-social-login';
import { CookieService } from 'ngx-cookie-service';
import { of } from 'rxjs';

Expand All @@ -13,9 +13,6 @@ describe('LoginService', () => {
let socialAuthService: SocialAuthService;
let account;
const socialAuthServiceStub = jasmine.createSpyObj('SocialAuthService', ['signOut', 'signIn']);
socialAuthServiceStub.signIn.and.returnValue(new Promise<SocialUser>( resolve => {
return {photoUrl: ''};
}));
const cookieStoreStub = {};

beforeEach(() => {
Expand Down
4 changes: 1 addition & 3 deletions src/app/modules/login/services/login.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,7 @@ export class LoginService {
}

signIn() {
this.socialAuthService.signIn(GoogleLoginProvider.PROVIDER_ID).then(user => {
localStorage.setItem('googleUserPhoto', user.photoUrl);
});
this.socialAuthService.signIn(GoogleLoginProvider.PROVIDER_ID);
}
logout() {
this.socialAuthService.signOut();
Expand Down
8 changes: 4 additions & 4 deletions src/app/modules/shared/components/user/user.component.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<div class=" py-8 flex items-center pl-3">
<img [src]="userPhoto" alt="user-icon" class="round"/>
<img src="assets/icons/user.svg" alt="user-icon" width="40" height="40"/>
<span class="pl-1">
<h2 class="font-poppins text-base font-semibold pl-2 dark:text-whiteTW">{{ userName }}</h2>
<p class="font-poppins mt-1 text-xs font-medium pl-2 text-grayTW dark:text-whiteTW">{{ userEmail }}</p>
<h2 class="font-poppins text-base font-semibold pl-2 dark:text-whiteTW">{{userName}}</h2>
<p class="font-poppins mt-1 text-xs font-medium pl-2 text-grayTW dark:text-whiteTW">{{userEmail}}</p>
</span>
</div>
</div>
6 changes: 0 additions & 6 deletions src/app/modules/shared/components/user/user.component.scss
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
@import '../../../../../styles/colors.scss';

.round {
width:40px;
height:40px;
border-radius:150px;
}

.user-profile {
color: black;
cursor: pointer;
Expand Down
11 changes: 3 additions & 8 deletions src/app/modules/shared/components/user/user.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,30 +9,25 @@ import { LoginService } from '../../../login/services/login.service';
styleUrls: ['./user.component.scss'],
})
export class UserComponent implements OnInit {
userPhoto: string;
userName: string;
userEmail: string;
isProduction = environment.production;

constructor(
private azureAdB2CService: AzureAdB2CService,
private loginService: LoginService
) { }
constructor(private azureAdB2CService: AzureAdB2CService, private loginService: LoginService) {}

ngOnInit(): void {
if (this.isProduction) {
if (this.isProduction){
if (this.azureAdB2CService.isLogin()) {
this.userName = this.azureAdB2CService.getName();
this.userEmail = this.azureAdB2CService.getUserEmail();
this.azureAdB2CService.setTenantId();
}
} else {
}else{
if (this.loginService.isLogin()) {
this.userName = this.loginService.getName();
this.userEmail = this.loginService.getUserEmail();
this.azureAdB2CService.setTenantId();
}
}
this.userPhoto = localStorage.getItem('googleUserPhoto');
}
}