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
4 changes: 4 additions & 0 deletions src/app/components/sign-in-card/sign-in-card.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,10 @@ export class SignInCardComponent implements OnInit {
})
.then(async () => {
await loader.dismiss();
if (!this.appGlobalService.signinOnboardingLoader) {
this.appGlobalService.signinOnboardingLoader = await this.commonUtilService.getLoader();
await this.appGlobalService.signinOnboardingLoader.present();
}
that.ngZone.run(() => {
that.preferences.putString('SHOW_WELCOME_TOAST', 'true').toPromise().then();

Expand Down
1 change: 1 addition & 0 deletions src/app/district-mapping/district-mapping.page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ export class DistrictMappingPage {
private ngZone: NgZone,
private externalIdVerificationService: ExternalIdVerificationService
) {
this.appGlobalService.closeSigninOnboardingLoader();
this.isKeyboardShown$ = deviceInfo.isKeyboardShown().pipe(
tap(() => this.changeDetectionRef.detectChanges())
);
Expand Down
1 change: 1 addition & 0 deletions src/app/profile/categories-edit/categories-edit.page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ export class CategoriesEditPage {
private tncUpdateHandlerService: TncUpdateHandlerService,

) {
this.appGlobalService.closeSigninOnboardingLoader();
this.profile = this.appGlobalService.getCurrentUser();
const extrasState = this.router.getCurrentNavigation().extras.state;
if (extrasState && extrasState.showOnlyMandatoryFields) {
Expand Down
13 changes: 11 additions & 2 deletions src/app/terms-and-conditions/terms-and-conditions.page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { CommonUtilService } from '@app/services/common-util.service';
import { TelemetryGeneratorService } from '@app/services/telemetry-generator.service';
import { AppHeaderService } from '@app/services/app-header.service';
import { ProfileConstants, RouterLinks } from '../app.constant';
import { FormAndFrameworkUtilService } from '@app/services';
import { FormAndFrameworkUtilService, AppGlobalService } from '@app/services';
import { Router, NavigationExtras } from '@angular/router';
import { SplashScreenService } from '@app/services/splash-screen.service';
import { ExternalIdVerificationService } from '@app/services/externalid-verification.service';
Expand Down Expand Up @@ -44,11 +44,13 @@ export class TermsAndConditionsPage implements OnInit {
private formAndFrameworkUtilService: FormAndFrameworkUtilService,
private router: Router,
private splashScreenService: SplashScreenService,
private externalIdVerificationService: ExternalIdVerificationService
private externalIdVerificationService: ExternalIdVerificationService,
private appGlobalService: AppGlobalService
) {
}

public async ngOnInit() {
this.appGlobalService.closeSigninOnboardingLoader();
this.appName = await this.appVersion.getAppName();
this.headerService.hideHeader();
this.userProfileDetails = (await this.profileService.getActiveSessionProfile(
Expand Down Expand Up @@ -135,15 +137,21 @@ export class TermsAndConditionsPage implements OnInit {
await loader.dismiss();
loader = undefined;
}
if (!this.appGlobalService.signinOnboardingLoader) {
this.appGlobalService.signinOnboardingLoader = await this.commonUtilService.getLoader();
await this.appGlobalService.signinOnboardingLoader.present();
}
this.disableSubmitButton = false;
if (value['status']) {
if (this.commonUtilService.isUserLocationAvalable(serverProfile)
&& await tncUpdateHandlerService.isSSOUser(profile)) {
await tncUpdateHandlerService.dismissTncPage();
this.appGlobalService.closeSigninOnboardingLoader();
this.router.navigate(['/', RouterLinks.TABS]);
this.externalIdVerificationService.showExternalIdVerificationPopup();
this.splashScreenService.handleSunbirdSplashScreenActions();
} else {
// closeSigninOnboardingLoader() is called in District-Mapping page
const navigationExtras: NavigationExtras = {
state: {
isShowBackButton: false
Expand All @@ -152,6 +160,7 @@ export class TermsAndConditionsPage implements OnInit {
this.router.navigate(['/', RouterLinks.DISTRICT_MAPPING] , navigationExtras);
}
} else {
// closeSigninOnboardingLoader() is called in CategoryEdit page
await tncUpdateHandlerService.dismissTncPage();
this.router.navigate([`/${RouterLinks.PROFILE}/${RouterLinks.CATEGORIES_EDIT}`], {
state: {
Expand Down
15 changes: 15 additions & 0 deletions src/services/app-global-service.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ export class AppGlobalService implements OnDestroy {
private _limitedShareQuizContent: any;
private _isSignInOnboardingCompleted: any;
private isJoinTraningOnboarding: any;
private _signinOnboardingLoader: any;


constructor(
Expand Down Expand Up @@ -677,10 +678,24 @@ export class AppGlobalService implements OnDestroy {
this.isJoinTraningOnboarding = value;
}

get signinOnboardingLoader() {
return this._signinOnboardingLoader;
}
set signinOnboardingLoader(value) {
this._signinOnboardingLoader = value;
}

// This method is used to reset if any quiz content data is previously saved before Joining a Training
// So it wont affect in the exterId verification page
resetSavedQuizContent() {
this.limitedShareQuizContent = null;
}

async closeSigninOnboardingLoader() {
if (this.signinOnboardingLoader) {
await this.signinOnboardingLoader.dismiss();
this.signinOnboardingLoader = null;
}
}

}
1 change: 1 addition & 0 deletions src/services/externalid-verification.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ export class ExternalIdVerificationService {
}

async showExternalIdVerificationPopup() {
this.appGlobalService.closeSigninOnboardingLoader();
if (await this.checkQuizContent()) {
return;
}
Expand Down
3 changes: 3 additions & 0 deletions src/services/handlers/tnc-update-handler.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ export class TncUpdateHandlerService {
return;
}
this.presentTncPage({ profile });
}).catch(e => {
this.appGlobalService.closeSigninOnboardingLoader();
});
}

Expand Down Expand Up @@ -134,6 +136,7 @@ export class TncUpdateHandlerService {
}
})
.catch((error) => {
this.appGlobalService.closeSigninOnboardingLoader();
this.externalIdVerificationService.showExternalIdVerificationPopup();
console.error('Error:', error);
});
Expand Down
8 changes: 7 additions & 1 deletion src/services/login-handler.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import {
} from '@app/services/telemetry-constants';
import { ContainerService } from '@app/services/container.services';
import { Router } from '@angular/router';
import { AppGlobalService } from './app-global-service.service';

@Injectable()
export class LoginHandlerService {
Expand All @@ -54,7 +55,8 @@ export class LoginHandlerService {
private formAndFrameworkUtilService: FormAndFrameworkUtilService,
private telemetryGeneratorService: TelemetryGeneratorService,
private router: Router,
private events: Events
private events: Events,
private appGlobalService: AppGlobalService
) {

this.appVersion.getAppName()
Expand Down Expand Up @@ -112,6 +114,10 @@ export class LoginHandlerService {
})
.then(async () => {
await loader.dismiss();
if (!this.appGlobalService.signinOnboardingLoader) {
this.appGlobalService.signinOnboardingLoader = await this.commonUtilService.getLoader();
await this.appGlobalService.signinOnboardingLoader.present();
}
that.ngZone.run(() => {
that.preferences.putString('SHOW_WELCOME_TOAST', 'true').toPromise().then();
// this.events.publish('UPDATE_TABS');
Expand Down