Skip to content

Commit

Permalink
fixup! fixup! fixup! fixup! wip drop: Mem v1 wip drop: EntityV1
Browse files Browse the repository at this point in the history
  • Loading branch information
zin- committed Sep 17, 2024
1 parent 880ea9a commit 2fb938a
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 12 deletions.
2 changes: 0 additions & 2 deletions lib/core/mem.dart
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,6 @@ class MemV1 extends EntityV1 {

bool get isDone => doneAt != null;

factory MemV1.defaultNew() => MemV1("", null, null);

Iterable<Schedule> periodSchedules(
TimeOfDay startOfDay,
) =>
Expand Down
7 changes: 1 addition & 6 deletions lib/mems/detail/states.dart
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
import 'package:collection/collection.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:mem/core/mem.dart';
import 'package:mem/core/mem_item.dart';
import 'package:mem/core/mem_notification.dart';
import 'package:mem/components/list_value_state_notifier.dart';
import 'package:mem/logger/log_service.dart';
import 'package:mem/components/value_state_notifier.dart';
import 'package:mem/mems/mem_item_repository.dart';
import 'package:mem/mems/states.dart';
import 'package:mem/repositories/mem.dart';
import 'package:mem/repositories/mem_entity.dart';
import 'package:mem/repositories/mem_item_entity.dart';
import 'package:mem/repositories/mem_notification_entity.dart';
Expand All @@ -20,10 +18,7 @@ final editingMemByMemIdProvider = StateNotifierProvider.autoDispose
() {
final mem = ref.watch(memByMemIdProvider(memId));
return ValueStateNotifier(
mem is SavedMemV1
? SavedMemEntity.fromV1(mem)
: MemEntity.fromV1(
ref.watch(memByMemIdProvider(memId)) ?? MemV1.defaultNew()),
mem == null ? MemEntity("", null, null) : SavedMemEntity.fromV1(mem),
);
},
{"memId": memId},
Expand Down
8 changes: 4 additions & 4 deletions lib/repositories/mem_entity.dart
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,12 @@ class MemEntity extends Mem with Entity, Copyable<MemEntity> {
period == null ? this.period : period(),
);

MemEntity.fromV1(MemV1 savedMem)
MemEntity.fromV1(MemV1 v1)
: this.fromMap(
MemEntity(
savedMem.name,
savedMem.doneAt,
savedMem.period,
v1.name,
v1.doneAt,
v1.period,
).toMap,
);

Expand Down

0 comments on commit 2fb938a

Please sign in to comment.