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

Add invidious redirect to share sheet #218

Merged
merged 1 commit into from
Jul 4, 2023
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
4 changes: 4 additions & 0 deletions lib/l10n/app_en.arb
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,10 @@
"@shareInvidiousLink": {
"description": "asking user to share invidious link"
},
"redirectInvidiousLink": "Share Invidious Redirect link",
"@redirectInvidiousLink": {
"description": "asking user to share redirecting invidious link"
},
"ok": "OK",
"@ok": {
"description": "Ok"
Expand Down
5 changes: 5 additions & 0 deletions lib/models/baseVideo.dart
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@ abstract class BaseVideo implements ShareLinks {
return '${server.url}/watch?v=$videoId';
}

@override
String getRedirectLink() {
return 'https://redirect.invidious.io/watch?v=$videoId';
}

@override
String getYoutubeLink() {
return 'https://www.youtube.com/watch?v=$videoId';
Expand Down
3 changes: 3 additions & 0 deletions lib/models/channel.dart
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,10 @@ class Channel implements ShareLinks {
@override
String getInvidiousLink(Server server) {
return '${server.url}/channel/$authorId';
}

@override getRedirectLink() {
return 'https://redirect.invidious.io/channel/$authorId';
}

@override
Expand Down
2 changes: 1 addition & 1 deletion lib/models/interfaces/sharelink.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ import '../db/server.dart';
abstract class ShareLinks{
String getYoutubeLink();
String getInvidiousLink(Server server);

String getRedirectLink();
}
9 changes: 8 additions & 1 deletion lib/utils.dart
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ void showSharingSheet(BuildContext context, ShareLinks links) {
context: context,
builder: (BuildContext context) {
return Container(
height: 100,
height: 150,
child: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
Expand All @@ -87,6 +87,13 @@ void showSharingSheet(BuildContext context, ShareLinks links) {
Navigator.of(context).pop();
},
),
FilledButton.tonal(
child: Text(locals.redirectInvidiousLink),
onPressed: () {
Share.share(links.getRedirectLink());
Navigator.of(context).pop();
},
),
FilledButton.tonal(
child: Text(locals.shareYoutubeLink),
onPressed: () {
Expand Down