Fix various bugs and shit

This commit is contained in:
2025-05-24 01:07:08 +02:00
parent 3c1f31d29b
commit 6eb55c5d50
2 changed files with 6 additions and 10 deletions

View File

@@ -614,17 +614,13 @@ class MainPageState extends State<MainPage> with WindowListener {
Duration newInterval = Duration(minutes: newIntervalMinutes); Duration newInterval = Duration(minutes: newIntervalMinutes);
if (newInterval != _currentPopupInterval) { if (newInterval != _currentPopupInterval) {
_currentPopupInterval = newInterval; _currentPopupInterval = newInterval;
DB.setSetting('popupIntervalMinutes', newIntervalMinutes.toString()); await setPopupInterval(newInterval);
_startPopupTimer(); _startPopupTimer();
} else {
DB.setSetting('popupIntervalMinutes', newIntervalMinutes.toString());
} }
if (soundStr != _currentNotificationSound) { if (soundStr != _currentNotificationSound) {
_currentNotificationSound = soundStr; _currentNotificationSound = soundStr;
DB.setSetting('notificationSound', soundStr); await setNotificationSound(soundStr);
} else {
DB.setSetting('notificationSound', soundStr);
} }
// Also save volume // Also save volume

View File

@@ -171,7 +171,7 @@ Future<void> setSetting(String key, String value) async {
headers: header, headers: header,
body: jsonEncode(document), body: jsonEncode(document),
); );
if (response.statusCode != 200) { if (response.statusCode != 202) {
throw Exception('Failed to set settings'); throw Exception('Failed to set settings');
} }
} }
@@ -181,7 +181,7 @@ Future<void> setSetting(String key, String value) async {
Future<List<Note>> searchNotes(String query) async { Future<List<Note>> searchNotes(String query) async {
final searchCondition = MeilisearchQuery( final searchCondition = MeilisearchQuery(
q: query, q: query,
limit: 1000, limit: 10,
attributesToHighlight: ['content'], attributesToHighlight: ['content'],
showRankingScore: true, showRankingScore: true,
highlightPreTag: '<b>', highlightPreTag: '<b>',
@@ -201,7 +201,7 @@ Future<List<Note>> searchNotes(String query) async {
(hit) => Note( (hit) => Note(
id: hit['id'] as String, id: hit['id'] as String,
epochTime: hit['date'] as int, epochTime: hit['date'] as int,
content: hit['content'] as String, content: hit['_formatted']['content'] as String,
), ),
) )
.toList(); .toList();
@@ -336,7 +336,7 @@ Future<Note> createNote(String content) async {
headers: header, headers: header,
body: jsonEncode(document), body: jsonEncode(document),
); );
if (response.statusCode != 200) { if (response.statusCode != 202) {
throw Exception('Failed to create note'); throw Exception('Failed to create note');
} }
return Note( return Note(