mirror of
				https://gitlab.com/comunic/comunicmobile
				synced 2025-11-04 04:04:18 +00:00 
			
		
		
		
	Use Websocket to update number of unread notifications
This commit is contained in:
		@@ -3,8 +3,8 @@
 | 
			
		||||
/// @author Pierre Hubert
 | 
			
		||||
 | 
			
		||||
class CountUnreadNotifications {
 | 
			
		||||
  final int notifications;
 | 
			
		||||
  final int conversations;
 | 
			
		||||
  int notifications;
 | 
			
		||||
  int conversations;
 | 
			
		||||
 | 
			
		||||
  CountUnreadNotifications({
 | 
			
		||||
    this.notifications,
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										25
									
								
								lib/models/ws_message.dart
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										25
									
								
								lib/models/ws_message.dart
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,25 @@
 | 
			
		||||
import 'package:flutter/widgets.dart';
 | 
			
		||||
 | 
			
		||||
/// WebSocket message
 | 
			
		||||
///
 | 
			
		||||
/// @author Pierre Hubert
 | 
			
		||||
 | 
			
		||||
class WsMessage {
 | 
			
		||||
  final String id;
 | 
			
		||||
  final String title;
 | 
			
		||||
  final dynamic data;
 | 
			
		||||
 | 
			
		||||
  const WsMessage({
 | 
			
		||||
    @required this.id,
 | 
			
		||||
    @required this.title,
 | 
			
		||||
    @required this.data,
 | 
			
		||||
  })  : assert(id != null),
 | 
			
		||||
        assert(title != null);
 | 
			
		||||
 | 
			
		||||
  /// Construct a message from a JSON document (messages coming from the server)
 | 
			
		||||
  static WsMessage fromJSON(final Map<dynamic, dynamic> m) {
 | 
			
		||||
    return WsMessage(id: m["id"], title: m["title"], data: m["data"]);
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  bool get hasId => this.id != null && this.id.isNotEmpty;
 | 
			
		||||
}
 | 
			
		||||
		Reference in New Issue
	
	Block a user