bump version

This commit is contained in:
otsmr 2025-07-14 12:01:06 +02:00
parent 37b11cef79
commit 0eda03537c
5 changed files with 37 additions and 39 deletions

View file

@ -66,6 +66,15 @@ class MessageRetransmissionDao extends DatabaseAccessor<TwonlyDatabase>
);
}
Future<MessageRetransmission?> getRetransmissionFromHash(
int fromUserId, Uint8List encryptedHash) async {
return ((select(messageRetransmissions))
..where((m) =>
m.contactId.equals(fromUserId) &
m.encryptedHash.equals(encryptedHash)))
.getSingleOrNull();
}
Future deleteRetransmissionById(int retransmissionId) {
return (delete(messageRetransmissions)
..where((t) => t.retransmissionId.equals(retransmissionId)))

View file

@ -32,14 +32,12 @@ Future tryTransmitMessages() async {
if (retransIds.isEmpty) return;
for (final retransId in retransIds) {
sendRetransmitMessage(retransId, fromRetransmissionDb: true);
//twonlyDB.messageRetransmissionDao.deleteRetransmissionById(retransId);
await sendRetransmitMessage(retransId);
}
});
}
Future sendRetransmitMessage(int retransId,
{bool fromRetransmissionDb = false}) async {
Future sendRetransmitMessage(int retransId) async {
try {
MessageRetransmission? retrans = await twonlyDB.messageRetransmissionDao
.getRetransmissionById(retransId)
@ -63,14 +61,6 @@ Future sendRetransmitMessage(int retransId,
),
);
DateTime timestampToCheck = DateTime.parse("2025-07-14T00:36:00");
if (json.timestamp.isBefore(timestampToCheck)) {
Log.info("Ignoring retransmission because it is before the update...");
await twonlyDB.messageRetransmissionDao
.deleteRetransmissionById(retransId);
return;
}
Log.info("Retransmitting $retransId: ${json.kind} to ${retrans.contactId}");
Contact? contact = await twonlyDB.contactsDao

View file

@ -132,11 +132,16 @@ Future<client.Response> handleNewMessage(int fromUserId, Uint8List body) async {
final content = message.content;
if (content is SignalDecryptErrorContent) {
final hash = Uint8List.fromList(content.encryptedHash);
await twonlyDB.messageRetransmissionDao.resetAckStatusFor(
fromUserId,
Uint8List.fromList(content.encryptedHash),
hash,
);
tryTransmitMessages();
final message = await twonlyDB.messageRetransmissionDao
.getRetransmissionFromHash(fromUserId, hash);
if (message != null) {
sendRetransmitMessage(message.retransmissionId);
}
}
break;

View file

@ -19,7 +19,6 @@ import 'package:twonly/src/views/camera/camera_send_to_view.dart';
import 'package:twonly/src/views/camera/image_editor/action_button.dart';
import 'package:twonly/src/views/components/media_view_sizing.dart';
import 'package:twonly/src/views/camera/camera_preview_components/permissions_view.dart';
import 'package:twonly/src/utils/storage.dart';
import 'package:twonly/src/views/camera/share_image_editor_view.dart';
import 'package:twonly/src/views/home.view.dart';
@ -143,7 +142,6 @@ class _CameraPreviewViewState extends State<CameraPreviewView> {
double basePanY = 0;
double baseScaleFactor = 0;
bool cameraLoaded = false;
bool useHighQuality = false;
bool isVideoRecording = false;
bool hasAudioPermission = true;
bool videoWithAudio = true;
@ -174,9 +172,6 @@ class _CameraPreviewViewState extends State<CameraPreviewView> {
: CameraSendToViewState.screenshotController;
void initAsync() async {
final user = await getUser();
if (user == null) return;
useHighQuality = user.useHighQuality;
hasAudioPermission = await Permission.microphone.isGranted;
if (!mounted) return;
setState(() {});
@ -258,8 +253,7 @@ class _CameraPreviewViewState extends State<CameraPreviewView> {
cameraController?.setFlashMode(
selectedCameraDetails.isFlashOn ? FlashMode.always : FlashMode.off);
imageBytes = screenshotController.capture(
pixelRatio:
(useHighQuality) ? MediaQuery.of(context).devicePixelRatio : 1);
pixelRatio: MediaQuery.of(context).devicePixelRatio);
if (await pushMediaEditor(imageBytes, null)) {
return;
@ -279,7 +273,7 @@ class _CameraPreviewViewState extends State<CameraPreviewView> {
sharedFromGallery: sharedFromGallery,
sendTo: widget.sendTo,
mirrorVideo: isFront && Platform.isAndroid,
useHighQuality: useHighQuality,
useHighQuality: true,
),
transitionsBuilder: (context, animation, secondaryAnimation, child) {
return child;
@ -546,22 +540,22 @@ class _CameraPreviewViewState extends State<CameraPreviewView> {
setState(() {});
},
),
if (!isFront)
ActionButton(
Icons.hd_rounded,
tooltipText: context.lang.toggleHighQuality,
color: useHighQuality
? Colors.white
: Colors.white.withAlpha(160),
onPressed: () async {
useHighQuality = !useHighQuality;
setState(() {});
await updateUserdata((user) {
user.useHighQuality = useHighQuality;
return user;
});
},
),
// if (!isFront)
// ActionButton(
// Icons.hd_rounded,
// tooltipText: context.lang.toggleHighQuality,
// color: useHighQuality
// ? Colors.white
// : Colors.white.withAlpha(160),
// onPressed: () async {
// useHighQuality = !useHighQuality;
// setState(() {});
// await updateUserdata((user) {
// user.useHighQuality = useHighQuality;
// return user;
// });
// },
// ),
if (!hasAudioPermission)
ActionButton(
Icons.mic_off_rounded,

View file

@ -4,7 +4,7 @@ description: "twonly, a privacy-friendly way to connect with friends through sec
# Prevent accidental publishing to pub.dev.
publish_to: 'none'
version: 0.0.56+56
version: 0.0.57+57
environment:
sdk: ^3.6.0