The OmemoManager#setTrustCallback can only be executed once. Presently this requires an instance of OmemoManager to use this method. In aTalk implementation, this method is called after connection is connected. Hence it will get call again during auto re-connection or manual re-connection. Would you consider making getTrustCallback() public so the app can check before making call to setTrustCallback().
Alternative, setTrustCallback() just ignores the call if trustCallback is not null, instead of throwing an error. (see below source)
I do think of making a local flag to keep track the state but do not think this is a good idea.
/**
* Set a TrustCallback for this particular OmemoManager.
* TrustCallbacks are used to query and modify trust decisions.
*
* @param callback trustCallback.
*/
public void setTrustCallback(OmemoTrustCallback callback) {
if (trustCallback == null) {
trustCallback = callback;
}
}
/**
* Return the TrustCallback of this manager.
* @return
*/
public OmemoTrustCallback getTrustCallback() {
return trustCallback;
}