about summary refs log tree commit diff stats
path: root/org.fox.ttrss
diff options
context:
space:
mode:
authorAndrew Dolgov <fox@fakecake.org>2026-06-06 10:48:11 +0300
committerAndrew Dolgov <fox@fakecake.org>2026-06-06 10:48:11 +0300
commit4a67adf524a2a3719e457bf6c07c6a5c69df4186 (patch)
treefa2709179031759a5fceaf937e6a7f2063d8aa12 /org.fox.ttrss
parent0d98568240699e2e044cbc3e0a968010081475a0 (diff)
downloadtt-rss-android-4a67adf524a2a3719e457bf6c07c6a5c69df4186.tar.gz
tt-rss-android-4a67adf524a2a3719e457bf6c07c6a5c69df4186.tar.xz
drop pointless second request for API level from loginRequest (login includes it)
Diffstat (limited to 'org.fox.ttrss')
-rwxr-xr-xorg.fox.ttrss/src/main/java/org/fox/ttrss/OnlineActivity.java76
1 files changed, 17 insertions, 59 deletions
diff --git a/org.fox.ttrss/src/main/java/org/fox/ttrss/OnlineActivity.java b/org.fox.ttrss/src/main/java/org/fox/ttrss/OnlineActivity.java
index 684514d8..adb6d28a 100755
--- a/org.fox.ttrss/src/main/java/org/fox/ttrss/OnlineActivity.java
+++ b/org.fox.ttrss/src/main/java/org/fox/ttrss/OnlineActivity.java
@@ -1177,72 +1177,30 @@ public class OnlineActivity extends CommonActivity {
 
                         if (apiLevel != null) {
                             setApiLevel(apiLevel.getAsInt());
-                            Log.d(TAG, "Received API level: " + getApiLevel());
-
-                            // get custom sort from configuration object
-                            if (getApiLevel() >= 17) {
-
-                                // daemon_is_running, icons_dir, etc...
-                                JsonObject config = content.get("config").getAsJsonObject();
-
-                                Type hashType = new TypeToken<Map<String, String>>() {
-                                }.getType();
-                                Map<String, String> customSortTypes = new Gson().fromJson(config.get("custom_sort_types"), hashType);
-
-                                setCustomSortModes(customSortTypes);
-                            }
-
-                            if (m_listener != null) {
-                                m_listener.OnLoginSuccess();
-                            } else {
-                                loginSuccess(m_refreshAfterLogin);
-                            }
-
                         } else {
+                            // Very old tt-rss server without api_level in login response
+                            setApiLevel(0);
+                        }
 
-                            ApiRequest req = new ApiRequest(OnlineActivity.this) {
-                                protected void onPostExecute(JsonElement result) {
-                                    setApiLevel(0);
-
-                                    if (result != null) {
-                                        try {
-                                            setApiLevel(result.getAsJsonObject().get("level").getAsInt());
-                                        } catch (Exception e) {
-                                            e.printStackTrace();
-                                        }
-                                    } else if (m_lastError != ApiCommon.ApiError.API_UNKNOWN_METHOD) {
-                                        // Unknown method means old tt-rss, in that case we assume API 0 and continue
-
-                                        setLoadingStatus(getErrorMessage());
-
-                                        if (m_lastErrorMessage != null) {
-                                            setLoadingStatus(getString(getErrorMessage()) + "\n\n" + m_lastErrorMessage);
-                                        } else {
-                                            setLoadingStatus(getErrorMessage());
-                                        }
-
-                                        if (m_listener != null) {
-                                            m_listener.OnLoginFailed();
-                                        } else {
-                                            loginFailure();
-                                        }
-
-                                        return;
-                                    }
+                        Log.d(TAG, "Received API level: " + getApiLevel());
 
-                                    Log.d(TAG, "Received API level: " + getApiLevel());
+                        // get custom sort from configuration object
+                        if (getApiLevel() >= 17) {
 
-                                    loginSuccess(m_refreshAfterLogin);
-                                }
-                            };
+                            // daemon_is_running, icons_dir, etc...
+                            JsonObject config = content.get("config").getAsJsonObject();
 
-                            HashMap<String, String> map = new HashMap<>();
-                            map.put("sid", getSessionId());
-                            map.put("op", "getApiLevel");
+                            Type hashType = new TypeToken<Map<String, String>>() {
+                            }.getType();
+                            Map<String, String> customSortTypes = new Gson().fromJson(config.get("custom_sort_types"), hashType);
 
-                            req.execute(map);
+                            setCustomSortModes(customSortTypes);
+                        }
 
-                            setLoadingStatus(R.string.loading_message);
+                        if (m_listener != null) {
+                            m_listener.OnLoginSuccess();
+                        } else {
+                            loginSuccess(m_refreshAfterLogin);
                         }
 
                         return;