Pass log as argument

Signed-off-by: RMidhunSuresh <rmidhunsuresh@gmail.com>
This commit is contained in:
RMidhunSuresh 2021-08-02 15:30:21 +05:30
parent 9651817c5b
commit f3946fcdf3
3 changed files with 5 additions and 8 deletions

View file

@ -106,7 +106,7 @@ export class SessionContainer {
const result = {};
for (const flow of flows) {
if (flow.type === "m.login.password") {
result.password = (username, password) => new PasswordLoginMethod({homeServer, username, password, platform: this._platform});
result.password = (username, password) => new PasswordLoginMethod({homeServer, username, password});
}
}
return result;

View file

@ -15,13 +15,12 @@ limitations under the License.
*/
export class LoginMethod {
constructor({homeServer, platform}) {
constructor({homeServer}) {
this.homeServer = homeServer;
this._platform = platform;
}
// eslint-disable-next-line no-unused-vars
async login(hsApi, deviceName) {
async login(hsApi, deviceName, log) {
/*
Regardless of the login method, SessionContainer.startWithLogin()
can do SomeLoginMethod.login()

View file

@ -23,9 +23,7 @@ export class PasswordLoginMethod extends LoginMethod {
this.password = options.password;
}
async login(hsApi, deviceName) {
return this._platform.logger.run("passwordLogin", async log =>
await hsApi.passwordLogin(this.username, this.password, deviceName, {log}).response()
);
async login(hsApi, deviceName, log) {
return await hsApi.passwordLogin(this.username, this.password, deviceName, {log}).response();
}
}