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

@@ -146,21 +146,21 @@ extension ApiServiceAuth on ApiService {
if (currentAccount != null) {
authToken = currentAccount.token;
userId = currentAccount.userId;
print(
"Токен загружен из AccountManager: ${authToken!.substring(0, 20)}...",
);
// print(
// "Токен загружен из AccountManager: ${authToken!.substring(0, 20)}...",
// );
} else {
final prefs = await SharedPreferences.getInstance();
authToken = prefs.getString('authToken');
userId = prefs.getString('userId');
if (authToken != null) {
print(
"Токен загружен из SharedPreferences: ${authToken!.substring(0, 20)}...",
);
if (userId != null) {
print("UserID загружен из SharedPreferences: $userId");
}
}
// if (authToken != null) {
// print(
// "Токен загружен из SharedPreferences: ${authToken!.substring(0, 20)}...",
// );
// if (userId != null) {
// print("UserID загружен из SharedPreferences: $userId");
// }
// }
}
}
return authToken != null;

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,6 +3593,7 @@ class _ChatsScreenState extends State<ChatsScreen>
),
]
: [
if (prefs.getBool('show_sferum_button') ?? true)
IconButton(
icon: Image.asset(
'assets/images/spermum.png',
@@ -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

@@ -481,11 +481,10 @@ class _PhoneEntryScreenState extends State<PhoneEntryScreen>
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);
},
),
],
),
),

View File

@@ -3752,13 +3752,38 @@ class ChatMessageBubble extends StatelessWidget {
],
if (message.text.isNotEmpty) ...[
if (message.text.contains("welcome.saved.dialog.message"))
Container(
alignment: Alignment.center,
child: Text(
'Привет! Это твои избранные. Все написанное сюда попадёт прямиком к дяде Майору.',
Linkify(
text:'Привет! Это твои избранные. Все написанное сюда попадёт прямиком к дяде Майору.',
style: TextStyle(color: textColor, fontStyle: FontStyle.italic),
textAlign: TextAlign.center,
),
linkStyle: linkStyle,
onOpen: onOpenLink,
options: const LinkifyOptions(humanize: false),
textAlign: TextAlign.left,
)
else if (message.text.contains("komet.custom_text"))
Linkify(
style: message.text.contains("komet.custom_text.red") ?
TextStyle(color: Color.from(alpha: 255, red: 255, green: 0, blue: 0)) :
message.text.contains("komet.custom_text.black") ?
TextStyle(color: Color.from(alpha: 255, red: 0, green: 0, blue: 0)) :
message.text.contains("komet.custom_text.green") ?
TextStyle(color: Color.from(alpha: 255, red: 0, green: 255, blue: 0)) :
message.text.contains("komet.custom_text.white") ?
TextStyle(color: Color.from(alpha: 255, red: 255, green: 255, blue: 255)) : defaultTextStyle,
linkStyle: linkStyle,
onOpen: onOpenLink,
options: const LinkifyOptions(humanize: false),
textAlign: message.text.contains("komet.custom_text.right")
? TextAlign.right
: message.text.contains("komet.custom_text.center") ? TextAlign.center : TextAlign.left,
text: message.text
.replaceAll("komet.custom_text.red", "")
.replaceAll("komet.custom_text.black", "")
.replaceAll("komet.custom_text.green", "")
.replaceAll("komet.custom_text.white", "")
.replaceAll("komet.custom_text.right", "")
.replaceAll("komet.custom_text.center", "")
.replaceAll("komet.custom_text", ""),
)
else
Linkify(

View File

@@ -16,7 +16,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
# In Windows, build-name is used as the major, minor, and patch parts
# of the product and file versions while build-number is used as the build suffix.
version: 0.2.0+4
version: 0.3.0+6
environment:
sdk: ^3.9.2