Merge branch 'develop' into feature/add-push-providers
This commit is contained in:
@@ -4,6 +4,10 @@
|
||||
|
||||
- Added `Huawei` and `Xiaomi` PushProviders.
|
||||
|
||||
🐞 Fixed
|
||||
|
||||
- Fixed initializing last synced date.
|
||||
|
||||
## 5.1.0
|
||||
|
||||
✅ Added
|
||||
|
||||
@@ -453,6 +453,15 @@ class StreamChatClient {
|
||||
if (persistenceEnabled) {
|
||||
await sync(cids: cids, lastSyncAt: _lastSyncedAt);
|
||||
}
|
||||
} else {
|
||||
// channels are empty, assuming it's a fresh start
|
||||
// and making sure `lastSyncAt` is initialized
|
||||
if (persistenceEnabled) {
|
||||
final lastSyncAt = await _chatPersistenceClient?.getLastSyncAt();
|
||||
if (lastSyncAt == null) {
|
||||
await _chatPersistenceClient?.updateLastSyncAt(DateTime.now());
|
||||
}
|
||||
}
|
||||
}
|
||||
handleEvent(Event(
|
||||
type: EventType.connectionRecovered,
|
||||
|
||||
@@ -516,6 +516,9 @@ void main() {
|
||||
});
|
||||
|
||||
setUp(() async {
|
||||
when(() => persistence.updateLastSyncAt(any()))
|
||||
.thenAnswer((_) => Future.value());
|
||||
when(persistence.getLastSyncAt).thenAnswer((_) async => null);
|
||||
client = StreamChatClient(apiKey, chatApi: api, ws: ws)
|
||||
..chatPersistenceClient = persistence;
|
||||
await client.connectUser(user, token);
|
||||
@@ -532,9 +535,12 @@ void main() {
|
||||
test(
|
||||
'''should update persistence connectionInfo and lastSync when sync succeeds''',
|
||||
() async {
|
||||
// persistence.updateLastSyncAt might be called
|
||||
// when connecting the user.
|
||||
// Resetting the logs so we start counting invocations correctly.
|
||||
reset(persistence);
|
||||
const cids = ['test-cid-1', 'test-cid-2', 'test-cid-3'];
|
||||
final lastSyncAt = DateTime.now();
|
||||
|
||||
when(() => api.general.sync(cids, lastSyncAt))
|
||||
.thenAnswer((_) async => SyncResponse()
|
||||
..events = [
|
||||
@@ -567,6 +573,10 @@ void main() {
|
||||
test(
|
||||
'should work fine if persistence contains sync params',
|
||||
() async {
|
||||
// persistence.updateLastSyncAt might be called
|
||||
// when connecting the user.
|
||||
// Resetting the logs so we start counting invocations correctly.
|
||||
reset(persistence);
|
||||
const cids = ['test-cid-1', 'test-cid-2', 'test-cid-3'];
|
||||
final lastSyncAt = DateTime.now();
|
||||
|
||||
|
||||
+4
-4
@@ -163,7 +163,7 @@ void main() {
|
||||
);
|
||||
|
||||
testWidgets(
|
||||
'tapping on reply should pop',
|
||||
'tapping on reply should invoke callback',
|
||||
(WidgetTester tester) async {
|
||||
final client = MockClient();
|
||||
final clientState = MockClientState();
|
||||
@@ -174,7 +174,7 @@ void main() {
|
||||
final themeData = ThemeData();
|
||||
final streamTheme = StreamChatThemeData.fromTheme(themeData);
|
||||
|
||||
final mockObserver = MockNavigatorObserver();
|
||||
final mockCallback = MockVoidCallback();
|
||||
|
||||
final attachment = Attachment(
|
||||
type: 'image',
|
||||
@@ -192,7 +192,6 @@ void main() {
|
||||
await tester.pumpWidget(
|
||||
MaterialApp(
|
||||
theme: themeData,
|
||||
navigatorObservers: [mockObserver],
|
||||
home: StreamChat(
|
||||
streamChatThemeData: streamTheme,
|
||||
client: client,
|
||||
@@ -200,13 +199,14 @@ void main() {
|
||||
child: AttachmentActionsModal(
|
||||
message: message,
|
||||
attachment: attachment,
|
||||
onReply: mockCallback,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
await tester.tap(find.text('Reply'));
|
||||
verify(() => mockObserver.didPop(any(), any()));
|
||||
verify(mockCallback.call);
|
||||
},
|
||||
);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user