mirror of
				https://gitlab.com/famedly/fluffychat.git
				synced 2025-10-31 03:57:27 +01:00 
			
		
		
		
	fix: loading history
This commit is contained in:
		
							parent
							
								
									e13a732688
								
							
						
					
					
						commit
						a5e95539e3
					
				| @ -1609,7 +1609,7 @@ | ||||
|     "type": "text", | ||||
|     "placeholders": {} | ||||
|   }, | ||||
|   "startYourFirstChat": "Start your first chat right now! 🙂\n- Tap on "+"\n- Enter the username of a friend\n- Have fun chatting", | ||||
|   "startYourFirstChat": "Start your first chat right now! 🙂\n- Tap on \"+\"\n- Enter the username of a friend\n- Have fun chatting", | ||||
|   "@startYourFirstChat": { | ||||
|     "type": "text", | ||||
|     "placeholders": {} | ||||
|  | ||||
| @ -81,8 +81,6 @@ class _ChatState extends State<Chat> { | ||||
| 
 | ||||
|   bool get selectMode => selectedEvents.isNotEmpty; | ||||
| 
 | ||||
|   bool _loadingHistory = false; | ||||
| 
 | ||||
|   final int _loadHistoryCount = 100; | ||||
| 
 | ||||
|   String inputText = ''; | ||||
| @ -93,8 +91,6 @@ class _ChatState extends State<Chat> { | ||||
| 
 | ||||
|   void requestHistory() async { | ||||
|     if (_canLoadMore) { | ||||
|       setState(() => _loadingHistory = true); | ||||
| 
 | ||||
|       try { | ||||
|         await timeline.requestHistory(historyCount: _loadHistoryCount); | ||||
|       } catch (err) { | ||||
| @ -102,11 +98,6 @@ class _ChatState extends State<Chat> { | ||||
|                 message: err.toLocalizedString(context)) | ||||
|             .show(context); | ||||
|       } | ||||
| 
 | ||||
|       // we do NOT setState() here as then the event order will be wrong. | ||||
|       // instead, we just set our variable to false, and rely on timeline update to set the | ||||
|       // new state, thus triggering a re-render, for us | ||||
|       _loadingHistory = false; | ||||
|     } | ||||
|   } | ||||
| 
 | ||||
| @ -633,7 +624,7 @@ class _ChatState extends State<Chat> { | ||||
|                         childrenDelegate: SliverChildBuilderDelegate( | ||||
|                           (BuildContext context, int i) { | ||||
|                             return i == filteredEvents.length + 1 | ||||
|                                 ? _loadingHistory | ||||
|                                 ? timeline.isRequestingHistory | ||||
|                                     ? Container( | ||||
|                                         height: 50, | ||||
|                                         alignment: Alignment.center, | ||||
|  | ||||
| @ -216,7 +216,7 @@ packages: | ||||
|     description: | ||||
|       path: "." | ||||
|       ref: main | ||||
|       resolved-ref: "0c89098b7a3231680d87cd79e1494d326a41574e" | ||||
|       resolved-ref: "4597ea344553e78a0817d7cdad16ac72079c8034" | ||||
|       url: "https://gitlab.com/famedly/famedlysdk.git" | ||||
|     source: git | ||||
|     version: "0.0.1" | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 Christian Pauly
						Christian Pauly