From 96f11a4a69f993c212f8c64fda6e018c8da7ecab Mon Sep 17 00:00:00 2001 From: TrueZhuanjia Date: Sun, 27 Jul 2025 02:13:11 +0800 Subject: [PATCH] host view improvements --- VoidLink/Localization/Localizable.xcstrings | 39 +++++++++++++++---- VoidLink/Stream/Connection.h | 2 +- .../ViewControllers/MainFrameViewController.m | 33 ++++++++-------- 3 files changed, 48 insertions(+), 26 deletions(-) diff --git a/VoidLink/Localization/Localizable.xcstrings b/VoidLink/Localization/Localizable.xcstrings index 273ba860..0183d2e4 100644 --- a/VoidLink/Localization/Localizable.xcstrings +++ b/VoidLink/Localization/Localizable.xcstrings @@ -2898,6 +2898,29 @@ } } }, + "Offline\n%@" : { + "extractionState" : "manual", + "localizations" : { + "zh-Hans" : { + "stringUnit" : { + "state" : "translated", + "value" : "离线\n%@" + } + }, + "zh-Hant" : { + "stringUnit" : { + "state" : "translated", + "value" : "離線\n%@" + } + }, + "zh-HK" : { + "stringUnit" : { + "state" : "translated", + "value" : "離線\n%@" + } + } + } + }, "Ok" : { "extractionState" : "manual", "localizations" : { @@ -2990,48 +3013,48 @@ } } }, - "Online - Not Paired" : { + "Online - Not Paired\n%@" : { "extractionState" : "manual", "localizations" : { "zh-Hans" : { "stringUnit" : { "state" : "translated", - "value" : "在线 - 未配对" + "value" : "在线 - 未配对\n%@" } }, "zh-Hant" : { "stringUnit" : { "state" : "translated", - "value" : "線上 - 未配對" + "value" : "線上 - 未配對\n%@" } }, "zh-HK" : { "stringUnit" : { "state" : "translated", - "value" : "線上 - 未配對" + "value" : "線上 - 未配對\n%@" } } } }, - "Online - Paired" : { + "Online - Paired\n%@" : { "extractionState" : "manual", "localizations" : { "zh-Hans" : { "stringUnit" : { "state" : "translated", - "value" : "在线 - 已配对" + "value" : "在线 - 已配对\n%@" } }, "zh-Hant" : { "stringUnit" : { "state" : "translated", - "value" : "線上 - 已配對" + "value" : "線上 - 已配對\n%@" } }, "zh-HK" : { "stringUnit" : { "state" : "translated", - "value" : "線上 - 已配對" + "value" : "線上 - 已配對\n%@" } } } diff --git a/VoidLink/Stream/Connection.h b/VoidLink/Stream/Connection.h index dc155419..ae50056e 100644 --- a/VoidLink/Stream/Connection.h +++ b/VoidLink/Stream/Connection.h @@ -9,7 +9,7 @@ #import "VideoDecoderRenderer.h" #import "StreamConfiguration.h" -#define CONN_TEST_SERVER "ios.conntest.moonlight-stream.org" +#define CONN_TEST_SERVER "www.baidu.com" typedef struct { CFTimeInterval startTime; diff --git a/VoidLink/ViewControllers/MainFrameViewController.m b/VoidLink/ViewControllers/MainFrameViewController.m index ecb98c1e..d49bd450 100644 --- a/VoidLink/ViewControllers/MainFrameViewController.m +++ b/VoidLink/ViewControllers/MainFrameViewController.m @@ -595,22 +595,24 @@ static NSMutableSet* hostList; Log(LOG_D, @"Long clicked host: %@", host.name); NSString* message; + NSString* hostAddress = [host.activeAddress componentsSeparatedByString:@":"].firstObject; + switch (host.state) { case StateOffline: - message = [LocalizationHelper localizedStringForKey:@"Offline"]; + message = [LocalizationHelper localizedStringForKey:@"Offline\n%@", hostAddress ? hostAddress : @"Unknown address"]; break; case StateOnline: if (host.pairState == PairStatePaired) { - message = [LocalizationHelper localizedStringForKey:@"Online - Paired"]; + message = [LocalizationHelper localizedStringForKey:@"Online - Paired\n%@", hostAddress ? hostAddress : @"Unknown address"]; } else { - message = [LocalizationHelper localizedStringForKey:@"Online - Not Paired"]; + message = [LocalizationHelper localizedStringForKey:@"Online - Not Paired\n%@", hostAddress ? hostAddress : @"Unknown address"]; } break; case StateUnknown: - message = [LocalizationHelper localizedStringForKey:@"Connecting"]; + message = [LocalizationHelper localizedStringForKey:@"Connecting\n"]; break; default: @@ -620,7 +622,7 @@ static NSMutableSet* hostList; UIAlertController* longClickAlert = [UIAlertController alertControllerWithTitle:host.name message:message preferredStyle:UIAlertControllerStyleActionSheet]; if (host.state != StateOnline) { - /*[longClickAlert addAction:[UIAlertAction actionWithTitle:[LocalizationHelper localizedStringForKey:@"Wake PC"] style:UIAlertActionStyleDefault handler:^(UIAlertAction* action){ + [longClickAlert addAction:[UIAlertAction actionWithTitle:[LocalizationHelper localizedStringForKey:@"Wake PC"] style:UIAlertActionStyleDefault handler:^(UIAlertAction* action){ UIAlertController* wolAlert = [UIAlertController alertControllerWithTitle:[LocalizationHelper localizedStringForKey:@"Wake-On-LAN"] message:@"" preferredStyle:UIAlertControllerStyleAlert]; [wolAlert addAction:[UIAlertAction actionWithTitle:[LocalizationHelper localizedStringForKey:@"Ok"] style:UIAlertActionStyleDefault handler:nil]]; if (host.mac == nil || [host.mac isEqualToString:@"00:00:00:00:00:00"]) { @@ -632,7 +634,7 @@ static NSMutableSet* hostList; wolAlert.message = [LocalizationHelper localizedStringForKey:@"Successfully sent wake-up request. It may take a few moments for the PC to wake. If it never wakes up, ensure it's properly configured for Wake-on-LAN."]; } [[self activeViewController] presentViewController:wolAlert animated:YES completion:nil]; - }]];*/ + }]]; } else if (host.pairState == PairStatePaired) { /* @@ -642,18 +644,14 @@ static NSMutableSet* hostList; }]]; */ #if !TARGET_OS_TV - if (false) { - [longClickAlert addAction:[UIAlertAction actionWithTitle:[LocalizationHelper localizedStringForKey:@"NVIDIA GameStream End-of-Service"] style:UIAlertActionStyleDefault handler:^(UIAlertAction* action){ - [Utils launchUrl:@"https://github.com/moonlight-stream/moonlight-docs/wiki/NVIDIA-GameStream-End-Of-Service-Announcement-FAQ"]; - }]]; - } + #endif } - [longClickAlert addAction:[UIAlertAction actionWithTitle:[LocalizationHelper localizedStringForKey:@"Test Network"] style:UIAlertActionStyleDefault handler:^(UIAlertAction* action) { + /*[longClickAlert addAction:[UIAlertAction actionWithTitle:[LocalizationHelper localizedStringForKey:@"Test Network"] style:UIAlertActionStyleDefault handler:^(UIAlertAction* action) { [self showLoadingFrame:^{ dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{ // Perform the network test on a GCD worker thread. It may take a while. - unsigned int portTestResult = LiTestClientConnectivity(CONN_TEST_SERVER, 443, ML_PORT_FLAG_ALL); + unsigned int portTestResult = LiTestClientConnectivity([host.activeAddress UTF8String], 443, ML_PORT_FLAG_ALL); dispatch_sync(dispatch_get_main_queue(), ^{ [self hideLoadingFrame:^{ NSString* message; @@ -679,8 +677,9 @@ static NSMutableSet* hostList; }); }); }]; - }]]; + }]];*/ #if !TARGET_OS_TV + /* if (host.state != StateOnline) { [longClickAlert addAction:[UIAlertAction actionWithTitle:[LocalizationHelper localizedStringForKey:@"NVIDIA GameStream End-of-Service"] style:UIAlertActionStyleDefault handler:^(UIAlertAction* action){ [Utils launchUrl:@"https://github.com/moonlight-stream/moonlight-docs/wiki/NVIDIA-GameStream-End-Of-Service-Announcement-FAQ"]; @@ -688,7 +687,7 @@ static NSMutableSet* hostList; [longClickAlert addAction:[UIAlertAction actionWithTitle:[LocalizationHelper localizedStringForKey:@"Connection Help"] style:UIAlertActionStyleDefault handler:^(UIAlertAction* action){ [Utils launchUrl:@"https://github.com/moonlight-stream/moonlight-docs/wiki/Troubleshooting"]; }]]; - } + }*/ #endif [longClickAlert addAction:[UIAlertAction actionWithTitle:[LocalizationHelper localizedStringForKey:@"Remove Host"] style:UIAlertActionStyleDestructive handler:^(UIAlertAction* action) { // host removed here [self->_discMan removeHostFromDiscovery:host]; @@ -746,7 +745,7 @@ static NSMutableSet* hostList; }]; }); } else { - unsigned int portTestResults = LiTestClientConnectivity(CONN_TEST_SERVER, 443, + unsigned int portTestResults = LiTestClientConnectivity([host.activeAddress UTF8String], 443, ML_PORT_FLAG_TCP_47984 | ML_PORT_FLAG_TCP_47989); if (portTestResults != ML_TEST_RESULT_INCONCLUSIVE && portTestResults != 0) { error = [error stringByAppendingString:[LocalizationHelper localizedStringForKey:@"!ML_TEST_RESULT_INCONCLUSIVE"]]; @@ -1932,7 +1931,7 @@ static NSMutableSet* hostList; [self updateHostShortcuts]; // Update the title in case we now have a PC - [self updateTitle]; + // [self updateTitle]; // Reset state first so we can rediscover hosts that were deleted before [_discMan resetDiscoveryState];