mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-19 04:57:52 +00:00
Notification solved
This commit is contained in:
@@ -192,9 +192,14 @@ export class ProfilePage implements OnInit {
|
||||
|
||||
deleteNotification(index) {
|
||||
this.notificationdata = this.notificationdata.filter(item => item.index != index);
|
||||
console.log(this.notificationdata)
|
||||
console.log(this.notificationdata)
|
||||
|
||||
this.storageservice.store("Notifications", JSON.stringify(this.notificationdata)).then(() => {
|
||||
//this.storageservice.remove("Notifications")
|
||||
this.storageservice.store("Notifications", this.notificationdata).then((store) => {
|
||||
console.log(store)
|
||||
this.storageservice.get("Notifications").then((value) => {
|
||||
console.log(value)
|
||||
}).catch((error) => {
|
||||
console.error('storage delete notification: ',error)
|
||||
})
|
||||
|
||||
@@ -15,6 +15,7 @@ import { v4 as uuidv4 } from 'uuid';
|
||||
import { EventTrigger } from '../services/eventTrigger.service';
|
||||
import { SessionStore } from '../store/session.service';
|
||||
import { ActionPerformed, PushNotificationSchema, PushNotifications, Token, } from '@capacitor/push-notifications';
|
||||
/* import { Events } from 'ionic-angular' */
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
@@ -44,6 +45,7 @@ export class NotificationsService {
|
||||
private activeroute: ActivatedRoute,
|
||||
private eventtrigger: EventTrigger,
|
||||
private backgroundservice: BackgroundService,
|
||||
/* private eventTriger: Events, */
|
||||
/* private fcm: FCM */) {
|
||||
|
||||
this.storageService.get("Notifications").then((value) => {
|
||||
@@ -147,9 +149,19 @@ export class NotificationsService {
|
||||
PushNotifications.addListener('pushNotificationReceived',
|
||||
(notification: PushNotificationSchema) => {
|
||||
console.log(notification)
|
||||
this.DataArray.push(notification)
|
||||
//this.DataArray.push(notification)
|
||||
//console.log(this.DataArray)
|
||||
|
||||
this.storageService.get("Notifications").then((store) => {
|
||||
store.push(notification)
|
||||
this.storageService.store("Notifications", store)
|
||||
}).catch((error) => {
|
||||
if(!error) {
|
||||
this.storageService.store("Notifications", [notification])
|
||||
}
|
||||
})
|
||||
|
||||
this.storageService.store("Notifications", this.DataArray)
|
||||
/* this.eventTriger.publish('notificatioRecive') */
|
||||
this.eventtrigger.publishSomeData({
|
||||
notification: "recive"
|
||||
})
|
||||
@@ -172,7 +184,7 @@ export class NotificationsService {
|
||||
);
|
||||
}
|
||||
|
||||
tempClearArray() {
|
||||
tempClearArray(data) {
|
||||
this.DataArray = new Array;
|
||||
}
|
||||
|
||||
|
||||
@@ -11,6 +11,7 @@ import { ThemeService } from '../../services/theme.service';
|
||||
import { RouteService } from 'src/app/services/route.service';
|
||||
import { PermissionList } from 'src/app/models/permission/permissionList';
|
||||
import { PermissionService } from 'src/app/services/permission.service';
|
||||
/* import { Events } from 'ionic-angular' */
|
||||
|
||||
@Component({
|
||||
selector: 'app-header',
|
||||
@@ -45,6 +46,7 @@ export class HeaderPage implements OnInit {
|
||||
public ThemeService: ThemeService,
|
||||
public RouteService: RouteService,
|
||||
public p: PermissionService,
|
||||
/* private eventTriger: Events, */
|
||||
) {
|
||||
this.loggeduser = SessionStore.user;
|
||||
router.events.subscribe((val) => {
|
||||
@@ -53,7 +55,10 @@ export class HeaderPage implements OnInit {
|
||||
this.showProfileModal = false
|
||||
});
|
||||
|
||||
|
||||
/* this.eventTriger.subscribe('notificatioRecive', () => {
|
||||
this.notificationLengthData();
|
||||
console.log('Header update with notificatio')
|
||||
}); */
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user