Merge pull request #726 from vector-im/flow-registration

Allow passing in flowSelector from startRegistration method
This commit is contained in:
Bruno Windels 2022-04-27 11:18:53 +02:00 committed by GitHub
commit 23b621492f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 5 deletions

View file

@ -31,7 +31,8 @@ import {
createNavigation,
createRouter,
RoomViewModel,
TimelineView
TimelineView,
viewClassForTile
} from "hydrogen-view-sdk";
import downloadSandboxPath from 'hydrogen-view-sdk/download-sandbox.html?url';
import workerPath from 'hydrogen-view-sdk/main.js?url';
@ -53,7 +54,7 @@ import "hydrogen-view-sdk/theme-element-light.css";
async function main() {
const app = document.querySelector<HTMLDivElement>('#app')!
const config = {};
const platform = new Platform(app, assetPaths, config, { development: import.meta.env.DEV });
const platform = new Platform({container: app, assetPaths, config, options: { development: import.meta.env.DEV }});
const navigation = createNavigation();
platform.setNavigation(navigation);
const urlRouter = createRouter({
@ -88,7 +89,7 @@ async function main() {
navigation,
});
await vm.load();
const view = new TimelineView(vm.timelineViewModel);
const view = new TimelineView(vm.timelineViewModel, viewClassForTile);
app.appendChild(view.mount());
}
}

View file

@ -132,14 +132,15 @@ export class Client {
});
}
async startRegistration(homeserver, username, password, initialDeviceDisplayName) {
async startRegistration(homeserver, username, password, initialDeviceDisplayName, flowSelector) {
const request = this._platform.request;
const hsApi = new HomeServerApi({homeserver, request});
const registration = new Registration(hsApi, {
username,
password,
initialDeviceDisplayName,
});
},
flowSelector);
return registration;
}