fix remote tab lable update, Get.find always return the first instance

Signed-off-by: 21pages <pages21@163.com>
This commit is contained in:
21pages 2023-09-28 09:05:10 +08:00
parent bdb1fc2ed7
commit 6028cfc1a3
5 changed files with 4 additions and 25 deletions

View File

@ -1100,7 +1100,7 @@ class MyGroupPeerCard extends BasePeerCard {
if (Platform.isWindows) {
menuItems.add(_createShortCutAction(peer.id));
}
menuItems.add(MenuEntryDivider());
// menuItems.add(MenuEntryDivider());
// menuItems.add(_renameAction(peer.id));
// if (await bind.mainPeerHasPassword(id: peer.id)) {
// menuItems.add(_unrememberPasswordAction(peer.id));

View File

@ -269,11 +269,8 @@ class DesktopTab extends StatelessWidget {
}
static RxString tablabelGetter(String peerId) {
PeerStringOption.init(peerId, 'tabLabel', () {
final alias = bind.mainGetPeerOptionSync(id: peerId, key: 'alias');
return getDesktopTabLabel(peerId, alias);
});
return PeerStringOption.find(peerId, 'tabLabel');
final alias = bind.mainGetPeerOptionSync(id: peerId, key: 'alias');
return RxString(getDesktopTabLabel(peerId, alias));
}
@override

View File

@ -266,8 +266,6 @@ class FfiModel with ChangeNotifier {
updateBlockInputState(evt, peerId);
} else if (name == 'update_privacy_mode') {
updatePrivacyMode(evt, sessionId, peerId);
} else if (name == 'alias') {
handleAliasChanged(evt);
} else if (name == 'show_elevation') {
final show = evt['show'].toString() == 'true';
parent.target?.serverModel.setShowElevation(show);
@ -353,17 +351,6 @@ class FfiModel with ChangeNotifier {
platformFFI.setEventCallback(startEventListener(sessionId, peerId));
}
handleAliasChanged(Map<String, dynamic> evt) {
if (!isDesktop) return;
final String peerId = evt['id'];
final String alias = evt['alias'];
String label = getDesktopTabLabel(peerId, alias);
final rxTabLabel = PeerStringOption.find(evt['id'], 'tabLabel');
if (rxTabLabel.value != label) {
rxTabLabel.value = label;
}
}
_updateCurDisplay(SessionID sessionId, Display newDisplay) {
if (newDisplay != _display) {
if (newDisplay.x != _display.x || newDisplay.y != _display.y) {

View File

@ -16,7 +16,7 @@ final testClients = [
Client(3, false, false, "UserDDDDDDDDDDDd", "441123123", true, false, false)
];
/// flutter run -d {platform} -t lib/cm_test.dart to test cm
/// flutter run -d {platform} -t test/cm_test.dart to test cm
void main(List<String> args) async {
isTest = true;
WidgetsFlutterBinding.ensureInitialized();

View File

@ -823,11 +823,6 @@ pub fn main_set_peer_option_sync(id: String, key: String, value: String) -> Sync
}
pub fn main_set_peer_alias(id: String, alias: String) {
main_broadcast_message(&HashMap::from([
("name", "alias"),
("id", &id),
("alias", &alias),
]));
set_peer_option(id, "alias".to_owned(), alias)
}