fix: import sticker packs
This commit is contained in:
parent
c372f7d79f
commit
24d1f7f9b2
|
|
@ -276,26 +276,16 @@ class EmotesSettingsController extends State<EmotesSettings> {
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> importEmojiZip() async {
|
Future<void> importEmojiZip() async {
|
||||||
final result = await showFutureLoadingDialog<Archive?>(
|
|
||||||
context: context,
|
|
||||||
future: () async {
|
|
||||||
final result = await selectFiles(
|
final result = await selectFiles(
|
||||||
context,
|
context,
|
||||||
type: FileSelectorType.zip,
|
type: FileSelectorType.zip,
|
||||||
);
|
);
|
||||||
|
|
||||||
if (result.isEmpty) return null;
|
if (result.isEmpty) return;
|
||||||
|
|
||||||
final buffer = await result.first.readAsBytes();
|
final buffer = InputMemoryStream(await result.single.readAsBytes());
|
||||||
|
|
||||||
final archive = ZipDecoder().decodeBytes(buffer);
|
final archive = ZipDecoder().decodeStream(buffer);
|
||||||
|
|
||||||
return archive;
|
|
||||||
},
|
|
||||||
);
|
|
||||||
|
|
||||||
final archive = result.result;
|
|
||||||
if (archive == null) return;
|
|
||||||
|
|
||||||
await showDialog(
|
await showDialog(
|
||||||
context: context,
|
context: context,
|
||||||
|
|
@ -338,8 +328,6 @@ class EmotesSettingsController extends State<EmotesSettings> {
|
||||||
'${pack.pack.displayName ?? client.userID?.localpart ?? 'emotes'}.zip';
|
'${pack.pack.displayName ?? client.userID?.localpart ?? 'emotes'}.zip';
|
||||||
final output = ZipEncoder().encode(archive);
|
final output = ZipEncoder().encode(archive);
|
||||||
|
|
||||||
if (output == null) return;
|
|
||||||
|
|
||||||
MatrixFile(
|
MatrixFile(
|
||||||
name: fileName,
|
name: fileName,
|
||||||
bytes: Uint8List.fromList(output),
|
bytes: Uint8List.fromList(output),
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue