Some fixes
This commit is contained in:
parent
03f8c33cb2
commit
cdaba2f34d
|
@ -17,7 +17,6 @@ package app.fedilab.android.viewmodel.mastodon;
|
||||||
import android.app.Application;
|
import android.app.Application;
|
||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
import android.os.Looper;
|
import android.os.Looper;
|
||||||
import android.util.Log;
|
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.lifecycle.AndroidViewModel;
|
import androidx.lifecycle.AndroidViewModel;
|
||||||
|
@ -214,13 +213,10 @@ public class AdminVM extends AndroidViewModel {
|
||||||
AdminAccount adminAccount = null;
|
AdminAccount adminAccount = null;
|
||||||
Call<AdminAccount> approveCall = mastodonAdminService.approve(token, accountId);
|
Call<AdminAccount> approveCall = mastodonAdminService.approve(token, accountId);
|
||||||
if (approveCall != null) {
|
if (approveCall != null) {
|
||||||
Log.v(Helper.TAG, "request: " + approveCall.request());
|
|
||||||
try {
|
try {
|
||||||
Response<AdminAccount> approveResponse = approveCall.execute();
|
Response<AdminAccount> approveResponse = approveCall.execute();
|
||||||
if (approveResponse.isSuccessful()) {
|
if (approveResponse.isSuccessful()) {
|
||||||
adminAccount = approveResponse.body();
|
adminAccount = approveResponse.body();
|
||||||
} else {
|
|
||||||
Log.v(Helper.TAG, "err: " + approveResponse.errorBody().string());
|
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
@ -346,13 +342,10 @@ public class AdminVM extends AndroidViewModel {
|
||||||
AdminAccount adminAccount = null;
|
AdminAccount adminAccount = null;
|
||||||
Call<AdminAccount> unsuspendCall = mastodonAdminService.unsuspend(token, accountId);
|
Call<AdminAccount> unsuspendCall = mastodonAdminService.unsuspend(token, accountId);
|
||||||
if (unsuspendCall != null) {
|
if (unsuspendCall != null) {
|
||||||
Log.v(Helper.TAG, "request: " + unsuspendCall.request());
|
|
||||||
try {
|
try {
|
||||||
Response<AdminAccount> unsuspendResponse = unsuspendCall.execute();
|
Response<AdminAccount> unsuspendResponse = unsuspendCall.execute();
|
||||||
if (unsuspendResponse.isSuccessful()) {
|
if (unsuspendResponse.isSuccessful()) {
|
||||||
adminAccount = unsuspendResponse.body();
|
adminAccount = unsuspendResponse.body();
|
||||||
} else {
|
|
||||||
Log.v(Helper.TAG, "err: " + unsuspendResponse.errorBody().string());
|
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
|
|
@ -221,10 +221,15 @@ public class TimelinesVM extends AndroidViewModel {
|
||||||
SharedPreferences sharedpreferences = PreferenceManager
|
SharedPreferences sharedpreferences = PreferenceManager
|
||||||
.getDefaultSharedPreferences(context);
|
.getDefaultSharedPreferences(context);
|
||||||
String instance = sharedpreferences.getString(context.getString(R.string.SET_NITTER_HOST), context.getString(R.string.DEFAULT_NITTER_HOST)).toLowerCase();
|
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);
|
MastodonTimelinesService mastodonTimelinesService = initInstanceXMLOnly(instance);
|
||||||
accountsStr = accountsStr.replaceAll("\\s", ",");
|
accountsStr = accountsStr.replaceAll("\\s", ",");
|
||||||
|
|
||||||
statusesMutableLiveData = new MutableLiveData<>();
|
statusesMutableLiveData = new MutableLiveData<>();
|
||||||
String finalAccountsStr = accountsStr;
|
String finalAccountsStr = accountsStr;
|
||||||
|
String finalInstance = instance;
|
||||||
new Thread(() -> {
|
new Thread(() -> {
|
||||||
Call<Nitter> publicTlCall = mastodonTimelinesService.getNitter(finalAccountsStr, max_position);
|
Call<Nitter> publicTlCall = mastodonTimelinesService.getNitter(finalAccountsStr, max_position);
|
||||||
Statuses statuses = new Statuses();
|
Statuses statuses = new Statuses();
|
||||||
|
@ -238,7 +243,7 @@ public class TimelinesVM extends AndroidViewModel {
|
||||||
if (rssResponse != null && rssResponse.mFeedItems != null) {
|
if (rssResponse != null && rssResponse.mFeedItems != null) {
|
||||||
for (Nitter.FeedItem feedItem : rssResponse.mFeedItems) {
|
for (Nitter.FeedItem feedItem : rssResponse.mFeedItems) {
|
||||||
if (!feedItem.title.startsWith("RT by")) {
|
if (!feedItem.title.startsWith("RT by")) {
|
||||||
Status status = Nitter.convert(getApplication(), instance, feedItem);
|
Status status = Nitter.convert(getApplication(), finalInstance, feedItem);
|
||||||
statusList.add(status);
|
statusList.add(status);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue