mirror of
https://github.com/twonlyapp/twonly-app.git
synced 2026-01-15 14:28:40 +00:00
fixing multiple bugs
This commit is contained in:
parent
7fe0f16a5c
commit
c67bd6b464
4 changed files with 63 additions and 34 deletions
|
|
@ -10,13 +10,13 @@ This repository contains the complete source code of the [twonly](https://twonly
|
||||||
- End-to-End encryption using the [Signal Protocol](https://de.wikipedia.org/wiki/Signal-Protokoll)
|
- End-to-End encryption using the [Signal Protocol](https://de.wikipedia.org/wiki/Signal-Protokoll)
|
||||||
- No email or phone number required to register
|
- No email or phone number required to register
|
||||||
- Privacy friendly - Everything is stored on the device
|
- Privacy friendly - Everything is stored on the device
|
||||||
|
- Open-Source
|
||||||
|
|
||||||
## In work
|
## In work
|
||||||
|
|
||||||
- For Android: Using [UnifiedPush](https://unifiedpush.org/) instead of FCM
|
- For Android: Using [UnifiedPush](https://unifiedpush.org/) instead of FCM
|
||||||
- For Android: Reproducible Builds + Publishing on Github/F-Droid
|
- For Android: Reproducible Builds + Publishing F-Droid
|
||||||
- Implementing [Sealed Sender](https://signal.org/blog/sealed-sender/) to minimize metadata
|
- Implementing [Sealed Sender](https://signal.org/blog/sealed-sender/) to minimize metadata
|
||||||
- Maybe: Switching from the Signal Protocol to [MLS](https://openmls.tech/).
|
|
||||||
|
|
||||||
## Security Issues
|
## Security Issues
|
||||||
If you discover a security issue in twonly, please adhere to the coordinated vulnerability disclosure model. Please send
|
If you discover a security issue in twonly, please adhere to the coordinated vulnerability disclosure model. Please send
|
||||||
|
|
@ -33,8 +33,6 @@ guarantee a bounty currently :/
|
||||||
Some dependencies are downloaded directly from the source as there are some new changes which are not yet published on
|
Some dependencies are downloaded directly from the source as there are some new changes which are not yet published on
|
||||||
pub.dev or because they require some special installation.
|
pub.dev or because they require some special installation.
|
||||||
|
|
||||||
- `flutter_secure_storage`: We need the 10.0.0-beta version, but this version has some issues which are fixed but [not yet published](https://github.com/juliansteenbakker/flutter_secure_storage/issues/866):
|
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
git submodule update --init --recursive
|
git submodule update --init --recursive
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,6 @@ import 'package:flutter/material.dart';
|
||||||
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||||
import 'package:twonly/globals.dart';
|
import 'package:twonly/globals.dart';
|
||||||
import 'package:twonly/src/database/daos/groups.dao.dart';
|
import 'package:twonly/src/database/daos/groups.dao.dart';
|
||||||
import 'package:twonly/src/database/tables/mediafiles.table.dart';
|
|
||||||
import 'package:twonly/src/database/twonly.db.dart';
|
import 'package:twonly/src/database/twonly.db.dart';
|
||||||
import 'package:twonly/src/services/api/mediafiles/upload.service.dart';
|
import 'package:twonly/src/services/api/mediafiles/upload.service.dart';
|
||||||
import 'package:twonly/src/services/mediafiles/mediafile.service.dart';
|
import 'package:twonly/src/services/mediafiles/mediafile.service.dart';
|
||||||
|
|
@ -65,7 +64,6 @@ class _ShareImageView extends State<ShareImageView> {
|
||||||
await widget.mediaStoreFuture;
|
await widget.mediaStoreFuture;
|
||||||
}
|
}
|
||||||
mediaStoreFutureReady = true;
|
mediaStoreFutureReady = true;
|
||||||
await widget.mediaFileService.setUploadState(UploadState.preprocessing);
|
|
||||||
unawaited(startBackgroundMediaUpload(widget.mediaFileService));
|
unawaited(startBackgroundMediaUpload(widget.mediaFileService));
|
||||||
if (!mounted) return;
|
if (!mounted) return;
|
||||||
setState(() {});
|
setState(() {});
|
||||||
|
|
|
||||||
|
|
@ -36,7 +36,30 @@ class ChatMediaEntry extends StatefulWidget {
|
||||||
|
|
||||||
class _ChatMediaEntryState extends State<ChatMediaEntry> {
|
class _ChatMediaEntryState extends State<ChatMediaEntry> {
|
||||||
GlobalKey reopenMediaFile = GlobalKey();
|
GlobalKey reopenMediaFile = GlobalKey();
|
||||||
bool canBeReopened = false;
|
bool _canBeReopened = false;
|
||||||
|
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
super.initState();
|
||||||
|
unawaited(initAsync());
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> initAsync() async {
|
||||||
|
if (widget.message.senderId == null || widget.message.mediaStored) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (widget.mediaService.mediaFile.requiresAuthentication ||
|
||||||
|
widget.mediaService.mediaFile.displayLimitInMilliseconds != null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (widget.mediaService.tempPath.existsSync()) {
|
||||||
|
if (mounted) {
|
||||||
|
setState(() {
|
||||||
|
_canBeReopened = true;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Future<void> onDoubleTap() async {
|
Future<void> onDoubleTap() async {
|
||||||
if (widget.message.openedAt == null || widget.message.mediaStored) {
|
if (widget.message.openedAt == null || widget.message.mediaStored) {
|
||||||
|
|
@ -109,7 +132,7 @@ class _ChatMediaEntryState extends State<ChatMediaEntry> {
|
||||||
mediaService: widget.mediaService,
|
mediaService: widget.mediaService,
|
||||||
color: color,
|
color: color,
|
||||||
galleryItems: widget.galleryItems,
|
galleryItems: widget.galleryItems,
|
||||||
canBeReopened: canBeReopened,
|
canBeReopened: _canBeReopened,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:twonly/globals.dart';
|
import 'package:twonly/globals.dart';
|
||||||
|
import 'package:twonly/src/database/daos/contacts.dao.dart';
|
||||||
import 'package:twonly/src/database/tables/mediafiles.table.dart';
|
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';
|
||||||
|
|
@ -128,22 +129,34 @@ class ResponsePreview extends StatefulWidget {
|
||||||
}
|
}
|
||||||
|
|
||||||
class _ResponsePreviewState extends State<ResponsePreview> {
|
class _ResponsePreviewState extends State<ResponsePreview> {
|
||||||
Message? message;
|
Message? _message;
|
||||||
MediaFileService? mediaService;
|
MediaFileService? _mediaService;
|
||||||
|
String _username = '';
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
message = widget.message;
|
_message = widget.message;
|
||||||
initAsync();
|
initAsync();
|
||||||
super.initState();
|
super.initState();
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> initAsync() async {
|
Future<void> initAsync() async {
|
||||||
message ??= await twonlyDB.messagesDao
|
_message ??= await twonlyDB.messagesDao
|
||||||
.getMessageById(widget.messageId!)
|
.getMessageById(widget.messageId!)
|
||||||
.getSingleOrNull();
|
.getSingleOrNull();
|
||||||
if (message?.mediaId != null) {
|
if (_message?.mediaId != null) {
|
||||||
mediaService = await MediaFileService.fromMediaId(message!.mediaId!);
|
_mediaService = await MediaFileService.fromMediaId(_message!.mediaId!);
|
||||||
|
}
|
||||||
|
if (_message?.senderId != null) {
|
||||||
|
final contact = await twonlyDB.contactsDao
|
||||||
|
.getContactByUserId(_message!.senderId!)
|
||||||
|
.getSingleOrNull();
|
||||||
|
if (contact != null) {
|
||||||
|
_username = getContactDisplayName(contact);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (_message == null && mounted) {
|
||||||
|
_username = context.lang.quotedMessageWasDeleted;
|
||||||
}
|
}
|
||||||
if (mounted) setState(() {});
|
if (mounted) setState(() {});
|
||||||
}
|
}
|
||||||
|
|
@ -152,28 +165,27 @@ class _ResponsePreviewState extends State<ResponsePreview> {
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
String? subtitle;
|
String? subtitle;
|
||||||
var color = const Color.fromARGB(233, 68, 137, 255);
|
var color = const Color.fromARGB(233, 68, 137, 255);
|
||||||
var username = '';
|
|
||||||
|
|
||||||
if (message != null) {
|
if (_message != null) {
|
||||||
if (message!.type == MessageType.text) {
|
if (_message!.type == MessageType.text) {
|
||||||
if (message!.content != null) {
|
if (_message!.content != null) {
|
||||||
subtitle = truncateString(message!.content!);
|
subtitle = truncateString(_message!.content!);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (message!.type == MessageType.media && mediaService != null) {
|
if (_message!.type == MessageType.media && _mediaService != null) {
|
||||||
subtitle = mediaService!.mediaFile.type == MediaType.video
|
subtitle = _mediaService!.mediaFile.type == MediaType.video
|
||||||
? context.lang.video
|
? context.lang.video
|
||||||
: context.lang.image;
|
: context.lang.image;
|
||||||
}
|
}
|
||||||
|
|
||||||
username = context.lang.you;
|
if (_message!.senderId == null) {
|
||||||
if (message!.senderId != null) {
|
_username = context.lang.you;
|
||||||
username = message!.senderId.toString();
|
// _username = _message!.senderId.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
color = getMessageColor(message!);
|
color = getMessageColor(_message!);
|
||||||
|
|
||||||
if (!message!.mediaStored) {
|
if (!_message!.mediaStored) {
|
||||||
return Container(
|
return Container(
|
||||||
padding: widget.showBorder
|
padding: widget.showBorder
|
||||||
? const EdgeInsets.only(left: 10, right: 10)
|
? const EdgeInsets.only(left: 10, right: 10)
|
||||||
|
|
@ -192,7 +204,7 @@ class _ResponsePreviewState extends State<ResponsePreview> {
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
Text(
|
Text(
|
||||||
username,
|
_username,
|
||||||
style: const TextStyle(fontWeight: FontWeight.bold),
|
style: const TextStyle(fontWeight: FontWeight.bold),
|
||||||
),
|
),
|
||||||
if (subtitle != null) Text(subtitle),
|
if (subtitle != null) Text(subtitle),
|
||||||
|
|
@ -200,8 +212,6 @@ class _ResponsePreviewState extends State<ResponsePreview> {
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
username = context.lang.quotedMessageWasDeleted;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return Container(
|
return Container(
|
||||||
|
|
@ -222,20 +232,20 @@ class _ResponsePreviewState extends State<ResponsePreview> {
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
Text(
|
Text(
|
||||||
username,
|
_username,
|
||||||
style: const TextStyle(fontWeight: FontWeight.bold),
|
style: const TextStyle(fontWeight: FontWeight.bold),
|
||||||
),
|
),
|
||||||
if (subtitle != null) Text(subtitle),
|
if (subtitle != null) Text(subtitle),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
if (mediaService != null)
|
if (_mediaService != null)
|
||||||
SizedBox(
|
SizedBox(
|
||||||
height: widget.showBorder ? 100 : 210,
|
height: widget.showBorder ? 100 : 210,
|
||||||
child: Image.file(
|
child: Image.file(
|
||||||
mediaService!.mediaFile.type == MediaType.video
|
_mediaService!.mediaFile.type == MediaType.video
|
||||||
? mediaService!.thumbnailPath
|
? _mediaService!.thumbnailPath
|
||||||
: mediaService!.storedPath,
|
: _mediaService!.storedPath,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue