Watch for account data changes in debug panel
This commit is contained in:
parent
c21c0e1150
commit
139e19630a
1 changed files with 18 additions and 0 deletions
|
@ -30,6 +30,24 @@ export default class CrossSigningPanel extends React.PureComponent {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
componentDidMount() {
|
||||||
|
const cli = MatrixClientPeg.get();
|
||||||
|
cli.on("accountData", this.onAccountData);
|
||||||
|
}
|
||||||
|
|
||||||
|
componentWillUnmount() {
|
||||||
|
const cli = MatrixClientPeg.get();
|
||||||
|
if (!cli) return;
|
||||||
|
cli.removeListener("accountData", this.onAccountData);
|
||||||
|
}
|
||||||
|
|
||||||
|
onAccountData = (event) => {
|
||||||
|
const type = event.getType();
|
||||||
|
if (type.startsWith("m.cross_signing") || type.startsWith("m.secret_storage")) {
|
||||||
|
this.setState(this._getUpdatedStatus());
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
_getUpdatedStatus() {
|
_getUpdatedStatus() {
|
||||||
// XXX: Add public accessors if we keep this around in production
|
// XXX: Add public accessors if we keep this around in production
|
||||||
const cli = MatrixClientPeg.get();
|
const cli = MatrixClientPeg.get();
|
||||||
|
|
Loading…
Reference in a new issue