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, createNavigation,
createRouter, createRouter,
RoomViewModel, RoomViewModel,
TimelineView TimelineView,
viewClassForTile
} from "hydrogen-view-sdk"; } from "hydrogen-view-sdk";
import downloadSandboxPath from 'hydrogen-view-sdk/download-sandbox.html?url'; import downloadSandboxPath from 'hydrogen-view-sdk/download-sandbox.html?url';
import workerPath from 'hydrogen-view-sdk/main.js?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() { async function main() {
const app = document.querySelector<HTMLDivElement>('#app')! const app = document.querySelector<HTMLDivElement>('#app')!
const config = {}; 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(); const navigation = createNavigation();
platform.setNavigation(navigation); platform.setNavigation(navigation);
const urlRouter = createRouter({ const urlRouter = createRouter({
@ -88,7 +89,7 @@ async function main() {
navigation, navigation,
}); });
await vm.load(); await vm.load();
const view = new TimelineView(vm.timelineViewModel); const view = new TimelineView(vm.timelineViewModel, viewClassForTile);
app.appendChild(view.mount()); 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 request = this._platform.request;
const hsApi = new HomeServerApi({homeserver, request}); const hsApi = new HomeServerApi({homeserver, request});
const registration = new Registration(hsApi, { const registration = new Registration(hsApi, {
username, username,
password, password,
initialDeviceDisplayName, initialDeviceDisplayName,
}); },
flowSelector);
return registration; return registration;
} }