Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Skip to content

[DISCUSSION] New unified Result class.

Sayantan Roychowdhury requested to merge 313-new_result_class into main

Description

Modify the existing Result class to play well with existing code and accommodate new use cases, example for network timeout.

Issue(s)

https://gitlab.e.foundation/e/os/backlog/-/issues/313

Test environment

Test procedures

Technical details

Main challenge is to make Result.data non-null in all cases. This can be achieved by defining it as non-null lateinit type variable and never initializing it for error cases. In all pre-existing code we never access data for error cases, hence this should not be a problem.

Another alternative is to use the class ResultSupreme (name will be later changed). It adheres to expected patterns as observed here: https://github.com/android/architecture-samples/blob/main/app/src/main/java/com/example/android/architecture/blueprints/todoapp/data/Result.kt

Screenshots

Check list

  • Self review
  • Test procedure explained
  • Tested on fresh install
  • Tested applied as an update
  • License
  • Internal documentation
  • User documentation
Edited by Sayantan Roychowdhury

Merge request reports

Loading