mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-20 21:35:50 +00:00
merge
This commit is contained in:
@@ -48,6 +48,7 @@ export class RoomService {
|
|||||||
private platform: Platform,
|
private platform: Platform,
|
||||||
private sqlservice: SqliteService,
|
private sqlservice: SqliteService,
|
||||||
private NativeNotificationService: NativeNotificationService,
|
private NativeNotificationService: NativeNotificationService,
|
||||||
|
private sortService: SortService,
|
||||||
) {
|
) {
|
||||||
this.NativeNotificationService.askForPermission()
|
this.NativeNotificationService.askForPermission()
|
||||||
}
|
}
|
||||||
@@ -90,11 +91,11 @@ export class RoomService {
|
|||||||
|
|
||||||
if(SessionStore.user.RochetChatUser != ChatMessage.u.username) {
|
if(SessionStore.user.RochetChatUser != ChatMessage.u.username) {
|
||||||
this.NativeNotificationService.sendNotificationChat({
|
this.NativeNotificationService.sendNotificationChat({
|
||||||
message: message.msg,
|
message: message.msg,
|
||||||
title: this.name
|
title: this.name
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// save to ionic storage
|
// save to ionic storage
|
||||||
this.storage.get('chatmsg' + this.id).then((messages: any) => {
|
this.storage.get('chatmsg' + this.id).then((messages: any) => {
|
||||||
const newListMessages = messages.push(ChatMessage)
|
const newListMessages = messages.push(ChatMessage)
|
||||||
@@ -110,8 +111,6 @@ export class RoomService {
|
|||||||
|
|
||||||
|
|
||||||
this.WsChatService.receiveStreamNotifyRoom((message) => {
|
this.WsChatService.receiveStreamNotifyRoom((message) => {
|
||||||
|
|
||||||
console.log(message.fields)
|
|
||||||
|
|
||||||
if(message.fields.eventName == this.id+'/'+'typing') {
|
if(message.fields.eventName == this.id+'/'+'typing') {
|
||||||
|
|
||||||
@@ -167,7 +166,7 @@ export class RoomService {
|
|||||||
|
|
||||||
const lastIsTyping = this.isTyping
|
const lastIsTyping = this.isTyping
|
||||||
if(text.length >= 1) {
|
if(text.length >= 1) {
|
||||||
this.isTyping = true
|
this.isTyping = true
|
||||||
} else {
|
} else {
|
||||||
this.isTyping = false
|
this.isTyping = false
|
||||||
}
|
}
|
||||||
@@ -175,7 +174,7 @@ export class RoomService {
|
|||||||
if(lastIsTyping != this.isTyping) {
|
if(lastIsTyping != this.isTyping) {
|
||||||
this.WsChatService.sendStreamNotifyRoom(this.id, SessionStore.user.RochetChatUser, 'typing', this.isTyping)
|
this.WsChatService.sendStreamNotifyRoom(this.id, SessionStore.user.RochetChatUser, 'typing', this.isTyping)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
this.lastMessageTxt = this.message
|
this.lastMessageTxt = this.message
|
||||||
this.typingWatch()
|
this.typingWatch()
|
||||||
@@ -187,13 +186,13 @@ export class RoomService {
|
|||||||
const now = new Date().getTime()
|
const now = new Date().getTime()
|
||||||
|
|
||||||
if((now - this.lastTimeType) >= 2888) {
|
if((now - this.lastTimeType) >= 2888) {
|
||||||
|
|
||||||
if(this.isTyping == true) {
|
if(this.isTyping == true) {
|
||||||
this.isTyping = false
|
this.isTyping = false
|
||||||
this.WsChatService.sendStreamNotifyRoom(this.id, SessionStore.user.RochetChatUser, 'typing', this.isTyping)
|
this.WsChatService.sendStreamNotifyRoom(this.id, SessionStore.user.RochetChatUser, 'typing', this.isTyping)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
console.log(now - this.lastTimeType)
|
//console.log(now - this.lastTimeType)
|
||||||
}
|
}
|
||||||
|
|
||||||
}, 3000)
|
}, 3000)
|
||||||
@@ -298,6 +297,7 @@ export class RoomService {
|
|||||||
console.log('loadHistory', chatHistory)
|
console.log('loadHistory', chatHistory)
|
||||||
|
|
||||||
let localMessages = []
|
let localMessages = []
|
||||||
|
//const sortedRoomList = this.sortService.sortDate(chatHistory.result.messages, "_updatedAt.$date")
|
||||||
chatHistory.result.messages.reverse().forEach(message => {
|
chatHistory.result.messages.reverse().forEach(message => {
|
||||||
|
|
||||||
message = this.fix_updatedAt(message)
|
message = this.fix_updatedAt(message)
|
||||||
@@ -308,6 +308,9 @@ export class RoomService {
|
|||||||
|
|
||||||
this.messages = localMessages
|
this.messages = localMessages
|
||||||
|
|
||||||
|
console.log(chatHistory.result.messages);
|
||||||
|
|
||||||
|
|
||||||
this.storage.set('chatmsg' + this.id, chatHistory.result.messages.reverse())
|
this.storage.set('chatmsg' + this.id, chatHistory.result.messages.reverse())
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -63,8 +63,8 @@ export class WsChatMethodsService {
|
|||||||
}, 100)
|
}, 100)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(message.msg =='changed' && message.collection == "stream-notify-room") {
|
if(message.msg =='changed' && message.collection == "stream-notify-room") {
|
||||||
if(message.fields.eventName.includes('deleteMessage')){
|
if(message.fields.eventName.includes('deleteMessage')){
|
||||||
@@ -82,13 +82,15 @@ export class WsChatMethodsService {
|
|||||||
await rooms.result.update.forEach( async (roomData: room) => {
|
await rooms.result.update.forEach( async (roomData: room) => {
|
||||||
await this.prepareRoom(roomData);
|
await this.prepareRoom(roomData);
|
||||||
});
|
});
|
||||||
|
|
||||||
this._dm = this.sortService.sortDate(this._dm,'_updatedAt').reverse()
|
this._dm = this.sortService.sortDate(this._dm,'_updatedAt').reverse()
|
||||||
this._group = this.sortService.sortDate(this._group,'_updatedAt').reverse()
|
this._group = this.sortService.sortDate(this._group,'_updatedAt').reverse()
|
||||||
|
|
||||||
this.loadingWholeList = false
|
this.loadingWholeList = false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
subscribeToRoom() {
|
subscribeToRoom() {
|
||||||
|
|
||||||
for (const id in this.dm) {
|
for (const id in this.dm) {
|
||||||
@@ -141,7 +143,7 @@ export class WsChatMethodsService {
|
|||||||
prepareRoom(roomData) {
|
prepareRoom(roomData) {
|
||||||
let room:RoomService;
|
let room:RoomService;
|
||||||
|
|
||||||
room = new RoomService(this.WsChatService, new MessageService(this.storage), this.storage, this.platform, this.sqlservice, this.NativeNotificationService)
|
room = new RoomService(this.WsChatService, new MessageService(this.storage), this.storage, this.platform, this.sqlservice, this.NativeNotificationService, this.sortService)
|
||||||
|
|
||||||
room.setData({
|
room.setData({
|
||||||
customFields: roomData.customFields,
|
customFields: roomData.customFields,
|
||||||
@@ -158,8 +160,6 @@ export class WsChatMethodsService {
|
|||||||
let roomId = this.getRoomId(roomData)
|
let roomId = this.getRoomId(roomData)
|
||||||
|
|
||||||
if(this.isIndividual(roomData)) {
|
if(this.isIndividual(roomData)) {
|
||||||
console.log(room);
|
|
||||||
|
|
||||||
this.dm[roomId] = room
|
this.dm[roomId] = room
|
||||||
this._dm.push(room)
|
this._dm.push(room)
|
||||||
this.dmCount++
|
this.dmCount++
|
||||||
|
|||||||
@@ -349,7 +349,7 @@ export class WsChatService {
|
|||||||
}
|
}
|
||||||
}})
|
}})
|
||||||
}
|
}
|
||||||
|
|
||||||
loadHistory(roomId, limit: number = 50) {
|
loadHistory(roomId, limit: number = 50) {
|
||||||
|
|
||||||
const requestId = uuidv4()
|
const requestId = uuidv4()
|
||||||
|
|||||||
@@ -8,11 +8,11 @@ export class ObjectService {
|
|||||||
constructor() { }
|
constructor() { }
|
||||||
|
|
||||||
|
|
||||||
deepFind(obj, path) {
|
deepFind(obj, path):any {
|
||||||
var paths = path.split('.')
|
var paths = path.split('.')
|
||||||
, current = obj
|
, current = obj
|
||||||
, i;
|
, i;
|
||||||
|
|
||||||
for (i = 0; i < paths.length; ++i) {
|
for (i = 0; i < paths.length; ++i) {
|
||||||
if (current[paths[i]] == undefined) {
|
if (current[paths[i]] == undefined) {
|
||||||
return undefined;
|
return undefined;
|
||||||
|
|||||||
@@ -283,7 +283,7 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy
|
|||||||
changeInput() {
|
changeInput() {
|
||||||
this.wsChatMethodsService.getDmRoom(this.roomId).typing()
|
this.wsChatMethodsService.getDmRoom(this.roomId).typing()
|
||||||
}
|
}
|
||||||
|
|
||||||
async openViewDocumentModal(file: any) {
|
async openViewDocumentModal(file: any) {
|
||||||
let task = {
|
let task = {
|
||||||
serialNumber: '',
|
serialNumber: '',
|
||||||
|
|||||||
Reference in New Issue
Block a user