From 4ddbc57b0034f197c8faebb3b68d0c3d16e97d69 Mon Sep 17 00:00:00 2001
From: Taras Smakula <tarassmakula@gmail.com>
Date: Thu, 11 Jan 2024 16:13:50 +0200
Subject: [PATCH] Clean up get login stages

---
 .../futo/circles/auth/feature/log_in/LoginDataSource.kt   | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/auth/src/main/java/org/futo/circles/auth/feature/log_in/LoginDataSource.kt b/auth/src/main/java/org/futo/circles/auth/feature/log_in/LoginDataSource.kt
index 02f3ad988..decc0120d 100644
--- a/auth/src/main/java/org/futo/circles/auth/feature/log_in/LoginDataSource.kt
+++ b/auth/src/main/java/org/futo/circles/auth/feature/log_in/LoginDataSource.kt
@@ -38,13 +38,9 @@ class LoginDataSource @Inject constructor(
         val homeServerConfig = buildHomeServerConfigFromDomain(domain)
         val supportedLoginMethods = authService.getLoginFlow(homeServerConfig).supportedLoginTypes
 
-        return if (supportedLoginMethods.isEmpty()) {
-            getCircleLoginStages(userName, domain)
-        } else if (isPasswordLogin(supportedLoginMethods)) {
+        return if (isPasswordLogin(supportedLoginMethods))
             listOf(Stage.Other(true, DIRECT_LOGIN_PASSWORD_TYPE, null))
-        } else {
-            throw IllegalArgumentException(context.getString(R.string.unsupported_login_method))
-        }
+        else getCircleLoginStages(userName, domain)
     }
 
     private fun isPasswordLogin(methods: List<String>) = methods.contains(LOGIN_PASSWORD_TYPE)
-- 
GitLab