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

[mob][photos] Add support for casting #1556

Merged
merged 27 commits into from
Apr 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
db95de8
[mob][photos] Add cast pkg dependency
ua741 Apr 16, 2024
f645fff
[mob][photos] Add hook to show cast devices
ua741 Apr 16, 2024
da1d778
[mob][photos] Add hook to connect to cast device
ua741 Apr 22, 2024
8fd330c
Merge branch 'main' into cast
ua741 Apr 23, 2024
89646ac
[mob][cast] Refactor + add multiple cast plugin to gracefully handle …
ua741 Apr 23, 2024
bd225ce
[mob][cast] Return name and castDevice as record
ua741 Apr 23, 2024
1251a01
[mob][cast] Show choice to auto and manual pair
ua741 Apr 24, 2024
bed14d8
[mob][photos] Use cast Icon in appbar
ua741 Apr 24, 2024
729e2ad
[mob] Use separate widget for auto-cast
ua741 Apr 24, 2024
aced4bb
[mob][photos] Update cast selection dialog
ua741 Apr 24, 2024
e903fbf
[mob][photos] Continue showing pair dialog in case of error
ua741 Apr 25, 2024
36dbda8
[mob][photos] Send pair req after getting receiver status
ua741 Apr 25, 2024
f777bdb
[mob][photos] Extract strings
ua741 Apr 25, 2024
864f5c1
[mob][photos] Extract strings
ua741 Apr 25, 2024
483cfd1
[mob][photos] Lint suggestions
ua741 Apr 25, 2024
dddbb95
[mob][photos] Refactor
ua741 Apr 25, 2024
4ce6fa7
[mob] Add method to close cast and keep track of active casts
ua741 Apr 27, 2024
4b97f83
[mob][photos] Finish auto-pair integration
ua741 Apr 29, 2024
7411125
[mob][photos] Add support for closing session
ua741 Apr 29, 2024
195ad01
[mob][photos] Add timeout for stop casting
ua741 Apr 29, 2024
b12e622
[mob][photos] Change button type to neutral
ua741 Apr 29, 2024
bd07759
[mob][photos] Show loading indicator on device tap
ua741 Apr 29, 2024
16888c8
[mob][photos] Fix lint warning
ua741 Apr 29, 2024
7c91604
[mob][photos] Extract strings
ua741 Apr 29, 2024
5c645d5
[mob][photos] Show custom error on ip mismatch
ua741 Apr 29, 2024
9e7c82d
[mob][photos] Extract string
ua741 Apr 29, 2024
e7a5e1b
Merge branch 'main' into cast
ua741 Apr 30, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 9 additions & 0 deletions mobile/ios/Runner/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -105,5 +105,14 @@
<true/>
<key>UIApplicationSupportsIndirectInputEvents</key>
<true/>
<key>NSBonjourServices</key>
<array>
<string>_googlecast._tcp</string>
<string>F5BCEC64._googlecast._tcp</string>
</array>

<key>NSLocalNetworkUsageDescription</key>
<string>${PRODUCT_NAME} uses the local network to discover Cast-enabled devices on your WiFi
network.</string>
</dict>
</plist>
16 changes: 12 additions & 4 deletions mobile/lib/gateways/cast_gw.dart
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,14 @@ class CastGateway {
);
return response.data["publicKey"];
} catch (e) {
if (e is DioError &&
e.response != null &&
e.response!.statusCode == 404) {
return null;
if (e is DioError && e.response != null) {
if (e.response!.statusCode == 404) {
return null;
} else if (e.response!.statusCode == 403) {
throw CastIPMismatchException();
} else {
rethrow;
}
}
rethrow;
}
Expand Down Expand Up @@ -48,3 +52,7 @@ class CastGateway {
}
}
}

class CastIPMismatchException implements Exception {
CastIPMismatchException();
}
24 changes: 24 additions & 0 deletions mobile/lib/generated/intl/messages_en.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

130 changes: 130 additions & 0 deletions mobile/lib/generated/l10n.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 14 additions & 1 deletion mobile/lib/l10n/intl_en.arb
Original file line number Diff line number Diff line change
Expand Up @@ -1195,6 +1195,8 @@
"verifyPasskey": "Verify passkey",
"playOnTv": "Play album on TV",
"pair": "Pair",
"autoPair": "Auto pair",
"pairWithPin": "Pair with PIN",
"deviceNotFound": "Device not found",
"castInstruction": "Visit cast.ente.io on the device you want to pair.\n\nEnter the code below to play the album on your TV.",
"deviceCodeHint": "Enter the code",
Expand All @@ -1212,5 +1214,16 @@
"endpointUpdatedMessage": "Endpoint updated successfully",
"customEndpoint": "Connected to {endpoint}",
"createCollaborativeLink": "Create collaborative link",
"search": "Search"
"search": "Search",
"autoPairGoogle": "Auto Pair requires connecting to Google servers and only works with Chromecast supported devices. Google will not receive sensitive data, such as your photos.",
"manualPairDesc": "Pair with PIN works for any large screen device you want to play your album on.",
"connectToDevice": "Connect to device",
"autoCastDialogBody": "You'll see available Cast devices here.",
"autoCastiOSPermission": "Make sure Local Network permissions are turned on for the Ente Photos app, in Settings.",
"noDeviceFound": "No device found",
"stopCastingTitle": "Stop casting",
"stopCastingBody": "Do you want to stop casting?",
"castIPMismatchTitle": "Failed to cast album",
"castIPMismatchBody": "Please make sure you are on the same network as the TV.",
"pairingComplete": "Pairing complete"
}
8 changes: 8 additions & 0 deletions mobile/lib/service_locator.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import "package:dio/dio.dart";
import "package:ente_cast/ente_cast.dart";
import "package:ente_cast_normal/ente_cast_normal.dart";
import "package:ente_feature_flag/ente_feature_flag.dart";
import "package:shared_preferences/shared_preferences.dart";

Expand Down Expand Up @@ -26,3 +28,9 @@ FlagService get flagService {
);
return _flagService!;
}

CastService? _castService;
CastService get castService {
_castService ??= CastServiceImpl();
return _castService!;
}