Skip to content

Commit

Permalink
fix ContentNotSupportedError not showing if cached and rename function
Browse files Browse the repository at this point in the history
  • Loading branch information
B0pol committed Apr 9, 2020
1 parent 7012fba commit 5eba4e3
Showing 1 changed file with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -437,10 +437,12 @@ public void handleResult(@NonNull final ChannelInfo result) {
// handling ContentNotSupportedException not to show the error but an appropriate string
// so that crashes won't be sent uselessly and the user will understand what happened
Iterator<Throwable> it = errors.iterator();
Throwable contentNotSupported = null;
while (it.hasNext()) {
Throwable throwable = it.next();
if (throwable instanceof ContentNotSupportedException) {
updateNoVideoDisplay();
showContentNotSupported();
contentNotSupported = throwable;
it.remove();
}
}
Expand All @@ -449,6 +451,12 @@ public void handleResult(@NonNull final ChannelInfo result) {
showSnackBarError(result.getErrors(), UserAction.REQUESTED_CHANNEL,
NewPipe.getNameOfService(result.getServiceId()), result.getUrl(), 0);
}

if (contentNotSupported != null) {
// adding it after snackbarError so that it's not removed and
// the CNS error will still show up even if the channel is cached
errors.add(contentNotSupported);
}
}

if (disposables != null) {
Expand All @@ -468,7 +476,7 @@ public void handleResult(@NonNull final ChannelInfo result) {
.playOnBackgroundPlayer(activity, getPlayQueue(), false));
}

private void updateNoVideoDisplay() {
private void showContentNotSupported() {
contentNotSupportedTextView.setVisibility(View.VISIBLE);
kaomojiTextView.setText("(︶︹︺)");
kaomojiTextView.setTextSize(TypedValue.COMPLEX_UNIT_SP, 45f);
Expand Down

0 comments on commit 5eba4e3

Please sign in to comment.