cleanup: Replace non-standard ByteArray module
gjs landed support for TextDecoder/TextEncoder. Use those instead of gjs' own ByteArray module. Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1946>
This commit is contained in:

committed by
Marge Bot

parent
b21b43e318
commit
ef70364e81
@ -2,7 +2,6 @@
|
||||
/* exported KeyboardManager */
|
||||
|
||||
const { Clutter, Gio, GLib, GObject, Graphene, Meta, Shell, St } = imports.gi;
|
||||
const ByteArray = imports.byteArray;
|
||||
const Signals = imports.signals;
|
||||
|
||||
const EdgeDragAction = imports.ui.edgeDragAction;
|
||||
@ -536,9 +535,9 @@ var KeyboardModel = class {
|
||||
_loadModel(groupName) {
|
||||
let file = Gio.File.new_for_uri('resource:///org/gnome/shell/osk-layouts/%s.json'.format(groupName));
|
||||
let [success_, contents] = file.load_contents(null);
|
||||
contents = ByteArray.toString(contents);
|
||||
|
||||
return JSON.parse(contents);
|
||||
const decoder = new TextDecoder();
|
||||
return JSON.parse(decoder.decode(contents));
|
||||
}
|
||||
|
||||
getLevels() {
|
||||
@ -1039,9 +1038,7 @@ var EmojiSelection = GObject.registerClass({
|
||||
let file = Gio.File.new_for_uri('resource:///org/gnome/shell/osk-layouts/emoji.json');
|
||||
let [success_, contents] = file.load_contents(null);
|
||||
|
||||
if (contents instanceof Uint8Array)
|
||||
contents = imports.byteArray.toString(contents);
|
||||
let emoji = JSON.parse(contents);
|
||||
let emoji = JSON.parse(new TextDecoder().decode(contents));
|
||||
|
||||
let variants = [];
|
||||
let currentKey = 0;
|
||||
|
Reference in New Issue
Block a user