push Enad code workList page

MOHEMM-Q3-DEV-LATEST
enadhilal 6 years ago
commit 0d05073e71

@ -149,6 +149,10 @@ call npm install @ionic-native/file-path
call ionic cordova plugin add com-badrit-base64 call ionic cordova plugin add com-badrit-base64
call npm install @ionic-native/base64 call npm install @ionic-native/base64
@echo install OneSignal plugin
call ionic cordova plugin add onesignal-cordova-plugin
call npm install @ionic-native/onesignal
@echo reinitializing git repository @echo reinitializing git repository
@echo git init @echo git init
@echo git remote add origin https://enas_yaghi@hmg.git.cloudforge.com/patientappionic.git @echo git remote add origin https://enas_yaghi@hmg.git.cloudforge.com/patientappionic.git

@ -1096,6 +1096,21 @@
} }
} }
}, },
"@ionic-native/onesignal": {
"version": "5.17.0",
"resolved": "https://registry.npmjs.org/@ionic-native/onesignal/-/onesignal-5.17.0.tgz",
"integrity": "sha512-PQfEki/34yGM4i+548Rt40RV8A4T0srRSk3GVEDZzoHiPMxnbxbLmsxiEjYG74K1AXBzT6tZmnlSiGumJtky6A==",
"requires": {
"@types/cordova": "^0.0.34"
},
"dependencies": {
"@types/cordova": {
"version": "0.0.34",
"resolved": "https://registry.npmjs.org/@types/cordova/-/cordova-0.0.34.tgz",
"integrity": "sha1-6nrd907Ow9dimCegw54smt3HPQQ="
}
}
},
"@ionic-native/open-native-settings": { "@ionic-native/open-native-settings": {
"version": "5.14.0", "version": "5.14.0",
"resolved": "https://registry.npmjs.org/@ionic-native/open-native-settings/-/open-native-settings-5.14.0.tgz", "resolved": "https://registry.npmjs.org/@ionic-native/open-native-settings/-/open-native-settings-5.14.0.tgz",
@ -9809,6 +9824,11 @@
"wrappy": "1" "wrappy": "1"
} }
}, },
"onesignal-cordova-plugin": {
"version": "2.7.0",
"resolved": "https://registry.npmjs.org/onesignal-cordova-plugin/-/onesignal-cordova-plugin-2.7.0.tgz",
"integrity": "sha512-ZkvF9uus+WdX+9Nh2p0OlZ6gUJHqKI88IQz78wW1Dat0kPmQvi8bYFi+MI8LYTkg2IFza6W0IbVVkEw7ye58cw=="
},
"onetime": { "onetime": {
"version": "2.0.1", "version": "2.0.1",
"resolved": "https://registry.npmjs.org/onetime/-/onetime-2.0.1.tgz", "resolved": "https://registry.npmjs.org/onetime/-/onetime-2.0.1.tgz",

@ -46,6 +46,7 @@
"@ionic-native/launch-navigator": "^5.16.0", "@ionic-native/launch-navigator": "^5.16.0",
"@ionic-native/local-notifications": "^5.16.0", "@ionic-native/local-notifications": "^5.16.0",
"@ionic-native/native-storage": "^5.16.0", "@ionic-native/native-storage": "^5.16.0",
"@ionic-native/onesignal": "^5.17.0",
"@ionic-native/open-native-settings": "^5.14.0", "@ionic-native/open-native-settings": "^5.14.0",
"@ionic-native/push": "^5.16.0", "@ionic-native/push": "^5.16.0",
"@ionic-native/splash-screen": "^5.0.0", "@ionic-native/splash-screen": "^5.0.0",
@ -102,6 +103,7 @@
"mx.ferreyra.callnumber": "0.0.2", "mx.ferreyra.callnumber": "0.0.2",
"ng2-file-upload": "^1.3.0", "ng2-file-upload": "^1.3.0",
"ng2-pdf-viewer": "^5.3.2", "ng2-pdf-viewer": "^5.3.2",
"onesignal-cordova-plugin": "^2.7.0",
"phonegap-plugin-barcodescanner": "8.1.0", "phonegap-plugin-barcodescanner": "8.1.0",
"phonegap-plugin-multidex": "^1.0.0", "phonegap-plugin-multidex": "^1.0.0",
"phonegap-plugin-push": "^2.3.0", "phonegap-plugin-push": "^2.3.0",
@ -200,7 +202,8 @@
"GMS_VERSION": "16.0.1" "GMS_VERSION": "16.0.1"
}, },
"cordova-plugin-appavailability": {}, "cordova-plugin-appavailability": {},
"cordova-plugin-apprate": {} "cordova-plugin-apprate": {},
"onesignal-cordova-plugin": {}
}, },
"platforms": [ "platforms": [
"browser", "browser",

@ -7,7 +7,7 @@ import { AuthenticatedUser } from "./hmg-common/services/authentication/models/a
import { TabsBarComponent } from "./hmg-common/ui/tabs-bar/tabs-bar.component"; import { TabsBarComponent } from "./hmg-common/ui/tabs-bar/tabs-bar.component";
import { KeyboardService } from "./hmg-common/services/keyboard/keyboard.service"; import { KeyboardService } from "./hmg-common/services/keyboard/keyboard.service";
import { SMSCheckResponse } from "src/app/hmg-common/services/authentication/models/smscheck.response"; import { SMSCheckResponse } from "src/app/hmg-common/services/authentication/models/smscheck.response";
import { PushService } from '../../src/app/hmg-common/services/push/push.service';
import { LazyLoadingService } from "./hmg-common/services/lazy-loading/lazy-loading.service"; import { LazyLoadingService } from "./hmg-common/services/lazy-loading/lazy-loading.service";
import { DomSanitizer } from '@angular/platform-browser'; import { DomSanitizer } from '@angular/platform-browser';
@ -38,6 +38,7 @@ export class AppComponent implements OnInit, AfterViewInit {
private menu: MenuController, private menu: MenuController,
private authService: AuthenticationService, private authService: AuthenticationService,
private sanitizer: DomSanitizer, private sanitizer: DomSanitizer,
public pushService: PushService,
) { ) {
this.events.subscribe("img-change", displayImg => { this.events.subscribe("img-change", displayImg => {
@ -50,6 +51,7 @@ export class AppComponent implements OnInit, AfterViewInit {
} }
ngOnInit() { ngOnInit() {
this.initializeApp(); this.initializeApp();
} }
ngAfterViewInit() {} ngAfterViewInit() {}
initializeApp() { initializeApp() {
@ -63,9 +65,15 @@ export class AppComponent implements OnInit, AfterViewInit {
this.watchLanguageChangeEvents(); this.watchLanguageChangeEvents();
this.subscribeEvents(); this.subscribeEvents();
this.keyboardService.watchKeyboard(); this.keyboardService.watchKeyboard();
this.startReceivingPushService();
}); });
}); });
} }
private startReceivingPushService() {
this.pushService.startReceiving();
}
subscribeEvents() { subscribeEvents() {
this.events.subscribe("setMenu", () => { this.events.subscribe("setMenu", () => {
const user = this.authService const user = this.authService

@ -5,6 +5,7 @@ import { HmgCommonModule } from './hmg-common/hmg-common.module';
import { IonicModule, IonicRouteStrategy } from '@ionic/angular'; import { IonicModule, IonicRouteStrategy } from '@ionic/angular';
import { SplashScreen } from '@ionic-native/splash-screen/ngx'; import { SplashScreen } from '@ionic-native/splash-screen/ngx';
import { StatusBar } from '@ionic-native/status-bar/ngx'; import { StatusBar } from '@ionic-native/status-bar/ngx';
import { OneSignal } from '@ionic-native/onesignal/ngx';
import { AppComponent } from './app.component'; import { AppComponent } from './app.component';
import { AppRoutingModule } from './app-routing.module'; import { AppRoutingModule } from './app-routing.module';
@ -36,6 +37,7 @@ import { Base64 } from "@ionic-native/base64/ngx";
File, File,
FilePath, FilePath,
Base64, Base64,
OneSignal,
{ provide: RouteReuseStrategy, useClass: IonicRouteStrategy } { provide: RouteReuseStrategy, useClass: IonicRouteStrategy }
], ],
bootstrap: [AppComponent] bootstrap: [AppComponent]

@ -20,7 +20,7 @@ import { SmsPageModule } from 'src/app/hmg-common/ui/sms/sms.module';
import { SmsPageComponent } from './sms-page/sms-page.page'; import { SmsPageComponent } from './sms-page/sms-page.page';
import { CheckUserComponent } from './check-user/check-user.component'; import { CheckUserComponent } from './check-user/check-user.component';
import { ChangePasswordComponent } from './change-password/change-password.component'; import { ChangePasswordComponent } from './change-password/change-password.component';
import {ConfirmLoginComponent} from '../authentication/confirm-login/confirm-login.component'
const routes: Routes = [ const routes: Routes = [
@ -47,6 +47,10 @@ const routes: Routes = [
{ {
path: 'changepassowrd', path: 'changepassowrd',
component: ChangePasswordComponent component: ChangePasswordComponent
},
{
path: 'confirmLogin',
component: ConfirmLoginComponent
} }
] ]
} }
@ -72,7 +76,8 @@ const routes: Routes = [
ForgotComponent, ForgotComponent,
SmsPageComponent, SmsPageComponent,
CheckUserComponent, CheckUserComponent,
ChangePasswordComponent ChangePasswordComponent,
ConfirmLoginComponent
], ],
providers:[ providers:[
FingerprintAIO, FingerprintAIO,

@ -0,0 +1,50 @@
<ion-header>
<ion-toolbar class="header-toolbar">
<ion-buttons slot="start">
<ion-back-button color="light" class="btnBack" ></ion-back-button>
</ion-buttons>
<ion-title color="light" > {{'login,verify-login' | translate}}</ion-title>
</ion-toolbar>
</ion-header>
<ion-content padding>
<ion-grid>
<ion-row class="ion-justify-content-center">
<ion-col [size]="4">
<img [src]="logo" class="logo" />
</ion-col>
</ion-row>
<ion-row class="description">
<ion-col size="12">
<!-- <type-writer *ngIf="onlySMSBox" [text]="'login,verify-login-with' | translate" class="description"
color="primary" fontSize="0.55cm" lineHeight="1cm" fontSize="0.55cm"></type-writer>
-->
<div *ngIf="onlySMSBox"><p>{{ts.trPK('login','verify-login-with')}}</p></div>
<!-- <type-writer *ngIf="!onlySMSBox" [text]="'login, verify-fingerprint' | translate" class="description"
color="primary" fontSize="0.55cm" lineHeight="1cm" fontSize="0.55cm"></type-writer>
-->
<div *ngIf="!onlySMSBox"><p>{{ts.trPK('login','verify-fingerprint')}}</p></div>
</ion-col>
</ion-row>
<page-trailer [small]="true"></page-trailer>
<ion-row [dir]="direction" class="zoomIn">
<ng-container *ngFor="let buttonsGroup of buttons">
<ion-col *ngFor="let button of buttonsGroup" [size]="6">
<app-button (click)="confirm(button)" [title]="button.title | translate " [icon]="button.icon"
[settings]="button.settings" [strong]="button.txt" [class]="button.class" [disabled]="button.disabled"
*ngIf="button.visible">
</app-button>
</ion-col>
</ng-container>
</ion-row>
</ion-grid>
</ion-content>

@ -0,0 +1,27 @@
import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { ConfirmLoginComponent } from './confirm-login.component';
describe('ConfirmLoginComponent', () => {
let component: ConfirmLoginComponent;
let fixture: ComponentFixture<ConfirmLoginComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ ConfirmLoginComponent ],
schemas: [CUSTOM_ELEMENTS_SCHEMA],
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(ConfirmLoginComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});

@ -0,0 +1,379 @@
import { Component, OnInit } from '@angular/core';
import {ButtonSettings} from "src/app/hmg-common/ui/button/models/button-settingsl";
import {TranslatorService} from "src/app/hmg-common/services/translator/translator.service";
import { CommonService } from 'src/app/hmg-common/services/common/common.service';
import { LoginRequest } from 'src/app/hmg-common/services/authentication/models/login.request';
import { AuthenticationService } from 'src/app/hmg-common/services/authentication/authentication.service';
import { SharedDataService } from 'src/app/hmg-common/services/shared-data-service/shared-data.service';
import { SendActivationByType } from '../models/sendActivationByType';
import { FingerprintAIO } from '@ionic-native/fingerprint-aio/ngx';
import { GetLoginInfoRequest } from "../../hmg-common/services/authentication/models/get-login-info.request";
import { GetLoginInfoResponse } from "../../hmg-common/services/authentication/models/get-login-info.response";
import { SMSCheckRequest } from "src/app/hmg-common/services/authentication/models/smscheck.request";
import { SMSCheckResponse } from "src/app/hmg-common/services/authentication/models/smscheck.response";
import { PushService } from 'src/app/hmg-common/services/push/push.service';
@Component({
selector: 'app-confirm-login',
templateUrl: './confirm-login.component.html',
styleUrls: ['./confirm-login.component.scss'],
})
export class ConfirmLoginComponent implements OnInit {
public logo = "assets/imgs/CS.png";
public buttons:any=[];
isFaceorFinger: any;
onlySMSBox: any = true;
loginData:any;
selectedOption: any;
lastLogin: any;
loginTokenID:any
deviceToken:any;
constructor(
public ts: TranslatorService,
public cs: CommonService,
public authService: AuthenticationService,
public sharedData: SharedDataService,
private faio: FingerprintAIO,
public pushService: PushService,
) {
this.loginData= this.sharedData.getSharedData(AuthenticationService.LOGIN_DATA, false);
console.log(this.loginData);
this.deviceToken= this.cs.sharedService.getSharedData(AuthenticationService.DEVICE_TOKEN, false);
console.log("deviceToken :"+this.deviceToken);
//if device token undefind
if(this.deviceToken == undefined){
this.deviceToken = localStorage.getItem("deviceToken");
}
this.lastLogin = this.cs.sharedService.getSharedData(AuthenticationService.LAST_LOGIN, false);
}
ngOnInit() {
//**checkIfAvailable FAIO **//
this.checkIfAvailable();
//**getSharedData of IMEI_USER_DATA and REGISTER_DATA_FOR_LOGIIN to set defult value **//
// this.setDefault();
this.button();
}
checkIfAvailable() {
this.faio.isAvailable().then(
options => {
this.isFaceorFinger = options;
if (this.isFaceorFinger === 'finger' && this.lastLogin === 1) {
this.selectedOption = 2;
this.cs.presentConfirmDialog(
this.ts.trPK("login", "biometric-support"),
() => {
this.presentBiometricDialog();
this.cs.sharedService.setSharedData(
this.selectedOption,
AuthenticationService.LAST_LOGIN
);
},
() => { }
);
}
this.button();
},
() => {
this.isFaceorFinger = null;
this.button();
}
);
}
button() {
console.log("button");
this.buttons = [
[{
title: "login,verify-with-fingerprint",
url: null,
icon: "assets/icon/login/102.png",
settings: new ButtonSettings(true, true, true, true),
value: 2,
disabled: this.isFaceorFinger === "finger" ? false : true,
visible: this.onlySMSBox
},
{
title: "login,verify-with-faceid",
url: null,
icon: "assets/icon/login/101.png",
settings: new ButtonSettings(true, true, true, true),
value: 3,
disabled: this.isFaceorFinger === "face" ? false : true,
visible: this.onlySMSBox
},
{
title: "login,verify-with-whatsapp",
url: null,
icon: "assets/icon/login/104.png",
settings: new ButtonSettings(true, true, true, true),
value: 4,
visible: true
},
{
title: "login,verify-with-sms",
url: null,
icon: "assets/icon/login/103.png",
settings: new ButtonSettings(true, true, true, true),
value: 1,
visible: true
}
]
];
}
confirm(el: any) {
console.log("confirm:"+ el );
this.selectedOption = this.selectedOption && !this.onlySMSBox ? this.selectedOption : el.value;
switch (el.value) {
case 1:
console.log(el.value);
this.loginWithSMS(el);
break;
case 2:
console.log(el.value);
this.loginWithFingurePrint(el);
break;
case 3:
console.log(el.value);
this.faceReconization(el);
break;
case 4:
console.log(el.value);
this.loginWithWhatsapp(el);
break;
default:
break;
}
this.cs.sharedService.setSharedData(
this.selectedOption,
AuthenticationService.LAST_LOGIN
);
}
loginWithSMS(el) {
console.log("loginWithSMS: "+ el);
if (!el.disabled) {
// if (this.user && !this.registerd_data) {
//calling because i dont have token id which required to the send activation code
/// this.checkUserAuthentication(1);
// this.checkUserAuthentication(); ***
// } else {
if (this.loginData.LogInTokenID) {
this.sendActivationCode(1);
} else {
// this.checkUserAuthentication(1);
// this.checkUserAuthentication();**
}
// }
}
}
loginWithWhatsapp(el) {
if (!el.disabled) {
// if (this.user && !this.registerd_data) {
//calling because i dont have token id which required to the send activation code
// this.checkUserAuthentication(2);
// } else {
if (this.loginData.LogInTokenID) {
this.sendActivationCode(2);
} else {
// this.checkUserAuthentication(2);
}
// }
}
}
public sendActivationCode(type: number) {
let request = new SendActivationByType();
this.authService.setPublicFields(request);
request.OTP_SendType = type;
request.MobileNumber = this.loginData.MobileNumber;
request.IsMobileFingerPrint =0;
request.P_USER_NAME=this.loginData.P_USER_NAME;
request.LogInTokenID =this.loginData.LogInTokenID;
request.P_LEGISLATION_CODE ="SA";
// request.VersionID ="2.0";
// request.LanguageID = imeiData && imeiData.PreferredLanguage || request.LanguageID;
this.authService
.sendActivationCodeByType(
request,
() => { },
this.ts.trPK("general", "ok")
)
.subscribe((result: any) => {
if (result.isSMSSent) {
this.cs.sharedService.setSharedData({
MobileNumber: this.loginData.mobileNumber,
loginType: this.selectedOption
},
SMSCheckRequest.SHARED_DATA
);
this.cs.openSMSPage();
}
});
}
loginWithFingurePrint(el: any) {
if (!el.disabled) {
this.startBiometricLoginIfAvailable();
}
}
faceReconization(el: any) {
if (!el.disabled) {
this.startBiometricLoginIfAvailable();
}
}
private startBiometricLoginIfAvailable() {
// this.setting.isBiometricsEnabled().then(result => {
// console.log(result);
this.faio.isAvailable().then(
options => {
// if biometric supported
//if (result) {
// ask if login with face or finger
this.presentBiometricDialog();
// } else {
// //ask to enable biometric
// this.getPermissionToActivateBiometric();
// }
},
() => {
alert("not avaliable ")
// if biometric not supported do nothing unless
// user session time out from last login
// if (AuthenticationService.isRequireRelogin()) {
// this.initializeInputsFromSessionTimeOut(user);
// }
// this.hideSplashScreen(true);
}
);
//});
}
private presentBiometricDialog() {
this.faio
.show({
clientId: "Fingerprint Authetnciation",
clientSecret: "Ate343_9347lajF", // Only necessary for Android
disableBackup: true, // Only for Android(optional)
localizedFallbackTitle: this.ts.trPK("general", "use-pin"), // Only for iOS
localizedReason: this.ts.trPK("general", "auth-please") // Only for iOS
})
.then((result: any) => {
console.log("1");
// this.deviceToken= this.cs.sharedService.getSharedData(AuthenticationService.DEVICE_TOKEN, false);
let request = new GetLoginInfoRequest();
this.authService.setPublicFields(request);
request.MobileNumber = this.loginData.MobileNumber;
request.P_USER_NAME=this.loginData.P_USER_NAME;
request.UserName=this.loginData.P_USER_NAME;
request.LogInTokenID =this.loginData.LogInTokenID;
request.CompanyID =1;//cs=1 , HMG=2
request.DeviceType= this.cs.getDeviceType();
request.DeviceToken=this.deviceToken;
this.getMobileInfo(request);
})
.catch((error: any) => {
console.log(error);
});
}
private getMobileInfo(request: GetLoginInfoRequest) {
console.log("2");
this.authService.getLoginInfo(request,() => { },this.ts.trPK("general", "ok")).subscribe((result: GetLoginInfoResponse) => {
console.log("authService.getLoginInfo");
if(result.Mohemm_GetPatientID_List.length > 0){
if ( result.Mohemm_GetPatientID_List[0].LoginType == 2 || result.Mohemm_GetPatientID_List[0].LoginType == 3) {
this.loginTokenID = result.LogInTokenID;
this.checkSMS();
} else {
this.onlySMSBox = false;
this.button();
}
}else {
this.onlySMSBox = false;
this.button();
}
});
}
public checkSMS() {
const data = this.sharedData.getSharedData(AuthenticationService.LOGIN_DATA, false);
const request = new SMSCheckRequest();
request.LogInTokenID = data.LogInTokenID;
request.activationCode = "";
request.P_USER_NAME = data.P_USER_NAME;
request.MobileNumber = data.MobileNumber;
this.authService
.checkSMS(request, () => {}, this.ts.trPK("general", "ok"))
.subscribe((result: SMSCheckResponse) => {
console.log(result);
if (this.cs.validResponse(result)) {
AuthenticationService.servicePrivilage=result.Privilege_List;
this.authService.setAuthenticatedUser(result).subscribe(() => {
this.insertMobileLogin();
this.cs.openHome();
});
}
});
}
public insertMobileLogin(){
let request = new GetLoginInfoRequest();
this.authService.setPublicFields(request);
request.MobileNumber = this.loginData.MobileNumber;
request.P_USER_NAME=this.loginData.P_USER_NAME;
request.UserName=this.loginData.P_USER_NAME;
request.LogInTokenID =this.loginData.LogInTokenID;
request.CompanyID =1;//CompanyID
request.DeviceType= this.cs.getDeviceType();
request.DeviceToken=this.deviceToken;
//request.TokenID=
request.LoginType=this.selectedOption;
this.authService
.insertMobileLoginInfo(
request,
() => { },
this.ts.trPK("general", "ok")
)
.subscribe((result: any) => {
console.log(result);
console.log("succssful insertMobileLoginInfo" );
});
}
}

@ -121,7 +121,7 @@ export class LoginComponent implements OnInit, OnDestroy {
this.handleAppUpdate(result) this.handleAppUpdate(result)
}); });
} else if (result.MessageStatus == 1) { } else if (result.MessageStatus == 1) {
this.checkUserAuthentication(); this.checkUserAuthentication();
} }
}); });
} }
@ -164,7 +164,10 @@ export class LoginComponent implements OnInit, OnDestroy {
this.sharedData.setSharedData(this.loginData, AuthenticationService.LOGIN_DATA); this.sharedData.setSharedData(this.loginData, AuthenticationService.LOGIN_DATA);
this.cs.sharedService.setSharedData(this.loginData.P_USER_NAME, LoginRequest.SHARED_DATA); this.cs.sharedService.setSharedData(this.loginData.P_USER_NAME, LoginRequest.SHARED_DATA);
this.remeberMyInfo(); this.remeberMyInfo();
this.cs.openSMSPage(); //this.cs.openSMSPage(); phase#1 one type of OTP
this.cs.openConfirmLoginPage();//phase#2 add 4 types for OTP
} else { } else {
console.log("result.IsPasswordExpired"); console.log("result.IsPasswordExpired");
console.log(result.IsPasswordExpired); console.log(result.IsPasswordExpired);

@ -0,0 +1,34 @@
import { Request } from 'src/app/hmg-common/services/models/request';
export class SendActivationByType extends Request {
P_USER_NAME: string; // id
UserName:string;
MobileNumber: string; // phone number
ZipCode: string;
LogInTokenID: string;
OTP_SendType:number;
IsMobileFingerPrint:number;
P_LEGISLATION_CODE:string;
// VersionID:string;
// Test
//{
// "Channel":31,
// "LanguageID":2,
// "LogInTokenID":"Wfm9uDlWhEi3vFsQMqUz3w==",
// "MobileNumber":"0508079569",
// "P_USER_NAME":"191817",
// "UserName":"191817",
// "VersionID":2.0,
// "P_LEGISLATION_CODE":"SA",
// "IsMobileFingerPrint":0,
// "OTP_SendType":1
// }
}

@ -9,6 +9,7 @@ import { LoginModel } from "../models/LoginModel";
import { AuthenticationService } from "src/app/hmg-common/services/authentication/authentication.service"; import { AuthenticationService } from "src/app/hmg-common/services/authentication/authentication.service";
import { SMSCheckResponse } from "src/app/hmg-common/services/authentication/models/smscheck.response"; import { SMSCheckResponse } from "src/app/hmg-common/services/authentication/models/smscheck.response";
import { Password } from "../models/password"; import { Password } from "../models/password";
import { GetLoginInfoRequest } from 'src/app/hmg-common/services/authentication/models/get-login-info.request';
@Component({ @Component({
selector: "app-sms-page", selector: "app-sms-page",
@ -33,7 +34,8 @@ export class SmsPageComponent implements OnInit {
public isExpiredPwd: boolean = false; public isExpiredPwd: boolean = false;
public count: number = 0; public count: number = 0;
private loginData = new LoginModel(); private loginData = new LoginModel();
public deviceToken:any;
public loginTypeData:any;
constructor( constructor(
public navCtrl: NavController, public navCtrl: NavController,
public translate: TranslatorService, public translate: TranslatorService,
@ -51,6 +53,18 @@ export class SmsPageComponent implements OnInit {
this.sharedData.getSharedData(Password.IS_FORGET_PSW) || false; this.sharedData.getSharedData(Password.IS_FORGET_PSW) || false;
this.isExpiredPwd = this.isExpiredPwd =
this.sharedData.getSharedData(Password.IS_EXPIRED_PSW) || false; this.sharedData.getSharedData(Password.IS_EXPIRED_PSW) || false;
this.loginData= this.sharedData.getSharedData(AuthenticationService.LOGIN_DATA, false);
console.log("loginData : "+ this.loginData);
this.deviceToken= this.common.sharedService.getSharedData(AuthenticationService.DEVICE_TOKEN, false);
if(this.deviceToken == undefined){
this.deviceToken = localStorage.getItem("deviceToken");
}
console.log("deviceToken :"+this.deviceToken);
this.loginTypeData= this.common.sharedService.getSharedData(SMSCheckRequest.SHARED_DATA, false);
console.log("loginType :"+this.loginTypeData.loginType);
} }
initTimer() { initTimer() {
@ -134,6 +148,7 @@ export class SmsPageComponent implements OnInit {
} }
public checkSMS() { public checkSMS() {
// alert("checkSMS in page")
const data = this.sharedData.getSharedData(AuthenticationService.LOGIN_DATA, false); const data = this.sharedData.getSharedData(AuthenticationService.LOGIN_DATA, false);
const request = new SMSCheckRequest(); const request = new SMSCheckRequest();
@ -149,12 +164,39 @@ export class SmsPageComponent implements OnInit {
if (this.common.validResponse(result)) { if (this.common.validResponse(result)) {
AuthenticationService.servicePrivilage=result.Privilege_List; AuthenticationService.servicePrivilage=result.Privilege_List;
this.authService.setAuthenticatedUser(result).subscribe(() => { this.authService.setAuthenticatedUser(result).subscribe(() => {
//call insert Mobile Login
this.insertMobileLogin();
this.common.openHome(); this.common.openHome();
}); });
} }
}); });
} }
public insertMobileLogin(){
// alert("insertMobileLogin");
let request = new GetLoginInfoRequest();
this.authService.setPublicFields(request);
request.MobileNumber = this.loginData.MobileNumber;
request.P_USER_NAME=this.loginData.P_USER_NAME;
request.UserName=this.loginData.P_USER_NAME;
request.LogInTokenID =this.loginData.LogInTokenID;
request.CompanyID =1;//CompanyID
request.DeviceType= this.common.getDeviceType();
request.DeviceToken=this.deviceToken;
request.LoginType=this.loginTypeData.loginType;
this.authService
.insertMobileLoginInfo(
request,
() => { },
this.translate.trPK("general", "ok")
)
.subscribe((result: any) => {
console.log("successful insertMobileLogin" );
});
}
public checkForgetPwdSMS() { public checkForgetPwdSMS() {
const data = this.sharedData.getSharedData(AuthenticationService.LOGIN_DATA, false); const data = this.sharedData.getSharedData(AuthenticationService.LOGIN_DATA, false);
const request = new SMSCheckRequest(); const request = new SMSCheckRequest();

@ -31,6 +31,7 @@ import { SMSCheckResponse } from "./models/smscheck.response";
import { ForgetPassword } from 'src/app/authentication/models/forget.password'; import { ForgetPassword } from 'src/app/authentication/models/forget.password';
import { CheckAppVersionResponse } from './models/check-app-version.response'; import { CheckAppVersionResponse } from './models/check-app-version.response';
import { PrivilageModel } from './models/privilage-model'; import { PrivilageModel } from './models/privilage-model';
import { SendActivationByType } from 'src/app/authentication/models/sendActivationByType';
@Injectable({ @Injectable({
providedIn: "root" providedIn: "root"
@ -53,6 +54,10 @@ export class AuthenticationService {
public static smsCheckForget='Services/ERP.svc/REST/CheckPublicActivationCode'; public static smsCheckForget='Services/ERP.svc/REST/CheckPublicActivationCode';
public static smsSendCode='Services/ERP.svc/REST/SendPublicActivationCode'; public static smsSendCode='Services/ERP.svc/REST/SendPublicActivationCode';
public static sendActivationCodeByType = 'Services/ERP.svc/REST/Mohemm_SendActivationCodebyOTPNotificationType';
public static getMobileLoginInfo ='Services/ERP.svc/REST/Mohemm_GetMobileLoginInfo';
public static insertMobileLoginInfo ='Services/ERP.svc/REST/Mohemm_InsertMobileLoginInfo';
/* register methods */ /* register methods */
public static checkPatientForRegisterationURL = 'Services/Authentication.svc/REST/CheckPatientForRegisteration'; public static checkPatientForRegisterationURL = 'Services/Authentication.svc/REST/CheckPatientForRegisteration';
@ -75,6 +80,8 @@ export class AuthenticationService {
public static FAMILY_LOGIN_EVENT = 'family-login-event'; public static FAMILY_LOGIN_EVENT = 'family-login-event';
public static AUTHENTICATED_USER_KEY = 'save-authenticated-user'; public static AUTHENTICATED_USER_KEY = 'save-authenticated-user';
public static LOGIN_DATA="logindata"; public static LOGIN_DATA="logindata";
public static DEVICE_TOKEN = "device_token";
public static LAST_LOGIN = 'last-login';
// private static user: AuthenticatedUser; // private static user: AuthenticatedUser;
@ -118,7 +125,7 @@ export class AuthenticationService {
} }
public setPublicFields(request: Request): Request { public setPublicFields(request: Request): Request {
request.VersionID = 1.4; request.VersionID = 2.0;//2.0,1.4
request.Channel = 31; request.Channel = 31;
request.LanguageID = TranslatorService.getCurrentLanguageCode(); request.LanguageID = TranslatorService.getCurrentLanguageCode();
//request.IPAdress = '10.10.10.10'; //request.IPAdress = '10.10.10.10';
@ -303,7 +310,7 @@ export class AuthenticationService {
): Observable<GetLoginInfoResponse> { ): Observable<GetLoginInfoResponse> {
this.setPublicFields(request); this.setPublicFields(request);
return this.con.post( return this.con.post(
AuthenticationService.getLoginInfoURL, AuthenticationService.getMobileLoginInfo,
request, request,
onError, onError,
errorLabel errorLabel
@ -547,6 +554,14 @@ export class AuthenticationService {
} }
public insertMobileLoginInfo(request: GetLoginInfoRequest,onError: any, errorLabel: string): Observable<GetLoginInfoResponse> {
this.authenticateRequest(request);
return this.con.post(AuthenticationService.insertMobileLoginInfo,request,onError,errorLabel);
}
public isSAUDIIDValid(id: string): boolean { public isSAUDIIDValid(id: string): boolean {
if (!id) { if (!id) {
return false; return false;
@ -673,4 +688,21 @@ export class AuthenticationService {
); );
} }
} }
} //**************************//
public sendActivationCodeByType(
request: SendActivationByType,
onError: any,
errorLabel: string
): Observable<CheckUserAuthenticationResponse> {
this.setPublicFields(request);
//below afifi code
//return this.con.post(AuthenticationService.checkUserAuthURL, request, onError, errorLabel); //afifi code, edit it to display the error msg into pop up ofverfication code
return this.con.post(
AuthenticationService.sendActivationCodeByType,
request,
onError,
errorLabel
);
}}

@ -4,28 +4,32 @@ import { AuthenticatedUser } from './authenticated-user';
import { CountryCode } from 'src/app/hmg-common/ui/mobile-number/international-mobile/models/country-code.model'; import { CountryCode } from 'src/app/hmg-common/ui/mobile-number/international-mobile/models/country-code.model';
export class GetLoginInfoRequest extends Request { export class GetLoginInfoRequest extends Request {
NationalID: string; UserName: string;
MobileNo: string; MobileNumber: string;
LogInTokenID: string;
DeviceToken: string; DeviceToken: string;
PatientID: number; LanguageID: number;
ProjectOutSA: boolean; P_USER_NAME: string;
LoginType: number; // 2 by patient id , 1 by identification number Channel:number;
ZipCode: string; CompanyID:number;
PatientMobileNumber: string; // same as mobileNO, DeviceType:string;
SearchType: number; // 2 LoginType:number;
PatientIdentificationID: string // "" // constructor(user: AuthenticatedUser) {
isRegister: boolean; // false // super();
constructor(user: AuthenticatedUser) {
super();
// this.NationalID = user.IdentificationNo; // this.NationalID = user.IdentificationNo;
// this.MobileNo = this.PatientMobileNumber = user.MobileNo; // this.MobileNo = this.PatientMobileNumber = user.MobileNo;
// this.DeviceToken = user.deviceToken; // this.DeviceToken = user.deviceToken;
// this.PatientID = user.PatientID; // this.PatientID = user.PatientID;
// this.ProjectOutSA = user.PatientOutSA ; // this.ProjectOutSA = user.PatientOutSA ;
this.LoginType = 2; // this.LoginType = 2;
this.ZipCode = CountryCode.localCode( user.ZipCode); // this.ZipCode = CountryCode.localCode( user.ZipCode);
this.SearchType = 2; // this.SearchType = 2;
this.PatientIdentificationID = ''; // this.PatientIdentificationID = '';
this.isRegister = false; // this.isRegister = false;
} //}
} }

@ -5,5 +5,7 @@ export class GetLoginInfoResponse extends Response {
SMSLoginRequired: boolean; SMSLoginRequired: boolean;
isSMSSent: boolean; isSMSSent: boolean;
LogInTokenID: string; LogInTokenID: string;
PatientOutSA: boolean; Mohemm_GetPatientID_List:any
isActiveCode: boolean;
// PatientOutSA: boolean;
} }

@ -4,4 +4,6 @@ import { Request } from 'src/app/hmg-common/services/models/request';
export class SMSCheckRequest extends Request { export class SMSCheckRequest extends Request {
LogInTokenID: string ; LogInTokenID: string ;
activationCode?: string; activationCode?: string;
public static SHARED_DATA = 'check_activation_shared_data';
} }

@ -437,7 +437,9 @@ export class CommonService {
public getDeviceType(): string { public getDeviceType(): string {
if (this.platform.is("mobile")) { if (this.platform.is("mobile")) {
return "Mobile " + (this.platform.is("ios") ? "Iphone" : "android"); // return "Mobile " + (this.platform.is("ios") ? "Iphone" : "android");
return (this.platform.is("ios") ? "Iphone" : "android");
} else { } else {
return "Desktop"; return "Desktop";
} }
@ -1017,6 +1019,9 @@ export class CommonService {
public openDeductionsPage() { public openDeductionsPage() {
this.nav.navigateForward(["/payslip/Deductions"]); this.nav.navigateForward(["/payslip/Deductions"]);
} }
public openConfirmLoginPage() {
this.nav.navigateForward(["/authentication/confirmLogin"]);
}
public reload(url: string, from: string) { public reload(url: string, from: string) {
console.log("force reload called from:" + from); console.log("force reload called from:" + from);

@ -18,4 +18,8 @@ export class Request {
public P_MOBILE_NUMBER: string; public P_MOBILE_NUMBER: string;
public P_EMAIL_ADDRESS: string; public P_EMAIL_ADDRESS: string;
public P_NOTIFICATION_ID: number; public P_NOTIFICATION_ID: number;
// public P_LEGISLATION_CODE: string;
// public OTP_SendType: number;
// public IsMobileFingerPrint: boolean;
} }

@ -16,16 +16,16 @@ import { SessionModel } from './models/session.model';
import { AuthenticatedUser } from '../authentication/models/authenticated-user'; import { AuthenticatedUser } from '../authentication/models/authenticated-user';
// import { NotificationsCenterService } from 'src/app/eservices/notifications-center/service/notifications-center.service'; // import { NotificationsCenterService } from 'src/app/eservices/notifications-center/service/notifications-center.service';
// import { NotificationsComponent } from 'src/app/eservices/notifications-center/notifications/notifications.component'; // import { NotificationsComponent } from 'src/app/eservices/notifications-center/notifications/notifications.component';
import {OneSignal} from '@ionic-native/onesignal/ngx'
@Injectable({ @Injectable({
providedIn: 'root' providedIn: 'root'
}) })
export class PushService { export class PushService {
private static notLoggedInUserURL = 'Services/MobileNotifications.svc/REST/PushNotification_InsertPatientDeviceInformation'; private static notLoggedInUserURL = 'Services/MobileNotifications.svc/REST/PushNotification_InsertPatientDeviceInformation';
private static loggedInUserURL = 'Services/MobileNotifications.svc/REST/Insert_PatientMobileDeviceInfo'; private static loggedInUserURL = 'Services/MobileNotifications.svc/REST/Insert_PatientMobileDeviceInfo';
public static SENDER_ID = '679409052782';//'815750722565';
public static CHANNEL_ID = '815750722565'; public static CHANNEL_ID = '679409052782';//'815750722565';
constructor( constructor(
// public push: Push, // public push: Push,
public cs: CommonService, public cs: CommonService,
@ -36,14 +36,16 @@ export class PushService {
private authService: AuthenticationService, private authService: AuthenticationService,
public ngZone: NgZone, public ngZone: NgZone,
// public notifyService: NotificationsCenterService, // public notifyService: NotificationsCenterService,
public events: Events public events: Events,
private oneSignal: OneSignal,
) { } ) { }
public startReceiving() { public startReceiving() {
this.processStartReceiving(); this.processStartReceiving();
} }
private processStartReceiving() { private processStartReceiving1() {
// if (this.cs.isCordova()) { // if (this.cs.isCordova()) {
// this.stopNotifications(() => { // this.stopNotifications(() => {
// this.push.hasPermission() // this.push.hasPermission()
@ -158,6 +160,7 @@ export class PushService {
} }
private registerInBackend(data: any) { private registerInBackend(data: any) {
console.log("registerInBackend");
if (this.authService.isAuthenticated()) { if (this.authService.isAuthenticated()) {
this.registerAuthenticatedUser(data.registrationId); this.registerAuthenticatedUser(data.registrationId);
} else { } else {
@ -207,4 +210,57 @@ export class PushService {
} }
private processStartReceiving() {
console.log('processStartReceiving');
console.log("processStartReceiving openConference");
this.oneSignal.startInit('8d9b8313-0365-4934-a2a9-fdee5aeac66e', PushService.SENDER_ID);
this.oneSignal.inFocusDisplaying(this.oneSignal.OSInFocusDisplayOption.Notification);
this.oneSignal.handleNotificationReceived().subscribe(data => this.onPushReceived(data.payload));
this.oneSignal.handleNotificationOpened().subscribe(data => this.onPushOpened(data.notification.payload));
console.log("this.oneSignal: "+ this.oneSignal.getIds());
this.oneSignal.endInit();
this.oneSignal.getIds().then(result => {
console.log("result.userId: " +result.userId);
//there is no part for notLoggedInUserURL () as patient app
if(result.userId){
this.cs.sharedService.setSharedData(result.userId, AuthenticationService.DEVICE_TOKEN);
localStorage.setItem("deviceToken", result.userId);
}
this.registerInBackend(result.userId);
}, err => {
console.log("getIds() error: "+err);
});
// if (this.cs.isCordova()) {
// console.log('Notification Channel Called');
// if (this.platform.is('android')) {
// this.stopNotifications(() => {
// });
// } else {
// //initialize code
// }
// }
}
public onPushReceived(payload: any) {
console.log(JSON.parse(JSON.stringify(payload)));
console.log('Push-Received whole payload: ' + payload);
}
public onPushOpened(payload: any) {
console.log(JSON.parse(JSON.stringify(payload)));
console.log('Push-opened whole payload: ' + payload);
console.log("onPushOpened openConference");
this.processNotification(payload);
}
} }

@ -7,7 +7,7 @@
--> -->
<!--
<div (click)="onClicked()" [ngStyle]="style" class="custom-button"> <div (click)="onClicked()" [ngStyle]="style" class="custom-button">
<img [src]="icon" class="icon" > <img [src]="icon" class="icon" >
@ -18,4 +18,3 @@
</div> </div>
-->

@ -11,11 +11,11 @@
border-width: 0.02cm; border-width: 0.02cm;
} }
.custom-button:hover { // .custom-button:hover {
-webkit-box-shadow: 0px 0px 8px 2px #d1212747;; // -webkit-box-shadow: 0px 0px 8px 2px #d1212747;;
-moz-box-shadow: 0px 0px 8px 2px #d1212747;; // -moz-box-shadow: 0px 0px 8px 2px #d1212747;;
box-shadow: 0px 0px 8px 2px #d1212747;; // box-shadow: 0px 0px 8px 2px #d1212747;;
} // }

@ -8,13 +8,9 @@ import { TranslatorService } from '../../services/translator/translator.service'
styleUrls: ['./button.component.scss'], styleUrls: ['./button.component.scss'],
}) })
export class ButtonComponent implements OnInit { export class ButtonComponent implements OnInit {
constructor() {
} @Input() strong: boolean;
ngOnInit() { @Input() class: any = '';
}
/*
@Input() icon: string; @Input() icon: string;
@Input() title: string; @Input() title: string;
@Output() trigger = new EventEmitter(); @Output() trigger = new EventEmitter();
@ -29,7 +25,7 @@ export class ButtonComponent implements OnInit {
} }
ngOnInit() { ngOnInit() {
this.direction = TranslatorService.getCurrentDirection(); this.direction = TranslatorService.getCurrentLanguageName();
if (this.settings) { if (this.settings) {
this.style = this.style =
{ {
@ -40,13 +36,19 @@ export class ButtonComponent implements OnInit {
}; };
} }
/*
const element = document.getElementById('modal');
element.addEventListener('click', e => {
e.stopImmediatePropagation();
});
*/
} }
private isEnabled(enabled: boolean): string { private isEnabled(enabled: boolean): string {
return enabled ? '30px' : '0px'; return enabled ? '6px' : '0px';
} }
public onClicked() { public onClicked() {
console.log(this.disabled);
if (!this.disabled) { if (!this.disabled) {
this.trigger.emit(); this.trigger.emit();
} }
@ -62,17 +64,20 @@ export class Modal implements OnInit {
ngOnInit() { ngOnInit() {
console.log(' on initialization'); console.log(' on initialization');
//this.elRef.nativeElement.addEventListener('mouseenter', this.onMouseEnter);
} }
ngOnDestroy() { ngOnDestroy() {
// this.elRef.nativeElement.removeEventListener('mouseenter', this.onMouseEnter);
} }
onMouseEnter() { onMouseEnter() {
// alert("Don't touch my bacon!")
} }
@HostListener('click', ['$event']) @HostListener('click', ['$event'])
onClick(event: any) { onClick(event: any) {
alert('click'); // alert('click');
// event.preventPropagation();
} }
*/
} }

@ -116,7 +116,7 @@ export class WorklistMainComponent implements OnInit {
this.worklistMainService this.worklistMainService
.getPRNotificationBody(notificationBodyObj) .getPRNotificationBody(notificationBodyObj)
.subscribe((result: PRNotificatonBodyResponse) => { .subscribe((result: PRNotificatonBodyResponse) => {
//this.handleWorkListBodyResult(result, "MO"); this.handleWorkListBodyResult(result, "PR");
}); });
} }
@ -168,10 +168,17 @@ export class WorklistMainComponent implements OnInit {
this.notificationBodyRes = this.notificationBodyRes =
result.GetAbsenceCollectionNotificationBodyList; result.GetAbsenceCollectionNotificationBodyList;
} }
}else if (Type == "PR") {
if (result.GetAbsenceCollectionNotificationBodyList) {
this.notificationBodyRes =
result.GetAbsenceCollectionNotificationBodyList;
}
} }
} }
} //End handleWorkListBodyResult } //End handleWorkListBodyResult
getNotificationButtons(notificationButtonsObj) { getNotificationButtons(notificationButtonsObj) {
this.worklistMainService this.worklistMainService
.getNotificationButtons(notificationButtonsObj) .getNotificationButtons(notificationButtonsObj)

@ -1,7 +1,7 @@
import { Injectable } from '@angular/core'; import { Injectable } from '@angular/core';
import { ConnectorService } from '../../hmg-common/services/connector/connector.service'; import { ConnectorService } from '../../hmg-common/services/connector/connector.service';
import { AuthenticationService } from '../../hmg-common/services/authentication/authentication.service'; import { AuthenticationService } from '../../hmg-common/services/authentication/authentication.service';
import { Observable } from 'rxjs'; import { Observable } from 'node_modules/@angular/cli/node_modules/rxjs';
@Injectable({ @Injectable({
providedIn: 'root' providedIn: 'root'

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.9 KiB

@ -104,6 +104,46 @@
"password-expired": { "password-expired": {
"en": "Your password has been expired. Kindly change your password to login again.", "en": "Your password has been expired. Kindly change your password to login again.",
"ar": "كلمة المرور الخاصة بك قد انتهت صلاحيتها. يرجى تغيير كلمة المرور لتسجيل الدخول مرة أخرى." "ar": "كلمة المرور الخاصة بك قد انتهت صلاحيتها. يرجى تغيير كلمة المرور لتسجيل الدخول مرة أخرى."
},
"verify-login": {
"en": "Verify Login",
"ar": "تحقق من تسجيل الدخول"
},
"verify-login-with": {
"en": "Please verify login with one of the following options",
"ar": "الرجاء التحقق من تسجيل الدخول باستخدام أحد هذه الخيارات"
},
"verify-with-fingerprint": {
"en": "Verify with fingerprint",
"ar": "تحقق باستخدام بصمة"
},
"verify-with-faceid": {
"en": "Verify with face ID",
"ar": "تحقق باستخدام معرف الوجه"
},
"verify-with-sms": {
"en": "Verify with SMS",
"ar": "تحقق مع الرسائل القصيرة"
},
"verify-with-whatsapp": {
"en": "Verify with Whatsapp",
"ar": "تحقق مع Whatsapp"
},
"last-login": {
"en": "Last login at:",
"ar": ":آخر تسجيل دخول"
},
"last-login-with": {
"en": "Last login using:",
"ar": "آخر تسجيل دخول مع"
},
"biometric-support": {
"en": "It seems that your phone is supporting biometric feature, do you want login with with biometric?",
"ar": "يبدو أن هاتفك يدعم ميزة البيومترية ، هل تريد تسجيل الدخول باستخدام البيومترية؟"
},
"verify-fingerprint": {
"en": "To activate fingerprint login service, please verify by using one of the following options. ",
"ar": "لتفعيل خدمة الدخول بالبصمة، يرجى التحقق من خلال احدى الخيارات التالية"
} }
}, },
"verificationcode": { "verificationcode": {

Loading…
Cancel
Save