Skip to content

Commit

Permalink
Adjustments needed for onboarding-module
Browse files Browse the repository at this point in the history
  • Loading branch information
John Tore Simonsen committed Jun 20, 2024
1 parent 5038dd4 commit 8d6b4f0
Show file tree
Hide file tree
Showing 4 changed files with 483 additions and 75 deletions.
18 changes: 18 additions & 0 deletions src/MatrixClientPeg.ts
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,10 @@ export interface IMatrixClientPeg {
* see {@link ICreateClientOpts.tokenRefreshFunction}
*/
replaceUsingCreds(creds: IMatrixClientCreds, tokenRefreshFunction?: TokenRefreshFunction): void;

/*VERJI Custom Functions */
getCredentials(): IMatrixClientCreds | undefined;
/*END VERJI Custom Functions*/
}

/**
Expand Down Expand Up @@ -499,6 +503,20 @@ class MatrixClientPegClass implements IMatrixClientPeg {
notifTimelineSet.getLiveTimeline().setPaginationToken("", EventTimeline.BACKWARDS);
this.matrixClient.setNotifTimelineSet(notifTimelineSet);
}
/* VERJI Custom Functions */
public getCredentials(): IMatrixClientCreds | undefined {
if (!this.matrixClient) return;

return {
homeserverUrl: this.matrixClient.baseUrl,
identityServerUrl: this.matrixClient.idBaseUrl,
userId: this.matrixClient.credentials.userId ?? "",
deviceId: this.matrixClient.getDeviceId() ?? "",
accessToken: this.matrixClient.getAccessToken() ?? "",
guest: this.matrixClient.isGuest(),
};
}
/* END VERJI Custom Functions*/
}

/**
Expand Down
31 changes: 30 additions & 1 deletion src/components/structures/MatrixChat.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,12 @@ import { logger } from "matrix-js-sdk/src/logger";
import { throttle } from "lodash";
import { CryptoEvent } from "matrix-js-sdk/src/crypto";
import { IKeyBackupInfo } from "matrix-js-sdk/src/crypto/keybackup";

// what-input helps improve keyboard accessibility
import "what-input";
import {
CustomComponentLifecycle,
CustomComponentOpts,
} from "@matrix-org/react-sdk-module-api/lib/lifecycles/CustomComponentLifecycle";

Check failure on line 40 in src/components/structures/MatrixChat.tsx

View workflow job for this annotation

GitHub Actions / Typescript Syntax Check

Cannot find module '@matrix-org/react-sdk-module-api/lib/lifecycles/CustomComponentLifecycle' or its corresponding type declarations.

import type NewRecoveryMethodDialog from "../../async-components/views/dialogs/security/NewRecoveryMethodDialog";
import type RecoveryMethodRemovedDialog from "../../async-components/views/dialogs/security/RecoveryMethodRemovedDialog";
Expand Down Expand Up @@ -942,6 +945,32 @@ export default class MatrixChat extends React.PureComponent<IProps, IState> {
true,
);
break;
// VERJI
case Action.OpenInviteExternalUsersDialog: {
const customOnboardingOpts = { CustomComponent: React.Fragment };
ModuleRunner.instance.invoke(
CustomComponentLifecycle.Experimental,
customOnboardingOpts as CustomComponentOpts,
);
const Props = (props: any): React.JSX.Element => <div>{props}</div>;
const customOnboardingDialog = (props: any): React.JSX.Element => (
<customOnboardingOpts.CustomComponent>
<Props props={props} />
</customOnboardingOpts.CustomComponent>
);
console.log("[Verji.Onboarding - Action.OpenInviteExternalUsers]", payload.data);
Modal.createDialog(
customOnboardingDialog,
{
initialText: payload.initialText,
data: payload?.data,
},
"mx_RoomDirectory_dialogWrapper",
false,
true,
);
}
// END VERJI
}
};

Expand Down
Loading

0 comments on commit 8d6b4f0

Please sign in to comment.