Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove/kind/pill sheet appearance old sequential #1309

Merged
merged 23 commits into from
Feb 11, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import 'package:flutter/material.dart';
import 'package:pilll/entity/pill_sheet_group.codegen.dart';
import 'package:pilll/utils/analytics.dart';
import 'package:pilll/components/atoms/color.dart';
import 'package:pilll/components/organisms/pill_mark/pill_mark.dart';
Expand All @@ -7,7 +8,6 @@ import 'package:pilll/components/organisms/pill_mark/pill_mark_with_number_layou
import 'package:pilll/components/organisms/pill_sheet/pill_sheet_view_layout.dart';
import 'package:pilll/entity/pill_mark_type.dart';
import 'package:pilll/entity/pill_sheet_type.dart';
import 'package:pilll/entity/setting.codegen.dart';
import 'package:pilll/entity/weekday.dart';

class SettingPillSheetView extends StatelessWidget {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import 'package:hooks_riverpod/hooks_riverpod.dart';
import 'package:pilll/components/molecules/dots_page_indicator.dart';
import 'package:pilll/components/organisms/pill_sheet/pill_sheet_view_layout.dart';
import 'package:pilll/components/organisms/pill_sheet/setting_pill_sheet_view.dart';
import 'package:pilll/entity/pill_sheet_group.codegen.dart';
import 'package:pilll/entity/pill_sheet_type.dart';
import 'package:pilll/entity/setting.codegen.dart';

class SettingMenstruationPillSheetList extends HookConsumerWidget {
final List<PillSheetType> pillSheetTypes;
Expand Down
54 changes: 30 additions & 24 deletions lib/entity/pill_sheet_group.codegen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ class PillSheetGroup with _$PillSheetGroup {
case PillSheetAppearanceMode.date:
return 0;
case PillSheetAppearanceMode.sequential:
return pillNumbersForSequential.firstWhereOrNull((element) => isSameDay(element.date, today()))?.number ?? 0;
return pillNumbersForCyclicSequential.firstWhereOrNull((element) => isSameDay(element.date, today()))?.number ?? 0;
case PillSheetAppearanceMode.cyclicSequential:
return pillNumbersForCyclicSequential.firstWhereOrNull((element) => isSameDay(element.date, today()))?.number ?? 0;
}
Expand All @@ -94,7 +94,7 @@ class PillSheetGroup with _$PillSheetGroup {
case PillSheetAppearanceMode.date:
return 0;
case PillSheetAppearanceMode.sequential:
return pillNumbersForSequential.firstWhereOrNull((element) => isSameDay(element.date, activePillSheetLastTakenDate))?.number ?? 0;
return pillNumbersForCyclicSequential.firstWhereOrNull((element) => isSameDay(element.date, activePillSheetLastTakenDate))?.number ?? 0;
case PillSheetAppearanceMode.cyclicSequential:
return pillNumbersForCyclicSequential.firstWhereOrNull((element) => isSameDay(element.date, activePillSheetLastTakenDate))?.number ?? 0;
}
Expand All @@ -106,7 +106,7 @@ class PillSheetGroup with _$PillSheetGroup {
case PillSheetAppearanceMode.date:
return 0;
case PillSheetAppearanceMode.sequential:
return pillNumbersForSequential.last.number;
return pillNumbersForCyclicSequential.last.number;
case PillSheetAppearanceMode.cyclicSequential:
return pillNumbersForCyclicSequential.last.number;
}
Expand All @@ -132,7 +132,6 @@ class PillSheetGroup with _$PillSheetGroup {
case PillSheetAppearanceMode.date:
return _pillNumberInPillSheet(pillNumberInPillSheet: lastTakenPillNumber);
case PillSheetAppearanceMode.sequential:
return _sequentialPillSheetNumber(pageIndex: pillSheet.groupIndex, pillNumberInPillSheet: lastTakenPillNumber);
case PillSheetAppearanceMode.cyclicSequential:
return _cycleSequentialPillSheetNumber(pageIndex: pillSheet.groupIndex, pillNumberInPillSheet: lastTakenPillNumber);
}
Expand All @@ -151,7 +150,6 @@ class PillSheetGroup with _$PillSheetGroup {
}

late final List<PillSheetGroupPillNumberDomainPillMarkValue> pillNumbersInPillSheet = _pillNumbersInPillSheet();
late final List<PillSheetGroupPillNumberDomainPillMarkValue> pillNumbersForSequential = _pillNumbersForSequential();
late final List<PillSheetGroupPillNumberDomainPillMarkValue> pillNumbersForCyclicSequential = _pillNumbersForCyclicSequential();
}

Expand All @@ -174,7 +172,6 @@ extension PillSheetGroupDisplayDomain on PillSheetGroup {
case PillSheetAppearanceMode.date:
return _pillNumberInPillSheet(pillNumberInPillSheet: pillNumberInPillSheet);
case PillSheetAppearanceMode.sequential:
return _sequentialPillSheetNumber(pageIndex: pageIndex, pillNumberInPillSheet: pillNumberInPillSheet);
case PillSheetAppearanceMode.cyclicSequential:
return _cycleSequentialPillSheetNumber(pageIndex: pageIndex, pillNumberInPillSheet: pillNumberInPillSheet);
}
Expand All @@ -191,7 +188,6 @@ extension PillSheetGroupDisplayDomain on PillSheetGroup {
case PillSheetAppearanceMode.date:
return pillNumbersInPillSheet.firstWhere((e) => isSameDay(e.date, date)).number;
case PillSheetAppearanceMode.sequential:
return pillNumbersForSequential.firstWhere((e) => isSameDay(e.date, date)).number;
case PillSheetAppearanceMode.cyclicSequential:
return pillNumbersForCyclicSequential.firstWhere((e) => isSameDay(e.date, date)).number;
}
Expand Down Expand Up @@ -219,7 +215,7 @@ extension PillSheetGroupDisplayDomain on PillSheetGroup {
PillSheetAppearanceMode.date => premiumOrTrial
? _displayPillSheetDate(pageIndex: pageIndex, pillNumberInPillSheet: pillNumberInPillSheet)
: _pillNumberInPillSheet(pillNumberInPillSheet: pillNumberInPillSheet),
PillSheetAppearanceMode.sequential => _sequentialPillSheetNumber(pageIndex: pageIndex, pillNumberInPillSheet: pillNumberInPillSheet),
PillSheetAppearanceMode.sequential => _cycleSequentialPillSheetNumber(pageIndex: pageIndex, pillNumberInPillSheet: pillNumberInPillSheet),
PillSheetAppearanceMode.cyclicSequential => _cycleSequentialPillSheetNumber(pageIndex: pageIndex, pillNumberInPillSheet: pillNumberInPillSheet),
};
return pillNumber.toString();
Expand All @@ -246,21 +242,6 @@ extension PillSheetGroupDisplayDomain on PillSheetGroup {
return DateTimeFormatter.monthAndDay(pillSheets[pageIndex].displayPillTakeDate(pillNumberInPillSheet));
}

@visibleForTesting
int sequentialPillSheetNumber({
required int pageIndex,
required int pillNumberInPillSheet,
}) {
return _sequentialPillSheetNumber(pageIndex: pageIndex, pillNumberInPillSheet: pillNumberInPillSheet);
}

int _sequentialPillSheetNumber({
required int pageIndex,
required int pillNumberInPillSheet,
}) {
return pillNumbersForSequential.where((e) => e.pillSheet.groupIndex == pageIndex).toList()[pillNumberInPillSheet - 1].number;
}

@visibleForTesting
int cycleSequentialPillSheetNumber({
required int pageIndex,
Expand Down Expand Up @@ -301,7 +282,6 @@ extension PillSheetGroupPillNumberDomain on PillSheetGroup {
case PillSheetAppearanceMode.date:
return pillNumbersInPillSheet;
case PillSheetAppearanceMode.sequential:
return pillNumbersForSequential;
case PillSheetAppearanceMode.cyclicSequential:
return pillNumbersForCyclicSequential;
}
Expand Down Expand Up @@ -532,3 +512,29 @@ class PillSheetGroupDisplayNumberSetting with _$PillSheetGroupDisplayNumberSetti

factory PillSheetGroupDisplayNumberSetting.fromJson(Map<String, dynamic> json) => _$PillSheetGroupDisplayNumberSettingFromJson(json);
}

@JsonEnum(valueField: 'value')
enum PillSheetAppearanceMode {
@JsonValue('number')
number,
@JsonValue('date')
date,
// 古い値。cyclicSequentialに変更した。一時的に両立されていた
@JsonValue('sequential')
sequential,
@JsonValue('cyclicSequential')
cyclicSequential,
}

extension PillSheetAppearanceModeExt on PillSheetAppearanceMode {
bool get isSequential {
switch (this) {
case PillSheetAppearanceMode.number:
case PillSheetAppearanceMode.date:
return false;
case PillSheetAppearanceMode.sequential:
case PillSheetAppearanceMode.cyclicSequential:
return true;
}
}
}
25 changes: 1 addition & 24 deletions lib/entity/setting.codegen.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import 'package:pilll/entity/pill_sheet_group.codegen.dart';
import 'package:pilll/entity/pill_sheet_type.dart';
import 'package:flutter/foundation.dart';
import 'package:freezed_annotation/freezed_annotation.dart';
Expand Down Expand Up @@ -26,30 +27,6 @@ class ReminderTime with _$ReminderTime {
static const int minimumCount = 1;
}

enum PillSheetAppearanceMode {
@JsonValue('number')
number,
@JsonValue('date')
date,
@JsonValue('sequential')
sequential,
@JsonValue('cyclicSequential')
cyclicSequential,
}

extension PillSheetAppearanceModeExt on PillSheetAppearanceMode {
bool get isSequential {
switch (this) {
case PillSheetAppearanceMode.number:
case PillSheetAppearanceMode.date:
return false;
case PillSheetAppearanceMode.sequential:
case PillSheetAppearanceMode.cyclicSequential:
return true;
}
}
}

class SettingFirestoreFieldKeys {
static const pillSheetAppearanceMode = 'pillSheetAppearanceMode';
static const timezoneDatabaseName = 'timezoneDatabaseName';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import 'dart:math';
import 'package:flutter_native_timezone/flutter_native_timezone.dart';
import 'package:pilll/entity/firestore_id_generator.dart';
import 'package:pilll/entity/link_account_type.dart';
import 'package:pilll/entity/pill_sheet_group.codegen.dart';
import 'package:pilll/utils/datetime/date_add.dart';
import 'package:pilll/utils/datetime/day.dart';
import 'package:freezed_annotation/freezed_annotation.dart';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import 'package:flutter/material.dart';
import 'package:flutter_hooks/flutter_hooks.dart';
import 'package:hooks_riverpod/hooks_riverpod.dart';
import 'package:pilll/entity/pill_sheet_group.codegen.dart';
import 'package:pilll/utils/analytics.dart';
import 'package:pilll/components/molecules/dots_page_indicator.dart';
import 'package:pilll/components/organisms/pill_sheet/pill_sheet_view_layout.dart';
import 'package:pilll/components/organisms/pill_sheet/setting_pill_sheet_view.dart';
import 'package:pilll/features/initial_setting/initial_setting_state.codegen.dart';
import 'package:pilll/features/initial_setting/initial_setting_state_notifier.dart';
import 'package:pilll/entity/pill_sheet_type.dart';
import 'package:pilll/entity/setting.codegen.dart';

class SelectTodayPillNumberPillSheetList extends HookConsumerWidget {
final InitialSettingState state;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import 'package:pilll/components/atoms/color.dart';
import 'package:pilll/components/atoms/font.dart';
import 'package:pilll/components/atoms/text_color.dart';
import 'package:pilll/entity/pill_sheet_group.codegen.dart';
import 'package:pilll/entity/setting.codegen.dart';
import 'package:pilll/utils/formatter/text_input_formatter.dart';

class DisplayNumberSetting extends HookConsumerWidget {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import 'package:pilll/components/atoms/text_color.dart';
import 'package:pilll/entity/pill_sheet_group.codegen.dart';
import 'package:pilll/entity/pill_sheet_type.dart';
import 'package:flutter/material.dart';
import 'package:pilll/entity/setting.codegen.dart';

class TodayTakenPillNumber extends StatelessWidget {
final PillSheetGroup? pillSheetGroup;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import 'package:pilll/components/atoms/button.dart';
import 'package:pilll/components/atoms/font.dart';
import 'package:pilll/components/atoms/text_color.dart';
import 'package:pilll/entity/pill_sheet_group.codegen.dart';
import 'package:pilll/entity/setting.codegen.dart';
import 'package:pilll/features/localizations/l.dart';
import 'package:pilll/utils/formatter/date_time_formatter.dart';

Expand Down Expand Up @@ -121,7 +120,6 @@ class RecordPageRestDurationDialogTitle extends StatelessWidget {
final dateString = DateTimeFormatter.monthAndDay(date);
return dateString;
case PillSheetAppearanceMode.sequential:
return L.withNumber((pillSheetGroup.sequentialLastTakenPillNumber + 1).toString());
case PillSheetAppearanceMode.cyclicSequential:
return L.withNumber((pillSheetGroup.sequentialLastTakenPillNumber + 1).toString());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,18 +74,6 @@ class SelectAppearanceModeModal extends HookConsumerWidget {
text: L.pillNumber,
isPremiumFunction: false,
),
_row(
context,
setting: setting,
pillSheetGroup: pillSheetGroup,
setSetting: setSetting,
setPillSheetGroup: setPillSheetGroup,
registerReminderLocalNotification: registerReminderLocalNotification,
user: user,
mode: PillSheetAppearanceMode.sequential,
text: L.pillDays,
isPremiumFunction: false,
),
_row(
context,
setting: setting,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import 'package:hooks_riverpod/hooks_riverpod.dart';
import 'package:flutter/material.dart';
import 'package:pilll/entity/pill_sheet.codegen.dart';
import 'package:pilll/entity/pill_sheet_group.codegen.dart';
import 'package:pilll/entity/setting.codegen.dart';
import 'package:pilll/features/localizations/l.dart';
import 'package:pilll/features/record/components/pill_sheet/components/record_page_rest_duration_dialog.dart';
import 'package:pilll/features/record/components/setting/components/rest_duration/invalid_already_taken_pill_dialog.dart';
Expand Down
26 changes: 16 additions & 10 deletions lib/features/release_note/release_note.dart
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,12 @@ class ReleaseNote extends StatelessWidget {
alignment: Alignment.center,
child: Container(
padding: const EdgeInsets.only(top: 40, left: 40, right: 40),
child: Text(
L.addedDisplayModePillDaysCycle,
style: const TextStyle(
child: const Text(
'',
// (周期)を消すことになったので無効化。リリースノート自体も無効化する
// "addedDisplayModePillDaysCycle": "表示モード服用日数(周期)が追加されました",
// L.addedDisplayModePillDaysCycle,
style: TextStyle(
fontFamily: FontFamily.japanese,
fontWeight: FontWeight.w600,
fontSize: 16,
Expand Down Expand Up @@ -102,15 +105,18 @@ void showReleaseNotePreDialog(BuildContext context) async {
if (storage.getBool(key) ?? false) {
return;
}

await storage.setBool(key, true);
// NOTE: (周期)のリリース後に、(周期)を消すことにした。リリースノートに現在記載されている。そのため一旦リリースノート自体を無効
return;

if (context.mounted) {
showDialog(
context: context,
builder: (context) {
return const ReleaseNote();
});
}
// if (context.mounted) {
// showDialog(
// context: context,
// builder: (context) {
// return const ReleaseNote();
// });
// }
}

void openReleaseNote() async {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import 'package:flutter/material.dart';
import 'package:hooks_riverpod/hooks_riverpod.dart';
import 'package:pilll/entity/pill_sheet_group.codegen.dart';
import 'package:pilll/features/localizations/l.dart';
import 'package:pilll/utils/analytics.dart';
import 'package:pilll/components/template/setting_menstruation/setting_menstruation_dynamic_description.dart';
import 'package:pilll/components/template/setting_menstruation/setting_menstruation_page_template.dart';
import 'package:pilll/components/template/setting_menstruation/setting_menstruation_pill_sheet_list.dart';
import 'package:pilll/entity/pill_sheet_type.dart';
import 'package:pilll/entity/setting.codegen.dart';
import 'package:pilll/provider/setting.dart';

class SettingMenstruationPage extends HookConsumerWidget {
Expand All @@ -21,7 +21,7 @@ class SettingMenstruationPage extends HookConsumerWidget {
title: L.aboutMenstruation,
pillSheetList: SettingMenstruationPillSheetList(
pillSheetTypes: setting.pillSheetEnumTypes,
appearanceMode: PillSheetAppearanceMode.sequential,
appearanceMode: PillSheetAppearanceMode.cyclicSequential,
selectedPillNumber: (pageIndex) {
final passedTotalCount = summarizedPillCountWithPillSheetTypesToIndex(pillSheetTypes: setting.pillSheetEnumTypes, toIndex: pageIndex);
if (passedTotalCount >= setting.pillNumberForFromMenstruation) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import 'package:flutter/material.dart';
import 'package:flutter_hooks/flutter_hooks.dart';
import 'package:hooks_riverpod/hooks_riverpod.dart';
import 'package:pilll/entity/pill_sheet_group.codegen.dart';
import 'package:pilll/utils/analytics.dart';
import 'package:pilll/components/molecules/dots_page_indicator.dart';
import 'package:pilll/components/organisms/pill_sheet/pill_sheet_view_layout.dart';
import 'package:pilll/components/organisms/pill_sheet/setting_pill_sheet_view.dart';
import 'package:pilll/entity/pill_sheet_type.dart';
import 'package:pilll/entity/setting.codegen.dart';

class SettingTodayPillNumberPillSheetList extends HookConsumerWidget {
final List<PillSheetType> pillSheetTypes;
Expand Down
2 changes: 1 addition & 1 deletion lib/l10n/app_af.arb
Original file line number Diff line number Diff line change
Expand Up @@ -1866,7 +1866,7 @@
"@purchaseErrorPurchasePendingError": {
"description": "課金の有効化が完了しておりません。しばらく時間をおいてからご確認ください"
},
"launchError": "`'n` 'Ongesteldheid: 'n fout het voorgekom tydens opstart.",
"launchError": "`'n` '{ErrorMessagesConnection}: 'n fout het voorgekom tydens opstart.",
"@launchError": {
"description": "起動時にエラーが発生しました\n{ErrorMessagesConnection}\n詳細:",
"placeholders": {
Expand Down
12 changes: 2 additions & 10 deletions lib/l10n/app_ja.arb
Original file line number Diff line number Diff line change
Expand Up @@ -641,13 +641,9 @@
"@pillNumber": {
"description": "ピル番号"
},
"pillDays": "服用日数",
"@pillDays": {
"description": "服用日数"
},
"pillDaysCycle": "服用日数(周期)",
"pillDaysCycle": "服用日数",
"@pillDaysCycle": {
"description": "服用日数(周期)"
"description": "服用日数"
},
"pillSheetEnded": "ピルシートが終了しました",
"@pillSheetEnded": {
Expand Down Expand Up @@ -1015,10 +1011,6 @@
"@viewPremiumFeatures": {
"description": "プレミアム機能を見る"
},
"addedDisplayModePillDaysCycle": "表示モード服用日数(周期)が追加されました",
"@addedDisplayModePillDaysCycle": {
"description": "表示モード服用日数(周期)が追加されました"
},
"seeDetails": "詳細を見る",
"@seeDetails": {
"description": "詳細を見る"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import 'package:pilll/components/organisms/pill_mark/pill_marks.dart';
import 'package:pilll/components/organisms/pill_sheet/setting_pill_sheet_view.dart';
import 'package:pilll/entity/pill_sheet_group.codegen.dart';
import 'package:pilll/entity/pill_sheet_type.dart';
import 'package:pilll/entity/setting.codegen.dart';
import 'package:pilll/utils/environment.dart';
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
Expand Down
Loading