mirror of
https://github.com/AsamK/signal-cli
synced 2025-08-29 10:30:38 +00:00
Make deviceId an int
This commit is contained in:
parent
a3c5cfd2f4
commit
80befec589
7 changed files with 9 additions and 9 deletions
|
@ -21,7 +21,7 @@ public class RemoveDeviceCommand implements JsonRpcLocalCommand {
|
|||
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.");
|
||||
}
|
||||
|
@ -31,7 +31,7 @@ public class RemoveDeviceCommand implements JsonRpcLocalCommand {
|
|||
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);
|
||||
|
|
|
@ -173,7 +173,7 @@ public class DbusManagerImpl implements Manager {
|
|||
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(),
|
||||
|
@ -182,7 +182,7 @@ public class DbusManagerImpl implements Manager {
|
|||
}
|
||||
|
||||
@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();
|
||||
}
|
||||
|
|
|
@ -942,7 +942,7 @@ public class DbusSignalImpl implements Signal {
|
|||
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())));
|
||||
});
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue