diff --git a/src/app/pages/invite/invite.page.html b/src/app/pages/invite/invite.page.html index 544737c..0aaa351 100644 --- a/src/app/pages/invite/invite.page.html +++ b/src/app/pages/invite/invite.page.html @@ -63,8 +63,27 @@ Invite from Contacts
-
- Refresh Contacts +
+ + + + + + + + + + + + + + +
+
+ Refresh Contacts
diff --git a/src/app/pages/invite/invite.page.ts b/src/app/pages/invite/invite.page.ts index 072514c..63d19e1 100644 --- a/src/app/pages/invite/invite.page.ts +++ b/src/app/pages/invite/invite.page.ts @@ -1,5 +1,5 @@ import {Component, OnInit, ViewChild} from '@angular/core'; -import {NavController} from "@ionic/angular"; +import {LoadingController, NavController} from "@ionic/angular"; import {Router} from "@angular/router"; import { WrenchService } from 'src/app/services/wrench.service'; import {SessionDataProviderService} from "../../store/session-data-provider.service"; @@ -25,7 +25,8 @@ export class InvitePage implements OnInit { public sessionDataProviderService: SessionDataProviderService, private wrenchService: WrenchService, private alertController: AlertController, - private contactsDataService:ContactsDataService + private contactsDataService:ContactsDataService, + private loadingCtrl: LoadingController, ) { } /* @@ -41,7 +42,11 @@ export class InvitePage implements OnInit { action:number, member_id: number, uid: string, sessionid: string, ref_firstname:string, ref_lastname:string,ref_email: string }; sendReferResult:any; - sendRefer(){ + async sendRefer(){ + const loading = await this.loadingCtrl.create({ + message: 'Sending ... ', + duration: 3500, + }); if (this.ref_firstname=="" || this.lastname=="" || !this.validateEmail(this.email) ){ this.showAlert('Refer Error', 'Email and names required'); @@ -57,8 +62,10 @@ export class InvitePage implements OnInit { ref_lastname:this.lastname, ref_email:this.email }; + loading.present(); this.wrenchService.sendRefer(this.referSendData).subscribe( sendReferResult => { + loading.dismiss(); this.sendReferResult = sendReferResult; if ( this.sendReferResult.internal_return == 0 ){ this.showAlert('Refer Sent', 'Message sent to '+ this.email); @@ -130,7 +137,11 @@ export class InvitePage implements OnInit { // alert.present(); // // alert(amessage); } - refreshContacts(){ + async refreshContacts(){ + const loading = await this.loadingCtrl.create({ + message: 'Please wait ... ', + duration: 3500, + }); this.contactsDataService.refeshContacts(); } } diff --git a/src/app/services/wrench.service.ts b/src/app/services/wrench.service.ts index 00eb61f..b17ef8b 100644 --- a/src/app/services/wrench.service.ts +++ b/src/app/services/wrench.service.ts @@ -171,6 +171,10 @@ export class WrenchService { getFamilyPeningList(usrData) { return this.getPostData("familywaitingtasks", usrData); } + + processUsersContacts(usrData) { + return this.getPostData("cachecontacts", usrData); + } getUserWallets(usrData) { return this.getPostData("getwallets", usrData); } diff --git a/src/app/store/contacts-data.service.ts b/src/app/store/contacts-data.service.ts index 8447c18..7ee9e06 100644 --- a/src/app/store/contacts-data.service.ts +++ b/src/app/store/contacts-data.service.ts @@ -4,13 +4,16 @@ import { Plugin} from "@capacitor/core"; //const { Contacts } = Plugins; import { isPlatform } from "@ionic/angular"; +import {SessionDataProviderService} from "./session-data-provider.service"; +import {WrenchService} from "../services/wrench.service"; @Injectable({ providedIn: 'root' }) export class ContactsDataService { - constructor() { } + constructor(public sessionDataProviderService:SessionDataProviderService, + private wrenchService: WrenchService) { } async refeshContacts(){ @@ -28,6 +31,40 @@ export class ContactsDataService { emails: true }}).then( result=>{ console.log(result); + this.cacheContactsForAccount(result); }); } + + usrData: { + action:number, + member_id: number, + uid: string, + sessionid: string, + raw_contacts : string + }; + pPesult:any; + async cacheContactsForAccount(contactResult){ + this.usrData = {action:22010, + member_id: this.sessionDataProviderService.member_id, + uid: this.sessionDataProviderService.member_uid, + sessionid: this.sessionDataProviderService.session , + raw_contacts: contactResult.toString()} + + this.wrenchService.processUsersContacts(this.usrData).subscribe( + pPesult => { + this.pPesult = pPesult; + console.log("pPesult RETURN->", this.pPesult); + } + ); + } + + suggestionTotal:number = 0; + familyPendingTotalData:any; + familyPendingData: []; + + + // async getFamilyPeningData(){ + // + // + // } }