Skip to content

Commit

Permalink
feat: default babbles (#500)
Browse files Browse the repository at this point in the history
  • Loading branch information
agazso authored Nov 29, 2023
1 parent c2f7534 commit 77cfe07
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
6 changes: 6 additions & 0 deletions src/lib/adapters/waku/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -483,6 +483,12 @@ export default class WakuAdapter implements Adapter {
})
this.subscriptions.push(subscribeInstalledObjectStore)

// subscribe to default Babbles
const defaultBabblesId = '0fbc5ad135290633aab3f37e5e0529fefa3c77cd9122b9a9e814bc8622e44d3f'
if (!get(chats).chats.has(defaultBabblesId)) {
await this.startBabbles(wallet, defaultBabblesId, 'Babbles')
}

// deferred updates
fetchBalances(address)
this.updateContactProfiles()
Expand Down
9 changes: 6 additions & 3 deletions src/routes/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,9 @@
</svelte:fragment>
<ul class="chats" aria-label="Chat List">
{#each orderedChats as chat}
{@const userMessages = chat.messages.filter((message) => message.type === 'user')}
{@const userMessages = chat.messages.filter(
(message) => message.type === 'user' || message.type === 'babble',
)}
{@const lastMessage =
userMessages.length > 0 ? userMessages[userMessages.length - 1] : undefined}
{@const myMessage = lastMessage && lastMessage.senderPublicKey === publicKey}
Expand Down Expand Up @@ -182,7 +184,7 @@
</span>
<Events />
{:else if isBabbles(chat)}
<span class="truncate"> Babbles </span>
<span class="truncate">{chat?.name}</span>
<Babbles />
{:else}
<span class="truncate">
Expand All @@ -204,7 +206,8 @@
<p class={`message text-serif ${myMessage ? 'my-message' : ''}`}>
{#if chat.joined}
{senderName}
{@html lastMessage && lastMessage.type === 'user'
{@html lastMessage &&
(lastMessage.type === 'user' || lastMessage.type === 'babble')
? replaceAddressesWithNames(lastMessage.text?.substring(0, 150), chat)
: 'No messages yet'}
{:else if isGroupChat(chat)}
Expand Down

1 comment on commit 77cfe07

@vercel
Copy link

@vercel vercel bot commented on 77cfe07 Nov 29, 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.