Merge pull request #206 from status-im/nim-waku-v0.4

This commit is contained in:
Franck Royer 2021-06-11 15:23:21 +10:00 committed by GitHub
commit c7991b3da2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 25 additions and 6 deletions

View File

@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased] ## [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 ## [0.6.0] - 2021-06-09
### Changed ### Changed

View File

@ -12,9 +12,17 @@ export class Message {
static fromWakuMessage(wakuMsg: WakuMessage): Message | undefined { static fromWakuMessage(wakuMsg: WakuMessage): Message | undefined {
if (wakuMsg.payload) { if (wakuMsg.payload) {
const chatMsg = ChatMessage.decode(wakuMsg.payload); try {
if (chatMsg) { const chatMsg = ChatMessage.decode(wakuMsg.payload);
return new Message(chatMsg, wakuMsg.timestamp); if (chatMsg) {
return new Message(chatMsg, wakuMsg.timestamp);
}
} catch (e) {
console.error(
'Failed to decode chat message',
wakuMsg.payloadAsUtf8,
e
);
} }
} }
return; return;

View File

@ -29,7 +29,12 @@ export default function MessageInput(props: Props) {
}; };
const keyPressHandler = async (event: KeyboardEvent<HTMLInputElement>) => { const keyPressHandler = async (event: KeyboardEvent<HTMLInputElement>) => {
if (event.key === 'Enter') { if (
event.key === 'Enter' &&
!event.altKey &&
!event.ctrlKey &&
!event.shiftKey
) {
await sendMessage(); await sendMessage();
} }
}; };

@ -1 +1 @@
Subproject commit 44cafcfee339bed7ff7d014e9cb3111d0c46c733 Subproject commit 5c58a19f4f50e207dcfbf34f4514cc7e88c709e5

View File

@ -10,7 +10,7 @@ import { DefaultPubsubTopic } from '../waku_relay';
import { PushRPC } from './push_rpc'; 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 { PushResponse };
export interface CreateOptions { export interface CreateOptions {