Skip to content

Commit 4e8b237

Browse files
authored
New llc release: 0.5.2 (#215)
1 parent 24e36d2 commit 4e8b237

File tree

6 files changed

+18
-39
lines changed

6 files changed

+18
-39
lines changed

packages/stream_feed/CHANGELOG.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,14 @@
1+
## 0.5.2: 30/03/2022
2+
3+
- fix(serverside llc): `issueJwtHS256` wasn't using the `expiresAt` field and remove the default "exp" value.
4+
- new: pagination suuport for flat feed activities. For example:
5+
```dart
6+
final paginated = await flatFeed.getPaginatedEnrichedActivities();
7+
final nextParams = parseNext(paginated.next!);
8+
// parse next page
9+
await flatFeed.getPaginatedEnrichedActivities(limit: nextParams.limit,filter: nextParams.idLT);
10+
```
11+
112
## 0.5.1+1: 24/03/2022
213

314
- fix: the `JsonConverter<DateTime,String>` implemented in 0.4.0+1 that was supposed to handle utc dates parsing wasn't working properly. Now that it is actually fixed you can convert dates in the user's local timezone.

packages/stream_feed/lib/src/client/flat_feed.dart

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,9 +141,10 @@ class FlatFeed extends Feed {
141141
}
142142

143143
/// ```dart
144-
/// final paginated = await getPaginatedEnrichedActivities();
144+
/// final paginated = await flatFeed.getPaginatedEnrichedActivities();
145145
/// final nextParams = parseNext(paginated.next!);
146-
/// await getPaginatedEnrichedActivities(limit: nextParams.limit,filter: nextParams.idLT);
146+
/// //parse next page
147+
/// await flatFeed.getPaginatedEnrichedActivities(limit: nextParams.limit,filter: nextParams.idLT);
147148
/// ```
148149
Future<PaginatedActivities<A, Ob, T, Or>>
149150
getPaginatedEnrichedActivities<A, Ob, T, Or>({

packages/stream_feed/lib/src/core/util/token_helper.dart

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -220,11 +220,8 @@ String issueJwtHS256({
220220
required Map<String, Object?>? claims,
221221
DateTime? expiresAt,
222222
}) {
223-
final now = DateTime.now();
224223
final claimSet = JsonWebTokenClaims.fromJson({
225-
'exp':
226-
now.add(const Duration(seconds: 1200)).millisecondsSinceEpoch ~/ 1000,
227-
//'iat': now.toUtc().millisecondsSinceEpoch ~/ 1000,
224+
if (expiresAt != null) 'exp': expiresAt.millisecondsSinceEpoch ~/ 1000,
228225
if (claims != null) ...claims,
229226
});
230227

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
/// Current package version
22
/// Used in [HttpClient] to build the `x-stream-client` header
3-
const String packageVersion = '0.5.1+1';
3+
const String packageVersion = '0.5.2';

packages/stream_feed/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name: stream_feed
22
description: Stream Feed official Dart SDK. Build your own feed experience using
33
Dart and Flutter.
4-
version: 0.5.1+1
4+
version: 0.5.2
55
repository: https://github.com/GetStream/stream-feed-flutter
66
issue_tracker: https://github.com/GetStream/stream-feed-flutter/issues
77
homepage: https://getstream.io/

packages/stream_feed/test/token_helper_test.dart

Lines changed: 1 addition & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,7 @@ void main() {
3535

3636
expect(
3737
payloadJson,
38-
{
39-
'exp': isA<int>(),
40-
// 'iat': isA<int>(),
41-
'user_id': 'userId'
42-
},
38+
{'exp': isA<int>(), 'user_id': 'userId'},
4339
);
4440
expect(payloadJson['user_id'], 'userId');
4541
});
@@ -58,8 +54,6 @@ void main() {
5854
final payloadStr = b64urlEncRfc7515Decode(payload);
5955
final payloadJson = json.decode(payloadStr);
6056
expect(payloadJson, {
61-
'exp': isA<int>(),
62-
//'iat': isA<int>(),
6357
'action': '*',
6458
'resource': 'feed',
6559
'feed_id': '*',
@@ -80,8 +74,6 @@ void main() {
8074
final payloadStr = b64urlEncRfc7515Decode(payload);
8175
final payloadJson = json.decode(payloadStr);
8276
expect(payloadJson, {
83-
'exp': isA<int>(),
84-
// 'iat': isA<int>(),
8577
'action': '*',
8678
'resource': 'follower',
8779
'feed_id': '*',
@@ -103,8 +95,6 @@ void main() {
10395
final payloadStr = b64urlEncRfc7515Decode(payload);
10496
final payloadJson = json.decode(payloadStr);
10597
expect(payloadJson, {
106-
'exp': isA<int>(),
107-
// 'iat': isA<int>(),
10898
'action': '*',
10999
'resource': 'reactions',
110100
'feed_id': '*',
@@ -126,8 +116,6 @@ void main() {
126116
final payloadStr = b64urlEncRfc7515Decode(payload);
127117
final payloadJson = json.decode(payloadStr);
128118
expect(payloadJson, {
129-
'exp': isA<int>(),
130-
// 'iat': isA<int>(),
131119
'action': 'write',
132120
'resource': 'activities',
133121
'feed_id': '*',
@@ -148,8 +136,6 @@ void main() {
148136
final payloadStr = b64urlEncRfc7515Decode(payload);
149137
final payloadJson = json.decode(payloadStr);
150138
expect(payloadJson, {
151-
'exp': isA<int>(),
152-
// 'iat': isA<int>(),
153139
'action': '*',
154140
'resource': 'users',
155141
'feed_id': '*',
@@ -171,8 +157,6 @@ void main() {
171157
final payloadStr = b64urlEncRfc7515Decode(payload);
172158
final payloadJson = json.decode(payloadStr);
173159
expect(payloadJson, {
174-
'exp': isA<int>(),
175-
// 'iat': isA<int>(),
176160
'action': '*',
177161
'resource': 'collections',
178162
'feed_id': '*',
@@ -195,8 +179,6 @@ void main() {
195179
final payloadStr = b64urlEncRfc7515Decode(payload);
196180
final payloadJson = json.decode(payloadStr);
197181
expect(payloadJson, {
198-
'exp': isA<int>(),
199-
// 'iat': isA<int>(),
200182
'action': 'read',
201183
'resource': 'url',
202184
'feed_id': '*',
@@ -218,8 +200,6 @@ void main() {
218200
final payloadStr = b64urlEncRfc7515Decode(payload);
219201
final payloadJson = json.decode(payloadStr);
220202
expect(payloadJson, {
221-
'exp': isA<int>(),
222-
// 'iat': isA<int>(),
223203
'action': '*',
224204
'resource': 'feed_targets',
225205
'feed_id': '*',
@@ -240,8 +220,6 @@ void main() {
240220
final payloadStr = b64urlEncRfc7515Decode(payload);
241221
final payloadJson = json.decode(payloadStr);
242222
expect(payloadJson, {
243-
'exp': isA<int>(),
244-
// 'iat': isA<int>(),
245223
'action': '*',
246224
'resource': 'analytics',
247225
'feed_id': '*',
@@ -264,8 +242,6 @@ void main() {
264242
final payloadStr = b64urlEncRfc7515Decode(payload);
265243
final payloadJson = json.decode(payloadStr);
266244
expect(payloadJson, {
267-
'exp': isA<int>(),
268-
// 'iat': isA<int>(),
269245
'action': '*',
270246
'resource': 'personalization',
271247
'feed_id': '*',
@@ -288,8 +264,6 @@ void main() {
288264
final payloadStr = b64urlEncRfc7515Decode(payload);
289265
final payloadJson = json.decode(payloadStr);
290266
expect(payloadJson, {
291-
'exp': isA<int>(),
292-
// 'iat': isA<int>(),
293267
'action': '*',
294268
'resource': 'redirect_and_track',
295269
'feed_id': '*',
@@ -311,8 +285,6 @@ void main() {
311285
final payloadStr = b64urlEncRfc7515Decode(payload);
312286
final payloadJson = json.decode(payloadStr);
313287
expect(payloadJson, {
314-
'exp': isA<int>(),
315-
// 'iat': isA<int>(),
316288
'action': 'write',
317289
'resource': 'analytics',
318290
'feed_id': '*',
@@ -332,8 +304,6 @@ void main() {
332304
final payloadStr = b64urlEncRfc7515Decode(payload);
333305
final payloadJson = json.decode(payloadStr);
334306
expect(payloadJson, {
335-
'exp': isA<int>(),
336-
// 'iat': isA<int>(),
337307
'action': '*',
338308
'resource': 'files',
339309
'feed_id': '*',

0 commit comments

Comments
 (0)