Sferum button hide option

This commit is contained in:
ivan2282
2025-11-30 21:53:45 +03:00
parent a935bd396d
commit 42cb4774b5
2 changed files with 35 additions and 2 deletions

View File

@@ -99,9 +99,16 @@ class _ChatsScreenState extends State<ChatsScreen>
StreamSubscription<String>? _connectionStateSubscription; StreamSubscription<String>? _connectionStateSubscription;
bool _isAccountsExpanded = false; bool _isAccountsExpanded = false;
late SharedPreferences prefs;
Future<void> _initializePrefs() async {
prefs = await SharedPreferences.getInstance();
}
@override @override
void initState() { void initState() {
super.initState(); super.initState();
_initializePrefs();
_loadMyProfile(); _loadMyProfile();
_chatsFuture = (() async { _chatsFuture = (() async {
try { try {
@@ -118,6 +125,9 @@ class _ChatsScreenState extends State<ChatsScreen>
rethrow; rethrow;
} }
})(); })();
_listenForUpdates(); _listenForUpdates();
_searchAnimationController = AnimationController( _searchAnimationController = AnimationController(
@@ -155,6 +165,7 @@ class _ChatsScreenState extends State<ChatsScreen>
_loadChannels(); _loadChannels();
} }
}); });
final prefs = SharedPreferences.getInstance();
} }
@override @override
@@ -3582,6 +3593,7 @@ class _ChatsScreenState extends State<ChatsScreen>
), ),
] ]
: [ : [
if (prefs.getBool('show_sferum_button') ?? true)
IconButton( IconButton(
icon: Image.asset( icon: Image.asset(
'assets/images/spermum.png', 'assets/images/spermum.png',
@@ -4508,7 +4520,7 @@ class _SferumWebViewPanelState extends State<SferumWebViewPanel> {
color: colors.surface, color: colors.surface,
child: const Center( child: const Center(
child: Text( child: Text(
'Сферум временно не доступен на линуксе,\nмы думаем как это исправить.', 'Веб приложения временно не доступны на линуксе,\nмы думаем как это исправить.',
textAlign: TextAlign.center, textAlign: TextAlign.center,
style: TextStyle(fontSize: 18, fontWeight: FontWeight.w600), style: TextStyle(fontSize: 18, fontWeight: FontWeight.w600),
), ),

View File

@@ -18,6 +18,7 @@ class _KometMiscScreenState extends State<KometMiscScreen> {
bool _showUpdateNotification = true; bool _showUpdateNotification = true;
bool _enableWebVersionCheck = false; bool _enableWebVersionCheck = false;
bool _showSpoofUpdateDialog = true; bool _showSpoofUpdateDialog = true;
bool _showSferumButton = true;
@override @override
void initState() { void initState() {
@@ -36,6 +37,8 @@ class _KometMiscScreenState extends State<KometMiscScreen> {
prefs.getBool('enable_web_version_check') ?? false; prefs.getBool('enable_web_version_check') ?? false;
_showSpoofUpdateDialog = _showSpoofUpdateDialog =
prefs.getBool('show_spoof_update_dialog') ?? true; prefs.getBool('show_spoof_update_dialog') ?? true;
_showSferumButton =
prefs.getBool('show_sferum_button') ?? true;
}); });
} }
@@ -225,6 +228,24 @@ class _KometMiscScreenState extends State<KometMiscScreen> {
_updateSettings('show_spoof_update_dialog', value); _updateSettings('show_spoof_update_dialog', value);
}, },
), ),
const Divider(height: 1),
SwitchListTile(
secondary: Icon(
Icons.remove_red_eye,
color: Theme.of(context).colorScheme.primary,
),
title: const Text("Показывать кнопку Сферум?"),
subtitle: const Text(
"Показывать кнопку Сферум в главном меню. Для применения нужен перезапуск приложения.",
),
value: _showSferumButton,
onChanged: (bool value) {
setState(() {
_showSferumButton = value;
});
_updateSettings('show_sferum_button', value);
},
),
], ],
), ),
), ),