Skip to content

[New arch] Use Moshi to parse capabilities and get rid of RemoteCapability in library? #2716

@davigonz

Description

@davigonz

GetRemoteCapabilitiesOperation.kt takes care of parsing the capabilities retrieved from the server in JSON format and transform them into RemoteCapability object.

Similarly to what we detailed in #2704, we could use Moshi to make the parsing of capabilities.

IN ADDITION

Since RemoteCapability object and OCCapability (domain model) objects are going to represent basically the same (when modularization is finished), we could get rid of RemoteCapability and parse the JSON directly to OCCapability from the data layer.

Parsing JSON and transforming it to domain models in data layer is the most common scenario when connecting with external APIs but ownCloud for Android is a special case, we have an intermediate layer between the oC server and our app, which is the ownCloud Android Library. This library is meant to make the life easier to those interested in communicate an Android app with ownCloud servers.

If we remove RemoteCapability from the ownCloud Android Library, the apps using it will receive just JSON and would need to parse it, so maybe is not the best idea if the aim of the library is "integrating your Android application with ownCloud seamlessly." 🤔

Tasks:

  • Move capabilities parsing from library to data layer, that will parse the JSON and transform it into OCCapability object. This OCCapability object is the domain model that will be retrieved from the data layer.
  • Get rid of RemoteCapability class in library since is basically the same as OCCapability

PR

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions