Java源码示例:org.whispersystems.signalservice.api.messages.multidevice.DeviceInfo

示例1
@Override
public int handleCommand(final Namespace ns, final Manager m) {
    if (!m.isRegistered()) {
        System.err.println("User is not registered.");
        return 1;
    }
    try {
        List<DeviceInfo> devices = m.getLinkedDevices();
        for (DeviceInfo d : devices) {
            System.out.println("Device " + d.getId() + (d.getId() == m.getDeviceId() ? " (this device)" : "") + ":");
            System.out.println(" Name: " + d.getName());
            System.out.println(" Created: " + DateUtils.formatTimestamp(d.getCreated()));
            System.out.println(" Last seen: " + DateUtils.formatTimestamp(d.getLastSeen()));
        }
        return 0;
    } catch (IOException e) {
        e.printStackTrace();
        return 3;
    }
}
 
示例2
public List<DeviceInfo> getDevices() throws IOException {
  return this.pushServiceSocket.getDevices();
}
 
示例3
public List<DeviceInfo> getDevices() throws IOException {
  String responseText = makeServiceRequest(String.format(DEVICE_PATH, ""), "GET", null);
  return JsonUtil.fromJson(responseText, DeviceInfoList.class).getDevices();
}
 
示例4
public List<DeviceInfo> getDevices() {
  return devices;
}
 
示例5
public List<DeviceInfo> getDevices() {
  return devices;
}
 
示例6
public List<DeviceInfo> getDevices() throws IOException {
  return this.pushServiceSocket.getDevices();
}
 
示例7
public List<DeviceInfo> getDevices() throws IOException {
  String responseText = makeServiceRequest(String.format(DEVICE_PATH, ""), "GET", null);
  return JsonUtil.fromJson(responseText, DeviceInfoList.class).getDevices();
}
 
示例8
public List<DeviceInfo> getDevices() {
  return devices;
}
 
示例9
public List<DeviceInfo> getLinkedDevices() throws IOException {
    List<DeviceInfo> devices = accountManager.getDevices();
    account.setMultiDevice(devices.size() > 1);
    account.save();
    return devices;
}
 
示例10
public void removeLinkedDevices(int deviceId) throws IOException {
    accountManager.removeDevice(deviceId);
    List<DeviceInfo> devices = accountManager.getDevices();
    account.setMultiDevice(devices.size() > 1);
    account.save();
}