Skip to content

Commit

Permalink
Merge pull request #2 from ethicnology/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
ethicnology committed Jan 1, 2023
2 parents d16874b + 343df5a commit a8a6679
Show file tree
Hide file tree
Showing 5 changed files with 64 additions and 13 deletions.
19 changes: 19 additions & 0 deletions gh-pages.sh
Original file line number Diff line number Diff line change
@@ -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://<USERNAME>.github.io/<REPO>
git push -f git@github.com:ethicnology/dispute.git main:gh-pages #main or master

cd -
22 changes: 9 additions & 13 deletions lib/screen/event.dart
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import 'dart:convert';
import 'dart:io';

import 'package:dispute/main.dart';
import 'package:dispute/model/profile.dart';
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});
Expand All @@ -22,12 +22,10 @@ class EventScreenState extends State<EventScreen> {
@override
Widget build(BuildContext context) {
final profil = context.watch<Profile>();
bool sent = false;
if (wsEvent.isNotEmpty) {
var json = jsonDecode(wsEvent);
if (json[0] == "OK" && json[2] == true) {
logger.w(json);
sent = true;
}
}

Expand Down Expand Up @@ -62,17 +60,16 @@ class EventScreenState extends State<EventScreen> {
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,
Expand All @@ -83,7 +80,6 @@ class EventScreenState extends State<EventScreen> {
child: const Text('Send'),
),
),
if (sent) const Text('Sent !')
],
),
),
Expand Down
8 changes: 8 additions & 0 deletions snap/gui/dispute.desktop
Original file line number Diff line number Diff line change
@@ -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;
Binary file added snap/gui/dispute.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
28 changes: 28 additions & 0 deletions snap/snapcraft.yaml
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit a8a6679

Please sign in to comment.