// Path: app/src/main/java/gdg/devfest/passwordmanager/framework/PasswordManagerActivity.java
// public abstract class PasswordManagerActivity<B extends ViewDataBinding, VM extends ViewModel>
//     extends ToolbarActivity<B, VM> {
// 
//   @CallSuper @Override protected void onInitBinding() {
//     binding.setVariable(BR.viewModel, viewModel);
//   }
// }
// 
// Path: app/src/pro/java/gdg/devfest/passwordmanager/framework/ProNavigator.java
// public class ProNavigator extends Navigator {
//   public ProNavigator(AppCompatActivity activity) {
//     super(activity);
//   }
// 
//   public void startPasswordList() {
//     activity.startActivity(new Intent(activity, PasswordListActivity.class));
//   }
// }
// 
// Path: app/src/pro/java/gdg/devfest/passwordmanager/model/LoginInteractor.java
// public class LoginInteractor {
//   private static final String AUTH_URL = "http://" + BuildConfig.REALM + "/auth";
//   private static final String SERVER_URL = "realm://" + BuildConfig.REALM + "/~/default";
// 
//   public Single<User> signIn(String userName, String password) {
//     return login(userName, password, false);
//   }
// 
//   public Single<User> signUp(String userName, String password) {
//     return login(userName, password, true);
//   }
// 
//   public void setRealmSyncConfiguration(User user) {
//     SyncConfiguration configuration = new SyncConfiguration.Builder(user, SERVER_URL).build();
//     Realm.setDefaultConfiguration(configuration);
//   }
// 
//   @NonNull private Single<User> login(String userName, String password, boolean createUser) {
//     return Single.create(singleSubscriber -> {
//       try {
//         Credentials credentials = Credentials.usernamePassword(userName, password, createUser);
//         User user = User.login(credentials, AUTH_URL);
//         singleSubscriber.onSuccess(user);
//       } catch (Exception e) {
//         singleSubscriber.onError(e);
//       }
//     });
//   }
// }
// 
// Path: app/src/pro/java/gdg/devfest/passwordmanager/viewmodel/LoginViewModel.java
// public class LoginViewModel implements ViewModel {
//   private final LoginInteractor interactor;
//   private final ProNavigator navigator;
// 
//   public final ObservableField<String> email;
//   public final ObservableField<String> password;
//   public final ObservableField<String> passwordRepeat;
//   public final ObservableBoolean inProgress;
// 
//   public LoginViewModel(LoginInteractor interactor, ProNavigator navigator) {
//     this.interactor = interactor;
//     this.navigator = navigator;
// 
//     email = new ObservableField<>();
//     password = new ObservableField<>();
//     passwordRepeat = new ObservableField<>();
//     inProgress = new ObservableBoolean();
//   }
// 
//   public void signIn() {
//     inProgress.set(true);
// 
//     interactor.signIn(email.get(), password.get())
//         .subscribeOn(Schedulers.io())
//         .observeOn(AndroidSchedulers.mainThread())
//         .subscribe(this::onAuthenticated);
//   }
// 
//   public void signUp() {
//     inProgress.set(true);
// 
//     interactor.signUp(email.get(), password.get())
//         .subscribeOn(Schedulers.io())
//         .observeOn(AndroidSchedulers.mainThread())
//         .subscribe(this::onAuthenticated);
//   }
// 
//   private void onAuthenticated(User user){
//     inProgress.set(false);
// 
//     interactor.setRealmSyncConfiguration(user);
// 
//     navigator.startPasswordList();
//     navigator.finish();
//   }
// }


import gdg.devfest.passwordmanager.databinding.LoginActivityBinding;
import gdg.devfest.passwordmanager.framework.PasswordManagerActivity;
import gdg.devfest.passwordmanager.framework.ProNavigator;
import gdg.devfest.passwordmanager.model.LoginInteractor;
import gdg.devfest.passwordmanager.viewmodel.LoginViewModel;
package gdg.devfest.passwordmanager.view;


public class LoginActivity extends PasswordManagerActivity<LoginActivityBinding, LoginViewModel> {
  @Override protected LoginViewModel createViewModel() {
// Path: app/src/main/java/gdg/devfest/passwordmanager/framework/PasswordManagerActivity.java
// public abstract class PasswordManagerActivity<B extends ViewDataBinding, VM extends ViewModel>
//     extends ToolbarActivity<B, VM> {
// 
//   @CallSuper @Override protected void onInitBinding() {
//     binding.setVariable(BR.viewModel, viewModel);
//   }
// }
// 
// Path: app/src/pro/java/gdg/devfest/passwordmanager/framework/ProNavigator.java
// public class ProNavigator extends Navigator {
//   public ProNavigator(AppCompatActivity activity) {
//     super(activity);
//   }
// 
//   public void startPasswordList() {
//     activity.startActivity(new Intent(activity, PasswordListActivity.class));
//   }
// }
// 
// Path: app/src/pro/java/gdg/devfest/passwordmanager/model/LoginInteractor.java
// public class LoginInteractor {
//   private static final String AUTH_URL = "http://" + BuildConfig.REALM + "/auth";
//   private static final String SERVER_URL = "realm://" + BuildConfig.REALM + "/~/default";
// 
//   public Single<User> signIn(String userName, String password) {
//     return login(userName, password, false);
//   }
// 
//   public Single<User> signUp(String userName, String password) {
//     return login(userName, password, true);
//   }
// 
//   public void setRealmSyncConfiguration(User user) {
//     SyncConfiguration configuration = new SyncConfiguration.Builder(user, SERVER_URL).build();
//     Realm.setDefaultConfiguration(configuration);
//   }
// 
//   @NonNull private Single<User> login(String userName, String password, boolean createUser) {
//     return Single.create(singleSubscriber -> {
//       try {
//         Credentials credentials = Credentials.usernamePassword(userName, password, createUser);
//         User user = User.login(credentials, AUTH_URL);
//         singleSubscriber.onSuccess(user);
//       } catch (Exception e) {
//         singleSubscriber.onError(e);
//       }
//     });
//   }
// }
// 
// Path: app/src/pro/java/gdg/devfest/passwordmanager/viewmodel/LoginViewModel.java
// public class LoginViewModel implements ViewModel {
//   private final LoginInteractor interactor;
//   private final ProNavigator navigator;
// 
//   public final ObservableField<String> email;
//   public final ObservableField<String> password;
//   public final ObservableField<String> passwordRepeat;
//   public final ObservableBoolean inProgress;
// 
//   public LoginViewModel(LoginInteractor interactor, ProNavigator navigator) {
//     this.interactor = interactor;
//     this.navigator = navigator;
// 
//     email = new ObservableField<>();
//     password = new ObservableField<>();
//     passwordRepeat = new ObservableField<>();
//     inProgress = new ObservableBoolean();
//   }
// 
//   public void signIn() {
//     inProgress.set(true);
// 
//     interactor.signIn(email.get(), password.get())
//         .subscribeOn(Schedulers.io())
//         .observeOn(AndroidSchedulers.mainThread())
//         .subscribe(this::onAuthenticated);
//   }
// 
//   public void signUp() {
//     inProgress.set(true);
// 
//     interactor.signUp(email.get(), password.get())
//         .subscribeOn(Schedulers.io())
//         .observeOn(AndroidSchedulers.mainThread())
//         .subscribe(this::onAuthenticated);
//   }
// 
//   private void onAuthenticated(User user){
//     inProgress.set(false);
// 
//     interactor.setRealmSyncConfiguration(user);
// 
//     navigator.startPasswordList();
//     navigator.finish();
//   }
// }


// Path: app/src/pro/java/gdg/devfest/passwordmanager/view/LoginActivity.java
import gdg.devfest.passwordmanager.databinding.LoginActivityBinding;
import gdg.devfest.passwordmanager.framework.PasswordManagerActivity;
import gdg.devfest.passwordmanager.framework.ProNavigator;
import gdg.devfest.passwordmanager.model.LoginInteractor;
import gdg.devfest.passwordmanager.viewmodel.LoginViewModel;

package gdg.devfest.passwordmanager.view;


public class LoginActivity extends PasswordManagerActivity<LoginActivityBinding, LoginViewModel> {
  @Override protected LoginViewModel createViewModel() {
    return new LoginViewModel(new LoginInteractor(), new ProNavigator(this));