RxJava-android-structure

  • C7_569128
    了解作者
  • 85.2KB
    文件大小
  • zip
    文件格式
  • 0
    收藏次数
  • VIP专享
    资源类型
  • 0
    下载次数
  • 2022-06-08 08:44
    上传日期
RxJava Android结构 该博客在Medium 解释的结构的实现 如何以Retrofit作为网络库以有组织的方式使用RxJava。 快乐之路 探索项目时,需要考虑一些事项: RegistrationAPIService会针对不同的网络错误引发多个异常(所有异常都在RegistrationFragment中处理)。 RegistrationAPIService从失败响应中获取状态代码。 LoginAPIService从成功的响应中获取状态代码。 注册后,我们将登录用户。 登录后,我们将获取用户数据。 我们允许Pull在Home Activity中刷新(这意味着我们将必须为每个请求创建不同的Subject / Subscriber)。 当两个请求都到来时,我们将处理用户数据信息。 如果其中之一失败,我们就不想更新数据。 设置 注册成功后,它将在SharedPreferen
RxJava-android-structure-master.zip
内容介绍
# RxJava Android Structure Implementation of the structure explained in this blog in Medium https://medium.com/@manuelvicnt/rxjava-android-mvvm-app-structure-with-retrofit-a5605fa32c00 How to use RxJava in a organised way with Retrofit as the networking library. ### Happy Path There are some things to have into account when exploring the project: - RegistrationAPIService throws more than one exception for different networking errors (all are handled in the RegistrationFragment). - RegistrationAPIService gets the status code from a failure response. - LoginAPIService gets the status code from a successful response. - After Registration, we're going to log the user in. - After Login, we're going to get the user data. - We allow Pull to refresh in the Home Activity (this means we will have to create different Subjects/Subscriber per request). - We process the user data information when both request come. If one of them fails, we don't want to update the data. ### Set up When the registration is successful, it stores a value in SharedPreferences (that's how it goes to Login or Registration). To force registration, you can uninstall the app and install it again or clear cache data in the App info (Settings > Apps > Select App). ### Unit Testing RegistrationAPIService is tested. The rest of the classes can be tested in the same way. Be aware of threading problems. ### Sad Paths You can change the response of the network request with the files stored in the assets folder. Change the 200 response for a 400, for example. That gives you the ability of exploring different sad paths. One good example would be: Change the accountResponse.txt to fail (400 response instead of 200). Run the app from registration, it will fail in the account response and the login screen will appear.
评论
    相关推荐
    • RxJava使用Demo
      介绍了RxJava中Single的使用方法,有兴趣的可以下载,总结的比较全
    • Rxjava2 demo
      这个demo主要针对rxjava2.0的版本
    • rxJava
      rxJava
    • RXJava
      RXJava
    • RxJava jar
      Rxjava
    • RxJava使用
      RxJava的使用,包括just,from,map,flatMap等操作符,以及多线程的使用,链式调用和使用Lambda表达式
    • RxJava API
      RxJava api文档,初学者来说重点是看里面的各种Operators操作。
    • 关于RxJava
      根据 hi大头鬼hi 关于RxJava的介绍,写的小Demo
    • rxjava学习代码
      学习 《这可能是最好的RxJava 2.x 入门教程》而写的代码,代码有非常详细的注释,和我的个人笔记,非常适合学习java2.x的新手,就算是原作者,注释也没有这样详细
    • rxjava mvvm
      rxjava mvvm