Skip to content

Commit

Permalink
Merge pull request #327 from rahulramakrishnan3/release-2.5.0
Browse files Browse the repository at this point in the history
Release 2.5.0
  • Loading branch information
vijiurs authored Dec 7, 2023
2 parents 0d9bb2f + 4e9d301 commit bad640c
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 5 deletions.
4 changes: 3 additions & 1 deletion src/app/core/guards/private.guard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,20 @@ import { Observable } from 'rxjs';
import { Router } from '@angular/router';
import { CommonRoutes } from 'src/global.routes';
import { UserService } from '../services/user/user.service';
import { UtilService } from '../services';

@Injectable({
providedIn: 'root'
})
export class PrivateGuard implements CanActivate {
constructor(private userService:UserService,private router: Router){}
constructor(private userService:UserService,private router: Router, private utilService: UtilService){}
canActivate(
route: ActivatedRouteSnapshot,
state: RouterStateSnapshot): Observable<boolean | UrlTree> | Promise<boolean | UrlTree> | boolean | UrlTree {

return this.userService.getUserValue().then((result) => {
if (result) {
this.utilService?.alertClose();
return true;
}
else {
Expand Down
8 changes: 8 additions & 0 deletions src/app/core/services/util/util.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,14 @@ export class UtilService {
});
}

async alertClose(){
this.alert.getTop().then(alertInstance => {
if (alertInstance) {
alertInstance.dismiss();
}
});
}

getActionSheetButtons(profileImageData) {
let texts
this.translate
Expand Down
4 changes: 3 additions & 1 deletion src/app/pages/session-detail/session-detail.page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,9 @@ export class SessionDetailPage implements OnInit {
this.dismissWhenBack = true;
}
ionViewWillLeave(){
if(!this.skipWhenDelete){this.snackbarRef = this.toaster.dismiss()}
if(!this.skipWhenDelete && this.snackbarRef){
this.snackbarRef = this.toaster.dismiss()
}
}

setPageHeader(response) {
Expand Down
9 changes: 6 additions & 3 deletions src/app/pages/tabs/tabs-routing.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,18 @@ const routes: Routes = [
},
{
path: CommonRoutes.MENTOR_DIRECTORY,
loadChildren: () => import('./mentor-directory/mentor-directory.module').then(m => m.MentorDirectoryPageModule)
loadChildren: () => import('./mentor-directory/mentor-directory.module').then(m => m.MentorDirectoryPageModule),
canActivate:[PrivateGuard]
},
{
path: CommonRoutes.DASHBOARD,
loadChildren: () => import('./dashboard/dashboard.module').then(m => m.DashboardPageModule)
loadChildren: () => import('./dashboard/dashboard.module').then(m => m.DashboardPageModule),
canActivate:[PrivateGuard]
},
{
path: CommonRoutes.PROFILE,
loadChildren: () => import('./profile/profile.module').then( m => m.ProfilePageModule)
loadChildren: () => import('./profile/profile.module').then( m => m.ProfilePageModule),
canActivate:[PrivateGuard]
},
{
path: '',
Expand Down

0 comments on commit bad640c

Please sign in to comment.