move to new sdk
This commit is contained in:
parent
7e3d330a68
commit
6868f38c7c
26 changed files with 172 additions and 201 deletions
|
|
@ -70,21 +70,16 @@ class _EmotesSettingsState extends State<EmotesSettings> {
|
|||
content['short'][emote.emote] = emote.mxc;
|
||||
}
|
||||
debugPrint(content.toString());
|
||||
var path = '';
|
||||
if (widget.room != null) {
|
||||
path = '/client/r0/rooms/${widget.room.id}/state/im.ponies.room_emotes/';
|
||||
await SimpleDialogs(context).tryRequestWithLoadingDialog(
|
||||
client.api.sendState(widget.room.id, 'im.ponies.room_emotes', content),
|
||||
);
|
||||
} else {
|
||||
path =
|
||||
'/client/r0/user/${client.userID}/account_data/im.ponies.user_emotes';
|
||||
await SimpleDialogs(context).tryRequestWithLoadingDialog(
|
||||
client.api
|
||||
.setAccountData(client.userID, 'im.ponies.user_emotes', content),
|
||||
);
|
||||
}
|
||||
debugPrint(path);
|
||||
await SimpleDialogs(context).tryRequestWithLoadingDialog(
|
||||
client.jsonRequest(
|
||||
type: HTTPType.PUT,
|
||||
action: path,
|
||||
data: content,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
bool get readonly => widget.room == null
|
||||
|
|
@ -378,11 +373,14 @@ class _EmoteImagePickerState extends State<_EmoteImagePicker> {
|
|||
maxWidth: 128,
|
||||
maxHeight: 128);
|
||||
if (file == null) return;
|
||||
final matrixFile =
|
||||
MatrixFile(bytes: await file.readAsBytes(), path: file.path);
|
||||
final uploadResp =
|
||||
await SimpleDialogs(context).tryRequestWithLoadingDialog(
|
||||
Matrix.of(context).client.upload(
|
||||
MatrixFile(bytes: await file.readAsBytes(), path: file.path),
|
||||
),
|
||||
Matrix.of(context)
|
||||
.client
|
||||
.api
|
||||
.upload(matrixFile.bytes, matrixFile.path),
|
||||
);
|
||||
setState(() {
|
||||
widget.controller.text = uploadResp;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue