pull/483/head
Thomas 2 years ago
parent 03f8c33cb2
commit cdaba2f34d

@ -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<AdminAccount> approveCall = mastodonAdminService.approve(token, accountId);
if (approveCall != null) {
Log.v(Helper.TAG, "request: " + approveCall.request());
try {
Response<AdminAccount> 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<AdminAccount> unsuspendCall = mastodonAdminService.unsuspend(token, accountId);
if (unsuspendCall != null) {
Log.v(Helper.TAG, "request: " + unsuspendCall.request());
try {
Response<AdminAccount> unsuspendResponse = unsuspendCall.execute();
if (unsuspendResponse.isSuccessful()) {
adminAccount = unsuspendResponse.body();
} else {
Log.v(Helper.TAG, "err: " + unsuspendResponse.errorBody().string());
}
} catch (Exception e) {
e.printStackTrace();

@ -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<Nitter> 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);
}
}

Loading…
Cancel
Save