mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-18 20:47:54 +00:00
Code refactoring
This commit is contained in:
+1
-1
@@ -3,7 +3,7 @@
|
|||||||
<name>gabinete digital</name>
|
<name>gabinete digital</name>
|
||||||
<description>An awesome Ionic/Cordova app.</description>
|
<description>An awesome Ionic/Cordova app.</description>
|
||||||
<author email="hi@ionicframework.com" href="http://ionicframework.com/">Ionic Framework Team</author>
|
<author email="hi@ionicframework.com" href="http://ionicframework.com/">Ionic Framework Team</author>
|
||||||
<content src="index.html" />
|
<content original-src="index.html" src="http://localhost:8100" />
|
||||||
<access origin="*" />
|
<access origin="*" />
|
||||||
<allow-navigation href="http://*/*" />
|
<allow-navigation href="http://*/*" />
|
||||||
<allow-navigation href="https://*/*" />
|
<allow-navigation href="https://*/*" />
|
||||||
|
|||||||
@@ -69,9 +69,12 @@ export class ProfilePage implements OnInit {
|
|||||||
this.storageservice.get("Notifications").then((value) => {
|
this.storageservice.get("Notifications").then((value) => {
|
||||||
console.log("Init get store", value)
|
console.log("Init get store", value)
|
||||||
|
|
||||||
var data = JSON.parse(value);
|
/* var data = JSON.parse(value); */
|
||||||
console.log("Init store parse", data)
|
console.log("Init store parse", value)
|
||||||
data.forEach((element,i) => {
|
if(typeof(value) == 'string') {
|
||||||
|
value = JSON.stringify(value)
|
||||||
|
}
|
||||||
|
value.forEach((element,i) => {
|
||||||
console.log("ARaaAA", element)
|
console.log("ARaaAA", element)
|
||||||
let notificationObject;
|
let notificationObject;
|
||||||
if(element.payload){
|
if(element.payload){
|
||||||
@@ -121,17 +124,6 @@ export class ProfilePage implements OnInit {
|
|||||||
console.log('Timer badge count')
|
console.log('Timer badge count')
|
||||||
}
|
}
|
||||||
|
|
||||||
typeAgendaColor(service,typeagenda,role){
|
|
||||||
if (service == "agenda" && typeagenda == "oficial" && role == "100000011"){
|
|
||||||
document.body.style.setProperty(`--notificationtypeagenda`, "#ffb703");
|
|
||||||
} else if( service == "agenda" && typeagenda == "pessoal" && role == "100000011"){
|
|
||||||
document.body.style.setProperty(`--notificationtypeagenda`, "#ff0303");
|
|
||||||
} else if (service == "agenda" && typeagenda == "oficial" && role == "100000014"){
|
|
||||||
document.body.style.setProperty(`--notificationtypeagenda`, "#03d838");
|
|
||||||
} else if (service == "agenda" && typeagenda == "oficial" && role == "100000014"){
|
|
||||||
document.body.style.setProperty(`--notificationtypeagenda`, "#8b0ae0");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
getFormatedTime(dateString){
|
getFormatedTime(dateString){
|
||||||
var date = new Date(dateString);
|
var date = new Date(dateString);
|
||||||
|
|||||||
@@ -212,7 +212,7 @@ export class NotificationsService {
|
|||||||
//this.jsonstore.createCollection('Notifications',message);
|
//this.jsonstore.createCollection('Notifications',message);
|
||||||
this.DataArray.push(message)
|
this.DataArray.push(message)
|
||||||
console.log("On ReceiveNotification", this.DataArray)
|
console.log("On ReceiveNotification", this.DataArray)
|
||||||
this.storageService.store("Notifications",JSON.stringify(this.DataArray))
|
this.storageService.store("Notifications",this.DataArray)
|
||||||
|
|
||||||
console.log(message);
|
console.log(message);
|
||||||
var data = JSON.parse(message.payload);
|
var data = JSON.parse(message.payload);
|
||||||
@@ -229,7 +229,7 @@ export class NotificationsService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.callbacks.forEach( e=> {
|
this.callbacks.forEach( e=> {
|
||||||
if(e.type == data.Object) {
|
if(e.type == data.Object || e.type == "any") {
|
||||||
e.funx()
|
e.funx()
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import { LoginUserRespose } from 'src/app/models/user.model';
|
|||||||
import { ProfilePage } from 'src/app/modals/profile/profile.page';
|
import { ProfilePage } from 'src/app/modals/profile/profile.page';
|
||||||
import { StorageService } from '../../services/storage.service';
|
import { StorageService } from '../../services/storage.service';
|
||||||
import { SessionStore } from 'src/app/store/session.service';
|
import { SessionStore } from 'src/app/store/session.service';
|
||||||
|
import { NotificationsService } from '../../services/notifications.service';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-header',
|
selector: 'app-header',
|
||||||
@@ -29,6 +30,7 @@ export class HeaderPage implements OnInit {
|
|||||||
private animationController: AnimationController,
|
private animationController: AnimationController,
|
||||||
private storageservice: StorageService,
|
private storageservice: StorageService,
|
||||||
private platform: Platform,
|
private platform: Platform,
|
||||||
|
private notificationsService: NotificationsService,
|
||||||
) {
|
) {
|
||||||
this.loggeduser = SessionStore.user;
|
this.loggeduser = SessionStore.user;
|
||||||
router.events.subscribe((val) => {
|
router.events.subscribe((val) => {
|
||||||
@@ -42,23 +44,30 @@ export class HeaderPage implements OnInit {
|
|||||||
if (this.platform.is('desktop') || this.platform.is('mobileweb')) {
|
if (this.platform.is('desktop') || this.platform.is('mobileweb')) {
|
||||||
console.log('Notifications not supported')
|
console.log('Notifications not supported')
|
||||||
} else {
|
} else {
|
||||||
this.notificationLengthData();
|
this.UpdateNotificationCount();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async notificationLengthData() {
|
UpdateNotificationCount() {
|
||||||
|
this.notificationsService.registerCallback(
|
||||||
|
'any',
|
||||||
|
() => {
|
||||||
|
this.notificationLengthData();
|
||||||
|
}
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
notificationLengthData() {
|
||||||
this.storageservice.get("Notifications").then((value) => {
|
this.storageservice.get("Notifications").then((value) => {
|
||||||
console.log("Init get store", value)
|
console.log("Init get store", value)
|
||||||
|
|
||||||
var data = JSON.parse(value);
|
/* var data = JSON.parse(value); */
|
||||||
this.notificationLength = data.length;
|
this.notificationLength = value.length;
|
||||||
})
|
})
|
||||||
|
|
||||||
await new Promise(resolve => setTimeout(resolve, 10000))
|
|
||||||
await this.notificationLengthData()
|
|
||||||
console.log('Timer badge count')
|
console.log('Timer badge count')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user