refactored comments capability

This commit is contained in:
Ritvik Saraf 2019-02-16 01:23:26 +05:30
parent 77c6d3d576
commit 56cb8209b8
2 changed files with 6 additions and 2 deletions

View file

@ -57,7 +57,7 @@ dependencies {
exclude module: 'support-annotations' exclude module: 'support-annotations'
}) })
implementation 'com.github.yausername:NewPipeExtractor:f97d5ab' implementation 'com.github.yausername:NewPipeExtractor:3dadf63'
testImplementation 'junit:junit:4.12' testImplementation 'junit:junit:4.12'
testImplementation 'org.mockito:mockito-core:2.23.0' testImplementation 'org.mockito:mockito-core:2.23.0'

View file

@ -100,6 +100,7 @@ import io.reactivex.disposables.CompositeDisposable;
import io.reactivex.disposables.Disposable; import io.reactivex.disposables.Disposable;
import io.reactivex.schedulers.Schedulers; import io.reactivex.schedulers.Schedulers;
import static org.schabi.newpipe.extractor.StreamingService.ServiceInfo.MediaCapability.COMMENTS;
import static org.schabi.newpipe.util.AnimationUtils.animateView; import static org.schabi.newpipe.util.AnimationUtils.animateView;
public class VideoDetailFragment public class VideoDetailFragment
@ -822,7 +823,10 @@ public class VideoDetailFragment
private boolean shouldShowComments() { private boolean shouldShowComments() {
try { try {
return showComments && NewPipe.getService(serviceId).isCommentsSupported(); return showComments && NewPipe.getService(serviceId)
.getServiceInfo()
.getMediaCapabilities()
.contains(COMMENTS);
} catch (ExtractionException e) { } catch (ExtractionException e) {
return false; return false;
} }