✨ Basic publisher page
This commit is contained in:
@ -63,10 +63,15 @@ class SnPostContentProvider {
|
||||
return out;
|
||||
}
|
||||
|
||||
Future<(List<SnPost>, int)> listPosts({int take = 10, int offset = 0}) async {
|
||||
Future<(List<SnPost>, int)> listPosts({
|
||||
int take = 10,
|
||||
int offset = 0,
|
||||
String? author,
|
||||
}) async {
|
||||
final resp = await _sn.client.get('/cgi/co/posts', queryParameters: {
|
||||
'take': take,
|
||||
'offset': offset,
|
||||
if (author != null) 'author': author,
|
||||
});
|
||||
final List<SnPost> out = await _preloadRelatedDataInBatch(
|
||||
List.from(resp.data['data']?.map((e) => SnPost.fromJson(e)) ?? []),
|
||||
|
@ -89,12 +89,6 @@ class WebSocketProvider extends ChangeNotifier {
|
||||
final packet = WebSocketPackage.fromJson(jsonDecode(event));
|
||||
log('Websocket incoming message: ${packet.method} ${packet.message}');
|
||||
stream.sink.add(packet);
|
||||
// TODO handle notification
|
||||
// if (packet.method == 'notifications.new') {
|
||||
// final NotificationProvider nty = Get.find();
|
||||
// nty.notifications.add(Notification.fromJson(packet.payload!));
|
||||
// nty.notificationUnread.value++;
|
||||
// }
|
||||
},
|
||||
onDone: () {
|
||||
isConnected = false;
|
||||
|
Reference in New Issue
Block a user