fix
This commit is contained in:
@@ -19,6 +19,14 @@ const routes: Routes = [
|
||||
path: 'merms-signup',
|
||||
loadChildren: () => import('./merms-signup/merms-signup.module').then( m => m.MermsSignupPageModule)
|
||||
},
|
||||
{
|
||||
path: 'merms-dash',
|
||||
loadChildren: () => import('./merms-dash/merms-dash.module').then( m => m.MermsDashPageModule)
|
||||
},
|
||||
{
|
||||
path: 'merms-settings',
|
||||
loadChildren: () => import('./merms-settings/merms-settings.module').then( m => m.MermsSettingsPageModule)
|
||||
},
|
||||
];
|
||||
|
||||
@NgModule({
|
||||
|
||||
@@ -6,13 +6,19 @@ import { IonicModule, IonicRouteStrategy } from '@ionic/angular';
|
||||
import { SplashScreen } from '@ionic-native/splash-screen/ngx';
|
||||
import { StatusBar } from '@ionic-native/status-bar/ngx';
|
||||
|
||||
//import { HttpModule } from '@angular/http'
|
||||
import { HTTP } from '@ionic-native/http/ngx';
|
||||
import { HttpClientModule } from '@angular/common/http'
|
||||
|
||||
import { AppComponent } from './app.component';
|
||||
import { AppRoutingModule } from './app-routing.module';
|
||||
|
||||
@NgModule({
|
||||
declarations: [AppComponent],
|
||||
entryComponents: [],
|
||||
imports: [BrowserModule, IonicModule.forRoot(), AppRoutingModule],
|
||||
imports: [BrowserModule, IonicModule.forRoot(),
|
||||
HttpClientModule,
|
||||
AppRoutingModule],
|
||||
providers: [
|
||||
StatusBar,
|
||||
SplashScreen,
|
||||
|
||||
@@ -17,6 +17,7 @@ export class HomePage {
|
||||
}
|
||||
|
||||
goToLogin() {
|
||||
// alert(0);
|
||||
this.router.navigateByUrl('/merms-login')
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
import { NgModule } from '@angular/core';
|
||||
import { Routes, RouterModule } from '@angular/router';
|
||||
|
||||
import { MermsDashPage } from './merms-dash.page';
|
||||
|
||||
const routes: Routes = [
|
||||
{
|
||||
path: '',
|
||||
component: MermsDashPage
|
||||
}
|
||||
];
|
||||
|
||||
@NgModule({
|
||||
imports: [RouterModule.forChild(routes)],
|
||||
exports: [RouterModule],
|
||||
})
|
||||
export class MermsDashPageRoutingModule {}
|
||||
@@ -0,0 +1,20 @@
|
||||
import { NgModule } from '@angular/core';
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { FormsModule } from '@angular/forms';
|
||||
|
||||
import { IonicModule } from '@ionic/angular';
|
||||
|
||||
import { MermsDashPageRoutingModule } from './merms-dash-routing.module';
|
||||
|
||||
import { MermsDashPage } from './merms-dash.page';
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
CommonModule,
|
||||
FormsModule,
|
||||
IonicModule,
|
||||
MermsDashPageRoutingModule
|
||||
],
|
||||
declarations: [MermsDashPage]
|
||||
})
|
||||
export class MermsDashPageModule {}
|
||||
@@ -0,0 +1,167 @@
|
||||
<ion-content fullscreen>
|
||||
<ion-grid>
|
||||
<ion-row>
|
||||
<ion-col>
|
||||
<div>
|
||||
<h2>{{ welcomeName }}</h2>
|
||||
</div>
|
||||
</ion-col>
|
||||
<ion-col>
|
||||
<div style="text-align: right;"> <h4>{{ currentDateFormated }}</h4></div>
|
||||
</ion-col>
|
||||
</ion-row>
|
||||
<ion-row style="height: 80px;">
|
||||
<ion-col style="background-color:ivory">
|
||||
<div>.</div>
|
||||
</ion-col>
|
||||
<ion-col style="background-color:honeydew">
|
||||
<div>.</div>
|
||||
</ion-col>
|
||||
<ion-col style="background-color: aquamarine;">
|
||||
<div>.</div>
|
||||
</ion-col>
|
||||
</ion-row>
|
||||
</ion-grid>
|
||||
|
||||
|
||||
<ion-list>
|
||||
<ion-list-header>
|
||||
Pending Encounter
|
||||
</ion-list-header>
|
||||
|
||||
<ion-item>
|
||||
<ion-avatar slot="start">
|
||||
<img src="./../../assets/imgs/avatar.svg">
|
||||
</ion-avatar>
|
||||
<ion-label>
|
||||
<h2>Adekunle Gold</h2>
|
||||
<h3>Need hew head</h3>
|
||||
<p>10/10/2050, 9:30 AM Male , 54 yrs</p>
|
||||
</ion-label>
|
||||
</ion-item>
|
||||
|
||||
<ion-item>
|
||||
<ion-avatar slot="start">
|
||||
<img src="./../../assets/imgs/avatar.svg">
|
||||
</ion-avatar>
|
||||
<ion-label>
|
||||
<h2>Janet Jackson</h2>
|
||||
<h3>Want to escape from the planet</h3>
|
||||
<p>10/10/2050, 10:30 AM Female , 34 yrs</p>
|
||||
</ion-label>
|
||||
</ion-item>
|
||||
|
||||
<ion-item>
|
||||
<ion-avatar slot="start">
|
||||
<img src="./../../assets/imgs/avatar.svg">
|
||||
</ion-avatar>
|
||||
<ion-label>
|
||||
<h2>Rey</h2>
|
||||
<h3>I can handle myself</h3>
|
||||
<p>You will remove these restraints and leave...</p>
|
||||
</ion-label>
|
||||
</ion-item>
|
||||
|
||||
<ion-item>
|
||||
<ion-avatar slot="start">
|
||||
<img src="./../../assets/imgs/avatar.svg">
|
||||
</ion-avatar>
|
||||
<ion-label>
|
||||
<h2>Luke</h2>
|
||||
<h3>Your thoughts betray you</h3>
|
||||
<p>I feel the good in you, the conflict...</p>
|
||||
</ion-label>
|
||||
</ion-item>
|
||||
</ion-list>
|
||||
|
||||
<ion-list>
|
||||
<ion-list-header>
|
||||
Recent Encounter
|
||||
</ion-list-header>
|
||||
|
||||
<ion-item>
|
||||
<ion-avatar slot="start">
|
||||
<img src="./../../assets/imgs/avatar.svg">
|
||||
</ion-avatar>
|
||||
<ion-label>
|
||||
<h2>Poe</h2>
|
||||
<h3>New Ride</h3>
|
||||
<p>I just upgraded my X-Wing. Next time...</p>
|
||||
</ion-label>
|
||||
</ion-item>
|
||||
|
||||
<ion-item>
|
||||
<ion-avatar slot="start">
|
||||
<img src="./../../assets/imgs/avatar.svg">
|
||||
</ion-avatar>
|
||||
<ion-label>
|
||||
<h2>Ben</h2>
|
||||
<h3>Move Along</h3>
|
||||
<p>These aren't the droids you're looking for...</p>
|
||||
</ion-label>
|
||||
</ion-item>
|
||||
|
||||
<ion-item>
|
||||
<ion-avatar slot="start">
|
||||
<img src="./../../assets/imgs/avatar.svg">
|
||||
</ion-avatar>
|
||||
<ion-label>
|
||||
<h2>Leia</h2>
|
||||
<h3>You're My Only Hope</h3>
|
||||
<p>I've placed information vital to the survival...</p>
|
||||
</ion-label>
|
||||
</ion-item>
|
||||
|
||||
<ion-item>
|
||||
<ion-avatar slot="start">
|
||||
<img src="./../../assets/imgs/avatar.svg">
|
||||
</ion-avatar>
|
||||
<ion-label>
|
||||
<h2>Yoda</h2>
|
||||
<h3>Size matters not</h3>
|
||||
<p>Do or do not. There is no try...</p>
|
||||
</ion-label>
|
||||
</ion-item>
|
||||
</ion-list>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</ion-content>
|
||||
|
||||
<!-- Footer without a border -->
|
||||
<ion-footer class="ion-no-border">
|
||||
<ion-toolbar>
|
||||
<ion-grid style="font-size: 25px; text-align: center;">
|
||||
<ion-row>
|
||||
<ion-col>
|
||||
<div>
|
||||
<ion-icon name="home"></ion-icon>
|
||||
</div>
|
||||
</ion-col>
|
||||
<ion-col>
|
||||
<div>
|
||||
<ion-icon name="grid"></ion-icon>
|
||||
</div>
|
||||
</ion-col>
|
||||
<ion-col>
|
||||
<div>[----]</div>
|
||||
</ion-col>
|
||||
<ion-col>
|
||||
<div>
|
||||
<ion-icon name="settings" (click)="goSettings()"></ion-icon>
|
||||
</div>
|
||||
</ion-col>
|
||||
</ion-row>
|
||||
</ion-grid>
|
||||
|
||||
</ion-toolbar>
|
||||
</ion-footer>
|
||||
@@ -0,0 +1,24 @@
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { IonicModule } from '@ionic/angular';
|
||||
|
||||
import { MermsDashPage } from './merms-dash.page';
|
||||
|
||||
describe('MermsDashPage', () => {
|
||||
let component: MermsDashPage;
|
||||
let fixture: ComponentFixture<MermsDashPage>;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ MermsDashPage ],
|
||||
imports: [IonicModule.forRoot()]
|
||||
}).compileComponents();
|
||||
|
||||
fixture = TestBed.createComponent(MermsDashPage);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
}));
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,26 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { Router, NavigationExtras } from '@angular/router'
|
||||
|
||||
|
||||
@Component({
|
||||
selector: 'app-merms-dash',
|
||||
templateUrl: './merms-dash.page.html',
|
||||
styleUrls: ['./merms-dash.page.scss'],
|
||||
})
|
||||
export class MermsDashPage implements OnInit {
|
||||
|
||||
currentDateFormated: string = '10/10/2020';
|
||||
welcomeName: string = '';
|
||||
|
||||
constructor(private router: Router) {
|
||||
|
||||
|
||||
this.welcomeName = "Dr. Something"
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
}
|
||||
goSettings() {
|
||||
this.router.navigateByUrl('/merms-settings')
|
||||
}
|
||||
}
|
||||
@@ -1,9 +1,63 @@
|
||||
<ion-header>
|
||||
<ion-toolbar>
|
||||
<ion-title>merms-login</ion-title>
|
||||
</ion-toolbar>
|
||||
</ion-header>
|
||||
|
||||
<ion-content>
|
||||
<ion-content class="merms-login-page">
|
||||
<div class="container">
|
||||
<ion-grid class="top-container">
|
||||
<ion-row>
|
||||
<ion-col size="2" class="navigation">
|
||||
<ion-back-button text=""></ion-back-button>
|
||||
</ion-col>
|
||||
<ion-col size="8" class="page-title">MERMS Providers</ion-col>
|
||||
</ion-row>
|
||||
</ion-grid>
|
||||
<h1>Log In</h1>
|
||||
<div class="bottom-container">
|
||||
<button class="google-sign-up" (click)="googleSignup()">
|
||||
<img src="assets/imgs/sign-up/google-icon.svg" />
|
||||
<span>Log in with Google</span>
|
||||
</button>
|
||||
<button
|
||||
class="apple-sign-up"
|
||||
*ngIf="platform_is_ios"
|
||||
(click)="appleSignup()"
|
||||
>
|
||||
<img src="assets/imgs/sign-up/apple-icon.svg" />
|
||||
<span>Sign in with Apple</span>
|
||||
</button>
|
||||
<span style="width: 100%;">
|
||||
Or Log in with Email
|
||||
</span>
|
||||
<form (ngSubmit)="loginAccount()">
|
||||
<div class="form">
|
||||
<div class="item-inner">
|
||||
<ion-input
|
||||
type="email"
|
||||
[(ngModel)]="username"
|
||||
[ngModelOptions]="{standalone: true}"
|
||||
maxlenght="20"
|
||||
placeHolder="Username/Email"
|
||||
></ion-input>
|
||||
</div>
|
||||
<div class="item-inner">
|
||||
<ion-input
|
||||
type="password"
|
||||
[(ngModel)]="password"
|
||||
[ngModelOptions]="{standalone: true}"
|
||||
maxlenght="15"
|
||||
placeholder="Password"
|
||||
></ion-input>
|
||||
</div>
|
||||
<span class="forgot-password" (click)="lostPassword()">
|
||||
Forgot your password ?
|
||||
</span>
|
||||
|
||||
<button
|
||||
[ngClass]="{'signin-btn': true, 'active-button': username && password}"
|
||||
type="submit"
|
||||
>
|
||||
<strong>Log</strong> in
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</ion-content>
|
||||
|
||||
|
||||
@@ -0,0 +1,143 @@
|
||||
.merms-login-page{
|
||||
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
--padding-top: 0px;
|
||||
--padding-bottom: 40px;
|
||||
--padding-start: 24px;
|
||||
--padding-end: 24px;
|
||||
.container {
|
||||
padding-top: 7vh;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
height: 100%;
|
||||
ion-grid.top-container {
|
||||
flex: 0 0 0;
|
||||
width: 100%;
|
||||
}
|
||||
.navigation {
|
||||
text-align: left;
|
||||
padding-left: 2px;
|
||||
ion-back-button {
|
||||
--color: #000;
|
||||
display: inline-block;
|
||||
--icon-font-size: 30px;
|
||||
}
|
||||
}
|
||||
.page-title {
|
||||
font-style: normal;
|
||||
font-weight: bold;
|
||||
font-size: 12px;
|
||||
line-height: 106.4%;
|
||||
letter-spacing: 0.1em;
|
||||
text-transform: uppercase;
|
||||
color: #000;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
h1 {
|
||||
margin-top: 30px;
|
||||
font-style: normal;
|
||||
font-weight: 600;
|
||||
font-size: 26px;
|
||||
line-height: 135%;
|
||||
color: #000;
|
||||
text-align: center;
|
||||
}
|
||||
}
|
||||
|
||||
.bottom-container {
|
||||
margin-top: 6vh;
|
||||
display: block;
|
||||
//flex: 1;
|
||||
//flex-direction: column;
|
||||
.google-sign-up,
|
||||
.apple-sign-up {
|
||||
display: block;
|
||||
border: 2px solid #000000;
|
||||
box-sizing: border-box;
|
||||
border-radius: 26.98px;
|
||||
padding: 13px 0;
|
||||
text-align: center;
|
||||
background: none;
|
||||
font-weight: bold;
|
||||
font-size: 16px;
|
||||
line-height: 14px;
|
||||
color: #000000;
|
||||
margin-bottom: 20px;
|
||||
position: relative;
|
||||
height: 55px !important;
|
||||
width: 100%;
|
||||
|
||||
span {
|
||||
opacity: 1;
|
||||
font-size: 16px;
|
||||
line-height: 24px;
|
||||
margin: 0;
|
||||
height: 25px;
|
||||
display: inline-block;
|
||||
padding: 0;
|
||||
vertical-align: top;
|
||||
}
|
||||
|
||||
img {
|
||||
height: 24px;
|
||||
margin-right: 13px;
|
||||
}
|
||||
}
|
||||
span {
|
||||
font-size: 12px;
|
||||
line-height: 145%;
|
||||
letter-spacing: -0.2px;
|
||||
color: #000000;
|
||||
opacity: 0.25;
|
||||
text-align: center;
|
||||
display: inline-block;
|
||||
margin-bottom: 20px;
|
||||
&.forgot-password {
|
||||
margin-top: 20px;
|
||||
}
|
||||
}
|
||||
.form {
|
||||
display: flex;
|
||||
flex: 1;
|
||||
flex-direction: column;
|
||||
ion-input {
|
||||
border: 2px solid #000000;
|
||||
box-sizing: border-box;
|
||||
border-radius: 26.98px;
|
||||
margin-bottom: 16px;
|
||||
--padding-start: 20px;
|
||||
font-style: normal;
|
||||
font-weight: normal;
|
||||
font-size: 16px;
|
||||
line-height: 145%;
|
||||
letter-spacing: -0.2px;
|
||||
color: #000000;
|
||||
}
|
||||
button {
|
||||
background: #0b7493;
|
||||
border-radius: 30px;
|
||||
vertical-align: bottom;
|
||||
display: flex;
|
||||
margin: auto auto 0 auto;
|
||||
width: 168px;
|
||||
font-weight: 600;
|
||||
font-size: 16px;
|
||||
line-height: 22px;
|
||||
color: #fff;
|
||||
justify-content: center;
|
||||
padding: 14px 0;
|
||||
opacity: 0.5;
|
||||
height: 50px;
|
||||
min-height: 50px;
|
||||
&.active-button {
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -1,4 +1,15 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { MermsServiceProviderService } from './../providers/merms-service-provider.service';
|
||||
import { Component, ViewChild, OnInit } from '@angular/core';
|
||||
import { MermsSessionService } from './../merms-session.service';
|
||||
//import { Device } from '@ionic-native/device/ngx'
|
||||
import { Router, NavigationExtras } from '@angular/router'
|
||||
|
||||
|
||||
import {
|
||||
NavController,
|
||||
AlertController,
|
||||
LoadingController,
|
||||
} from '@ionic/angular'
|
||||
|
||||
@Component({
|
||||
selector: 'app-merms-login',
|
||||
@@ -7,9 +18,135 @@ import { Component, OnInit } from '@angular/core';
|
||||
})
|
||||
export class MermsLoginPage implements OnInit {
|
||||
|
||||
constructor() { }
|
||||
@ViewChild('username', { static: false }) username
|
||||
@ViewChild('password', { static: false }) password
|
||||
|
||||
loginData: {
|
||||
username: string
|
||||
password: string
|
||||
sessionid: string
|
||||
}
|
||||
|
||||
StoredloginData: {
|
||||
username: string
|
||||
password: string
|
||||
}
|
||||
|
||||
loaded = false
|
||||
loginResult: any
|
||||
public platform_is_ios: boolean = false
|
||||
|
||||
constructor(
|
||||
public navCtrl: NavController,
|
||||
private alertCtrl: AlertController,
|
||||
private loadingCtrl: LoadingController,
|
||||
/* private mermsServiceProviderService :MermsServiceProviderService,*/
|
||||
private mermsSessionService :MermsSessionService ,
|
||||
private router: Router
|
||||
) { }
|
||||
|
||||
ngOnInit() {
|
||||
}
|
||||
|
||||
|
||||
async loginAccount() {
|
||||
|
||||
console.log('MERMSLoginPage::loginAccount()')
|
||||
this.mermsSessionService.account_token = ''
|
||||
const loader = await this.loadingCtrl.create({
|
||||
message: 'Please wait...',
|
||||
duration: 3000,
|
||||
})
|
||||
|
||||
|
||||
/*
|
||||
220 spinner: null,
|
||||
221 duration: 5000,
|
||||
222 message: 'Click the backdrop to dismiss early...',
|
||||
223 translucent: true,
|
||||
224 cssClass: 'custom-class custom-loading',
|
||||
225 backdropDismiss: true
|
||||
*/
|
||||
|
||||
if (
|
||||
this.username == null ||
|
||||
this.username === '' ||
|
||||
this.mermsSessionService.validateEmail(this.username) === false ||
|
||||
this.password == null ||
|
||||
this.password === ''
|
||||
) {
|
||||
this.showAlert(
|
||||
'Invalid Login',
|
||||
'Enter username(email) and password to login'
|
||||
)
|
||||
} else {
|
||||
loader.present()
|
||||
this.loginData = {
|
||||
username: this.username,
|
||||
password: this.password,
|
||||
sessionid: 'DUMMYSESSION',
|
||||
}
|
||||
this.StoredloginData = {
|
||||
username: this.username,
|
||||
password: this.password,
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
this.completeLogin();
|
||||
}
|
||||
|
||||
completeLogin() {
|
||||
console.log('MERMSLoginPage::completeLogin()')
|
||||
// alert(100);
|
||||
this.router.navigateByUrl('/merms-dash')
|
||||
}
|
||||
|
||||
async showAlert(mtitle: string, amessage: string) {
|
||||
console.log('MERMSLoginPage::showAlert()')
|
||||
const alert = await this.alertCtrl.create({
|
||||
header: mtitle,
|
||||
message: amessage,
|
||||
buttons: ['OK'],
|
||||
})
|
||||
alert.present()
|
||||
}
|
||||
|
||||
lostPassword() {
|
||||
console.log('MERMSLoginPage::lostPassword()')
|
||||
// this.navCtrl.push(LostpasswordPage);
|
||||
this.router.navigateByUrl('/MERMS-lostpassword')
|
||||
}
|
||||
|
||||
showSignUp() {
|
||||
console.log('MERMSLoginPage::showSignUp()')
|
||||
// this.navCtrl.push(UserSignupPage);
|
||||
// this.navCtrl.push(HomePage,{jump_to_slide:5});
|
||||
const navigationExtras: NavigationExtras = {
|
||||
state: {
|
||||
jump_to_slide: 5,
|
||||
},
|
||||
}
|
||||
this.router.navigate(['/MERMS-start'], navigationExtras)
|
||||
}
|
||||
|
||||
goBack() {
|
||||
console.log('MERMSLoginPage::goBack()')
|
||||
this.navCtrl.pop()
|
||||
}
|
||||
|
||||
appleSignup() {
|
||||
console.log('MERMSStartPage:appleSignup()')
|
||||
|
||||
|
||||
}
|
||||
googleSignup() {
|
||||
console.log('MERMSLoginPage::googleSignup()')
|
||||
console.log('----- Google Signup -----')
|
||||
// this.signup_method = 1;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
import { TestBed } from '@angular/core/testing';
|
||||
|
||||
import { MermsSessionService } from './merms-session.service';
|
||||
|
||||
describe('MermsSessionService', () => {
|
||||
let service: MermsSessionService;
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({});
|
||||
service = TestBed.inject(MermsSessionService);
|
||||
});
|
||||
|
||||
it('should be created', () => {
|
||||
expect(service).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,207 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { HttpClient } from '@angular/common/http'
|
||||
import { Router } from '@angular/router'
|
||||
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class MermsSessionService {
|
||||
|
||||
constructor(
|
||||
public http: HttpClient,
|
||||
private router: Router
|
||||
|
||||
) { }
|
||||
|
||||
list_bank_count: number = 0
|
||||
|
||||
currentFooterPage = 'HOME'
|
||||
top_card = '' // "https://www.float.sg/float/static_top.png";
|
||||
firstname = ''
|
||||
lastname = ''
|
||||
session = ''
|
||||
balance = 0
|
||||
username = ''
|
||||
last_login = ''
|
||||
member_id = 0
|
||||
added = ''
|
||||
account_added = ''
|
||||
public country = ''
|
||||
email = ''
|
||||
city = ''
|
||||
fb_id = ''
|
||||
loc = ''
|
||||
news = ''
|
||||
id = 0
|
||||
phone = ''
|
||||
post_jobs = ''
|
||||
profile_pic = ''
|
||||
refer = ''
|
||||
state = ''
|
||||
status = 0
|
||||
street1 = ''
|
||||
zipcode = ''
|
||||
account_token = ''
|
||||
points = 0
|
||||
min_budget = 0
|
||||
max_budget = 0
|
||||
test = 1 // 0;
|
||||
count_acct = 0
|
||||
count_email = 0
|
||||
testAccount = 1 // Emmergency fix, remove once bookig flow is fixed
|
||||
alert_email = true
|
||||
alert_notification = true
|
||||
// settings
|
||||
FEED_BOOKING_SHOW = 100
|
||||
max_deals_cards = 5
|
||||
start_city = '' // "Powder Springs"
|
||||
start_country = '' // "US"
|
||||
start_state = '' // "GA"
|
||||
|
||||
public player_id = ''
|
||||
public access_token = ''
|
||||
public refresh_token = ''
|
||||
|
||||
public gps_city_location = '....'
|
||||
public gps_fulladdress_location = ''
|
||||
public gps_latitude
|
||||
public gps_longitude
|
||||
public dash_data_refresh_seconds = 15000
|
||||
public gps_country_code = ''
|
||||
public data_collection_mode = 1
|
||||
|
||||
public prompt_background_gps = true
|
||||
session_contructed = false
|
||||
|
||||
public personality_name = ''
|
||||
|
||||
public lastSessionCheck = null
|
||||
public readonly applicationStarted = new Date().getTime()
|
||||
|
||||
ConstructGlobalSessionData(loginResult: any) {
|
||||
console.log('FloatSessionProvider::ConstructGlobalSessionData()')
|
||||
this.session_contructed = false
|
||||
|
||||
try {
|
||||
console.log('Login result session:', loginResult)
|
||||
// alert(loginResult.firstname);
|
||||
this.firstname = loginResult.firstname
|
||||
this.lastname = loginResult.lastname
|
||||
|
||||
if (
|
||||
loginResult.hasOwnProperty('sessionid') &&
|
||||
loginResult.sessionid !== ''
|
||||
) {
|
||||
this.session = loginResult.sessionid
|
||||
loginResult.session = loginResult.sessionid
|
||||
delete loginResult.sessionid
|
||||
} else {
|
||||
this.session = loginResult.session
|
||||
if (loginResult.hasOwnProperty('sessionid')) {
|
||||
delete loginResult.sessionid
|
||||
}
|
||||
}
|
||||
|
||||
this.username = loginResult.username
|
||||
this.last_login = loginResult.last_login
|
||||
this.member_id = loginResult.member_id
|
||||
this.balance = loginResult.balance
|
||||
this.added = loginResult.added
|
||||
this.account_added = loginResult.account_added
|
||||
this.city = loginResult.city
|
||||
this.country = loginResult.country
|
||||
if (this.country === '') {
|
||||
// this.country = 'SG';
|
||||
}
|
||||
this.email = loginResult.email
|
||||
this.fb_id = loginResult.fb_id
|
||||
this.id = loginResult.id
|
||||
this.loc = loginResult.loc
|
||||
this.news = loginResult.news
|
||||
this.phone = loginResult.phone
|
||||
this.post_jobs = loginResult.post_jobs
|
||||
this.profile_pic = loginResult.profile_pic
|
||||
this.refer = loginResult.refer
|
||||
this.state = loginResult.state
|
||||
this.status = loginResult.status
|
||||
this.street1 = loginResult.street1
|
||||
this.zipcode = loginResult.zipcode
|
||||
this.test = 1 // loginResult.test;
|
||||
this.points = loginResult.points
|
||||
this.min_budget = loginResult.min_budget
|
||||
this.max_budget = loginResult.max_budget
|
||||
this.top_card = loginResult.top_card
|
||||
this.count_acct = loginResult.count_acct
|
||||
this.count_email = loginResult.count_email
|
||||
this.account_token = loginResult.account_token
|
||||
|
||||
this.alert_email = loginResult.alert_email === 1 ? true : false
|
||||
this.alert_notification =
|
||||
loginResult.alert_notification === 1 ? true : false
|
||||
/*
|
||||
START city , state or Country is the first detected location of the account - not a profile location
|
||||
*/
|
||||
|
||||
if (loginResult && loginResult.hasOwnProperty('max_deals_cards')) {
|
||||
this.max_deals_cards = loginResult.max_deals_cards
|
||||
}
|
||||
|
||||
if (loginResult && loginResult.hasOwnProperty('start_city')) {
|
||||
this.start_city = loginResult.start_city
|
||||
}
|
||||
if (loginResult && loginResult.hasOwnProperty('start_country')) {
|
||||
this.start_country = loginResult.start_country
|
||||
}
|
||||
if (loginResult && loginResult.hasOwnProperty('start_city')) {
|
||||
this.start_state = loginResult.start_state
|
||||
}
|
||||
|
||||
// app settings parameters
|
||||
this.FEED_BOOKING_SHOW = loginResult.FEED_BOOKING_SHOW
|
||||
if (loginResult && loginResult.hasOwnProperty('personality_name')) {
|
||||
this.personality_name = loginResult.personality_name
|
||||
}
|
||||
|
||||
if (loginResult && loginResult.hasOwnProperty('access_token')) {
|
||||
this.access_token = loginResult.access_token
|
||||
this.refresh_token = loginResult.refresh_token
|
||||
}
|
||||
if (loginResult && loginResult.hasOwnProperty('player_id')) {
|
||||
this.player_id = loginResult.player_id
|
||||
}
|
||||
|
||||
if (loginResult && loginResult.hasOwnProperty('prompt_background_gps')) {
|
||||
this.prompt_background_gps = loginResult.prompt_background_gps
|
||||
} else {
|
||||
this.prompt_background_gps = true // Let's ask
|
||||
}
|
||||
|
||||
// alert("Got Here");
|
||||
// this.pushNotificationProvider.tagUser(this.session);
|
||||
this.session_contructed = true
|
||||
|
||||
// console.log(loginResult);
|
||||
console.log(loginResult)
|
||||
console.log('LOGIN STORAGE COMPLETED')
|
||||
} catch (error) {
|
||||
console.log('LOGIN STORAGE ERROR -> ' + error)
|
||||
this.session_contructed = false
|
||||
}
|
||||
|
||||
return this.session_contructed
|
||||
}
|
||||
|
||||
updateSession(cleanUp) {
|
||||
console.log('FloatSessionProvider::updateSession(' + cleanUp + ')')
|
||||
let updateResult: any
|
||||
}
|
||||
|
||||
|
||||
|
||||
validateEmail(email) {
|
||||
const re = /\S+@\S+\.\S+/;
|
||||
return re.test(email);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
import { NgModule } from '@angular/core';
|
||||
import { Routes, RouterModule } from '@angular/router';
|
||||
|
||||
import { MermsSettingsPage } from './merms-settings.page';
|
||||
|
||||
const routes: Routes = [
|
||||
{
|
||||
path: '',
|
||||
component: MermsSettingsPage
|
||||
}
|
||||
];
|
||||
|
||||
@NgModule({
|
||||
imports: [RouterModule.forChild(routes)],
|
||||
exports: [RouterModule],
|
||||
})
|
||||
export class MermsSettingsPageRoutingModule {}
|
||||
@@ -0,0 +1,20 @@
|
||||
import { NgModule } from '@angular/core';
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { FormsModule } from '@angular/forms';
|
||||
|
||||
import { IonicModule } from '@ionic/angular';
|
||||
|
||||
import { MermsSettingsPageRoutingModule } from './merms-settings-routing.module';
|
||||
|
||||
import { MermsSettingsPage } from './merms-settings.page';
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
CommonModule,
|
||||
FormsModule,
|
||||
IonicModule,
|
||||
MermsSettingsPageRoutingModule
|
||||
],
|
||||
declarations: [MermsSettingsPage]
|
||||
})
|
||||
export class MermsSettingsPageModule {}
|
||||
@@ -0,0 +1,44 @@
|
||||
<ion-content class="merms-settings-page">
|
||||
<div class="container">
|
||||
<ion-grid class="top-container">
|
||||
<ion-row>
|
||||
<ion-col size="2" class="navigation">
|
||||
<ion-back-button text="" (click)="goBack()"></ion-back-button>
|
||||
</ion-col>
|
||||
<ion-col size="8" class="page-title">Settings</ion-col>
|
||||
</ion-row>
|
||||
</ion-grid>
|
||||
|
||||
|
||||
|
||||
<!-- Item Dividers in a List -->
|
||||
<ion-list>
|
||||
<ion-item-divider>
|
||||
<ion-label>
|
||||
Profile
|
||||
</ion-label>
|
||||
</ion-item-divider>
|
||||
|
||||
<ion-item><ion-label> Dr. Something Something</ion-label></ion-item>
|
||||
<ion-item><ion-label>Edit Profile</ion-label></ion-item>
|
||||
<ion-item><ion-label>A4</ion-label></ion-item>
|
||||
<ion-item><ion-label>Practice Time</ion-label></ion-item>
|
||||
|
||||
<ion-item-divider>
|
||||
<ion-label>
|
||||
Manage Practice
|
||||
</ion-label>
|
||||
</ion-item-divider>
|
||||
|
||||
<ion-item><ion-label>Add Practice</ion-label></ion-item>
|
||||
<ion-item><ion-label>B3</ion-label></ion-item>
|
||||
<ion-item><ion-label>B4</ion-label></ion-item>
|
||||
<ion-item><ion-label>B5</ion-label></ion-item>
|
||||
</ion-list>
|
||||
|
||||
<ion-button expand="full" color="danger" (click)="goLogout()">Log Out</ion-button>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
</ion-content>
|
||||
@@ -0,0 +1,143 @@
|
||||
.merms-settings-page{
|
||||
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
--padding-top: 0px;
|
||||
--padding-bottom: 40px;
|
||||
--padding-start: 24px;
|
||||
--padding-end: 24px;
|
||||
.container {
|
||||
padding-top: 7vh;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
height: 100%;
|
||||
ion-grid.top-container {
|
||||
flex: 0 0 0;
|
||||
width: 100%;
|
||||
}
|
||||
.navigation {
|
||||
text-align: left;
|
||||
padding-left: 2px;
|
||||
ion-back-button {
|
||||
--color: #000;
|
||||
display: inline-block;
|
||||
--icon-font-size: 30px;
|
||||
}
|
||||
}
|
||||
.page-title {
|
||||
font-style: normal;
|
||||
font-weight: bold;
|
||||
font-size: 12px;
|
||||
line-height: 106.4%;
|
||||
letter-spacing: 0.1em;
|
||||
text-transform: uppercase;
|
||||
color: #000;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
h1 {
|
||||
margin-top: 30px;
|
||||
font-style: normal;
|
||||
font-weight: 600;
|
||||
font-size: 26px;
|
||||
line-height: 135%;
|
||||
color: #000;
|
||||
text-align: center;
|
||||
}
|
||||
}
|
||||
|
||||
.bottom-container {
|
||||
margin-top: 6vh;
|
||||
display: block;
|
||||
//flex: 1;
|
||||
//flex-direction: column;
|
||||
.google-sign-up,
|
||||
.apple-sign-up {
|
||||
display: block;
|
||||
border: 2px solid #000000;
|
||||
box-sizing: border-box;
|
||||
border-radius: 26.98px;
|
||||
padding: 13px 0;
|
||||
text-align: center;
|
||||
background: none;
|
||||
font-weight: bold;
|
||||
font-size: 16px;
|
||||
line-height: 14px;
|
||||
color: #000000;
|
||||
margin-bottom: 20px;
|
||||
position: relative;
|
||||
height: 55px !important;
|
||||
width: 100%;
|
||||
|
||||
span {
|
||||
opacity: 1;
|
||||
font-size: 16px;
|
||||
line-height: 24px;
|
||||
margin: 0;
|
||||
height: 25px;
|
||||
display: inline-block;
|
||||
padding: 0;
|
||||
vertical-align: top;
|
||||
}
|
||||
|
||||
img {
|
||||
height: 24px;
|
||||
margin-right: 13px;
|
||||
}
|
||||
}
|
||||
span {
|
||||
font-size: 12px;
|
||||
line-height: 145%;
|
||||
letter-spacing: -0.2px;
|
||||
color: #000000;
|
||||
opacity: 0.25;
|
||||
text-align: center;
|
||||
display: inline-block;
|
||||
margin-bottom: 20px;
|
||||
&.forgot-password {
|
||||
margin-top: 20px;
|
||||
}
|
||||
}
|
||||
.form {
|
||||
display: flex;
|
||||
flex: 1;
|
||||
flex-direction: column;
|
||||
ion-input {
|
||||
border: 2px solid #000000;
|
||||
box-sizing: border-box;
|
||||
border-radius: 26.98px;
|
||||
margin-bottom: 16px;
|
||||
--padding-start: 20px;
|
||||
font-style: normal;
|
||||
font-weight: normal;
|
||||
font-size: 16px;
|
||||
line-height: 145%;
|
||||
letter-spacing: -0.2px;
|
||||
color: #000000;
|
||||
}
|
||||
button {
|
||||
background: #0b7493;
|
||||
border-radius: 30px;
|
||||
vertical-align: bottom;
|
||||
display: flex;
|
||||
margin: auto auto 0 auto;
|
||||
width: 168px;
|
||||
font-weight: 600;
|
||||
font-size: 16px;
|
||||
line-height: 22px;
|
||||
color: #fff;
|
||||
justify-content: center;
|
||||
padding: 14px 0;
|
||||
opacity: 0.5;
|
||||
height: 50px;
|
||||
min-height: 50px;
|
||||
&.active-button {
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { IonicModule } from '@ionic/angular';
|
||||
|
||||
import { MermsSettingsPage } from './merms-settings.page';
|
||||
|
||||
describe('MermsSettingsPage', () => {
|
||||
let component: MermsSettingsPage;
|
||||
let fixture: ComponentFixture<MermsSettingsPage>;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ MermsSettingsPage ],
|
||||
imports: [IonicModule.forRoot()]
|
||||
}).compileComponents();
|
||||
|
||||
fixture = TestBed.createComponent(MermsSettingsPage);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
}));
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,32 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { Router, NavigationExtras } from '@angular/router'
|
||||
import {
|
||||
NavController,
|
||||
AlertController,
|
||||
LoadingController,
|
||||
} from '@ionic/angular'
|
||||
|
||||
|
||||
|
||||
@Component({
|
||||
selector: 'app-merms-settings',
|
||||
templateUrl: './merms-settings.page.html',
|
||||
styleUrls: ['./merms-settings.page.scss'],
|
||||
})
|
||||
export class MermsSettingsPage implements OnInit {
|
||||
|
||||
constructor( public navCtrl: NavController,private router: Router) { }
|
||||
|
||||
ngOnInit() {
|
||||
}
|
||||
|
||||
goBack() {
|
||||
console.log('MERMSLoginPage::goBack()')
|
||||
this.navCtrl.pop()
|
||||
}
|
||||
|
||||
goLogout(){
|
||||
// /home
|
||||
this.router.navigateByUrl('/home')
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,97 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
//import { Storage } from '@ionic/storage';
|
||||
import * as CryptoBrowserify from 'crypto-browserify';
|
||||
import { BehaviorSubject } from 'rxjs';
|
||||
// import { FloatSessionProvider } from '../providers/float-session/float-session';
|
||||
|
||||
export let CONFIG = {
|
||||
appVersion: 'myFloatApp 1.0.0',
|
||||
firebaseConfig: {
|
||||
apiKey: 'AIzaSyCQ1AZ-BWDWY9bLCEh-D6hLUOfDK7FnbTQ',
|
||||
authDomain: 'float-app-224118.firebaseapp.com',
|
||||
databaseURL: 'https://float-app-224118.firebaseio.com',
|
||||
projectId: 'float-app-224118',
|
||||
storageBucket: 'float-app-224118.appspot.com',
|
||||
messagingSenderId: '343605975098',
|
||||
},
|
||||
googleMapsKey: 'AIzaSyCPFo6GfBNOYEsUeFiw9Zq2XD54O5hXuO4',
|
||||
clientId: "FloatApp",
|
||||
googleWebClientId:
|
||||
'343605975098-ao362h3sq637l91q7o5haiv7gu44spo6.apps.googleusercontent.com',
|
||||
googleScopes:
|
||||
'email profile openid https://www.googleapis.com/auth/gmail.readonly',
|
||||
googleClientSecret: 'qj115Y45Ovs1WCJSa4xbCw46',
|
||||
oneSignal: {
|
||||
appId: 'e9a7bb38-0a27-4250-9fb7-9bd7871d7b63',
|
||||
apiKey: 'NjE2OTg4ZDAtMWQ5MC00ZGMwLThhM2MtY2JhZTkzMjAyNzBi',
|
||||
googleProjectNumber: '858926099772',
|
||||
},
|
||||
app: {
|
||||
environment: 'production',
|
||||
password: '342b90d2fc96017673858f5aecab4e1d',
|
||||
iv: '0dbe837a2196f4c5',
|
||||
},
|
||||
locationTracker: {
|
||||
cacheSize: 50,
|
||||
},
|
||||
decrypt: function (iv: string, text: string, password: string) {
|
||||
const decipher = CryptoBrowserify.createDecipheriv(
|
||||
'aes-256-ctr',
|
||||
password,
|
||||
iv
|
||||
);
|
||||
let dec = decipher.update(text, 'hex', 'utf8');
|
||||
dec += decipher.final('utf8');
|
||||
return JSON.parse(dec);
|
||||
},
|
||||
development: function () {
|
||||
return CONFIG.decrypt(
|
||||
CONFIG.app.iv,
|
||||
'078eb203fce4db5b9c7ab388dc6d98e103e284c6641f084f50ece99c6cfaebfdb1863f70e53d03f7bd24472112a4310e2b7b4c8d83f171e1028906f70212d41b9669d35d68533d5911ebdd030504885f8fe87dea68fe6f5bddb1336c6ba352c129d4aa3baaf953284c22f40ca3aa069a21a2a1e2f098071dccfc95307f8e42401f7c61a41eccb46e2dc244bef0aca5e11551ff8ee39781d359539f59c0a69d91a1e9094483c64f55feacffcda19acc3f7c738eebb0ca151a8c98b7490fc8fd5c0662ee8edd9a2cb2',
|
||||
CONFIG.app.password
|
||||
);
|
||||
},
|
||||
production: function () {
|
||||
return CONFIG.decrypt(
|
||||
CONFIG.app.iv,
|
||||
'078eb203fce4db5b9c7ab388dc6d98e103e284c6641f084f50ece99c6cfaebfdb1863f70e53d03e2a624543e4ff9304068101883d0b673ed288904b6525bbf5ecf69880d237e3b4657e4c4120b5f885cd3be79e96ebe743598a0762969af78c12b91e478f8a0037e4023f935bfa350c96eeed3e5bddc0b058da99e327cde1543172332f0199db1387cc645bda0afabb41f59edc38bd4c5961f519373c0a4d8dfe2bb5014d5ca4e58c583ad83e8d7c4404b358df8a5c3444bdd99b04c07c4ef3719',
|
||||
CONFIG.app.password
|
||||
);
|
||||
},
|
||||
development_tolik: function () {
|
||||
return CONFIG.decrypt(
|
||||
CONFIG.app.iv,
|
||||
'078eb203fce4db5b9c7ab388dc6d98e103e284c6641f084f50ece99c6cfaece4af9c3528e0325ff7ab3d43334ff9200d36714b8d96fa3cac7c8755b0001efe1b966b920d2138780252a1946a5944ce03caf971b56ffa3d0c8de6356b7eeb3dd06c91a83780f9532a096cb75efaf8179d2dbe93f7fdd35253a5a8de21719b5646157665f04a98e8327b9214eea0fcf5e71f5bfbdab7c3dd8f0f10d13084e3db93adc3094481830116acf5addca696d00f5a25dda4fcb2710b828da34f05c2f9085236b2d28bd944acb1a900c50578',
|
||||
CONFIG.app.password
|
||||
);
|
||||
},
|
||||
};
|
||||
|
||||
@Injectable({ providedIn: 'root' })
|
||||
export class AppSettingsProvider {
|
||||
private theme: BehaviorSubject<String>;
|
||||
|
||||
constructor(/*private storage: Storage*/) {
|
||||
/*
|
||||
console.log('AppSettingsProvider::constructor');
|
||||
this.theme = new BehaviorSubject('light-theme');
|
||||
this.storage.get('selectedTheme').then(val => {
|
||||
console.log('AppSettingsProvider::constructor => ' + val);
|
||||
if (val == null || val !== 'dark-theme') {
|
||||
val = 'light-theme';
|
||||
}
|
||||
this.setActiveTheme(val);
|
||||
});
|
||||
*/
|
||||
}
|
||||
|
||||
setActiveTheme(val) {
|
||||
console.log('AppSettingsProvider::setActiveTheme(' + val + ')');
|
||||
// this.storage.set('selectedTheme', val);
|
||||
this.theme.next(val);
|
||||
}
|
||||
|
||||
getActiveTheme() {
|
||||
return this.theme.asObservable();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
export let VERSION = {
|
||||
branch: "master",
|
||||
latestTag: "003f122ba6f8cc78364a42d512aa7b2f47f0ffc1",
|
||||
revCount: "843",
|
||||
shortHash: "003f122"
|
||||
};
|
||||
@@ -0,0 +1,16 @@
|
||||
import { TestBed } from '@angular/core/testing';
|
||||
|
||||
import { MermsServiceProviderService } from './merms-service-provider.service';
|
||||
|
||||
describe('MermsServiceProviderService', () => {
|
||||
let service: MermsServiceProviderService;
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({});
|
||||
service = TestBed.inject(MermsServiceProviderService);
|
||||
});
|
||||
|
||||
it('should be created', () => {
|
||||
expect(service).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,177 @@
|
||||
import { HttpClient, HttpHeaders, HttpParams } from '@angular/common/http'
|
||||
import { Injectable, Injector } from '@angular/core'
|
||||
//import 'rxjs/add/operator/map'
|
||||
//import { Observable, from } from 'rxjs'
|
||||
import { MermsSessionService } from './../merms-session.service';
|
||||
//import * as CryptoBrowserify from 'crypto-browserify'
|
||||
//import { CONFIG } from './app-config'
|
||||
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class MermsServiceProviderService {
|
||||
|
||||
|
||||
//config = CONFIG[CONFIG.app.environment]()
|
||||
//apiKey = this.config.apiKey
|
||||
url = ''
|
||||
// oauth_url: string = this.config.baseURL + '/SAVVY/oauth2/api'
|
||||
// account_endpoint: string = this.config.baseURL + '/SAVVY/banklogin/api'
|
||||
// booking_endpoint: string = this.config.baseURL + '/SAVVY/booking/api'
|
||||
// advice_endpoint: string = this.config.baseURL + '/SAVVY/advice/api'
|
||||
// trip_endpoint: string = this.config.baseURL + '/SAVVY/trips/api'
|
||||
// messaging_endpoint: string = this.config.baseURL + '/SAVVY/messaging/api'
|
||||
// blog_endpoint: string = this.config.baseURL + '/SAVVY/blog/api'
|
||||
// clientId: string = CONFIG.clientId
|
||||
|
||||
// encryptionKey: string = this.config.encryptionKey
|
||||
// encryptionIV: string = this.config.encryptionIV
|
||||
|
||||
|
||||
|
||||
constructor(public http: HttpClient,
|
||||
private mermsSessionService:MermsSessionService) { }
|
||||
|
||||
loginUser(loginData) {
|
||||
// this.http.post(this.url + '/userlogin', loginData);
|
||||
return this.sendPostRequest('1', '/userlogin', loginData)
|
||||
}
|
||||
|
||||
sendPostRequest(grp: string, endPoint: string, sendData: any) {
|
||||
// grp - will be used to change URL
|
||||
let endpointString = ''
|
||||
console.log('GRP->' + grp)
|
||||
switch (grp) {
|
||||
case '1':
|
||||
endpointString = this.url
|
||||
break
|
||||
|
||||
|
||||
}
|
||||
(async () => {
|
||||
// const id = Math.floor(100 * Math.random());
|
||||
const id = (Math.random() * (10000 - 1000) + 1000).toFixed(0)
|
||||
const d1 = new Date()
|
||||
console.log('[' + id + '] before semaphore: ' + d1.getTime())
|
||||
await this.semaphore(id)
|
||||
const d2 = new Date()
|
||||
console.log('[' + id + '] after semaphore: ' + d2.getTime())
|
||||
})()
|
||||
|
||||
}
|
||||
|
||||
getResponseError(error) {
|
||||
// console.log("Error:" + JSON.stringify(error));
|
||||
console.log(error)
|
||||
let data = error['error']
|
||||
let result = data
|
||||
if (data != null && data.hasOwnProperty('payload')) {
|
||||
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
authUser(authData) {
|
||||
return this.sendPostRequest('4', '/auth', authData)
|
||||
}
|
||||
/*
|
||||
encrypt(iv: string, text: string, password: string) {
|
||||
const cipher = CryptoBrowserify.createCipheriv('aes-256-ctr', password, iv)
|
||||
let crypted = cipher.update(text, 'utf8', 'hex')
|
||||
crypted += cipher.final('hex')
|
||||
return crypted
|
||||
}
|
||||
|
||||
decrypt(iv: string, text: string, password: string) {
|
||||
const decipher = CryptoBrowserify.createDecipheriv(
|
||||
'aes-256-ctr',
|
||||
password,
|
||||
iv
|
||||
)
|
||||
let dec = decipher.update(text, 'hex', 'utf8')
|
||||
dec += decipher.final('utf8')
|
||||
return dec
|
||||
}
|
||||
*/
|
||||
/**
|
||||
* Checks if the response from the server returns invalid session error
|
||||
*
|
||||
* @param response_data response from the server
|
||||
*/
|
||||
checkSessionValid(response_data: any){
|
||||
|
||||
if("session_valid" in response_data){
|
||||
if(response_data['session_valid'] === "INVALID_SESSION") {
|
||||
return this.doLogout();
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
doLogout(){
|
||||
// this.floatEventsService.publish('DoLogout', {});
|
||||
}
|
||||
|
||||
|
||||
queued = 0
|
||||
lastQueued = 0
|
||||
|
||||
async semaphore(marker: string) {
|
||||
console.log('[' + marker + '] inside semaphore: start')
|
||||
const cd = new Date()
|
||||
const sec = cd.getTime()
|
||||
if (this.queued < 0 || sec - this.lastQueued > 10) {
|
||||
this.queued = 0
|
||||
}
|
||||
if (this.lastQueued === 0 || sec - this.lastQueued > 1000) {
|
||||
this.lastQueued = sec
|
||||
console.log(
|
||||
'[' +
|
||||
marker +
|
||||
'] inside semaphore: wait (queued: ' +
|
||||
this.queued +
|
||||
', lastQueued: ' +
|
||||
this.lastQueued +
|
||||
')'
|
||||
)
|
||||
await this.delay(1000)
|
||||
console.log(
|
||||
'[' +
|
||||
marker +
|
||||
'] inside semaphore: done (queued: ' +
|
||||
this.queued +
|
||||
', lastQueued: ' +
|
||||
this.lastQueued +
|
||||
')'
|
||||
)
|
||||
return
|
||||
}
|
||||
this.lastQueued = sec
|
||||
this.queued++
|
||||
console.log(
|
||||
'[' +
|
||||
marker +
|
||||
'] inside semaphore: wait (queued: ' +
|
||||
this.queued +
|
||||
', lastQueued: ' +
|
||||
this.lastQueued +
|
||||
')'
|
||||
)
|
||||
await this.delay(1000 + 1000 * this.queued)
|
||||
console.log(
|
||||
'[' +
|
||||
marker +
|
||||
'] inside semaphore: done (queued: ' +
|
||||
this.queued +
|
||||
', lastQueued: ' +
|
||||
this.lastQueued +
|
||||
')'
|
||||
)
|
||||
}
|
||||
|
||||
delay(ms: number) {
|
||||
return new Promise((resolve) => setTimeout(resolve, ms))
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user