@@ -14,7 +14,7 @@ public class LoginManager : ILoginManager
1414 {
1515 readonly string [ ] scopes = { "user" , "repo" , "gist" , "write:public_key" } ;
1616 readonly IKeychain keychain ;
17- readonly ITwoFactorChallengeHandler twoFactorChallengeHandler ;
17+ readonly Lazy < ITwoFactorChallengeHandler > twoFactorChallengeHandler ;
1818 readonly string clientId ;
1919 readonly string clientSecret ;
2020 readonly string authorizationNote ;
@@ -31,7 +31,7 @@ public class LoginManager : ILoginManager
3131 /// <param name="fingerprint">The machine fingerprint.</param>
3232 public LoginManager (
3333 IKeychain keychain ,
34- ITwoFactorChallengeHandler twoFactorChallengeHandler ,
34+ Lazy < ITwoFactorChallengeHandler > twoFactorChallengeHandler ,
3535 string clientId ,
3636 string clientSecret ,
3737 string authorizationNote = null ,
@@ -194,7 +194,7 @@ async Task<ApplicationAuthorization> HandleTwoFactorAuthorization(
194194 {
195195 for ( ; ; )
196196 {
197- var challengeResult = await twoFactorChallengeHandler . HandleTwoFactorException ( exception ) ;
197+ var challengeResult = await twoFactorChallengeHandler . Value . HandleTwoFactorException ( exception ) ;
198198
199199 if ( challengeResult == null )
200200 {
@@ -218,7 +218,7 @@ async Task<ApplicationAuthorization> HandleTwoFactorAuthorization(
218218 }
219219 catch ( Exception e )
220220 {
221- await twoFactorChallengeHandler . ChallengeFailed ( e ) ;
221+ await twoFactorChallengeHandler . Value . ChallengeFailed ( e ) ;
222222 await keychain . Delete ( hostAddress ) . ConfigureAwait ( false ) ;
223223 throw ;
224224 }
0 commit comments