From 919b6284ae30b59c749a78b2e372e24fba6289f6 Mon Sep 17 00:00:00 2001 From: "venbatechnologies@gmail.com" Date: Tue, 16 Jun 2020 12:00:52 +0530 Subject: [PATCH] Fairoj : send link via sms using external sms app and copy link with text and capture btn is disabled for tele pd --- config.xml | 3 ++ package-lock.json | 15 ++++++++ package.json | 8 ++++- plugins/android.json | 7 ++++ plugins/browser.json | 6 ++++ plugins/fetch.json | 18 ++++++++++ src/app/app.module.ts | 2 ++ .../ques-template/ques-template.html | 4 +-- .../components/ques-template/ques-template.ts | 12 ++++--- .../pages/sales-p-dlist/sales-p-dlist.ts | 2 ++ .../pages/section-list/section-list.html | 6 ++-- .../pages/section-list/section-list.ts | 35 +++++++++++-------- 12 files changed, 93 insertions(+), 25 deletions(-) diff --git a/config.xml b/config.xml index f8d6788..422d3de 100755 --- a/config.xml +++ b/config.xml @@ -99,6 +99,9 @@ + + + diff --git a/package-lock.json b/package-lock.json index c64162c..c0efdce 100755 --- a/package-lock.json +++ b/package-lock.json @@ -191,6 +191,11 @@ "resolved": "https://registry.npmjs.org/@ionic-native/network/-/network-4.10.1.tgz", "integrity": "sha512-hAyJDce6mcs+Mo7xiVyDvo+5+AiyQ39IPoSdmqEdrq6FChjgtVN13UlC9RbMS1Y95Iq3h5rrXHx9RmHd5jHF1Q==" }, + "@ionic-native/social-sharing": { + "version": "4.20.0", + "resolved": "https://registry.npmjs.org/@ionic-native/social-sharing/-/social-sharing-4.20.0.tgz", + "integrity": "sha512-mUCjozvaMp09UU2L9qTabw6JgVcvSxGVMJq069Oh66llgCiiGUbsKyqtbU7RIRMp74lJLZVZvxFlvfUP8hZ/Jw==" + }, "@ionic-native/splash-screen": { "version": "4.4.0", "resolved": "https://registry.npmjs.org/@ionic-native/splash-screen/-/splash-screen-4.4.0.tgz", @@ -2365,6 +2370,11 @@ "resolved": "https://registry.npmjs.org/cordova-plugin-whitelist/-/cordova-plugin-whitelist-1.3.3.tgz", "integrity": "sha1-tehezbv+Wu3tQKG/TuI3LmfZb7Q=" }, + "cordova-plugin-x-socialsharing": { + "version": "5.6.8", + "resolved": "https://registry.npmjs.org/cordova-plugin-x-socialsharing/-/cordova-plugin-x-socialsharing-5.6.8.tgz", + "integrity": "sha512-R31ZQq00YNzLBwUM4VTE/uKhh/T0GEMuz/MZOw/Pu5AYIAAQkd7EMqFVhMtKs7wfHl1koiRz8+6nLDb19r2tBQ==" + }, "cordova-sqlite-storage": { "version": "3.4.0", "resolved": "https://registry.npmjs.org/cordova-sqlite-storage/-/cordova-sqlite-storage-3.4.0.tgz", @@ -2803,6 +2813,11 @@ "event-emitter": "~0.3.5" } }, + "es6-promise-plugin": { + "version": "4.2.2", + "resolved": "https://registry.npmjs.org/es6-promise-plugin/-/es6-promise-plugin-4.2.2.tgz", + "integrity": "sha512-uoA4aVplXI9oqUYJFBAVRwAqIN9/n9JgrTAUGX3qPbnSZVE5yY1+6/MsoN5f4xsaPO62WjPHOdtts6okMN6tNA==" + }, "es6-set": { "version": "0.1.5", "resolved": "https://registry.npmjs.org/es6-set/-/es6-set-0.1.5.tgz", diff --git a/package.json b/package.json index a81571d..24298f7 100755 --- a/package.json +++ b/package.json @@ -33,6 +33,7 @@ "@ionic-native/launch-navigator": "^4.16.0", "@ionic-native/location-accuracy": "^4.20.0", "@ionic-native/network": "4.10.1", + "@ionic-native/social-sharing": "^4.20.0", "@ionic-native/splash-screen": "4.4.0", "@ionic-native/status-bar": "^4.16.0", "@ionic/storage": "^2.2.0", @@ -56,7 +57,9 @@ "cordova-plugin-splashscreen": "5.0.2", "cordova-plugin-statusbar": "2.4.2", "cordova-plugin-whitelist": "1.3.3", + "cordova-plugin-x-socialsharing": "^5.6.8", "cordova-sqlite-storage": "3.4.0", + "es6-promise-plugin": "^4.2.2", "hammerjs": "^2.0.8", "ionic-angular": "3.9.2", "ionic-img-viewer": "^2.9.0", @@ -101,7 +104,10 @@ "PLAY_SERVICES_LOCATION_VERSION": "16.+" }, "cordova-plugin-android-permissions": {}, - "cordova-plugin-network-information": {} + "cordova-plugin-network-information": {}, + "cordova-plugin-x-socialsharing": { + "ANDROID_SUPPORT_V4_VERSION": "24.1.1+" + } }, "platforms": [ "browser", diff --git a/plugins/android.json b/plugins/android.json index 2a149fc..8565d83 100755 --- a/plugins/android.json +++ b/plugins/android.json @@ -54,6 +54,10 @@ }, "cordova-plugin-network-information": { "PACKAGE_NAME": "com.sineedge.pdglender" + }, + "cordova-plugin-x-socialsharing": { + "ANDROID_SUPPORT_V4_VERSION": "24.1.1+", + "PACKAGE_NAME": "com.sineedge.pdglender" } }, "dependent_plugins": { @@ -62,6 +66,9 @@ }, "cordova-plugin-dialogs": { "PACKAGE_NAME": "com.sineedge.pdglender" + }, + "es6-promise-plugin": { + "PACKAGE_NAME": "com.sineedge.pdglender" } } } \ No newline at end of file diff --git a/plugins/browser.json b/plugins/browser.json index 396ff78..cd406e7 100755 --- a/plugins/browser.json +++ b/plugins/browser.json @@ -51,6 +51,9 @@ }, "uk.co.workingedge.phonegap.plugin.launchnavigator": { "PACKAGE_NAME": "com.sineedge.pdglender" + }, + "cordova-plugin-x-socialsharing": { + "PACKAGE_NAME": "com.sineedge.pdglender" } }, "dependent_plugins": { @@ -62,6 +65,9 @@ }, "cordova-plugin-dialogs": { "PACKAGE_NAME": "com.sineedge.pdglender" + }, + "es6-promise-plugin": { + "PACKAGE_NAME": "com.sineedge.pdglender" } } } \ No newline at end of file diff --git a/plugins/fetch.json b/plugins/fetch.json index d27fbe8..cfeac59 100755 --- a/plugins/fetch.json +++ b/plugins/fetch.json @@ -146,5 +146,23 @@ }, "is_top_level": true, "variables": {} + }, + "cordova-plugin-x-socialsharing": { + "source": { + "type": "registry", + "id": "cordova-plugin-x-socialsharing" + }, + "is_top_level": true, + "variables": { + "ANDROID_SUPPORT_V4_VERSION": "24.1.1+" + } + }, + "es6-promise-plugin": { + "source": { + "type": "registry", + "id": "es6-promise-plugin@^4.1.0" + }, + "is_top_level": false, + "variables": {} } } \ No newline at end of file diff --git a/src/app/app.module.ts b/src/app/app.module.ts index 5882fc3..c2e2aa3 100755 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -90,6 +90,7 @@ import { NetworkDetectionProvider } from '../providers/network-detection/network import { OfflineManagerProvider } from '../pages/sales_pd/providers/offline-manager/offline-manager'; import { IonicStorageProvider } from '../providers/ionic-storage/ionic-storage'; import { Network } from '@ionic-native/network'; +import {SocialSharing} from '@ionic-native/social-sharing' // need the hammerConnfig export class HammerConfig extends HammerGestureConfig { overrides = { @@ -194,6 +195,7 @@ export class HammerConfig extends HammerGestureConfig { AwsServiceProvider, QuestionCategoryProvider, CameraProvider,Camera,LocationAccuracy, + SocialSharing, LoadingProvider,Geolocation,AppVersion, CameraProvider, { diff --git a/src/pages/sales_pd/components/ques-template/ques-template.html b/src/pages/sales_pd/components/ques-template/ques-template.html index ad54be3..059366b 100755 --- a/src/pages/sales_pd/components/ques-template/ques-template.html +++ b/src/pages/sales_pd/components/ques-template/ques-template.html @@ -75,7 +75,7 @@ - + @@ -341,7 +341,7 @@
- +
diff --git a/src/pages/sales_pd/components/ques-template/ques-template.ts b/src/pages/sales_pd/components/ques-template/ques-template.ts index fc052ab..479a831 100755 --- a/src/pages/sales_pd/components/ques-template/ques-template.ts +++ b/src/pages/sales_pd/components/ques-template/ques-template.ts @@ -122,8 +122,9 @@ this.sales_pd_type = localStorage.getItem('sales_pd_type') this.sendAutomaticallyToApi() // FOR DISPLAYING THE CUSTOMER CAPTURED IMAGE (STRUCTURED DYNAMICALLY CREATED IN FRONTEND) (***TELE PD ONLY***) - if(sales_pd_id && this.sales_pd_type && this.sales_pd_type == '2' && this.local_ques_JSON.section_id == '9' && this.networkDetection.getCurrentNetworkStatus() == ConnectionStatus.online) { - let params = {"sales_pd_id":sales_pd_id} + if(sales_pd_id && this.sales_pd_type && this.sales_pd_type == '2' && this.local_ques_JSON.section_id == '9' && !this. sales_pd_id.includes('local') &&this.networkDetection.getCurrentNetworkStatus() == ConnectionStatus.online) { + this.salesPDProvider.getData_fromLocal('sales_rand_string').then((sales_rand_string)=>{ + let params = {"rand_string":sales_rand_string} this.salesPDProvider.getSalesPDImgDataCusLink(params).subscribe(result=>{ if(result['dataStatus']){ this.updateCustomerImages(result['records']) @@ -132,8 +133,9 @@ this.sales_pd_type = localStorage.getItem('sales_pd_type') this.loadingProvider.dismissLoader() },err=>{ this.loadingProvider.dismissLoader() - }) - } + }) + }) +} else{ this.loadingProvider.dismissLoader() } @@ -1299,10 +1301,12 @@ this.proceedonChangeProperty(modified) if(apiresult['dataStatus']){ if(apiresult['records'] != true && typeof(apiresult['records']) != 'object'){ this.salesPDProvider.insertData_Replace('sales_pd_id_PRIMARYKEY',String(apiresult['records'])).then(local_result=>{ + this.salesPDProvider.insertData_Replace('sales_rand_string',String(apiresult['rand_string'])).then(()=>{ if(!this.submit_btn){ this.sendSectiontoApi(section_data) } }) + }) } else if(!this.submit_btn){ diff --git a/src/pages/sales_pd/pages/sales-p-dlist/sales-p-dlist.ts b/src/pages/sales_pd/pages/sales-p-dlist/sales-p-dlist.ts index 0a39612..fb86266 100755 --- a/src/pages/sales_pd/pages/sales-p-dlist/sales-p-dlist.ts +++ b/src/pages/sales_pd/pages/sales-p-dlist/sales-p-dlist.ts @@ -168,6 +168,7 @@ export class SalesPDlistPage { primary_key = 'local_pd_id' } this.salesPDService.insertData_Replace('sales_pd_id_PRIMARYKEY',value_obj[primary_key]).then(()=>{ + this.salesPDService.insertData_Replace('sales_rand_string',value_obj['rand_string']).then(()=>{ localStorage.setItem('product_id_salesPD',value_obj.product_id) if(!value_obj.hasOwnProperty('sales_pd_type')&& !value_obj.sales_pd_type) { value_obj.sales_pd_type = '1' @@ -176,6 +177,7 @@ export class SalesPDlistPage { localStorage.setItem('sales_pd_type',value_obj.sales_pd_type) this.navCtrl.push(SectionListPage,{product_id:value_obj.product_id,sales_pd_type:value_obj.sales_pd_type}) }) +}) } salesPDpdf(pdfdetail){ this.loaderProvider.pdloader("Processing..") diff --git a/src/pages/sales_pd/pages/section-list/section-list.html b/src/pages/sales_pd/pages/section-list/section-list.html index 4890694..2d7f4d6 100755 --- a/src/pages/sales_pd/pages/section-list/section-list.html +++ b/src/pages/sales_pd/pages/section-list/section-list.html @@ -56,12 +56,12 @@ pd_completed.pd_complete_request_items != null"> - - diff --git a/src/pages/sales_pd/pages/section-list/section-list.ts b/src/pages/sales_pd/pages/section-list/section-list.ts index 7946ce6..606c35d 100755 --- a/src/pages/sales_pd/pages/section-list/section-list.ts +++ b/src/pages/sales_pd/pages/section-list/section-list.ts @@ -5,7 +5,7 @@ import { Section9 } from '../home/home'; import { ToastProvider } from '../../../../providers/common-provider/toast'; import { OfflineManagerProvider } from '../../providers/offline-manager/offline-manager'; import { ConstantsProvider } from '../../../../providers/constants/constants'; - +import { SocialSharing } from '@ionic-native/social-sharing'; /** * Generated class for the SectionListPage page. * @@ -28,8 +28,10 @@ export class SectionListPage { pd_completed: any = {}; customer_link:string='' sales_pd_type: string; + customer_link_with_text: string; constructor(public navCtrl: NavController, public navParams: NavParams,private SalesPDService:SalesPdProvider,private toastProvider:ToastProvider, - private offlineManager:OfflineManagerProvider,private constantProvider:ConstantsProvider) { + private offlineManager:OfflineManagerProvider,private constantProvider:ConstantsProvider, + private socialSharing:SocialSharing) { if(this.navParams.get('product_id')){ this.product_id=this.navParams.get('product_id') @@ -51,8 +53,15 @@ export class SectionListPage { getSectionStats() { this.SalesPDService.getData_fromLocal('sales_pd_id_PRIMARYKEY').then((key_value)=>{ if(key_value && key_value != null && key_value != '' && key_value != undefined){ - this.customer_link = this.constantProvider.environment().app_origin+'/customer/#/salespd-images/'+key_value; this.sales_pd_id=key_value + if(!this.sales_pd_id.includes('local')) { + this.SalesPDService.getData_fromLocal('sales_rand_string').then((rand_string_sales)=>{ + if(rand_string_sales) { + this.customer_link = this.constantProvider.environment().app_origin+'/customer/#/salespd-images/'+rand_string_sales; + this.customer_link_with_text = 'Dear applicant, please click the link to upload the photographs. '+this.customer_link + } + }) + } let params={sales_pd_id:this.sales_pd_id,section_id:'all'} this.SalesPDService.getSalesPDSectionData(params).subscribe(res=>{ // console.log(this.section_template,res); @@ -204,18 +213,14 @@ export class SectionListPage { } this.toastProvider.lenderappmessage(user_msg) } - sendSmsViaLink(){ - this.toastProvider.lenderappmessage('Send link via SMS is disabled') - let param={ - // pd_id: this.pdMaster.pd_id, - // mobile_no: this.mainApplicant.mobile_no, - // random_string: this.pdMaster.random_string, + + shareViaSMS() { + this.socialSharing.shareViaSMS(this.customer_link_with_text,'').then(result=>{ + console.log(result) + },err=>{ + console.log(err); + alert("SMS Error "+JSON.stringify(err)); + }) } - // this.pdDetails.smsLink(param).subscribe(res=>{ - // if(res['dataStatus']){ - // this.toast.pdTriggerappmessage('SMS Sent Successfully','primary'); - // } - // }) - } }