Merge branch 'krille/add-calc-localized-body-fallback' into 'main'
refactor: add calcLocalizedBodyFallback method See merge request famedly/company/frontend/famedlysdk!1052
This commit is contained in:
commit
8473cd8831
|
|
@ -653,7 +653,7 @@ class Event extends MatrixEvent {
|
||||||
await fetchSenderUser();
|
await fetchSenderUser();
|
||||||
}
|
}
|
||||||
|
|
||||||
return _getLocalizedBody(i18n,
|
return calcLocalizedBodyFallback(i18n,
|
||||||
withSenderNamePrefix: withSenderNamePrefix,
|
withSenderNamePrefix: withSenderNamePrefix,
|
||||||
hideReply: hideReply,
|
hideReply: hideReply,
|
||||||
hideEdit: hideEdit,
|
hideEdit: hideEdit,
|
||||||
|
|
@ -661,22 +661,26 @@ class Event extends MatrixEvent {
|
||||||
removeMarkdown: removeMarkdown);
|
removeMarkdown: removeMarkdown);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated('Use calcLocalizedBody')
|
@Deprecated('Use calcLocalizedBody or calcLocalizedBodyFallback')
|
||||||
String getLocalizedBody(MatrixLocalizations i18n,
|
String getLocalizedBody(MatrixLocalizations i18n,
|
||||||
{bool withSenderNamePrefix = false,
|
{bool withSenderNamePrefix = false,
|
||||||
bool hideReply = false,
|
bool hideReply = false,
|
||||||
bool hideEdit = false,
|
bool hideEdit = false,
|
||||||
bool plaintextBody = false,
|
bool plaintextBody = false,
|
||||||
bool removeMarkdown = false}) {
|
bool removeMarkdown = false}) =>
|
||||||
return _getLocalizedBody(i18n,
|
calcLocalizedBodyFallback(i18n,
|
||||||
withSenderNamePrefix: withSenderNamePrefix,
|
withSenderNamePrefix: withSenderNamePrefix,
|
||||||
hideReply: hideReply,
|
hideReply: hideReply,
|
||||||
hideEdit: hideEdit,
|
hideEdit: hideEdit,
|
||||||
plaintextBody: plaintextBody,
|
plaintextBody: plaintextBody,
|
||||||
removeMarkdown: removeMarkdown);
|
removeMarkdown: removeMarkdown);
|
||||||
}
|
|
||||||
|
|
||||||
String _getLocalizedBody(MatrixLocalizations i18n,
|
/// Works similar to `calcLocalizedBody()` but does not wait for the sender
|
||||||
|
/// user to be fetched. If it is not in the cache it will just use the
|
||||||
|
/// fallback and display the localpart of the MXID according to the
|
||||||
|
/// values of `formatLocalpart` and `mxidLocalPartFallback` in the `Client`
|
||||||
|
/// class.
|
||||||
|
String calcLocalizedBodyFallback(MatrixLocalizations i18n,
|
||||||
{bool withSenderNamePrefix = false,
|
{bool withSenderNamePrefix = false,
|
||||||
bool hideReply = false,
|
bool hideReply = false,
|
||||||
bool hideEdit = false,
|
bool hideEdit = false,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue