mirror of
https://github.com/twonlyapp/twonly-app.git
synced 2026-01-15 06:28:41 +00:00
fix #364
This commit is contained in:
parent
3899c8e6e4
commit
b3c25dd160
11 changed files with 71 additions and 5 deletions
|
|
@ -462,5 +462,7 @@
|
|||
"verifiedPublicKey": "Der öffentliche Schlüssel von {username} wurde überprüft und ist gültig.",
|
||||
"memoriesAYearAgo": "Vor einem Jahr",
|
||||
"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."
|
||||
}
|
||||
|
|
@ -492,5 +492,7 @@
|
|||
"verifiedPublicKey": "The public key of {username} has been verified and is valid.",
|
||||
"memoriesAYearAgo": "One year 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."
|
||||
}
|
||||
|
|
@ -2875,6 +2875,18 @@ abstract class AppLocalizations {
|
|||
/// In en, this message translates to:
|
||||
/// **'Migration of media files: {open} still to be processed.'**
|
||||
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
|
||||
|
|
|
|||
|
|
@ -1595,4 +1595,12 @@ class AppLocalizationsDe extends AppLocalizations {
|
|||
String migrationOfMemories(Object open) {
|
||||
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.';
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1585,4 +1585,11 @@ class AppLocalizationsEn extends AppLocalizations {
|
|||
String migrationOfMemories(Object open) {
|
||||
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.';
|
||||
}
|
||||
|
|
|
|||
|
|
@ -72,6 +72,9 @@ class UserData {
|
|||
@JsonKey(defaultValue: false)
|
||||
bool storeMediaFilesInGallery = false;
|
||||
|
||||
@JsonKey(defaultValue: false)
|
||||
bool autoStoreAllSendUnlimitedMediaFiles = false;
|
||||
|
||||
String? lastPlanBallance;
|
||||
String? additionalUserInvites;
|
||||
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ UserData _$UserDataFromJson(Map<String, dynamic> json) => UserData(
|
|||
json['requestedAudioPermission'] as bool? ?? false
|
||||
..showFeedbackShortcut = json['showFeedbackShortcut'] as bool? ?? true
|
||||
..showShowImagePreviewWhenSending =
|
||||
json['showShowImagePreviewWhenSending'] as bool? ?? true
|
||||
json['showShowImagePreviewWhenSending'] as bool? ?? false
|
||||
..startWithCameraOpen = json['startWithCameraOpen'] as bool? ?? true
|
||||
..preSelectedEmojies = (json['preSelectedEmojies'] as List<dynamic>?)
|
||||
?.map((e) => e as String)
|
||||
|
|
@ -45,6 +45,8 @@ UserData _$UserDataFromJson(Map<String, dynamic> json) => UserData(
|
|||
)
|
||||
..storeMediaFilesInGallery =
|
||||
json['storeMediaFilesInGallery'] as bool? ?? false
|
||||
..autoStoreAllSendUnlimitedMediaFiles =
|
||||
json['autoStoreAllSendUnlimitedMediaFiles'] as bool? ?? false
|
||||
..lastPlanBallance = json['lastPlanBallance'] as String?
|
||||
..additionalUserInvites = json['additionalUserInvites'] as String?
|
||||
..tutorialDisplayed = (json['tutorialDisplayed'] as List<dynamic>?)
|
||||
|
|
@ -102,6 +104,8 @@ Map<String, dynamic> _$UserDataToJson(UserData instance) => <String, dynamic>{
|
|||
'preSelectedEmojies': instance.preSelectedEmojies,
|
||||
'autoDownloadOptions': instance.autoDownloadOptions,
|
||||
'storeMediaFilesInGallery': instance.storeMediaFilesInGallery,
|
||||
'autoStoreAllSendUnlimitedMediaFiles':
|
||||
instance.autoStoreAllSendUnlimitedMediaFiles,
|
||||
'lastPlanBallance': instance.lastPlanBallance,
|
||||
'additionalUserInvites': instance.additionalUserInvites,
|
||||
'tutorialDisplayed': instance.tutorialDisplayed,
|
||||
|
|
|
|||
|
|
@ -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()) {
|
||||
await _encryptMediaFiles(mediaService);
|
||||
if (!mediaService.encryptedPath.existsSync()) {
|
||||
|
|
|
|||
|
|
@ -46,6 +46,15 @@ class _DataAndStorageViewState extends State<DataAndStorageView> {
|
|||
setState(() {});
|
||||
}
|
||||
|
||||
Future<void> toggleAutoStoreMediaFiles() async {
|
||||
await updateUserdata((u) {
|
||||
u.autoStoreAllSendUnlimitedMediaFiles =
|
||||
!u.autoStoreAllSendUnlimitedMediaFiles;
|
||||
return u;
|
||||
});
|
||||
setState(() {});
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final autoDownloadOptions =
|
||||
|
|
@ -65,6 +74,18 @@ class _DataAndStorageViewState extends State<DataAndStorageView> {
|
|||
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)
|
||||
ListTile(
|
||||
title: Text(
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@ import 'package:avatar_maker/avatar_maker.dart';
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:font_awesome_flutter/font_awesome_flutter.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/storage.dart';
|
||||
|
||||
|
|
|
|||
|
|
@ -5,7 +5,6 @@ import 'package:flutter/services.dart';
|
|||
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||
import 'package:twonly/globals.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/create_backup.twonly_safe.dart';
|
||||
import 'package:twonly/src/utils/misc.dart';
|
||||
|
|
|
|||
Loading…
Reference in a new issue