π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
show black friday banner on change log widget
ashilkndcf2b11cdcb6
diff --git a/lib/ui/notification/update/change_log_page.dart b/lib/ui/notification/update/change_log_page.dartindex 5416035b3d..053ad0973f 100644--- a/lib/ui/notification/update/change_log_page.dart+++ b/lib/ui/notification/update/change_log_page.dart@@ -5,8 +5,10 @@ import 'package:photos/theme/ente_theme.dart';import 'package:photos/ui/components/buttons/button_widget.dart';import 'package:photos/ui/components/divider_widget.dart';import 'package:photos/ui/components/models/button_type.dart';+import "package:photos/ui/components/notification_widget.dart";import 'package:photos/ui/components/title_bar_title_widget.dart';import 'package:photos/ui/notification/update/change_log_entry.dart';+import "package:photos/utils/black_friday_util.dart";import "package:url_launcher/url_launcher_string.dart";class ChangeLogPage extends StatefulWidget {@@ -64,6 +66,26 @@ class _ChangeLogPageState extends State<ChangeLogPage> {child: Column(crossAxisAlignment: CrossAxisAlignment.start,children: [+ shouldShowBfBanner()+ ? Padding(+ padding: const EdgeInsets.only(bottom: 8),+ child: NotificationWidget(+ isBlackFriday: true,+ startIcon: Icons.celebration,+ actionIcon: Icons.arrow_forward_outlined,+ text: S.of(context).blackFridaySale,+ subText: S.of(context).upto50OffUntil4thDec,+ type: NotificationType.goldenBanner,+ onTap: () async {+ launchUrlString(+ "https://ente.io/blackfriday",+ mode: LaunchMode.platformDefault,+ );+ },+ ),+ )+ : const SizedBox.shrink(),+ButtonWidget(buttonType: ButtonType.trailingIconPrimary,buttonSize: ButtonSize.large,@@ -89,19 +111,23 @@ class _ChangeLogPageState extends State<ChangeLogPage> {// await UpdateService.instance.launchReviewUrl();// },// ),- ButtonWidget(- buttonType: ButtonType.trailingIconSecondary,- buttonSize: ButtonSize.large,- labelText: "Join the ente community",- icon: Icons.people_alt_rounded,- iconColor: enteColorScheme.primary500,- onTap: () async {- launchUrlString(- "https://ente.io/community",- mode: LaunchMode.externalApplication,- );- },- ),++ shouldShowBfBanner()+ ? const SizedBox.shrink()+ : ButtonWidget(+ buttonType: ButtonType.trailingIconSecondary,+ buttonSize: ButtonSize.large,+ labelText: "Join the ente community",+ icon: Icons.people_alt_rounded,+ iconColor: enteColorScheme.primary500,+ onTap: () async {+ launchUrlString(+ "https://ente.io/community",+ mode: LaunchMode.externalApplication,+ );+ },+ ),+const SizedBox(height: 8),],),diff --git a/lib/ui/settings_page.dart b/lib/ui/settings_page.dartindex 044a70975a..2e6d4dda65 100644--- a/lib/ui/settings_page.dart+++ b/lib/ui/settings_page.dart@@ -9,7 +9,6 @@ import 'package:photos/events/opened_settings_event.dart';import "package:photos/generated/l10n.dart";import 'package:photos/services/feature_flag_service.dart';import "package:photos/services/storage_bonus_service.dart";-import "package:photos/services/user_service.dart";import 'package:photos/theme/colors.dart';import 'package:photos/theme/ente_theme.dart';import "package:photos/ui/components/notification_widget.dart";@@ -28,6 +27,7 @@ import 'package:photos/ui/settings/storage_card_widget.dart';import 'package:photos/ui/settings/support_section_widget.dart';import 'package:photos/ui/settings/theme_switch_widget.dart';import "package:photos/ui/sharing/verify_identity_dialog.dart";+import "package:photos/utils/black_friday_util.dart";import "package:photos/utils/navigation_util.dart";import "package:url_launcher/url_launcher_string.dart";@@ -188,23 +188,6 @@ class SettingsPage extends StatelessWidget {);}- bool shouldShowBfBanner() {- if (!Platform.isAndroid && !kDebugMode) {- return false;- }- // if date is after 5th of December 2023, 00:00:00, hide banner- if (DateTime.now().isAfter(DateTime(2023, 12, 5))) {- return false;- }- // if coupon is already applied, can hide the banner- return (UserService.instance- .getCachedUserDetails()- ?.bonusData- ?.getAddOnBonuses()- .isEmpty ??- true);- }-Future<void> _showVerifyIdentityDialog(BuildContext context) async {await showDialog(context: context,diff --git a/lib/utils/black_friday_util.dart b/lib/utils/black_friday_util.dartnew file mode 100644index 0000000000..0887d6b7a0--- /dev/null+++ b/lib/utils/black_friday_util.dart@@ -0,0 +1,21 @@+import "dart:io";++import "package:flutter/foundation.dart";+import "package:photos/services/user_service.dart";++bool shouldShowBfBanner() {+ if (!Platform.isAndroid && !kDebugMode) {+ return false;+ }+ // if date is after 5th of December 2023, 00:00:00, hide banner+ if (DateTime.now().isAfter(DateTime(2023, 12, 5))) {+ return false;+ }+ // if coupon is already applied, can hide the banner+ return (UserService.instance+ .getCachedUserDetails()+ ?.bonusData+ ?.getAddOnBonuses()+ .isEmpty ??+ true);+}