Repository navigation
Closed
Labels
Description
Specific issue to start modularizing the app, following the guidelines defined in #2351
- Tasks
- Split up code into different modules following a layers approach and move the corresponding shares code to those modules:
- Presentation layer => owncloudApp module
- Domain layer => owncloudDomain module
- Data layer => owncloudData module
- Use mockk instead of mockito in UI and domain unit tests, more prepared to work with Kotlin instead of Java.
- Transform sharing operations into usecases in domain model.
- Decouple data and domain modules with the help of dependency injection (Koin). Domain should not depend on data layer directly => Difficult to achieve due to strong ownCloud Client dependencies that force us to use instances of repositories in domain layer when we should use repository interfaces.
- Create share data and domain models with some Mapper classes to transform them.
- Create capability data and domain models with some Mapper classes to transform them.
- Error handling, + info in [SPIKE] Error and data handling inside new architecture modularization #2665
- Create new services as facade for remote operations to decouple that logic from remote datasources and ease remote datasource and repository tests
- Fix already existing tests: unit and UI. Use corresponding share models in TestUtils.
- Data layer
- Datasources
- Repositories
- Mappers (model-entities, model-remote)
- Entity
- DAOs
- Domain layer
- Usecases
- Presentation layer
- ViewModel Tests
- UI tests
- Data layer
- New tests for usecases
- New tests for models
- Use StandAloneContext.loadKoinModules. See [New arch] Private shares: edition and deletion #2603 (comment)
- Split up code into different modules following a layers approach and move the corresponding shares code to those modules:
PRs
Pending issues (create separate ones?)
- Consider adding a new module just for data testing.
- Consider renaming usecases to Fetch...() instead of Refresh...FromServer()
Bugs and improvements
- (1) Error is shown again when rotating the device [New arch] Modularization, decoupling and new error handling #2607 (comment)
- (2) Users and groups search doesn't work
[New arch] Modularization, decoupling and new error handling #2607 (comment) [FIXED]
Activity
[-][New arch] Shares modularization and decoupling[/-][+][New arch] Modularization and decoupling[/+][-][New arch] Modularization and decoupling[/-][+][New arch] Modularization, decoupling and new error handling[/+]davigonz commentedon Nov 6, 2019
[BUG] (1) Error is shown again when rotating the device
Current behavior: Error is shown again and the user has not done any request.
Expected behavior: No error is shown
davigonz commentedon Nov 6, 2019
[FIXED] (2) Users and groups search doesn't work
Current behavior: No results
Expected behavior: Users or groups appear
2019-11-06 13:19:05.425 26092-26488/com.owncloud.android.debug W/SuggestionsAdapter: Search suggestions query threw an exception. java.lang.IllegalStateException: Cannot invoke observeForever on a background thread at androidx.lifecycle.LiveData.assertMainThread(LiveData.java:461) at androidx.lifecycle.LiveData.observeForever(LiveData.java:222) at com.owncloud.android.presentation.viewmodels.capabilities.OCCapabilityViewModel.<init>(OCCapabilityViewModel.kt:69) at com.owncloud.android.presentation.viewmodels.capabilities.OCCapabilityViewModel.<init>(OCCapabilityViewModel.kt:49) at com.owncloud.android.presentation.providers.sharing.UsersAndGroupsSearchProvider.searchForUsersOrGroups(UsersAndGroupsSearchProvider.kt:128) atdavigonz commentedon Dec 11, 2019
Merged, great job guys!! @abelgardep @jesmrec @jcmontesmartos
hannesa2 commentedon Dec 12, 2019
Are there plans to convert/replace
UserProfilesRepository,FileDataStorageManagerandProviderMetaby a room solution ?abelgardep commentedon Dec 12, 2019
For sure, the idea is to migrate the app completely to the new architecture. That means using Room as it is already done with shares functionality. Step by step 👍
davigonz commentedon Dec 12, 2019
In addition to what @abelgardep says
Yes, but is going to be done by features, I mean:
- FileDataStorageManager: we already removed all the sharing methods from there (~500 lines). We will continue replacing the old implementation in coming issues: files, uploads, camera uploads...
- ProviderMeta: the idea is to keep it in the data layer but just with information required by the room solution.
- UserProfilesRepository: same, we will convert it.
By the way, now that the new architecture is on master, any contribution is welcome 😉