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

Refactor static access #4729

Merged
merged 10 commits into from
Mar 17, 2023
Merged

Refactor static access #4729

merged 10 commits into from
Mar 17, 2023

Conversation

JcMinarro
Copy link
Member

@JcMinarro JcMinarro commented Mar 14, 2023

🎯 Goal

We were using some classes with the old approach to have it as a singleton and obtain it by get() method returning an exception if it wasn't initialized yet.
This old way is not needed anymore as we have our own "DepencencyResolver" to find dependencies from plugins that were added to the SDK.
Fix: #4717

🛠 Implementation details

Configure StatePlugin to provide needed dependencies.
ChatClient::resolveDependency() method has been update to provide better error on the case plugins wasn't initialized properly

☑️Contributor Checklist

General

  • I have signed the Stream CLA (required)
  • Assigned a person / code owner group (required)
  • Thread with the PR link started in a respective Slack channel (#android-chat-core or #android-chat-ui) (required)
  • PR targets the develop branch
  • PR is linked to the GitHub issue it resolves

Code & documentation

  • Changelog is updated with client-facing changes
  • New code is covered by unit tests
  • Comparison screenshots added for visual changes
  • Affected documentation updated (KDocs, docusaurus, tutorial)

☑️Reviewer Checklist

  • UI Components sample runs & works
  • Compose sample runs & works
  • UI Changes correct (before & after images)
  • Bugs validated (bugfixes)
  • New feature tested and works
  • Release notes and docs clearly describe changes
  • All code we touched has new or updated KDocs

🎉 GIF

@JcMinarro JcMinarro force-pushed the refactor-static-access branch 2 times, most recently from 5ffa2f5 to 7c7c962 Compare March 15, 2023 09:43
@JcMinarro JcMinarro added the merge before v6 release This ticket needs to be merged before we can proceed with the v6 release label Mar 15, 2023
Copy link
Contributor

@MarinTolic MarinTolic left a comment

Choose a reason for hiding this comment

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

Unfortunately, I get the crash reported in the issue when launching the Compose sample app on an API 28 emulator.

Please keep in mind that it's not perfectly repeatable. It happens often after a clean install, but not always.

@JcMinarro JcMinarro force-pushed the refactor-static-access branch 3 times, most recently from 917bdd1 to 21f5407 Compare March 16, 2023 17:32
Copy link
Contributor

@MarinTolic MarinTolic left a comment

Choose a reason for hiding this comment

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

☑️Reviewer Checklist

  • UI Components sample runs & works
  • Compose sample runs & works
  • UI Changes correct (before & after images)
  • Bugs validated (bugfixes)
  • New feature tested and works
  • Release notes and docs clearly describe changes
  • All code we touched has new or updated KDocs

@JcMinarro JcMinarro enabled auto-merge (rebase) March 17, 2023 10:31
Copy link
Contributor

@leandroBorgesFerreira leandroBorgesFerreira left a comment

Choose a reason for hiding this comment

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

Please address the comment and this is good to me.

@JcMinarro JcMinarro merged commit 1592e15 into develop Mar 17, 2023
@JcMinarro JcMinarro deleted the refactor-static-access branch March 17, 2023 16:33
@@ -205,7 +204,7 @@ private fun <T> ChatClient.getStateOrNull(
*/
@CheckResult
public fun ChatClient.setMessageForReply(cid: String, message: Message?): Call<Unit> {
return CoroutineCall(state.scope) {
return CoroutineCall(inheritScope { SupervisorJob(it) }) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Hey @JcMinarro

Would you mind replacing SupervisorJob with Job?
I assume we don't need to supervise anything.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merge before v6 release This ticket needs to be merged before we can proceed with the v6 release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants