List<Device> getLinkedDevices() throws IOException;
- void removeLinkedDevices(long deviceId) throws IOException;
+ void removeLinkedDevices(int deviceId) throws IOException;
void addDeviceLink(URI linkUri) throws IOException, InvalidDeviceLinkException;
}
@Override
- public void removeLinkedDevices(long deviceId) throws IOException {
+ public void removeLinkedDevices(int deviceId) throws IOException {
context.getAccountHelper().removeLinkedDevices(deviceId);
}
package org.asamk.signal.manager.api;
-public record Device(long id, String name, long created, long lastSeen, boolean isThisDevice) {}
+public record Device(int id, String name, long created, long lastSeen, boolean isThisDevice) {}
account.setMultiDevice(true);
}
- public void removeLinkedDevices(long deviceId) throws IOException {
+ public void removeLinkedDevices(int deviceId) throws IOException {
dependencies.getAccountManager().removeDevice(deviceId);
var devices = dependencies.getAccountManager().getDevices();
account.setMultiDevice(devices.size() > 1);
public void attachToSubparser(final Subparser subparser) {
subparser.help("Remove a linked device.");
subparser.addArgument("-d", "--device-id", "--deviceId")
- .type(long.class)
+ .type(int.class)
.required(true)
.help("Specify the device you want to remove. Use listDevices to see the deviceIds.");
}
final Namespace ns, final Manager m, final OutputWriter outputWriter
) throws CommandException {
try {
- final var deviceId = ns.getLong("device-id");
+ final var deviceId = ns.getInt("device-id");
m.removeLinkedDevices(deviceId);
} catch (IOException e) {
throw new IOErrorException("Error while removing device: " + e.getMessage(), e);
return signal.listDevices().stream().map(d -> {
final var device = getRemoteObject(d.getObjectPath(),
Signal.Device.class).GetAll("org.asamk.Signal.Device");
- return new Device((long) device.get("Id").getValue(),
+ return new Device(((Long) device.get("Id").getValue()).intValue(),
(String) device.get("Name").getValue(),
(long) device.get("Created").getValue(),
(long) device.get("LastSeen").getValue(),
}
@Override
- public void removeLinkedDevices(final long deviceId) throws IOException {
+ public void removeLinkedDevices(final int deviceId) throws IOException {
final var devicePath = signal.getDevice(deviceId);
getRemoteObject(devicePath, Signal.Device.class).removeDevice();
}
if (d.isThisDevice()) {
thisDevice = new DBusPath(deviceObjectPath);
}
- this.devices.add(new StructDevice(new DBusPath(deviceObjectPath), d.id(), emptyIfNull(d.name())));
+ this.devices.add(new StructDevice(new DBusPath(deviceObjectPath), (long) d.id(), emptyIfNull(d.name())));
});
}