Support for MSC3882 revision 1 (#10443)
Co-authored-by: Michael Telatynski <7t3chguy@gmail.com>
This commit is contained in:
parent
700af0954a
commit
5c0e5eb0fb
8 changed files with 114 additions and 9 deletions
|
@ -15,8 +15,12 @@ limitations under the License.
|
|||
*/
|
||||
|
||||
import React from "react";
|
||||
import {
|
||||
IMSC3882GetLoginTokenCapability,
|
||||
IServerVersions,
|
||||
UNSTABLE_MSC3882_CAPABILITY,
|
||||
} from "matrix-js-sdk/src/matrix";
|
||||
|
||||
import type { IServerVersions } from "matrix-js-sdk/src/matrix";
|
||||
import { _t } from "../../../../languageHandler";
|
||||
import AccessibleButton from "../../elements/AccessibleButton";
|
||||
import SettingsSubsection from "../shared/SettingsSubsection";
|
||||
|
@ -24,6 +28,8 @@ import SettingsSubsection from "../shared/SettingsSubsection";
|
|||
interface IProps {
|
||||
onShowQr: () => void;
|
||||
versions?: IServerVersions;
|
||||
// we can't use the capabilities type from the js-sdk because it isn't exported
|
||||
capabilities?: Record<string, any>;
|
||||
}
|
||||
|
||||
export default class LoginWithQRSection extends React.Component<IProps> {
|
||||
|
@ -33,7 +39,10 @@ export default class LoginWithQRSection extends React.Component<IProps> {
|
|||
|
||||
public render(): JSX.Element | null {
|
||||
// Needs server support for MSC3882 and MSC3886:
|
||||
const msc3882Supported = !!this.props.versions?.unstable_features?.["org.matrix.msc3882"];
|
||||
// in r0 of MSC3882 it is exposed as a feature flag, but in r1 it is a capability
|
||||
const capability = UNSTABLE_MSC3882_CAPABILITY.findIn<IMSC3882GetLoginTokenCapability>(this.props.capabilities);
|
||||
const msc3882Supported =
|
||||
!!this.props.versions?.unstable_features?.["org.matrix.msc3882"] || !!capability?.enabled;
|
||||
const msc3886Supported = !!this.props.versions?.unstable_features?.["org.matrix.msc3886"];
|
||||
const offerShowQr = msc3882Supported && msc3886Supported;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue