diff --git a/android/.kotlin/sessions/kotlin-compiler-9339312346383169436.salive b/android/.kotlin/sessions/kotlin-compiler-9339312346383169436.salive deleted file mode 100644 index e69de29..0000000 diff --git a/lib/api/api_service_auth.dart b/lib/api/api_service_auth.dart index 39f3323..4a3b199 100644 --- a/lib/api/api_service_auth.dart +++ b/lib/api/api_service_auth.dart @@ -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; diff --git a/lib/consts.dart b/lib/consts.dart index 7d0937f..4d18362 100644 --- a/lib/consts.dart +++ b/lib/consts.dart @@ -1,2 +1,2 @@ // Датафайл с константами, полезно при изменении версии например -const version = "0.3.0"; \ No newline at end of file +const version = "0.3.0"; diff --git a/lib/screens/chats_screen.dart b/lib/screens/chats_screen.dart index f7922d7..b2e92f0 100644 --- a/lib/screens/chats_screen.dart +++ b/lib/screens/chats_screen.dart @@ -99,9 +99,16 @@ class _ChatsScreenState extends State StreamSubscription? _connectionStateSubscription; bool _isAccountsExpanded = false; + late SharedPreferences prefs; + + Future _initializePrefs() async { + prefs = await SharedPreferences.getInstance(); + } + @override void initState() { super.initState(); + _initializePrefs(); _loadMyProfile(); _chatsFuture = (() async { try { @@ -118,6 +125,9 @@ class _ChatsScreenState extends State rethrow; } })(); + + + _listenForUpdates(); _searchAnimationController = AnimationController( @@ -155,6 +165,7 @@ class _ChatsScreenState extends State _loadChannels(); } }); + final prefs = SharedPreferences.getInstance(); } @override @@ -3582,7 +3593,8 @@ class _ChatsScreenState extends State ), ] : [ - 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 { color: colors.surface, child: const Center( child: Text( - 'Сферум временно не доступен на линуксе,\nмы думаем как это исправить.', + 'Веб приложения временно не доступны на линуксе,\nмы думаем как это исправить.', textAlign: TextAlign.center, style: TextStyle(fontSize: 18, fontWeight: FontWeight.w600), ), diff --git a/lib/screens/phone_entry_screen.dart b/lib/screens/phone_entry_screen.dart index 9100dcd..1c46fee 100644 --- a/lib/screens/phone_entry_screen.dart +++ b/lib/screens/phone_entry_screen.dart @@ -480,12 +480,11 @@ class _PhoneEntryScreenState extends State 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 ); } : 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, diff --git a/lib/screens/settings/komet_misc_screen.dart b/lib/screens/settings/komet_misc_screen.dart index ab0310d..3ed0a96 100644 --- a/lib/screens/settings/komet_misc_screen.dart +++ b/lib/screens/settings/komet_misc_screen.dart @@ -18,6 +18,7 @@ class _KometMiscScreenState extends State { bool _showUpdateNotification = true; bool _enableWebVersionCheck = false; bool _showSpoofUpdateDialog = true; + bool _showSferumButton = true; @override void initState() { @@ -36,6 +37,8 @@ class _KometMiscScreenState extends State { 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 { _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); + }, + ), ], ), ), diff --git a/lib/widgets/chat_message_bubble.dart b/lib/widgets/chat_message_bubble.dart index dbd68e2..a641665 100644 --- a/lib/widgets/chat_message_bubble.dart +++ b/lib/widgets/chat_message_bubble.dart @@ -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( - 'Привет! Это твои избранные. Все написанное сюда попадёт прямиком к дяде Майору.', - style: TextStyle(color: textColor, fontStyle: FontStyle.italic), - textAlign: TextAlign.center, - ), + Linkify( + text:'Привет! Это твои избранные. Все написанное сюда попадёт прямиком к дяде Майору.', + style: TextStyle(color: textColor, fontStyle: FontStyle.italic), + 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( diff --git a/pubspec.yaml b/pubspec.yaml index 634a56b..493ab32 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -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