Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

Show Christmas animation only from Dec 24-26

AmanRajSinghMourya9d12e51f0d76
diff --git a/mobile/apps/photos/lib/ui/home/christmas/christmas_utils.dart b/mobile/apps/photos/lib/ui/home/christmas/christmas_utils.dart
new file mode 100644
index 0000000000..afb5c74013
--- /dev/null
+++ b/mobile/apps/photos/lib/ui/home/christmas/christmas_utils.dart
@@ -0,0 +1,5 @@
+/// Returns true if the current date is within the Christmas period (Dec 24-26).
+bool isChristmasPeriod() {
+ final now = DateTime.now();
+ return now.month == 12 && now.day >= 24 && now.day <= 26;
+}
diff --git a/mobile/apps/photos/lib/ui/home/christmas/snow_fall_overlay.dart b/mobile/apps/photos/lib/ui/home/christmas/snow_fall_overlay.dart
index 1cd09dbf3c..98e8b7ca15 100644
--- a/mobile/apps/photos/lib/ui/home/christmas/snow_fall_overlay.dart
+++ b/mobile/apps/photos/lib/ui/home/christmas/snow_fall_overlay.dart
@@ -365,7 +365,7 @@ class _FadingSnowOverlayState extends State<FadingSnowOverlay>
_fadeController.forward();
} else if (!isPulling && _wasPulling && _isVisible && !_isFadingOut) {
_isFadingOut = true;
- _fadeController.duration = const Duration(milliseconds: 2000);
+ _fadeController.duration = const Duration(milliseconds: 1000);
_fadeController.reverse().then((_) {
if (mounted) {
setState(() {
diff --git a/mobile/apps/photos/lib/ui/home/status_bar_widget.dart b/mobile/apps/photos/lib/ui/home/status_bar_widget.dart
index 7b24f281e8..bd0f7e76ab 100644
--- a/mobile/apps/photos/lib/ui/home/status_bar_widget.dart
+++ b/mobile/apps/photos/lib/ui/home/status_bar_widget.dart
@@ -16,6 +16,7 @@ import 'package:photos/ui/account/verify_recovery_page.dart';
import 'package:photos/ui/components/home_header_widget.dart';
import 'package:photos/ui/components/notification_widget.dart';
import 'package:photos/ui/home/christmas/christmas_lights_banner.dart';
+import 'package:photos/ui/home/christmas/christmas_utils.dart';
import 'package:photos/ui/home/header_error_widget.dart';
import "package:photos/ui/settings/backup/backup_settings_screen.dart";
import "package:photos/ui/settings/backup/backup_status_screen.dart";
@@ -98,7 +99,7 @@ class _StatusBarWidgetState extends State<StatusBarWidget> {
Widget build(BuildContext context) {
return Column(
children: [
- const ChristmasLightsBanner(),
+ if (isChristmasPeriod()) const ChristmasLightsBanner(),
HomeHeaderWidget(
centerWidget: _showStatus && !_showErrorBanner
? GestureDetector(
diff --git a/mobile/apps/photos/lib/ui/tabs/home_widget.dart b/mobile/apps/photos/lib/ui/tabs/home_widget.dart
index 35d49a0b20..16a41ef1c6 100644
--- a/mobile/apps/photos/lib/ui/tabs/home_widget.dart
+++ b/mobile/apps/photos/lib/ui/tabs/home_widget.dart
@@ -60,6 +60,7 @@ import "package:photos/ui/components/buttons/button_widget.dart";
import "package:photos/ui/components/models/button_type.dart";
import "package:photos/ui/extents_page_view.dart";
import "package:photos/ui/home/christmas/christmas_pull_animation.dart";
+import "package:photos/ui/home/christmas/christmas_utils.dart";
import "package:photos/ui/home/christmas/snow_fall_overlay.dart";
import "package:photos/ui/home/grant_permissions_widget.dart";
import "package:photos/ui/home/header_widget.dart";
@@ -765,33 +766,35 @@ class _HomeWidgetState extends State<HomeWidget> {
},
),
),
- ValueListenableBuilder<double>(
- valueListenable: _christmasPullOffsetNotifier,
- builder: (context, pullOffset, child) {
- return ValueListenableBuilder<bool>(
- valueListenable: _christmasPullReleasedNotifier,
- builder: (context, isReleased, child) {
- if (pullOffset <= 0) {
- return const SizedBox.shrink();
- }
- return Positioned(
- top: 0,
- left: 0,
- right: 0,
- child: ChristmasPullOverlay(
- pullOffset: pullOffset,
- isReleased: isReleased,
- ),
- );
- },
- );
- },
- ),
- Positioned.fill(
- child: FadingSnowOverlay(
- pullOffsetNotifier: _christmasPullOffsetNotifier,
+ if (isChristmasPeriod())
+ ValueListenableBuilder<double>(
+ valueListenable: _christmasPullOffsetNotifier,
+ builder: (context, pullOffset, child) {
+ return ValueListenableBuilder<bool>(
+ valueListenable: _christmasPullReleasedNotifier,
+ builder: (context, isReleased, child) {
+ if (pullOffset <= 0) {
+ return const SizedBox.shrink();
+ }
+ return Positioned(
+ top: 0,
+ left: 0,
+ right: 0,
+ child: ChristmasPullOverlay(
+ pullOffset: pullOffset,
+ isReleased: isReleased,
+ ),
+ );
+ },
+ );
+ },
+ ),
+ if (isChristmasPeriod())
+ Positioned.fill(
+ child: FadingSnowOverlay(
+ pullOffsetNotifier: _christmasPullOffsetNotifier,
+ ),
),
- ),
],
),
@@ -879,6 +882,8 @@ class _HomeWidgetState extends State<HomeWidget> {
},
child: NotificationListener<ScrollNotification>(
onNotification: (notification) {
+ if (!isChristmasPeriod()) return false;
+
const double maxPullOffset = 200.0;
if (notification is ScrollUpdateNotification) {