Remove black friday deal ref (#1546)

This commit is contained in:
Neeraj Gupta 2023-11-28 10:48:24 +05:30 committed by GitHub
commit db35137902
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 28 additions and 120 deletions

View file

@ -478,6 +478,7 @@ class MessageLookup extends MessageLookupByLibrary {
"discord": MessageLookupByLibrary.simpleMessage("Discord"), "discord": MessageLookupByLibrary.simpleMessage("Discord"),
"dismiss": MessageLookupByLibrary.simpleMessage("忽略"), "dismiss": MessageLookupByLibrary.simpleMessage("忽略"),
"distanceInKMUnit": MessageLookupByLibrary.simpleMessage("公里"), "distanceInKMUnit": MessageLookupByLibrary.simpleMessage("公里"),
"doNotSignOut": MessageLookupByLibrary.simpleMessage("不要退登"),
"doThisLater": MessageLookupByLibrary.simpleMessage("稍后再做"), "doThisLater": MessageLookupByLibrary.simpleMessage("稍后再做"),
"doYouWantToDiscardTheEditsYouHaveMade": "doYouWantToDiscardTheEditsYouHaveMade":
MessageLookupByLibrary.simpleMessage("您想要放弃您所做的编辑吗?"), MessageLookupByLibrary.simpleMessage("您想要放弃您所做的编辑吗?"),
@ -1013,6 +1014,11 @@ class MessageLookup extends MessageLookupByLibrary {
"sharedWithYou": MessageLookupByLibrary.simpleMessage("已与您共享"), "sharedWithYou": MessageLookupByLibrary.simpleMessage("已与您共享"),
"sharing": MessageLookupByLibrary.simpleMessage("正在分享..."), "sharing": MessageLookupByLibrary.simpleMessage("正在分享..."),
"showMemories": MessageLookupByLibrary.simpleMessage("显示回忆"), "showMemories": MessageLookupByLibrary.simpleMessage("显示回忆"),
"signOutFromOtherDevices":
MessageLookupByLibrary.simpleMessage("从其他设备退出登录"),
"signOutOtherBody": MessageLookupByLibrary.simpleMessage(
"如果你认为有人可能知道你的密码,你可以强制所有使用你账户的其他设备退出登录。"),
"signOutOtherDevices": MessageLookupByLibrary.simpleMessage("登出其他设备"),
"signUpTerms": MessageLookupByLibrary.simpleMessage( "signUpTerms": MessageLookupByLibrary.simpleMessage(
"我同意 <u-terms>服务条款</u-terms> 和 <u-policy>隐私政策</u-policy>"), "我同意 <u-terms>服务条款</u-terms> 和 <u-policy>隐私政策</u-policy>"),
"singleFileDeleteFromDevice": m49, "singleFileDeleteFromDevice": m49,

View file

@ -1,16 +1,13 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import "package:flutter_animate/flutter_animate.dart";
import "package:photos/generated/l10n.dart"; import "package:photos/generated/l10n.dart";
import 'package:photos/services/update_service.dart'; import 'package:photos/services/update_service.dart';
import 'package:photos/theme/ente_theme.dart'; import 'package:photos/theme/ente_theme.dart';
import 'package:photos/ui/components/buttons/button_widget.dart'; import 'package:photos/ui/components/buttons/button_widget.dart';
import 'package:photos/ui/components/divider_widget.dart'; import 'package:photos/ui/components/divider_widget.dart';
import 'package:photos/ui/components/models/button_type.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/components/title_bar_title_widget.dart';
import 'package:photos/ui/notification/update/change_log_entry.dart'; import 'package:photos/ui/notification/update/change_log_entry.dart';
import "package:photos/utils/black_friday_util.dart"; import "package:photos/utils/black_friday_util.dart";
import "package:url_launcher/url_launcher_string.dart";
class ChangeLogPage extends StatefulWidget { class ChangeLogPage extends StatefulWidget {
const ChangeLogPage({ const ChangeLogPage({
@ -67,36 +64,6 @@ class _ChangeLogPageState extends State<ChangeLogPage> {
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
shouldShowBfBanner()
? RepaintBoundary(
child: 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,
);
},
),
)
.animate(
onPlay: (controller) => controller.repeat(),
)
.shimmer(
duration: 1000.ms,
delay: 3200.ms,
size: 0.6,
),
)
: const SizedBox.shrink(),
ButtonWidget( ButtonWidget(
buttonType: ButtonType.trailingIconPrimary, buttonType: ButtonType.trailingIconPrimary,
buttonSize: ButtonSize.large, buttonSize: ButtonSize.large,
@ -112,33 +79,16 @@ class _ChangeLogPageState extends State<ChangeLogPage> {
const SizedBox( const SizedBox(
height: 8, height: 8,
), ),
// ButtonWidget( ButtonWidget(
// buttonType: ButtonType.trailingIconSecondary, buttonType: ButtonType.trailingIconSecondary,
// buttonSize: ButtonSize.large, buttonSize: ButtonSize.large,
// labelText: S.of(context).rateTheApp, labelText: S.of(context).rateTheApp,
// icon: Icons.favorite_rounded, icon: Icons.favorite_rounded,
// iconColor: enteColorScheme.primary500, iconColor: enteColorScheme.primary500,
// onTap: () async { onTap: () async {
// await UpdateService.instance.launchReviewUrl(); await UpdateService.instance.launchReviewUrl();
// }, },
// ), ),
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), const SizedBox(height: 8),
], ],
), ),
@ -160,14 +110,6 @@ class _ChangeLogPageState extends State<ChangeLogPage> {
'\nYou can now discover items that come under different Locations, Moments, Contacts, Photo descriptions, Albums and File types with ease.\n', '\nYou can now discover items that come under different Locations, Moments, Contacts, Photo descriptions, Albums and File types with ease.\n',
), ),
); );
items.add(
ChangeLogEntry(
"Black Friday Sale 🎉",
"You can now purchase Ente's plans for 3 years at 30% off and 5 years at 50% off!\n"
'\nThe storage you purchase will be stacked on top of your current plan.\n'
'\nThis is the lowest our prices will ever be, so do consider upgrading!\n',
),
);
return Container( return Container(
padding: const EdgeInsets.only(left: 16), padding: const EdgeInsets.only(left: 16),

View file

@ -27,9 +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/support_section_widget.dart';
import 'package:photos/ui/settings/theme_switch_widget.dart'; import 'package:photos/ui/settings/theme_switch_widget.dart';
import "package:photos/ui/sharing/verify_identity_dialog.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:photos/utils/navigation_util.dart";
import "package:url_launcher/url_launcher_string.dart";
class SettingsPage extends StatelessWidget { class SettingsPage extends StatelessWidget {
final ValueNotifier<String?> emailNotifier; final ValueNotifier<String?> emailNotifier;
@ -86,42 +84,25 @@ class SettingsPage extends StatelessWidget {
const sectionSpacing = SizedBox(height: 8); const sectionSpacing = SizedBox(height: 8);
contents.add(const SizedBox(height: 8)); contents.add(const SizedBox(height: 8));
if (hasLoggedIn) { if (hasLoggedIn) {
final shouldShowBFBanner = shouldShowBfBanner();
final showStorageBonusBanner = final showStorageBonusBanner =
StorageBonusService.instance.shouldShowStorageBonus(); StorageBonusService.instance.shouldShowStorageBonus();
contents.addAll([ contents.addAll([
const StorageCardWidget(), const StorageCardWidget(),
(shouldShowBFBanner || showStorageBonusBanner) (showStorageBonusBanner)
? RepaintBoundary( ? RepaintBoundary(
child: Padding( child: Padding(
padding: const EdgeInsets.symmetric(vertical: 8.0), padding: const EdgeInsets.symmetric(vertical: 8.0),
child: shouldShowBFBanner child: NotificationWidget(
? NotificationWidget( startIcon: Icons.auto_awesome,
isBlackFriday: true, actionIcon: Icons.arrow_forward_outlined,
startIcon: Icons.celebration, text: S.of(context).doubleYourStorage,
actionIcon: Icons.arrow_forward_outlined, subText: S.of(context).referFriendsAnd2xYourPlan,
text: S.of(context).blackFridaySale, type: NotificationType.goldenBanner,
subText: S.of(context).upto50OffUntil4thDec, onTap: () async {
type: NotificationType.goldenBanner, StorageBonusService.instance.markStorageBonusAsDone();
onTap: () async { routeToPage(context, const ReferralScreen());
launchUrlString( },
"https://ente.io/blackfriday", ),
mode: LaunchMode.platformDefault,
);
},
)
: NotificationWidget(
startIcon: Icons.auto_awesome,
actionIcon: Icons.arrow_forward_outlined,
text: S.of(context).doubleYourStorage,
subText: S.of(context).referFriendsAnd2xYourPlan,
type: NotificationType.goldenBanner,
onTap: () async {
StorageBonusService.instance
.markStorageBonusAsDone();
routeToPage(context, const ReferralScreen());
},
),
).animate(onPlay: (controller) => controller.repeat()).shimmer( ).animate(onPlay: (controller) => controller.repeat()).shimmer(
duration: 1000.ms, duration: 1000.ms,
delay: 3200.ms, delay: 3200.ms,

View file

@ -1,21 +0,0 @@
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);
}