automatically retry message delete

This commit is contained in:
Salvatore Giordano
2020-03-11 17:44:56 +01:00
parent 54f1901620
commit fe5adc72dc
5 changed files with 99 additions and 30 deletions
+12 -6
View File
@@ -12,13 +12,13 @@ PODS:
- keyboard_visibility (0.5.0):
- Flutter
- Reachability
- moor_ffi (0.0.1):
- Flutter
- path_provider (0.0.1):
- Flutter
- path_provider_macos (0.0.1):
- Flutter
- Reachability (3.2)
- screen (0.0.1):
- Flutter
- sqflite (0.0.1):
- Flutter
- FMDB (~> 2.7.2)
@@ -32,6 +32,8 @@ PODS:
- Flutter
- video_player_web (0.0.1):
- Flutter
- wakelock (0.0.1):
- Flutter
DEPENDENCIES:
- file_picker (from `.symlinks/plugins/file_picker/ios`)
@@ -39,15 +41,16 @@ DEPENDENCIES:
- flutter_plugin_android_lifecycle (from `.symlinks/plugins/flutter_plugin_android_lifecycle/ios`)
- image_picker (from `.symlinks/plugins/image_picker/ios`)
- keyboard_visibility (from `.symlinks/plugins/keyboard_visibility/ios`)
- moor_ffi (from `.symlinks/plugins/moor_ffi/ios`)
- path_provider (from `.symlinks/plugins/path_provider/ios`)
- path_provider_macos (from `.symlinks/plugins/path_provider_macos/ios`)
- screen (from `.symlinks/plugins/screen/ios`)
- sqflite (from `.symlinks/plugins/sqflite/ios`)
- url_launcher (from `.symlinks/plugins/url_launcher/ios`)
- url_launcher_macos (from `.symlinks/plugins/url_launcher_macos/ios`)
- url_launcher_web (from `.symlinks/plugins/url_launcher_web/ios`)
- video_player (from `.symlinks/plugins/video_player/ios`)
- video_player_web (from `.symlinks/plugins/video_player_web/ios`)
- wakelock (from `.symlinks/plugins/wakelock/ios`)
SPEC REPOS:
trunk:
@@ -65,12 +68,12 @@ EXTERNAL SOURCES:
:path: ".symlinks/plugins/image_picker/ios"
keyboard_visibility:
:path: ".symlinks/plugins/keyboard_visibility/ios"
moor_ffi:
:path: ".symlinks/plugins/moor_ffi/ios"
path_provider:
:path: ".symlinks/plugins/path_provider/ios"
path_provider_macos:
:path: ".symlinks/plugins/path_provider_macos/ios"
screen:
:path: ".symlinks/plugins/screen/ios"
sqflite:
:path: ".symlinks/plugins/sqflite/ios"
url_launcher:
@@ -83,6 +86,8 @@ EXTERNAL SOURCES:
:path: ".symlinks/plugins/video_player/ios"
video_player_web:
:path: ".symlinks/plugins/video_player_web/ios"
wakelock:
:path: ".symlinks/plugins/wakelock/ios"
SPEC CHECKSUMS:
file_picker: 408623be2125b79a4539cf703be3d4b3abe5e245
@@ -91,16 +96,17 @@ SPEC CHECKSUMS:
FMDB: 2ce00b547f966261cd18927a3ddb07cb6f3db82a
image_picker: e3eacd46b94694dde7cf2705955cece853aa1a8f
keyboard_visibility: 96a24de806fe6823c3ad956c01ba2ec6d056616f
moor_ffi: d66c9470c18e9cb333423bbcb493c105c6c774c6
path_provider: fb74bd0465e96b594bb3b5088ee4a4e7bb1f2a9d
path_provider_macos: f760a3c5b04357c380e2fddb6f9db6f3015897e0
Reachability: 33e18b67625424e47b6cde6d202dce689ad7af96
screen: abd91ca7bf3426e1cc3646d27e9b2358d6bf07b0
sqflite: 4001a31ff81d210346b500c55b17f4d6c7589dd0
url_launcher: a1c0cc845906122c4784c542523d8cacbded5626
url_launcher_macos: fd7894421cd39320dce5f292fc99ea9270b2a313
url_launcher_web: e5527357f037c87560776e36436bf2b0288b965c
video_player: 69c5f029fac4ffe4fc8a85ea7f7b793709661549
video_player_web: da8cadb8274ed4f8dbee8d7171b420dedd437ce7
wakelock: bd3dcc6a8bcf53a1c0309780ff192dcee67c6ccb
PODFILE CHECKSUM: 1b66dae606f75376c5f2135a8290850eeb09ae83
+26
View File
@@ -0,0 +1,26 @@
import 'package:cached_network_image/cached_network_image.dart';
import 'package:flutter/material.dart';
import 'package:photo_view/photo_view.dart';
class FullScreenImage extends StatelessWidget {
final String url;
const FullScreenImage({
Key key,
@required this.url,
}) : super(key: key);
@override
Widget build(BuildContext context) {
return Container(
child: PhotoView(
imageProvider: CachedNetworkImageProvider(url),
maxScale: PhotoViewComputedScale.covered,
minScale: PhotoViewComputedScale.contained,
heroAttributes: PhotoViewHeroAttributes(
tag: url,
),
),
);
}
}
+21 -7
View File
@@ -586,14 +586,28 @@ class _MessageInputState extends State<MessageInput> {
_attachments.add(attachment);
});
final res = await channel.sendFile(
MultipartFile.fromBytes(
bytes,
filename: file.path.split('/').last,
),
);
String url;
attachment.url = res.file;
if (type == FileType.IMAGE) {
final res = await channel.sendImage(
MultipartFile.fromBytes(
bytes,
filename: file.path.split('/').last,
contentType: MediaType.parse('image/jpeg'),
),
);
url = res.file;
} else {
final res = await channel.sendFile(
MultipartFile.fromBytes(
bytes,
filename: file.path.split('/').last,
),
);
url = res.file;
}
attachment.url = url;
setState(() {
attachment.uploaded = true;
+39 -17
View File
@@ -8,6 +8,7 @@ import 'package:flutter/widgets.dart';
import 'package:flutter_markdown/flutter_markdown.dart';
import 'package:jiffy/jiffy.dart';
import 'package:stream_chat/stream_chat.dart';
import 'package:stream_chat_flutter/src/full_screen_image.dart';
import 'package:stream_chat_flutter/src/message_input.dart';
import 'package:stream_chat_flutter/src/message_list_view.dart';
import 'package:stream_chat_flutter/src/reaction_picker.dart';
@@ -221,7 +222,7 @@ class _MessageWidgetState extends State<MessageWidget>
alignment: alignment,
child: Padding(
padding: const EdgeInsets.symmetric(
horizontal: 16,
horizontal: 14,
vertical: 14,
),
child: Text(
@@ -895,23 +896,44 @@ class _MessageWidgetState extends State<MessageWidget>
Widget _buildImage(
Attachment attachment,
) {
return CachedNetworkImage(
imageUrl:
attachment.thumbUrl ?? attachment.imageUrl ?? attachment.assetUrl,
errorWidget: (context, url, error) {
return Container(
width: 200,
height: 140,
color: Color(0xffd0021B).withAlpha(26),
child: Center(
child: Icon(
Icons.error_outline,
color: Colors.white,
),
),
);
return GestureDetector(
onTap: () {
print(attachment.toJson());
Navigator.push(context, MaterialPageRoute(builder: (_) {
return FullScreenImage(
url: attachment.imageUrl ??
attachment.assetUrl ??
attachment.thumbUrl,
);
}));
},
fit: BoxFit.cover,
child: Hero(
tag: attachment.imageUrl ?? attachment.assetUrl ?? attachment.thumbUrl,
child: CachedNetworkImage(
placeholder: (_, __) {
return Container(
width: 200,
height: 140,
);
},
imageUrl:
attachment.thumbUrl ?? attachment.imageUrl ?? attachment.assetUrl,
errorWidget: (context, url, error) {
return Container(
width: 200,
height: 140,
color: Color(0xffd0021B).withAlpha(26),
child: Center(
child: Icon(
Icons.error_outline,
color: Colors.white,
),
),
);
},
fit: BoxFit.cover,
),
),
);
}
+1
View File
@@ -9,6 +9,7 @@ environment:
dependencies:
flutter:
sdk: flutter
photo_view: ^0.9.2
rxdart: ^0.23.1
flutter_widgets: ^0.1.11
jiffy: ^3.0.0