mirror of
https://github.com/bggRGjQaUbCoE/PiliPlus.git
synced 2026-04-21 03:15:14 +08:00
tweaks (#1780)
* opt: sized * fix: self send * feat: ctrl enter to send * opt: checked * opt: download notifier * opt: Future.syncValue * mod: account * mod: loading state * opt: DebounceStreamMixin * opt: report * opt: enum map * opt: file handler * opt: dyn color * opt: Uint8List subview * opt: FileExt * opt: computeLuminance * opt: isNullOrEmpty * opt: Get context * update [skip ci] Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me> * opt dynamicColor [skip ci] Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me> * fixes [skip ci] * update Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me> * update Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me> --------- Signed-off-by: My-Responsitories <107370289+My-Responsitories@users.noreply.github.com> Co-authored-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
committed by
GitHub
parent
02e0d34127
commit
ce5e85e64b
@@ -118,20 +118,21 @@ class GrpcReq {
|
||||
|
||||
static Uint8List compressProtobuf(Uint8List proto) {
|
||||
proto = const GZipEncoder().encodeBytes(proto);
|
||||
var byteLength = ByteData(4)..setInt32(0, proto.length, Endian.big);
|
||||
return Uint8List(5 + proto.length)
|
||||
..[0] = 1
|
||||
..setRange(1, 5, byteLength.buffer.asUint8List())
|
||||
..buffer.asByteData(1, 4).setInt32(0, proto.length, Endian.big)
|
||||
..setAll(5, proto);
|
||||
}
|
||||
|
||||
static Uint8List decompressProtobuf(Uint8List data) {
|
||||
var length = ByteData.sublistView(data, 1, 5).getInt32(0, Endian.big);
|
||||
final length = ByteData.sublistView(data, 1, 5).getInt32(0, Endian.big);
|
||||
|
||||
if (data[0] == 1) {
|
||||
return const GZipDecoder().decodeBytes(data.sublist(5, length + 5));
|
||||
return const GZipDecoder().decodeBytes(
|
||||
Uint8List.sublistView(data, 5, length + 5),
|
||||
);
|
||||
} else {
|
||||
return data.sublist(5, length + 5);
|
||||
return Uint8List.sublistView(data, 5, length + 5);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user