chore: Follow up search

pull/1096/head
krille-chan 1 year ago
parent e40e24e97d
commit b20b599ce4
No known key found for this signature in database

@ -2540,7 +2540,7 @@
"chat": {} "chat": {}
} }
}, },
"photos": "Photos", "gallery": "Gallery",
"files": "Files", "files": "Files",
"databaseBuildErrorBody": "Unable to build the SQlite database. The app tries to use the legacy database for now. Please report this error to the developers at {url}. The error message is: {error}", "databaseBuildErrorBody": "Unable to build the SQlite database. The app tries to use the legacy database for now. Please report this error to the developers at {url}. The error message is: {error}",
"@databaseBuildErrorBody": { "@databaseBuildErrorBody": {

@ -155,10 +155,7 @@ class MessageContent extends StatelessWidget {
} }
return MessageDownloadContent(event, textColor); return MessageDownloadContent(event, textColor);
case MessageTypes.Video: case MessageTypes.Video:
if (PlatformInfos.isMobile || PlatformInfos.isWeb) {
return EventVideoPlayer(event); return EventVideoPlayer(event);
}
return MessageDownloadContent(event, textColor);
case MessageTypes.File: case MessageTypes.File:
return MessageDownloadContent(event, textColor); return MessageDownloadContent(event, textColor);

@ -10,9 +10,11 @@ import 'package:path_provider/path_provider.dart';
import 'package:universal_html/html.dart' as html; import 'package:universal_html/html.dart' as html;
import 'package:video_player/video_player.dart'; import 'package:video_player/video_player.dart';
import 'package:fluffychat/config/app_config.dart';
import 'package:fluffychat/pages/chat/events/image_bubble.dart'; import 'package:fluffychat/pages/chat/events/image_bubble.dart';
import 'package:fluffychat/utils/localized_exception_extension.dart'; import 'package:fluffychat/utils/localized_exception_extension.dart';
import 'package:fluffychat/utils/matrix_sdk_extensions/event_extension.dart'; import 'package:fluffychat/utils/matrix_sdk_extensions/event_extension.dart';
import 'package:fluffychat/utils/platform_infos.dart';
import 'package:fluffychat/widgets/blur_hash.dart'; import 'package:fluffychat/widgets/blur_hash.dart';
import '../../../utils/error_reporter.dart'; import '../../../utils/error_reporter.dart';
@ -31,6 +33,10 @@ class EventVideoPlayerState extends State<EventVideoPlayer> {
File? _tmpFile; File? _tmpFile;
void _downloadAction() async { void _downloadAction() async {
if (PlatformInfos.isDesktop) {
widget.event.saveFile(context);
return;
}
setState(() => _isDownloading = true); setState(() => _isDownloading = true);
try { try {
final videoFile = await widget.event.downloadAndDecryptAttachment(); final videoFile = await widget.event.downloadAndDecryptAttachment();
@ -98,6 +104,7 @@ class EventVideoPlayerState extends State<EventVideoPlayer> {
final chewieManager = _chewieManager; final chewieManager = _chewieManager;
return Material( return Material(
color: Colors.black, color: Colors.black,
borderRadius: BorderRadius.circular(AppConfig.borderRadius),
child: SizedBox( child: SizedBox(
height: 300, height: 300,
child: chewieManager != null child: chewieManager != null
@ -114,9 +121,10 @@ class EventVideoPlayerState extends State<EventVideoPlayer> {
else else
BlurHash(blurhash: blurHash, width: 300, height: 300), BlurHash(blurhash: blurHash, width: 300, height: 300),
Center( Center(
child: OutlinedButton.icon( child: IconButton(
style: OutlinedButton.styleFrom( style: IconButton.styleFrom(
backgroundColor: Theme.of(context).colorScheme.surface, backgroundColor:
Theme.of(context).colorScheme.background,
), ),
icon: _isDownloading icon: _isDownloading
? const SizedBox( ? const SizedBox(
@ -126,14 +134,12 @@ class EventVideoPlayerState extends State<EventVideoPlayer> {
strokeWidth: 2, strokeWidth: 2,
), ),
) )
: const Icon(Icons.download_outlined), : const Icon(Icons.play_circle_outlined),
label: Text( tooltip: _isDownloading
_isDownloading
? L10n.of(context)!.loadingPleaseWait ? L10n.of(context)!.loadingPleaseWait
: L10n.of(context)!.videoWithSize( : L10n.of(context)!.videoWithSize(
widget.event.sizeString ?? '?MB', widget.event.sizeString ?? '?MB',
), ),
),
onPressed: _isDownloading ? null : _downloadAction, onPressed: _isDownloading ? null : _downloadAction,
), ),
), ),

@ -5,6 +5,7 @@ import 'package:intl/intl.dart';
import 'package:matrix/matrix.dart'; import 'package:matrix/matrix.dart';
import 'package:fluffychat/pages/chat/events/image_bubble.dart'; import 'package:fluffychat/pages/chat/events/image_bubble.dart';
import 'package:fluffychat/pages/chat/events/video_player.dart';
import 'package:fluffychat/utils/matrix_sdk_extensions/matrix_locals.dart'; import 'package:fluffychat/utils/matrix_sdk_extensions/matrix_locals.dart';
class ChatSearchImagesTab extends StatelessWidget { class ChatSearchImagesTab extends StatelessWidget {
@ -146,14 +147,17 @@ class ChatSearchImagesTab extends StatelessWidget {
crossAxisSpacing: padding, crossAxisSpacing: padding,
padding: const EdgeInsets.all(padding), padding: const EdgeInsets.all(padding),
crossAxisCount: 3, crossAxisCount: 3,
children: monthEvents children: monthEvents.map(
.map( (event) {
(event) => ImageBubble( if (event.messageType == MessageTypes.Video) {
return EventVideoPlayer(event);
}
return ImageBubble(
event, event,
fit: BoxFit.cover, fit: BoxFit.cover,
), );
) },
.toList(), ).toList(),
), ),
], ],
); );

@ -66,7 +66,7 @@ class ChatSearchView extends StatelessWidget {
controller: controller.tabController, controller: controller.tabController,
tabs: [ tabs: [
Tab(child: Text(L10n.of(context)!.messages)), Tab(child: Text(L10n.of(context)!.messages)),
Tab(child: Text(L10n.of(context)!.photos)), Tab(child: Text(L10n.of(context)!.gallery)),
Tab(child: Text(L10n.of(context)!.files)), Tab(child: Text(L10n.of(context)!.files)),
], ],
), ),

Loading…
Cancel
Save