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 = {}; const result = {};
for (const flow of flows) { for (const flow of flows) {
if (flow.type === "m.login.password") { 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; return result;

View File

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

View File

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