dd250788f6
The backend retired /api/briefing/* and the RSS feature entirely. This
Flutter change mirrors what landed web-side: rename the briefing surface
to journal, repoint at /api/journal/*, and drop the news/RSS UI since
its endpoints no longer exist.
New (mirrors briefing structure with adapted shapes):
- lib/data/api/journal_api.dart — getToday, getDay, getDays, triggerPrep
- lib/data/models/journal_day.dart — {day_date, conversation, messages}
- lib/providers/journal_provider.dart — async notifier, sendReply, polling,
silent refresh, regeneratePrep. Mirrors the briefing notifier 1:1
- lib/widgets/journal_prep_card.dart — adapted briefing_digest_card
- lib/screens/journal/journal_screen.dart — adapted briefing_screen,
weather card preserved (rendered from msg_metadata.sections.weather
on the daily-prep assistant message). News cards / RSS reactions /
article-discuss removed
- lib/screens/journal/journal_history_screen.dart — past days picker
pulls /api/journal/days, drills into /api/journal/day/<iso>
Wiring:
- Routes.briefing → Routes.journal (constants.dart)
- Routes.news removed
- briefingApiProvider → journalApiProvider (api_client_provider.dart)
- newsApiProvider removed
- app.dart: shell tab "Briefing" → "Journal"; News destination removed
from nav rail, bottom nav, and the More sheet
- splash_screen.dart and login_screen.dart: redirect Routes.journal
instead of Routes.briefing
- chat_api.dart: drop openArticleInChat (calls deleted /api/chat/from-article)
- settings_provider.dart: drop rssEnabled getter and rssEnabledProvider
Deleted:
- lib/screens/briefing/ (whole directory)
- lib/screens/news/ (whole directory)
- lib/data/api/briefing_api.dart, news_api.dart
- lib/data/models/briefing_conversation.dart, briefing_feed.dart, news_item.dart
- lib/providers/briefing_provider.dart, news_provider.dart
- lib/widgets/briefing_digest_card.dart, news_card.dart
- test cases for NewsItem and BriefingFeed in test/widget_test.dart
flutter analyze: 0 issues.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
56 lines
1.7 KiB
Dart
56 lines
1.7 KiB
Dart
import 'package:dio/dio.dart';
|
|
|
|
import '../models/journal_day.dart';
|
|
import 'api_client.dart';
|
|
|
|
class JournalApi {
|
|
final Dio _dio;
|
|
const JournalApi(this._dio);
|
|
|
|
/// GET /api/journal/today
|
|
/// Creates today's journal conversation + daily prep on demand if absent,
|
|
/// then returns the day payload.
|
|
Future<JournalDay> getToday() async {
|
|
try {
|
|
final response = await _dio.get('/api/journal/today');
|
|
return JournalDay.fromJson(response.data as Map<String, dynamic>);
|
|
} on DioException catch (e) {
|
|
throw dioToApp(e);
|
|
}
|
|
}
|
|
|
|
/// GET /api/journal/day/<iso_date>
|
|
Future<JournalDay> getDay(String isoDate) async {
|
|
try {
|
|
final response = await _dio.get('/api/journal/day/$isoDate');
|
|
return JournalDay.fromJson(response.data as Map<String, dynamic>);
|
|
} on DioException catch (e) {
|
|
throw dioToApp(e);
|
|
}
|
|
}
|
|
|
|
/// GET /api/journal/days — list of dates with journal content, newest first.
|
|
Future<List<String>> getDays() async {
|
|
try {
|
|
final response = await _dio.get('/api/journal/days');
|
|
final data = response.data as Map<String, dynamic>;
|
|
final list = data['days'] as List<dynamic>;
|
|
return list.map((e) => e as String).toList();
|
|
} on DioException catch (e) {
|
|
throw dioToApp(e);
|
|
}
|
|
}
|
|
|
|
/// POST /api/journal/trigger-prep — force-regenerate today's daily prep
|
|
/// (or a specific day if [isoDate] is given).
|
|
Future<void> triggerPrep({String? isoDate}) async {
|
|
try {
|
|
final body = <String, dynamic>{};
|
|
if (isoDate != null) body['date'] = isoDate;
|
|
await _dio.post('/api/journal/trigger-prep', data: body);
|
|
} on DioException catch (e) {
|
|
throw dioToApp(e);
|
|
}
|
|
}
|
|
}
|