[mob][photos] Continue showing pair dialog in case of error
This commit is contained in:
parent
aced4bb5cf
commit
e903fbf9bc
|
@ -880,11 +880,11 @@ class _GalleryAppBarWidgetState extends State<GalleryAppBarWidget> {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
if (result == ButtonAction.second) {
|
if (result == ButtonAction.second) {
|
||||||
await _pairWithPin(gw);
|
await _pairWithPin(gw, '');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> _pairWithPin(CastGateway gw) async {
|
Future<void> _pairWithPin(CastGateway gw, String code) async {
|
||||||
await showTextInputDialog(
|
await showTextInputDialog(
|
||||||
context,
|
context,
|
||||||
title: context.l10n.playOnTv,
|
title: context.l10n.playOnTv,
|
||||||
|
@ -892,12 +892,17 @@ class _GalleryAppBarWidgetState extends State<GalleryAppBarWidget> {
|
||||||
submitButtonLabel: S.of(context).pair,
|
submitButtonLabel: S.of(context).pair,
|
||||||
textInputType: TextInputType.streetAddress,
|
textInputType: TextInputType.streetAddress,
|
||||||
hintText: context.l10n.deviceCodeHint,
|
hintText: context.l10n.deviceCodeHint,
|
||||||
|
showOnlyLoadingState: true,
|
||||||
|
alwaysShowSuccessState: false,
|
||||||
|
initialValue: code,
|
||||||
onSubmit: (String text) async {
|
onSubmit: (String text) async {
|
||||||
try {
|
try {
|
||||||
final code = text.trim();
|
code = text.trim();
|
||||||
final String? publicKey = await gw.getPublicKey(code);
|
final String? publicKey = await gw.getPublicKey(code);
|
||||||
if (publicKey == null) {
|
if (publicKey == null) {
|
||||||
showToast(context, S.of(context).deviceNotFound);
|
showToast(context, S.of(context).deviceNotFound);
|
||||||
|
// show _pairPin again
|
||||||
|
Future.delayed(Duration.zero, () => _pairWithPin(gw, code));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
final String castToken = const Uuid().v4().toString();
|
final String castToken = const Uuid().v4().toString();
|
||||||
|
@ -912,6 +917,7 @@ class _GalleryAppBarWidgetState extends State<GalleryAppBarWidget> {
|
||||||
} catch (e, s) {
|
} catch (e, s) {
|
||||||
_logger.severe("Failed to cast album", e, s);
|
_logger.severe("Failed to cast album", e, s);
|
||||||
await showGenericErrorDialog(context: context, error: e);
|
await showGenericErrorDialog(context: context, error: e);
|
||||||
|
Future.delayed(Duration.zero, () => _pairWithPin(gw, code));
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
Loading…
Reference in a new issue