From cdaba2f34dfc0fcf0b5f56006bb09b379618750f Mon Sep 17 00:00:00 2001 From: Thomas Date: Mon, 14 Nov 2022 17:18:55 +0100 Subject: [PATCH] Some fixes --- .../app/fedilab/android/viewmodel/mastodon/AdminVM.java | 7 ------- .../fedilab/android/viewmodel/mastodon/TimelinesVM.java | 7 ++++++- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/app/src/main/java/app/fedilab/android/viewmodel/mastodon/AdminVM.java b/app/src/main/java/app/fedilab/android/viewmodel/mastodon/AdminVM.java index 132d9625..cb764d01 100644 --- a/app/src/main/java/app/fedilab/android/viewmodel/mastodon/AdminVM.java +++ b/app/src/main/java/app/fedilab/android/viewmodel/mastodon/AdminVM.java @@ -17,7 +17,6 @@ package app.fedilab.android.viewmodel.mastodon; import android.app.Application; import android.os.Handler; import android.os.Looper; -import android.util.Log; import androidx.annotation.NonNull; import androidx.lifecycle.AndroidViewModel; @@ -214,13 +213,10 @@ public class AdminVM extends AndroidViewModel { AdminAccount adminAccount = null; Call approveCall = mastodonAdminService.approve(token, accountId); if (approveCall != null) { - Log.v(Helper.TAG, "request: " + approveCall.request()); try { Response approveResponse = approveCall.execute(); if (approveResponse.isSuccessful()) { adminAccount = approveResponse.body(); - } else { - Log.v(Helper.TAG, "err: " + approveResponse.errorBody().string()); } } catch (Exception e) { e.printStackTrace(); @@ -346,13 +342,10 @@ public class AdminVM extends AndroidViewModel { AdminAccount adminAccount = null; Call unsuspendCall = mastodonAdminService.unsuspend(token, accountId); if (unsuspendCall != null) { - Log.v(Helper.TAG, "request: " + unsuspendCall.request()); try { Response unsuspendResponse = unsuspendCall.execute(); if (unsuspendResponse.isSuccessful()) { adminAccount = unsuspendResponse.body(); - } else { - Log.v(Helper.TAG, "err: " + unsuspendResponse.errorBody().string()); } } catch (Exception e) { e.printStackTrace(); diff --git a/app/src/main/java/app/fedilab/android/viewmodel/mastodon/TimelinesVM.java b/app/src/main/java/app/fedilab/android/viewmodel/mastodon/TimelinesVM.java index 35192a2f..01a2fcab 100644 --- a/app/src/main/java/app/fedilab/android/viewmodel/mastodon/TimelinesVM.java +++ b/app/src/main/java/app/fedilab/android/viewmodel/mastodon/TimelinesVM.java @@ -221,10 +221,15 @@ public class TimelinesVM extends AndroidViewModel { SharedPreferences sharedpreferences = PreferenceManager .getDefaultSharedPreferences(context); String instance = sharedpreferences.getString(context.getString(R.string.SET_NITTER_HOST), context.getString(R.string.DEFAULT_NITTER_HOST)).toLowerCase(); + if (instance.trim().equals("")) { + instance = context.getString(R.string.DEFAULT_NITTER_HOST); + } MastodonTimelinesService mastodonTimelinesService = initInstanceXMLOnly(instance); accountsStr = accountsStr.replaceAll("\\s", ","); + statusesMutableLiveData = new MutableLiveData<>(); String finalAccountsStr = accountsStr; + String finalInstance = instance; new Thread(() -> { Call publicTlCall = mastodonTimelinesService.getNitter(finalAccountsStr, max_position); Statuses statuses = new Statuses(); @@ -238,7 +243,7 @@ public class TimelinesVM extends AndroidViewModel { if (rssResponse != null && rssResponse.mFeedItems != null) { for (Nitter.FeedItem feedItem : rssResponse.mFeedItems) { if (!feedItem.title.startsWith("RT by")) { - Status status = Nitter.convert(getApplication(), instance, feedItem); + Status status = Nitter.convert(getApplication(), finalInstance, feedItem); statusList.add(status); } }