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

chore: provide a way to make previews with scoped view models #2414

Merged
merged 6 commits into from Nov 14, 2023

Conversation

saleniuk
Copy link
Contributor

@saleniuk saleniuk commented Nov 10, 2023


PR Submission Checklist for internal contributors

  • The PR Title

    • conforms to the style of semantic commits messages¹ supported in Wire's Github Workflow²
    • contains a reference JIRA issue number like SQPIT-764
    • answers the question: If merged, this PR will: ... ³
  • The PR Description

    • is free of optional paragraphs and you have filled the relevant parts to the best of your ability

What's new in this PR?

Issues

Currently, previews for all composables that have some elements which use scoped view models does not work.

Causes (Optional)

It requires to inject a view model using hilt which is not possible for previews.

Solutions

Create annotation @ViewModelScopedPreview to mark all view model interfaces that should have the "preview" object.
These interfaces need to have default implementations.
KSP will generate a "preview" data object with these default implementations and create a list of all "preview" objects for all view model interfaces that are marked with this annotation.
hiltViewModelScoped checks if it's a preview, and if so then it takes a "preview" object, otherwise it injects the proper view model using hilt.

image image

PR Post Submission Checklist for internal contributors (Optional)

  • Wire's Github Workflow has automatically linked the PR to a JIRA issue

PR Post Merge Checklist for internal contributors

  • If any soft of configuration variable was introduced by this PR, it has been added to the relevant documents and the CI jobs have been updated.

References
  1. https://sparkbox.com/foundry/semantic_commit_messages
  2. https://github.com/wireapp/.github#usage
  3. E.g. feat(conversation-list): Sort conversations by most emojis in the title #SQPIT-764.

Copy link
Contributor

github-actions bot commented Nov 10, 2023

Test Results

680 tests  ±0   680 ✔️ ±0   10m 22s ⏱️ + 4m 46s
  98 suites ±0       0 💤 ±0 
  98 files   ±0       0 ±0 

Results for commit 0096670. ± Comparison against base commit faf8286.

♻️ This comment has been updated with latest results.

@AndroidBob
Copy link
Collaborator

Build 1746 failed.

Copy link

codecov bot commented Nov 10, 2023

Codecov Report

Merging #2414 (0096670) into develop (faf8286) will increase coverage by 0.00%.
Report is 1 commits behind head on develop.
The diff coverage is 26.66%.

@@            Coverage Diff             @@
##             develop    #2414   +/-   ##
==========================================
  Coverage      41.48%   41.49%           
+ Complexity      1085     1080    -5     
==========================================
  Files            344      344           
  Lines          12430    12429    -1     
  Branches        1632     1633    +1     
==========================================
  Hits            5157     5157           
+ Misses          6788     6787    -1     
  Partials         485      485           
Files Coverage Δ
...poser/attachments/IsFileSharingEnabledViewModel.kt 0.00% <0.00%> (ø)
...ui/home/conversations/CompositeMessageViewModel.kt 88.88% <60.00%> (-11.12%) ⬇️
...d/ui/connection/ConnectionActionButtonViewModel.kt 74.48% <11.11%> (+0.75%) ⬆️

Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update faf8286...0096670. Read the comment docs.

Copy link
Contributor

APKs built during tests are available here. Scroll down to Artifacts!

@AndroidBob
Copy link
Collaborator

Build 1752 succeeded.

The build produced the following APK's:

@saleniuk saleniuk requested review from Garzas, a team, alexandreferris, borichellow, MohamadJaara and vitorhugods and removed request for a team November 10, 2023 17:25
Copy link
Contributor

@Garzas Garzas left a comment

Choose a reason for hiding this comment

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

Wow great automation 🥇

Copy link
Contributor

@alexandreferris alexandreferris left a comment

Choose a reason for hiding this comment

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

👏🏻

@saleniuk saleniuk added this pull request to the merge queue Nov 14, 2023
Merged via the queue into develop with commit 3fbff9b Nov 14, 2023
16 checks passed
@saleniuk saleniuk deleted the chore/fix-scoped-viewmodels-previews branch November 14, 2023 12:47
MohamadJaara added a commit that referenced this pull request Feb 12, 2024
* fix: some end points are not routed through the proxy server

* fix cli

* fix android sample

* fix test service

* detekt

* fix ios target

* fix tests

* refactor: reimplement update api versions usecase to use proxy (#2414)

* refactor: implement UpdateApiVersionsUseCaseImpl to be proxy safe

* feat: add proxy URL and need auth indication to custom server dialogs

* fix tests

(cherry picked from commit b1f14574e945e276fe275acce468346d755a97a3)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
4 participants