This commit is contained in:
otsmr 2025-12-29 23:06:09 +01:00
parent 3899c8e6e4
commit b3c25dd160
11 changed files with 71 additions and 5 deletions

View file

@ -462,5 +462,7 @@
"verifiedPublicKey": "Der öffentliche Schlüssel von {username} wurde überprüft und ist gültig.", "verifiedPublicKey": "Der öffentliche Schlüssel von {username} wurde überprüft und ist gültig.",
"memoriesAYearAgo": "Vor einem Jahr", "memoriesAYearAgo": "Vor einem Jahr",
"memoriesXYearsAgo": "Vor {years} Jahren", "memoriesXYearsAgo": "Vor {years} Jahren",
"migrationOfMemories": "Migration von Mediendateien: {open} noch offen." "migrationOfMemories": "Migration von Mediendateien: {open} noch offen.",
"autoStoreAllSendUnlimitedMediaFiles": "Alle gesendeten Medien speichern",
"autoStoreAllSendUnlimitedMediaFilesSubtitle": "Wenn du diese Option aktivierst, werden alle Bilder, die du sendest, gespeichert, sofern sie mit einem unendlichen Countdown und nicht im twonly-Modus gesendet wurden."
} }

View file

@ -492,5 +492,7 @@
"verifiedPublicKey": "The public key of {username} has been verified and is valid.", "verifiedPublicKey": "The public key of {username} has been verified and is valid.",
"memoriesAYearAgo": "One year ago", "memoriesAYearAgo": "One year ago",
"memoriesXYearsAgo": "{years} years ago", "memoriesXYearsAgo": "{years} years ago",
"migrationOfMemories": "Migration of media files: {open} still to be processed." "migrationOfMemories": "Migration of media files: {open} still to be processed.",
"autoStoreAllSendUnlimitedMediaFiles": "Save all sent media",
"autoStoreAllSendUnlimitedMediaFilesSubtitle": "If you enable this option, all images you send will be saved as long as they were sent with an infinite countdown and not in twonly mode."
} }

View file

@ -2875,6 +2875,18 @@ abstract class AppLocalizations {
/// In en, this message translates to: /// In en, this message translates to:
/// **'Migration of media files: {open} still to be processed.'** /// **'Migration of media files: {open} still to be processed.'**
String migrationOfMemories(Object open); String migrationOfMemories(Object open);
/// No description provided for @autoStoreAllSendUnlimitedMediaFiles.
///
/// In en, this message translates to:
/// **'Save all sent media'**
String get autoStoreAllSendUnlimitedMediaFiles;
/// No description provided for @autoStoreAllSendUnlimitedMediaFilesSubtitle.
///
/// In en, this message translates to:
/// **'If you enable this option, all images you send will be saved as long as they were sent with an infinite countdown and not in twonly mode.'**
String get autoStoreAllSendUnlimitedMediaFilesSubtitle;
} }
class _AppLocalizationsDelegate class _AppLocalizationsDelegate

View file

@ -1595,4 +1595,12 @@ class AppLocalizationsDe extends AppLocalizations {
String migrationOfMemories(Object open) { String migrationOfMemories(Object open) {
return 'Migration von Mediendateien: $open noch offen.'; return 'Migration von Mediendateien: $open noch offen.';
} }
@override
String get autoStoreAllSendUnlimitedMediaFiles =>
'Alle gesendeten Medien speichern';
@override
String get autoStoreAllSendUnlimitedMediaFilesSubtitle =>
'Wenn du diese Option aktivierst, werden alle Bilder, die du sendest, gespeichert, sofern sie mit einem unendlichen Countdown und nicht im twonly-Modus gesendet wurden.';
} }

View file

@ -1585,4 +1585,11 @@ class AppLocalizationsEn extends AppLocalizations {
String migrationOfMemories(Object open) { String migrationOfMemories(Object open) {
return 'Migration of media files: $open still to be processed.'; return 'Migration of media files: $open still to be processed.';
} }
@override
String get autoStoreAllSendUnlimitedMediaFiles => 'Save all sent media';
@override
String get autoStoreAllSendUnlimitedMediaFilesSubtitle =>
'If you enable this option, all images you send will be saved as long as they were sent with an infinite countdown and not in twonly mode.';
} }

View file

@ -72,6 +72,9 @@ class UserData {
@JsonKey(defaultValue: false) @JsonKey(defaultValue: false)
bool storeMediaFilesInGallery = false; bool storeMediaFilesInGallery = false;
@JsonKey(defaultValue: false)
bool autoStoreAllSendUnlimitedMediaFiles = false;
String? lastPlanBallance; String? lastPlanBallance;
String? additionalUserInvites; String? additionalUserInvites;

View file

@ -33,7 +33,7 @@ UserData _$UserDataFromJson(Map<String, dynamic> json) => UserData(
json['requestedAudioPermission'] as bool? ?? false json['requestedAudioPermission'] as bool? ?? false
..showFeedbackShortcut = json['showFeedbackShortcut'] as bool? ?? true ..showFeedbackShortcut = json['showFeedbackShortcut'] as bool? ?? true
..showShowImagePreviewWhenSending = ..showShowImagePreviewWhenSending =
json['showShowImagePreviewWhenSending'] as bool? ?? true json['showShowImagePreviewWhenSending'] as bool? ?? false
..startWithCameraOpen = json['startWithCameraOpen'] as bool? ?? true ..startWithCameraOpen = json['startWithCameraOpen'] as bool? ?? true
..preSelectedEmojies = (json['preSelectedEmojies'] as List<dynamic>?) ..preSelectedEmojies = (json['preSelectedEmojies'] as List<dynamic>?)
?.map((e) => e as String) ?.map((e) => e as String)
@ -45,6 +45,8 @@ UserData _$UserDataFromJson(Map<String, dynamic> json) => UserData(
) )
..storeMediaFilesInGallery = ..storeMediaFilesInGallery =
json['storeMediaFilesInGallery'] as bool? ?? false json['storeMediaFilesInGallery'] as bool? ?? false
..autoStoreAllSendUnlimitedMediaFiles =
json['autoStoreAllSendUnlimitedMediaFiles'] as bool? ?? false
..lastPlanBallance = json['lastPlanBallance'] as String? ..lastPlanBallance = json['lastPlanBallance'] as String?
..additionalUserInvites = json['additionalUserInvites'] as String? ..additionalUserInvites = json['additionalUserInvites'] as String?
..tutorialDisplayed = (json['tutorialDisplayed'] as List<dynamic>?) ..tutorialDisplayed = (json['tutorialDisplayed'] as List<dynamic>?)
@ -102,6 +104,8 @@ Map<String, dynamic> _$UserDataToJson(UserData instance) => <String, dynamic>{
'preSelectedEmojies': instance.preSelectedEmojies, 'preSelectedEmojies': instance.preSelectedEmojies,
'autoDownloadOptions': instance.autoDownloadOptions, 'autoDownloadOptions': instance.autoDownloadOptions,
'storeMediaFilesInGallery': instance.storeMediaFilesInGallery, 'storeMediaFilesInGallery': instance.storeMediaFilesInGallery,
'autoStoreAllSendUnlimitedMediaFiles':
instance.autoStoreAllSendUnlimitedMediaFiles,
'lastPlanBallance': instance.lastPlanBallance, 'lastPlanBallance': instance.lastPlanBallance,
'additionalUserInvites': instance.additionalUserInvites, 'additionalUserInvites': instance.additionalUserInvites,
'tutorialDisplayed': instance.tutorialDisplayed, 'tutorialDisplayed': instance.tutorialDisplayed,

View file

@ -132,6 +132,15 @@ Future<void> startBackgroundMediaUpload(MediaFileService mediaService) async {
} }
} }
// if the user has enabled auto storing and the file
// was send with unlimited counter not in twonly-Mode then store the file
if (gUser.autoStoreAllSendUnlimitedMediaFiles &&
!mediaService.mediaFile.requiresAuthentication &&
!mediaService.storedPath.existsSync() &&
mediaService.mediaFile.displayLimitInMilliseconds == null) {
await mediaService.storeMediaFile();
}
if (!mediaService.encryptedPath.existsSync()) { if (!mediaService.encryptedPath.existsSync()) {
await _encryptMediaFiles(mediaService); await _encryptMediaFiles(mediaService);
if (!mediaService.encryptedPath.existsSync()) { if (!mediaService.encryptedPath.existsSync()) {

View file

@ -46,6 +46,15 @@ class _DataAndStorageViewState extends State<DataAndStorageView> {
setState(() {}); setState(() {});
} }
Future<void> toggleAutoStoreMediaFiles() async {
await updateUserdata((u) {
u.autoStoreAllSendUnlimitedMediaFiles =
!u.autoStoreAllSendUnlimitedMediaFiles;
return u;
});
setState(() {});
}
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final autoDownloadOptions = final autoDownloadOptions =
@ -65,6 +74,18 @@ class _DataAndStorageViewState extends State<DataAndStorageView> {
onChanged: (a) => toggleStoreInGallery(), onChanged: (a) => toggleStoreInGallery(),
), ),
), ),
ListTile(
title: Text(context.lang.autoStoreAllSendUnlimitedMediaFiles),
subtitle: Text(
context.lang.autoStoreAllSendUnlimitedMediaFilesSubtitle,
style: const TextStyle(fontSize: 9),
),
onTap: toggleAutoStoreMediaFiles,
trailing: Switch(
value: gUser.autoStoreAllSendUnlimitedMediaFiles,
onChanged: (a) => toggleAutoStoreMediaFiles(),
),
),
if (Platform.isAndroid) if (Platform.isAndroid)
ListTile( ListTile(
title: Text( title: Text(

View file

@ -3,7 +3,6 @@ import 'package:avatar_maker/avatar_maker.dart';
import 'package:flutter/material.dart'; 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/services/api/messages.dart';
import 'package:twonly/src/utils/misc.dart'; import 'package:twonly/src/utils/misc.dart';
import 'package:twonly/src/utils/storage.dart'; import 'package:twonly/src/utils/storage.dart';

View file

@ -5,7 +5,6 @@ import 'package:flutter/services.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/model/protobuf/api/websocket/error.pb.dart'; import 'package:twonly/src/model/protobuf/api/websocket/error.pb.dart';
import 'package:twonly/src/services/api/messages.dart';
import 'package:twonly/src/services/twonly_safe/common.twonly_safe.dart'; import 'package:twonly/src/services/twonly_safe/common.twonly_safe.dart';
import 'package:twonly/src/services/twonly_safe/create_backup.twonly_safe.dart'; import 'package:twonly/src/services/twonly_safe/create_backup.twonly_safe.dart';
import 'package:twonly/src/utils/misc.dart'; import 'package:twonly/src/utils/misc.dart';