Skip to content

Instantly share code, notes, and snippets.

@bitsydarel
Created May 15, 2017 17:02
Show Gist options
  • Save bitsydarel/fcf500091cbf6eb96ab5cd1caea631ff to your computer and use it in GitHub Desktop.
Save bitsydarel/fcf500091cbf6eb96ab5cd1caea631ff to your computer and use it in GitHub Desktop.
public interface IAuthProvider {
public login() {}
public logout() {}
public singup() {}
}
public interface IAuthManager {
IAuthProvider provider;
IAuthManager() {}
IAuthManager(IAuthProvider provider) {
this.provider = provider
}
setAuthProvider(IAuthProvider provider){}
public logIn() { provider.login() }
public logout() { provider.logout() }
public signUp() { provider.signup() }
...
}
public class Presenter {
Presenter(IAuthManager manager) {
this.manager = manager;
}
onAuthSelected(IAuthProvider provider, TYPE.LOGIN typeOfConnection) {
manager.setAuthManager(provider);
if(typeOfConnection == LOGIN) { manager.login() }
....
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment