mirror of
https://github.com/twonlyapp/twonly-app.git
synced 2026-03-03 16:46:47 +00:00
feature: Show link in chat if the saved media file contains one
Some checks are pending
Flutter analyze & test / flutter_analyze_and_test (push) Waiting to run
Some checks are pending
Flutter analyze & test / flutter_analyze_and_test (push) Waiting to run
This commit is contained in:
parent
ca62069652
commit
e9ea0a7f16
2 changed files with 75 additions and 23 deletions
|
|
@ -1,7 +1,8 @@
|
||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
## 0.0.94
|
## 0.0.95
|
||||||
|
|
||||||
|
Feature: Show link in chat if the saved media file contains one
|
||||||
Fix: Problem with decrypting messages fixed
|
Fix: Problem with decrypting messages fixed
|
||||||
|
|
||||||
## 0.0.93
|
## 0.0.93
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,7 @@ import 'package:twonly/src/database/tables/mediafiles.table.dart';
|
||||||
import 'package:twonly/src/database/tables/messages.table.dart';
|
import 'package:twonly/src/database/tables/messages.table.dart';
|
||||||
import 'package:twonly/src/database/twonly.db.dart';
|
import 'package:twonly/src/database/twonly.db.dart';
|
||||||
import 'package:twonly/src/model/memory_item.model.dart';
|
import 'package:twonly/src/model/memory_item.model.dart';
|
||||||
|
import 'package:twonly/src/model/protobuf/client/generated/data.pb.dart';
|
||||||
import 'package:twonly/src/model/protobuf/client/generated/messages.pb.dart'
|
import 'package:twonly/src/model/protobuf/client/generated/messages.pb.dart'
|
||||||
hide Message;
|
hide Message;
|
||||||
import 'package:twonly/src/services/api/mediafiles/download.service.dart'
|
import 'package:twonly/src/services/api/mediafiles/download.service.dart'
|
||||||
|
|
@ -13,8 +14,10 @@ import 'package:twonly/src/services/api/mediafiles/download.service.dart'
|
||||||
import 'package:twonly/src/services/api/messages.dart';
|
import 'package:twonly/src/services/api/messages.dart';
|
||||||
import 'package:twonly/src/services/mediafiles/mediafile.service.dart';
|
import 'package:twonly/src/services/mediafiles/mediafile.service.dart';
|
||||||
import 'package:twonly/src/utils/misc.dart';
|
import 'package:twonly/src/utils/misc.dart';
|
||||||
|
import 'package:twonly/src/views/chats/chat_messages_components/entries/common.dart';
|
||||||
import 'package:twonly/src/views/chats/chat_messages_components/in_chat_media_viewer.dart';
|
import 'package:twonly/src/views/chats/chat_messages_components/in_chat_media_viewer.dart';
|
||||||
import 'package:twonly/src/views/chats/media_viewer.view.dart';
|
import 'package:twonly/src/views/chats/media_viewer.view.dart';
|
||||||
|
import 'package:twonly/src/views/components/better_text.dart';
|
||||||
|
|
||||||
class ChatMediaEntry extends StatefulWidget {
|
class ChatMediaEntry extends StatefulWidget {
|
||||||
const ChatMediaEntry({
|
const ChatMediaEntry({
|
||||||
|
|
@ -114,31 +117,79 @@ class _ChatMediaEntryState extends State<ChatMediaEntry> {
|
||||||
context,
|
context,
|
||||||
);
|
);
|
||||||
|
|
||||||
return GestureDetector(
|
var imageBorderRadius = BorderRadius.circular(12);
|
||||||
key: reopenMediaFile,
|
|
||||||
onDoubleTap: onDoubleTap,
|
Widget additionalMessageData = Container();
|
||||||
onTap: (widget.message.type == MessageType.media.name) ? onTap : null,
|
|
||||||
child: SizedBox(
|
final addData = widget.message.additionalMessageData;
|
||||||
width: (widget.minWidth > 150) ? widget.minWidth : 150,
|
if (addData != null) {
|
||||||
height: (widget.message.mediaStored &&
|
final info =
|
||||||
widget.mediaService.imagePreviewAvailable)
|
getBubbleInfo(context, widget.message, null, null, null, 200);
|
||||||
? 271
|
final data = AdditionalMessageData.fromBuffer(addData);
|
||||||
: null,
|
if (data.hasLink()) {
|
||||||
child: Align(
|
imageBorderRadius = const BorderRadius.only(
|
||||||
alignment: Alignment.centerRight,
|
topLeft: Radius.circular(12),
|
||||||
child: ClipRRect(
|
topRight: Radius.circular(12),
|
||||||
borderRadius: BorderRadius.circular(12),
|
bottomLeft: Radius.circular(5),
|
||||||
child: InChatMediaViewer(
|
bottomRight: Radius.circular(5),
|
||||||
message: widget.message,
|
);
|
||||||
group: widget.group,
|
|
||||||
mediaService: widget.mediaService,
|
additionalMessageData = Container(
|
||||||
color: color,
|
constraints: BoxConstraints(
|
||||||
galleryItems: widget.galleryItems,
|
maxWidth: MediaQuery.of(context).size.width * 0.8,
|
||||||
canBeReopened: _canBeReopened,
|
),
|
||||||
|
padding:
|
||||||
|
const EdgeInsets.only(left: 10, top: 6, bottom: 6, right: 10),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: info.color,
|
||||||
|
borderRadius: const BorderRadius.only(
|
||||||
|
topLeft: Radius.circular(5),
|
||||||
|
topRight: Radius.circular(12),
|
||||||
|
bottomLeft: Radius.circular(12),
|
||||||
|
bottomRight: Radius.circular(12),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
child: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
BetterText(text: data.link, textColor: info.textColor),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
GestureDetector(
|
||||||
|
key: reopenMediaFile,
|
||||||
|
onDoubleTap: onDoubleTap,
|
||||||
|
onTap: (widget.message.type == MessageType.media.name) ? onTap : null,
|
||||||
|
child: SizedBox(
|
||||||
|
width: (widget.minWidth > 150) ? widget.minWidth : 150,
|
||||||
|
height: (widget.message.mediaStored &&
|
||||||
|
widget.mediaService.imagePreviewAvailable)
|
||||||
|
? 271
|
||||||
|
: null,
|
||||||
|
child: Align(
|
||||||
|
alignment: Alignment.centerRight,
|
||||||
|
child: ClipRRect(
|
||||||
|
borderRadius: imageBorderRadius,
|
||||||
|
child: InChatMediaViewer(
|
||||||
|
message: widget.message,
|
||||||
|
group: widget.group,
|
||||||
|
mediaService: widget.mediaService,
|
||||||
|
color: color,
|
||||||
|
galleryItems: widget.galleryItems,
|
||||||
|
canBeReopened: _canBeReopened,
|
||||||
|
),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
additionalMessageData,
|
||||||
|
],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue