platform control

This commit is contained in:
CHIEFSOFT\ameye
2024-01-31 19:05:59 -05:00
parent 7cd080026f
commit 1ef85ca8d7
3 changed files with 18 additions and 11 deletions
+1 -1
View File
@@ -72,7 +72,7 @@
</ion-list>
</ion-card-content>
</ion-card>
</div>
</div>
+1 -3
View File
@@ -64,9 +64,7 @@ export class HomePage implements OnInit {
allInitFunctions(){
if ( this.sessionDataProviderService.member_uid != ''){
console.log("BLOG HOME 002->", this.blogDataService.blogData);
// this.firstname = this.sessionDataProviderService.firstname;
// this.onesignalService.Init(this.sessionDataProviderService.member_uid);
this.onesignalService.Init(this.sessionDataProviderService.member_uid);
this.locTrcService.startTracking();
if (this.accountType == 'FULL'){
this.getBlogData([]);
+16 -7
View File
@@ -1,5 +1,7 @@
import { HttpClient } from '@angular/common/http';
import { Injectable } from '@angular/core';
import { isPlatform } from '@ionic/angular';
import { Observable } from 'rxjs';
//import 'rxjs/add/operator/map';
import { environment } from 'src/environments/environment';
@@ -23,17 +25,25 @@ export class OnesignalService {
// Call this function when your app starts
Init(member_uid): void {
if ( isPlatform('ios') == true || isPlatform('android')==true){
console.log("Correct Notification platform");
}
else{
return;
}
// https://documentation.onesignal.com/docs/mobile-sdk
alert('OneSignalInit');
// alert('OneSignalInit');
// 0 = None, 1 = Fatal, 2 = Errors, 3 = Warnings, 4 = Info, 5 = Debug, 6 = Verbose
// Uncomment to set OneSignal device logging to VERBOSE
OneSignal.Debug.setLogLevel(6);
//OneSignal.Debug.setLogLevel(6);
OneSignal.Debug.setLogLevel(0);
// 0 = None, 1 = Fatal, 2 = Errors, 3 = Warnings, 4 = Info, 5 = Debug, 6 = Verbose
// Uncomment to set OneSignal visual logging to VERBOSE
//OneSignal.Debug.setAlertLevel(6);
OneSignal.Debug.setAlertLevel(4);
//OneSignal.Debug.setAlertLevel(4);
OneSignal.Debug.setAlertLevel(0);
// NOTE: Update the init value below with your OneSignal AppId.
OneSignal.init(this.AppId);
@@ -43,16 +53,15 @@ export class OnesignalService {
let myClickListener = async function(event) {
let notificationData = JSON.stringify(event);
alert("CLICKED: " + notificationData);
//alert("CLICKED: " + notificationData);
console.log('notificationOpenedCallback: ' + JSON.stringify(notificationData));
};
OneSignal.Notifications.addEventListener("click", myClickListener);
// Set a handler to run before displaying a notification while the app is in focus.
let myForegroundWillDisplayListener = async function(event) {
let notificationData = JSON.stringify(event);
alert("RECEIVED: " + notificationData);
// alert("RECEIVED: " + notificationData);
console.log('foregroundWillDisplayCallback : ' + JSON.stringify(notificationData));
/// Display Notification, preventDefault to not display