Created
May 15, 2017 17:02
-
-
Save bitsydarel/fcf500091cbf6eb96ab5cd1caea631ff to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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