Last active
August 21, 2018 15:30
-
-
Save alexshikov/7b3f724fdd6a98f346a0a9993229412c to your computer and use it in GitHub Desktop.
Fix an issue when update Xamarin.Auth NuGet from 1.5.x to 1.6.x
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
// Workaround | |
public static class AccountStoreFix | |
{ | |
// Replace default construction with Android fix in the MainActivity.cs | |
public static Func<AccountStore> CreateFunc = AccountStore.Create; | |
public static AccountStore Create () | |
{ | |
return CreateFunc (); | |
} | |
} | |
// Usage | |
public class Storage | |
{ | |
public void Save () | |
{ | |
// Now just replace AccountStore.Create() with AccountStoreFix.Create() everywhere | |
var store = AccountStoreFix.Create(); | |
// ... | |
} | |
} |
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 class MainActivity : global::Xamarin.Forms.Platform.Android.FormsAppCompatActivity | |
{ | |
protected override void OnCreate (Bundle bundle) | |
{ | |
TabLayoutResource = Resource.Layout.Tabbar; | |
ToolbarResource = Resource.Layout.Toolbar; | |
base.OnCreate (bundle); | |
AccountStoreFix.CreateFunc = () => Xamarin.Auth.AccountStore.Create ("System.Char[]"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment