From f0dbf27eff8c7453cc2015e04b890039369a32d1 Mon Sep 17 00:00:00 2001 From: VinayagaSundar Date: Fri, 25 May 2018 14:25:34 +0530 Subject: [PATCH] Issue #SB-3723 fix : Show the toast when no internet in QR code search --- src/pages/resources/resources.ts | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/pages/resources/resources.ts b/src/pages/resources/resources.ts index 582722e8a..6ad1604a7 100644 --- a/src/pages/resources/resources.ts +++ b/src/pages/resources/resources.ts @@ -30,6 +30,7 @@ import { CourseDetailPage } from '../course-detail/course-detail'; import { CollectionDetailsPage } from '../collection-details/collection-details'; import { ContentDetailsPage } from '../content-details/content-details'; import { TranslateService } from '@ngx-translate/core'; +import { Network } from '@ionic-native/network'; @Component({ selector: 'page-resources', @@ -96,7 +97,8 @@ export class ResourcesPage implements OnInit { private toastCtrl: ToastController, private preference: SharedPreferences, private translate: TranslateService, - private zone: NgZone + private zone: NgZone, + private network: Network ) { this.contentService = contentService; this.authService = authService; @@ -366,12 +368,11 @@ export class ResourcesPage implements OnInit { that.showContentDetails(data.result); }, (error) => { console.log("Error " + error); - let toast = that.toastCtrl.create({ - message: "No content found associated with that QR code", - duration: 3000 - }) - - toast.present(); + if (that.network.type === 'none') { + that.getMessageByConst('ERROR_NO_INTERNET_MESSAGE'); + } else { + that.getMessageByConst('UNKNOWN_QR'); + } }); } }