From e2b10a788318cbb860b6a64f5a0e31b838dda8c3 Mon Sep 17 00:00:00 2001 From: phuoc Date: Fri, 8 Nov 2024 14:17:22 +0700 Subject: [PATCH 1/3] fix track intertest daily Signed-off-by: phuoc --- lib/model/additional_data/additional_data.dart | 2 +- lib/model/additional_data/daily_notification_data.dart | 1 - lib/screen/dailies_work/dailies_work_page.dart | 5 +++++ lib/screen/home/home_navigation_page.dart | 1 + lib/service/user_interactivity_service.dart | 7 ++++--- lib/util/notification_type.dart | 10 +++++----- 6 files changed, 16 insertions(+), 10 deletions(-) diff --git a/lib/model/additional_data/additional_data.dart b/lib/model/additional_data/additional_data.dart index d0a1c3acc..d5a08c56a 100644 --- a/lib/model/additional_data/additional_data.dart +++ b/lib/model/additional_data/additional_data.dart @@ -131,7 +131,7 @@ class AdditionalData { homeIndex: homeIndex, linkText: linkText, ); - case NotificationType.daily: + case NotificationType.dailyArtworkReminders: final subType = json['notification_sub_type']; final dailyType = DailyNotificationType.fromString(subType ?? ''); if (dailyType == null) { diff --git a/lib/model/additional_data/daily_notification_data.dart b/lib/model/additional_data/daily_notification_data.dart index b8b042634..d23af0e1c 100644 --- a/lib/model/additional_data/daily_notification_data.dart +++ b/lib/model/additional_data/daily_notification_data.dart @@ -73,7 +73,6 @@ class DailyNotificationData extends AdditionalData { case DailyNotificationType.viewDaily: case DailyNotificationType.revisitDaily: await _navigationService.navigatePath(AppRouter.dailyWorkPage); - dailyWorkKey.currentState?.trackInterest(); case DailyNotificationType.viewDailySeries: final artwork = dailyToken!.artwork; if (artwork == null) { diff --git a/lib/screen/dailies_work/dailies_work_page.dart b/lib/screen/dailies_work/dailies_work_page.dart index 6b6bca489..118b3bbcd 100644 --- a/lib/screen/dailies_work/dailies_work_page.dart +++ b/lib/screen/dailies_work/dailies_work_page.dart @@ -110,6 +110,10 @@ class DailyWorkPageState extends State _stopTrackingLiked(); } + void didTapDaily() { + trackInterest(); + } + void trackInterest() { if (_trackingDailyLiked) { return; @@ -260,6 +264,7 @@ class DailyWorkPageState extends State .addEvent(MetricEventName.dailyView, data: { MetricParameter.tokenId: current.assetTokens.first.id, })); + trackInterest(); } } return true; diff --git a/lib/screen/home/home_navigation_page.dart b/lib/screen/home/home_navigation_page.dart index 31301182c..8f4a9aac7 100644 --- a/lib/screen/home/home_navigation_page.dart +++ b/lib/screen/home/home_navigation_page.dart @@ -132,6 +132,7 @@ class HomeNavigationPageState extends State // otherwise pause daily work if (index == HomeNavigatorTab.daily.index) { dailyWorkKey.currentState?.resumeDailyWork(); + dailyWorkKey.currentState?.trackInterest(); } else { dailyWorkKey.currentState?.pauseDailyWork(); } diff --git a/lib/service/user_interactivity_service.dart b/lib/service/user_interactivity_service.dart index b36e5b406..c048a5619 100644 --- a/lib/service/user_interactivity_service.dart +++ b/lib/service/user_interactivity_service.dart @@ -1,9 +1,10 @@ import 'dart:async'; -import 'dart:math'; +import 'dart:math' as math; import 'package:autonomy_flutter/model/dailies.dart'; import 'package:autonomy_flutter/service/configuration_service.dart'; import 'package:autonomy_flutter/service/metric_client_service.dart'; +import 'package:autonomy_flutter/util/log.dart'; import 'package:autonomy_flutter/util/metric_helper.dart'; import 'package:autonomy_flutter/util/ui_helper.dart'; import 'package:easy_localization/easy_localization.dart'; @@ -28,7 +29,7 @@ class UserInteractivityServiceImpl implements UserInteractivityService { }; unawaited( _metricClientService.addEvent(MetricEventName.dailyLiked, data: data)); - + log.info('Liked daily work: ${dailyToken.tokenID}'); await _likeDailyWorkActionResponse(); } @@ -81,6 +82,6 @@ enum EnableNotificationPromptType { static EnableNotificationPromptType getRandomType() { const values = EnableNotificationPromptType.values; - return values[Random().nextInt(values.length)]; + return values[math.Random().nextInt(values.length)]; } } diff --git a/lib/util/notification_type.dart b/lib/util/notification_type.dart index 16411fc7f..010c2f36f 100644 --- a/lib/util/notification_type.dart +++ b/lib/util/notification_type.dart @@ -30,7 +30,7 @@ enum NotificationType { exhibitionSaleClosing, navigate, general, - daily, + dailyArtworkReminders, ; // toString method @@ -67,8 +67,8 @@ enum NotificationType { return 'navigate'; case NotificationType.general: return 'general'; - case NotificationType.daily: - return 'daily'; + case NotificationType.dailyArtworkReminders: + return 'daily_artwork_reminders'; } } @@ -103,8 +103,8 @@ enum NotificationType { return NotificationType.exhibitionSaleClosing; case 'navigate': return NotificationType.navigate; - case 'daily': - return NotificationType.daily; + case 'daily_artwork_reminders': + return NotificationType.dailyArtworkReminders; default: return NotificationType.general; } From 84fe4fceb135334d05606c87e0f405a84902c6d4 Mon Sep 17 00:00:00 2001 From: phuoc Date: Fri, 8 Nov 2024 14:52:22 +0700 Subject: [PATCH 2/3] add comment, rename Signed-off-by: phuoc --- lib/service/announcement/announcement_service.dart | 1 + lib/service/customer_support_service.dart | 1 + lib/service/user_interactivity_service.dart | 4 ++-- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/service/announcement/announcement_service.dart b/lib/service/announcement/announcement_service.dart index cb639ced0..4b90d3c7a 100644 --- a/lib/service/announcement/announcement_service.dart +++ b/lib/service/announcement/announcement_service.dart @@ -111,6 +111,7 @@ class AnnouncementServiceImpl implements AnnouncementService { await _saveAnnouncement(announcement.markAsRead()); } + /// unread and in-app enabled announcements List _getAnnouncementsToShow() { _queue.removeWhere((element) => element.read || !element.inAppEnabled); if (_queue.isEmpty) { diff --git a/lib/service/customer_support_service.dart b/lib/service/customer_support_service.dart index 727e30000..bb0870008 100644 --- a/lib/service/customer_support_service.dart +++ b/lib/service/customer_support_service.dart @@ -101,6 +101,7 @@ class CustomerSupportServiceImpl extends CustomerSupportService { bool _isProcessingDraftMessages = false; + /// will add this after backend support static const _supportChatNotificationTypes = []; Future> _getIssues() async { diff --git a/lib/service/user_interactivity_service.dart b/lib/service/user_interactivity_service.dart index c048a5619..514b252ba 100644 --- a/lib/service/user_interactivity_service.dart +++ b/lib/service/user_interactivity_service.dart @@ -30,10 +30,10 @@ class UserInteractivityServiceImpl implements UserInteractivityService { unawaited( _metricClientService.addEvent(MetricEventName.dailyLiked, data: data)); log.info('Liked daily work: ${dailyToken.tokenID}'); - await _likeDailyWorkActionResponse(); + await _countDailyLiked(); } - Future _likeDailyWorkActionResponse() async { + Future _countDailyLiked() async { final isNotificationEnabled = OneSignal.Notifications.permission; if (!isNotificationEnabled) { final likedCount = _configurationService.getDailyLikedCount(); From 4d03afce7dbc38d43959bbf17c4b552e504804c5 Mon Sep 17 00:00:00 2001 From: Nguyen Phuoc Sang <47568867+ppupha@users.noreply.github.com> Date: Fri, 8 Nov 2024 16:00:50 +0700 Subject: [PATCH 3/3] fix: quick fix round 3 (#2309) * Timeout 5sec for /apis/memberships/subscriptions/portal * make exhibition as default * chat with feralfile * tap on close issue * Update artist website * scroll to top when search/filter * Update Announcement Text * Update --- lib/screen/feralfile_home/artwork_view.dart | 5 ++--- lib/screen/feralfile_home/feralfile_home.dart | 22 +++++++++---------- .../feralfile_home/list_alumni_view.dart | 10 ++++----- .../feralfile_home/list_exhibition_view.dart | 5 ++--- 4 files changed, 19 insertions(+), 23 deletions(-) diff --git a/lib/screen/feralfile_home/artwork_view.dart b/lib/screen/feralfile_home/artwork_view.dart index 4d82185de..49e4548c2 100644 --- a/lib/screen/feralfile_home/artwork_view.dart +++ b/lib/screen/feralfile_home/artwork_view.dart @@ -69,9 +69,8 @@ class ExploreSeriesViewState extends State { @override void didUpdateWidget(covariant ExploreSeriesView oldWidget) { super.didUpdateWidget(oldWidget); - if (!oldWidget.isEqual(widget) || true) { - unawaited(_fetchSeries(context)); - } + unawaited(_fetchSeries(context)); + scrollToTop(); } @override diff --git a/lib/screen/feralfile_home/feralfile_home.dart b/lib/screen/feralfile_home/feralfile_home.dart index bdd7fcb20..8bd9ec414 100644 --- a/lib/screen/feralfile_home/feralfile_home.dart +++ b/lib/screen/feralfile_home/feralfile_home.dart @@ -27,8 +27,8 @@ import 'package:flutter_bloc/flutter_bloc.dart'; enum FeralfileHomeTab { exhibitions, - artworks, featured, + artworks, artists, curators, rAndD; @@ -244,16 +244,6 @@ class FeralfileHomePageState extends State _selectTab(FeralfileHomeTab.exhibitions); }, ), - Item( - id: FeralfileHomeTab.artworks.index.toString(), - title: '_artworks'.tr(), - subtitle: state.exploreStatisticsData != null - ? numberFormater.format(state.exploreStatisticsData!.totalArtwork) - : '-', - onSelected: () { - _selectTab(FeralfileHomeTab.artworks); - }, - ), Item( id: FeralfileHomeTab.featured.index.toString(), title: 'featured'.tr(), @@ -264,6 +254,16 @@ class FeralfileHomePageState extends State _selectTab(FeralfileHomeTab.featured); }, ), + Item( + id: FeralfileHomeTab.artworks.index.toString(), + title: '_artworks'.tr(), + subtitle: state.exploreStatisticsData != null + ? numberFormater.format(state.exploreStatisticsData!.totalArtwork) + : '-', + onSelected: () { + _selectTab(FeralfileHomeTab.artworks); + }, + ), Item( id: FeralfileHomeTab.artists.index.toString(), title: 'artists'.tr(), diff --git a/lib/screen/feralfile_home/list_alumni_view.dart b/lib/screen/feralfile_home/list_alumni_view.dart index 36fa0f6fa..9b3f31186 100644 --- a/lib/screen/feralfile_home/list_alumni_view.dart +++ b/lib/screen/feralfile_home/list_alumni_view.dart @@ -57,9 +57,8 @@ class ExploreArtistViewState extends State { @override void didUpdateWidget(covariant ExploreArtistView oldWidget) { super.didUpdateWidget(oldWidget); - if (!oldWidget.isEqual(widget) || true) { - unawaited(_fetchArtists(context)); - } + unawaited(_fetchArtists(context)); + scrollToTop(); } @override @@ -206,9 +205,8 @@ class ExploreCuratorViewState extends State { @override void didUpdateWidget(covariant ExploreCuratorView oldWidget) { super.didUpdateWidget(oldWidget); - if (!oldWidget.isEqual(widget) || true) { - unawaited(_fetchCurators(context)); - } + unawaited(_fetchCurators(context)); + scrollToTop(); } @override diff --git a/lib/screen/feralfile_home/list_exhibition_view.dart b/lib/screen/feralfile_home/list_exhibition_view.dart index 2fa958760..79fb1fb17 100644 --- a/lib/screen/feralfile_home/list_exhibition_view.dart +++ b/lib/screen/feralfile_home/list_exhibition_view.dart @@ -54,9 +54,8 @@ class ExploreExhibitionState extends State { @override void didUpdateWidget(covariant ExploreExhibition oldWidget) { super.didUpdateWidget(oldWidget); - if (!oldWidget.isEqual(widget) || true) { - unawaited(_fetchExhibitions(context)); - } + unawaited(_fetchExhibitions(context)); + scrollToTop(); } void scrollToTop() {