host view improvements

This commit is contained in:
TrueZhuanjia committed 2025-07-27 02:13:11 +08:00
1 parent 5fcfa84766
commit 96f11a4a69
3 files changed
+48 -26

No files matched your search

+31 -8
View File
@@ -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" : { "Ok" : {
"extractionState" : "manual", "extractionState" : "manual",
"localizations" : { "localizations" : {
@@ -2990,48 +3013,48 @@
} }
} }
}, },
"Online - Not Paired" : { "Online - Not Paired\n%@" : {
"extractionState" : "manual", "extractionState" : "manual",
"localizations" : { "localizations" : {
"zh-Hans" : { "zh-Hans" : {
"stringUnit" : { "stringUnit" : {
"state" : "translated", "state" : "translated",
"value" : "在线 - 未配对" "value" : "在线 - 未配对\n%@"
} }
}, },
"zh-Hant" : { "zh-Hant" : {
"stringUnit" : { "stringUnit" : {
"state" : "translated", "state" : "translated",
"value" : "線上 - 未配對" "value" : "線上 - 未配對\n%@"
} }
}, },
"zh-HK" : { "zh-HK" : {
"stringUnit" : { "stringUnit" : {
"state" : "translated", "state" : "translated",
"value" : "線上 - 未配對" "value" : "線上 - 未配對\n%@"
} }
} }
} }
}, },
"Online - Paired" : { "Online - Paired\n%@" : {
"extractionState" : "manual", "extractionState" : "manual",
"localizations" : { "localizations" : {
"zh-Hans" : { "zh-Hans" : {
"stringUnit" : { "stringUnit" : {
"state" : "translated", "state" : "translated",
"value" : "在线 - 已配对" "value" : "在线 - 已配对\n%@"
} }
}, },
"zh-Hant" : { "zh-Hant" : {
"stringUnit" : { "stringUnit" : {
"state" : "translated", "state" : "translated",
"value" : "線上 - 已配對" "value" : "線上 - 已配對\n%@"
} }
}, },
"zh-HK" : { "zh-HK" : {
"stringUnit" : { "stringUnit" : {
"state" : "translated", "state" : "translated",
"value" : "線上 - 已配對" "value" : "線上 - 已配對\n%@"
} }
} }
} }
+1 -1
View File
@@ -9,7 +9,7 @@
#import "VideoDecoderRenderer.h" #import "VideoDecoderRenderer.h"
#import "StreamConfiguration.h" #import "StreamConfiguration.h"
#define CONN_TEST_SERVER "ios.conntest.moonlight-stream.org" #define CONN_TEST_SERVER "www.baidu.com"
typedef struct { typedef struct {
CFTimeInterval startTime; CFTimeInterval startTime;
@@ -595,22 +595,24 @@ static NSMutableSet* hostList;
Log(LOG_D, @"Long clicked host: %@", host.name); Log(LOG_D, @"Long clicked host: %@", host.name);
NSString* message; NSString* message;
NSString* hostAddress = [host.activeAddress componentsSeparatedByString:@":"].firstObject;
switch (host.state) { switch (host.state) {
case StateOffline: case StateOffline:
message = [LocalizationHelper localizedStringForKey:@"Offline"]; message = [LocalizationHelper localizedStringForKey:@"Offline\n%@", hostAddress ? hostAddress : @"Unknown address"];
break; break;
case StateOnline: case StateOnline:
if (host.pairState == PairStatePaired) { if (host.pairState == PairStatePaired) {
message = [LocalizationHelper localizedStringForKey:@"Online - Paired"]; message = [LocalizationHelper localizedStringForKey:@"Online - Paired\n%@", hostAddress ? hostAddress : @"Unknown address"];
} }
else { else {
message = [LocalizationHelper localizedStringForKey:@"Online - Not Paired"]; message = [LocalizationHelper localizedStringForKey:@"Online - Not Paired\n%@", hostAddress ? hostAddress : @"Unknown address"];
} }
break; break;
case StateUnknown: case StateUnknown:
message = [LocalizationHelper localizedStringForKey:@"Connecting"]; message = [LocalizationHelper localizedStringForKey:@"Connecting\n"];
break; break;
default: default:
@@ -620,7 +622,7 @@ static NSMutableSet* hostList;
UIAlertController* longClickAlert = [UIAlertController alertControllerWithTitle:host.name message:message preferredStyle:UIAlertControllerStyleActionSheet]; UIAlertController* longClickAlert = [UIAlertController alertControllerWithTitle:host.name message:message preferredStyle:UIAlertControllerStyleActionSheet];
if (host.state != StateOnline) { 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]; UIAlertController* wolAlert = [UIAlertController alertControllerWithTitle:[LocalizationHelper localizedStringForKey:@"Wake-On-LAN"] message:@"" preferredStyle:UIAlertControllerStyleAlert];
[wolAlert addAction:[UIAlertAction actionWithTitle:[LocalizationHelper localizedStringForKey:@"Ok"] style:UIAlertActionStyleDefault handler:nil]]; [wolAlert addAction:[UIAlertAction actionWithTitle:[LocalizationHelper localizedStringForKey:@"Ok"] style:UIAlertActionStyleDefault handler:nil]];
if (host.mac == nil || [host.mac isEqualToString:@"00:00:00:00:00:00"]) { 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."]; 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]; [[self activeViewController] presentViewController:wolAlert animated:YES completion:nil];
}]];*/ }]];
} }
else if (host.pairState == PairStatePaired) { else if (host.pairState == PairStatePaired) {
/* /*
@@ -642,18 +644,14 @@ static NSMutableSet* hostList;
}]]; */ }]]; */
#if !TARGET_OS_TV #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 #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:^{ [self showLoadingFrame:^{
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{ 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. // 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(), ^{ dispatch_sync(dispatch_get_main_queue(), ^{
[self hideLoadingFrame:^{ [self hideLoadingFrame:^{
NSString* message; NSString* message;
@@ -679,8 +677,9 @@ static NSMutableSet* hostList;
}); });
}); });
}]; }];
}]]; }]];*/
#if !TARGET_OS_TV #if !TARGET_OS_TV
/*
if (host.state != StateOnline) { if (host.state != StateOnline) {
[longClickAlert addAction:[UIAlertAction actionWithTitle:[LocalizationHelper localizedStringForKey:@"NVIDIA GameStream End-of-Service"] style:UIAlertActionStyleDefault handler:^(UIAlertAction* action){ [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"]; [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){ [longClickAlert addAction:[UIAlertAction actionWithTitle:[LocalizationHelper localizedStringForKey:@"Connection Help"] style:UIAlertActionStyleDefault handler:^(UIAlertAction* action){
[Utils launchUrl:@"https://github.com/moonlight-stream/moonlight-docs/wiki/Troubleshooting"]; [Utils launchUrl:@"https://github.com/moonlight-stream/moonlight-docs/wiki/Troubleshooting"];
}]]; }]];
} }*/
#endif #endif
[longClickAlert addAction:[UIAlertAction actionWithTitle:[LocalizationHelper localizedStringForKey:@"Remove Host"] style:UIAlertActionStyleDestructive handler:^(UIAlertAction* action) { // host removed here [longClickAlert addAction:[UIAlertAction actionWithTitle:[LocalizationHelper localizedStringForKey:@"Remove Host"] style:UIAlertActionStyleDestructive handler:^(UIAlertAction* action) { // host removed here
[self->_discMan removeHostFromDiscovery:host]; [self->_discMan removeHostFromDiscovery:host];
@@ -746,7 +745,7 @@ static NSMutableSet* hostList;
}]; }];
}); });
} else { } 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); ML_PORT_FLAG_TCP_47984 | ML_PORT_FLAG_TCP_47989);
if (portTestResults != ML_TEST_RESULT_INCONCLUSIVE && portTestResults != 0) { if (portTestResults != ML_TEST_RESULT_INCONCLUSIVE && portTestResults != 0) {
error = [error stringByAppendingString:[LocalizationHelper localizedStringForKey:@"!ML_TEST_RESULT_INCONCLUSIVE"]]; error = [error stringByAppendingString:[LocalizationHelper localizedStringForKey:@"!ML_TEST_RESULT_INCONCLUSIVE"]];
@@ -1932,7 +1931,7 @@ static NSMutableSet* hostList;
[self updateHostShortcuts]; [self updateHostShortcuts];
// Update the title in case we now have a PC // 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 // Reset state first so we can rediscover hosts that were deleted before
[_discMan resetDiscoveryState]; [_discMan resetDiscoveryState];