feat:нечиталка
This commit is contained in:
@@ -312,7 +312,7 @@ class ChatsModule {
|
||||
if ((row['unread_count'] as int? ?? 0) == 0) return;
|
||||
|
||||
final msgIdNum = int.tryParse(messageId);
|
||||
if (msgIdNum != null) {
|
||||
if (msgIdNum != null && !KometSettings.antiRead.value) {
|
||||
try {
|
||||
await api.sendRequest(Opcode.chatMark, {
|
||||
'type': 'READ_MESSAGE',
|
||||
|
||||
@@ -6,12 +6,14 @@ class KometSettings {
|
||||
static const _kViewRedacted = 'komet_view_redacted';
|
||||
static const _kFullTimestamp = 'komet_full_timestamp';
|
||||
static const _kGhostMode = 'komet_ghost_mode';
|
||||
static const _kAntiRead = 'komet_anti_read';
|
||||
static const _kSelfOnlineCheck = 'komet_self_online_check';
|
||||
|
||||
static final ValueNotifier<bool> viewDeleted = ValueNotifier(false);
|
||||
static final ValueNotifier<bool> viewRedacted = ValueNotifier(false);
|
||||
static final ValueNotifier<bool> fullTimestamp = ValueNotifier(false);
|
||||
static final ValueNotifier<bool> ghostMode = ValueNotifier(false);
|
||||
static final ValueNotifier<bool> antiRead = ValueNotifier(false);
|
||||
static final ValueNotifier<bool> selfOnlineCheck = ValueNotifier(true);
|
||||
|
||||
static Future<void> load() async {
|
||||
@@ -20,6 +22,7 @@ class KometSettings {
|
||||
viewRedacted.value = prefs.getBool(_kViewRedacted) ?? false;
|
||||
fullTimestamp.value = prefs.getBool(_kFullTimestamp) ?? false;
|
||||
ghostMode.value = prefs.getBool(_kGhostMode) ?? false;
|
||||
antiRead.value = prefs.getBool(_kAntiRead) ?? false;
|
||||
selfOnlineCheck.value = prefs.getBool(_kSelfOnlineCheck) ?? true;
|
||||
}
|
||||
|
||||
@@ -47,6 +50,12 @@ class KometSettings {
|
||||
await prefs.setBool(_kGhostMode, value);
|
||||
}
|
||||
|
||||
static Future<void> setAntiRead(bool value) async {
|
||||
antiRead.value = value;
|
||||
final prefs = await SharedPreferences.getInstance();
|
||||
await prefs.setBool(_kAntiRead, value);
|
||||
}
|
||||
|
||||
static Future<void> setSelfOnlineCheck(bool value) async {
|
||||
selfOnlineCheck.value = value;
|
||||
final prefs = await SharedPreferences.getInstance();
|
||||
|
||||
@@ -68,11 +68,20 @@ class KometSettingsScreen extends StatelessWidget {
|
||||
cs,
|
||||
icon: Symbols.visibility_off,
|
||||
label: 'Ghost Mode',
|
||||
subtitle: 'Не отмечать вас в сети: пинги идут скрытно',
|
||||
subtitle: 'Вас не видно в сети',
|
||||
notifier: KometSettings.ghostMode,
|
||||
onChanged: _setGhostMode,
|
||||
),
|
||||
_divider(cs),
|
||||
_toggle(
|
||||
cs,
|
||||
icon: Symbols.mark_chat_read,
|
||||
label: 'Anti read',
|
||||
subtitle: 'Нечиталка сообщений',
|
||||
notifier: KometSettings.antiRead,
|
||||
onChanged: KometSettings.setAntiRead,
|
||||
),
|
||||
_divider(cs),
|
||||
_toggle(
|
||||
cs,
|
||||
icon: Symbols.radar,
|
||||
|
||||
@@ -467,13 +467,12 @@ class _SettingsTabState extends State<SettingsTab> {
|
||||
cs,
|
||||
items: [
|
||||
_SettingsItem(
|
||||
icon: Symbols.logout,
|
||||
label: 'Выйти из аккаунта',
|
||||
tintColor: cs.error,
|
||||
onTap: _confirmLogout,
|
||||
),
|
||||
_SettingsItem(
|
||||
icon: Symbols.auto_awesome,
|
||||
leading: Image.asset(
|
||||
'assets/komet.png',
|
||||
width: 22,
|
||||
height: 22,
|
||||
color: cs.onSurfaceVariant,
|
||||
),
|
||||
label: 'Komet',
|
||||
onTap: () {
|
||||
Navigator.push(
|
||||
@@ -484,6 +483,12 @@ class _SettingsTabState extends State<SettingsTab> {
|
||||
);
|
||||
},
|
||||
),
|
||||
_SettingsItem(
|
||||
icon: Symbols.logout,
|
||||
label: 'Выйти из аккаунта',
|
||||
tintColor: cs.error,
|
||||
onTap: _confirmLogout,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
@@ -723,12 +728,13 @@ class _SettingsTabState extends State<SettingsTab> {
|
||||
padding: const EdgeInsets.symmetric(horizontal: 20, vertical: 17),
|
||||
child: Row(
|
||||
children: [
|
||||
Icon(
|
||||
item.icon,
|
||||
color: item.tintColor ?? cs.onSurfaceVariant,
|
||||
size: 22,
|
||||
weight: 400,
|
||||
),
|
||||
item.leading ??
|
||||
Icon(
|
||||
item.icon,
|
||||
color: item.tintColor ?? cs.onSurfaceVariant,
|
||||
size: 22,
|
||||
weight: 400,
|
||||
),
|
||||
const SizedBox(width: 16),
|
||||
Expanded(
|
||||
child: Text(
|
||||
@@ -766,13 +772,15 @@ class _SettingsTabState extends State<SettingsTab> {
|
||||
}
|
||||
|
||||
class _SettingsItem {
|
||||
final IconData icon;
|
||||
final IconData? icon;
|
||||
final Widget? leading;
|
||||
final String label;
|
||||
final VoidCallback? onTap;
|
||||
final Color? tintColor;
|
||||
|
||||
const _SettingsItem({
|
||||
required this.icon,
|
||||
this.icon,
|
||||
this.leading,
|
||||
required this.label,
|
||||
this.onTap,
|
||||
this.tintColor,
|
||||
|
||||
Reference in New Issue
Block a user