remove logs
This commit is contained in:
parent
6cad59cab1
commit
e4dd2a15c1
|
@ -149,13 +149,9 @@ class Community {
|
||||||
|
|
||||||
// Channel messages
|
// Channel messages
|
||||||
await this.observeChannelMessages(Object.keys(this.communityMetadata.chats))
|
await this.observeChannelMessages(Object.keys(this.communityMetadata.chats))
|
||||||
|
|
||||||
console.log('CLINET: STARTED')
|
|
||||||
console.log('COMMUNITY:', this)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private async observeCommunity() {
|
private async observeCommunity() {
|
||||||
// console.log('here')
|
|
||||||
this.waku.relay.addDecryptionKey(this.communityDecryptionKey)
|
this.waku.relay.addDecryptionKey(this.communityDecryptionKey)
|
||||||
this.waku.relay.addObserver(
|
this.waku.relay.addObserver(
|
||||||
message => {
|
message => {
|
||||||
|
@ -223,7 +219,6 @@ class Community {
|
||||||
// todo?: check if waku propagates errors
|
// todo?: check if waku propagates errors
|
||||||
// todo!: request Waku feature to accept decryption keys as a param
|
// todo!: request Waku feature to accept decryption keys as a param
|
||||||
this.waku.relay.addObserver(this.handleMessage, contentTopics)
|
this.waku.relay.addObserver(this.handleMessage, contentTopics)
|
||||||
console.log('Added observer', contentTopics)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private unobserveChannelMessages(chatIds: string[]) {
|
private unobserveChannelMessages(chatIds: string[]) {
|
||||||
|
@ -238,7 +233,6 @@ class Community {
|
||||||
}
|
}
|
||||||
|
|
||||||
private handleMessage = (wakuMessage: WakuMessage) => {
|
private handleMessage = (wakuMessage: WakuMessage) => {
|
||||||
console.log('MESSAGE: HANDLE')
|
|
||||||
if (!wakuMessage.payload) {
|
if (!wakuMessage.payload) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -263,8 +257,6 @@ class Community {
|
||||||
console.error(err)
|
console.error(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log('MESSAGE: DECODED METADATA')
|
|
||||||
|
|
||||||
let shouldUpdate = false
|
let shouldUpdate = false
|
||||||
let _decodedPayload:
|
let _decodedPayload:
|
||||||
| ChatMessage
|
| ChatMessage
|
||||||
|
@ -275,8 +267,6 @@ class Community {
|
||||||
| undefined
|
| undefined
|
||||||
switch (decodedMetadata.type) {
|
switch (decodedMetadata.type) {
|
||||||
case ApplicationMetadataMessage.Type.TYPE_CHAT_MESSAGE: {
|
case ApplicationMetadataMessage.Type.TYPE_CHAT_MESSAGE: {
|
||||||
console.log('MESSAGE:')
|
|
||||||
|
|
||||||
if (!wakuMessage.signaturePublicKey) {
|
if (!wakuMessage.signaturePublicKey) {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
@ -287,8 +277,6 @@ class Community {
|
||||||
)
|
)
|
||||||
const decodedPayload = ChatMessage.decode(decodedMetadata.payload)
|
const decodedPayload = ChatMessage.decode(decodedMetadata.payload)
|
||||||
|
|
||||||
console.log('MESSAGE: DECODED')
|
|
||||||
|
|
||||||
// todo: explain
|
// todo: explain
|
||||||
// if (!decodedMetadata.identity) {
|
// if (!decodedMetadata.identity) {
|
||||||
// break
|
// break
|
||||||
|
@ -301,16 +289,10 @@ class Community {
|
||||||
|
|
||||||
const channelId = decodedPayload.chatId.slice(68)
|
const channelId = decodedPayload.chatId.slice(68)
|
||||||
|
|
||||||
console.log('THIS:', this)
|
|
||||||
|
|
||||||
if (!this.channelMessages[channelId]) {
|
if (!this.channelMessages[channelId]) {
|
||||||
this.channelMessages[channelId] = []
|
this.channelMessages[channelId] = []
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log('THIS:', this)
|
|
||||||
console.log('CHANNEL:', channelId)
|
|
||||||
console.log('MESSAGES:', this.channelMessages)
|
|
||||||
|
|
||||||
const channelMessage: MessageType = {
|
const channelMessage: MessageType = {
|
||||||
...decodedPayload,
|
...decodedPayload,
|
||||||
// ...decodedIdentity,
|
// ...decodedIdentity,
|
||||||
|
@ -343,15 +325,12 @@ class Community {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
console.log('MESSAGE: PREMAPPED')
|
|
||||||
|
|
||||||
this.channelMessages[channelId].push(channelMessage)
|
this.channelMessages[channelId].push(channelMessage)
|
||||||
|
|
||||||
shouldUpdate = true
|
shouldUpdate = true
|
||||||
_decodedPayload = decodedPayload
|
_decodedPayload = decodedPayload
|
||||||
|
|
||||||
console.log('MESSAGE: MAPPED')
|
|
||||||
|
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
case ApplicationMetadataMessage.Type.TYPE_EDIT_MESSAGE: {
|
case ApplicationMetadataMessage.Type.TYPE_EDIT_MESSAGE: {
|
||||||
|
@ -488,8 +467,6 @@ class Community {
|
||||||
this.channelMessagesCallbacks[channelId]?.(
|
this.channelMessagesCallbacks[channelId]?.(
|
||||||
this.channelMessages[channelId]
|
this.channelMessages[channelId]
|
||||||
)
|
)
|
||||||
|
|
||||||
console.log('MESSAGE: NEW', messages, channelId)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue