diff --git a/.gitmodules b/.gitmodules index 06dd51a..627b6b0 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,4 @@ [submodule "gomuks"] path = gomuks - url = https://github.com/gomuks/gomuks + url = https://github.com/Henry-Hiles/gomuks + branch = quad/feat/customizable-device-name diff --git a/gomuks b/gomuks index b11eedc..ae11daa 160000 --- a/gomuks +++ b/gomuks @@ -1 +1 @@ -Subproject commit b11eedca121a7081d3ee48165ba363e722d18d87 +Subproject commit ae11daa1b14b103688e57accb9c65ad6401cb3ef diff --git a/lib/controllers/client.dart b/lib/controllers/client.dart index 90f8896..cd1fa13 100644 --- a/lib/controllers/client.dart +++ b/lib/controllers/client.dart @@ -20,7 +20,6 @@ import "package:nexus/main.dart"; import "package:nexus/models/capabilities.dart"; import "package:nexus/models/content/message.dart"; import "package:nexus/models/event.dart"; -import "package:nexus/models/gomuks_config.dart"; import "package:nexus/models/oauth_auth_code_response.dart"; import "package:nexus/models/open_graph_data.dart"; import "package:nexus/models/paginate.dart"; @@ -71,17 +70,14 @@ class ClientController extends AsyncNotifier { } } final handle = await Isolate.run(() { - final bufferPointer = GomuksConfig( - matrix: .new( - initialDeviceDisplayName: - "Nexus on ${toBeginningOfSentenceCase(Platform.operatingSystem)}", - ), - ).toJson().toGomuksBufferPtr(); - + final message = + "Nexus on ${toBeginningOfSentenceCase(Platform.operatingSystem)}" + .toNativeUtf8() + .cast(); try { - return GomuksInit(bufferPointer.ref); + return GomuksInit(message); } finally { - calloc.free(bufferPointer); + calloc.free(message); } }); @@ -296,9 +292,9 @@ class ClientController extends AsyncNotifier { } Future> getMentions(GetMentionsRequest request) async => .new( - // TODO: Handle `related_events` - ((await _sendCommand("get_mentions", request.toJson()))["events"] as List) - .map((event) => .fromJson(event)), + ((await _sendCommand("get_mentions", request.toJson())) as List).map( + (event) => .fromJson(event), + ), ); Future getEvent(GetEventRequest request) async { diff --git a/lib/models/gomuks_config.dart b/lib/models/gomuks_config.dart deleted file mode 100644 index e6a8ce7..0000000 --- a/lib/models/gomuks_config.dart +++ /dev/null @@ -1,55 +0,0 @@ -import "package:freezed_annotation/freezed_annotation.dart"; - -part "gomuks_config.freezed.dart"; -part "gomuks_config.g.dart"; - -@Freezed(toJson: false, fromJson: false) -@JsonSerializable() -class const GomuksConfig({ - final MatrixConfig? matrix, - final PushConfig? push, - final MediaConfig? media, -}) with _$GomuksConfig { - Map toJson() => _$GomuksConfigToJson(this); - - factory GomuksConfig.fromJson(Map json) => - _$GomuksConfigFromJson(json); -} - -@Freezed(toJson: false, fromJson: false) -@JsonSerializable() -class const MatrixConfig({ - @JsonKey(name: "disable_http2") final bool disableHttp2 = false, - @JsonKey(name: "set_presence") final String? setPresence, - @JsonKey(name: "initial_device_display_name") - required final String initialDeviceDisplayName, -}) with _$MatrixConfig { - Map toJson() => _$MatrixConfigToJson(this); - - factory MatrixConfig.fromJson(Map json) => - _$MatrixConfigFromJson(json); -} - -@Freezed(toJson: false, fromJson: false) -@JsonSerializable() -class const PushConfig({ - @JsonKey(name: "fcm_gateway") required final String fcmGateway, - @JsonKey(name: "vapid_private_key") required final String vapidPrivateKey, - @JsonKey(name: "vapid_public_key") required final String vapidPublicKey, -}) with _$PushConfig { - Map toJson() => _$PushConfigToJson(this); - - factory PushConfig.fromJson(Map json) => - _$PushConfigFromJson(json); -} - -@Freezed(toJson: false, fromJson: false) -@JsonSerializable() -class const MediaConfig({ - @JsonKey(name: "thumbnail_size") required final int thumbnailSize, -}) with _$MediaConfig { - Map toJson() => _$MediaConfigToJson(this); - - factory MediaConfig.fromJson(Map json) => - _$MediaConfigFromJson(json); -}