diff --git a/app/src/main/java/com/example/sprout/refactor/registration.puml b/app/src/main/java/com/example/sprout/refactor/registration.puml new file mode 100644 index 0000000..306393a --- /dev/null +++ b/app/src/main/java/com/example/sprout/refactor/registration.puml @@ -0,0 +1,60 @@ +@startuml + +class ModelLocator{ + registrationRepository : RegistrationRepository +} +class AppCompatActivity +interface ViewContract{ + void startActivity() + void finishActivity() + void showShortToast(String message) + void showLongToast(String message) +} +interface LifecycleObserver +class Repository +class RegistrationRepository{ + void registration(String userName) + accountObservable : Observable +} +class RegistrationService{ + @POST Call registration(String userName) +} +class RegistrationActivity +class RegistrationViewModel{ + userName : ObservableField + registrationRepository : RegistrationRepository + viewContract : ViewContract + observer: Observer + void onClickRegistration(String userName) + void onResume() + void onPause() +} + +abstract class Observable{ + observers : ArrayList> + void addObserver(Observer observer) + void removeObserver(Observer observer) + void notifyObservers(T t) + void notifyError(Throwable t) +} + +abstract class Observer{ + void notify(T t) + void error(Throwable t) +} + +ModelLocator o-- RegistrationRepository +Repository <|-- RegistrationRepository +Repository o-- OkHttpClient +RegistrationViewModel o-- RegistrationRepository +RegistrationRepository o-- RegistrationService + +AppCompatActivity <|-down- RegistrationActivity +ViewContract <|.down. RegistrationActivity +RegistrationActivity o-down- RegistrationViewModel +LifecycleObserver <|.down. RegistrationViewModel +RegistrationViewModel o-up- ViewContract + +RegistrationViewModel o-- Observer +RegistrationRepository o-- Observable +@enduml \ No newline at end of file