66import androidx .annotation .NonNull ;
77import androidx .core .content .ContextCompat ;
88
9- import org .schabi .newpipe .MainActivity ;
109import org .schabi .newpipe .extractor .NewPipe ;
1110import org .schabi .newpipe .extractor .StreamingService ;
1211import org .schabi .newpipe .extractor .exceptions .ExtractionException ;
1817import java .util .regex .Matcher ;
1918import java .util .regex .Pattern ;
2019
21- import io .reactivex .rxjava3 .disposables .CompositeDisposable ;
22-
2320public final class InternalUrlsHandler {
24- private static final String TAG = InternalUrlsHandler .class .getSimpleName ();
25- private static final boolean DEBUG = MainActivity .DEBUG ;
26-
2721 private static final Pattern AMPERSAND_TIMESTAMP_PATTERN = Pattern .compile ("(.*)&t=(\\ d+)" );
28- private static final Pattern HASHTAG_TIMESTAMP_PATTERN =
29- Pattern .compile ("(.*)#timestamp=(\\ d+)" );
22+
23+ private InternalUrlsHandler () {
24+ }
3025
3126 /**
3227 * Handle a YouTube timestamp description URL in NewPipe.
@@ -36,14 +31,11 @@ public final class InternalUrlsHandler {
3631 * player will be opened when the user will click on the timestamp in the video description,
3732 * at the time and for the video indicated in the timestamp.
3833 *
39- * @param disposables a field of the Activity/Fragment class that calls this method
4034 * @param context the context to use
4135 * @param url the URL to check if it can be handled
4236 * @return true if the URL can be handled by NewPipe, false if it cannot
4337 */
44- public static boolean handleUrlDescriptionTimestamp (@ NonNull final CompositeDisposable
45- disposables ,
46- final Context context ,
38+ public static boolean handleUrlDescriptionTimestamp (final Context context ,
4739 @ NonNull final String url ) {
4840 final Matcher matcher = AMPERSAND_TIMESTAMP_PATTERN .matcher (url );
4941 if (!matcher .matches ()) {
@@ -70,7 +62,7 @@ public static boolean handleUrlDescriptionTimestamp(@NonNull final CompositeDisp
7062 }
7163
7264 if (linkType == StreamingService .LinkType .STREAM && seconds != -1 ) {
73- return playOnPopup (context , matchedUrl , service , seconds , disposables );
65+ return playOnPopup (context , matchedUrl , service , seconds );
7466 } else {
7567 NavigationHelper .openRouterActivity (context , matchedUrl );
7668 return true ;
@@ -84,15 +76,12 @@ public static boolean handleUrlDescriptionTimestamp(@NonNull final CompositeDisp
8476 * @param url the URL of the content
8577 * @param service the service of the content
8678 * @param seconds the position in seconds at which the floating player will start
87- * @param disposables disposables created by the method are added here and their lifecycle
88- * should be handled by the calling class
8979 * @return true if the playback of the content has successfully started or false if not
9080 */
9181 public static boolean playOnPopup (final Context context ,
9282 final String url ,
9383 @ NonNull final StreamingService service ,
94- final int seconds ,
95- @ NonNull final CompositeDisposable disposables ) {
84+ final int seconds ) {
9685 final LinkHandlerFactory factory = service .getStreamLHFactory ();
9786 final String cleanUrl ;
9887
0 commit comments