This commit is contained in:
tiago.kayaya
2022-01-17 13:48:08 +01:00
parent 936351b7ec
commit cdecf4f5cc
2 changed files with 49 additions and 16 deletions
+1 -1
View File
@@ -50,7 +50,7 @@ export class RoomService {
ChatMessage = ChatMessage.fields.args[0]
ChatMessage = this.fix_updatedAt(ChatMessage)
this.ToastService.presentToast('nova mensagem')
/* this.ToastService._chatMessage({message:'Nova mensagem', sender:'Gilson'}) */
const message = new MessageService()
message.setData(ChatMessage)
this.lastMessage.msg = message.msg
+48 -15
View File
@@ -24,7 +24,7 @@ export class ToastService {
async _successMessage(message?: any, callback?) {
let notification = document.createElement('div')
notification.className = 'notification'
notification.innerHTML = `
@@ -34,7 +34,7 @@ export class ToastService {
<ion-icon slot="end" class="title-icon pr-10" src="/assets/images/nofitication-success.svg"></ion-icon>
<p class="text">{{ message }}</p>
</p>
</div>
`
@@ -52,7 +52,7 @@ export class ToastService {
},1000)
},6000)
}
async _badRequest(message?: string, callback?) {
@@ -66,7 +66,7 @@ export class ToastService {
<ion-icon slot="end" class="title-icon pr-10" src="/assets/images/notification-error.svg"></ion-icon>
<p class="text">{{ message }}</p>
</p>
</div>
`
@@ -89,8 +89,41 @@ export class ToastService {
}
async _chatMessage(message?: any, sender?:string) {
let notification = document.createElement('div')
notification.className = 'notification'
notification.innerHTML = `
<div class="main-content width-100 pa-20">
<p class="message d-flex align-bottom success">
<ion-icon slot="end" class="title-icon pr-10" src="/assets/images/nofitication-success.svg"></ion-icon>
<p class="text">{{ message.message }}</p>
</p>
<p class="text">{{ message.sender }} </p>
</div>
`
document.body.append(notification)
notification.querySelector('.text').innerHTML = message || 'Processo efetuado'
setTimeout(()=>{
/* if (callback) {
callback()
} */
notification.style.right = "-100%"
setTimeout(()=>{
notification.remove()
},1000)
},6000)
}
async successMessage(message?: any, callback?) {
let notification = document.createElement('div')
notification.className = 'notification'
notification.innerHTML = `
@@ -100,7 +133,7 @@ export class ToastService {
<ion-icon slot="end" class="title-icon pr-10" src="/assets/images/nofitication-success.svg"></ion-icon>
<p class="text">{{ message }}</p>
</p>
</div>
`
@@ -118,7 +151,7 @@ export class ToastService {
},1000)
},6000)
}
async badRequest(message?: string, callback?) {
@@ -132,7 +165,7 @@ export class ToastService {
<ion-icon slot="end" class="title-icon pr-10" src="/assets/images/notification-error.svg"></ion-icon>
<p class="text">{{ message }}</p>
</p>
</div>
`
@@ -155,9 +188,9 @@ export class ToastService {
}
async notificationMessage(message?: any, callback?: any,data?: any) {
let notification = document.createElement('div')
notification.className = 'notificationPush'
notification.innerHTML = `
@@ -166,7 +199,7 @@ export class ToastService {
<p class="message d-flex align-left">
<p class="text">{{ message }}</p>
</p>
</div>
`
@@ -189,7 +222,7 @@ export class ToastService {
},1000)
},6000)
}
@@ -216,7 +249,7 @@ export class ToastService {
</div>
</div>
`;
// console.log(document.querySelector('body').classList)
document.body.append(loader)
@@ -224,10 +257,10 @@ export class ToastService {
// loader.remove()
})
return loader
}
}
export const ToastsService = new ToastService(new ToastController())
export const ToastsService = new ToastService(new ToastController())