diff --git a/lib/main.dart b/lib/main.dart index dbd804e..e878060 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -614,17 +614,13 @@ class MainPageState extends State with WindowListener { Duration newInterval = Duration(minutes: newIntervalMinutes); if (newInterval != _currentPopupInterval) { _currentPopupInterval = newInterval; - DB.setSetting('popupIntervalMinutes', newIntervalMinutes.toString()); + await setPopupInterval(newInterval); _startPopupTimer(); - } else { - DB.setSetting('popupIntervalMinutes', newIntervalMinutes.toString()); } if (soundStr != _currentNotificationSound) { _currentNotificationSound = soundStr; - DB.setSetting('notificationSound', soundStr); - } else { - DB.setSetting('notificationSound', soundStr); + await setNotificationSound(soundStr); } // Also save volume diff --git a/lib/meilisearch.dart b/lib/meilisearch.dart index 43550a8..6c82eb3 100644 --- a/lib/meilisearch.dart +++ b/lib/meilisearch.dart @@ -171,7 +171,7 @@ Future setSetting(String key, String value) async { headers: header, body: jsonEncode(document), ); - if (response.statusCode != 200) { + if (response.statusCode != 202) { throw Exception('Failed to set settings'); } } @@ -181,7 +181,7 @@ Future setSetting(String key, String value) async { Future> searchNotes(String query) async { final searchCondition = MeilisearchQuery( q: query, - limit: 1000, + limit: 10, attributesToHighlight: ['content'], showRankingScore: true, highlightPreTag: '', @@ -201,7 +201,7 @@ Future> searchNotes(String query) async { (hit) => Note( id: hit['id'] as String, epochTime: hit['date'] as int, - content: hit['content'] as String, + content: hit['_formatted']['content'] as String, ), ) .toList(); @@ -336,7 +336,7 @@ Future createNote(String content) async { headers: header, body: jsonEncode(document), ); - if (response.statusCode != 200) { + if (response.statusCode != 202) { throw Exception('Failed to create note'); } return Note(