From a29e2116a7ed127da639d59b5ac97f96c3f259b3 Mon Sep 17 00:00:00 2001
From: Ritvik Saraf <13ritvik@gmail.com>
Date: Thu, 27 Sep 2018 00:53:36 +0530
Subject: [PATCH] handling error while loading comments
---
app/build.gradle | 2 +-
.../newpipe/fragments/detail/VideoDetailFragment.java | 8 ++++++--
app/src/main/res/values/strings.xml | 1 +
3 files changed, 8 insertions(+), 3 deletions(-)
diff --git a/app/build.gradle b/app/build.gradle
index e4c1f24c1..0b264d8c6 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -55,7 +55,7 @@ dependencies {
exclude module: 'support-annotations'
}
- implementation 'com.github.yausername:NewPipeExtractor:c1199c8'
+ implementation 'com.github.yausername:NewPipeExtractor:fb14196'
testImplementation 'junit:junit:4.12'
testImplementation 'org.mockito:mockito-core:2.8.9'
diff --git a/app/src/main/java/org/schabi/newpipe/fragments/detail/VideoDetailFragment.java b/app/src/main/java/org/schabi/newpipe/fragments/detail/VideoDetailFragment.java
index 09e9b38d7..1629afadd 100644
--- a/app/src/main/java/org/schabi/newpipe/fragments/detail/VideoDetailFragment.java
+++ b/app/src/main/java/org/schabi/newpipe/fragments/detail/VideoDetailFragment.java
@@ -997,7 +997,6 @@ public class VideoDetailFragment
protected void prepareAndLoadInfo() {
parallaxScrollRootView.smoothScrollTo(0, 0);
pushToStack(serviceId, url, name);
- //clearComments();
startLoading(false);
}
@@ -1027,6 +1026,7 @@ public class VideoDetailFragment
private void loadComments(boolean forceLoad) {
if(isCommentsSupported && showComments){
+ clearComments();
commentsInfo = null;
if (commentsDisposable != null) commentsDisposable.dispose();
@@ -1038,7 +1038,7 @@ public class VideoDetailFragment
showCommentsWithAnimation(120, 0,0);
initComments(commentsInfo);
}, (@NonNull Throwable throwable) -> {
- onError(throwable);
+ onCommentsError(throwable);
});
}
}
@@ -1495,4 +1495,8 @@ public class VideoDetailFragment
showError(getString(R.string.blocked_by_gema), false, R.drawable.gruese_die_gema);
}
+
+ public void onCommentsError(Throwable exception) {
+ showSnackBarError(exception, UserAction.REQUESTED_COMMENTS, NewPipe.getNameOfService(serviceId), url, R.string.error_unable_to_load_comments);
+ }
}
\ No newline at end of file
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index 23039a4c7..3dbbc29cf 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -389,6 +389,7 @@
Warning: Could not import all files.
This will override your current setup.
Do you want to also import settings?
+ Could not load comments
Kiosk