From bbe696a37b6ddc5fba282f40f40c091fbce8fb68 Mon Sep 17 00:00:00 2001 From: Balazs Toldi Date: Tue, 15 Aug 2023 07:55:07 +0200 Subject: [PATCH 1/2] Fix anonymous link resolving --- .../infinityforlemmy/activities/LinkResolverActivity.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/eu/toldi/infinityforlemmy/activities/LinkResolverActivity.java b/app/src/main/java/eu/toldi/infinityforlemmy/activities/LinkResolverActivity.java index d8d5cc9a..d170705f 100644 --- a/app/src/main/java/eu/toldi/infinityforlemmy/activities/LinkResolverActivity.java +++ b/app/src/main/java/eu/toldi/infinityforlemmy/activities/LinkResolverActivity.java @@ -91,8 +91,10 @@ public class LinkResolverActivity extends AppCompatActivity { ((Infinity) getApplication()).getAppComponent().inject(this); mAccessToken = mCurrentAccountSharedPreferences.getString(SharedPreferencesUtils.ACCESS_TOKEN, null); - String instance = mCurrentAccountSharedPreferences.getString(SharedPreferencesUtils.ACCOUNT_INSTANCE, null); - mRetrofit.setBaseURL(instance); + if (mAccessToken != null) { + String instance = mCurrentAccountSharedPreferences.getString(SharedPreferencesUtils.ACCOUNT_INSTANCE, null); + mRetrofit.setBaseURL(instance); + } Uri uri = getIntent().getData(); if (uri == null) { From a36ddccefd37d66a0f61f0f1d56401f1c8efb4e7 Mon Sep 17 00:00:00 2001 From: Balazs Toldi Date: Tue, 15 Aug 2023 08:10:21 +0200 Subject: [PATCH 2/2] Fix parsing user display name --- .../main/java/eu/toldi/infinityforlemmy/FetchMyInfo.java | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/app/src/main/java/eu/toldi/infinityforlemmy/FetchMyInfo.java b/app/src/main/java/eu/toldi/infinityforlemmy/FetchMyInfo.java index 667fbcd6..4103b37a 100644 --- a/app/src/main/java/eu/toldi/infinityforlemmy/FetchMyInfo.java +++ b/app/src/main/java/eu/toldi/infinityforlemmy/FetchMyInfo.java @@ -1,7 +1,6 @@ package eu.toldi.infinityforlemmy; import android.os.AsyncTask; -import android.text.Html; import androidx.annotation.NonNull; @@ -9,9 +8,6 @@ import org.json.JSONException; import org.json.JSONObject; import eu.toldi.infinityforlemmy.apis.LemmyAPI; -import eu.toldi.infinityforlemmy.apis.RedditAPI; -import eu.toldi.infinityforlemmy.utils.APIUtils; -import eu.toldi.infinityforlemmy.utils.JSONUtils; import eu.toldi.infinityforlemmy.utils.LemmyUtils; import retrofit2.Call; import retrofit2.Callback; @@ -83,7 +79,7 @@ public class FetchMyInfo { if (!person.isNull("banner")) { bannerImageUrl = person.getString("banner"); } - display_name = person.getString("name"); + display_name = (person.has("display_name")) ? person.getString("display_name") : person.getString("name"); redditDataRoomDatabase.accountDao().updateAccountInfo(name, profileImageUrl, bannerImageUrl); } catch (JSONException e) { parseFailed = true;