host view improvements

This commit is contained in:
TrueZhuanjia
2025-07-27 02:13:11 +08:00
parent 5fcfa84766
commit 96f11a4a69
3 changed files with 48 additions and 26 deletions
+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" : {
"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%@"
}
}
}
+1 -1
View File
@@ -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;
@@ -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];