Compare commits
6 changed files with 12 additions and 10 deletions
|
|
@ -108,7 +108,7 @@ class ClientController extends AsyncNotifier<int> {
|
||||||
() => callback(handle, bufferPointer.ref),
|
() => callback(handle, bufferPointer.ref),
|
||||||
);
|
);
|
||||||
|
|
||||||
final json = response.buf.toJsonAndFree();
|
final json = response.buf.toJson();
|
||||||
|
|
||||||
if (response.command.cast<Utf8>().toDartString() == "error") {
|
if (response.command.cast<Utf8>().toDartString() == "error") {
|
||||||
throw json;
|
throw json;
|
||||||
|
|
|
||||||
|
|
@ -35,7 +35,7 @@ class GomuksListenerController extends AsyncNotifier<void> {
|
||||||
try {
|
try {
|
||||||
final muksEventType = command.cast<Utf8>().toDartString();
|
final muksEventType = command.cast<Utf8>().toDartString();
|
||||||
debugPrint("Handling $muksEventType...");
|
debugPrint("Handling $muksEventType...");
|
||||||
final decodedMuksEvent = data.toJsonAndFree();
|
final decodedMuksEvent = data.toJson();
|
||||||
|
|
||||||
switch (muksEventType) {
|
switch (muksEventType) {
|
||||||
case "client_state":
|
case "client_state":
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@ import "dart:convert";
|
||||||
import "dart:io";
|
import "dart:io";
|
||||||
|
|
||||||
import "package:flutter/foundation.dart";
|
import "package:flutter/foundation.dart";
|
||||||
|
import "package:flutter/services.dart";
|
||||||
import "package:flutter_riverpod/flutter_riverpod.dart";
|
import "package:flutter_riverpod/flutter_riverpod.dart";
|
||||||
import "package:intl/intl.dart";
|
import "package:intl/intl.dart";
|
||||||
import "package:nexus/controllers/key.dart";
|
import "package:nexus/controllers/key.dart";
|
||||||
|
|
@ -77,7 +78,7 @@ class UnifiedPushController extends AsyncNotifier<bool> {
|
||||||
KeyController.provider(KeyController.roomKey).future,
|
KeyController.provider(KeyController.roomKey).future,
|
||||||
) ==
|
) ==
|
||||||
event.roomId)) {
|
event.roomId)) {
|
||||||
if (isInBackground) exit(0);
|
if (isInBackground) SystemNavigator.pop();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -103,7 +104,7 @@ class UnifiedPushController extends AsyncNotifier<bool> {
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
if (isInBackground) exit(0);
|
if (isInBackground) SystemNavigator.pop();
|
||||||
},
|
},
|
||||||
onUnregistered: deregister,
|
onUnregistered: deregister,
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -1,21 +1,20 @@
|
||||||
import "dart:convert";
|
import "dart:convert";
|
||||||
import "dart:ffi";
|
import "dart:ffi";
|
||||||
import "dart:typed_data";
|
import "dart:typed_data";
|
||||||
|
|
||||||
import "package:ffi/ffi.dart";
|
import "package:ffi/ffi.dart";
|
||||||
import "package:nexus/src/third_party/gomuks.g.dart";
|
import "package:nexus/src/third_party/gomuks.g.dart";
|
||||||
|
|
||||||
extension GomuksOwnedBufferToX on GomuksOwnedBuffer {
|
extension GomuksOwnedBufferToX on GomuksOwnedBuffer {
|
||||||
Uint8List toBytesAndFree() {
|
Uint8List toBytes() {
|
||||||
try {
|
try {
|
||||||
if (base == nullptr || length <= 0) return .new(0);
|
if (base == nullptr || length <= 0) return .new(0);
|
||||||
return .fromList(base.asTypedList(length));
|
return .fromList(base.asTypedList(length));
|
||||||
} finally {
|
} finally {
|
||||||
GomuksFreeBuffer(this);
|
calloc.free(base);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
dynamic toJsonAndFree() => jsonDecode(utf8.decode(toBytesAndFree()));
|
dynamic toJson() => jsonDecode(utf8.decode(toBytes()));
|
||||||
}
|
}
|
||||||
|
|
||||||
extension JsonToGomuksBuffer on Map<String, dynamic> {
|
extension JsonToGomuksBuffer on Map<String, dynamic> {
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@ import "dart:io";
|
||||||
|
|
||||||
import "package:dynamic_color/dynamic_color.dart";
|
import "package:dynamic_color/dynamic_color.dart";
|
||||||
import "package:flutter/foundation.dart";
|
import "package:flutter/foundation.dart";
|
||||||
|
import "package:flutter/services.dart";
|
||||||
import "package:flutter_riverpod/flutter_riverpod.dart";
|
import "package:flutter_riverpod/flutter_riverpod.dart";
|
||||||
import "package:material_emoji_picker/material_emoji_picker.dart";
|
import "package:material_emoji_picker/material_emoji_picker.dart";
|
||||||
import "package:media_kit/media_kit.dart";
|
import "package:media_kit/media_kit.dart";
|
||||||
|
|
@ -79,7 +80,7 @@ void main(List<String> args) async {
|
||||||
.timeout(Duration(seconds: 5));
|
.timeout(Duration(seconds: 5));
|
||||||
|
|
||||||
await Future.delayed(Duration(seconds: 10));
|
await Future.delayed(Duration(seconds: 10));
|
||||||
exit(0);
|
SystemNavigator.pop();
|
||||||
} else {
|
} else {
|
||||||
if (Platform.isLinux || Platform.isMacOS || Platform.isWindows) {
|
if (Platform.isLinux || Platform.isMacOS || Platform.isWindows) {
|
||||||
await windowManager.ensureInitialized();
|
await windowManager.ensureInitialized();
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
import "dart:io";
|
import "dart:io";
|
||||||
|
|
||||||
import "package:fast_immutable_collections/fast_immutable_collections.dart";
|
import "package:fast_immutable_collections/fast_immutable_collections.dart";
|
||||||
|
import "package:flutter/services.dart";
|
||||||
import "package:material_ui/material_ui.dart";
|
import "package:material_ui/material_ui.dart";
|
||||||
import "package:hooks_riverpod/hooks_riverpod.dart";
|
import "package:hooks_riverpod/hooks_riverpod.dart";
|
||||||
import "package:nexus/controllers/settings.dart";
|
import "package:nexus/controllers/settings.dart";
|
||||||
|
|
@ -59,7 +60,7 @@ final class const Appbar({
|
||||||
),
|
),
|
||||||
IconButton(
|
IconButton(
|
||||||
tooltip: "Close window",
|
tooltip: "Close window",
|
||||||
onPressed: () => exit(0),
|
onPressed: SystemNavigator.pop,
|
||||||
icon: const Icon(Icons.close),
|
icon: const Icon(Icons.close),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue