Skip to content

Commit

Permalink
Merge pull request #206 from status-im/nim-waku-v0.4
Browse files Browse the repository at this point in the history
  • Loading branch information
D4nte authored Jun 11, 2021
2 parents 4eec393 + c293e26 commit c7991b3
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 6 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### Changed
- Test: Upgrade nim-waku node to v0.4.
- Waku Light Push upgraded to `2.0.0-beta1`.
- Examples (web chat): Catch error if chat message decoding fails.
- Examples (web chat): Do not send message if shift/alt/ctrl is pressed, enabling multiline messages.

## [0.6.0] - 2021-06-09

### Changed
Expand Down
14 changes: 11 additions & 3 deletions examples/web-chat/src/Message.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,17 @@ export class Message {

static fromWakuMessage(wakuMsg: WakuMessage): Message | undefined {
if (wakuMsg.payload) {
const chatMsg = ChatMessage.decode(wakuMsg.payload);
if (chatMsg) {
return new Message(chatMsg, wakuMsg.timestamp);
try {
const chatMsg = ChatMessage.decode(wakuMsg.payload);
if (chatMsg) {
return new Message(chatMsg, wakuMsg.timestamp);
}
} catch (e) {
console.error(
'Failed to decode chat message',
wakuMsg.payloadAsUtf8,
e
);
}
}
return;
Expand Down
7 changes: 6 additions & 1 deletion examples/web-chat/src/MessageInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,12 @@ export default function MessageInput(props: Props) {
};

const keyPressHandler = async (event: KeyboardEvent<HTMLInputElement>) => {
if (event.key === 'Enter') {
if (
event.key === 'Enter' &&
!event.altKey &&
!event.ctrlKey &&
!event.shiftKey
) {
await sendMessage();
}
};
Expand Down
2 changes: 1 addition & 1 deletion nim-waku
2 changes: 1 addition & 1 deletion src/lib/waku_light_push/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { DefaultPubsubTopic } from '../waku_relay';

import { PushRPC } from './push_rpc';

export const LightPushCodec = '/vac/waku/lightpush/2.0.0-alpha1';
export const LightPushCodec = '/vac/waku/lightpush/2.0.0-beta1';
export { PushResponse };

export interface CreateOptions {
Expand Down

0 comments on commit c7991b3

Please sign in to comment.