Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
02c486e1b3 |
|||
|
b694da31f9 |
6 changed files with 10 additions and 12 deletions
|
|
@ -108,7 +108,7 @@ class ClientController extends AsyncNotifier<int> {
|
||||||
() => callback(handle, bufferPointer.ref),
|
() => callback(handle, bufferPointer.ref),
|
||||||
);
|
);
|
||||||
|
|
||||||
final json = response.buf.toJson();
|
final json = response.buf.toJsonAndFree();
|
||||||
|
|
||||||
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.toJson();
|
final decodedMuksEvent = data.toJsonAndFree();
|
||||||
|
|
||||||
switch (muksEventType) {
|
switch (muksEventType) {
|
||||||
case "client_state":
|
case "client_state":
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,6 @@ 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";
|
||||||
|
|
@ -78,7 +77,7 @@ class UnifiedPushController extends AsyncNotifier<bool> {
|
||||||
KeyController.provider(KeyController.roomKey).future,
|
KeyController.provider(KeyController.roomKey).future,
|
||||||
) ==
|
) ==
|
||||||
event.roomId)) {
|
event.roomId)) {
|
||||||
if (isInBackground) SystemNavigator.pop();
|
if (isInBackground) exit(0);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -104,7 +103,7 @@ class UnifiedPushController extends AsyncNotifier<bool> {
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
if (isInBackground) SystemNavigator.pop();
|
if (isInBackground) exit(0);
|
||||||
},
|
},
|
||||||
onUnregistered: deregister,
|
onUnregistered: deregister,
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -1,20 +1,21 @@
|
||||||
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 toBytes() {
|
Uint8List toBytesAndFree() {
|
||||||
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 {
|
||||||
calloc.free(base);
|
GomuksFreeBuffer(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
dynamic toJson() => jsonDecode(utf8.decode(toBytes()));
|
dynamic toJsonAndFree() => jsonDecode(utf8.decode(toBytesAndFree()));
|
||||||
}
|
}
|
||||||
|
|
||||||
extension JsonToGomuksBuffer on Map<String, dynamic> {
|
extension JsonToGomuksBuffer on Map<String, dynamic> {
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,6 @@ 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";
|
||||||
|
|
@ -80,7 +79,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));
|
||||||
SystemNavigator.pop();
|
exit(0);
|
||||||
} else {
|
} else {
|
||||||
if (Platform.isLinux || Platform.isMacOS || Platform.isWindows) {
|
if (Platform.isLinux || Platform.isMacOS || Platform.isWindows) {
|
||||||
await windowManager.ensureInitialized();
|
await windowManager.ensureInitialized();
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,6 @@
|
||||||
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";
|
||||||
|
|
@ -60,7 +59,7 @@ final class const Appbar({
|
||||||
),
|
),
|
||||||
IconButton(
|
IconButton(
|
||||||
tooltip: "Close window",
|
tooltip: "Close window",
|
||||||
onPressed: SystemNavigator.pop,
|
onPressed: () => exit(0),
|
||||||
icon: const Icon(Icons.close),
|
icon: const Icon(Icons.close),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue