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 {
|
||||
final result = await showFutureLoadingDialog<Archive?>(
|
||||
context: context,
|
||||
future: () async {
|
||||
final result = await selectFiles(
|
||||
context,
|
||||
type: FileSelectorType.zip,
|
||||
);
|
||||
|
||||
if (result.isEmpty) return null;
|
||||
|
||||
final buffer = await result.first.readAsBytes();
|
||||
|
||||
final archive = ZipDecoder().decodeBytes(buffer);
|
||||
|
||||
return archive;
|
||||
},
|
||||
final result = await selectFiles(
|
||||
context,
|
||||
type: FileSelectorType.zip,
|
||||
);
|
||||
|
||||
final archive = result.result;
|
||||
if (archive == null) return;
|
||||
if (result.isEmpty) return;
|
||||
|
||||
final buffer = InputMemoryStream(await result.single.readAsBytes());
|
||||
|
||||
final archive = ZipDecoder().decodeStream(buffer);
|
||||
|
||||
await showDialog(
|
||||
context: context,
|
||||
|
|
@ -338,8 +328,6 @@ class EmotesSettingsController extends State<EmotesSettings> {
|
|||
'${pack.pack.displayName ?? client.userID?.localpart ?? 'emotes'}.zip';
|
||||
final output = ZipEncoder().encode(archive);
|
||||
|
||||
if (output == null) return;
|
||||
|
||||
MatrixFile(
|
||||
name: fileName,
|
||||
bytes: Uint8List.fromList(output),
|
||||
|
|
|
|||
Loading…
Reference in New Issue