diff --git a/gh-pages.sh b/gh-pages.sh new file mode 100755 index 0000000..183a32f --- /dev/null +++ b/gh-pages.sh @@ -0,0 +1,19 @@ +#!/usr/bin/env sh + +# abort on errors +set -e + +# build +flutter build web --release --base-href '/dispute/' + +# navigate into the build output directory +cd build/web + +git init +git add -A +git commit -m 'deploy' + +# if you are deploying to https://.github.io/ +git push -f git@github.com:ethicnology/dispute.git main:gh-pages #main or master + +cd - \ No newline at end of file diff --git a/lib/screen/event.dart b/lib/screen/event.dart index 6379347..8f72e8f 100644 --- a/lib/screen/event.dart +++ b/lib/screen/event.dart @@ -1,5 +1,4 @@ import 'dart:convert'; -import 'dart:io'; import 'package:dispute/main.dart'; import 'package:dispute/model/profile.dart'; @@ -7,6 +6,7 @@ import 'package:dispute/utils.dart'; import 'package:flutter/material.dart'; import 'package:nostr/nostr.dart'; import 'package:provider/provider.dart'; +import 'package:web_socket_channel/web_socket_channel.dart'; class EventScreen extends StatefulWidget { const EventScreen({super.key}); @@ -22,12 +22,10 @@ class EventScreenState extends State { @override Widget build(BuildContext context) { final profil = context.watch(); - bool sent = false; if (wsEvent.isNotEmpty) { var json = jsonDecode(wsEvent); if (json[0] == "OK" && json[2] == true) { logger.w(json); - sent = true; } } @@ -62,17 +60,16 @@ class EventScreenState extends State { content: _controller.text, privkey: profil.keys.private, ); - WebSocket webSocket = await WebSocket.connect( - profil.relay, + final channel = WebSocketChannel.connect( + Uri.parse(profil.relay), ); - webSocket.add(event.serialize()); + channel.sink.add(event.serialize()); await Future.delayed(const Duration(seconds: 1)); - webSocket.listen((event) { - setState(() { - wsEvent = event; - }); - }); - await webSocket.close(); + channel.sink.close(); + displaySnackBar( + context, + "The event is sent, go back to the wall", + ); } else { displaySnackBar( context, @@ -83,7 +80,6 @@ class EventScreenState extends State { child: const Text('Send'), ), ), - if (sent) const Text('Sent !') ], ), ), diff --git a/snap/gui/dispute.desktop b/snap/gui/dispute.desktop new file mode 100644 index 0000000..640e220 --- /dev/null +++ b/snap/gui/dispute.desktop @@ -0,0 +1,8 @@ +[Desktop Entry] +Name=dispute +Comment=A cross-platform client for Nostr +Exec=dispute +Icon=${SNAP}/meta/gui/dispute.png +Terminal=false +Type=Application +Categories=Communication; \ No newline at end of file diff --git a/snap/gui/dispute.png b/snap/gui/dispute.png new file mode 100644 index 0000000..22d4873 Binary files /dev/null and b/snap/gui/dispute.png differ diff --git a/snap/snapcraft.yaml b/snap/snapcraft.yaml new file mode 100644 index 0000000..37e81e1 --- /dev/null +++ b/snap/snapcraft.yaml @@ -0,0 +1,28 @@ +name: dispute +version: 1.0.0 +summary: A cross-platform client for Nostr +description: A cross-platform client for Nostr + +confinement: strict +base: core18 +grade: stable + +slots: + dbus-dispute: + interface: dbus + bus: session + name: org.ethicnology.dispute + +apps: + dispute: + command: dispute + extensions: [flutter-master] + plugs: + - network + slots: + - dbus-dispute +parts: + dispute: + source: . + plugin: flutter + flutter-target: lib/main.dart \ No newline at end of file