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) { if (currentAccount != null) {
authToken = currentAccount.token; authToken = currentAccount.token;
userId = currentAccount.userId; userId = currentAccount.userId;
print( // print(
"Токен загружен из AccountManager: ${authToken!.substring(0, 20)}...", // "Токен загружен из AccountManager: ${authToken!.substring(0, 20)}...",
); // );
} else { } else {
final prefs = await SharedPreferences.getInstance(); final prefs = await SharedPreferences.getInstance();
authToken = prefs.getString('authToken'); authToken = prefs.getString('authToken');
userId = prefs.getString('userId'); userId = prefs.getString('userId');
if (authToken != null) { // if (authToken != null) {
print( // print(
"Токен загружен из SharedPreferences: ${authToken!.substring(0, 20)}...", // "Токен загружен из SharedPreferences: ${authToken!.substring(0, 20)}...",
); // );
if (userId != null) { // if (userId != null) {
print("UserID загружен из SharedPreferences: $userId"); // print("UserID загружен из SharedPreferences: $userId");
} // }
} // }
} }
} }
return authToken != null; return authToken != null;

View File

@@ -1,2 +1,2 @@
// Датафайл с константами, полезно при изменении версии например // Датафайл с константами, полезно при изменении версии например
const version = "0.3.0"; const version = "0.3.0";

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

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

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);
},
),
], ],
), ),
), ),

View File

@@ -3752,13 +3752,38 @@ class ChatMessageBubble extends StatelessWidget {
], ],
if (message.text.isNotEmpty) ...[ if (message.text.isNotEmpty) ...[
if (message.text.contains("welcome.saved.dialog.message")) if (message.text.contains("welcome.saved.dialog.message"))
Container( Linkify(
alignment: Alignment.center, text:'Привет! Это твои избранные. Все написанное сюда попадёт прямиком к дяде Майору.',
child: Text( style: TextStyle(color: textColor, fontStyle: FontStyle.italic),
'Привет! Это твои избранные. Все написанное сюда попадёт прямиком к дяде Майору.', linkStyle: linkStyle,
style: TextStyle(color: textColor, fontStyle: FontStyle.italic), onOpen: onOpenLink,
textAlign: TextAlign.center, 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 else
Linkify( 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 # 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 # 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. # 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: environment:
sdk: ^3.9.2 sdk: ^3.9.2