feat: Add scroll-to-event
This commit is contained in:
parent
8df3695ecf
commit
46c26c02dc
8 changed files with 269 additions and 76 deletions
24
lib/utils/matrix_identifier_string_extension.dart
Normal file
24
lib/utils/matrix_identifier_string_extension.dart
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
extension MatrixIdentifierStringExtension on String {
|
||||
/// Separates room identifiers with an event id and possibly a query parameter into its components.
|
||||
MatrixIdentifierStringExtensionResults parseIdentifierIntoParts() {
|
||||
final match = RegExp(r'^([#!][^:]*:[^\/?]*)(?:\/(\$[^?]*))?(?:\?(.*))?$')
|
||||
.firstMatch(this);
|
||||
if (match == null) {
|
||||
return null;
|
||||
}
|
||||
return MatrixIdentifierStringExtensionResults(
|
||||
roomIdOrAlias: match.group(1),
|
||||
eventId: match.group(2),
|
||||
queryString: match.group(3),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class MatrixIdentifierStringExtensionResults {
|
||||
final String roomIdOrAlias;
|
||||
final String eventId;
|
||||
final String queryString;
|
||||
|
||||
MatrixIdentifierStringExtensionResults(
|
||||
{this.roomIdOrAlias, this.eventId, this.queryString});
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue