forked from Henry-Hiles/nexus
Compare commits
34 commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
322acbd694 |
|||
|
099725063f |
|||
|
0e6b9a8133 |
|||
|
79fe4ea440 |
|||
|
8946353228 |
|||
|
b79d96ee31 |
|||
|
ec5827dc30 |
|||
|
36c6d6958a |
|||
|
520fa0ccdb |
|||
|
c2214fcc44 |
|||
|
92eedc92ab |
|||
|
715bb15738 |
|||
|
b55c990b24 |
|||
|
7c76bb6e66 |
|||
|
a28bced44d |
|||
|
85d96b80bc |
|||
|
c084bc4caf |
|||
|
97f2673b55 |
|||
|
4862bf47c7 |
|||
|
095c72f983 |
|||
|
3fff32f170 |
|||
|
47a758a33b |
|||
|
cd0d10555b |
|||
|
e7599f3e94 |
|||
|
c0dfb6370e |
|||
|
20f69ca0aa |
|||
|
058f68cffb |
|||
|
8d43313512 |
|||
|
7de94531f7 |
|||
|
c332d7361c |
|||
|
5fe22867f8 |
|||
|
33239c02c0 |
|||
|
a012a2e762 |
|||
|
2996074838 |
9 changed files with 79 additions and 243 deletions
11
README.md
11
README.md
|
|
@ -15,7 +15,7 @@ A simple and user-friendly Matrix client made with Flutter and the Matrix Dart S
|
||||||
|
|
||||||
## Progress
|
## Progress
|
||||||
|
|
||||||
- [x] Move from the Dart SDK to the Gomuks SDK with Dart bindings: https://git.federated.nexus/Henry-Hiles/nexus/pulls/2
|
- [ ] Move from the Dart SDK to the Gomuks SDK with bindings: WIP
|
||||||
- [ ] Platform Support
|
- [ ] Platform Support
|
||||||
- [x] Linux
|
- [x] Linux
|
||||||
- [x] Windows
|
- [x] Windows
|
||||||
|
|
@ -33,17 +33,14 @@ A simple and user-friendly Matrix client made with Flutter and the Matrix Dart S
|
||||||
- [ ] Searching
|
- [ ] Searching
|
||||||
- [ ] Creating (Rooms, Spaces, and DMs)
|
- [ ] Creating (Rooms, Spaces, and DMs)
|
||||||
- [x] Joining
|
- [x] Joining
|
||||||
- [x] Using a text/uri/link
|
- [x] Using alias/id/link
|
||||||
- [x] Plain text
|
|
||||||
- [x] `matrix:` Uri
|
|
||||||
- [ ] Matrix.to link: I just need to fix my regex
|
|
||||||
- [ ] From space
|
- [ ] From space
|
||||||
- [ ] Exploring
|
- [ ] Exploring
|
||||||
- [x] Leaving
|
- [x] Leaving
|
||||||
- [x] Subspaces
|
- [x] Subspaces
|
||||||
- [x] Messages
|
- [x] Messages
|
||||||
- [x] Encryption
|
- [x] Encryption
|
||||||
- [x] Restoring crypto identity from passphrase/key or verification
|
- [ ] Restoring crypto identity from passphrase/key or verification
|
||||||
- [x] Sending
|
- [x] Sending
|
||||||
- [x] Plain text
|
- [x] Plain text
|
||||||
- [x] HTML/Markdown
|
- [x] HTML/Markdown
|
||||||
|
|
@ -150,4 +147,4 @@ flutter run
|
||||||
|
|
||||||
## Community
|
## Community
|
||||||
|
|
||||||
Join the [Nexus Client Matrix Room](https://matrix.to/#/#nexus:federated.nexus) for questions or help with developing or using Nexus Client.
|
Come chat in the [Federated Nexus Community](https://matrix.to/#/#space:federated.nexus) for questions or help with developing or using Nexus Client.
|
||||||
|
|
|
||||||
43
flake.nix
43
flake.nix
|
|
@ -29,22 +29,6 @@
|
||||||
...
|
...
|
||||||
}:
|
}:
|
||||||
|
|
||||||
let
|
|
||||||
src = ./.;
|
|
||||||
|
|
||||||
# from https://discourse.nixos.org/t/is-there-a-way-to-read-a-yaml-file-and-get-back-a-set/18385/5
|
|
||||||
importYAML =
|
|
||||||
file:
|
|
||||||
lib.importJSON (
|
|
||||||
pkgs.runCommand "converted-yaml.json" { } ''${pkgs.yj}/bin/yj < "${file}" > "$out"''
|
|
||||||
);
|
|
||||||
|
|
||||||
package = importYAML "${src}/pubspec.yaml";
|
|
||||||
|
|
||||||
usedFlutter = (pkgs.flutter.override { extraPkgConfigPackages = [ pkgs.libsecret ]; });
|
|
||||||
|
|
||||||
buildInputs = [ pkgs.sqlite ];
|
|
||||||
in
|
|
||||||
{
|
{
|
||||||
_module.args.pkgs = import nixpkgs {
|
_module.args.pkgs = import nixpkgs {
|
||||||
inherit system;
|
inherit system;
|
||||||
|
|
@ -61,35 +45,20 @@
|
||||||
olm
|
olm
|
||||||
git
|
git
|
||||||
clang
|
clang
|
||||||
usedFlutter
|
(flutter.override { extraPkgConfigPackages = [ pkgs.libsecret ]; })
|
||||||
|
|
||||||
(pkgs.writeShellScriptBin "rustup" (builtins.readFile ./nix/fake-rustup.sh))
|
(pkgs.writeShellScriptBin "rustup" (builtins.readFile ./nix/fake-rustup.sh))
|
||||||
];
|
];
|
||||||
|
|
||||||
env = {
|
env = {
|
||||||
LD_LIBRARY_PATH = "${lib.makeLibraryPath buildInputs}:./build/native_assets/linux";
|
LD_LIBRARY_PATH = "${
|
||||||
|
pkgs.lib.makeLibraryPath ([
|
||||||
|
pkgs.sqlite
|
||||||
|
])
|
||||||
|
}:./build/native_assets/linux";
|
||||||
CPATH = lib.makeSearchPath "include" [ pkgs.glibc.dev ];
|
CPATH = lib.makeSearchPath "include" [ pkgs.glibc.dev ];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
packages.default = usedFlutter.buildFlutterApplication {
|
|
||||||
inherit src buildInputs;
|
|
||||||
pname = package.name;
|
|
||||||
version = package.version;
|
|
||||||
|
|
||||||
pubspecLock = importYAML "${src}/pubspec.lock";
|
|
||||||
gitHashes = {
|
|
||||||
flutter_chat_ui = "sha256-4fuag7lRH5cMBFD3fUzj2K541JwXLoz8HF/4OMr3uhk=";
|
|
||||||
flutter_link_previewer = "sha256-4fuag7lRH5cMBFD3fUzj2K541JwXLoz8HF/4OMr3uhk=";
|
|
||||||
flyer_chat_text_message = "sha256-4fuag7lRH5cMBFD3fUzj2K541JwXLoz8HF/4OMr3uhk=";
|
|
||||||
window_size = "sha256-XelNtp7tpZ91QCEcvewVphNUtgQX7xrp5QP0oFo6DgM=";
|
|
||||||
};
|
|
||||||
|
|
||||||
patchPhase = /* sh */ ''
|
|
||||||
patchShebangs ./scripts/generate.sh
|
|
||||||
./scripts/generate.sh # note: this doesn't quit the build on fail
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,6 @@ import "package:nexus/models/paginate.dart";
|
||||||
import "package:nexus/models/requests/get_event_request.dart";
|
import "package:nexus/models/requests/get_event_request.dart";
|
||||||
import "package:nexus/models/requests/get_related_events_request.dart";
|
import "package:nexus/models/requests/get_related_events_request.dart";
|
||||||
import "package:nexus/models/requests/get_room_state_request.dart";
|
import "package:nexus/models/requests/get_room_state_request.dart";
|
||||||
import "package:nexus/models/requests/join_room_request.dart";
|
|
||||||
import "package:nexus/models/requests/login_request.dart";
|
import "package:nexus/models/requests/login_request.dart";
|
||||||
import "package:nexus/models/profile.dart";
|
import "package:nexus/models/profile.dart";
|
||||||
import "package:nexus/models/requests/paginate_request.dart";
|
import "package:nexus/models/requests/paginate_request.dart";
|
||||||
|
|
@ -139,11 +138,6 @@ class ClientController extends AsyncNotifier<int> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<String> joinRoom(JoinRoomRequest request) async {
|
|
||||||
final response = await _sendCommand("join_room", request.toJson());
|
|
||||||
return response["room_id"];
|
|
||||||
}
|
|
||||||
|
|
||||||
Future<void> leaveRoom(Room room) async {
|
Future<void> leaveRoom(Room room) async {
|
||||||
if (room.metadata == null) return;
|
if (room.metadata == null) return;
|
||||||
await _sendCommand("leave_room", {"room_id": room.metadata!.id});
|
await _sendCommand("leave_room", {"room_id": room.metadata!.id});
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,9 @@
|
||||||
import "package:collection/collection.dart";
|
import "package:collection/collection.dart";
|
||||||
import "package:fast_immutable_collections/fast_immutable_collections.dart";
|
|
||||||
import "package:flutter/material.dart";
|
import "package:flutter/material.dart";
|
||||||
import "package:hooks_riverpod/hooks_riverpod.dart";
|
import "package:hooks_riverpod/hooks_riverpod.dart";
|
||||||
import "package:nexus/controllers/client_controller.dart";
|
import "package:nexus/controllers/client_controller.dart";
|
||||||
import "package:nexus/controllers/key_controller.dart";
|
import "package:nexus/controllers/key_controller.dart";
|
||||||
import "package:nexus/controllers/spaces_controller.dart";
|
import "package:nexus/controllers/spaces_controller.dart";
|
||||||
import "package:nexus/helpers/extensions/link_to_mention.dart";
|
|
||||||
import "package:nexus/models/requests/join_room_request.dart";
|
|
||||||
|
|
||||||
extension JoinRoomWithSnackbars on ClientController {
|
extension JoinRoomWithSnackbars on ClientController {
|
||||||
Future<void> joinRoomWithSnackBars(
|
Future<void> joinRoomWithSnackBars(
|
||||||
|
|
@ -14,77 +11,77 @@ extension JoinRoomWithSnackbars on ClientController {
|
||||||
String roomAlias,
|
String roomAlias,
|
||||||
WidgetRef ref,
|
WidgetRef ref,
|
||||||
) async {
|
) async {
|
||||||
final roomIdOrAlias = roomAlias.mention ?? roomAlias;
|
// final parsed = roomAlias.parseIdentifierIntoParts();
|
||||||
|
// final alias = parsed?.primaryIdentifier ?? roomAlias;
|
||||||
|
|
||||||
final scaffoldMessenger = ScaffoldMessenger.of(context);
|
// final scaffoldMessenger = ScaffoldMessenger.of(context);
|
||||||
|
|
||||||
final snackbar = scaffoldMessenger.showSnackBar(
|
// final snackbar = scaffoldMessenger.showSnackBar(
|
||||||
SnackBar(
|
// SnackBar(
|
||||||
content: Text("Joining room $roomIdOrAlias."),
|
// content: Text("Joining room $alias."),
|
||||||
duration: Duration(days: 999),
|
// duration: Duration(days: 999),
|
||||||
),
|
// ),
|
||||||
);
|
// );
|
||||||
|
|
||||||
try {
|
// try {
|
||||||
final id = await joinRoom(
|
// final id = await joinRoom(alias, via: parsed?.via.toList());
|
||||||
JoinRoomRequest(
|
|
||||||
roomIdOrAlias: roomIdOrAlias,
|
|
||||||
via: IList(Uri.tryParse(roomAlias)?.queryParametersAll["via"] ?? []),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
|
|
||||||
snackbar.close();
|
// snackbar.close();
|
||||||
|
|
||||||
scaffoldMessenger.showSnackBar(
|
// scaffoldMessenger.showSnackBar(
|
||||||
SnackBar(
|
// SnackBar(
|
||||||
content: Text("Room $roomIdOrAlias successfully joined."),
|
// content: Text("Room $alias successfully joined."),
|
||||||
action: SnackBarAction(
|
// action: SnackBarAction(
|
||||||
label: "Open",
|
// label: "Open",
|
||||||
onPressed: () async {
|
// onPressed: () async {
|
||||||
final spaces = ref.watch(SpacesController.provider);
|
// final spaces = await ref.refresh(
|
||||||
final space = spaces.firstWhereOrNull((space) => space.id == id);
|
// SpacesController.provider.future,
|
||||||
|
// );
|
||||||
|
// final space = spaces.firstWhereOrNull((space) => space.id == id);
|
||||||
|
|
||||||
await ref
|
// await ref
|
||||||
.watch(
|
// .watch(
|
||||||
KeyController.provider(KeyController.spaceKey).notifier,
|
// KeyController.provider(KeyController.spaceKey).notifier,
|
||||||
)
|
// )
|
||||||
.set(
|
// .set(
|
||||||
space?.id ??
|
// space?.id ??
|
||||||
spaces
|
// spaces
|
||||||
.firstWhere(
|
// .firstWhere(
|
||||||
(space) => space.children.any(
|
// (space) =>
|
||||||
(child) => child.metadata?.id == id,
|
// space.children.firstWhereOrNull(
|
||||||
),
|
// (child) => child.roomData.id == id,
|
||||||
)
|
// ) !=
|
||||||
.id,
|
// null,
|
||||||
);
|
// )
|
||||||
|
// .id,
|
||||||
|
// );
|
||||||
|
|
||||||
if (space == null) {
|
// if (space == null) {
|
||||||
await ref
|
// await ref
|
||||||
.watch(
|
// .watch(
|
||||||
KeyController.provider(KeyController.roomKey).notifier,
|
// KeyController.provider(KeyController.roomKey).notifier,
|
||||||
)
|
// )
|
||||||
.set(id);
|
// .set(id);
|
||||||
}
|
// }
|
||||||
},
|
// },
|
||||||
),
|
// ),
|
||||||
),
|
// ),
|
||||||
);
|
// );
|
||||||
} catch (error) {
|
// } catch (error) {
|
||||||
snackbar.close();
|
// snackbar.close();
|
||||||
if (context.mounted) {
|
// if (context.mounted) {
|
||||||
scaffoldMessenger.showSnackBar(
|
// scaffoldMessenger.showSnackBar(
|
||||||
SnackBar(
|
// SnackBar(
|
||||||
backgroundColor: Theme.of(context).colorScheme.errorContainer,
|
// backgroundColor: Theme.of(context).colorScheme.errorContainer,
|
||||||
content: Text(
|
// content: Text(
|
||||||
error.toString(),
|
// error.toString(),
|
||||||
style: TextStyle(
|
// style: TextStyle(
|
||||||
color: Theme.of(context).colorScheme.onErrorContainer,
|
// color: Theme.of(context).colorScheme.onErrorContainer,
|
||||||
),
|
// ),
|
||||||
),
|
// ),
|
||||||
),
|
// ),
|
||||||
);
|
// );
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -29,11 +29,7 @@ extension LinkToMention on String {
|
||||||
if (uri.pathSegments.isNotEmpty) {
|
if (uri.pathSegments.isNotEmpty) {
|
||||||
final identifier = uri.pathSegments.last;
|
final identifier = uri.pathSegments.last;
|
||||||
if (identifier.isNotEmpty) {
|
if (identifier.isNotEmpty) {
|
||||||
return "${switch (uri.pathSegments.firstOrNull) {
|
return Uri.decodeComponent(identifier);
|
||||||
"r" || "roomid" => "#",
|
|
||||||
"u" => "@",
|
|
||||||
_ => "",
|
|
||||||
}}${Uri.decodeComponent(identifier)}";
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (_) {}
|
} catch (_) {}
|
||||||
|
|
|
||||||
|
|
@ -1,15 +0,0 @@
|
||||||
import "package:fast_immutable_collections/fast_immutable_collections.dart";
|
|
||||||
import "package:freezed_annotation/freezed_annotation.dart";
|
|
||||||
part "join_room_request.freezed.dart";
|
|
||||||
part "join_room_request.g.dart";
|
|
||||||
|
|
||||||
@freezed
|
|
||||||
abstract class JoinRoomRequest with _$JoinRoomRequest {
|
|
||||||
const factory JoinRoomRequest({
|
|
||||||
required String roomIdOrAlias,
|
|
||||||
required IList<String> via,
|
|
||||||
}) = _JoinRoomRequest;
|
|
||||||
|
|
||||||
factory JoinRoomRequest.fromJson(Map<String, Object?> json) =>
|
|
||||||
_$JoinRoomRequestFromJson(json);
|
|
||||||
}
|
|
||||||
|
|
@ -1,8 +1,11 @@
|
||||||
import "package:fast_immutable_collections/fast_immutable_collections.dart";
|
import "package:fast_immutable_collections/fast_immutable_collections.dart";
|
||||||
import "package:flutter/material.dart";
|
import "package:flutter/material.dart";
|
||||||
|
import "package:flutter/services.dart";
|
||||||
|
import "package:flutter_hooks/flutter_hooks.dart";
|
||||||
import "package:flutter_riverpod/flutter_riverpod.dart";
|
import "package:flutter_riverpod/flutter_riverpod.dart";
|
||||||
import "package:nexus/controllers/client_controller.dart";
|
import "package:nexus/controllers/client_controller.dart";
|
||||||
import "package:nexus/models/room.dart";
|
import "package:nexus/models/room.dart";
|
||||||
|
import "package:nexus/widgets/form_text_input.dart";
|
||||||
|
|
||||||
class RoomMenu extends ConsumerWidget {
|
class RoomMenu extends ConsumerWidget {
|
||||||
final Room room;
|
final Room room;
|
||||||
|
|
|
||||||
|
|
@ -1,105 +0,0 @@
|
||||||
/* Code generated by cmd/cgo; DO NOT EDIT. */
|
|
||||||
|
|
||||||
/* package go.mau.fi/gomuks/pkg/ffi */
|
|
||||||
|
|
||||||
|
|
||||||
#line 1 "cgo-builtin-export-prolog"
|
|
||||||
|
|
||||||
#include <stddef.h>
|
|
||||||
|
|
||||||
#ifndef GO_CGO_EXPORT_PROLOGUE_H
|
|
||||||
#define GO_CGO_EXPORT_PROLOGUE_H
|
|
||||||
|
|
||||||
#ifndef GO_CGO_GOSTRING_TYPEDEF
|
|
||||||
typedef struct { const char *p; ptrdiff_t n; } _GoString_;
|
|
||||||
extern size_t _GoStringLen(_GoString_ s);
|
|
||||||
extern const char *_GoStringPtr(_GoString_ s);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Start of preamble from import "C" comments. */
|
|
||||||
|
|
||||||
|
|
||||||
#line 9 "ffi.go"
|
|
||||||
|
|
||||||
#include "gomuksffi.h"
|
|
||||||
#include <stdlib.h>
|
|
||||||
|
|
||||||
static inline void _gomuks_callEventCallback(EventCallback cb, const char *command, int64_t request_id, GomuksOwnedBuffer data) {
|
|
||||||
cb(command, request_id, data);
|
|
||||||
}
|
|
||||||
|
|
||||||
#line 1 "cgo-generated-wrapper"
|
|
||||||
|
|
||||||
|
|
||||||
/* End of preamble from import "C" comments. */
|
|
||||||
|
|
||||||
|
|
||||||
/* Start of boilerplate cgo prologue. */
|
|
||||||
#line 1 "cgo-gcc-export-header-prolog"
|
|
||||||
|
|
||||||
#ifndef GO_CGO_PROLOGUE_H
|
|
||||||
#define GO_CGO_PROLOGUE_H
|
|
||||||
|
|
||||||
typedef signed char GoInt8;
|
|
||||||
typedef unsigned char GoUint8;
|
|
||||||
typedef short GoInt16;
|
|
||||||
typedef unsigned short GoUint16;
|
|
||||||
typedef int GoInt32;
|
|
||||||
typedef unsigned int GoUint32;
|
|
||||||
typedef long long GoInt64;
|
|
||||||
typedef unsigned long long GoUint64;
|
|
||||||
typedef GoInt64 GoInt;
|
|
||||||
typedef GoUint64 GoUint;
|
|
||||||
typedef size_t GoUintptr;
|
|
||||||
typedef float GoFloat32;
|
|
||||||
typedef double GoFloat64;
|
|
||||||
#ifdef _MSC_VER
|
|
||||||
#if !defined(__cplusplus) || _MSVC_LANG <= 201402L
|
|
||||||
#include <complex.h>
|
|
||||||
typedef _Fcomplex GoComplex64;
|
|
||||||
typedef _Dcomplex GoComplex128;
|
|
||||||
#else
|
|
||||||
#include <complex>
|
|
||||||
typedef std::complex<float> GoComplex64;
|
|
||||||
typedef std::complex<double> GoComplex128;
|
|
||||||
#endif
|
|
||||||
#else
|
|
||||||
typedef float _Complex GoComplex64;
|
|
||||||
typedef double _Complex GoComplex128;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*
|
|
||||||
static assertion to make sure the file is being used on architecture
|
|
||||||
at least with matching size of GoInt.
|
|
||||||
*/
|
|
||||||
typedef char _check_for_64_bit_pointer_matching_GoInt[sizeof(void*)==64/8 ? 1:-1];
|
|
||||||
|
|
||||||
#ifndef GO_CGO_GOSTRING_TYPEDEF
|
|
||||||
typedef _GoString_ GoString;
|
|
||||||
#endif
|
|
||||||
typedef void *GoMap;
|
|
||||||
typedef void *GoChan;
|
|
||||||
typedef struct { void *t; void *v; } GoInterface;
|
|
||||||
typedef struct { void *data; GoInt len; GoInt cap; } GoSlice;
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* End of boilerplate cgo prologue. */
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
extern GomuksHandle GomuksInit(void);
|
|
||||||
extern int GomuksStart(GomuksHandle handle, EventCallback callback);
|
|
||||||
extern void GomuksDestroy(GomuksHandle handle);
|
|
||||||
extern GomuksResponse GomuksSubmitCommand(GomuksHandle handle, char* command, GomuksBorrowedBuffer data);
|
|
||||||
extern GomuksAccountInfo GomuksGetAccountInfo(GomuksHandle handle);
|
|
||||||
extern void GomuksFreeAccountInfo(GomuksAccountInfo info);
|
|
||||||
extern void GomuksFreeBuffer(GomuksOwnedBuffer buf);
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
Binary file not shown.
Loading…
Add table
Add a link
Reference in a new issue