initDailyPush static method

void initDailyPush(
  1. BuildContext context
)

初始化每日推送

Implementation

static void initDailyPush(BuildContext context) {
  // 检查是否已经显示过今天的推送
  final now = DateTime.now();
  if (_hasShownToday && _isSameDay(now, DateTime.now())) {
    return;
  }

  // 设置每日定时器(每天早上8点)
  _scheduleDailyPush(context);

  // 如果现在是早上8-9点之间,立即显示
  if (now.hour == 8 && !_hasShownToday) {
    _showDailyRecommendation(context);
  }
}