Last active
February 20, 2018 16:39
-
-
Save PoisonousJohn/e2f9a6dff1994793ad5088c72ef1efa8 to your computer and use it in GitHub Desktop.
Offline emulation mode per Service's method
This file contains hidden or 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 static class Services | |
{ | |
public static bool isOffline | |
{ | |
get; set; | |
} | |
} | |
public class APIService | |
{ | |
public string UserId | |
{ | |
get | |
{ | |
if (Services.isOffline) | |
{ | |
return "offlineUser"; | |
} | |
return _userId; | |
} | |
} | |
public void Login() | |
{ | |
if (Services.isOffline) | |
{ | |
return; | |
} | |
// send request to server here | |
} | |
private string _userId; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment