bump gomuks, use new pause/resume commands
This commit is contained in:
parent
f971c50df0
commit
a2638d5c82
4 changed files with 11 additions and 4 deletions
2
gomuks
2
gomuks
|
|
@ -1 +1 @@
|
|||
Subproject commit 53cae0e0334aef5ac376ea84f19ba1cff8a92310
|
||||
Subproject commit 081d5df14be6bf7131e955461207e26da7ad23c9
|
||||
|
|
@ -200,6 +200,9 @@ class ClientController extends AsyncNotifier<int> {
|
|||
Future<String?> setState(SetStateRequest request) async =>
|
||||
await _sendCommand("set_state", request.toJson());
|
||||
|
||||
Future<void> pauseSync() => _sendCommand("pause_sync");
|
||||
Future<void> resumeSync() => _sendCommand("resume_sync");
|
||||
|
||||
Future<void> verify(String recoveryKey) =>
|
||||
_sendCommand("verify", {"recovery_key": recoveryKey});
|
||||
|
||||
|
|
|
|||
|
|
@ -156,11 +156,12 @@ class GomuksListenerController extends AsyncNotifier<void> {
|
|||
// Mobile OSes block network access for backgrounded apps, so pause
|
||||
// syncing instead of letting it fail.
|
||||
ref.listen(AppPausedController.provider, (_, paused) {
|
||||
final client = ref.read(ClientController.provider.notifier);
|
||||
if (paused) {
|
||||
GomuksPauseSync(handle);
|
||||
client.pauseSync().onError(showError);
|
||||
} else {
|
||||
ref.invalidate(TypingController.provider);
|
||||
GomuksResumeSync(handle);
|
||||
client.resumeSync().onError(showError);
|
||||
}
|
||||
}, fireImmediately: true);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,7 +15,10 @@ extension GomuksOwnedBufferToX on GomuksOwnedBuffer {
|
|||
}
|
||||
}
|
||||
|
||||
dynamic toJsonAndFree() => jsonDecode(utf8.decode(toBytesAndFree()));
|
||||
dynamic toJsonAndFree() {
|
||||
final bytes = toBytesAndFree();
|
||||
return bytes.isEmpty ? null : jsonDecode(utf8.decode(bytes));
|
||||
}
|
||||
}
|
||||
|
||||
extension JsonToGomuksBuffer on Map<String, dynamic> {
|
||||
|
|
|
|||
Loading…
Reference in a new issue