mirror of
https://gitlab.com/famedly/fluffychat.git
synced 2024-12-24 22:42:33 +01:00
fix: Analyzer bugs
This commit is contained in:
parent
15fcfbf362
commit
dcee386da4
@ -16,7 +16,7 @@ class ArchiveController extends State<Archive> {
|
||||
|
||||
Future<List<Room>> getArchive(BuildContext context) async {
|
||||
if (archive != null) return archive;
|
||||
return await Matrix.of(context).client.archive;
|
||||
return await Matrix.of(context).client.loadArchive();
|
||||
}
|
||||
|
||||
void forgetAction(int i) => setState(() => archive.removeAt(i));
|
||||
|
@ -80,7 +80,7 @@ extension LocalizedBody on Event {
|
||||
return true;
|
||||
}
|
||||
// check if the url is cached
|
||||
final url = Uri.parse(mxcUrl).getDownloadLink(room.client);
|
||||
final url = mxcUrl.getDownloadLink(room.client);
|
||||
final file = await DefaultCacheManager().getFileFromCache(url.toString());
|
||||
return file != null;
|
||||
}
|
||||
@ -88,7 +88,7 @@ extension LocalizedBody on Event {
|
||||
Future<MatrixFile> downloadAndDecryptAttachmentCached(
|
||||
{bool getThumbnail = false}) async {
|
||||
final mxcUrl = attachmentOrThumbnailMxcUrl(getThumbnail: getThumbnail);
|
||||
_downloadAndDecryptFutures[mxcUrl] ??= downloadAndDecryptAttachment(
|
||||
_downloadAndDecryptFutures[mxcUrl.toString()] ??= downloadAndDecryptAttachment(
|
||||
getThumbnail: getThumbnail,
|
||||
downloadCallback: (Uri url) async {
|
||||
final file = await DefaultCacheManager().getSingleFile(url.toString());
|
||||
|
@ -118,20 +118,22 @@ class FlutterMatrixHiveStore extends FamedlySdkHiveDatabase {
|
||||
}
|
||||
|
||||
@override
|
||||
Future<Uint8List> getFile(String mxcUri) async {
|
||||
Future<Uint8List> getFile(Uri mxcUri) async {
|
||||
if (!supportsFileStoring) return null;
|
||||
final tempDirectory = await _getFileStoreDirectory();
|
||||
final file = File('$tempDirectory/${Uri.encodeComponent(mxcUri)}');
|
||||
final file =
|
||||
File('$tempDirectory/${Uri.encodeComponent(mxcUri.toString())}');
|
||||
if (await file.exists() == false) return null;
|
||||
final bytes = await file.readAsBytes();
|
||||
return bytes;
|
||||
}
|
||||
|
||||
@override
|
||||
Future storeFile(String mxcUri, Uint8List bytes, int time) async {
|
||||
Future storeFile(Uri mxcUri, Uint8List bytes, int time) async {
|
||||
if (!supportsFileStoring) return null;
|
||||
final tempDirectory = await _getFileStoreDirectory();
|
||||
final file = File('$tempDirectory/${Uri.encodeComponent(mxcUri)}');
|
||||
final file =
|
||||
File('$tempDirectory/${Uri.encodeComponent(mxcUri.toString())}');
|
||||
if (await file.exists()) return;
|
||||
await file.writeAsBytes(bytes);
|
||||
return;
|
||||
|
@ -21,7 +21,7 @@ import 'package:matrix/matrix.dart';
|
||||
import 'resize_image.dart';
|
||||
|
||||
extension RoomSendFileExtension on Room {
|
||||
Future<String> sendFileEventWithThumbnail(
|
||||
Future<Uri> sendFileEventWithThumbnail(
|
||||
MatrixFile file, {
|
||||
String txid,
|
||||
Event inReplyTo,
|
||||
|
@ -265,7 +265,8 @@ class _ImageBubbleState extends State<ImageBubble> {
|
||||
: widget.event.thumbnailMxcUrl;
|
||||
final mimetype = getMimetype(!isOriginal);
|
||||
if (_contentRenderers.containsKey(mimetype)) {
|
||||
return _contentRenderers[mimetype].memory(_displayFile.bytes, key);
|
||||
return _contentRenderers[mimetype]
|
||||
.memory(_displayFile.bytes, key.toString());
|
||||
} else {
|
||||
return Image.memory(
|
||||
_displayFile.bytes,
|
||||
|
Loading…
Reference in New Issue
Block a user