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

Does mavericks-mocking support Jetpack compose? #602

Open
sanginovs opened this issue Jan 11, 2022 · 4 comments
Open

Does mavericks-mocking support Jetpack compose? #602

sanginovs opened this issue Jan 11, 2022 · 4 comments

Comments

@sanginovs
Copy link

Hi @elihart
First of all, thanks a lot for open sourcing these mocking libraries.
I am trying to setup mavericks-mocking and mavericks-launcher in our codebase and was wondering if mavericks-mocking support composable views?

@elihart
Copy link
Contributor

elihart commented Jan 11, 2022

there is no compose specific support in the mocking. if you have a mocked fragment that uses composables within its view I think it should work fine, but overall it only works with Fragments still

@sanginovs
Copy link
Author

sanginovs commented Jan 11, 2022

@elihart any plans/timeline to add compose specific support (embed in a single activity) in the near future?

I couldn't get it to work on my Activity which uses composable. Seems like the mocking library won't work if i don't have any fragments in my activity.

for reference, here's my setup. It's a single activity which uses Compose:

class MyActivty: MockableMavericksView {
       private val viewModel: XYZViewModel by activityViewModel()
       ...
       override fun provideMocks() = mockSingleViewModel(
          viewModelReference = MyActivity::viewModel,
          defaultState = MyState(...),
          defaultArgs = null) { }
        ...
        
       @ExperimentalComposeUiApi
       @ExperimentalFoundationApi
        override fun onCreate(savedInstanceState: Bundle?) { 
           registerMockPrinter()
           
           setContent {
              MyComposableView()
          }
      
       }     
}

@elihart
Copy link
Contributor

elihart commented Jan 12, 2022

This is related to #544 - right now the MavericksView interface is required.

In the coming months we will be working on compose specific support, but not timeline to promise for now

@sanginovs
Copy link
Author

thanks again @elihart. looking forward to it

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

No branches or pull requests

2 participants