1 min read

Customisations

Add custom data to Listing

To add custom data to the Listing model you need to:

  1. Receive your custom data in the network model NetworkListing.
  2. Create a new implementation of Mapper<Any, Map<String, Any>>.
  3. Provide your new mapper via Koin using the name productListingCustomMapToAnyMapperName.

Add custom data to Filter

To add extra data to a specific Filter type model:

  1. Receive your custom data in the network model NetworkFilter.
  2. Create a new implementation of Mapper<Any, Map<String, Any>>.
  3. Provide your new mapper via Koin for the specific Filter type using the appropriate name:
    • Filter price: customDataFilterPriceMapperName
    • Filter toggle: customDataFilterToggleMapperName
    • Filter multi selection: customDataFilterMultiSelectionMapperName

Add custom Filter type

To add extra data Filter types to your filter screen:

  1. Receive your custom type in the network model NetworkFilter.
  2. Provide a new implementation of Mapper<Filter.Custom?, NetworkFilter?>.
  3. Provide your new mapper via Koin using the name networkToDomainFilterCustomMapperName.
  4. Provide a new implementation of DomainToUiFilterCustomMapper if you support more than 1 new custom Filter type.
  5. Provide a new implementation of UiFilterCustomViewHolderFactory where you can create as many view holders as custom Filter types you support.

Custom SearchType

Adding a custom SearchType allows you to send different information to your backend from the one that the SDK does.

To add a custom SearchType:

  1. Define a new model CustomSearchType that represents your extra fields.
  2. Provide a new implementation of Mapper<Map<String, String>, SearchType.Custom> returning a map with the query paramenters that your new SearchType requires.
  3. Provide your new mapper via Koin using the name domainToNetworkSearchTypeCustomMapperName
    factory<Mapper<Map<String, String>, SearchType.Custom>>(named(domainToNetworkSearchTypeCustomMapperName), override = true) {
    CustomSearchTypeMapper()
    }
  4. Call ProductListViewModel.loadProductList with your new SearchType