Skip to content

Commit

Permalink
fix: default babbles history (#502)
Browse files Browse the repository at this point in the history
  • Loading branch information
agazso authored Nov 30, 2023
1 parent e2facb4 commit 058b085
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions src/lib/adapters/waku/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -488,7 +488,18 @@ export default class WakuAdapter implements Adapter {
if (!get(chats).chats.has(defaultBabblesId)) {
const defaultBabblesName = 'Cypher City'
const defaultBabblesAvatar = 'QmeQQ1RSav1ysrNoM4hpyKTEXKQ3bAt1keHU6MCkJNKScx'
await this.startBabbles(wallet, defaultBabblesId, defaultBabblesName, defaultBabblesAvatar)
// retrieve history
const timeFilter = {
startTime: new Date(0),
endTime: new Date(),
}
await this.startBabbles(
wallet,
defaultBabblesId,
defaultBabblesName,
defaultBabblesAvatar,
timeFilter,
)
}

// deferred updates
Expand Down Expand Up @@ -536,13 +547,14 @@ export default class WakuAdapter implements Adapter {
chatId: string,
name: string,
avatar?: string,
timeFilter?: TimeFilter,
): Promise<string> {
const wakuObjectAdapter = makeWakuObjectAdapter(this, wallet)

createBabbles(chatId, name, avatar, true)

const ownPublicKey = wallet.signingKey.compressedPublicKey
await this.subscribeToBabbles(ownPublicKey, chatId, wakuObjectAdapter)
await this.subscribeToBabbles(ownPublicKey, chatId, wakuObjectAdapter, timeFilter)

return chatId
}
Expand Down

1 comment on commit 058b085

@vercel
Copy link

@vercel vercel bot commented on 058b085 Nov 30, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.