Skip to content

Commit

Permalink
[homekit] update AuthInfo objects when blockUserDeletion changes (ope…
Browse files Browse the repository at this point in the history
…nhab#14017)

* [homekit] update AuthInfo objects when blockUserDeletion changes

Signed-off-by: Cody Cutrer <[email protected]>

* [homekit] general cleanup of redundant method call and unused local vars

Signed-off-by: Cody Cutrer <[email protected]>

Signed-off-by: Cody Cutrer <[email protected]>
  • Loading branch information
ccutrer authored Dec 21, 2022
1 parent 672b60b commit 462dca8
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,10 @@ public HomekitAuthInfoImpl(Storage<Object> storage, String pin, String setupId,
initializeStorage();
}

public void setBlockUserDeletion(boolean blockUserDeletion) {
this.blockUserDeletion = blockUserDeletion;
}

@Override
public void createUser(String username, byte[] publicKey) {
logger.trace("create user {}", username);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,11 @@ protected synchronized void modified(Map<String, Object> config) {
for (HomekitChangeListener changeListener : changeListeners) {
changeListener.updateSettings(settings);
}
if (settings.blockUserDeletion != oldSettings.blockUserDeletion) {
for (HomekitAuthInfoImpl authInfo : authInfos) {
authInfo.setBlockUserDeletion(settings.blockUserDeletion);
}
}
}
} catch (IOException | InvalidAlgorithmParameterException e) {
logger.warn("could not initialize HomeKit bridge: {}", e.getMessage());
Expand Down Expand Up @@ -203,10 +208,6 @@ private HomekitRoot startBridge(HomekitServer homekitServer, HomekitAuthInfoImpl
changeListener.setBridge(bridge);
bridges.add(bridge);
bridge.setConfigurationIndex(changeListener.getConfigurationRevision());
bridge.refreshAuthInfo();

final int lastAccessoryCount = changeListener.getLastAccessoryCount();
int currentAccessoryCount = changeListener.getAccessories().size();
bridge.start();
return bridge;
}
Expand Down

0 comments on commit 462dca8

Please sign in to comment.