data refresh
This commit is contained in:
@@ -70,6 +70,9 @@ ionic generate interface interfaces/location
|
||||
ionic generate interface interfaces/marker
|
||||
|
||||
|
||||
ionic generate service interval-refresh
|
||||
ionic generate service family-data
|
||||
ionic generate service market-data
|
||||
|
||||
|
||||
$ ionic generate
|
||||
|
||||
@@ -6,6 +6,7 @@ import { WrenchService } from 'src/app/services/wrench.service';
|
||||
import { OnesignalService } from 'src/app/services/onesignal.service';//
|
||||
import { UserWalletService } from 'src/app/store/user-wallet.service';
|
||||
import { LocTrcService } from "../../services/loc-trc.service";
|
||||
import {MarketDataService} from "../../store/market-data.service";
|
||||
|
||||
//import * as stream from "stream";
|
||||
|
||||
@@ -34,7 +35,8 @@ export class HomePage implements OnInit {
|
||||
private onesignalService: OnesignalService,
|
||||
public blogDataService: BlogDataService,
|
||||
public userWalletService: UserWalletService,
|
||||
private locTrcService:LocTrcService
|
||||
private locTrcService:LocTrcService,
|
||||
public marketDataService:MarketDataService,
|
||||
) {
|
||||
this.accountType = sessionDataProviderService.account_type;
|
||||
this.firstname = this.sessionDataProviderService.firstname;
|
||||
@@ -73,7 +75,7 @@ export class HomePage implements OnInit {
|
||||
console.log('Home page did enter - > ionViewWillEnter');
|
||||
this.allInitFunctions();
|
||||
}
|
||||
walletPresentation(){
|
||||
async walletPresentation(){
|
||||
this.walletData = this.userWalletService.getWallet();
|
||||
if( this.walletData?.length > 0 ) {
|
||||
var num = new Number(this.walletData[0].amount*0.01);
|
||||
|
||||
@@ -4,7 +4,7 @@ import { WrenchService } from 'src/app/services/wrench.service';
|
||||
import { SessionDataProviderService } from 'src/app/store/session-data-provider.service';
|
||||
import { BlogDataService } from 'src/app/store/blog-data.service';
|
||||
import { environment} from "../../../environments/environment";
|
||||
import { AlertController, Platform } from '@ionic/angular';
|
||||
import {AlertController, LoadingController, Platform} from '@ionic/angular';
|
||||
import { Preferences } from '@capacitor/preferences';
|
||||
import { Capacitor } from '@capacitor/core';
|
||||
import jwt_decode from "jwt-decode";
|
||||
@@ -18,6 +18,9 @@ import {
|
||||
FacebookLoginResponse,
|
||||
} from '@capacitor-community/facebook-login';
|
||||
import { GoogleAuth, User } from '@codetrix-studio/capacitor-google-auth';
|
||||
import {UserWalletService} from "../../store/user-wallet.service";
|
||||
import {IntervalRefreshService} from "../../store/interval-refresh.service";
|
||||
import {MarketDataService} from "../../store/market-data.service";
|
||||
|
||||
@Component({
|
||||
selector: 'app-login',
|
||||
@@ -53,8 +56,13 @@ export class LoginPage implements OnInit {
|
||||
public sessionDataProviderService:SessionDataProviderService,
|
||||
public blogDataService:BlogDataService,
|
||||
private alertController: AlertController,
|
||||
public platform: Platform
|
||||
) {
|
||||
public userWalletService: UserWalletService,
|
||||
public intervalRefreshService: IntervalRefreshService,
|
||||
public platform: Platform,
|
||||
private loadingCtrl: LoadingController,
|
||||
public marketDataService:MarketDataService,
|
||||
) {
|
||||
this.sessionDataProviderService.DestroySessionOnLogout();
|
||||
// https://ionicframework.com/docs/angular/platform
|
||||
this.ios = platform.is('ios');
|
||||
this.android = platform.is('android');
|
||||
@@ -111,11 +119,17 @@ getBlogData(){
|
||||
loginData: {
|
||||
username: string, password: string, sessionid: string
|
||||
};
|
||||
startLogin() {
|
||||
async startLogin() {
|
||||
const loading = await this.loadingCtrl.create({
|
||||
message: 'Starting ... ',
|
||||
duration: 1500,
|
||||
});
|
||||
|
||||
if (this.username == null || this.username == '' || this.validateEmail(this.username) == false || this.password == null || this.password == '') {
|
||||
this.showAlert('Invalid Login', 'Enter username(email) and password to login');
|
||||
return;
|
||||
}
|
||||
loading.present();
|
||||
this.loginData = { username: this.username, password: this.password, sessionid: 'DUMMY-APP-SESSION' }
|
||||
this.wrenchService.loginUser(this.loginData).subscribe(
|
||||
loginResult => {
|
||||
@@ -131,8 +145,12 @@ getBlogData(){
|
||||
};
|
||||
|
||||
|
||||
this.getBlogData();
|
||||
this.router.navigate(['tabs/tab1']);
|
||||
// this.intervalRefreshService.startIntervalCalls(); // anything with interval call
|
||||
// this.marketDataService.getJobsData();
|
||||
// this.getBlogData();
|
||||
// this.userWalletService.getWallet();
|
||||
this.startUpCalls();
|
||||
this.router.navigate(['tabs/tab1']);
|
||||
}
|
||||
else{
|
||||
//debugger;
|
||||
@@ -151,6 +169,12 @@ getBlogData(){
|
||||
);
|
||||
}
|
||||
|
||||
async startUpCalls(){
|
||||
this.intervalRefreshService.startIntervalCalls(); // anything with interval call
|
||||
this.marketDataService.getJobsData();
|
||||
this.getBlogData();
|
||||
this.userWalletService.getWalletData();
|
||||
}
|
||||
onForgot() {
|
||||
this.router.navigate(['forgot']);
|
||||
}
|
||||
@@ -254,8 +278,12 @@ getBlogData(){
|
||||
value: this.username,
|
||||
});
|
||||
};
|
||||
|
||||
this.getBlogData();
|
||||
|
||||
// this.intervalRefreshService.startIntervalCalls(); // anything with interval call
|
||||
// this.marketDataService.getJobsData();
|
||||
// this.getBlogData();
|
||||
// this.userWalletService.getWallet();
|
||||
this.startUpCalls();
|
||||
this.router.navigate(['tabs/tab1']);
|
||||
}
|
||||
else{
|
||||
@@ -324,8 +352,12 @@ getBlogData(){
|
||||
value: this.username,
|
||||
});
|
||||
};
|
||||
|
||||
this.getBlogData();
|
||||
|
||||
// this.intervalRefreshService.startIntervalCalls(); // anything with interval call
|
||||
// this.marketDataService.getJobsData();
|
||||
// this.getBlogData();
|
||||
// this.userWalletService.getWallet();
|
||||
this.startUpCalls();
|
||||
this.router.navigate(['tabs/tab1']);
|
||||
}
|
||||
else{
|
||||
@@ -458,9 +490,12 @@ getBlogData(){
|
||||
value: this.username,
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
this.getBlogData();
|
||||
|
||||
// this.intervalRefreshService.startIntervalCalls(); // anything with interval call
|
||||
// this.marketDataService.getJobsData();
|
||||
// this.getBlogData();
|
||||
// this.userWalletService.getWallet();
|
||||
this.startUpCalls();
|
||||
this.router.navigate(['tabs/tab1']);
|
||||
}
|
||||
else{
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
</div>
|
||||
<div class="video" *ngFor="let item of jobsData;" (click)="viewMarketItem( item )">
|
||||
<div class="left">
|
||||
<div class="bg_image men_image" [style.backgroundImage]="'url('+session_image_server+'/'+curr_session+'/job/'+item.job_uid+')'"></div>
|
||||
<div class="bg_image men_image" [style.backgroundImage]="'url('+session_image_server+''+curr_session+'/job/'+item.job_uid+')'"></div>
|
||||
|
||||
<div class="text">
|
||||
<div class="bold_text" [innerHTML]="item.title"></div>
|
||||
|
||||
@@ -3,6 +3,7 @@ import { Component, OnInit } from '@angular/core';
|
||||
import { WrenchService } from 'src/app/services/wrench.service';
|
||||
import {SessionDataProviderService} from "../../store/session-data-provider.service";
|
||||
import {WaitingInterestService} from "../../store/waiting-interest.service";
|
||||
import {MarketDataService} from "../../store/market-data.service";
|
||||
@Component({
|
||||
selector: 'app-my-course',
|
||||
templateUrl: './my-course.page.html',
|
||||
@@ -18,9 +19,16 @@ export class MyCoursePage implements OnInit {
|
||||
private router: Router,
|
||||
public sessionDataProviderService: SessionDataProviderService,
|
||||
private wrenchService: WrenchService,
|
||||
public marketDataService:MarketDataService,
|
||||
private waitingInterestService:WaitingInterestService
|
||||
) { }
|
||||
) {
|
||||
this.marketDataService.getJobsData();
|
||||
}
|
||||
|
||||
ionViewWillEnter(){
|
||||
console.log('Home page did enter - > ionViewWillEnter');
|
||||
this.session_image_server = this.marketDataService.session_image_server;
|
||||
}
|
||||
ngOnInit() {
|
||||
this.getJobsData();
|
||||
}
|
||||
@@ -35,7 +43,8 @@ export class MyCoursePage implements OnInit {
|
||||
|
||||
ionViewDidEnter(){
|
||||
console.log('Home page did enter - > ionViewDidEnter ');
|
||||
this.getJobsData();
|
||||
this.session_image_server = this.marketDataService.session_image_server;
|
||||
this.jobsData = this.marketDataService.jobsData;
|
||||
}
|
||||
|
||||
usrData: {
|
||||
@@ -44,22 +53,28 @@ export class MyCoursePage implements OnInit {
|
||||
|
||||
jobsTotalData:any;
|
||||
jobsData: [];
|
||||
getJobsData(){
|
||||
async getJobsData(){
|
||||
|
||||
this.curr_session = this.sessionDataProviderService.session;
|
||||
var interval = setInterval( ()=> {
|
||||
this.jobsData = this.marketDataService.jobsData;
|
||||
this.session_image_server = this.marketDataService.session_image_server;
|
||||
}, 5000);
|
||||
|
||||
this.usrData = {action:11200, member_id: this.sessionDataProviderService.member_id, uid: this.sessionDataProviderService.member_uid, sessionid: this.sessionDataProviderService.session , limit:20, page:1}
|
||||
this.wrenchService.getJobsData(this.usrData).subscribe(
|
||||
jobsTotalData => {
|
||||
this.jobsTotalData = jobsTotalData;
|
||||
console.log("PAH HX RETURN->", this.jobsTotalData);
|
||||
this.jobsData = this.jobsTotalData.result_list;
|
||||
this.session_image_server = this.jobsTotalData.session_image_server;
|
||||
|
||||
// debugger;
|
||||
console.log("JOBS RETURN DATA->", this.jobsData);
|
||||
// this.blogDataService.setBlogData(this.blogResult.blog_data);
|
||||
}
|
||||
);
|
||||
// this.usrData = {action:11200, member_id: this.sessionDataProviderService.member_id, uid: this.sessionDataProviderService.member_uid, sessionid: this.sessionDataProviderService.session , limit:20, page:1}
|
||||
// this.wrenchService.getJobsData(this.usrData).subscribe(
|
||||
// jobsTotalData => {
|
||||
// this.jobsTotalData = jobsTotalData;
|
||||
// console.log("PAH HX RETURN->", this.jobsTotalData);
|
||||
// this.jobsData = this.jobsTotalData.result_list;
|
||||
// this.session_image_server = this.jobsTotalData.session_image_server;
|
||||
//
|
||||
// // debugger;
|
||||
// console.log("JOBS RETURN DATA->", this.jobsData);
|
||||
// // this.blogDataService.setBlogData(this.blogResult.blog_data);
|
||||
// }
|
||||
// );
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
import { TestBed } from '@angular/core/testing';
|
||||
|
||||
import { FamilyDataService } from './family-data.service';
|
||||
|
||||
describe('FamilyDataService', () => {
|
||||
let service: FamilyDataService;
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({});
|
||||
service = TestBed.inject(FamilyDataService);
|
||||
});
|
||||
|
||||
it('should be created', () => {
|
||||
expect(service).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,9 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class FamilyDataService {
|
||||
|
||||
constructor() { }
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
import { TestBed } from '@angular/core/testing';
|
||||
|
||||
import { IntervalRefreshService } from './interval-refresh.service';
|
||||
|
||||
describe('IntervalRefreshService', () => {
|
||||
let service: IntervalRefreshService;
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({});
|
||||
service = TestBed.inject(IntervalRefreshService);
|
||||
});
|
||||
|
||||
it('should be created', () => {
|
||||
expect(service).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,28 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import {SessionDataProviderService} from "./session-data-provider.service";
|
||||
import {MarketDataService} from "./market-data.service";
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class IntervalRefreshService {
|
||||
|
||||
constructor( public sessionDataProviderService:SessionDataProviderService,
|
||||
public marketDataService:MarketDataService) {
|
||||
this.marketDataService.getJobsData();
|
||||
}
|
||||
|
||||
startIntervalCalls(){
|
||||
console.log("Hello Start ",this.sessionDataProviderService.session,this.sessionDataProviderService.refresh );
|
||||
var interval = setInterval( ()=> {
|
||||
|
||||
if( this.sessionDataProviderService.session == ''){
|
||||
clearInterval(interval);
|
||||
return;
|
||||
}
|
||||
console.log("Interval Function ",this.sessionDataProviderService.session );
|
||||
this.marketDataService.getJobsData();
|
||||
}, this.sessionDataProviderService.refresh*2);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
import { TestBed } from '@angular/core/testing';
|
||||
|
||||
import { MarketDataService } from './market-data.service';
|
||||
|
||||
describe('MarketDataService', () => {
|
||||
let service: MarketDataService;
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({});
|
||||
service = TestBed.inject(MarketDataService);
|
||||
});
|
||||
|
||||
it('should be created', () => {
|
||||
expect(service).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,38 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import {SessionDataProviderService} from "./session-data-provider.service";
|
||||
import {WrenchService} from "../services/wrench.service";
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class MarketDataService {
|
||||
session_image_server:string='';
|
||||
curr_session:string='';
|
||||
constructor( public sessionDataProviderService: SessionDataProviderService,
|
||||
private wrenchService: WrenchService) { }
|
||||
|
||||
usrData: {
|
||||
action:11200, member_id: number, uid: string, sessionid: string, limit:20, page:1
|
||||
};
|
||||
|
||||
jobsTotalData:any;
|
||||
jobsData: [];
|
||||
getJobsData(){
|
||||
this.curr_session = this.sessionDataProviderService.session;
|
||||
|
||||
this.usrData = {action:11200, member_id: this.sessionDataProviderService.member_id, uid: this.sessionDataProviderService.member_uid, sessionid: this.sessionDataProviderService.session , limit:20, page:1}
|
||||
this.wrenchService.getJobsData(this.usrData).subscribe(
|
||||
jobsTotalData => {
|
||||
this.jobsTotalData = jobsTotalData;
|
||||
console.log("PAH HX RETURN->", this.jobsTotalData);
|
||||
this.jobsData = this.jobsTotalData.result_list;
|
||||
this.session_image_server = this.jobsTotalData.session_image_server;
|
||||
|
||||
// debugger;
|
||||
console.log("JOBS RETURN DATA->", this.jobsData);
|
||||
// this.blogDataService.setBlogData(this.blogResult.blog_data);
|
||||
}
|
||||
);
|
||||
|
||||
}
|
||||
}
|
||||
@@ -6,7 +6,7 @@ import { environment } from 'src/environments/environment';
|
||||
})
|
||||
export class SessionDataProviderService {
|
||||
|
||||
constructor() {
|
||||
constructor( ) {
|
||||
console.log('Hello SessionDataProvider Store');
|
||||
}
|
||||
/*
|
||||
@@ -52,6 +52,7 @@ export class SessionDataProviderService {
|
||||
"zip_code": "30127",
|
||||
"internal_return": 100
|
||||
*/
|
||||
refresh:number=30000;
|
||||
account_country:string="NG";
|
||||
account_type:string="";
|
||||
email: string = "";
|
||||
@@ -112,7 +113,7 @@ export class SessionDataProviderService {
|
||||
this.active_job_count = loginResult.active_job_count;
|
||||
this.tracking = loginResult.tracking;
|
||||
this.session_image_server = loginResult.session_image_server;
|
||||
|
||||
this.refresh = loginResult.refresh;
|
||||
//this.pushNotificationProvider.tagUser(this.session);
|
||||
|
||||
this.session_contructed = true;
|
||||
@@ -163,6 +164,8 @@ export class SessionDataProviderService {
|
||||
|
||||
this.storage.set('sessionuser', JSON.stringify(this.SessionUser));
|
||||
*/
|
||||
|
||||
|
||||
} catch (error) {
|
||||
console.log("LOGIN STORAGE ERROR->" + error);
|
||||
}
|
||||
@@ -176,7 +179,7 @@ export class SessionDataProviderService {
|
||||
console.log('Hello DestroySessionOnLogout Provider');
|
||||
this.firstname = "";
|
||||
this.lastname = "";
|
||||
this.session = "INVALID";
|
||||
this.session = "";
|
||||
this.session_contructed= false;
|
||||
this.username="";
|
||||
this.last_login = "";
|
||||
|
||||
@@ -13,7 +13,9 @@ export class UserWalletService {
|
||||
constructor(public wrenchService: WrenchService,
|
||||
public sessionDataProviderService: SessionDataProviderService
|
||||
) {
|
||||
this.getWalletData();
|
||||
if ( this.sessionDataProviderService.session!=""){
|
||||
this.getWalletData();
|
||||
}
|
||||
}
|
||||
walletDescription:string="";
|
||||
walletPresentation(){
|
||||
@@ -33,7 +35,7 @@ export class UserWalletService {
|
||||
usrData: {
|
||||
action:number, member_id: number, uid: string, sessionid: string, limit:20, page:1
|
||||
};
|
||||
getWalletData(){
|
||||
async getWalletData(){
|
||||
this.walletData = []; // clean the data
|
||||
this.usrData = {
|
||||
action:11200,
|
||||
|
||||
Reference in New Issue
Block a user