Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement a more scoped API to the Session interface #5816

Merged
merged 8 commits into from
Apr 26, 2022

Conversation

bmarty
Copy link
Member

@bmarty bmarty commented Apr 21, 2022

Type of change

  • Feature
  • Bugfix
  • Technical
  • Other :

Content

Session does not directly implement the various services anymore. Now the services are accessible with a getter. It improves the SDK api, and makes it homogeneous.

A few extensions has been added to still be able to do session.getRoom(roomId) for instance.

Also the search method from the Room interface has been removed. It was a shortcut.

Motivation and context

Have a nicer scoped completion when using the SDK, and make the SDK api more user friendly:

Before After
image imageimage

Screenshots / GIFs

Tests

  • Smoke test

Tested devices

  • Physical
  • Emulator
  • OS version(s):

@bmarty bmarty requested review from a team and fedrunov and removed request for a team April 21, 2022 18:12
@github-actions
Copy link

github-actions bot commented Apr 21, 2022

Unit Test Results

114 files  114 suites   1m 20s ⏱️
202 tests 202 ✔️ 0 💤 0
678 runs  678 ✔️ 0 💤 0

Results for commit 6ee0b62.

♻️ This comment has been updated with latest results.

@bmarty bmarty force-pushed the feature/bma/sdk_doc_update branch from 7c54d97 to 10434e7 Compare April 21, 2022 19:10
@bmarty bmarty force-pushed the feature/bma/sdk_doc_update branch from 10434e7 to 4af883f Compare April 25, 2022 07:50
@fedrunov
Copy link
Contributor

I don't understand purpose of session in this implementation: why would I inject session and call session.roomService() if i can just inject roomService and use its methods?

@bmarty
Copy link
Member Author

bmarty commented Apr 26, 2022

I don't understand purpose of session in this implementation: why would I inject session and call session.roomService() if i can just inject roomService and use its methods?

Session is the current entry point to a Matrix account. It's still possible to inject app side a RoomService, by providing a method providesCurrentRoomService into VectorStaticModule as per providesCurrentSession for instance (this is out of scope of this PR).

We can discuss and make some changes in the future when we will be supporting multi-account.

Copy link
Contributor

@fedrunov fedrunov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks for explanation

@bmarty bmarty enabled auto-merge April 26, 2022 14:17
@bmarty bmarty merged commit d694ea1 into develop Apr 26, 2022
@bmarty bmarty deleted the feature/bma/sdk_doc_update branch April 26, 2022 15:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants