Merge branch 'ios_1.2.2'

This commit is contained in:
rustdesk 2023-09-03 11:28:21 +08:00
commit e3b0cdaf69
2 changed files with 14 additions and 8 deletions

View File

@ -25,6 +25,10 @@ class _HomePageState extends State<HomePage> {
var _selectedIndex = 0; var _selectedIndex = 0;
int get selectedIndex => _selectedIndex; int get selectedIndex => _selectedIndex;
final List<PageShape> _pages = []; final List<PageShape> _pages = [];
final _blockableOverlayState = BlockableOverlayState();
bool get isChatPageCurrentTab => isAndroid
? _selectedIndex == 1
: false; // change this when ios have chat page
void refreshPages() { void refreshPages() {
setState(() { setState(() {
@ -79,13 +83,15 @@ class _HomePageState extends State<HomePage> {
unselectedItemColor: MyTheme.darkGray, unselectedItemColor: MyTheme.darkGray,
onTap: (index) => setState(() { onTap: (index) => setState(() {
// close chat overlay when go chat page // close chat overlay when go chat page
if (index == 1 && _selectedIndex != index) { if (_selectedIndex != index) {
gFFI.chatModel.hideChatIconOverlay(); _selectedIndex = index;
gFFI.chatModel.hideChatWindowOverlay(); if (isChatPageCurrentTab) {
gFFI.chatModel gFFI.chatModel.hideChatIconOverlay();
.mobileClearClientUnread(gFFI.chatModel.currentKey.connId); gFFI.chatModel.hideChatWindowOverlay();
gFFI.chatModel.mobileClearClientUnread(
gFFI.chatModel.currentKey.connId);
}
} }
_selectedIndex = index;
}), }),
), ),
body: _pages.elementAt(_selectedIndex), body: _pages.elementAt(_selectedIndex),
@ -95,7 +101,7 @@ class _HomePageState extends State<HomePage> {
Widget appTitle() { Widget appTitle() {
final currentUser = gFFI.chatModel.currentUser; final currentUser = gFFI.chatModel.currentUser;
final currentKey = gFFI.chatModel.currentKey; final currentKey = gFFI.chatModel.currentKey;
if (_selectedIndex == 1 && if (isChatPageCurrentTab &&
currentUser != null && currentUser != null &&
currentKey.peerId.isNotEmpty) { currentKey.peerId.isNotEmpty) {
final connected = final connected =

View File

@ -396,7 +396,7 @@ class ChatModel with ChangeNotifier {
parent.target?.serverModel.jumpTo(id); parent.target?.serverModel.jumpTo(id);
} }
} else { } else {
if (HomePage.homeKey.currentState?.selectedIndex != 1 || if (HomePage.homeKey.currentState?.isChatPageCurrentTab != true ||
_currentKey != messagekey) { _currentKey != messagekey) {
client.unreadChatMessageCount.value += 1; client.unreadChatMessageCount.value += 1;
mobileUpdateUnreadSum(); mobileUpdateUnreadSum();