@@ -335,16 +335,32 @@ impl Client {
335
335
}
336
336
} ;
337
337
338
- let supports_password_login = self . supports_password_login ( ) . await . ok ( ) . unwrap_or ( false ) ;
339
- let supports_sso_login = self . supports_sso_login ( ) . await . ok ( ) . unwrap_or ( false ) ;
338
+ let login_types = self . inner . matrix_auth ( ) . get_login_types ( ) . await . ok ( ) ;
339
+ let supports_password_login = login_types
340
+ . as_ref ( )
341
+ . map ( |login_types| {
342
+ login_types. flows . iter ( ) . any ( |login_type| {
343
+ matches ! ( login_type, get_login_types:: v3:: LoginType :: Password ( _) )
344
+ } )
345
+ } )
346
+ . unwrap_or ( false ) ;
347
+ let supports_sso_login = login_types
348
+ . as_ref ( )
349
+ . map ( |login_types| {
350
+ login_types
351
+ . flows
352
+ . iter ( )
353
+ . any ( |login_type| matches ! ( login_type, get_login_types:: v3:: LoginType :: Sso ( _) ) )
354
+ } )
355
+ . unwrap_or ( false ) ;
340
356
let sliding_sync_version = self . sliding_sync_version ( ) ;
341
357
342
358
Arc :: new ( HomeserverLoginDetails {
343
359
url : self . homeserver ( ) ,
344
360
sliding_sync_version,
345
361
supports_oidc_login,
346
- supports_sso_login,
347
362
supported_oidc_prompts,
363
+ supports_sso_login,
348
364
supports_password_login,
349
365
} )
350
366
}
@@ -735,29 +751,6 @@ impl Client {
735
751
}
736
752
}
737
753
738
- impl Client {
739
- /// Whether or not the client's homeserver supports the password login flow.
740
- pub ( crate ) async fn supports_password_login ( & self ) -> anyhow:: Result < bool > {
741
- let login_types = self . inner . matrix_auth ( ) . get_login_types ( ) . await ?;
742
- let supports_password = login_types
743
- . flows
744
- . iter ( )
745
- . any ( |login_type| matches ! ( login_type, get_login_types:: v3:: LoginType :: Password ( _) ) ) ;
746
- Ok ( supports_password)
747
- }
748
-
749
- /// Whether or not the client's homeserver supports the legacy SSO login
750
- /// flow.
751
- pub ( crate ) async fn supports_sso_login ( & self ) -> anyhow:: Result < bool > {
752
- let login_types = self . inner . matrix_auth ( ) . get_login_types ( ) . await ?;
753
- let supports_password = login_types
754
- . flows
755
- . iter ( )
756
- . any ( |login_type| matches ! ( login_type, get_login_types:: v3:: LoginType :: Sso ( _) ) ) ;
757
- Ok ( supports_password)
758
- }
759
- }
760
-
761
754
#[ matrix_sdk_ffi_macros:: export]
762
755
impl Client {
763
756
/// The sliding sync version.
0 commit comments