Skip to content

Commit

Permalink
Fix notebook
Browse files Browse the repository at this point in the history
  • Loading branch information
CodeDoctorDE committed May 27, 2024
1 parent f2db80b commit da6e0f3
Show file tree
Hide file tree
Showing 8 changed files with 50 additions and 34 deletions.
2 changes: 1 addition & 1 deletion FLUTTER_VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.22.0
3.22.1
12 changes: 12 additions & 0 deletions api/lib/models/note/label.dart
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ abstract class LabelNoteConnector extends NoteConnector<Label> {
int offset = 0,
int limit = 50,
Multihash? parent,
Multihash? notebook,
Set<NoteStatus?> statuses = const {
NoteStatus.todo,
NoteStatus.inProgress,
Expand Down Expand Up @@ -44,6 +45,7 @@ class LabelNoteDatabaseConnector extends NoteDatabaseConnector<Label>
int offset = 0,
int limit = 50,
Multihash? parent,
Multihash? notebook,
Set<NoteStatus?> statuses = const {
NoteStatus.todo,
NoteStatus.inProgress,
Expand All @@ -67,6 +69,16 @@ class LabelNoteDatabaseConnector extends NoteDatabaseConnector<Label>
where == null ? 'parentId IS NULL' : '$where AND parentId IS NULL';
}
}
if (notebook != null) {
if (notebook.fullBytes.isNotEmpty) {
where = where == null ? 'notebookId = ?' : '$where AND notebookId = ?';
whereArgs.add(notebook.fullBytes);
} else {
where = where == null
? 'notebookId IS NULL'
: '$where AND notebookId IS NULL';
}
}
var statusStatement =
"status IN (${statuses.whereNotNull().map((e) => "'${e.name}'").join(',')})";
if (statuses.contains(null)) {
Expand Down
14 changes: 7 additions & 7 deletions app/android/Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,17 @@ GEM
artifactory (3.0.17)
atomos (0.1.3)
aws-eventstream (1.3.0)
aws-partitions (1.919.0)
aws-sdk-core (3.192.1)
aws-partitions (1.934.0)
aws-sdk-core (3.196.1)
aws-eventstream (~> 1, >= 1.3.0)
aws-partitions (~> 1, >= 1.651.0)
aws-sigv4 (~> 1.8)
jmespath (~> 1, >= 1.6.1)
aws-sdk-kms (1.79.0)
aws-sdk-core (~> 3, >= 3.191.0)
aws-sdk-kms (1.82.0)
aws-sdk-core (~> 3, >= 3.193.0)
aws-sigv4 (~> 1.1)
aws-sdk-s3 (1.147.0)
aws-sdk-core (~> 3, >= 3.192.0)
aws-sdk-s3 (1.151.0)
aws-sdk-core (~> 3, >= 3.194.0)
aws-sdk-kms (~> 1)
aws-sigv4 (~> 1.8)
aws-sigv4 (1.8.0)
Expand Down Expand Up @@ -157,7 +157,7 @@ GEM
mini_magick (4.12.0)
mini_mime (1.1.5)
multi_json (1.15.0)
multipart-post (2.4.0)
multipart-post (2.4.1)
nanaimo (0.3.0)
naturally (2.2.1)
nkf (0.2.0)
Expand Down
9 changes: 4 additions & 5 deletions app/lib/pages/calendar/list.dart
Original file line number Diff line number Diff line change
Expand Up @@ -33,18 +33,17 @@ class CalendarListView extends StatefulWidget {

class _CalendarListViewState extends State<CalendarListView> {
late FlowCubit _cubit;
final PagingController<
late final PagingController<
ConnectedModel<int, ConnectedModel<Map<String, int>, Map<String, int>>>,
List<
SourcedConnectedModel<CalendarItem,
Event?>>> _controller = PagingController(
firstPageKey: const ConnectedModel(-1, ConnectedModel({}, {})));
List<SourcedConnectedModel<CalendarItem, Event?>>> _controller;
static const _pageSize = 50;

@override
void initState() {
super.initState();
_cubit = context.read<FlowCubit>();
_controller = PagingController(
firstPageKey: const ConnectedModel(-1, ConnectedModel({}, {})));
_controller.addPageRequestListener(_requestPage);
}

Expand Down
12 changes: 9 additions & 3 deletions app/lib/pages/notes/page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ class _NotesBodyViewState extends State<NotesBodyView> {
_filter.selectedLabel!,
offset: offset,
limit: limit,
notebook: _filter.notebook,
statuses: _filter.statuses,
parent: widget.parent?.source == source
? widget.parent?.model
Expand All @@ -123,6 +124,7 @@ class _NotesBodyViewState extends State<NotesBodyView> {
: await service.note?.getNotes(
offset: offset,
limit: limit,
notebook: _filter.notebook,
statuses: _filter.statuses,
parent: widget.parent?.source == source
? widget.parent?.model
Expand Down Expand Up @@ -176,9 +178,12 @@ class _NotesBodyViewState extends State<NotesBodyView> {
filter: _filter,
controller: _controller,
isSearching: widget.search.isNotEmpty,
onFilterChanged: (value) => setState(() {
_filter = value;
}),
onFilterChanged: (value) {
setState(() {
_filter = value;
_controller.refresh();
});
},
),
actions: [
IconButton(
Expand Down Expand Up @@ -236,6 +241,7 @@ class _NotesBodyViewState extends State<NotesBodyView> {
builder: (context) => NoteDialog(
note: Note(
parentId: widget.parent?.model,
notebookId: _filter.notebook,
),
source: widget.parent?.source,
create: true,
Expand Down
1 change: 0 additions & 1 deletion app/lib/widgets/select.dart
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@ class _SelectTileState<T extends NamedModel> extends State<SelectTile<T>> {
leading: widget.leadingBuilder(context, sourcedModel),
onTap: () async {
if (model != null) {
Navigator.of(context).pop();
final newModel = await showDialog<SourcedModel<T>>(
context: context,
builder: (context) => widget.dialogBuilder(
Expand Down
32 changes: 16 additions & 16 deletions app/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,10 @@ packages:
dependency: transitive
description:
name: archive
sha256: ecf4273855368121b1caed0d10d4513c7241dfc813f7d3c8933b36622ae9b265
sha256: "6bd38d335f0954f5fad9c79e614604fbf03a0e5b975923dd001b6ea965ef5b4b"
url: "https://pub.dev"
source: hosted
version: "3.5.1"
version: "3.6.0"
args:
dependency: "direct main"
description:
Expand Down Expand Up @@ -415,10 +415,10 @@ packages:
dependency: "direct main"
description:
name: flutter_secure_storage
sha256: "8496a89eea74e23f92581885f876455d9d460e71201405dffe5f55dfe1155864"
sha256: "165164745e6afb5c0e3e3fcc72a012fb9e58496fb26ffb92cf22e16a821e85d0"
url: "https://pub.dev"
source: hosted
version: "9.2.1"
version: "9.2.2"
flutter_secure_storage_linux:
dependency: transitive
description:
Expand All @@ -431,10 +431,10 @@ packages:
dependency: transitive
description:
name: flutter_secure_storage_macos
sha256: b768a7dab26d6186b68e2831b3104f8968154f0f4fdbf66e7c2dd7bdf299daaf
sha256: "1693ab11121a5f925bbea0be725abfcfbbcf36c1e29e571f84a0c0f436147a81"
url: "https://pub.dev"
source: hosted
version: "3.1.1"
version: "3.1.2"
flutter_secure_storage_platform_interface:
dependency: transitive
description:
Expand Down Expand Up @@ -513,10 +513,10 @@ packages:
dependency: "direct main"
description:
name: go_router
sha256: aa073287b8f43553678e6fa9e8bb9c83212ff76e09542129a8099bbc8db4df65
sha256: "6ad5662b014c06c20fa46ab78715c96b2222a7fe4f87bf77e0289592c2539e86"
url: "https://pub.dev"
source: hosted
version: "14.1.2"
version: "14.1.3"
graphs:
dependency: transitive
description:
Expand Down Expand Up @@ -561,10 +561,10 @@ packages:
dependency: transitive
description:
name: image
sha256: "4c68bfd5ae83e700b5204c1e74451e7bf3cf750e6843c6e158289cf56bda018e"
sha256: "2237616a36c0d69aef7549ab439b833fb7f9fb9fc861af2cc9ac3eedddd69ca8"
url: "https://pub.dev"
source: hosted
version: "4.1.7"
version: "4.2.0"
infinite_scroll_pagination:
dependency: "direct main"
description:
Expand Down Expand Up @@ -689,8 +689,8 @@ packages:
dependency: "direct main"
description:
path: "packages/material_leap"
ref: ff93bce26d1f8d5160cbfe66b548cf9286d0576d
resolved-ref: ff93bce26d1f8d5160cbfe66b548cf9286d0576d
ref: c10ef06d25be8374130a24408f677272d0dd9747
resolved-ref: c10ef06d25be8374130a24408f677272d0dd9747
url: "https://github.com/LinwoodDev/dart_pkgs"
source: git
version: "0.0.1"
Expand Down Expand Up @@ -1063,10 +1063,10 @@ packages:
dependency: "direct main"
description:
name: sqlite3_flutter_libs
sha256: fb2a106a2ea6042fe57de2c47074cc31539a941819c91e105b864744605da3f5
sha256: "1e62698dc1ab396152ccaf3b3990d826244e9f3c8c39b51805f209adcd6dbea3"
url: "https://pub.dev"
source: hosted
version: "0.5.21"
version: "0.5.22"
stack_trace:
dependency: transitive
description:
Expand Down Expand Up @@ -1167,10 +1167,10 @@ packages:
dependency: transitive
description:
name: url_launcher_android
sha256: "360a6ed2027f18b73c8d98e159dda67a61b7f2e0f6ec26e86c3ada33b0621775"
sha256: "17cd5e205ea615e2c6ea7a77323a11712dffa0720a8a90540db57a01347f9ad9"
url: "https://pub.dev"
source: hosted
version: "6.3.1"
version: "6.3.2"
url_launcher_ios:
dependency: transitive
description:
Expand Down
2 changes: 1 addition & 1 deletion app/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ dependencies:
material_leap:
git:
url: https://github.com/LinwoodDev/dart_pkgs
ref: ff93bce26d1f8d5160cbfe66b548cf9286d0576d
ref: c10ef06d25be8374130a24408f677272d0dd9747
path: packages/material_leap
phosphor_flutter: ^2.1.0
path: ^1.8.3
Expand Down

0 comments on commit da6e0f3

Please sign in to comment.