Skip to content

Instantly share code, notes, and snippets.

@PoisonousJohn
Last active February 20, 2018 16:39
Show Gist options
  • Save PoisonousJohn/e2f9a6dff1994793ad5088c72ef1efa8 to your computer and use it in GitHub Desktop.
Save PoisonousJohn/e2f9a6dff1994793ad5088c72ef1efa8 to your computer and use it in GitHub Desktop.
Offline emulation mode per Service's method
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