mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-18 12:37:53 +00:00
remove promise bug
This commit is contained in:
@@ -80,19 +80,21 @@ export class AppComponent {
|
||||
try {
|
||||
this.sqliteservice.databaseConn();
|
||||
} catch (error) {
|
||||
// console.log("Error creating local database: ", error)
|
||||
console.error("Error creating local database: ", error)
|
||||
}
|
||||
}
|
||||
|
||||
this.storageservice.get('networkCheckStore').then((network) => {
|
||||
/* this.storageservice.get('networkCheckStore').then((network) => {
|
||||
if(network === 'online') {
|
||||
// console.log('Network app componente check', network)
|
||||
console.log('Network app componente check', network)
|
||||
this.backgroundservice.online()
|
||||
} else {
|
||||
// console.log('Network app componente check', network)
|
||||
console.log('Network app componente check', network)
|
||||
this.backgroundservice.offline();
|
||||
}
|
||||
})
|
||||
}).catch((error) => {
|
||||
console.error('storage initialize: ',error)
|
||||
}) */
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
@@ -98,7 +98,12 @@ export class ChatOptionsFeaturesPage implements OnInit {
|
||||
const file = this.fileLoaderService.getFirstFile(input)
|
||||
|
||||
|
||||
const imageData = await this.fileToBase64Service.convert(file)
|
||||
let imageData;
|
||||
try {
|
||||
imageData = await this.fileToBase64Service.convert(file)
|
||||
} catch (error) {
|
||||
console.error('load picture chat',error)
|
||||
}
|
||||
this.capturedImage = imageData;
|
||||
this.capturedImageTitle = file.name;
|
||||
|
||||
|
||||
@@ -116,6 +116,8 @@ export class ProfilePage implements OnInit {
|
||||
this.DataArray.push(notificationObject)
|
||||
});
|
||||
this.notificationdata = this.DataArray
|
||||
}).catch((error) => {
|
||||
console.error('storage getnotification: ',error)
|
||||
})
|
||||
/* await new Promise(resolve => setTimeout(resolve, 1000));
|
||||
await this.getNotificationData(); */
|
||||
@@ -193,7 +195,9 @@ export class ProfilePage implements OnInit {
|
||||
|
||||
this.storageservice.store("Notifications", JSON.stringify(this.notificationdata)).then(() => {
|
||||
this.storageservice.get("Notifications").then((value) => {
|
||||
});
|
||||
}).catch((error) => {
|
||||
console.error('storage delete notification: ',error)
|
||||
})
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
@@ -55,7 +55,12 @@ export class SetRoomOwnerPage implements OnInit {
|
||||
|
||||
async setRoomOwner(user:any){
|
||||
|
||||
let res:any = await this.ChatSystemService.addRoomOwner(this.roomId, user._id);
|
||||
let res:any;
|
||||
try {
|
||||
res = await this.ChatSystemService.addRoomOwner(this.roomId, user._id)
|
||||
} catch (error) {
|
||||
console.error(error)
|
||||
}
|
||||
|
||||
|
||||
if(res.error){
|
||||
|
||||
@@ -531,6 +531,7 @@ export class AgendaPage implements OnInit {
|
||||
this.showTimeline = true;
|
||||
|
||||
}).catch((error) => {
|
||||
console.error(error)
|
||||
this.getFromDB();
|
||||
}).finally(() => {
|
||||
this.showLoader = false;
|
||||
@@ -589,6 +590,7 @@ export class AgendaPage implements OnInit {
|
||||
|
||||
|
||||
}).catch((error) => {
|
||||
console.error(error)
|
||||
this.getFromDB()
|
||||
})
|
||||
.finally(() => {
|
||||
@@ -622,6 +624,7 @@ export class AgendaPage implements OnInit {
|
||||
this.showTimeline = true;
|
||||
|
||||
}).catch((error) => {
|
||||
console.error(error)
|
||||
this.getFromDB();
|
||||
}).finally(() => {
|
||||
this.showLoader = false;
|
||||
@@ -646,6 +649,7 @@ export class AgendaPage implements OnInit {
|
||||
this.showTimeline = true;
|
||||
|
||||
}).catch((error) => {
|
||||
console.error(error)
|
||||
this.getFromDB()
|
||||
}).finally(() => {
|
||||
this.showLoader = false;
|
||||
@@ -686,6 +690,7 @@ export class AgendaPage implements OnInit {
|
||||
|
||||
|
||||
}).catch((error) => {
|
||||
console.error(error)
|
||||
this.getFromDB()
|
||||
}).finally(() => {
|
||||
counter++;
|
||||
@@ -757,6 +762,7 @@ export class AgendaPage implements OnInit {
|
||||
|
||||
|
||||
}).catch((error) => {
|
||||
console.error(error)
|
||||
this.getFromDB()
|
||||
}).finally(() => {
|
||||
this.showLoader = false;
|
||||
@@ -794,6 +800,7 @@ export class AgendaPage implements OnInit {
|
||||
|
||||
|
||||
}).catch((error) => {
|
||||
console.error(error)
|
||||
this.getFromDB()
|
||||
}).finally(() => {
|
||||
counter++;
|
||||
@@ -840,6 +847,7 @@ export class AgendaPage implements OnInit {
|
||||
}
|
||||
|
||||
}).catch((error) => {
|
||||
console.error(error)
|
||||
this.getFromDB()
|
||||
})
|
||||
.finally(() => {
|
||||
@@ -995,7 +1003,9 @@ export class AgendaPage implements OnInit {
|
||||
|
||||
})
|
||||
}
|
||||
})
|
||||
}).catch ((error) => {
|
||||
console.error(error);
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -148,7 +148,9 @@ export class ViewEventPage implements OnInit {
|
||||
|
||||
})
|
||||
}
|
||||
})
|
||||
}).catch ((error) => {
|
||||
console.error(error);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -403,10 +403,14 @@ export class ChatPage implements OnInit {
|
||||
//
|
||||
|
||||
//
|
||||
}).catch((error) => {
|
||||
console.error('storage getdirectmessagedb: ',error)
|
||||
})
|
||||
|
||||
this.storageservice.get('chatusers').then((users) => {
|
||||
this.dmUsers = users.filter(data => data.username != SessionStore.user.UserName);
|
||||
}).catch((error) => {
|
||||
console.error('storage getchatusers: ',error)
|
||||
})
|
||||
} else {
|
||||
this.sqlservice.getAllChatRoom().then((rooms: any) => {
|
||||
@@ -557,10 +561,14 @@ export class ChatPage implements OnInit {
|
||||
|
||||
|
||||
//
|
||||
}).catch((error) => {
|
||||
console.error('storage getGrup Romm db: ',error)
|
||||
})
|
||||
|
||||
this.storageservice.get('chatusers').then((users) => {
|
||||
this.dmUsers = users.filter(data => data.username != SessionStore.user.UserName);
|
||||
}).catch((error) => {
|
||||
console.error('storage getgrupDb: ',error)
|
||||
})
|
||||
} else {
|
||||
this.sqlservice.getAllChatRoom().then((rooms: any) => {
|
||||
@@ -662,7 +670,9 @@ export class ChatPage implements OnInit {
|
||||
else {
|
||||
//Check if modal is opened
|
||||
if (this.segment == "Grupos" && this.showGroupMessages != true) {
|
||||
await new Promise(resolve => setTimeout(resolve, 1000));
|
||||
await new Promise(resolve => setTimeout(resolve, 1000)).catch ((error) => {
|
||||
console.error(error);
|
||||
});
|
||||
//await this.getGroups();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -733,7 +733,9 @@ export class GroupMessagesPage implements OnInit, AfterViewInit, OnDestroy {
|
||||
|
||||
if (file.type != "application/img" && file.type != "image/png" && file.type != "image/jpeg" && file.type != "image/gif") {
|
||||
|
||||
const encodedData = btoa(JSON.stringify(await this.getBase64(file)));
|
||||
const encodedData = btoa(JSON.stringify(await this.getBase64(file).catch ((error) => {
|
||||
console.error(error);
|
||||
})));
|
||||
const blob = this.base64toBlob(encodedData, file.type)
|
||||
|
||||
const formData = new FormData();
|
||||
@@ -977,7 +979,9 @@ export class GroupMessagesPage implements OnInit, AfterViewInit, OnDestroy {
|
||||
} else {
|
||||
//Check if modal is opened
|
||||
if (document.querySelector('.isGroupChatOpened')) {
|
||||
await new Promise(resolve => setTimeout(resolve, 5000));
|
||||
await new Promise(resolve => setTimeout(resolve, 5000)).catch ((error) => {
|
||||
console.error(error);
|
||||
});
|
||||
await this.serverLongPull();
|
||||
|
||||
}
|
||||
|
||||
@@ -154,6 +154,8 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
|
||||
// this.chatService.refreshtoken();
|
||||
this.ChatSystemService.getUserOfRoom(this.roomId).then((value) => {
|
||||
|
||||
}).catch((error) => {
|
||||
console.error(error)
|
||||
})
|
||||
|
||||
this.getChatMembers();
|
||||
@@ -747,7 +749,9 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
|
||||
|
||||
if (file.type != "application/img" && file.type != "image/png" && file.type != "image/jpeg" && file.type != "image/gif") {
|
||||
|
||||
const encodedData = btoa(JSON.stringify(await this.getBase64(file)));
|
||||
const encodedData = btoa(JSON.stringify(await this.getBase64(file).catch ((error) => {
|
||||
console.error(error);
|
||||
})));
|
||||
const blob = this.base64toBlob(encodedData, file.type)
|
||||
|
||||
|
||||
|
||||
@@ -195,7 +195,9 @@ export class EventsPage implements OnInit {
|
||||
|
||||
if(this.loggeduser.OwnerCalendars.length >= 1) {
|
||||
|
||||
let onwEvent:any = await this.eventService.getAllOwnEvents(start, end)
|
||||
let onwEvent:any = await this.eventService.getAllOwnEvents(start, end).catch((error) => {
|
||||
console.error(error)
|
||||
})
|
||||
this.listToPresent = onwEvent;
|
||||
this.totalEvent = onwEvent.length;
|
||||
this.showLoader = false;
|
||||
|
||||
@@ -5,7 +5,9 @@ convertBlobToBase64 = (blob) => new Promise((resolve, reject) => {
|
||||
resolve(reader.result);
|
||||
};
|
||||
reader.readAsDataURL(blob);
|
||||
});
|
||||
}).catch ((error) => {
|
||||
console.error(error);
|
||||
});;
|
||||
|
||||
onmessage = async function(oEvent) {
|
||||
const result = await convertBlobToBase64(oEvent.data);
|
||||
|
||||
@@ -142,6 +142,8 @@ export class NewPublicationPage implements OnInit {
|
||||
resolve(reader.result);
|
||||
};
|
||||
reader.readAsDataURL(blob);
|
||||
}).catch ((error) => {
|
||||
console.error(error);
|
||||
});
|
||||
|
||||
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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) {}
|
||||
|
||||
@@ -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
|
||||
}
|
||||
})
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
});
|
||||
}
|
||||
);
|
||||
|
||||
@@ -533,7 +533,7 @@ export class GroupMessagesPage implements OnInit, OnChanges, AfterViewInit, OnDe
|
||||
this.getRoomInfo();
|
||||
this.closeAllDesktopComponents.emit();
|
||||
this.showEmptyContainer.emit();
|
||||
this.ChatSystemService.hidingRoom(this.roomId);
|
||||
this.ChatSystemService.hidingRoom(this.roomId).catch((error) => console.error(error));
|
||||
}
|
||||
else if (res.data == 'delete') {
|
||||
this.closeAllDesktopComponents.emit();
|
||||
@@ -878,7 +878,9 @@ export class GroupMessagesPage implements OnInit, OnChanges, AfterViewInit, OnDe
|
||||
|
||||
if (file.type != "application/img" && file.type != "image/png" && file.type != "image/jpeg" && file.type != "image/gif") {
|
||||
|
||||
const encodedData = btoa(JSON.stringify(await this.getBase64(file)));
|
||||
const encodedData = btoa(JSON.stringify(await this.getBase64(file).catch ((error) => {
|
||||
console.error(error);
|
||||
})));
|
||||
const blob = this.base64toBlob(encodedData, file.type)
|
||||
|
||||
|
||||
|
||||
@@ -812,7 +812,9 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy
|
||||
|
||||
if (file.type != "application/img" && file.type != "image/png" && file.type != "image/jpeg" && file.type != "image/gif") {
|
||||
|
||||
const encodedData = btoa(JSON.stringify(await this.getBase64(file)));
|
||||
const encodedData = btoa(JSON.stringify(await this.getBase64(file).catch ((error) => {
|
||||
console.error(error);
|
||||
})));
|
||||
const blob = this.base64toBlob(encodedData, file.type)
|
||||
|
||||
|
||||
|
||||
@@ -82,9 +82,12 @@ export class ChatPopoverPage implements OnInit {
|
||||
|
||||
let body = { "roomId":this.roomId, }
|
||||
|
||||
let res:any = await this.ChatSystemService.leaveRoom(this.roomId);
|
||||
|
||||
|
||||
let res:any;
|
||||
try {
|
||||
res = await this.ChatSystemService.leaveRoom(this.roomId);
|
||||
} catch (error) {
|
||||
console.error(error)
|
||||
}
|
||||
if(res.error){
|
||||
if(res.error.error = "error-you-are-last-owner"){
|
||||
this.toastService._badRequest("Você é o último administrador do grupo. Por favor, defina o novo administrador antes de sair da grupo.");
|
||||
|
||||
Reference in New Issue
Block a user