Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix video/channel sharing #1258

Merged
merged 1 commit into from
May 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading