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) { if (adminAccount.disabled) {
adminVM.enable(MainActivity.currentInstance, MainActivity.currentToken, account.id) adminVM.enable(MainActivity.currentInstance, MainActivity.currentToken, account.id)
.observe(AdminReportActivity.this, adminAccountResult -> { .observe(AdminReportActivity.this, adminAccountResult -> {
adminAccount.disabled = false; if (adminAccountResult != null) {
binding.disableAction.setText(R.string.disable); adminAccount.disabled = false;
binding.disabled.setText(R.string.no); 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 { } else {
adminVM.performAction(MainActivity.currentInstance, MainActivity.currentToken, account.id, "disable ", null, null, null, null); 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) { if (adminAccount.approved) {
adminVM.reject(MainActivity.currentInstance, MainActivity.currentToken, account.id) adminVM.reject(MainActivity.currentInstance, MainActivity.currentToken, account.id)
.observe(AdminReportActivity.this, adminAccountResult -> { .observe(AdminReportActivity.this, adminAccountResult -> {
adminAccount.approved = false; if (adminAccountResult != null) {
binding.approveAction.setText(R.string.approve); adminAccount.approved = false;
binding.approved.setText(R.string.no); 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 { } else {
adminVM.approve(MainActivity.currentInstance, MainActivity.currentToken, account.id); adminVM.approve(MainActivity.currentInstance, MainActivity.currentToken, account.id);
@ -205,9 +215,13 @@ public class AdminReportActivity extends BaseActivity {
if (adminAccount.disabled) { if (adminAccount.disabled) {
adminVM.unsilence(MainActivity.currentInstance, MainActivity.currentToken, account.id) adminVM.unsilence(MainActivity.currentInstance, MainActivity.currentToken, account.id)
.observe(AdminReportActivity.this, adminAccountResult -> { .observe(AdminReportActivity.this, adminAccountResult -> {
adminAccount.silenced = false; if (adminAccountResult != null) {
binding.silenceAction.setText(R.string.silence); adminAccount.silenced = false;
binding.disabled.setText(R.string.no); 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 { } else {
adminVM.performAction(MainActivity.currentInstance, MainActivity.currentToken, account.id, "silence", null, null, null, null); 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) { if (adminAccount.disabled) {
adminVM.unsuspend(MainActivity.currentInstance, MainActivity.currentToken, account.id) adminVM.unsuspend(MainActivity.currentInstance, MainActivity.currentToken, account.id)
.observe(AdminReportActivity.this, adminAccountResult -> { .observe(AdminReportActivity.this, adminAccountResult -> {
adminAccount.suspended = false; if (adminAccountResult != null) {
binding.suspendAction.setText(R.string.suspend); adminAccount.suspended = false;
binding.suspended.setText(R.string.no); 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 { } else {
adminVM.performAction(MainActivity.currentInstance, MainActivity.currentToken, account.id, "suspend", null, null, null, null); 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 if (statusReplyId != null && statusDraft != null) {//Delete and redraft
statusesVM.getStatus(BaseMainActivity.currentInstance, BaseMainActivity.currentToken, statusReplyId) statusesVM.getStatus(BaseMainActivity.currentInstance, BaseMainActivity.currentToken, statusReplyId)
.observe(ComposeActivity.this, status1 -> { .observe(ComposeActivity.this, status1 -> {
statusesVM.getContext(BaseMainActivity.currentInstance, BaseMainActivity.currentToken, statusReplyId) if (status1 != null) {
.observe(ComposeActivity.this, statusContext -> { statusesVM.getContext(BaseMainActivity.currentInstance, BaseMainActivity.currentToken, statusReplyId)
initializeContextRedraftView(statusContext, status1); .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 } else if (statusDraft != null) {//Restore a draft with all messages
new Thread(() -> { 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) new ViewModelProvider(EditProfileActivity.this).get(AccountsVM.class).getConnectedAccount(BaseMainActivity.currentInstance, BaseMainActivity.currentToken)
.observe(EditProfileActivity.this, account -> { .observe(EditProfileActivity.this, account -> {
BaseMainActivity.accountWeakReference.get().mastodon_account = account; if (account != null) {
initializeView(); BaseMainActivity.accountWeakReference.get().mastodon_account = account;
initializeView();
} else {
Helper.sendToastMessage(getApplication(), Helper.RECEIVE_TOAST_TYPE_ERROR, getString(R.string.toast_error));
}
}); });
} }
@ -187,17 +191,21 @@ public class EditProfileActivity extends BaseActivity {
.into(binding.accountPp); .into(binding.accountPp);
accountsVM.updateProfilePicture(BaseMainActivity.currentInstance, BaseMainActivity.currentToken, data.getData(), AccountsVM.UpdateMediaType.AVATAR) accountsVM.updateProfilePicture(BaseMainActivity.currentInstance, BaseMainActivity.currentToken, data.getData(), AccountsVM.UpdateMediaType.AVATAR)
.observe(EditProfileActivity.this, account -> { .observe(EditProfileActivity.this, account -> {
sendBroadCast(account); if (account != null) {
binding.avatarProgress.setVisibility(View.GONE); sendBroadCast(account);
BaseMainActivity.accountWeakReference.get().mastodon_account = account; binding.avatarProgress.setVisibility(View.GONE);
Helper.recreateMainActivity(EditProfileActivity.this); BaseMainActivity.accountWeakReference.get().mastodon_account = account;
new Thread(() -> { Helper.recreateMainActivity(EditProfileActivity.this);
try { new Thread(() -> {
new app.fedilab.android.client.entities.app.Account(EditProfileActivity.this).insertOrUpdate(BaseMainActivity.accountWeakReference.get()); try {
} catch (DBException e) { new app.fedilab.android.client.entities.app.Account(EditProfileActivity.this).insertOrUpdate(BaseMainActivity.accountWeakReference.get());
e.printStackTrace(); } catch (DBException e) {
} e.printStackTrace();
}).start(); }
}).start();
} else {
Helper.sendToastMessage(getApplication(), Helper.RECEIVE_TOAST_TYPE_ERROR, getString(R.string.toast_error));
}
}); });
} else if (requestCode == PICK_MEDIA_HEADER && resultCode == RESULT_OK) { } else if (requestCode == PICK_MEDIA_HEADER && resultCode == RESULT_OK) {
Glide.with(EditProfileActivity.this) Glide.with(EditProfileActivity.this)
@ -208,18 +216,21 @@ public class EditProfileActivity extends BaseActivity {
binding.headerProgress.setVisibility(View.VISIBLE); binding.headerProgress.setVisibility(View.VISIBLE);
accountsVM.updateProfilePicture(BaseMainActivity.currentInstance, BaseMainActivity.currentToken, data.getData(), AccountsVM.UpdateMediaType.HEADER) accountsVM.updateProfilePicture(BaseMainActivity.currentInstance, BaseMainActivity.currentToken, data.getData(), AccountsVM.UpdateMediaType.HEADER)
.observe(EditProfileActivity.this, account -> { .observe(EditProfileActivity.this, account -> {
sendBroadCast(account); if (account != null) {
binding.headerProgress.setVisibility(View.GONE); sendBroadCast(account);
BaseMainActivity.accountWeakReference.get().mastodon_account = account; binding.headerProgress.setVisibility(View.GONE);
new Thread(() -> { BaseMainActivity.accountWeakReference.get().mastodon_account = account;
try { new Thread(() -> {
new app.fedilab.android.client.entities.app.Account(EditProfileActivity.this).insertOrUpdate(BaseMainActivity.accountWeakReference.get()); try {
} catch (DBException e) { new app.fedilab.android.client.entities.app.Account(EditProfileActivity.this).insertOrUpdate(BaseMainActivity.accountWeakReference.get());
e.printStackTrace(); } catch (DBException e) {
} e.printStackTrace();
}).start(); }
}).start();
Helper.recreateMainActivity(EditProfileActivity.this); Helper.recreateMainActivity(EditProfileActivity.this);
} else {
Helper.sendToastMessage(getApplication(), Helper.RECEIVE_TOAST_TYPE_ERROR, getString(R.string.toast_error));
}
}); });
} }
} }
@ -301,18 +312,22 @@ public class EditProfileActivity extends BaseActivity {
getFields() getFields()
) )
.observe(EditProfileActivity.this, account -> { .observe(EditProfileActivity.this, account -> {
BaseMainActivity.accountWeakReference.get().mastodon_account = account; if (account != null) {
new Thread(() -> { BaseMainActivity.accountWeakReference.get().mastodon_account = account;
try { new Thread(() -> {
new app.fedilab.android.client.entities.app.Account(EditProfileActivity.this).insertOrUpdate(BaseMainActivity.accountWeakReference.get()); try {
sendBroadCast(account); new app.fedilab.android.client.entities.app.Account(EditProfileActivity.this).insertOrUpdate(BaseMainActivity.accountWeakReference.get());
} catch (DBException e) { sendBroadCast(account);
e.printStackTrace(); } catch (DBException e) {
} e.printStackTrace();
}).start(); }
}).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));
}
Toasty.success(EditProfileActivity.this, getString(R.string.profiled_updated), Toasty.LENGTH_LONG).show();
finish();
}); });
return true; return true;
} }

View file

@ -627,8 +627,11 @@ public class SpannableHelper {
* @param text String - text to convert, it can be display name or bio * @param text String - text to convert, it can be display name or bio
* @return Spannable string * @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; SpannableString initialContent;
if (text == null) {
return null;
}
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N)
initialContent = new SpannableString(Html.fromHtml(text, Html.FROM_HTML_MODE_LEGACY)); initialContent = new SpannableString(Html.fromHtml(text, Html.FROM_HTML_MODE_LEGACY));
else else

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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