@@ -27,7 +27,6 @@ namespace GitHub.Models
2727 public class RepositoryHost : ReactiveObject , IRepositoryHost
2828 {
2929 static readonly Logger log = LogManager . GetCurrentClassLogger ( ) ;
30- static readonly UserAndScopes unverifiedUser = new UserAndScopes ( null , null ) ;
3130
3231 readonly ILoginManager loginManager ;
3332 readonly HostAddress hostAddress ;
@@ -65,8 +64,6 @@ public bool IsLoggedIn
6564 private set { this . RaiseAndSetIfChanged ( ref isLoggedIn , value ) ; }
6665 }
6766
68- public bool SupportsGist { get ; private set ; }
69-
7067 public string Title { get ; private set ; }
7168
7269 [ SuppressMessage ( "Microsoft.Reliability" , "CA2000:Dispose objects before losing scope" ) ]
@@ -81,7 +78,7 @@ public IObservable<AuthenticationResult> LogInFromCache()
8178 usage . IncrementLoginCount ( ) . Forget ( ) ;
8279 await ModelService . InsertUser ( accountCacheItem ) ;
8380
84- if ( user != unverifiedUser . User )
81+ if ( user != null )
8582 {
8683 IsLoggedIn = true ;
8784 return AuthenticationResult . Success ;
@@ -112,7 +109,7 @@ public IObservable<AuthenticationResult> LogIn(string usernameOrEmail, string pa
112109 usage . IncrementLoginCount ( ) . Forget ( ) ;
113110 await ModelService . InsertUser ( accountCacheItem ) ;
114111
115- if ( user != unverifiedUser . User )
112+ if ( user != null )
116113 {
117114 IsLoggedIn = true ;
118115 return Observable . Return ( AuthenticationResult . Success ) ;
@@ -149,53 +146,6 @@ public IObservable<Unit> LogOut()
149146 } ) ;
150147 }
151148
152- static IObservable < AuthenticationResult > GetAuthenticationResultForUser ( UserAndScopes account )
153- {
154- return Observable . Return ( account == null ? AuthenticationResult . CredentialFailure
155- : account == unverifiedUser
156- ? AuthenticationResult . VerificationFailure
157- : AuthenticationResult . Success ) ;
158- }
159-
160- IObservable < AuthenticationResult > LoginWithApiUser ( UserAndScopes userAndScopes )
161- {
162- return GetAuthenticationResultForUser ( userAndScopes )
163- . SelectMany ( result =>
164- {
165- if ( result . IsSuccess ( ) )
166- {
167- var accountCacheItem = new AccountCacheItem ( userAndScopes . User ) ;
168- usage . IncrementLoginCount ( ) . Forget ( ) ;
169- return ModelService . InsertUser ( accountCacheItem ) . Select ( _ => result ) ;
170- }
171-
172- if ( result == AuthenticationResult . VerificationFailure )
173- {
174- return loginCache . EraseLogin ( Address ) . Select ( _ => result ) ;
175- }
176- return Observable . Return ( result ) ;
177- } )
178- . ObserveOn ( RxApp . MainThreadScheduler )
179- . Do ( result =>
180- {
181- if ( result . IsSuccess ( ) )
182- {
183- SupportsGist = userAndScopes . Scopes ? . Contains ( "gist" ) ?? true ;
184- IsLoggedIn = true ;
185- }
186-
187- log . Info ( "Log in from cache for login '{0}' to host '{1}' {2}" ,
188- userAndScopes ? . User ? . Login ?? "(null)" ,
189- hostAddress . ApiUri ,
190- result . IsSuccess ( ) ? "SUCCEEDED" : "FAILED" ) ;
191- } ) ;
192- }
193-
194- IObservable < UserAndScopes > GetUserFromApi ( )
195- {
196- return Observable . Defer ( ( ) => ApiClient . GetUser ( ) ) ;
197- }
198-
199149 protected virtual void Dispose ( bool disposing )
200150 { }
201151
0 commit comments