Skip to content

Commit

Permalink
Hide sharing behind feature flag
Browse files Browse the repository at this point in the history
  • Loading branch information
G-Ray committed Jan 7, 2025
1 parent 8f4101c commit 7f17939
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 17 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ git clone --recurse-submodules git@github.com:G-Ray/pikatorrent.git pikatorrent
cd pikatorrent/app
./vcpkg/bootstrap-vcpkg.sh # .bat for Windows
export VCPKG_ROOT=/absolut/path/to/./app/vcpkg
flutter run
flutter run # optionally specify --dart-define-from-file=.env
```

## Localization
Expand Down
1 change: 1 addition & 0 deletions app/.env
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ENABLE_LINK_SHARING=true
20 changes: 10 additions & 10 deletions app/lib/screens/torrents/torrent_list_tile/torrent_list_tile.dart
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,8 @@ class TorrentListTile extends StatelessWidget {
: torrent.progress == 1
? const Icon(Icons.download_done)
: const Icon(Icons.download),
tooltip: torrent.status == TorrentStatus.stopped
? 'Start'
: 'Stop',
tooltip:
torrent.status == TorrentStatus.stopped ? 'Start' : 'Stop',
)),
]),
),
Expand All @@ -83,12 +82,14 @@ class TorrentListTile extends StatelessWidget {
? Row(
mainAxisSize: MainAxisSize.min,
children: [
IconButton(
tooltip: 'Share',
onPressed: () => shareLink(context, torrent.magnetLink!),
icon: const Icon(
Icons.share,
)),
if (const bool.fromEnvironment('ENABLE_LINK_SHARING') == true)
IconButton(
tooltip: 'Share',
onPressed: () =>
shareLink(context, torrent.magnetLink!),
icon: const Icon(
Icons.share,
)),
IconButton(
tooltip: 'Remove',
onPressed: () => showDialog(
Expand Down Expand Up @@ -165,4 +166,3 @@ class TorrentListTile extends StatelessWidget {
});
}
}

15 changes: 9 additions & 6 deletions app/lib/screens/torrents/torrents.dart
Original file line number Diff line number Diff line change
Expand Up @@ -81,12 +81,15 @@ class _TorrentScreen extends State<TorrentsScreen>
motion: const ScrollMotion(),
extentRatio: 0.4,
children: [
SlidableAction(
backgroundColor: Colors.blue,
onPressed: (_) =>
shareLink(context, torrent.magnetLink!),
icon: Icons.share,
),
if (const bool.fromEnvironment(
'ENABLE_LINK_SHARING') ==
true)
SlidableAction(
backgroundColor: Colors.blue,
onPressed: (_) =>
shareLink(context, torrent.magnetLink!),
icon: Icons.share,
),
SlidableAction(
backgroundColor: Colors.red,
onPressed: (_) => showDialog(
Expand Down

0 comments on commit 7f17939

Please sign in to comment.