Skip to content

Commit

Permalink
Merge branch 'develop' into release/08.11
Browse files Browse the repository at this point in the history
  • Loading branch information
ppupha authored Nov 8, 2024
2 parents 52b1c88 + 9d6ffd1 commit 77ddd1e
Show file tree
Hide file tree
Showing 8 changed files with 20 additions and 12 deletions.
2 changes: 1 addition & 1 deletion lib/model/additional_data/additional_data.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
1 change: 0 additions & 1 deletion lib/model/additional_data/daily_notification_data.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
5 changes: 5 additions & 0 deletions lib/screen/dailies_work/dailies_work_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,10 @@ class DailyWorkPageState extends State<DailyWorkPage>
_stopTrackingLiked();
}

void didTapDaily() {
trackInterest();
}

void trackInterest() {
if (_trackingDailyLiked) {
return;
Expand Down Expand Up @@ -260,6 +264,7 @@ class DailyWorkPageState extends State<DailyWorkPage>
.addEvent(MetricEventName.dailyView, data: {
MetricParameter.tokenId: current.assetTokens.first.id,
}));
trackInterest();
}
}
return true;
Expand Down
1 change: 1 addition & 0 deletions lib/screen/home/home_navigation_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ class HomeNavigationPageState extends State<HomeNavigationPage>
// otherwise pause daily work
if (index == HomeNavigatorTab.daily.index) {
dailyWorkKey.currentState?.resumeDailyWork();
dailyWorkKey.currentState?.trackInterest();
} else {
dailyWorkKey.currentState?.pauseDailyWork();
}
Expand Down
1 change: 1 addition & 0 deletions lib/service/announcement/announcement_service.dart
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ class AnnouncementServiceImpl implements AnnouncementService {
await _saveAnnouncement(announcement.markAsRead());
}

/// unread and in-app enabled announcements
List<AnnouncementLocal> _getAnnouncementsToShow() {
_queue.removeWhere((element) => element.read || !element.inAppEnabled);
if (_queue.isEmpty) {
Expand Down
1 change: 1 addition & 0 deletions lib/service/customer_support_service.dart
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ class CustomerSupportServiceImpl extends CustomerSupportService {

bool _isProcessingDraftMessages = false;

/// will add this after backend support
static const _supportChatNotificationTypes = [];

Future<List<Issue>> _getIssues() async {
Expand Down
11 changes: 6 additions & 5 deletions lib/service/user_interactivity_service.dart
Original file line number Diff line number Diff line change
@@ -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';
Expand All @@ -28,11 +29,11 @@ class UserInteractivityServiceImpl implements UserInteractivityService {
};
unawaited(
_metricClientService.addEvent(MetricEventName.dailyLiked, data: data));

await _likeDailyWorkActionResponse();
log.info('Liked daily work: ${dailyToken.tokenID}');
await _countDailyLiked();
}

Future<void> _likeDailyWorkActionResponse() async {
Future<void> _countDailyLiked() async {
final isNotificationEnabled = OneSignal.Notifications.permission;
if (!isNotificationEnabled) {
final likedCount = _configurationService.getDailyLikedCount();
Expand Down Expand Up @@ -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)];
}
}
10 changes: 5 additions & 5 deletions lib/util/notification_type.dart
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ enum NotificationType {
exhibitionSaleClosing,
navigate,
general,
daily,
dailyArtworkReminders,
;

// toString method
Expand Down Expand Up @@ -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';
}
}

Expand Down Expand Up @@ -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;
}
Expand Down

0 comments on commit 77ddd1e

Please sign in to comment.