в поле ввода соо динамично показывается что мы и как отметили, форматированные соо не отправляются при шифровании
This commit is contained in:
@@ -433,6 +433,8 @@ class _ChatScreenState extends State<ChatScreen> {
|
|||||||
bool _sendEncryptedForCurrentChat = false;
|
bool _sendEncryptedForCurrentChat = false;
|
||||||
bool _specialMessagesEnabled = false;
|
bool _specialMessagesEnabled = false;
|
||||||
|
|
||||||
|
bool _formatWarningVisible = false;
|
||||||
|
|
||||||
bool _showKometColorPicker = false;
|
bool _showKometColorPicker = false;
|
||||||
String? _currentKometColorPrefix;
|
String? _currentKometColorPrefix;
|
||||||
|
|
||||||
@@ -1948,6 +1950,16 @@ class _ChatScreenState extends State<ChatScreen> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void _applyTextFormat(String type) {
|
void _applyTextFormat(String type) {
|
||||||
|
final isEncryptionActive =
|
||||||
|
_encryptionConfigForCurrentChat != null &&
|
||||||
|
_encryptionConfigForCurrentChat!.password.isNotEmpty &&
|
||||||
|
_sendEncryptedForCurrentChat;
|
||||||
|
if (isEncryptionActive) {
|
||||||
|
setState(() {
|
||||||
|
_formatWarningVisible = true;
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
final selection = _textController.selection;
|
final selection = _textController.selection;
|
||||||
if (!selection.isValid || selection.isCollapsed) return;
|
if (!selection.isValid || selection.isCollapsed) return;
|
||||||
final from = selection.start;
|
final from = selection.start;
|
||||||
@@ -4320,7 +4332,6 @@ class _ChatScreenState extends State<ChatScreen> {
|
|||||||
),
|
),
|
||||||
const SizedBox(height: 4),
|
const SizedBox(height: 4),
|
||||||
Row(
|
Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.start,
|
|
||||||
children: [
|
children: [
|
||||||
IconButton(
|
IconButton(
|
||||||
iconSize: 18,
|
iconSize: 18,
|
||||||
@@ -4371,6 +4382,28 @@ class _ChatScreenState extends State<ChatScreen> {
|
|||||||
),
|
),
|
||||||
tooltip: 'Зачеркнуть',
|
tooltip: 'Зачеркнуть',
|
||||||
),
|
),
|
||||||
|
const SizedBox(width: 8),
|
||||||
|
Expanded(
|
||||||
|
child: AnimatedOpacity(
|
||||||
|
opacity: _formatWarningVisible
|
||||||
|
? 1
|
||||||
|
: 0,
|
||||||
|
duration: const Duration(
|
||||||
|
milliseconds: 200,
|
||||||
|
),
|
||||||
|
child: Text(
|
||||||
|
'Форматирование не доступно в шифрованных сообщениях.',
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 11,
|
||||||
|
color: Theme.of(
|
||||||
|
context,
|
||||||
|
).colorScheme.error,
|
||||||
|
),
|
||||||
|
maxLines: 2,
|
||||||
|
overflow: TextOverflow.ellipsis,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ class ChatEncryptionConfig {
|
|||||||
factory ChatEncryptionConfig.fromJson(Map<String, dynamic> json) {
|
factory ChatEncryptionConfig.fromJson(Map<String, dynamic> json) {
|
||||||
return ChatEncryptionConfig(
|
return ChatEncryptionConfig(
|
||||||
password: (json['password'] as String?) ?? '',
|
password: (json['password'] as String?) ?? '',
|
||||||
sendEncrypted: (json['sendEncrypted'] as bool?) ?? false,
|
sendEncrypted: (json['sendEncrypted'] as bool?) ?? true,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -54,7 +54,7 @@ class ChatEncryptionService {
|
|||||||
if (legacyPassword != null && legacyPassword.isNotEmpty) {
|
if (legacyPassword != null && legacyPassword.isNotEmpty) {
|
||||||
final legacyConfig = ChatEncryptionConfig(
|
final legacyConfig = ChatEncryptionConfig(
|
||||||
password: legacyPassword,
|
password: legacyPassword,
|
||||||
sendEncrypted: false,
|
sendEncrypted: true,
|
||||||
);
|
);
|
||||||
await _saveConfig(chatId, legacyConfig);
|
await _saveConfig(chatId, legacyConfig);
|
||||||
return legacyConfig;
|
return legacyConfig;
|
||||||
|
|||||||
Reference in New Issue
Block a user