Truncate long error messages
This commit is contained in:
parent
497da30eb3
commit
318bd9cb58
|
@ -387,7 +387,11 @@ public class MutedInstanceActivity extends BaseActivity implements OnRetrieveDom
|
|||
@Override
|
||||
public void onPostAction(int statusCode, API.StatusAction statusAction, String userId, Error error) {
|
||||
if (error != null) {
|
||||
Toasty.error(getApplicationContext(), error.getError(), Toast.LENGTH_LONG).show();
|
||||
if(error.getError().length() < 100) {
|
||||
Toasty.error(getApplicationContext(), error.getError(), Toast.LENGTH_LONG).show();
|
||||
}else{
|
||||
Toasty.error(getApplicationContext(), getString(R.string.long_api_error,"\ud83d\ude05"), Toast.LENGTH_LONG).show();
|
||||
}
|
||||
return;
|
||||
}
|
||||
Helper.manageMessageStatusCode(MutedInstanceActivity.this, statusCode, statusAction);
|
||||
|
|
|
@ -168,7 +168,11 @@ public class SearchResultActivity extends BaseActivity implements OnRetrieveSear
|
|||
public void onRetrieveSearchStatus(APIResponse apiResponse, Error error) {
|
||||
loader.setVisibility(View.GONE);
|
||||
if (apiResponse.getError() != null) {
|
||||
Toasty.error(getApplicationContext(), error.getError(), Toast.LENGTH_LONG).show();
|
||||
if(error.getError().length() < 100) {
|
||||
Toasty.error(getApplicationContext(), error.getError(), Toast.LENGTH_LONG).show();
|
||||
}else{
|
||||
Toasty.error(getApplicationContext(), getString(R.string.long_api_error,"\ud83d\ude05"), Toast.LENGTH_LONG).show();
|
||||
}
|
||||
return;
|
||||
}
|
||||
lv_search.setVisibility(View.VISIBLE);
|
||||
|
|
|
@ -1000,7 +1000,11 @@ public class ShowAccountActivity extends BaseActivity implements OnPostActionInt
|
|||
public void onRetrieveRelationship(Relationship relationship, Error error) {
|
||||
|
||||
if (error != null) {
|
||||
Toasty.error(getApplicationContext(), error.getError(), Toast.LENGTH_LONG).show();
|
||||
if(error.getError().length() < 100) {
|
||||
Toasty.error(getApplicationContext(), error.getError(), Toast.LENGTH_LONG).show();
|
||||
}else{
|
||||
Toasty.error(getApplicationContext(), getString(R.string.long_api_error,"\ud83d\ude05"), Toast.LENGTH_LONG).show();
|
||||
}
|
||||
return;
|
||||
}
|
||||
this.relationship = relationship;
|
||||
|
@ -1613,7 +1617,11 @@ public class ShowAccountActivity extends BaseActivity implements OnPostActionInt
|
|||
public void onPostAction(int statusCode, API.StatusAction statusAction, String targetedId, Error error) {
|
||||
|
||||
if (error != null) {
|
||||
Toasty.error(getApplicationContext(), error.getError(), Toast.LENGTH_LONG).show();
|
||||
if(error.getError().length() < 100) {
|
||||
Toasty.error(getApplicationContext(), error.getError(), Toast.LENGTH_LONG).show();
|
||||
}else{
|
||||
Toasty.error(getApplicationContext(), getString(R.string.long_api_error,"\ud83d\ude05"), Toast.LENGTH_LONG).show();
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (addToList != null) {
|
||||
|
@ -1642,7 +1650,11 @@ public class ShowAccountActivity extends BaseActivity implements OnPostActionInt
|
|||
if (error == null)
|
||||
Toasty.error(getApplicationContext(), getString(R.string.toast_error), Toast.LENGTH_LONG).show();
|
||||
else
|
||||
Toasty.error(getApplicationContext(), error.getError(), Toast.LENGTH_LONG).show();
|
||||
if(error.getError().length() < 100) {
|
||||
Toasty.error(getApplicationContext(), error.getError(), Toast.LENGTH_LONG).show();
|
||||
}else{
|
||||
Toasty.error(getApplicationContext(), getString(R.string.long_api_error,"\ud83d\ude05"), Toast.LENGTH_LONG).show();
|
||||
}
|
||||
return;
|
||||
}
|
||||
this.account = account;
|
||||
|
|
|
@ -208,7 +208,11 @@ public class DisplayAccountsFragment extends Fragment implements OnRetrieveAccou
|
|||
mainLoader.setVisibility(View.GONE);
|
||||
nextElementLoader.setVisibility(View.GONE);
|
||||
if (apiResponse.getError() != null) {
|
||||
Toasty.error(context, apiResponse.getError().getError(), Toast.LENGTH_LONG).show();
|
||||
if(apiResponse.getError().getError().length() < 100) {
|
||||
Toasty.error(context, apiResponse.getError().getError(), Toast.LENGTH_LONG).show();
|
||||
}else{
|
||||
Toasty.error(context, getString(R.string.long_api_error,"\ud83d\ude05"), Toast.LENGTH_LONG).show();
|
||||
}
|
||||
swipeRefreshLayout.setRefreshing(false);
|
||||
swiped = false;
|
||||
flag_loading = false;
|
||||
|
@ -259,7 +263,11 @@ public class DisplayAccountsFragment extends Fragment implements OnRetrieveAccou
|
|||
@Override
|
||||
public void onRetrieveRelationship(APIResponse apiResponse) {
|
||||
if (apiResponse.getError() != null) {
|
||||
Toasty.error(context, apiResponse.getError().getError(), Toast.LENGTH_LONG).show();
|
||||
if(apiResponse.getError().getError().length() < 100) {
|
||||
Toasty.error(context, apiResponse.getError().getError(), Toast.LENGTH_LONG).show();
|
||||
}else{
|
||||
Toasty.error(context, getString(R.string.long_api_error,"\ud83d\ude05"), Toast.LENGTH_LONG).show();
|
||||
}
|
||||
return;
|
||||
}
|
||||
SharedPreferences sharedpreferences = context.getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
|
||||
|
|
|
@ -224,7 +224,11 @@ public class DisplayAdminAccountsFragment extends Fragment implements OnAdminAct
|
|||
mainLoader.setVisibility(View.GONE);
|
||||
nextElementLoader.setVisibility(View.GONE);
|
||||
if (apiResponse.getError() != null) {
|
||||
Toasty.error(context, apiResponse.getError().getError(), Toast.LENGTH_LONG).show();
|
||||
if(apiResponse.getError().getError().length() < 100) {
|
||||
Toasty.error(context, apiResponse.getError().getError(), Toast.LENGTH_LONG).show();
|
||||
}else{
|
||||
Toasty.error(context, getString(R.string.long_api_error,"\ud83d\ude05"), Toast.LENGTH_LONG).show();
|
||||
}
|
||||
swipeRefreshLayout.setRefreshing(false);
|
||||
swiped = false;
|
||||
flag_loading = false;
|
||||
|
|
|
@ -231,7 +231,11 @@ public class DisplayAdminReportsFragment extends Fragment implements OnAdminActi
|
|||
});
|
||||
builderInner.show();
|
||||
} else {
|
||||
Toasty.error(context, apiResponse.getError().getError(), Toast.LENGTH_LONG).show();
|
||||
if(apiResponse.getError().getError().length() < 100) {
|
||||
Toasty.error(context, apiResponse.getError().getError(), Toast.LENGTH_LONG).show();
|
||||
}else{
|
||||
Toasty.error(context, getString(R.string.long_api_error,"\ud83d\ude05"), Toast.LENGTH_LONG).show();
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -241,7 +241,11 @@ public class DisplayFiltersFragment extends Fragment implements OnFilterActionIn
|
|||
mainLoader.setVisibility(View.GONE);
|
||||
add_new.setEnabled(true);
|
||||
if (apiResponse.getError() != null) {
|
||||
Toasty.error(context, apiResponse.getError().getError(), Toast.LENGTH_LONG).show();
|
||||
if(apiResponse.getError().getError().length() < 100) {
|
||||
Toasty.error(context, apiResponse.getError().getError(), Toast.LENGTH_LONG).show();
|
||||
}else{
|
||||
Toasty.error(context, getString(R.string.long_api_error,"\ud83d\ude05"), Toast.LENGTH_LONG).show();
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (actionType == ManageFiltersAsyncTask.action.GET_ALL_FILTER) {
|
||||
|
|
|
@ -179,7 +179,11 @@ public class DisplayFollowRequestSentFragment extends Fragment implements OnRetr
|
|||
mainLoader.setVisibility(View.GONE);
|
||||
nextElementLoader.setVisibility(View.GONE);
|
||||
if (apiResponse.getError() != null) {
|
||||
Toasty.error(context, apiResponse.getError().getError(), Toast.LENGTH_LONG).show();
|
||||
if(apiResponse.getError().getError().length() < 100) {
|
||||
Toasty.error(context, apiResponse.getError().getError(), Toast.LENGTH_LONG).show();
|
||||
}else{
|
||||
Toasty.error(context, getString(R.string.long_api_error,"\ud83d\ude05"), Toast.LENGTH_LONG).show();
|
||||
}
|
||||
flag_loading = false;
|
||||
swipeRefreshLayout.setRefreshing(false);
|
||||
swiped = false;
|
||||
|
|
|
@ -94,7 +94,11 @@ public class DisplayHowToFragment extends Fragment implements OnRetrieveHowToInt
|
|||
public void onRetrieveHowTo(APIResponse apiResponse) {
|
||||
mainLoader.setVisibility(View.GONE);
|
||||
if (apiResponse.getError() != null) {
|
||||
Toasty.error(context, apiResponse.getError().getError(), Toast.LENGTH_LONG).show();
|
||||
if(apiResponse.getError().getError().length() < 100) {
|
||||
Toasty.error(context, apiResponse.getError().getError(), Toast.LENGTH_LONG).show();
|
||||
}else{
|
||||
Toasty.error(context, getString(R.string.long_api_error,"\ud83d\ude05"), Toast.LENGTH_LONG).show();
|
||||
}
|
||||
return;
|
||||
}
|
||||
List<HowToVideo> howToVideos = apiResponse.getHowToVideos();
|
||||
|
|
|
@ -177,7 +177,11 @@ public class DisplayListsFragment extends Fragment implements OnListActionInterf
|
|||
mainLoader.setVisibility(View.GONE);
|
||||
add_new.setEnabled(true);
|
||||
if (apiResponse.getError() != null) {
|
||||
Toasty.error(context, apiResponse.getError().getError(), Toast.LENGTH_LONG).show();
|
||||
if(apiResponse.getError().getError().length() < 100) {
|
||||
Toasty.error(context, apiResponse.getError().getError(), Toast.LENGTH_LONG).show();
|
||||
}else{
|
||||
Toasty.error(context, getString(R.string.long_api_error,"\ud83d\ude05"), Toast.LENGTH_LONG).show();
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (actionType == ManageListsAsyncTask.action.GET_LIST) {
|
||||
|
|
|
@ -179,7 +179,11 @@ public class DisplayMediaFragment extends Fragment implements OnRetrieveFeedsInt
|
|||
//Discards 404 - error which can often happen due to toots which have been deleted
|
||||
if (apiResponse == null || apiResponse.getError() != null && apiResponse.getError().getStatusCode() != 404) {
|
||||
if (apiResponse != null && apiResponse.getError() != null && apiResponse.getError().getError() != null)
|
||||
Toasty.error(context, apiResponse.getError().getError(), Toast.LENGTH_LONG).show();
|
||||
if(apiResponse.getError().getError().length() < 100) {
|
||||
Toasty.error(context, apiResponse.getError().getError(), Toast.LENGTH_LONG).show();
|
||||
}else{
|
||||
Toasty.error(context, getString(R.string.long_api_error,"\ud83d\ude05"), Toast.LENGTH_LONG).show();
|
||||
}
|
||||
else
|
||||
Toasty.error(context, context.getString(R.string.toast_error), Toast.LENGTH_LONG).show();
|
||||
flag_loading = false;
|
||||
|
|
|
@ -239,7 +239,11 @@ public class DisplayMutedInstanceFragment extends Fragment implements OnRetrieve
|
|||
mainLoader.setVisibility(View.GONE);
|
||||
nextElementLoader.setVisibility(View.GONE);
|
||||
if (apiResponse.getError() != null) {
|
||||
Toasty.error(context, apiResponse.getError().getError(), Toast.LENGTH_LONG).show();
|
||||
if(apiResponse.getError().getError().length() < 100) {
|
||||
Toasty.error(context, apiResponse.getError().getError(), Toast.LENGTH_LONG).show();
|
||||
}else{
|
||||
Toasty.error(context, getString(R.string.long_api_error,"\ud83d\ude05"), Toast.LENGTH_LONG).show();
|
||||
}
|
||||
swipeRefreshLayout.setRefreshing(false);
|
||||
swiped = false;
|
||||
flag_loading = false;
|
||||
|
|
|
@ -305,7 +305,11 @@ public class DisplayNotificationsFragment extends Fragment implements OnRetrieve
|
|||
String lastReadNotifications = sharedpreferences.getString(Helper.LAST_NOTIFICATION_MAX_ID + userId + instance, null);
|
||||
if (apiResponse.getError() != null) {
|
||||
|
||||
Toasty.error(context, apiResponse.getError().getError(), Toast.LENGTH_LONG).show();
|
||||
if(apiResponse.getError().getError().length() < 100) {
|
||||
Toasty.error(context, apiResponse.getError().getError(), Toast.LENGTH_LONG).show();
|
||||
}else{
|
||||
Toasty.error(context, getString(R.string.long_api_error,"\ud83d\ude05"), Toast.LENGTH_LONG).show();
|
||||
}
|
||||
flag_loading = false;
|
||||
swipeRefreshLayout.setRefreshing(false);
|
||||
swiped = false;
|
||||
|
|
|
@ -249,7 +249,11 @@ public class DisplayPeertubeNotificationsFragment extends Fragment implements On
|
|||
nextElementLoader.setVisibility(View.GONE);
|
||||
String lastReadNotifications = sharedpreferences.getString(Helper.LAST_NOTIFICATION_MAX_ID + userId + instance, null);
|
||||
if (apiResponse.getError() != null) {
|
||||
Toasty.error(context, apiResponse.getError().getError(), Toast.LENGTH_LONG).show();
|
||||
if(apiResponse.getError().getError().length() < 100) {
|
||||
Toasty.error(context, apiResponse.getError().getError(), Toast.LENGTH_LONG).show();
|
||||
}else{
|
||||
Toasty.error(context, getString(R.string.long_api_error,"\ud83d\ude05"), Toast.LENGTH_LONG).show();
|
||||
}
|
||||
flag_loading = false;
|
||||
swipeRefreshLayout.setRefreshing(false);
|
||||
swiped = false;
|
||||
|
|
|
@ -319,7 +319,11 @@ public class DisplayPlaylistsFragment extends Fragment implements OnPlaylistActi
|
|||
mainLoader.setVisibility(View.GONE);
|
||||
add_new.setEnabled(true);
|
||||
if (apiResponse.getError() != null) {
|
||||
Toasty.error(context, apiResponse.getError().getError(), Toast.LENGTH_LONG).show();
|
||||
if(apiResponse.getError().getError().length() < 100) {
|
||||
Toasty.error(context, apiResponse.getError().getError(), Toast.LENGTH_LONG).show();
|
||||
}else{
|
||||
Toasty.error(context, getString(R.string.long_api_error,"\ud83d\ude05"), Toast.LENGTH_LONG).show();
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -342,7 +346,11 @@ public class DisplayPlaylistsFragment extends Fragment implements OnPlaylistActi
|
|||
playlistAdapter.notifyDataSetChanged();
|
||||
textviewNoAction.setVisibility(View.GONE);
|
||||
} else {
|
||||
Toasty.error(context, apiResponse.getError().getError(), Toast.LENGTH_LONG).show();
|
||||
if(apiResponse.getError().getError().length() < 100) {
|
||||
Toasty.error(context, apiResponse.getError().getError(), Toast.LENGTH_LONG).show();
|
||||
}else{
|
||||
Toasty.error(context, getString(R.string.long_api_error,"\ud83d\ude05"), Toast.LENGTH_LONG).show();
|
||||
}
|
||||
}
|
||||
} else if (actionType == ManagePlaylistsAsyncTask.action.DELETE_PLAYLIST) {
|
||||
if (this.playlists.size() == 0)
|
||||
|
@ -365,7 +373,11 @@ public class DisplayPlaylistsFragment extends Fragment implements OnPlaylistActi
|
|||
public void onRetrievePeertubeChannels(APIResponse apiResponse) {
|
||||
if (apiResponse.getError() != null || apiResponse.getAccounts() == null || apiResponse.getAccounts().size() == 0) {
|
||||
if (apiResponse.getError() != null && apiResponse.getError().getError() != null)
|
||||
Toasty.error(context, apiResponse.getError().getError(), Toast.LENGTH_LONG).show();
|
||||
if(apiResponse.getError().getError().length() < 100) {
|
||||
Toasty.error(context, apiResponse.getError().getError(), Toast.LENGTH_LONG).show();
|
||||
}else{
|
||||
Toasty.error(context, getString(R.string.long_api_error,"\ud83d\ude05"), Toast.LENGTH_LONG).show();
|
||||
}
|
||||
else
|
||||
Toasty.error(context, getString(R.string.toast_error), Toast.LENGTH_LONG).show();
|
||||
return;
|
||||
|
|
|
@ -118,7 +118,11 @@ public class DisplayScheduledTootsFragment extends Fragment implements OnRetriev
|
|||
@Override
|
||||
public void onRetrieveFeeds(APIResponse apiResponse) {
|
||||
if (apiResponse.getError() != null && apiResponse.getError().getStatusCode() != 404) {
|
||||
Toasty.error(context, apiResponse.getError().getError(), Toast.LENGTH_LONG).show();
|
||||
if(apiResponse.getError().getError().length() < 100) {
|
||||
Toasty.error(context, apiResponse.getError().getError(), Toast.LENGTH_LONG).show();
|
||||
}else{
|
||||
Toasty.error(context, getString(R.string.long_api_error,"\ud83d\ude05"), Toast.LENGTH_LONG).show();
|
||||
}
|
||||
return;
|
||||
}
|
||||
mainLoader.setVisibility(View.GONE);
|
||||
|
|
|
@ -191,7 +191,11 @@ public class DisplaySearchTagsFragment extends Fragment implements OnRetrieveSea
|
|||
swipeRefreshLayout.setRefreshing(false);
|
||||
if (apiResponse.getError() != null) {
|
||||
if (apiResponse.getError().getError() != null)
|
||||
Toasty.error(context, apiResponse.getError().getError(), Toast.LENGTH_LONG).show();
|
||||
if(apiResponse.getError().getError().length() < 100) {
|
||||
Toasty.error(context, apiResponse.getError().getError(), Toast.LENGTH_LONG).show();
|
||||
}else{
|
||||
Toasty.error(context, getString(R.string.long_api_error,"\ud83d\ude05"), Toast.LENGTH_LONG).show();
|
||||
}
|
||||
else
|
||||
Toasty.error(context, context.getString(R.string.toast_error), Toast.LENGTH_LONG).show();
|
||||
return;
|
||||
|
|
|
@ -487,8 +487,13 @@ public class DisplayStatusFragment extends Fragment implements OnRetrieveFeedsIn
|
|||
if (this.peertubes == null || this.statuses == null || apiResponse == null || (apiResponse.getError() != null && apiResponse.getError().getStatusCode() != 404)) {
|
||||
if (apiResponse == null)
|
||||
Toasty.error(context, context.getString(R.string.toast_error), Toast.LENGTH_LONG).show();
|
||||
else
|
||||
Toasty.error(context, apiResponse.getError().getError(), Toast.LENGTH_LONG).show();
|
||||
else {
|
||||
if(apiResponse.getError().getError().length() < 100) {
|
||||
Toasty.error(context, apiResponse.getError().getError(), Toast.LENGTH_LONG).show();
|
||||
}else{
|
||||
Toasty.error(context, getString(R.string.long_api_error,"\ud83d\ude05"), Toast.LENGTH_LONG).show();
|
||||
}
|
||||
}
|
||||
swipeRefreshLayout.setRefreshing(false);
|
||||
flag_loading = false;
|
||||
return;
|
||||
|
@ -974,7 +979,11 @@ public class DisplayStatusFragment extends Fragment implements OnRetrieveFeedsIn
|
|||
if (apiResponse == null)
|
||||
Toasty.error(context, context.getString(R.string.toast_error), Toast.LENGTH_LONG).show();
|
||||
else
|
||||
Toasty.error(context, apiResponse.getError().getError(), Toast.LENGTH_LONG).show();
|
||||
if(apiResponse.getError().getError().length() < 100) {
|
||||
Toasty.error(context, apiResponse.getError().getError(), Toast.LENGTH_LONG).show();
|
||||
}else{
|
||||
Toasty.error(context, getString(R.string.long_api_error,"\ud83d\ude05"), Toast.LENGTH_LONG).show();
|
||||
}
|
||||
swipeRefreshLayout.setRefreshing(false);
|
||||
flag_loading = false;
|
||||
return;
|
||||
|
@ -1108,7 +1117,11 @@ public class DisplayStatusFragment extends Fragment implements OnRetrieveFeedsIn
|
|||
//Discards 404 - error which can often happen due to toots which have been deleted
|
||||
if (apiResponse.getError() != null) {
|
||||
if (!apiResponse.getError().getError().startsWith("404 -"))
|
||||
Toasty.error(context, apiResponse.getError().getError(), Toast.LENGTH_LONG).show();
|
||||
if(apiResponse.getError().getError().length() < 100) {
|
||||
Toasty.error(context, apiResponse.getError().getError(), Toast.LENGTH_LONG).show();
|
||||
}else{
|
||||
Toasty.error(context, getString(R.string.long_api_error,"\ud83d\ude05"), Toast.LENGTH_LONG).show();
|
||||
}
|
||||
swipeRefreshLayout.setRefreshing(false);
|
||||
isSwipped = false;
|
||||
flag_loading = false;
|
||||
|
|
|
@ -1232,4 +1232,5 @@
|
|||
<string name="add_photo_indication_pixelfed">Accepted Formats: jpeg, png, gif \n\nMax File Size: 15 MB \n\nAlbums can contain up to 4 photos or videos</string>
|
||||
<string name="upload_media">Upload media</string>
|
||||
<string name="pixelfed_compose_placeholder">Add an optional caption</string>
|
||||
<string name="long_api_error">The app received a very long error message from the API %1$s</string>
|
||||
</resources>
|
Loading…
Reference in New Issue