Merge branch 'main' into braid/store-left-rooms-in-archive
This commit is contained in:
commit
620187c772
|
|
@ -9,7 +9,6 @@ on:
|
|||
jobs:
|
||||
publish:
|
||||
permissions:
|
||||
id-token: write # Required for authentication using OIDC
|
||||
uses: dart-lang/setup-dart/.github/workflows/publish.yml@a57a6c04cf7d4840e88432aad6281d1e125f0d46
|
||||
with:
|
||||
environment: pub.dev
|
||||
contents: read
|
||||
id-token: write
|
||||
uses: famedly/frontend-ci-templates/.github/workflows/publish-pub.yml@main
|
||||
|
|
|
|||
|
|
@ -1,3 +1,7 @@
|
|||
## [0.22.6] - 23 October 2023
|
||||
- fix: Do not convert linebreaks in pre blocks on markdown parsing (Krille)
|
||||
- refactor: Wait for room in sync until sync process and trigger cleanup call not before actually start clean up. (Krille)
|
||||
|
||||
## [0.22.5] - 20 October 2023
|
||||
- build(deps): bump http from 0.13.6 to 1.1.0 (dependabot[bot])
|
||||
- feat: Add methods to load all room keys from online key backup (Krille)
|
||||
|
|
|
|||
|
|
@ -739,10 +739,17 @@ class Client extends MatrixApi {
|
|||
leave = true;
|
||||
}
|
||||
|
||||
return await onSync.stream.firstWhere((sync) =>
|
||||
// Wait for the next sync where this room appears.
|
||||
final syncUpdate = await onSync.stream.firstWhere((sync) =>
|
||||
invite && (sync.rooms?.invite?.containsKey(roomId) ?? false) ||
|
||||
join && (sync.rooms?.join?.containsKey(roomId) ?? false) ||
|
||||
leave && (sync.rooms?.leave?.containsKey(roomId) ?? false));
|
||||
|
||||
// Wait for this sync to be completely processed.
|
||||
await onSyncStatus.stream.firstWhere(
|
||||
(syncStatus) => syncStatus.status == SyncStatus.finished,
|
||||
);
|
||||
return syncUpdate;
|
||||
}
|
||||
|
||||
/// Checks if the given user has encryption keys. May query keys from the
|
||||
|
|
@ -1675,7 +1682,7 @@ class Client extends MatrixApi {
|
|||
Logs().d('Running sync while init isn\'t done yet, dropping request');
|
||||
return;
|
||||
}
|
||||
dynamic syncError;
|
||||
Object? syncError;
|
||||
await _checkSyncFilter();
|
||||
timeout ??= const Duration(seconds: 30);
|
||||
final syncRequest = sync(
|
||||
|
|
@ -1715,12 +1722,12 @@ class Client extends MatrixApi {
|
|||
() async => await _currentTransaction,
|
||||
syncResp.itemCount,
|
||||
);
|
||||
onSyncStatus.add(SyncStatusUpdate(SyncStatus.cleaningUp));
|
||||
} else {
|
||||
await _handleSync(syncResp, direction: Direction.f);
|
||||
}
|
||||
if (_disposed || _aborted) return;
|
||||
prevBatch = syncResp.nextBatch;
|
||||
onSyncStatus.add(SyncStatusUpdate(SyncStatus.cleaningUp));
|
||||
// ignore: unawaited_futures
|
||||
database?.deleteOldFiles(
|
||||
DateTime.now().subtract(Duration(days: 30)).millisecondsSinceEpoch);
|
||||
|
|
|
|||
|
|
@ -258,8 +258,21 @@ String markdown(
|
|||
// Remove trailing linebreaks
|
||||
.replaceAll(RegExp(r'(<br />)+$'), '');
|
||||
if (convertLinebreaks) {
|
||||
ret = ret.replaceAll('\n', '<br/>');
|
||||
// Only convert linebreaks which are not in <pre> blocks
|
||||
ret = ret.convertLinebreaksToBr();
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
extension on String {
|
||||
String convertLinebreaksToBr() {
|
||||
final parts = split('pre>');
|
||||
var convertLinebreaks = true;
|
||||
for (var i = 0; i < parts.length; i++) {
|
||||
if (convertLinebreaks) parts[i] = parts[i].replaceAll('\n', '<br/>');
|
||||
convertLinebreaks = !convertLinebreaks;
|
||||
}
|
||||
return parts.join('pre>');
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
name: matrix
|
||||
description: Matrix Dart SDK
|
||||
version: 0.22.5
|
||||
version: 0.22.6
|
||||
homepage: https://famedly.com
|
||||
repository: https://github.com/famedly/matrix-dart-sdk.git
|
||||
|
||||
|
|
|
|||
|
|
@ -123,5 +123,22 @@ void main() {
|
|||
expect(markdown('meep `\$\\frac{2}{3}\$`'),
|
||||
'meep <code>\$\\frac{2}{3}\$</code>');
|
||||
});
|
||||
test('Code blocks', () {
|
||||
expect(
|
||||
markdown(
|
||||
'```dart\nvoid main(){\nprint(something);\n}\n```',
|
||||
convertLinebreaks: true,
|
||||
),
|
||||
'<pre><code class="language-dart">void main(){\nprint(something);\n}\n</code></pre>',
|
||||
);
|
||||
|
||||
expect(
|
||||
markdown(
|
||||
'The first \n codeblock\n```dart\nvoid main(){\nprint(something);\n}\n```\nAnd the second code block\n```js\nmeow\nmeow\n```',
|
||||
convertLinebreaks: true,
|
||||
),
|
||||
'<p>The first<br/>codeblock</p><br/><pre><code class="language-dart">void main(){\nprint(something);\n}\n</code></pre><br/><p>And the second code block</p><br/><pre><code class="language-js">meow\nmeow\n</code></pre>',
|
||||
);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue