feat: Request history on limited timeline
This commit is contained in:
		
							parent
							
								
									ef854b3b4c
								
							
						
					
					
						commit
						fea4dea6a9
					
				|  | @ -21,6 +21,7 @@ import 'dart:convert'; | ||||||
| import 'dart:core'; | import 'dart:core'; | ||||||
| import 'dart:typed_data'; | import 'dart:typed_data'; | ||||||
| 
 | 
 | ||||||
|  | import 'package:famedlysdk/src/utils/run_in_root.dart'; | ||||||
| import 'package:http/http.dart' as http; | import 'package:http/http.dart' as http; | ||||||
| import 'package:olm/olm.dart' as olm; | import 'package:olm/olm.dart' as olm; | ||||||
| import 'package:pedantic/pedantic.dart'; | import 'package:pedantic/pedantic.dart'; | ||||||
|  | @ -74,6 +75,8 @@ class Client extends MatrixApi { | ||||||
| 
 | 
 | ||||||
|   int sendMessageTimeoutSeconds; |   int sendMessageTimeoutSeconds; | ||||||
| 
 | 
 | ||||||
|  |   bool requestHistoryOnLimitedTimeline; | ||||||
|  | 
 | ||||||
|   /// Create a client |   /// Create a client | ||||||
|   /// [clientName] = unique identifier of this client |   /// [clientName] = unique identifier of this client | ||||||
|   /// [database]: The database instance to use |   /// [database]: The database instance to use | ||||||
|  | @ -96,6 +99,8 @@ class Client extends MatrixApi { | ||||||
|   ///     - *some* m.room.member events, where needed |   ///     - *some* m.room.member events, where needed | ||||||
|   /// [roomPreviewLastEvents]: The event types that should be used to calculate the last event |   /// [roomPreviewLastEvents]: The event types that should be used to calculate the last event | ||||||
|   ///     in a room for the room list. |   ///     in a room for the room list. | ||||||
|  |   /// Set [requestHistoryOnLimitedTimeline] to controll the automatic behaviour if the client | ||||||
|  |   /// receives a limited timeline flag for a room. | ||||||
|   Client( |   Client( | ||||||
|     this.clientName, { |     this.clientName, { | ||||||
|     this.databaseBuilder, |     this.databaseBuilder, | ||||||
|  | @ -106,6 +111,7 @@ class Client extends MatrixApi { | ||||||
|     this.roomPreviewLastEvents, |     this.roomPreviewLastEvents, | ||||||
|     this.pinUnreadRooms = false, |     this.pinUnreadRooms = false, | ||||||
|     this.sendMessageTimeoutSeconds = 60, |     this.sendMessageTimeoutSeconds = 60, | ||||||
|  |     this.requestHistoryOnLimitedTimeline = true, | ||||||
|     @deprecated bool debug, |     @deprecated bool debug, | ||||||
|   }) { |   }) { | ||||||
|     verificationMethods ??= <KeyVerificationMethod>{}; |     verificationMethods ??= <KeyVerificationMethod>{}; | ||||||
|  | @ -1290,6 +1296,10 @@ class Client extends MatrixApi { | ||||||
|         } |         } | ||||||
|       } |       } | ||||||
|       if (rooms[j].onUpdate != null) rooms[j].onUpdate.add(rooms[j].id); |       if (rooms[j].onUpdate != null) rooms[j].onUpdate.add(rooms[j].id); | ||||||
|  |       if (chatUpdate.limitedTimeline) { | ||||||
|  |         Logs().v('Limited timeline for ${rooms[j].id} request history now'); | ||||||
|  |         runInRoot(rooms[j].requestHistory); | ||||||
|  |       } | ||||||
|     } |     } | ||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue