fix: add streaming static image

This commit is contained in:
Prateek Sunal
2025-08-24 01:59:23 +05:30
parent 8b708228be
commit b44734a493
7 changed files with 110 additions and 86 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 175 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 396 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 45 KiB

View File

@@ -1832,6 +1832,5 @@
"totalVideos": "Total videos",
"skippedVideos": "Skipped videos",
"videoStreamingDescription": "Play videos instantly on any device. Enable to process video streams on this device.",
"videoStreamingDescriptionClickable": "More information here.",
"videoStreamingNote": "Only videos from last 60 days and under 1 minute are processed on this device. For older/longer videos, enable streaming in the desktop app."
}

View File

@@ -412,6 +412,7 @@ class _ButtonChildWidgetState extends State<ButtonChildWidget> {
if (widget.onTap != null) {
_debouncer.run(
() => Future(() {
if (!mounted) return;
setState(() {
executionState = ExecutionState.inProgress;
});
@@ -432,6 +433,7 @@ class _ButtonChildWidgetState extends State<ButtonChildWidget> {
: null;
_debouncer.cancelDebounceTimer();
if (executionState == ExecutionState.successful) {
if (!mounted) return;
setState(() {});
}
@@ -470,6 +472,7 @@ class _ButtonChildWidgetState extends State<ButtonChildWidget> {
}
}
if (executionState == ExecutionState.error) {
if (!mounted) return;
setState(() {
executionState = ExecutionState.idle;
widget.isInAlert
@@ -512,6 +515,7 @@ class _ButtonChildWidgetState extends State<ButtonChildWidget> {
}
void _onTapDown(details) {
if (!mounted) return;
setState(() {
buttonColor = widget.buttonStyle.pressedButtonColor ??
widget.buttonStyle.defaultButtonColor;
@@ -527,13 +531,17 @@ class _ButtonChildWidgetState extends State<ButtonChildWidget> {
void _onTapUp(details) {
Future.delayed(
const Duration(milliseconds: 84),
() => setState(() {
setAllStylesToDefault();
}),
() {
if (!mounted) return;
setState(() {
setAllStylesToDefault();
});
},
);
}
void _onTapCancel() {
if (!mounted) return;
setState(() {
setAllStylesToDefault();
});

View File

@@ -106,12 +106,14 @@ class _ToggleSwitchWidgetState extends State<ToggleSwitchWidget> {
}
Future<void> _onChanged(bool negationOfToggleValue) async {
if (!mounted) return;
setState(() {
toggleValue = negationOfToggleValue;
//start showing inProgress statu icons if toggle takes more than debounce time
_debouncer.run(
() => Future(
() {
if (!mounted) return;
setState(() {
executionState = ExecutionState.inProgress;
});
@@ -129,16 +131,16 @@ class _ToggleSwitchWidgetState extends State<ToggleSwitchWidget> {
_debouncer.cancelDebounceTimer();
final newValue = widget.value.call();
if (!mounted) return;
setState(() {
if (toggleValue == newValue) {
if (executionState == ExecutionState.inProgress) {
executionState = ExecutionState.successful;
Future.delayed(const Duration(seconds: 2), () {
if (mounted) {
setState(() {
executionState = ExecutionState.idle;
});
}
if (!mounted) return;
setState(() {
executionState = ExecutionState.idle;
});
});
}
} else {

View File

@@ -63,97 +63,114 @@ class _VideoStreamingSettingsPageState
),
)
: null,
body: CustomScrollView(
primary: false,
slivers: <Widget>[
TitleBarWidget(
reducedExpandedHeight: 16,
flexibleSpaceTitle: TitleBarTitleWidget(
title: AppLocalizations.of(context).videoStreaming,
),
actionIcons: [
IconButtonWidget(
icon: Icons.close_outlined,
iconButtonType: IconButtonType.secondary,
onTap: () {
Navigator.pop(context);
if (Navigator.canPop(context)) Navigator.pop(context);
if (Navigator.canPop(context)) Navigator.pop(context);
},
appBar: hasEnabled
? null
: PreferredSize(
preferredSize: const Size.fromHeight(154),
child: TitleBarWidget(
reducedExpandedHeight: 16,
flexibleSpaceTitle: TitleBarTitleWidget(
title: AppLocalizations.of(context).videoStreaming,
),
actionIcons: [
IconButtonWidget(
icon: Icons.close_outlined,
iconButtonType: IconButtonType.secondary,
onTap: () {
Navigator.pop(context);
if (Navigator.canPop(context)) Navigator.pop(context);
if (Navigator.canPop(context)) Navigator.pop(context);
},
),
],
isSliver: false,
),
],
),
if (hasEnabled) ...[
SliverToBoxAdapter(
child: Container(
height: MediaQuery.sizeOf(context).height * 0.88,
padding: const EdgeInsets.only(left: 16, right: 16),
child: Column(
children: [
Text.rich(
TextSpan(
children: [
TextSpan(
text: AppLocalizations.of(context)
.videoStreamingDescription,
),
if (hasEnabled) ...[
const TextSpan(text: " "),
TextSpan(
text: AppLocalizations.of(context)
.videoStreamingDescriptionClickable,
style: const TextStyle(
decoration: TextDecoration.underline,
),
recognizer: TapGestureRecognizer()
..onTap = openHelp,
),
],
],
),
textAlign: TextAlign.justify,
style: getEnteTextTheme(context).mini.copyWith(
color: getEnteColorScheme(context).textMuted,
),
),
body: hasEnabled
? CustomScrollView(
primary: false,
slivers: <Widget>[
TitleBarWidget(
reducedExpandedHeight: 16,
flexibleSpaceTitle: TitleBarTitleWidget(
title: AppLocalizations.of(context).videoStreaming,
),
actionIcons: [
IconButtonWidget(
icon: Icons.close_outlined,
iconButtonType: IconButtonType.secondary,
onTap: () {
Navigator.pop(context);
if (Navigator.canPop(context)) Navigator.pop(context);
if (Navigator.canPop(context)) Navigator.pop(context);
},
),
],
),
),
),
SliverToBoxAdapter(
child: Padding(
padding: const EdgeInsets.symmetric(
horizontal: 10,
).copyWith(top: 30),
child: _getStreamingSettings(context),
),
),
] else ...[
SliverToBoxAdapter(
child: SizedBox(
width: double.infinity,
SliverToBoxAdapter(
child: Container(
padding: const EdgeInsets.only(left: 16, right: 16),
child: Column(
children: [
Text.rich(
TextSpan(
children: [
TextSpan(
text: AppLocalizations.of(context)
.videoStreamingDescription,
),
const TextSpan(text: " "),
TextSpan(
text: AppLocalizations.of(context).moreDetails,
style: TextStyle(
color: getEnteColorScheme(context).primary500,
),
recognizer: TapGestureRecognizer()
..onTap = openHelp,
),
],
),
textAlign: TextAlign.justify,
style: getEnteTextTheme(context).mini.copyWith(
color: getEnteColorScheme(context).textMuted,
),
),
],
),
),
),
SliverToBoxAdapter(
child: Padding(
padding: const EdgeInsets.symmetric(
horizontal: 10,
).copyWith(top: 30),
child: _getStreamingSettings(context),
),
),
],
)
: Center(
child: SingleChildScrollView(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Image.asset(
"assets/albums-widget-static.png",
"assets/enable-streaming-static.png",
height: 160,
),
const SizedBox(height: 16),
Text.rich(
TextSpan(
text: AppLocalizations.of(context).addSomePhotosDesc1,
text: AppLocalizations.of(context)
.videoStreamingDescription +
" ",
children: [
TextSpan(
text:
AppLocalizations.of(context).addSomePhotosDesc2,
text: AppLocalizations.of(context).moreDetails,
style: TextStyle(
color: getEnteColorScheme(context).primary500,
),
),
TextSpan(
text:
AppLocalizations.of(context).addSomePhotosDesc3,
recognizer: TapGestureRecognizer()
..onTap = openHelp,
),
],
),
@@ -165,9 +182,6 @@ class _VideoStreamingSettingsPageState
),
),
),
],
],
),
);
}
@@ -185,6 +199,7 @@ class _VideoStreamingSettingsPageState
final isEnabled = VideoPreviewService.instance.isVideoStreamingEnabled;
await VideoPreviewService.instance.setIsVideoStreamingEnabled(!isEnabled);
if (!mounted) return;
setState(() {});
}