This commit is contained in:
Peter Maquiran
2021-08-25 11:51:02 +01:00
parent f469fa0588
commit 40667918ff
6 changed files with 41 additions and 10 deletions
+15 -3
View File
@@ -71,7 +71,7 @@ export class HomePage implements OnInit {
constructor(private zone: NgZone,
private router: Router,
public modalCtrl: AlertController,
private notificatinsservice: NotificationsService,
private notificationsService: NotificationsService,
private platform: Platform,
private activeroute: ActivatedRoute,
// private network: NetworkService,
@@ -99,6 +99,18 @@ export class HomePage implements OnInit {
//this.folderId = this.navParams.get('folderId');
}
this.notificationsService.registerCallback(
'Create Depacho',
() =>{
this.refreshing()
}
)
}
refreshing() {
}
ngOnInit() {
@@ -109,8 +121,8 @@ export class HomePage implements OnInit {
console.log('Notifications not supported')
} else {
this.mobilefirstConnect();
this.notificatinsservice.getAndpostToken2();
this.notificatinsservice.onReceviNotification();
this.notificationsService.getAndpostToken2();
this.notificationsService.onReceviNotification();
}
}
+1
View File
@@ -26,6 +26,7 @@ import { NavigationStart, NavigationEnd, Router } from '@angular/router';
import { EventPerson } from 'src/app/models/eventperson.model';
import { removeDuplicate } from 'src/plugin/removeDuplicate.js'
import { environment } from 'src/environments/environment';
import { NotificationsService } from 'src/app/services/notifications.service';
@Component({
selector: 'app-chat',
+19 -1
View File
@@ -23,6 +23,11 @@ export class NotificationsService {
folderId: string;
DataArray: Array<String> = [];
callbacks: {
type: string,
funx: Function
}[] = []
constructor(
private http: HttpClient,
private storageService: StorageService,
@@ -34,7 +39,20 @@ export class NotificationsService {
private toastService: ToastService,
private zone: NgZone,
private activeroute: ActivatedRoute,
private jsonstore: JsonStore) { }
private jsonstore: JsonStore) {
this.callbacks.forEach(e=> {
if(e.type = 'Create Depacho') {
e.funx()
}
})
}
registerCallback(type: string, funx: Function ) {
this.callbacks.push({type, funx})
}
getTokenByUserIdAndId(user, userID) {
const geturl = environment.apiURL + 'notifications/user/' + userID;
@@ -186,11 +186,11 @@
<mat-select placeholder="Selecione repetição*"
[(ngModel)]="postEvent.EventRecurrence.Type"
(ngModelChange)="onSelectedRecurringChanged($event)">
<!-- <mat-option
<mat-option
*ngFor="let recurring of recurringTypes" value="{{recurring.Code}}"
>
{{recurring.Description}}
</mat-option> -->
</mat-option>
</mat-select>
</mat-form-field>
@@ -67,7 +67,7 @@ export class NewEventPage implements OnInit {
public stepMinute = 5;
public stepSecond = 5;
public color: ThemePalette = 'primary';
recurringTypes: any;
recurringTypes = []
selectedRecurringType: any;
@Input() profile:string;
+3 -3
View File
@@ -1,6 +1,6 @@
import { Injectable } from '@angular/core';
import { localstoreService } from '../localstore.service'
import { SHA1 } from 'crypto-js'
import { localstoreService } from '../localstore.service';
import { SHA1 } from 'crypto-js';
@Injectable({
providedIn: 'root'
@@ -16,7 +16,7 @@ export class ChatUserService {
this.keyName = ('chat'+SHA1(this.constructor.name)).toString()
setTimeout(()=>{
setTimeout(()=> {
let restore = localstoreService.get(this.keyName, {})
this._userList = restore.userList || {}
}, 10)