update to zjs81/dev commit d5f54df
This commit is contained in:
commit
cf027c974f
64 files changed
+2972
-1129
No files matched your search
@@ -195,7 +195,12 @@ class ChannelMessageStore {
|
||||
replyToText: json['replyToText'] as String?,
|
||||
reactions:
|
||||
(json['reactions'] as Map<String, dynamic>?)?.map(
|
||||
(key, value) => MapEntry(key, value as int),
|
||||
(key, value) => MapEntry(
|
||||
key,
|
||||
(value is int)
|
||||
? List<String?>.filled(value, null)
|
||||
: List<String?>.from(value),
|
||||
),
|
||||
) ??
|
||||
{},
|
||||
);
|
||||
|
||||
@@ -4,6 +4,7 @@ import 'prefs_manager.dart';
|
||||
class ChannelSettingsStore {
|
||||
static const String _keyPrefix = 'channel_smaz_';
|
||||
static const String _cyr2latKeyPrefix = 'channel_cyr2lat_';
|
||||
static const String _urlImagesKeyPrefix = 'channel_url_images_';
|
||||
|
||||
String publicKeyHex = '';
|
||||
set setPublicKeyHex(String value) =>
|
||||
@@ -11,6 +12,7 @@ class ChannelSettingsStore {
|
||||
|
||||
String get keyFor => '$_keyPrefix$publicKeyHex';
|
||||
String get keyForCyr2Lat => '$_cyr2latKeyPrefix$publicKeyHex';
|
||||
String get keyForUrlImages => '$_urlImagesKeyPrefix$publicKeyHex';
|
||||
|
||||
Future<bool> loadSmazEnabled(int channelIndex) async {
|
||||
if (publicKeyHex.isEmpty) {
|
||||
@@ -73,6 +75,31 @@ class ChannelSettingsStore {
|
||||
await prefs.setBool(key, enabled);
|
||||
}
|
||||
|
||||
Future<bool> loadUrlImagesEnabled(int channelIndex) async {
|
||||
if (publicKeyHex.isEmpty) {
|
||||
appLogger.warn(
|
||||
'Public key hex is not set. Cannot load channel URL image settings.',
|
||||
);
|
||||
return false;
|
||||
}
|
||||
final prefs = PrefsManager.instance;
|
||||
final key = '$keyForUrlImages$channelIndex';
|
||||
return prefs.getBool(key) ?? false;
|
||||
}
|
||||
|
||||
Future<void> saveUrlImagesEnabled(int channelIndex, bool enabled) async {
|
||||
if (publicKeyHex.isEmpty) {
|
||||
appLogger.warn(
|
||||
'Public key hex is not set. Cannot save channel URL image settings.',
|
||||
);
|
||||
return;
|
||||
}
|
||||
await PrefsManager.instance.setBool(
|
||||
'$keyForUrlImages$channelIndex',
|
||||
enabled,
|
||||
);
|
||||
}
|
||||
|
||||
Future<String?> loadCyr2LatProfileId(int channelIndex) async {
|
||||
if (publicKeyHex.isEmpty) {
|
||||
appLogger.warn(
|
||||
|
||||
@@ -4,6 +4,7 @@ import 'prefs_manager.dart';
|
||||
class ContactSettingsStore {
|
||||
static const String _keyPrefix = 'contact_smaz_';
|
||||
static const String _cyr2latKeyPrefix = 'contact_cyr2lat_';
|
||||
static const String _urlImagesKeyPrefix = 'contact_url_images_';
|
||||
|
||||
String publicKeyHex = '';
|
||||
set setPublicKeyHex(String value) =>
|
||||
@@ -11,6 +12,7 @@ class ContactSettingsStore {
|
||||
|
||||
String get keyFor => '$_keyPrefix$publicKeyHex';
|
||||
String get keyForCyr2Lat => '$_cyr2latKeyPrefix$publicKeyHex';
|
||||
String get keyForUrlImages => '$_urlImagesKeyPrefix$publicKeyHex';
|
||||
|
||||
Future<bool> loadSmazEnabled(String contactKeyHex) async {
|
||||
if (publicKeyHex.isEmpty) {
|
||||
@@ -73,6 +75,31 @@ class ContactSettingsStore {
|
||||
await prefs.setBool(key, enabled);
|
||||
}
|
||||
|
||||
Future<bool> loadUrlImagesEnabled(String contactKeyHex) async {
|
||||
if (publicKeyHex.isEmpty) {
|
||||
appLogger.warn(
|
||||
'Public key hex is not set. Cannot load contact URL image settings.',
|
||||
);
|
||||
return false;
|
||||
}
|
||||
final prefs = PrefsManager.instance;
|
||||
final key = '$keyForUrlImages$contactKeyHex';
|
||||
return prefs.getBool(key) ?? false;
|
||||
}
|
||||
|
||||
Future<void> saveUrlImagesEnabled(String contactKeyHex, bool enabled) async {
|
||||
if (publicKeyHex.isEmpty) {
|
||||
appLogger.warn(
|
||||
'Public key hex is not set. Cannot save contact URL image settings.',
|
||||
);
|
||||
return;
|
||||
}
|
||||
await PrefsManager.instance.setBool(
|
||||
'$keyForUrlImages$contactKeyHex',
|
||||
enabled,
|
||||
);
|
||||
}
|
||||
|
||||
Future<String?> loadCyr2LatProfileId(String contactKeyHex) async {
|
||||
if (publicKeyHex.isEmpty) {
|
||||
appLogger.warn(
|
||||
|
||||
@@ -171,7 +171,12 @@ class MessageStore {
|
||||
pathBytes: decodedPathBytes,
|
||||
reactions:
|
||||
(json['reactions'] as Map<String, dynamic>?)?.map(
|
||||
(key, value) => MapEntry(key, value as int),
|
||||
(key, value) => MapEntry(
|
||||
key,
|
||||
(value is int)
|
||||
? List<String?>.filled(value, null)
|
||||
: List<String?>.from(value),
|
||||
),
|
||||
) ??
|
||||
{},
|
||||
reactionStatuses:
|
||||
|
||||
Reference in new issue
Block a user