This commit is contained in:
Peter Maquiran
2022-01-29 17:07:18 +01:00
5 changed files with 21 additions and 18 deletions
+6 -3
View File
@@ -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()
} }
@@ -111,8 +112,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') {
this.userThatIsTyping = this.usernameToDisplayName(message.fields.args[0]) this.userThatIsTyping = this.usernameToDisplayName(message.fields.args[0])
@@ -193,7 +192,7 @@ export class RoomService {
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())
}) })
@@ -89,6 +89,8 @@ export class WsChatMethodsService {
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++
+1 -1
View File
@@ -8,7 +8,7 @@ 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;