-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
(#42) Code refactoring after initial release
- (#47) solved this issue too
- Loading branch information
Showing
19 changed files
with
476 additions
and
370 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,30 @@ | ||
|
||
import 'package:todo_app/data/AppDatabase.dart'; | ||
import 'package:todo_app/data/datasource/CategoryDataSource.dart'; | ||
import 'package:todo_app/domain/entity/Category.dart'; | ||
import 'package:todo_app/domain/repository/CategoryRepository.dart'; | ||
|
||
class CategoryRepositoryImpl implements CategoryRepository { | ||
final AppDatabase _db; | ||
final CategoryDataSource _dataSource; | ||
|
||
const CategoryRepositoryImpl(this._db); | ||
const CategoryRepositoryImpl(this._dataSource); | ||
|
||
@override | ||
Future<Category> getCategory(int id) async { | ||
return _db.getCategory(id); | ||
return _dataSource.getCategory(id); | ||
} | ||
|
||
@override | ||
Future<int> setCategory(Category category) async { | ||
return _db.setCategory(category); | ||
return _dataSource.setCategory(category); | ||
} | ||
|
||
@override | ||
Future<List<Category>> getAllCategories() async { | ||
return _db.getAllCategories(); | ||
return _dataSource.getAllCategories(); | ||
} | ||
|
||
@override | ||
Future<void> removeCategory(Category category) async { | ||
return _db.removeCategory(category); | ||
return _dataSource.removeCategory(category); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,31 @@ | ||
|
||
import 'package:todo_app/data/AppDatabase.dart'; | ||
import 'package:todo_app/data/datasource/LockDataSource.dart'; | ||
import 'package:todo_app/domain/entity/DateInWeek.dart'; | ||
import 'package:todo_app/domain/repository/LockRepository.dart'; | ||
|
||
class LockRepositoryImpl implements LockRepository { | ||
final AppDatabase _db; | ||
final LockDataSource _dataSource; | ||
|
||
const LockRepositoryImpl(this._db); | ||
const LockRepositoryImpl(this._dataSource); | ||
|
||
@override | ||
Future<bool> getIsCheckPointsLocked(DateTime date, bool defaultValue) async { | ||
return await _db.getIsCheckPointsLocked(date, defaultValue); | ||
return await _dataSource.getIsCheckPointsLocked(date, defaultValue); | ||
} | ||
|
||
@override | ||
Future<bool> getIsDayRecordLocked(DateTime date, bool defaultValue) async { | ||
return await _db.getIsDayRecordLocked(date, defaultValue); | ||
return await _dataSource.getIsDayRecordLocked(date, defaultValue); | ||
} | ||
|
||
@override | ||
void setIsCheckPointsLocked(DateInWeek dateInWeek, bool value) { | ||
_db.setIsCheckPointsLocked(dateInWeek, value); | ||
_dataSource.setIsCheckPointsLocked(dateInWeek, value); | ||
} | ||
|
||
@override | ||
void setIsDayRecordLocked(DateTime date, bool value) { | ||
_db.setIsDayRecordLocked(date, value); | ||
_dataSource.setIsDayRecordLocked(date, value); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,32 @@ | ||
|
||
import 'package:todo_app/data/AppDatabase.dart'; | ||
import 'package:todo_app/data/datasource/MemoDataSource.dart'; | ||
import 'package:todo_app/domain/entity/CheckPoint.dart'; | ||
import 'package:todo_app/domain/entity/DayMemo.dart'; | ||
import 'package:todo_app/domain/repository/MemoRepository.dart'; | ||
|
||
class MemoRepositoryImpl implements MemoRepository { | ||
final AppDatabase _db; | ||
final MemoDataSource _dataSource; | ||
|
||
const MemoRepositoryImpl(this._db); | ||
const MemoRepositoryImpl(this._dataSource); | ||
|
||
@override | ||
Future<List<CheckPoint>> getCheckPoints(DateTime date) async { | ||
return await _db.getCheckPoints(date); | ||
return await _dataSource.getCheckPoints(date); | ||
} | ||
|
||
@override | ||
Future<DayMemo> getDayMemo(DateTime date) async { | ||
return await _db.getDayMemo(date); | ||
return await _dataSource.getDayMemo(date); | ||
} | ||
|
||
@override | ||
void setDayMemo(DayMemo dayMemo) { | ||
_db.setDayMemo(dayMemo); | ||
_dataSource.setDayMemo(dayMemo); | ||
} | ||
|
||
@override | ||
void setCheckPoint(CheckPoint checkPoint) { | ||
_db.setCheckPoint(checkPoint); | ||
_dataSource.setCheckPoint(checkPoint); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,26 @@ | ||
|
||
import 'package:todo_app/data/AppDatabase.dart'; | ||
import 'package:todo_app/data/datasource/ToDoDataSource.dart'; | ||
import 'package:todo_app/domain/entity/ToDo.dart'; | ||
import 'package:todo_app/domain/repository/ToDoRepository.dart'; | ||
|
||
class TodoRepositoryImpl implements ToDoRepository { | ||
final AppDatabase _db; | ||
class ToDoRepositoryImpl implements ToDoRepository { | ||
final ToDoDataSource _dataSource; | ||
|
||
const TodoRepositoryImpl(this._db); | ||
const ToDoRepositoryImpl(this._dataSource); | ||
|
||
@override | ||
Future<List<ToDo>> getToDos(DateTime date) async { | ||
return await _db.getToDos(date); | ||
return await _dataSource.getToDos(date); | ||
} | ||
|
||
@override | ||
void setToDo(ToDo toDo) { | ||
_db.setToDo(toDo); | ||
_dataSource.setToDo(toDo); | ||
} | ||
|
||
@override | ||
void removeToDo(ToDo toDo) { | ||
_db.removeToDo(toDo); | ||
_dataSource.removeToDo(toDo); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
|
||
import 'package:todo_app/domain/entity/Category.dart'; | ||
|
||
abstract class CategoryDataSource { | ||
Future<Category> getCategory(int id); | ||
Future<List<Category>> getAllCategories(); | ||
Future<int> setCategory(Category category); | ||
Future<void> removeCategory(Category category); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
|
||
import 'package:todo_app/domain/entity/DateInWeek.dart'; | ||
|
||
abstract class LockDataSource { | ||
Future<bool> getIsCheckPointsLocked(DateTime date, bool defaultValue); | ||
void setIsCheckPointsLocked(DateInWeek dateInWeek, bool value); | ||
Future<bool> getIsDayRecordLocked(DateTime date, bool defaultValue); | ||
void setIsDayRecordLocked(DateTime date, bool value); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
|
||
import 'package:todo_app/domain/entity/CheckPoint.dart'; | ||
import 'package:todo_app/domain/entity/DayMemo.dart'; | ||
|
||
abstract class MemoDataSource { | ||
Future<List<CheckPoint>> getCheckPoints(DateTime date); | ||
void setCheckPoint(CheckPoint checkPoint); | ||
Future<DayMemo> getDayMemo(DateTime date); | ||
void setDayMemo(DayMemo dayMemo); | ||
} |
Oops, something went wrong.