Skip to content

Commit

Permalink
Iterate
Browse files Browse the repository at this point in the history
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
  • Loading branch information
t3chguy committed Nov 1, 2024
1 parent 6f29288 commit 4550068
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/components/structures/auth/CompleteSecurity.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,13 @@ export default class CompleteSecurity extends React.Component<IProps, IState> {
public constructor(props: IProps) {
super(props);
const store = SetupEncryptionStore.sharedInstance();
store.start();
this.state = { phase: store.phase, lostKeys: store.lostKeys() };
}

public componentDidMount(): void {
const store = SetupEncryptionStore.sharedInstance();
store.on("update", this.onStoreUpdate);
store.start();
}

private onStoreUpdate = (): void => {
Expand Down
2 changes: 1 addition & 1 deletion src/components/structures/auth/SetupEncryptionBody.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ export default class SetupEncryptionBody extends React.Component<IProps, IState>
public constructor(props: IProps) {
super(props);
const store = SetupEncryptionStore.sharedInstance();
store.start();
this.state = {
phase: store.phase,
// this serves dual purpose as the object for the request logic and
Expand All @@ -53,7 +54,6 @@ export default class SetupEncryptionBody extends React.Component<IProps, IState>
public componentDidMount(): void {
const store = SetupEncryptionStore.sharedInstance();
store.on("update", this.onStoreUpdate);
store.start();
}

private onStoreUpdate = (): void => {
Expand Down
12 changes: 7 additions & 5 deletions src/components/views/elements/AppTile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,12 @@ export default class AppTile extends React.Component<IProps, IState> {

// The key used for PersistedElement
this.persistKey = getPersistKey(WidgetUtils.getWidgetUid(this.props.app));
try {
this.sgWidget = new StopGapWidget(this.props);
} catch (e) {
logger.log("Failed to construct widget", e);
this.sgWidget = undefined;
}

this.state = this.getNewState(props);
}
Expand Down Expand Up @@ -298,12 +304,8 @@ export default class AppTile extends React.Component<IProps, IState> {
);
}

try {
this.sgWidget = new StopGapWidget(this.props);
if (this.sgWidget) {
this.setupSgListeners();
} catch (e) {
logger.log("Failed to construct widget", e);
this.sgWidget = undefined;
}

// Only fetch IM token on mount if we're showing and have permission to load
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,12 @@ interface IState {
}

export default class AdvancedRoomSettingsTab extends React.Component<IProps, IState> {
public constructor(props: IProps) {
super(props);

this.state = {};
}

public componentDidMount(): void {
const msc3946ProcessDynamicPredecessor = SettingsStore.getValue("feature_dynamic_room_predecessors");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import { mocked } from "jest-mock";
import { MatrixClientPeg } from "../../../../../src/MatrixClientPeg";
import * as TestUtils from "../../../../test-utils";
import CryptographyPanel from "../../../../../src/components/views/settings/CryptographyPanel";
import { withClientContextRenderOptions } from "../../../../test-utils";

describe("CryptographyPanel", () => {
it("shows the session ID and key", async () => {
Expand All @@ -28,7 +29,7 @@ describe("CryptographyPanel", () => {
mocked(client.getCrypto()!.getOwnDeviceKeys).mockResolvedValue({ ed25519: sessionKey, curve25519: "1234" });

// When we render the CryptographyPanel
const rendered = render(<CryptographyPanel />);
const rendered = render(<CryptographyPanel />, withClientContextRenderOptions(client));

// Then it displays info about the user's session
const codes = rendered.container.querySelectorAll("code");
Expand All @@ -52,7 +53,7 @@ describe("CryptographyPanel", () => {
mocked(client.getCrypto()!.getOwnDeviceKeys).mockRejectedValue(new Error("bleh"));

// When we render the CryptographyPanel
const rendered = render(<CryptographyPanel />);
const rendered = render(<CryptographyPanel />, withClientContextRenderOptions(client));

// Then it displays info about the user's session
const codes = rendered.container.querySelectorAll("code");
Expand Down

0 comments on commit 4550068

Please sign in to comment.