Set the device name when onboarding multiple devices

parent b3726be5
......@@ -482,7 +482,12 @@ public class DoxsViewModel extends BaseViewModel {
.subscribe(
deviceRole -> {
ownedDevice.setDeviceRole(deviceRole);
String deviceName = ownedDevice.getDeviceRole().toString() + ownedDevice.getDeviceId().substring(0, 5);
String deviceName;
if (ownedDevice.getDeviceInfo().getName() == null || ownedDevice.getDeviceInfo().getName().isEmpty()) {
deviceName = ownedDevice.getDeviceRole().toString() + "_" + ownedDevice.getDeviceId().substring(0, 5);
} else {
deviceName = ownedDevice.getDeviceInfo().getName() + "_" + ownedDevice.getDeviceId().substring(0, 5);
}
ownedDevice.getDeviceInfo().setName(deviceName);
setDeviceName(ownedDevice.getDeviceId(), deviceName);
deviceRoleMultiResponse.setValue(Response.success(ownedDevice));
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment