Add less restrictive catch close

This commit is contained in:
Thomas 2022-06-01 16:37:01 +02:00
parent e3ef0881a7
commit 9047181e8f
20 changed files with 228 additions and 195 deletions

View file

@ -173,9 +173,14 @@ public class AdminReportActivity extends BaseActivity {
if (adminAccount.disabled) {
adminVM.enable(MainActivity.currentInstance, MainActivity.currentToken, account.id)
.observe(AdminReportActivity.this, adminAccountResult -> {
if (adminAccountResult != null) {
adminAccount.disabled = false;
binding.disableAction.setText(R.string.disable);
binding.disabled.setText(R.string.no);
} else {
Helper.sendToastMessage(getApplication(), Helper.RECEIVE_TOAST_TYPE_ERROR, getString(R.string.toast_error));
}
});
} else {
adminVM.performAction(MainActivity.currentInstance, MainActivity.currentToken, account.id, "disable ", null, null, null, null);
@ -189,9 +194,14 @@ public class AdminReportActivity extends BaseActivity {
if (adminAccount.approved) {
adminVM.reject(MainActivity.currentInstance, MainActivity.currentToken, account.id)
.observe(AdminReportActivity.this, adminAccountResult -> {
if (adminAccountResult != null) {
adminAccount.approved = false;
binding.approveAction.setText(R.string.approve);
binding.approved.setText(R.string.no);
} else {
Helper.sendToastMessage(getApplication(), Helper.RECEIVE_TOAST_TYPE_ERROR, getString(R.string.toast_error));
}
});
} else {
adminVM.approve(MainActivity.currentInstance, MainActivity.currentToken, account.id);
@ -205,9 +215,13 @@ public class AdminReportActivity extends BaseActivity {
if (adminAccount.disabled) {
adminVM.unsilence(MainActivity.currentInstance, MainActivity.currentToken, account.id)
.observe(AdminReportActivity.this, adminAccountResult -> {
if (adminAccountResult != null) {
adminAccount.silenced = false;
binding.silenceAction.setText(R.string.silence);
binding.disabled.setText(R.string.no);
} else {
Helper.sendToastMessage(getApplication(), Helper.RECEIVE_TOAST_TYPE_ERROR, getString(R.string.toast_error));
}
});
} else {
adminVM.performAction(MainActivity.currentInstance, MainActivity.currentToken, account.id, "silence", null, null, null, null);
@ -221,9 +235,13 @@ public class AdminReportActivity extends BaseActivity {
if (adminAccount.disabled) {
adminVM.unsuspend(MainActivity.currentInstance, MainActivity.currentToken, account.id)
.observe(AdminReportActivity.this, adminAccountResult -> {
if (adminAccountResult != null) {
adminAccount.suspended = false;
binding.suspendAction.setText(R.string.suspend);
binding.suspended.setText(R.string.no);
} else {
Helper.sendToastMessage(getApplication(), Helper.RECEIVE_TOAST_TYPE_ERROR, getString(R.string.toast_error));
}
});
} else {
adminVM.performAction(MainActivity.currentInstance, MainActivity.currentToken, account.id, "suspend", null, null, null, null);

View file

@ -178,10 +178,18 @@ public class ComposeActivity extends BaseActivity implements ComposeAdapter.Mana
if (statusReplyId != null && statusDraft != null) {//Delete and redraft
statusesVM.getStatus(BaseMainActivity.currentInstance, BaseMainActivity.currentToken, statusReplyId)
.observe(ComposeActivity.this, status1 -> {
if (status1 != null) {
statusesVM.getContext(BaseMainActivity.currentInstance, BaseMainActivity.currentToken, statusReplyId)
.observe(ComposeActivity.this, statusContext -> {
if (statusContext != null) {
initializeContextRedraftView(statusContext, status1);
} else {
Helper.sendToastMessage(getApplication(), Helper.RECEIVE_TOAST_TYPE_ERROR, getString(R.string.toast_error));
}
});
} else {
Helper.sendToastMessage(getApplication(), Helper.RECEIVE_TOAST_TYPE_ERROR, getString(R.string.toast_error));
}
});
} else if (statusDraft != null) {//Restore a draft with all messages
new Thread(() -> {

View file

@ -73,8 +73,12 @@ public class EditProfileActivity extends BaseActivity {
new ViewModelProvider(EditProfileActivity.this).get(AccountsVM.class).getConnectedAccount(BaseMainActivity.currentInstance, BaseMainActivity.currentToken)
.observe(EditProfileActivity.this, account -> {
if (account != null) {
BaseMainActivity.accountWeakReference.get().mastodon_account = account;
initializeView();
} else {
Helper.sendToastMessage(getApplication(), Helper.RECEIVE_TOAST_TYPE_ERROR, getString(R.string.toast_error));
}
});
}
@ -187,6 +191,7 @@ public class EditProfileActivity extends BaseActivity {
.into(binding.accountPp);
accountsVM.updateProfilePicture(BaseMainActivity.currentInstance, BaseMainActivity.currentToken, data.getData(), AccountsVM.UpdateMediaType.AVATAR)
.observe(EditProfileActivity.this, account -> {
if (account != null) {
sendBroadCast(account);
binding.avatarProgress.setVisibility(View.GONE);
BaseMainActivity.accountWeakReference.get().mastodon_account = account;
@ -198,6 +203,9 @@ public class EditProfileActivity extends BaseActivity {
e.printStackTrace();
}
}).start();
} else {
Helper.sendToastMessage(getApplication(), Helper.RECEIVE_TOAST_TYPE_ERROR, getString(R.string.toast_error));
}
});
} else if (requestCode == PICK_MEDIA_HEADER && resultCode == RESULT_OK) {
Glide.with(EditProfileActivity.this)
@ -208,6 +216,7 @@ public class EditProfileActivity extends BaseActivity {
binding.headerProgress.setVisibility(View.VISIBLE);
accountsVM.updateProfilePicture(BaseMainActivity.currentInstance, BaseMainActivity.currentToken, data.getData(), AccountsVM.UpdateMediaType.HEADER)
.observe(EditProfileActivity.this, account -> {
if (account != null) {
sendBroadCast(account);
binding.headerProgress.setVisibility(View.GONE);
BaseMainActivity.accountWeakReference.get().mastodon_account = account;
@ -218,8 +227,10 @@ public class EditProfileActivity extends BaseActivity {
e.printStackTrace();
}
}).start();
Helper.recreateMainActivity(EditProfileActivity.this);
} else {
Helper.sendToastMessage(getApplication(), Helper.RECEIVE_TOAST_TYPE_ERROR, getString(R.string.toast_error));
}
});
}
}
@ -301,6 +312,7 @@ public class EditProfileActivity extends BaseActivity {
getFields()
)
.observe(EditProfileActivity.this, account -> {
if (account != null) {
BaseMainActivity.accountWeakReference.get().mastodon_account = account;
new Thread(() -> {
try {
@ -310,9 +322,12 @@ public class EditProfileActivity extends BaseActivity {
e.printStackTrace();
}
}).start();
Toasty.success(EditProfileActivity.this, getString(R.string.profiled_updated), Toasty.LENGTH_LONG).show();
finish();
} else {
Helper.sendToastMessage(getApplication(), Helper.RECEIVE_TOAST_TYPE_ERROR, getString(R.string.toast_error));
}
});
return true;
}

View file

@ -627,8 +627,11 @@ public class SpannableHelper {
* @param text String - text to convert, it can be display name or bio
* @return Spannable string
*/
private static Spannable convertA(@NonNull Context context, @NonNull Account account, @NonNull String text, boolean limitedToDisplayName) {
private static Spannable convertA(@NonNull Context context, @NonNull Account account, String text, boolean limitedToDisplayName) {
SpannableString initialContent;
if (text == null) {
return null;
}
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N)
initialContent = new SpannableString(Html.fromHtml(text, Html.FROM_HTML_MODE_LEGACY));
else

View file

@ -99,6 +99,8 @@ public class FragmentLoginPickInstanceMastodon extends Fragment implements Insta
binding.regCategoryView.setLayoutManager(mLayoutManager);
binding.regCategoryView.setNestedScrollingEnabled(false);
binding.regCategoryView.setAdapter(instanceRegAdapter);
} else {
Helper.sendToastMessage(requireActivity(), Helper.RECEIVE_TOAST_TYPE_ERROR, getString(R.string.toast_error));
}
});
} else {

View file

@ -224,6 +224,7 @@ public class FragmentMastodonContext extends Fragment {
private void initializeContextView(final Context context) {
if (context == null) {
Helper.sendToastMessage(requireActivity(), Helper.RECEIVE_TOAST_TYPE_ERROR, getString(R.string.toast_error));
return;
}
if (pullToRefresh) {

View file

@ -24,7 +24,6 @@ import androidx.lifecycle.AndroidViewModel;
import androidx.lifecycle.LiveData;
import androidx.lifecycle.MutableLiveData;
import java.io.IOException;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.concurrent.TimeUnit;
@ -118,7 +117,7 @@ public class AccountsVM extends AndroidViewModel {
if (accountResponse.isSuccessful()) {
account = accountResponse.body();
}
} catch (IOException e) {
} catch (Exception e) {
e.printStackTrace();
}
}
@ -164,7 +163,7 @@ public class AccountsVM extends AndroidViewModel {
errorMessage = stringResponse.errorBody().string();
}
}
} catch (IOException e) {
} catch (Exception e) {
e.printStackTrace();
errorMessage = e.getMessage() != null ? e.getMessage() : getApplication().getString(R.string.toast_error);
}
@ -210,7 +209,7 @@ public class AccountsVM extends AndroidViewModel {
if (accountResponse.isSuccessful()) {
account = accountResponse.body();
}
} catch (IOException e) {
} catch (Exception e) {
e.printStackTrace();
}
}
@ -270,7 +269,7 @@ public class AccountsVM extends AndroidViewModel {
if (accountResponse.isSuccessful()) {
account = accountResponse.body();
}
} catch (IOException e) {
} catch (Exception e) {
e.printStackTrace();
}
}
@ -298,7 +297,7 @@ public class AccountsVM extends AndroidViewModel {
if (accountResponse.isSuccessful()) {
account = accountResponse.body();
}
} catch (IOException e) {
} catch (Exception e) {
e.printStackTrace();
}
}
@ -343,7 +342,7 @@ public class AccountsVM extends AndroidViewModel {
pagination = MastodonHelper.getPagination(accountStatusesResponse.headers());
}
} catch (IOException e) {
} catch (Exception e) {
e.printStackTrace();
}
}
@ -378,7 +377,7 @@ public class AccountsVM extends AndroidViewModel {
accountList = followersResponse.body();
pagination = MastodonHelper.getPagination(followersResponse.headers());
}
} catch (IOException e) {
} catch (Exception e) {
e.printStackTrace();
}
}
@ -414,7 +413,7 @@ public class AccountsVM extends AndroidViewModel {
accountList = followingResponse.body();
pagination = MastodonHelper.getPagination(followingResponse.headers());
}
} catch (IOException e) {
} catch (Exception e) {
e.printStackTrace();
}
}
@ -446,7 +445,7 @@ public class AccountsVM extends AndroidViewModel {
if (featuredTagsResponse.isSuccessful()) {
featuredTagList = featuredTagsResponse.body();
}
} catch (IOException e) {
} catch (Exception e) {
e.printStackTrace();
}
}
@ -476,7 +475,7 @@ public class AccountsVM extends AndroidViewModel {
if (listsResponse.isSuccessful()) {
mastodonListList = listsResponse.body();
}
} catch (IOException e) {
} catch (Exception e) {
e.printStackTrace();
}
}
@ -506,7 +505,7 @@ public class AccountsVM extends AndroidViewModel {
if (identityProofsResponse.isSuccessful()) {
identityProofList = identityProofsResponse.body();
}
} catch (IOException e) {
} catch (Exception e) {
e.printStackTrace();
}
}
@ -537,7 +536,7 @@ public class AccountsVM extends AndroidViewModel {
if (followResponse.isSuccessful()) {
relationShip = followResponse.body();
}
} catch (IOException e) {
} catch (Exception e) {
e.printStackTrace();
}
}
@ -569,7 +568,7 @@ public class AccountsVM extends AndroidViewModel {
if (followResponse.isSuccessful()) {
relationShip = followResponse.body();
}
} catch (IOException e) {
} catch (Exception e) {
e.printStackTrace();
}
}
@ -599,7 +598,7 @@ public class AccountsVM extends AndroidViewModel {
if (unfollowResponse.isSuccessful()) {
relationShip = unfollowResponse.body();
}
} catch (IOException e) {
} catch (Exception e) {
e.printStackTrace();
}
}
@ -629,7 +628,7 @@ public class AccountsVM extends AndroidViewModel {
if (blockResponse.isSuccessful()) {
relationShip = blockResponse.body();
}
} catch (IOException e) {
} catch (Exception e) {
e.printStackTrace();
}
Handler mainHandler = new Handler(Looper.getMainLooper());
@ -659,7 +658,7 @@ public class AccountsVM extends AndroidViewModel {
if (unblockResponse.isSuccessful()) {
relationShip = unblockResponse.body();
}
} catch (IOException e) {
} catch (Exception e) {
e.printStackTrace();
}
Handler mainHandler = new Handler(Looper.getMainLooper());
@ -691,7 +690,7 @@ public class AccountsVM extends AndroidViewModel {
if (muteResponse.isSuccessful()) {
relationShip = muteResponse.body();
}
} catch (IOException e) {
} catch (Exception e) {
e.printStackTrace();
}
Handler mainHandler = new Handler(Looper.getMainLooper());
@ -721,7 +720,7 @@ public class AccountsVM extends AndroidViewModel {
if (unmuteResponse.isSuccessful()) {
relationShip = unmuteResponse.body();
}
} catch (IOException e) {
} catch (Exception e) {
e.printStackTrace();
}
Handler mainHandler = new Handler(Looper.getMainLooper());
@ -751,7 +750,7 @@ public class AccountsVM extends AndroidViewModel {
if (endorseResponse.isSuccessful()) {
relationShip = endorseResponse.body();
}
} catch (IOException e) {
} catch (Exception e) {
e.printStackTrace();
}
Handler mainHandler = new Handler(Looper.getMainLooper());
@ -781,7 +780,7 @@ public class AccountsVM extends AndroidViewModel {
if (unendorseResponse.isSuccessful()) {
relationShip = unendorseResponse.body();
}
} catch (IOException e) {
} catch (Exception e) {
e.printStackTrace();
}
Handler mainHandler = new Handler(Looper.getMainLooper());
@ -812,7 +811,7 @@ public class AccountsVM extends AndroidViewModel {
if (noteResponse.isSuccessful()) {
relationShip = noteResponse.body();
}
} catch (IOException e) {
} catch (Exception e) {
e.printStackTrace();
}
Handler mainHandler = new Handler(Looper.getMainLooper());
@ -842,7 +841,7 @@ public class AccountsVM extends AndroidViewModel {
if (relationshipsResponse.isSuccessful()) {
relationShipList = relationshipsResponse.body();
}
} catch (IOException e) {
} catch (Exception e) {
e.printStackTrace();
}
}
@ -875,7 +874,7 @@ public class AccountsVM extends AndroidViewModel {
if (searchResponse.isSuccessful()) {
accountList = searchResponse.body();
}
} catch (IOException e) {
} catch (Exception e) {
e.printStackTrace();
}
}
@ -912,7 +911,7 @@ public class AccountsVM extends AndroidViewModel {
statuses.statuses = SpannableHelper.convertStatus(getApplication().getApplicationContext(), statusList);
statuses.pagination = MastodonHelper.getPagination(bookmarksResponse.headers());
}
} catch (IOException e) {
} catch (Exception e) {
e.printStackTrace();
}
}
@ -943,7 +942,7 @@ public class AccountsVM extends AndroidViewModel {
statuses.statuses = SpannableHelper.convertStatus(getApplication().getApplicationContext(), statusList);
statuses.pagination = MastodonHelper.getPagination(favouritesResponse.headers());
}
} catch (IOException e) {
} catch (Exception e) {
e.printStackTrace();
}
}
@ -975,7 +974,7 @@ public class AccountsVM extends AndroidViewModel {
accounts.accounts = SpannableHelper.convertAccounts(getApplication().getApplicationContext(), accountList);
accounts.pagination = MastodonHelper.getPagination(mutesResponse.headers());
}
} catch (IOException e) {
} catch (Exception e) {
e.printStackTrace();
}
}
@ -1007,7 +1006,7 @@ public class AccountsVM extends AndroidViewModel {
accounts.accounts = SpannableHelper.convertAccounts(getApplication().getApplicationContext(), accountList);
accounts.pagination = MastodonHelper.getPagination(blocksResponse.headers());
}
} catch (IOException e) {
} catch (Exception e) {
e.printStackTrace();
}
}
@ -1036,7 +1035,7 @@ public class AccountsVM extends AndroidViewModel {
if (getDomainBlocksResponse.isSuccessful()) {
stringList = getDomainBlocksResponse.body();
}
} catch (IOException e) {
} catch (Exception e) {
e.printStackTrace();
}
}
@ -1064,7 +1063,7 @@ public class AccountsVM extends AndroidViewModel {
if (addDomainBlockCall != null) {
try {
addDomainBlockCall.execute();
} catch (IOException e) {
} catch (Exception e) {
e.printStackTrace();
}
}
@ -1083,7 +1082,7 @@ public class AccountsVM extends AndroidViewModel {
if (removeDomainBlockCall != null) {
try {
removeDomainBlockCall.execute();
} catch (IOException e) {
} catch (Exception e) {
e.printStackTrace();
}
}
@ -1108,7 +1107,7 @@ public class AccountsVM extends AndroidViewModel {
BaseMainActivity.filterFetched = true;
filterList = getFiltersResponse.body();
}
} catch (IOException e) {
} catch (Exception e) {
e.printStackTrace();
}
}
@ -1138,7 +1137,7 @@ public class AccountsVM extends AndroidViewModel {
if (getFiltersResponse.isSuccessful()) {
filter = getFiltersResponse.body();
}
} catch (IOException e) {
} catch (Exception e) {
e.printStackTrace();
}
}
@ -1177,7 +1176,7 @@ public class AccountsVM extends AndroidViewModel {
if (addFiltersResponse.isSuccessful()) {
filter = addFiltersResponse.body();
}
} catch (IOException e) {
} catch (Exception e) {
e.printStackTrace();
}
}
@ -1212,7 +1211,7 @@ public class AccountsVM extends AndroidViewModel {
if (editFiltersResponse.isSuccessful()) {
filter = editFiltersResponse.body();
}
} catch (IOException e) {
} catch (Exception e) {
e.printStackTrace();
}
}
@ -1236,7 +1235,7 @@ public class AccountsVM extends AndroidViewModel {
if (removeFilterCall != null) {
try {
removeFilterCall.execute();
} catch (IOException e) {
} catch (Exception e) {
e.printStackTrace();
}
}
@ -1270,7 +1269,7 @@ public class AccountsVM extends AndroidViewModel {
if (reportRequestsResponse.isSuccessful()) {
report = reportRequestsResponse.body();
}
} catch (IOException e) {
} catch (Exception e) {
e.printStackTrace();
}
}
@ -1303,7 +1302,7 @@ public class AccountsVM extends AndroidViewModel {
accounts.accounts = SpannableHelper.convertAccounts(getApplication().getApplicationContext(), accountList);
accounts.pagination = MastodonHelper.getPagination(followRequestsResponse.headers());
}
} catch (IOException e) {
} catch (Exception e) {
e.printStackTrace();
}
Handler mainHandler = new Handler(Looper.getMainLooper());
@ -1332,7 +1331,7 @@ public class AccountsVM extends AndroidViewModel {
if (acceptFollowResponse.isSuccessful()) {
relationShip = acceptFollowResponse.body();
}
} catch (IOException e) {
} catch (Exception e) {
e.printStackTrace();
}
}
@ -1362,7 +1361,7 @@ public class AccountsVM extends AndroidViewModel {
if (rejectFollowResponse.isSuccessful()) {
relationShip = rejectFollowResponse.body();
}
} catch (IOException e) {
} catch (Exception e) {
e.printStackTrace();
}
}
@ -1392,7 +1391,7 @@ public class AccountsVM extends AndroidViewModel {
if (endorsementsResponse.isSuccessful()) {
accountList = endorsementsResponse.body();
}
} catch (IOException e) {
} catch (Exception e) {
e.printStackTrace();
}
}
@ -1421,7 +1420,7 @@ public class AccountsVM extends AndroidViewModel {
if (getFeaturedTagsResponse.isSuccessful()) {
featuredTagList = getFeaturedTagsResponse.body();
}
} catch (IOException e) {
} catch (Exception e) {
e.printStackTrace();
}
Handler mainHandler = new Handler(Looper.getMainLooper());
@ -1451,7 +1450,7 @@ public class AccountsVM extends AndroidViewModel {
if (addFeaturedTagResponse.isSuccessful()) {
featuredTag = addFeaturedTagResponse.body();
}
} catch (IOException e) {
} catch (Exception e) {
e.printStackTrace();
}
}
@ -1475,7 +1474,7 @@ public class AccountsVM extends AndroidViewModel {
if (removeFeaturedTagCall != null) {
try {
removeFeaturedTagCall.execute();
} catch (IOException e) {
} catch (Exception e) {
e.printStackTrace();
}
}
@ -1499,7 +1498,7 @@ public class AccountsVM extends AndroidViewModel {
if (featuredTagsSuggestionsResponse.isSuccessful()) {
tagList = featuredTagsSuggestionsResponse.body();
}
} catch (IOException e) {
} catch (Exception e) {
e.printStackTrace();
}
}
@ -1528,7 +1527,7 @@ public class AccountsVM extends AndroidViewModel {
if (preferencesResponse.isSuccessful()) {
preferences = preferencesResponse.body();
}
} catch (IOException e) {
} catch (Exception e) {
e.printStackTrace();
}
}
@ -1558,7 +1557,7 @@ public class AccountsVM extends AndroidViewModel {
if (suggestionsResponse.isSuccessful()) {
accountList = suggestionsResponse.body();
}
} catch (IOException e) {
} catch (Exception e) {
e.printStackTrace();
}
}
@ -1582,7 +1581,7 @@ public class AccountsVM extends AndroidViewModel {
if (removeSuggestionCall != null) {
try {
removeSuggestionCall.execute();
} catch (IOException e) {
} catch (Exception e) {
e.printStackTrace();
}
}

View file

@ -23,7 +23,6 @@ import androidx.lifecycle.AndroidViewModel;
import androidx.lifecycle.LiveData;
import androidx.lifecycle.MutableLiveData;
import java.io.IOException;
import java.util.List;
import java.util.concurrent.TimeUnit;
@ -119,7 +118,7 @@ public class AdminVM extends AndroidViewModel {
adminAccounts.adminAccounts = getAccountsResponse.body();
adminAccounts.pagination = MastodonHelper.getPagination(getAccountsResponse.headers());
}
} catch (IOException e) {
} catch (Exception e) {
e.printStackTrace();
}
}
@ -150,7 +149,7 @@ public class AdminVM extends AndroidViewModel {
if (getAccountResponse.isSuccessful()) {
adminAccount = getAccountResponse.body();
}
} catch (IOException e) {
} catch (Exception e) {
e.printStackTrace();
}
}
@ -188,7 +187,7 @@ public class AdminVM extends AndroidViewModel {
if (performActionCall != null) {
try {
performActionCall.execute();
} catch (IOException e) {
} catch (Exception e) {
e.printStackTrace();
}
}
@ -215,7 +214,7 @@ public class AdminVM extends AndroidViewModel {
if (approveResponse.isSuccessful()) {
adminAccount = approveResponse.body();
}
} catch (IOException e) {
} catch (Exception e) {
e.printStackTrace();
}
}
@ -247,7 +246,7 @@ public class AdminVM extends AndroidViewModel {
if (rejectResponse.isSuccessful()) {
adminAccount = rejectResponse.body();
}
} catch (IOException e) {
} catch (Exception e) {
e.printStackTrace();
}
}
@ -279,7 +278,7 @@ public class AdminVM extends AndroidViewModel {
if (enableResponse.isSuccessful()) {
adminAccount = enableResponse.body();
}
} catch (IOException e) {
} catch (Exception e) {
e.printStackTrace();
}
}
@ -311,7 +310,7 @@ public class AdminVM extends AndroidViewModel {
if (unsilenceResponse.isSuccessful()) {
adminAccount = unsilenceResponse.body();
}
} catch (IOException e) {
} catch (Exception e) {
e.printStackTrace();
}
}
@ -343,7 +342,7 @@ public class AdminVM extends AndroidViewModel {
if (unsuspendResponse.isSuccessful()) {
adminAccount = unsuspendResponse.body();
}
} catch (IOException e) {
} catch (Exception e) {
e.printStackTrace();
}
}
@ -382,7 +381,7 @@ public class AdminVM extends AndroidViewModel {
adminReports.adminReports = adminReportList;
adminReports.pagination = MastodonHelper.getPagination(getReportsResponse.headers());
}
} catch (IOException e) {
} catch (Exception e) {
e.printStackTrace();
}
}
@ -412,7 +411,7 @@ public class AdminVM extends AndroidViewModel {
if (getReportResponse.isSuccessful()) {
adminReport = getReportResponse.body();
}
} catch (IOException e) {
} catch (Exception e) {
e.printStackTrace();
}
}
@ -443,7 +442,7 @@ public class AdminVM extends AndroidViewModel {
if (assignToSelfResponse.isSuccessful()) {
adminReport = assignToSelfResponse.body();
}
} catch (IOException e) {
} catch (Exception e) {
e.printStackTrace();
}
}
@ -474,7 +473,7 @@ public class AdminVM extends AndroidViewModel {
if (unassignResponse.isSuccessful()) {
adminReport = unassignResponse.body();
}
} catch (IOException e) {
} catch (Exception e) {
e.printStackTrace();
}
}
@ -505,7 +504,7 @@ public class AdminVM extends AndroidViewModel {
if (resolvedResponse.isSuccessful()) {
adminReport = resolvedResponse.body();
}
} catch (IOException e) {
} catch (Exception e) {
e.printStackTrace();
}
}
@ -536,7 +535,7 @@ public class AdminVM extends AndroidViewModel {
if (reopenResponse.isSuccessful()) {
adminReport = reopenResponse.body();
}
} catch (IOException e) {
} catch (Exception e) {
e.printStackTrace();
}
}

View file

@ -23,7 +23,6 @@ import androidx.lifecycle.AndroidViewModel;
import androidx.lifecycle.LiveData;
import androidx.lifecycle.MutableLiveData;
import java.io.IOException;
import java.util.List;
import java.util.concurrent.TimeUnit;
@ -80,7 +79,7 @@ public class AnnouncementsVM extends AndroidViewModel {
if (getAnnouncementsResponse.isSuccessful()) {
announcementList = getAnnouncementsResponse.body();
}
} catch (IOException e) {
} catch (Exception e) {
e.printStackTrace();
}
}
@ -106,7 +105,7 @@ public class AnnouncementsVM extends AndroidViewModel {
if (dismissCall != null) {
try {
dismissCall.execute();
} catch (IOException e) {
} catch (Exception e) {
e.printStackTrace();
}
}
@ -128,7 +127,7 @@ public class AnnouncementsVM extends AndroidViewModel {
if (addReactionCall != null) {
try {
addReactionCall.execute();
} catch (IOException e) {
} catch (Exception e) {
e.printStackTrace();
}
}
@ -150,7 +149,7 @@ public class AnnouncementsVM extends AndroidViewModel {
if (removeReactionCall != null) {
try {
removeReactionCall.execute();
} catch (IOException e) {
} catch (Exception e) {
e.printStackTrace();
}
}

View file

@ -23,7 +23,6 @@ import androidx.lifecycle.AndroidViewModel;
import androidx.lifecycle.LiveData;
import androidx.lifecycle.MutableLiveData;
import java.io.IOException;
import java.util.concurrent.TimeUnit;
import app.fedilab.android.client.endpoints.MastodonAppsService;
@ -88,7 +87,7 @@ public class AppsVM extends AndroidViewModel {
if (appResponse.isSuccessful()) {
app = appResponse.body();
}
} catch (IOException e) {
} catch (Exception e) {
e.printStackTrace();
}
}
@ -117,7 +116,7 @@ public class AppsVM extends AndroidViewModel {
if (appResponse.isSuccessful()) {
app = appResponse.body();
}
} catch (IOException e) {
} catch (Exception e) {
e.printStackTrace();
}
}

View file

@ -22,7 +22,6 @@ import androidx.annotation.NonNull;
import androidx.lifecycle.AndroidViewModel;
import androidx.lifecycle.MutableLiveData;
import java.io.IOException;
import java.util.concurrent.TimeUnit;
import app.fedilab.android.client.entities.app.InstanceSocial;
@ -77,7 +76,7 @@ public class InstanceSocialVM extends AndroidViewModel {
Runnable myRunnable = () -> instanceSocialMutableLiveData.setValue(response.body());
mainHandler.post(myRunnable);
}
} catch (IOException e) {
} catch (Exception e) {
e.printStackTrace();
}
}).start();

View file

@ -23,7 +23,6 @@ import androidx.lifecycle.AndroidViewModel;
import androidx.lifecycle.LiveData;
import androidx.lifecycle.MutableLiveData;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.TimeUnit;
@ -80,7 +79,7 @@ public class InstancesVM extends AndroidViewModel {
if (emojiResponse.isSuccessful()) {
emojiInstance.emojiList = emojiResponse.body();
}
} catch (IOException e) {
} catch (Exception e) {
e.printStackTrace();
}
}
@ -113,7 +112,7 @@ public class InstancesVM extends AndroidViewModel {
instanceInfo.info = instanceResponse.body();
}
} catch (IOException e) {
} catch (Exception e) {
e.printStackTrace();
}
}

View file

@ -23,7 +23,6 @@ import androidx.lifecycle.AndroidViewModel;
import androidx.lifecycle.LiveData;
import androidx.lifecycle.MutableLiveData;
import java.io.IOException;
import java.util.List;
import java.util.concurrent.TimeUnit;
@ -87,7 +86,7 @@ public class JoinInstancesVM extends AndroidViewModel {
if (listResponse.isSuccessful()) {
joinMastodonInstanceList = listResponse.body();
}
} catch (IOException e) {
} catch (Exception e) {
e.printStackTrace();
}
}

View file

@ -24,7 +24,6 @@ import androidx.lifecycle.AndroidViewModel;
import androidx.lifecycle.LiveData;
import androidx.lifecycle.MutableLiveData;
import java.io.IOException;
import java.util.concurrent.TimeUnit;
import app.fedilab.android.client.NodeInfoService;
@ -85,12 +84,12 @@ public class NodeInfoVM extends AndroidViewModel {
if (response.isSuccessful() && response.body() != null) {
nodeInfo = response.body();
}
} catch (IOException e) {
} catch (Exception e) {
e.printStackTrace();
}
}
}
} catch (IOException e) {
} catch (Exception e) {
e.printStackTrace();
}
}

View file

@ -23,7 +23,6 @@ import androidx.lifecycle.AndroidViewModel;
import androidx.lifecycle.LiveData;
import androidx.lifecycle.MutableLiveData;
import java.io.IOException;
import java.util.List;
import java.util.concurrent.TimeUnit;
@ -109,7 +108,7 @@ public class NotificationsVM extends AndroidViewModel {
}
notifications.pagination = MastodonHelper.getPagination(notificationsResponse.headers());
}
} catch (IOException e) {
} catch (Exception e) {
e.printStackTrace();
}
}
@ -146,7 +145,7 @@ public class NotificationsVM extends AndroidViewModel {
notification.status = SpannableHelper.convertStatus(getApplication().getApplicationContext(), notification.status);
}
}
} catch (IOException e) {
} catch (Exception e) {
e.printStackTrace();
}
}
@ -173,7 +172,7 @@ public class NotificationsVM extends AndroidViewModel {
if (voidCall != null) {
try {
voidCall.execute();
} catch (IOException e) {
} catch (Exception e) {
e.printStackTrace();
}
}
@ -201,7 +200,7 @@ public class NotificationsVM extends AndroidViewModel {
if (voidCall != null) {
try {
voidCall.execute();
} catch (IOException e) {
} catch (Exception e) {
e.printStackTrace();
}
}
@ -249,7 +248,7 @@ public class NotificationsVM extends AndroidViewModel {
if (pushSubscriptionResponse.isSuccessful()) {
pushSubscription = pushSubscriptionResponse.body();
}
} catch (IOException e) {
} catch (Exception e) {
e.printStackTrace();
}
}
@ -282,7 +281,7 @@ public class NotificationsVM extends AndroidViewModel {
if (pushSubscriptionResponse.isSuccessful()) {
pushSubscription = pushSubscriptionResponse.body();
}
} catch (IOException e) {
} catch (Exception e) {
e.printStackTrace();
}
}
@ -325,7 +324,7 @@ public class NotificationsVM extends AndroidViewModel {
if (pushSubscriptionResponse.isSuccessful()) {
pushSubscription = pushSubscriptionResponse.body();
}
} catch (IOException e) {
} catch (Exception e) {
e.printStackTrace();
}
}
@ -352,7 +351,7 @@ public class NotificationsVM extends AndroidViewModel {
if (voidCall != null) {
try {
voidCall.execute();
} catch (IOException e) {
} catch (Exception e) {
e.printStackTrace();
}
}

View file

@ -23,7 +23,6 @@ import androidx.lifecycle.AndroidViewModel;
import androidx.lifecycle.LiveData;
import androidx.lifecycle.MutableLiveData;
import java.io.IOException;
import java.util.concurrent.TimeUnit;
import app.fedilab.android.client.endpoints.MastodonAppsService;
@ -91,7 +90,7 @@ public class OauthVM extends AndroidViewModel {
if (tokenResponse.isSuccessful()) {
token = tokenResponse.body();
}
} catch (IOException e) {
} catch (Exception e) {
e.printStackTrace();
}
}
@ -121,7 +120,7 @@ public class OauthVM extends AndroidViewModel {
if (voidCall != null) {
try {
voidCall.execute();
} catch (IOException e) {
} catch (Exception e) {
e.printStackTrace();
}
}

View file

@ -23,7 +23,6 @@ import androidx.lifecycle.AndroidViewModel;
import androidx.lifecycle.LiveData;
import androidx.lifecycle.MutableLiveData;
import java.io.IOException;
import java.util.ArrayList;
import java.util.concurrent.TimeUnit;
@ -156,7 +155,7 @@ public class ReorderVM extends AndroidViewModel {
}
}
}
} catch (IOException e) {
} catch (Exception e) {
e.printStackTrace();
}
}

View file

@ -23,7 +23,6 @@ import androidx.lifecycle.AndroidViewModel;
import androidx.lifecycle.LiveData;
import androidx.lifecycle.MutableLiveData;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.TimeUnit;
@ -120,7 +119,7 @@ public class SearchVM extends AndroidViewModel {
}
}
}
} catch (IOException e) {
} catch (Exception e) {
e.printStackTrace();
}
}

View file

@ -25,7 +25,6 @@ import androidx.lifecycle.AndroidViewModel;
import androidx.lifecycle.LiveData;
import androidx.lifecycle.MutableLiveData;
import java.io.IOException;
import java.util.Date;
import java.util.List;
import java.util.concurrent.TimeUnit;
@ -127,7 +126,7 @@ public class StatusesVM extends AndroidViewModel {
if (attachmentResponse.isSuccessful()) {
attachment = attachmentResponse.body();
}
} catch (IOException e) {
} catch (Exception e) {
e.printStackTrace();
}
}
@ -187,7 +186,7 @@ public class StatusesVM extends AndroidViewModel {
if (statusResponse.isSuccessful()) {
status = statusResponse.body();
}
} catch (IOException e) {
} catch (Exception e) {
e.printStackTrace();
}
}
@ -249,7 +248,7 @@ public class StatusesVM extends AndroidViewModel {
if (scheduledStatusResponse.isSuccessful()) {
scheduledStatus = scheduledStatusResponse.body();
}
} catch (IOException e) {
} catch (Exception e) {
e.printStackTrace();
}
}
@ -281,7 +280,7 @@ public class StatusesVM extends AndroidViewModel {
if (statusResponse.isSuccessful()) {
status = SpannableHelper.convertStatus(getApplication().getApplicationContext(), statusResponse.body());
}
} catch (IOException e) {
} catch (Exception e) {
e.printStackTrace();
}
}
@ -313,7 +312,7 @@ public class StatusesVM extends AndroidViewModel {
if (statusResponse.isSuccessful()) {
status = statusResponse.body();
}
} catch (IOException e) {
} catch (Exception e) {
e.printStackTrace();
}
}
@ -366,7 +365,7 @@ public class StatusesVM extends AndroidViewModel {
}
}
} catch (IOException e) {
} catch (Exception e) {
e.printStackTrace();
}
}
@ -409,7 +408,7 @@ public class StatusesVM extends AndroidViewModel {
accounts = SpannableHelper.convertAccounts(getApplication().getApplicationContext(), accountsResponse.body());
}
headers = accountsResponse.headers();
} catch (IOException e) {
} catch (Exception e) {
e.printStackTrace();
}
}
@ -454,7 +453,7 @@ public class StatusesVM extends AndroidViewModel {
accounts = SpannableHelper.convertAccounts(getApplication().getApplicationContext(), accountsResponse.body());
}
headers = accountsResponse.headers();
} catch (IOException e) {
} catch (Exception e) {
e.printStackTrace();
}
}
@ -493,7 +492,7 @@ public class StatusesVM extends AndroidViewModel {
errorMessage = statusResponse.errorBody().string();
}
}
} catch (IOException e) {
} catch (Exception e) {
e.printStackTrace();
errorMessage = e.getMessage() != null ? e.getMessage() : getApplication().getString(R.string.toast_error);
}
@ -537,7 +536,7 @@ public class StatusesVM extends AndroidViewModel {
errorMessage = statusResponse.errorBody().string();
}
}
} catch (IOException e) {
} catch (Exception e) {
e.printStackTrace();
errorMessage = e.getMessage() != null ? e.getMessage() : getApplication().getString(R.string.toast_error);
}
@ -583,7 +582,7 @@ public class StatusesVM extends AndroidViewModel {
errorMessage = statusResponse.errorBody().string();
}
}
} catch (IOException e) {
} catch (Exception e) {
e.printStackTrace();
errorMessage = e.getMessage() != null ? e.getMessage() : getApplication().getString(R.string.toast_error);
}
@ -627,7 +626,7 @@ public class StatusesVM extends AndroidViewModel {
errorMessage = statusResponse.errorBody().string();
}
}
} catch (IOException e) {
} catch (Exception e) {
e.printStackTrace();
errorMessage = e.getMessage() != null ? e.getMessage() : getApplication().getString(R.string.toast_error);
}
@ -671,7 +670,7 @@ public class StatusesVM extends AndroidViewModel {
errorMessage = statusResponse.errorBody().string();
}
}
} catch (IOException e) {
} catch (Exception e) {
e.printStackTrace();
errorMessage = e.getMessage() != null ? e.getMessage() : getApplication().getString(R.string.toast_error);
}
@ -715,7 +714,7 @@ public class StatusesVM extends AndroidViewModel {
errorMessage = statusResponse.errorBody().string();
}
}
} catch (IOException e) {
} catch (Exception e) {
e.printStackTrace();
errorMessage = e.getMessage() != null ? e.getMessage() : getApplication().getString(R.string.toast_error);
}
@ -759,7 +758,7 @@ public class StatusesVM extends AndroidViewModel {
errorMessage = statusResponse.errorBody().string();
}
}
} catch (IOException e) {
} catch (Exception e) {
e.printStackTrace();
errorMessage = e.getMessage() != null ? e.getMessage() : getApplication().getString(R.string.toast_error);
}
@ -803,7 +802,7 @@ public class StatusesVM extends AndroidViewModel {
errorMessage = statusResponse.errorBody().string();
}
}
} catch (IOException e) {
} catch (Exception e) {
e.printStackTrace();
errorMessage = e.getMessage() != null ? e.getMessage() : getApplication().getString(R.string.toast_error);
}
@ -847,7 +846,7 @@ public class StatusesVM extends AndroidViewModel {
errorMessage = statusResponse.errorBody().string();
}
}
} catch (IOException e) {
} catch (Exception e) {
e.printStackTrace();
errorMessage = e.getMessage() != null ? e.getMessage() : getApplication().getString(R.string.toast_error);
}
@ -891,7 +890,7 @@ public class StatusesVM extends AndroidViewModel {
errorMessage = statusResponse.errorBody().string();
}
}
} catch (IOException e) {
} catch (Exception e) {
e.printStackTrace();
errorMessage = e.getMessage() != null ? e.getMessage() : getApplication().getString(R.string.toast_error);
}
@ -930,7 +929,7 @@ public class StatusesVM extends AndroidViewModel {
if (cardResponse.isSuccessful()) {
card = cardResponse.body();
}
} catch (IOException e) {
} catch (Exception e) {
e.printStackTrace();
}
}
@ -962,7 +961,7 @@ public class StatusesVM extends AndroidViewModel {
if (attachmentResponse.isSuccessful()) {
attachment = attachmentResponse.body();
}
} catch (IOException e) {
} catch (Exception e) {
e.printStackTrace();
}
}
@ -1008,7 +1007,7 @@ public class StatusesVM extends AndroidViewModel {
if (attachmentResponse.isSuccessful()) {
attachment = attachmentResponse.body();
}
} catch (IOException e) {
} catch (Exception e) {
e.printStackTrace();
}
}
@ -1040,7 +1039,7 @@ public class StatusesVM extends AndroidViewModel {
if (pollResponse.isSuccessful()) {
poll = pollResponse.body();
}
} catch (IOException e) {
} catch (Exception e) {
e.printStackTrace();
}
}
@ -1073,7 +1072,7 @@ public class StatusesVM extends AndroidViewModel {
if (pollResponse.isSuccessful()) {
poll = pollResponse.body();
}
} catch (IOException e) {
} catch (Exception e) {
e.printStackTrace();
}
}
@ -1115,7 +1114,7 @@ public class StatusesVM extends AndroidViewModel {
scheduledStatusList = scheduledStatusResponse.body();
pagination = MastodonHelper.getPagination(scheduledStatusResponse.headers());
}
} catch (IOException e) {
} catch (Exception e) {
e.printStackTrace();
}
}
@ -1149,7 +1148,7 @@ public class StatusesVM extends AndroidViewModel {
if (scheduledStatusResponse.isSuccessful()) {
scheduledStatus = scheduledStatusResponse.body();
}
} catch (IOException e) {
} catch (Exception e) {
e.printStackTrace();
}
}
@ -1181,7 +1180,7 @@ public class StatusesVM extends AndroidViewModel {
if (scheduledStatusResponse.isSuccessful()) {
scheduledStatus = scheduledStatusResponse.body();
}
} catch (IOException e) {
} catch (Exception e) {
e.printStackTrace();
}
}
@ -1209,7 +1208,7 @@ public class StatusesVM extends AndroidViewModel {
if (voidCall != null) {
try {
voidCall.execute();
} catch (IOException e) {
} catch (Exception e) {
e.printStackTrace();
}
}

View file

@ -24,7 +24,6 @@ import androidx.lifecycle.AndroidViewModel;
import androidx.lifecycle.LiveData;
import androidx.lifecycle.MutableLiveData;
import java.io.IOException;
import java.util.List;
import java.util.concurrent.TimeUnit;
@ -118,7 +117,7 @@ public class TimelinesVM extends AndroidViewModel {
statuses.statuses = SpannableHelper.convertStatus(getApplication().getApplicationContext(), filteredStatuses);
statuses.pagination = MastodonHelper.getPagination(publicTlResponse.headers());
}
} catch (IOException e) {
} catch (Exception e) {
e.printStackTrace();
}
}
@ -167,7 +166,7 @@ public class TimelinesVM extends AndroidViewModel {
statuses.statuses = SpannableHelper.convertStatus(getApplication().getApplicationContext(), filteredStatuses);
statuses.pagination = MastodonHelper.getPagination(hashTagTlResponse.headers());
}
} catch (IOException e) {
} catch (Exception e) {
e.printStackTrace();
}
}
@ -223,7 +222,7 @@ public class TimelinesVM extends AndroidViewModel {
}
}
}
} catch (IOException e) {
} catch (Exception e) {
e.printStackTrace();
}
}
@ -324,7 +323,7 @@ public class TimelinesVM extends AndroidViewModel {
statuses.statuses = SpannableHelper.convertStatus(getApplication().getApplicationContext(), listTlResponse.body());
statuses.pagination = MastodonHelper.getPagination(listTlResponse.headers());
}
} catch (IOException e) {
} catch (Exception e) {
e.printStackTrace();
}
}
@ -364,7 +363,7 @@ public class TimelinesVM extends AndroidViewModel {
}
conversations.pagination = MastodonHelper.getPagination(conversationsResponse.headers());
}
} catch (IOException e) {
} catch (Exception e) {
e.printStackTrace();
}
}
@ -389,7 +388,7 @@ public class TimelinesVM extends AndroidViewModel {
if (deleteStatusCall != null) {
try {
deleteStatusCall.execute();
} catch (IOException e) {
} catch (Exception e) {
e.printStackTrace();
}
}
@ -414,7 +413,7 @@ public class TimelinesVM extends AndroidViewModel {
if (markReadConversationResponse.isSuccessful()) {
status = markReadConversationResponse.body();
}
} catch (IOException e) {
} catch (Exception e) {
e.printStackTrace();
}
}
@ -443,7 +442,7 @@ public class TimelinesVM extends AndroidViewModel {
if (getListsResponse.isSuccessful()) {
mastodonListList = getListsResponse.body();
}
} catch (IOException e) {
} catch (Exception e) {
e.printStackTrace();
}
}
@ -474,7 +473,7 @@ public class TimelinesVM extends AndroidViewModel {
if (getListResponse.isSuccessful()) {
mastodonList = getListResponse.body();
}
} catch (IOException e) {
} catch (Exception e) {
e.printStackTrace();
}
}
@ -505,7 +504,7 @@ public class TimelinesVM extends AndroidViewModel {
if (createListResponse.isSuccessful()) {
mastodonList = createListResponse.body();
}
} catch (IOException e) {
} catch (Exception e) {
e.printStackTrace();
}
}
@ -537,7 +536,7 @@ public class TimelinesVM extends AndroidViewModel {
if (updateListResponse.isSuccessful()) {
mastodonList = updateListResponse.body();
}
} catch (IOException e) {
} catch (Exception e) {
e.printStackTrace();
}
}
@ -561,7 +560,7 @@ public class TimelinesVM extends AndroidViewModel {
if (deleteListCall != null) {
try {
deleteListCall.execute();
} catch (IOException e) {
} catch (Exception e) {
e.printStackTrace();
}
}
@ -586,7 +585,7 @@ public class TimelinesVM extends AndroidViewModel {
if (getAccountsInListResponse.isSuccessful()) {
accountList = getAccountsInListResponse.body();
}
} catch (IOException e) {
} catch (Exception e) {
e.printStackTrace();
}
}
@ -611,7 +610,7 @@ public class TimelinesVM extends AndroidViewModel {
if (addAccountsListCall != null) {
try {
addAccountsListCall.execute();
} catch (IOException e) {
} catch (Exception e) {
e.printStackTrace();
}
}
@ -631,7 +630,7 @@ public class TimelinesVM extends AndroidViewModel {
if (deleteAccountsListCall != null) {
try {
deleteAccountsListCall.execute();
} catch (IOException e) {
} catch (Exception e) {
e.printStackTrace();
}
}
@ -682,7 +681,7 @@ public class TimelinesVM extends AndroidViewModel {
if (addMarkerCall != null) {
try {
addMarkerCall.execute();
} catch (IOException e) {
} catch (Exception e) {
e.printStackTrace();
}
}