Conversation
ended_pill_sheet_dialog_history / ended_pill_sheet_dialog_summary を追加し、A/B 各バリアントの paywall 経路を計測できるようにする
A/B バリアント割り当てを Firebase Remote Config / A/B Testing で行う。 default は空文字(実験未参加=非表示)で、history_blur / summary_stats を配信する。 String 取得用の getStringOrDefault 拡張も追加
服用予定日と服用記録日の集合構築を内部ヘルパーに切り出し(missedPillDays の戻り値は不変)、 服用予定日数を返す scheduledPillDays を追加する。 ダイアログ Variant B の x(服用記録日数) = scheduledPillDays - missedPillDays に利用する
endedPillSheetDialogShown(pillSheetGroupID) で終了グループごとに表示済みを保持し、 1つの終了ピルシートグループにつき1回だけダイアログを出す
ピルシート終了時に free ユーザーへ価値ティーザー型ダイアログを表示する。 - Variant A(history_blur): 最新の服用履歴3件を先頭1件は鮮明・残り2件は blur で見せる - Variant B(summary_stats): 服用記録できた日数・記録漏れ日数の集計メッセージを表示 - shown / cta_tapped / dismissed を variant 付きで送出し、CTA から各 source で paywall を開く - 集計の境界値・variant 解決・ダイアログの分岐描画をテスト
HomePageBody の起動時 useEffect に「終了グループ + free + 未表示」分岐を追加し、 Remote Config の variant に応じてダイアログを表示する。既存の月次 paywall とは排他。 バーは残し、ダイアログを追加する(置換しない)
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthrough終了ピルシート向けに、服用集計、Remote Config の variant、ダイアログ UI、ホーム画面からの表示導線を追加しました。履歴ぼかし/集計の2種ティーザーと、表示済み判定付きの起動処理も含まれます。 Changes終了ピルシートダイアログ
Estimated code review effort: 4 (Complex) | ~60 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Code Review
このプルリクエストでは、ピルシートが終了した無料ユーザー向けに、Firebase Remote Configのバリアント設定(履歴のぼかし表示または服用記録の集計メッセージ)に応じた課金転換ダイアログを表示する機能が追加されました。これに伴い、服用予定日数や記録漏れ日数を集計するロジックの共通化や、関連するUIコンポーネントおよびテストコードが実装されています。レビュー指摘として、endedPillSheetTakenSummary 内で _buildPillTakenDateSets が重複して実行される非効率な実装に対して、1回の呼び出しに最適化する具体的なコード提案が行われています。
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 9ab08dc4d3
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
Actionable comments posted: 2
🧹 Nitpick comments (1)
lib/l10n/app_en.arb (1)
2805-2809: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value新規ローカライズキーの
@メタデータ description が欠落・空です。
endedPillSheetDialogHistoryTitleとendedPillSheetDialogSummaryTitleには@メタデータ(description)が無く、endedPillSheetDialogSummaryMessageの description は空文字です。このファイルの他キーと同様に翻訳意図が伝わる説明を付与しておくと、翻訳品質・保守性が向上します。🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@lib/l10n/app_en.arb` around lines 2805 - 2809, The new localization keys in app_en.arb are missing proper @ metadata descriptions, and endedPillSheetDialogSummaryMessage currently has an empty description. Update the corresponding metadata entries for endedPillSheetDialogHistoryTitle, endedPillSheetDialogSummaryTitle, and endedPillSheetDialogSummaryMessage so each has a clear, non-empty description consistent with the other ARB entries, using the same key names to locate them.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@lib/features/home/page.dart`:
- Around line 174-175: The ended pill sheet “shown” flag is written without
waiting for the result, so failures can be missed and the dialog may reappear
for the same group. Update the flow in the home page logic around
showEndedPillSheetDialog and sharedPreferences.setBool to await the write, check
the returned success value, and handle the failure case explicitly so the saved
state is reliable.
In `@test/features/ended_pill_sheet_dialog/ended_pill_sheet_dialog_test.dart`:
- Line 30: The EndedPillSheetDialog widget test group name should follow the
Widget Test naming convention and start with a # prefix. Update the group
declaration in EndedPillSheetDialog tests to use the widget class name with a
leading # so it matches the path instructions and is easy to identify alongside
other widget test groups.
---
Nitpick comments:
In `@lib/l10n/app_en.arb`:
- Around line 2805-2809: The new localization keys in app_en.arb are missing
proper @ metadata descriptions, and endedPillSheetDialogSummaryMessage currently
has an empty description. Update the corresponding metadata entries for
endedPillSheetDialogHistoryTitle, endedPillSheetDialogSummaryTitle, and
endedPillSheetDialogSummaryMessage so each has a clear, non-empty description
consistent with the other ARB entries, using the same key names to locate them.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 1301f059-a4bd-45dc-95f7-c5b54131e18a
📒 Files selected for processing (22)
lib/entity/pill_sheet_modified_history.codegen.dartlib/entity/remote_config_parameter.codegen.dartlib/entity/remote_config_parameter.codegen.freezed.dartlib/entity/remote_config_parameter.codegen.g.dartlib/features/ended_pill_sheet_dialog/components/history_blur_teaser.dartlib/features/ended_pill_sheet_dialog/components/summary_stats_teaser.dartlib/features/ended_pill_sheet_dialog/ended_pill_sheet_dialog.dartlib/features/ended_pill_sheet_dialog/ended_pill_sheet_dialog_variant.dartlib/features/ended_pill_sheet_dialog/ended_pill_sheet_taken_summary.dartlib/features/home/page.dartlib/features/premium_introduction/paywall_source.dartlib/l10n/app_en.arblib/l10n/app_ja.arblib/provider/remote_config_parameter.dartlib/provider/remote_config_parameter.g.dartlib/utils/remote_config.dartlib/utils/shared_preference/keys.darttest/entity/pill_sheet_modified_history_test.darttest/features/ended_pill_sheet_dialog/ended_pill_sheet_dialog_test.darttest/features/ended_pill_sheet_dialog/ended_pill_sheet_dialog_variant_test.darttest/features/ended_pill_sheet_dialog/ended_pill_sheet_taken_summary_test.darttest/features/premium_introduction/paywall_source_test.dart
- 日付集合をすべて日付のみに正規化(時刻付き履歴で服用日が一致せず recordedDays=0 になる不具合を修正) - 集計期間をシート開始日(beginDate)〜終了日(endDate・両端含む)にし、開始日〜初回記録前の未記録日も記録漏れに含める - endedPillSheetTakenSummary は pillTakenDateSets を1回だけ呼び出す(服用予定日数・記録漏れ日数の二重計算を解消) - scheduledPillDays を削除し、_buildPillTakenDateSets を pillTakenDateSets として公開
CodeRabbit レビュー対応: setBool の結果を待たずにいたため、保存失敗時に同じ終了グループでダイアログが再表示される可能性があった。await して失敗時は debugPrint する。
CodeRabbit レビュー対応: Widget Test のグループは Widget クラス名を # 始まりで命名する規約に合わせる。
There was a problem hiding this comment.
🧹 Nitpick comments (1)
lib/features/ended_pill_sheet_dialog/ended_pill_sheet_taken_summary.dart (1)
18-20: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value到達不能な null 分岐
beginDateは必須パラメータのため、pillTakenDateSetsが null を返す条件(beginDate == nullかつ履歴が空)には到達しません。この分岐は実質デッドコードです。♻️ 提案
- if (sets == null) { - return (recordedDays: 0, missedDays: 0); - } - final missedDays = sets.scheduledDates.difference(sets.takenDates).length; + final missedDays = sets!.scheduledDates.difference(sets.takenDates).length;または、戻り値の型を non-nullable にできないか
pillTakenDateSets側の実装を確認した上で、呼び出し側のnullチェックの要否を再検討してください。🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@lib/features/ended_pill_sheet_dialog/ended_pill_sheet_taken_summary.dart` around lines 18 - 20, The null guard in pillTakenDateSummary is unreachable because beginDate is required, so the sets == null branch is dead code. Remove that branch from ended_pill_sheet_taken_summary.dart and then verify pillTakenDateSets and any callers of pillTakenDateSummary so the return type can be kept consistently non-nullable if possible, or adjust the API only if a real null case exists.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@lib/features/ended_pill_sheet_dialog/ended_pill_sheet_taken_summary.dart`:
- Around line 18-20: The null guard in pillTakenDateSummary is unreachable
because beginDate is required, so the sets == null branch is dead code. Remove
that branch from ended_pill_sheet_taken_summary.dart and then verify
pillTakenDateSets and any callers of pillTakenDateSummary so the return type can
be kept consistently non-nullable if possible, or adjust the API only if a real
null case exists.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: aefe2cf1-9674-4ab2-91e5-0d3e8831e586
📒 Files selected for processing (7)
lib/entity/pill_sheet_modified_history.codegen.dartlib/features/ended_pill_sheet_dialog/components/summary_stats_teaser.dartlib/features/ended_pill_sheet_dialog/ended_pill_sheet_taken_summary.dartlib/features/home/page.darttest/entity/pill_sheet_modified_history_test.darttest/features/ended_pill_sheet_dialog/ended_pill_sheet_dialog_test.darttest/features/ended_pill_sheet_dialog/ended_pill_sheet_taken_summary_test.dart
✅ Files skipped from review due to trivial changes (1)
- lib/entity/pill_sheet_modified_history.codegen.dart
🚧 Files skipped from review as they are similar to previous changes (3)
- test/features/ended_pill_sheet_dialog/ended_pill_sheet_dialog_test.dart
- lib/features/home/page.dart
- lib/features/ended_pill_sheet_dialog/components/summary_stats_teaser.dart
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 723748ec86
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
コンフリクト解消: - remote_config / paywall_source: main の lifetimeOffer* と本ブランチの endedPillSheetDialogVariant / endedPillSheetDialog* を両方残す - home/page.dart: main で削除された月次 paywall (homeMonthly) 分岐は削除し、ピルシート終了ダイアログ分岐のみ残す - 生成ファイル (freezed/g.dart) は build_runner で再生成
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 5ab5553bc5
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
- 日付正規化を DateTime(y,m,d) の手書きから .date() extension に置き換え - revertTakenPill 履歴の before/after グループの lastTakenDate 差分から取り消された日を takenDates から除外する。取り消し後に再記録された日は時系列処理で再度加算される
服用予定日を begin〜end の全日から「各シートの錠剤日付のうち実薬分(dosingPeriod)」に変更。 pillsheet_21 等の休薬・偽薬期間が記録漏れにカウントされる問題を修正する。 服用お休みによる日付シフトは PillSheet.buildDates が織り込む
- AsyncValue を when で分岐し、ロード中は Indicator・エラーはメッセージをそのまま表示(空履歴での誤集計を防ぐ) - afterPillSheetGroup.id でフィルタし、同じ日付範囲を含む別グループの履歴が混ざらないようにする
視覚的に隠している履歴がスクリーンリーダーで読み上げられないようにする
|
@codex review |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@lib/features/ended_pill_sheet_dialog/components/summary_stats_teaser.dart`:
- Around line 54-62: The error branch in the `summary_stats_teaser.dart` widget
is exposing internal details by rendering `error.toString()` directly. Update
the `error:` callback in the teaser’s builder to avoid showing raw exception
text; instead, display a user-friendly fallback message or reuse the same
`Indicator` loading-style UI. Keep the change localized to the error handling
for this summary stats teaser so the widget no longer leaks implementation
details.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 1765aad7-706b-42b9-bc47-9d3951b9d485
📒 Files selected for processing (14)
lib/entity/pill_sheet_modified_history.codegen.dartlib/entity/remote_config_parameter.codegen.dartlib/entity/remote_config_parameter.codegen.freezed.dartlib/entity/remote_config_parameter.codegen.g.dartlib/features/ended_pill_sheet_dialog/components/history_blur_teaser.dartlib/features/ended_pill_sheet_dialog/components/summary_stats_teaser.dartlib/features/ended_pill_sheet_dialog/ended_pill_sheet_taken_summary.dartlib/features/home/page.dartlib/features/premium_introduction/paywall_source.dartlib/provider/remote_config_parameter.dartlib/provider/remote_config_parameter.g.dartlib/utils/remote_config.dartlib/utils/shared_preference/keys.darttest/features/ended_pill_sheet_dialog/ended_pill_sheet_taken_summary_test.dart
💤 Files with no reviewable changes (1)
- lib/features/home/page.dart
✅ Files skipped from review due to trivial changes (4)
- lib/entity/remote_config_parameter.codegen.g.dart
- lib/utils/remote_config.dart
- lib/provider/remote_config_parameter.g.dart
- lib/entity/remote_config_parameter.codegen.freezed.dart
🚧 Files skipped from review as they are similar to previous changes (6)
- lib/features/ended_pill_sheet_dialog/components/history_blur_teaser.dart
- lib/utils/shared_preference/keys.dart
- lib/features/premium_introduction/paywall_source.dart
- lib/provider/remote_config_parameter.dart
- lib/entity/remote_config_parameter.codegen.dart
- lib/entity/pill_sheet_modified_history.codegen.dart
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 3edc953186
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
履歴は180日のTTLで削除されるため、終了から長期間経過したグループでは取得結果が空になり 「服用記録0件・記録漏れ全日」の誤った集計が表示されていた。対象グループの履歴が空の場合は 集計メッセージを出さず、見出し・プレミアム訴求・CTAのみ表示する
- 取り消してそのままの日は飲み忘れとしてカウントされる - 取り消して同じ日に再記録した場合は飲み忘れにならない - 複数日分まとめて取り消した場合は全日が飲み忘れになる
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 07fd6408d0
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
PR #1809 の既存挙動変更の監査で不足していた直接テストを追加: - 全件取り消し(取り消し後の最終服用日が null)で全日が飲み忘れになる - before/after グループが null の revert は従来どおり無視される - 最古履歴が深夜(23:59)の時刻付きでも日付単位で集計される - 時刻付き最古履歴 + 服用お休み継続中で休薬期間が除外される
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 07a7cec6d4
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
- HistoryBlurTeaser を対象グループの履歴に絞り、取り消し(revertTakenPill)されたままの服用記録を表示しない - SummaryStatsTeaser は集計開始日が履歴TTL(180日)の窓外の場合、部分的な履歴欠落による誤集計を防ぐため集計メッセージを表示しない - 削除済み(deletedAt != null)グループを終了ダイアログの表示対象から除外 - 上記の widget テストを追加
|
/gemini review |
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 5ab0993388
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
集計メッセージの無いダイアログで impression と表示済みフラグを消費しないよう、 表示トリガー側で endedPillSheetTakenSummaryAvailable(履歴TTL窓内かつ対象グループの 履歴あり)を事前判定する。ティーザー側の同条件チェックは表示中のデータ更新に対する 防御として共通関数で残す
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: feee1cacae
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
- pillTakenDateSets: まとめ記録では操作日ではなく記録対象日 (記録前の最終服用日, 記録後の最終服用日] を展開して集計する。グループ情報の無い旧履歴は従来どおり - 起動時自動モーダルの排他: shownPaywallOnThisAppLaunchProvider を共有フラグとして、終了ダイアログと買い切りオファーが同一起動で重ならないようにする - HistoryBlurTeaser: AsyncValue.when でローディング中は Indicator を表示し、表示トリガー側でも履歴取得後に表示可否を判定する(内容の無いダイアログで impression と表示済みフラグを消費しない)
|
/gemini review |
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 5dc4a449bd
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
- takenPillHistoryTargetDates を切り出し、服用日時が編集された履歴は編集後の日時を記録日とする(before/after の lastTakenDate は編集前のままのため) - 履歴ティーザーの照合を操作日ではなく記録対象日で行い、過去日のピルを後から記録した履歴が落ちないようにする - 終了ダイアログ表示直前に起動時モーダルの共有排他フラグを再確認する(履歴取得 await 中の競合対策)
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 97cceb77f4
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
- 同じピル日に2回目を記録した履歴(lastTakenDate 不変)も記録対象日としてその日を返す - 服用日時を編集した記録が取り消された場合、編集後の日付も服用済みから除外する(元のピル日付→編集後日付の対応を保持) - 一部だけ取り消されたまとめ記録の行はティーザーに表示しない(行表示が afterPillSheetGroup ベースで実態とずれるため) - 買い切りオファー側も表示直前に起動時モーダルの共有排他フラグを再確認する
|
@codex review |
|
Codex Review: Didn't find any major issues. What shall we delve into next? Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
# Conflicts: # lib/entity/remote_config_parameter.codegen.dart # lib/entity/remote_config_parameter.codegen.freezed.dart # lib/entity/remote_config_parameter.codegen.g.dart # lib/provider/remote_config_parameter.dart # lib/provider/remote_config_parameter.g.dart # lib/utils/remote_config.dart
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 7a06139dd0
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| return false; | ||
| } | ||
| final targetDates = takenPillHistoryTargetDates(history); | ||
| return targetDates.isNotEmpty && targetDates.every(takenDates.contains); |
There was a problem hiding this comment.
同じ日を takenPill → revertTakenPill → takenPill で再記録した場合、takenDates には最終的な日付だけが残るため、後続の再記録だけでなく取り消された元の takenPill 行もこの条件を通過します。履歴ティーザーは revertTakenPill 行を表示しないので、直近3件に元行が入ると、最終状態では1件の服用記録しかない日に取り消し済みの服用行まで課金ティーザーとして見えてしまいます。日付集合だけでなく、時系列処理で生き残った taken 履歴を特定して表示対象を絞ってください。
Useful? React with 👍 / 👎.
| if (history.value.takenPill?.edited != null) { | ||
| return [history.estimatedEventCausingDate.date()]; |
There was a problem hiding this comment.
新たな根拠は、現在のコードが編集後の服用日時を estimatedEventCausingDate にして日付順処理するため、編集後日時が取り消し操作より後だと revert が先に処理される点です。服用日時を翌日などへ編集してからすぐ取り消すと、revert 時点では editedTakenDatesByOriginalDate が未登録で編集後日付を消せず、その後この分岐で取り消し済みの日付が takenDates に追加され、summary/history teaser に服用済みとして残ります。操作順(createdAt など)で取り消しを処理するか、revert 後にも編集済み対応を除去してください。
Useful? React with 👍 / 👎.
Abstract
ピルシートが終了した free ユーザーに、価値ティーザー型の課金転換ダイアログを表示する A/B 機能を追加します(PilllBackend issue #385 の Flutter 側実装)。
history_blur: 最新の服用履歴3件を「先頭1件は鮮明・残り2件は blur」で見せて課金を訴求summary_stats: 服用記録できた日数・記録漏れ日数の集計メッセージを見せる既存のピルシート終了バーは残し、ダイアログを 追加 します(置換しない)。表示は free ユーザー限定で、終了グループにつき1回です。
Why
PR #383 のリリース後分析で、ペイウォール起動経路別の購入転換に大きな差が判明しました。
ended_pill_sheet_bar(終了バー)pill_sheet_modified_history_card(ぼかし履歴カード)差はファネル最上流(paywall を開いた瞬間の意図)で生まれています。終了バーは「機能タスクの予告」文言で意図ミスマッチ、ぼかし履歴カードは「価値ティーザー+プレミアム明示+本人のオプトイン」で意図一致するため高転換です。この勝ち筋を終了タイミングに移植し、どの提示形式が効くかを A/B 検証します。
変更内容
計測
PaywallSourceにendedPillSheetDialogHistory/endedPillSheetDialogSummaryを追加(value:ended_pill_sheet_dialog_history/ended_pill_sheet_dialog_summary)variant付きで送出:ended_sheet_dialog_shown/ended_sheet_dialog_cta_tapped/ended_sheet_dialog_dismissedshowPremiumIntroductionSheet(source: 各バリアントの source)で既存 paywall ファネル(paywall_viewed→pressed_*_purchase_button→purchase_succeeded)に接続A/B 割り当て
endedPillSheetDialogVariant(default 空文字=非表示)を追加し、history_blur/summary_statsを配信して 50:50 で振り分ける集計(Variant B の x/y)
missedPillDaysの集合構築部分をpillTakenDateSetsとして公開し、服用記録日の集合を流用dosingPeriod)のみを対象とし、偽薬・休薬期間は記録漏れに含めない。y(記録漏れ日数)= 服用予定日 − 服用記録日、x(服用記録日数)= 服用予定日数 − y既存挙動の変更(missedPillDays)と波及
集計の流用にあたり、共有ロジック
missedPillDaysの既存バグ修正・挙動変更を行いました。この変更は利用側のホーム飲み忘れバー(
SpecialOfferingAnnouncementBar2、表示条件missedDays >= 1)にも波及します:いずれも修正後の値が本来意図された「飲み忘れ日数」であるため、この波及は許容とする(挙動変更のテスト監査とあわせて確認済み)。
表示トリガー / 頻度制御
home/page.dartの起動時 useEffect に「終了グループ(activePillSheet == nullかつdeletedAt == null)+ free(!premiumOrTrial)+ 未表示」分岐を追加(既存の月次 paywall と排他)pillSheetGroupIDを key に SharedPreferences で表示済みフラグを保持し、終了グループにつき1回だけ表示shownPaywallOnThisAppLaunchProviderを共有排他フラグとして参照・更新動作確認
iOS Simulator で初期設定 → ピルシート登録 → 服用記録の上、ダイアログを表示して確認しました。
history_blursummary_statsテスト
flutter test全件パス(1524 件)ended_pill_sheet_taken_summary_test.dartended_pill_sheet_dialog_variant_test.dartended_pill_sheet_dialog_test.dartshow_lifetime_offer_on_app_launch_test.dartmissedPillDaysの挙動変更を直接検証するユニットテスト:pill_sheet_modified_history_test.dartの#missedPillDays(取り消してそのまま / 同日再記録 / まとめて取り消し / 全件取り消し / null グループの取り消しは無視 / 最古履歴が深夜時刻付き / 時刻付き最古履歴+服用お休み継続中 / 同日複数履歴の正規化 / まとめ記録 / 初回まとめ記録)残作業(本PR対象外)
paywall_source_conversion.sqlのknown_sourcesに新2値追加、paywall_source_ended_dialog_ab.sql(A/B集計)を追加(イベント着弾後)endedPillSheetDialogVariantを 50:50 配信)Links
Checked
Summary by CodeRabbit