remove promise bug

This commit is contained in:
Eudes Inácio
2022-12-20 17:06:19 +01:00
parent c8d62760ce
commit 111214d231
22 changed files with 128 additions and 42 deletions
+1 -1
View File
@@ -60,7 +60,7 @@ export class AlertService {
this.ChatSystemService.deleteMessage(msgId).then(() => {
room.deleteMessage(msgId)
})
}).catch((error) => console.error(error))
//this.ChatSystemService.subscribeToRoomUpdate(room._id, room);
//loader.remove();
}
+6 -4
View File
@@ -129,8 +129,8 @@ export class AuthService {
// alert('wsLogin')
}).catch((message) => {
// alert('ws login failed')
}).catch((error) => {
console.error(error)
})
@@ -150,7 +150,7 @@ export class AuthService {
return true
} catch(e) {
console.error('BeforesendAtachment', e)
return false
}
@@ -167,7 +167,7 @@ export class AuthService {
return true
} catch(e) {
console.error('BeforesendAtachment', e)
return false
}
}
@@ -231,6 +231,8 @@ export class AuthService {
getUserData() {
this.storageService.get(AuthConnstants.AUTH).then(res=>{
this.userData$.next(res);
}).catch((error) => {
console.error('storage getuserdata',error)
});
}
+3 -1
View File
@@ -326,7 +326,9 @@ export class ChatService {
//showMessage(response.statusText);
this.getRoomMessages(roomId)
// Reconnect in one second
await new Promise(resolve => setTimeout(resolve, 1000));
await new Promise(resolve => setTimeout(resolve, 1000)).catch ((error) => {
console.error(error);
});
await this.subscribe(roomId);
} else {
// Got message
+6 -1
View File
@@ -183,7 +183,12 @@ export class ChatSystemService {
async getAllRooms () {
this.loadingWholeList = true
const rooms = await this.RochetChatConnectorService.getRooms();
var rooms;
try {
rooms = await this.RochetChatConnectorService.getRooms();
} catch (error) {
console.error('chatgetrooms',error)
}
try {
await this.storage.remove('Rooms');
} catch(e) {}
+17 -5
View File
@@ -166,7 +166,11 @@ export class MessageService {
let uploadSuccessfully = false
if(this.hasSendAttachment == false) {
uploadSuccessfully = await this.NfService.beforeSendAttachment(this)
try {
uploadSuccessfully = await this.NfService.beforeSendAttachment(this)
} catch (error) {
console.error('beforeSendAttachment uploadSuccessfully',error)
}
this.UploadAttachmentsTemp++
}
@@ -186,13 +190,17 @@ export class MessageService {
this.RochetChatConnectorService.registerCallback({
type: 'reConnect',
funx: async ()=> {
this.send()
this.send().catch((error) =>{
console.error(error)
})
return true
}
})
} else if(uploadSuccessfully == false && this.UploadAttachmentsTemp == 1) {
this.send()
this.send().catch((error) =>{
console.error(error)
})
}
else if(uploadSuccessfully == false) {
@@ -225,7 +233,9 @@ export class MessageService {
this.messageSend = true
this.redefinedMessage(ChatMessage)
}
)
).catch((error) => {
console.error(error)
})
} else {
// console.log("reconnect")
@@ -233,7 +243,9 @@ export class MessageService {
type: 'reConnect',
funx: async ()=> {
this.send()
this.send().catch((error) =>{
console.error(error)
})
return true
}
})
+7 -5
View File
@@ -630,7 +630,7 @@ export class RoomService {
}
if(lastIsTyping != this.isTyping) {
this.RochetChatConnectorService.sendStreamNotifyRoom(this.id, SessionStore.user.UserName, 'typing', this.isTyping)
this.RochetChatConnectorService.sendStreamNotifyRoom(this.id, SessionStore.user.UserName, 'typing', this.isTyping).catch((error) => console.error(error));
}
@@ -639,7 +639,7 @@ export class RoomService {
}
sendFalseTypingReadMessage(method,param: object) {
this.RochetChatConnectorService.sendStreamNotifyRoom(this.id, SessionStore.user.UserName, 'typing', {method:method, params: param} as falseTypingMethod)
this.RochetChatConnectorService.sendStreamNotifyRoom(this.id, SessionStore.user.UserName, 'typing', {method:method, params: param} as falseTypingMethod).catch((error) => console.error(error))
this.setTypingOff()
}
@@ -651,7 +651,7 @@ export class RoomService {
if(this.isTyping == true) {
this.isTyping = false
this.RochetChatConnectorService.sendStreamNotifyRoom(this.id, SessionStore.user.UserName, 'typing', this.isTyping)
this.RochetChatConnectorService.sendStreamNotifyRoom(this.id, SessionStore.user.UserName, 'typing', this.isTyping).catch((error) => console.error(error))
}
}
@@ -675,7 +675,7 @@ export class RoomService {
leave(rid?) {
this.RochetChatConnectorService.leaveRoom(this.id)
this.RochetChatConnectorService.leaveRoom(this.id).catch((error) => console.error(error))
}
isJson(str) {
@@ -1003,7 +1003,9 @@ export class RoomService {
}
sendReadMessage() {
this.RochetChatConnectorService.readMessage(this.id)
this.RochetChatConnectorService.readMessage(this.id).catch((error) =>{
console.error(error)
})
this.sendFalseTypingReadMessage('viewMessage', {})
this.messageUnread = false
}
+7 -3
View File
@@ -48,8 +48,8 @@ export class NotificationsService {
this.storageService.get("Notifications").then((value) => {
}).catch(()=>{
}).catch((error)=>{
console.error('storage getnotification',error)
}).catch(() => {
this.storageService.store("Notifications", [])
@@ -122,8 +122,12 @@ export class NotificationsService {
}, (error) => {
//console.log(error)
})
});
}).catch((error) => {
console.error('storage authorization', error)
});;
}).catch((error) => {
console.error('storage getAndPostToken', error)
});
}
);