Merge branch 'main' into braid/store-left-rooms-in-archive
This commit is contained in:
commit
620187c772
|
|
@ -9,7 +9,6 @@ on:
|
||||||
jobs:
|
jobs:
|
||||||
publish:
|
publish:
|
||||||
permissions:
|
permissions:
|
||||||
id-token: write # Required for authentication using OIDC
|
contents: read
|
||||||
uses: dart-lang/setup-dart/.github/workflows/publish.yml@a57a6c04cf7d4840e88432aad6281d1e125f0d46
|
id-token: write
|
||||||
with:
|
uses: famedly/frontend-ci-templates/.github/workflows/publish-pub.yml@main
|
||||||
environment: pub.dev
|
|
||||||
|
|
|
||||||
|
|
@ -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
|
## [0.22.5] - 20 October 2023
|
||||||
- build(deps): bump http from 0.13.6 to 1.1.0 (dependabot[bot])
|
- 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)
|
- feat: Add methods to load all room keys from online key backup (Krille)
|
||||||
|
|
|
||||||
|
|
@ -739,10 +739,17 @@ class Client extends MatrixApi {
|
||||||
leave = true;
|
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) ||
|
invite && (sync.rooms?.invite?.containsKey(roomId) ?? false) ||
|
||||||
join && (sync.rooms?.join?.containsKey(roomId) ?? false) ||
|
join && (sync.rooms?.join?.containsKey(roomId) ?? false) ||
|
||||||
leave && (sync.rooms?.leave?.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
|
/// 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');
|
Logs().d('Running sync while init isn\'t done yet, dropping request');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
dynamic syncError;
|
Object? syncError;
|
||||||
await _checkSyncFilter();
|
await _checkSyncFilter();
|
||||||
timeout ??= const Duration(seconds: 30);
|
timeout ??= const Duration(seconds: 30);
|
||||||
final syncRequest = sync(
|
final syncRequest = sync(
|
||||||
|
|
@ -1715,12 +1722,12 @@ class Client extends MatrixApi {
|
||||||
() async => await _currentTransaction,
|
() async => await _currentTransaction,
|
||||||
syncResp.itemCount,
|
syncResp.itemCount,
|
||||||
);
|
);
|
||||||
onSyncStatus.add(SyncStatusUpdate(SyncStatus.cleaningUp));
|
|
||||||
} else {
|
} else {
|
||||||
await _handleSync(syncResp, direction: Direction.f);
|
await _handleSync(syncResp, direction: Direction.f);
|
||||||
}
|
}
|
||||||
if (_disposed || _aborted) return;
|
if (_disposed || _aborted) return;
|
||||||
prevBatch = syncResp.nextBatch;
|
prevBatch = syncResp.nextBatch;
|
||||||
|
onSyncStatus.add(SyncStatusUpdate(SyncStatus.cleaningUp));
|
||||||
// ignore: unawaited_futures
|
// ignore: unawaited_futures
|
||||||
database?.deleteOldFiles(
|
database?.deleteOldFiles(
|
||||||
DateTime.now().subtract(Duration(days: 30)).millisecondsSinceEpoch);
|
DateTime.now().subtract(Duration(days: 30)).millisecondsSinceEpoch);
|
||||||
|
|
|
||||||
|
|
@ -258,8 +258,21 @@ String markdown(
|
||||||
// Remove trailing linebreaks
|
// Remove trailing linebreaks
|
||||||
.replaceAll(RegExp(r'(<br />)+$'), '');
|
.replaceAll(RegExp(r'(<br />)+$'), '');
|
||||||
if (convertLinebreaks) {
|
if (convertLinebreaks) {
|
||||||
ret = ret.replaceAll('\n', '<br/>');
|
// Only convert linebreaks which are not in <pre> blocks
|
||||||
|
ret = ret.convertLinebreaksToBr();
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret;
|
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
|
name: matrix
|
||||||
description: Matrix Dart SDK
|
description: Matrix Dart SDK
|
||||||
version: 0.22.5
|
version: 0.22.6
|
||||||
homepage: https://famedly.com
|
homepage: https://famedly.com
|
||||||
repository: https://github.com/famedly/matrix-dart-sdk.git
|
repository: https://github.com/famedly/matrix-dart-sdk.git
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -123,5 +123,22 @@ void main() {
|
||||||
expect(markdown('meep `\$\\frac{2}{3}\$`'),
|
expect(markdown('meep `\$\\frac{2}{3}\$`'),
|
||||||
'meep <code>\$\\frac{2}{3}\$</code>');
|
'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