fix remote tab lable update, Get.find always return the first instance
Signed-off-by: 21pages <pages21@163.com>
This commit is contained in:
parent
bdb1fc2ed7
commit
6028cfc1a3
@ -1100,7 +1100,7 @@ class MyGroupPeerCard extends BasePeerCard {
|
|||||||
if (Platform.isWindows) {
|
if (Platform.isWindows) {
|
||||||
menuItems.add(_createShortCutAction(peer.id));
|
menuItems.add(_createShortCutAction(peer.id));
|
||||||
}
|
}
|
||||||
menuItems.add(MenuEntryDivider());
|
// menuItems.add(MenuEntryDivider());
|
||||||
// menuItems.add(_renameAction(peer.id));
|
// menuItems.add(_renameAction(peer.id));
|
||||||
// if (await bind.mainPeerHasPassword(id: peer.id)) {
|
// if (await bind.mainPeerHasPassword(id: peer.id)) {
|
||||||
// menuItems.add(_unrememberPasswordAction(peer.id));
|
// menuItems.add(_unrememberPasswordAction(peer.id));
|
||||||
|
@ -269,11 +269,8 @@ class DesktopTab extends StatelessWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static RxString tablabelGetter(String peerId) {
|
static RxString tablabelGetter(String peerId) {
|
||||||
PeerStringOption.init(peerId, 'tabLabel', () {
|
|
||||||
final alias = bind.mainGetPeerOptionSync(id: peerId, key: 'alias');
|
final alias = bind.mainGetPeerOptionSync(id: peerId, key: 'alias');
|
||||||
return getDesktopTabLabel(peerId, alias);
|
return RxString(getDesktopTabLabel(peerId, alias));
|
||||||
});
|
|
||||||
return PeerStringOption.find(peerId, 'tabLabel');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
@ -266,8 +266,6 @@ class FfiModel with ChangeNotifier {
|
|||||||
updateBlockInputState(evt, peerId);
|
updateBlockInputState(evt, peerId);
|
||||||
} else if (name == 'update_privacy_mode') {
|
} else if (name == 'update_privacy_mode') {
|
||||||
updatePrivacyMode(evt, sessionId, peerId);
|
updatePrivacyMode(evt, sessionId, peerId);
|
||||||
} else if (name == 'alias') {
|
|
||||||
handleAliasChanged(evt);
|
|
||||||
} else if (name == 'show_elevation') {
|
} else if (name == 'show_elevation') {
|
||||||
final show = evt['show'].toString() == 'true';
|
final show = evt['show'].toString() == 'true';
|
||||||
parent.target?.serverModel.setShowElevation(show);
|
parent.target?.serverModel.setShowElevation(show);
|
||||||
@ -353,17 +351,6 @@ class FfiModel with ChangeNotifier {
|
|||||||
platformFFI.setEventCallback(startEventListener(sessionId, peerId));
|
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) {
|
_updateCurDisplay(SessionID sessionId, Display newDisplay) {
|
||||||
if (newDisplay != _display) {
|
if (newDisplay != _display) {
|
||||||
if (newDisplay.x != _display.x || newDisplay.y != _display.y) {
|
if (newDisplay.x != _display.x || newDisplay.y != _display.y) {
|
||||||
|
@ -16,7 +16,7 @@ final testClients = [
|
|||||||
Client(3, false, false, "UserDDDDDDDDDDDd", "441123123", true, false, false)
|
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 {
|
void main(List<String> args) async {
|
||||||
isTest = true;
|
isTest = true;
|
||||||
WidgetsFlutterBinding.ensureInitialized();
|
WidgetsFlutterBinding.ensureInitialized();
|
||||||
|
@ -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) {
|
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)
|
set_peer_option(id, "alias".to_owned(), alias)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user