diff --git a/package-lock.json b/package-lock.json index ac104e671..f924bc8cd 100644 --- a/package-lock.json +++ b/package-lock.json @@ -4602,6 +4602,21 @@ "resolved": "https://registry.npmjs.org/@ionic-native/local-notifications/-/local-notifications-4.20.0.tgz", "integrity": "sha512-Ht/0zau8/2+G/bH/okXXhhWB6YrkCNL2QxVJHQ2dophXFGxQPOZAN3CKWhuQSjfbr76fa2nvQXF6jsXLpIR/ng==" }, + "@ionic-native/network": { + "version": "5.35.0", + "resolved": "https://registry.npmjs.org/@ionic-native/network/-/network-5.35.0.tgz", + "integrity": "sha512-Iu6dC0xTB0DUfdY+AJDVdQCJlmmn779s0j5QlR7THA1UUWz37LeWQuUvBdipLt66VfxZ2TlayM4HKrbTE/VkCQ==", + "requires": { + "@types/cordova": "^0.0.34" + }, + "dependencies": { + "@types/cordova": { + "version": "0.0.34", + "resolved": "https://registry.npmjs.org/@types/cordova/-/cordova-0.0.34.tgz", + "integrity": "sha1-6nrd907Ow9dimCegw54smt3HPQQ=" + } + } + }, "@ionic-native/screen-orientation": { "version": "5.35.0", "resolved": "https://registry.npmjs.org/@ionic-native/screen-orientation/-/screen-orientation-5.35.0.tgz", @@ -12538,6 +12553,12 @@ "integrity": "sha512-OOSV4TCkZVNfwQzjfbsD0ycNcZyokKdBPJnEK/QrtrGtEA+Ah1R86FphXFNJtCWEQYybCCHvCVXgor4Pgf11xQ==", "dev": true }, + "cordova-plugin-network-information": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/cordova-plugin-network-information/-/cordova-plugin-network-information-3.0.0.tgz", + "integrity": "sha512-bBtP3PxIX8vshsfR0+F6co2e2cFLgjt18yKIdigzMwk6ANudWQ72RB3g2qMPyT6fBDWmUyE1Qd+bKQB/fZtQwQ==", + "dev": true + }, "cordova-plugin-okhttp": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/cordova-plugin-okhttp/-/cordova-plugin-okhttp-2.0.0.tgz", diff --git a/package.json b/package.json index 8d54ab693..156e8d886 100644 --- a/package.json +++ b/package.json @@ -49,6 +49,7 @@ "@ionic-native/in-app-browser": "^5.28.0", "@ionic-native/ionic-webview": "^5.35.0", "@ionic-native/local-notifications": "^4.20.0", + "@ionic-native/network": "^5.35.0", "@ionic-native/screen-orientation": "^5.35.0", "@ionic-native/splash-screen": "^5.31.1", "@ionic-native/sqlite": "^5.31.1", @@ -136,6 +137,7 @@ "cordova-plugin-mfp": "^8.0.2021031007", "cordova-plugin-mfp-jsonstore": "^8.0.2021062408", "cordova-plugin-mfp-push": "^8.0.2021062405", + "cordova-plugin-network-information": "^3.0.0", "cordova-plugin-screen-orientation": "^3.0.2", "cordova-plugin-splashscreen": "^5.0.2", "cordova-plugin-statusbar": "^2.4.2", @@ -175,7 +177,8 @@ "cordova-plugin-mfp-push": {}, "cordova-plugin-mfp-jsonstore": {}, "cordova-plugin-ionic-webview": {}, - "cordova-plugin-screen-orientation": {} + "cordova-plugin-screen-orientation": {}, + "cordova-plugin-network-information": {} }, "platforms": [ "browser", diff --git a/src/app/modals/profile/profile.page.ts b/src/app/modals/profile/profile.page.ts index 51a96b6c2..f122c2f4c 100644 --- a/src/app/modals/profile/profile.page.ts +++ b/src/app/modals/profile/profile.page.ts @@ -2,7 +2,7 @@ /// import { Component, OnInit, NgZone } from '@angular/core'; import { Router, NavigationExtras } from '@angular/router'; -import { AnimationController, ModalController } from '@ionic/angular'; +import { AnimationController, ModalController,Platform } from '@ionic/angular'; import { User } from 'src/app/models/user.model'; import { AuthService } from 'src/app/services/auth.service'; import { LocalstoreService } from 'src/app/store/localstore.service'; @@ -31,7 +31,8 @@ export class ProfilePage implements OnInit { private jsonstore: JsonStore, private storageservice: StorageService, private zone: NgZone, - private notificationservice: NotificationsService + private notificationservice: NotificationsService, + private platform: Platform, ) { this.loggeduser = authService.ValidatedUser; @@ -42,7 +43,11 @@ export class ProfilePage implements OnInit { } ngOnInit() { + if (this.platform.is('desktop') || this.platform.is('mobileweb')) { + console.log('Notifications not supported') + } else { this.getNotificationData(); + } } diff --git a/src/app/shared/header/header.page.ts b/src/app/shared/header/header.page.ts index ccc77e877..1ae605b4f 100644 --- a/src/app/shared/header/header.page.ts +++ b/src/app/shared/header/header.page.ts @@ -1,5 +1,5 @@ import { Component, OnInit } from '@angular/core'; -import { AnimationController, ModalController } from '@ionic/angular'; +import { AnimationController, ModalController,Platform } from '@ionic/angular'; import { SearchPage } from 'src/app/pages/search/search.page'; import { Router } from '@angular/router'; import { ProfileComponent } from '../headers/header-no-search/profile/profile.page'; @@ -31,6 +31,7 @@ export class HeaderPage implements OnInit { private animationController: AnimationController, private storageservice: StorageService, private notificatioservice: NotificationsService, + private platform: Platform, authService: AuthService ) { this.loggeduser = authService.ValidatedUser; @@ -42,7 +43,12 @@ export class HeaderPage implements OnInit { ngOnInit() { this.hideSearch(); - this.notificationLengthData(); + if (this.platform.is('desktop') || this.platform.is('mobileweb')) { + console.log('Notifications not supported') + } else { + this.notificationLengthData(); + } + }