Merge branch 'reorg' of https://github.com/KometTeam/app into reorg

This commit is contained in:
endgame
2025-11-30 23:33:29 +03:00
8 changed files with 92 additions and 42 deletions

View File

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

View File

@@ -480,12 +480,11 @@ class _PhoneEntryScreenState extends State<PhoneEntryScreen>
onCountryChanged: _onCountryChanged,
customPrefix: _customPrefix,
),
(Platform.instance.android || Platform.instance.windows) ? Column(
children: [
if (Platform.instance.android ||
Platform.instance.windows) ...[
const SizedBox(height: 16),
Center(
child: TextButton(
OutlinedButton(
onPressed: _isTosAccepted
? () {
Navigator.of(context).push(
@@ -496,26 +495,19 @@ class _PhoneEntryScreenState extends State<PhoneEntryScreen>
);
}
: null,
style: OutlinedButton.styleFrom(
padding: const EdgeInsets.symmetric(
vertical: 16,
),
),
child: Text(
'зарегистрироваться',
'Зарегистрироваться',
style: GoogleFonts.manrope(
color: _isTosAccepted
? colors.primary
: colors.onSurfaceVariant.withOpacity(
0.5,
),
fontWeight: FontWeight.w600,
decoration: TextDecoration.underline,
decorationColor: _isTosAccepted
? colors.primary
: colors.onSurfaceVariant.withOpacity(
0.5,
),
fontWeight: FontWeight.bold,
),
),
),
)]
) : const SizedBox(),
],
const SizedBox(height: 16),
Row(
crossAxisAlignment: CrossAxisAlignment.center,

View File

@@ -18,6 +18,7 @@ class _KometMiscScreenState extends State<KometMiscScreen> {
bool _showUpdateNotification = true;
bool _enableWebVersionCheck = false;
bool _showSpoofUpdateDialog = true;
bool _showSferumButton = true;
@override
void initState() {
@@ -36,6 +37,8 @@ class _KometMiscScreenState extends State<KometMiscScreen> {
prefs.getBool('enable_web_version_check') ?? false;
_showSpoofUpdateDialog =
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);
},
),
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);
},
),
],
),
),