// Path: app/src/main/java/com/wiseass/profiler/data/auth/AuthSource.java
// public interface AuthSource {
// 
//     Completable createAccount(Credentials cred);
// 
//     Completable attemptLogin(Credentials cred);
// 
//     Completable deleteUser();
// 
//     Maybe<User> getUser();
// 
//     Completable logUserOut();
// 
//     Completable reauthenticateUser(String password);
// 
//     void setReturnFail(boolean bool);
// }
// 
// Path: app/src/main/java/com/wiseass/profiler/data/auth/Credentials.java
// public class Credentials {
//     private String password;
//     private String username;
//     private String email;
// 
//     public Credentials(String password, String username, String email) {
//         this.password = password;
//         this.username = username;
//         this.email = email;
//     }
// 
//     public String getPassword() {
//         return password;
//     }
// 
//     public void setPassword(String password) {
//         this.password = password;
//     }
// 
//     public String getUsername() {
//         return username;
//     }
// 
//     public void setUsername(String username) {
//         this.username = username;
//     }
// 
//     public String getEmail() {
//         return email;
//     }
// 
//     public void setEmail(String email) {
//         this.email = email;
//     }
// }
// 
// Path: app/src/main/java/com/wiseass/profiler/data/auth/User.java
// public class User {
//     private String email;
//     private String userId;
// 
//     public User(String email, String userId) {
//         this.email = email;
//         this.userId = userId;
//     }
// 
//     public String getEmail() {
//         return email;
//     }
// 
//     public void setEmail(String email) {
//         this.email = email;
//     }
// 
//     public String getUserId() {
//         return userId;
//     }
// 
//     public void setUserId(String userId) {
//         this.userId = userId;
//     }
// }
// 
// Path: app/src/main/java/com/wiseass/profiler/util/BaseSchedulerProvider.java
// public interface BaseSchedulerProvider {
// 
//     Scheduler computation();
// 
//     Scheduler io();
// 
//     Scheduler ui();
// }


import com.wiseass.profiler.R;
import com.wiseass.profiler.data.auth.AuthSource;
import com.wiseass.profiler.data.auth.Credentials;
import com.wiseass.profiler.data.auth.User;
import com.wiseass.profiler.util.BaseSchedulerProvider;
import io.reactivex.disposables.CompositeDisposable;
import io.reactivex.observers.DisposableCompletableObserver;
import io.reactivex.observers.DisposableMaybeObserver;
                            public void onComplete() {
                                view.showProgressIndicator(false);
                                view.startProfileActivity();
                            }

                            @Override
                            public void onError(Throwable e) {
                                view.showProgressIndicator(false);
                                view.makeToast(e.toString());
                            }
                        })
        );
    }

    /**
     * When this Activity first starts, check and see if there is a currently logged in user.
     * If so, send the user to their Profile Page.
     */
    public void getUser() {
        view.showProgressIndicator(true);
        compositeDisposable.add(
                authSource.getUser()
                        .subscribeOn(schedulerProvider.io())
                        .observeOn(schedulerProvider.ui())
                        .subscribeWith(new DisposableMaybeObserver<User>() {
                            /**
                             * If a uses is found, send them straight to their profile
                             * @param user
                             */
                            @Override
// Path: app/src/main/java/com/wiseass/profiler/data/auth/AuthSource.java
// public interface AuthSource {
// 
//     Completable createAccount(Credentials cred);
// 
//     Completable attemptLogin(Credentials cred);
// 
//     Completable deleteUser();
// 
//     Maybe<User> getUser();
// 
//     Completable logUserOut();
// 
//     Completable reauthenticateUser(String password);
// 
//     void setReturnFail(boolean bool);
// }
// 
// Path: app/src/main/java/com/wiseass/profiler/data/auth/Credentials.java
// public class Credentials {
//     private String password;
//     private String username;
//     private String email;
// 
//     public Credentials(String password, String username, String email) {
//         this.password = password;
//         this.username = username;
//         this.email = email;
//     }
// 
//     public String getPassword() {
//         return password;
//     }
// 
//     public void setPassword(String password) {
//         this.password = password;
//     }
// 
//     public String getUsername() {
//         return username;
//     }
// 
//     public void setUsername(String username) {
//         this.username = username;
//     }
// 
//     public String getEmail() {
//         return email;
//     }
// 
//     public void setEmail(String email) {
//         this.email = email;
//     }
// }
// 
// Path: app/src/main/java/com/wiseass/profiler/data/auth/User.java
// public class User {
//     private String email;
//     private String userId;
// 
//     public User(String email, String userId) {
//         this.email = email;
//         this.userId = userId;
//     }
// 
//     public String getEmail() {
//         return email;
//     }
// 
//     public void setEmail(String email) {
//         this.email = email;
//     }
// 
//     public String getUserId() {
//         return userId;
//     }
// 
//     public void setUserId(String userId) {
//         this.userId = userId;
//     }
// }
// 
// Path: app/src/main/java/com/wiseass/profiler/util/BaseSchedulerProvider.java
// public interface BaseSchedulerProvider {
// 
//     Scheduler computation();
// 
//     Scheduler io();
// 
//     Scheduler ui();
// }


// Path: app/src/main/java/com/wiseass/profiler/login/LoginPresenter.java
import com.wiseass.profiler.R;
import com.wiseass.profiler.data.auth.AuthSource;
import com.wiseass.profiler.data.auth.Credentials;
import com.wiseass.profiler.data.auth.User;
import com.wiseass.profiler.util.BaseSchedulerProvider;
import io.reactivex.disposables.CompositeDisposable;
import io.reactivex.observers.DisposableCompletableObserver;
import io.reactivex.observers.DisposableMaybeObserver;

                            public void onComplete() {
                                view.showProgressIndicator(false);
                                view.startProfileActivity();
                            }

                            @Override
                            public void onError(Throwable e) {
                                view.showProgressIndicator(false);
                                view.makeToast(e.toString());
                            }
                        })
        );
    }

    /**
     * When this Activity first starts, check and see if there is a currently logged in user.
     * If so, send the user to their Profile Page.
     */
    public void getUser() {
        view.showProgressIndicator(true);
        compositeDisposable.add(
                authSource.getUser()
                        .subscribeOn(schedulerProvider.io())
                        .observeOn(schedulerProvider.ui())
                        .subscribeWith(new DisposableMaybeObserver<User>() {
                            /**
                             * If a uses is found, send them straight to their profile
                             * @param user
                             */
                            @Override
                            public void onSuccess(User user) {