Skip to content

Commit

Permalink
Fix video/channel sharing
Browse files Browse the repository at this point in the history
  • Loading branch information
gzsombor committed May 2, 2024
1 parent 59c27f3 commit 5d6785e
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
import free.rm.skytube.R;
import free.rm.skytube.app.EventBus;
import free.rm.skytube.app.SkyTubeApp;
import free.rm.skytube.app.Utils;
import free.rm.skytube.businessobjects.Logger;
import free.rm.skytube.businessobjects.YouTube.VideoBlocker;
import free.rm.skytube.businessobjects.YouTube.newpipe.ChannelId;
Expand Down Expand Up @@ -325,11 +326,6 @@ public static Disposable subscribeChannel(final Context context, final ChannelId
}

public String getChannelUrl() {
try {
return YoutubeChannelLinkHandlerFactory.getInstance().getUrl(getId());
} catch (ParsingException p) {
Logger.e(this, "getChannel URL for " + getId() + ", error:" + p.getMessage(), p);
return id;
}
return getChannelId().toURL();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,8 @@ public int hashCode() {
public String toString() {
return "ChannelId{'" + id + '\'' + '}';
}

public String toURL() {
return String.format("https://www.youtube.com/channel/%s", id);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,10 @@ public boolean handleChannelActions(Context context, YouTubeChannel channel, int
case R.id.unblock_channel:
compositeDisposable.add(channel.unblockChannel().subscribe());
return true;
case R.id.share:
case R.id.share_channel:
SkyTubeApp.shareUrl(context, channel.getChannelUrl());
return true;
case R.id.copyurl:
case R.id.channel_copyurl:
SkyTubeApp.copyUrl(context, "Channel URL", channel.getChannelUrl());
return true;

Expand Down
4 changes: 2 additions & 2 deletions app/src/main/res/menu/channel_options_menu.xml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:id="@+id/share"
android:id="@+id/share_channel"
android:title="@string/share_via"/>
<item
android:id="@+id/copyurl"
android:id="@+id/channel_copyurl"
android:title="@string/copy_url"/>
<item
android:id="@+id/open_channel" android:visible="false"
Expand Down

0 comments on commit 5d6785e

Please sign in to comment.