diff --git a/CMakeLists.txt b/CMakeLists.txt
index 46e4e565b..49b69b1b5 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -3732,6 +3732,8 @@ if (GUI)
src/ios/YassViewController.h
src/ios/YassSceneDelegate.h
src/ios/YassSceneDelegate.mm
+ src/ios/utils.h
+ src/ios/utils.mm
src/ios/main.mm)
elseif(GUI_FLAVOUR STREQUAL "gtk3")
list(APPEND SRC_FILES
diff --git a/src/ios/Base.lproj/Main.storyboard b/src/ios/Base.lproj/Main.storyboard
index 93cf9fe03..786b984ef 100644
--- a/src/ios/Base.lproj/Main.storyboard
+++ b/src/ios/Base.lproj/Main.storyboard
@@ -36,49 +36,42 @@
-
-
+
-
+
-
+
-
+
-
+
-
+
+
diff --git a/src/ios/YassAppDelegate.mm b/src/ios/YassAppDelegate.mm
index 2a8f3aa6f..765e6fde3 100644
--- a/src/ios/YassAppDelegate.mm
+++ b/src/ios/YassAppDelegate.mm
@@ -32,6 +32,8 @@ @implementation YassAppDelegate {
}
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
+ state_ = STOPPED;
+ pthread_set_qos_class_self_np(QOS_CLASS_USER_INTERACTIVE, 0);
return YES;
}
diff --git a/src/ios/YassViewController.mm b/src/ios/YassViewController.mm
index 9a7e14a51..ba2a80a7f 100644
--- a/src/ios/YassViewController.mm
+++ b/src/ios/YassViewController.mm
@@ -15,6 +15,7 @@
#include "core/utils.hpp"
#include "crypto/crypter_export.hpp"
#include "ios/YassAppDelegate.h"
+#include "ios/utils.h"
static void humanReadableByteCountBin(std::ostream* ss, uint64_t bytes) {
if (bytes < 1024) {
@@ -61,6 +62,7 @@ - (void)viewDidLoad {
[self.cipherMethod reloadAllComponents];
[self LoadChanges];
+ [self UpdateStatusBar];
[self.startButton setEnabled:TRUE];
[self.stopButton setEnabled:FALSE];
}
@@ -220,6 +222,10 @@ - (void)LoadChanges {
self.timeout.text =
gurl_base::SysUTF8ToNSString(std::to_string(absl::GetFlag(FLAGS_connect_timeout)));
+ auto ip_addresses = GetIpAddress();
+ if (!ip_addresses.empty()) {
+ self.currentIP.text = gurl_base::SysUTF8ToNSString(ip_addresses[0] + ":3000");
+ }
}
@end
diff --git a/src/ios/en.lproj/Main.strings b/src/ios/en.lproj/Main.strings
index 8696629fa..bee49c4c0 100644
--- a/src/ios/en.lproj/Main.strings
+++ b/src/ios/en.lproj/Main.strings
@@ -1,87 +1,26 @@
+/* Class = "UILabel"; text = "Password"; ObjectID = "9N4-Lw-6Ob"; */
+"bEh-We-3bh.text" = "Password";
-/* Class = "NSMenuItem"; title = "YASS"; ObjectID = "1Xt-HY-uBw"; */
-"1Xt-HY-uBw.title" = "YASS";
+/* Class = "UIButton"; text = "Stop"; ObjectID = "JYa-MA-4KH"; */
+"MGs-Nl-c5G.text" = "Stop";
-/* Class = "NSTextFieldCell"; title = "Local Port"; ObjectID = "3bJ-wb-xnh"; */
-"3bJ-wb-xnh.title" = "Local Port";
+/* Class = "UIButton"; text = "Start"; ObjectID = "KPU-2Q-dN7"; */
+"mgH-S8-WUJ.text" = "Start";
-/* Class = "NSMenuItem"; title = "Quit YASS"; ObjectID = "4sb-4s-VLi"; */
-"4sb-4s-VLi.title" = "Quit YASS";
+/* Class = "UILabel"; text = "Username"; ObjectID = "QRy-PK-jJT"; */
+"dFn-KS-gx8.text" = "Username";
-/* Class = "NSMenuItem"; title = "About YASS"; ObjectID = "5kV-Vb-QxS"; */
-"5kV-Vb-QxS.title" = "About YASS";
+/* Class = "UILabel"; text = "Server Host"; ObjectID = "g3k-Ab-Oin"; */
+"1EK-58-4Tb.text" = "Server Host";
-/* Class = "NSTextFieldCell"; title = "Auto Start"; ObjectID = "8hL-Qd-hQU"; */
-"8hL-Qd-hQU.title" = "Auto Start";
+/* Class = "UILabel"; text = "Server Port"; ObjectID = "mcp-Vm-U1E"; */
+"h37-oZ-p8D.text" = "Server Port";
-/* Class = "NSTextFieldCell"; title = "Password"; ObjectID = "9N4-Lw-6Ob"; */
-"9N4-Lw-6Ob.title" = "Password";
+/* Class = "UILabel"; text = "Cipher/Method"; ObjectID = "tOi-q9-yJY"; */
+"ENX-yq-A0k.text" = "Cipher/Method";
-/* Class = "NSMenu"; title = "Main Menu"; ObjectID = "AYu-sK-qS6"; */
-"AYu-sK-qS6.title" = "Main Menu";
+/* Class = "UILabel"; text = "Timeout"; ObjectID = "zY6-tD-aUd"; */
+"3S5-0B-efx.text" = "Timeout";
-/* Class = "NSTextFieldCell"; title = "TCP Keep Alive Count"; ObjectID = "DwU-MU-ncE"; */
-"DwU-MU-ncE.title" = "TCP Keep Alive Count";
-
-/* Class = "NSTextFieldCell"; title = "TCP Keep Alive Idle Timeout"; ObjectID = "EnC-Oa-kda"; */
-"EnC-Oa-kda.title" = "TCP Keep Alive Idle Timeout";
-
-/* Class = "NSWindow"; title = "Yet Another Shadow Socket"; ObjectID = "IQv-IB-iLA"; */
-"IQv-IB-iLA.title" = "Yet Another Shadow Socket";
-
-/* Class = "NSButtonCell"; title = "Enable"; ObjectID = "IpF-Ur-Zlh"; */
-"IpF-Ur-Zlh.title" = "Enable";
-
-/* Class = "NSButtonCell"; title = "Stop"; ObjectID = "JYa-MA-4KH"; */
-"JYa-MA-4KH.title" = "Stop";
-
-/* Class = "NSButtonCell"; title = "Enable"; ObjectID = "Jw2-My-hmB"; */
-"Jw2-My-hmB.title" = "Enable";
-
-/* Class = "NSButtonCell"; title = "Start"; ObjectID = "KPU-2Q-dN7"; */
-"KPU-2Q-dN7.title" = "Start";
-
-/* Class = "NSButtonCell"; title = "Cancel"; ObjectID = "Mei-lK-JLB"; */
-"Mei-lK-JLB.title" = "Cancel";
-
-/* Class = "NSTextFieldCell"; title = "Username"; ObjectID = "QRy-PK-jJT"; */
-"QRy-PK-jJT.title" = "Username";
-
-/* Class = "NSTextFieldCell"; title = "TCP Keep Alive Interval"; ObjectID = "dCR-E3-G0W"; */
-"dCR-E3-G0W.title" = "TCP Keep Alive Interval";
-
-/* Class = "NSTextFieldCell"; title = "System Proxy"; ObjectID = "g0k-mZ-0JW"; */
-"g0k-mZ-0JW.title" = "System Proxy";
-
-/* Class = "NSTextFieldCell"; title = "Server Host"; ObjectID = "g3k-Ab-Oin"; */
-"g3k-Ab-Oin.title" = "Server Host";
-
-/* Class = "NSButtonCell"; title = "Enable"; ObjectID = "hei-7a-ZHr"; */
-"hei-7a-ZHr.title" = "Enable";
-
-/* Class = "NSTextFieldCell"; title = "Server Port"; ObjectID = "mcp-Vm-U1E"; */
-"mcp-Vm-U1E.title" = "Server Port";
-
-/* Class = "NSMenuItem"; title = "Option"; ObjectID = "n7v-aO-ITf"; */
-"n7v-aO-ITf.title" = "Option";
-
-/* Class = "NSComboBoxCell"; qHI-jj-mpI.ibShadowedObjectValues[0] = "Item"; ObjectID = "qHI-jj-mpI"; */
-"qHI-jj-mpI.ibShadowedObjectValues[0]" = "Item";
-
-/* Class = "NSTextFieldCell"; title = "Local Host"; ObjectID = "rim-zj-Iub"; */
-"rim-zj-Iub.title" = "Local Host";
-
-/* Class = "NSTextFieldCell"; title = "Cipher/Method"; ObjectID = "tOi-q9-yJY"; */
-"tOi-q9-yJY.title" = "Cipher/Method";
-
-/* Class = "NSMenu"; title = "YASS"; ObjectID = "uQy-DD-JDr"; */
-"uQy-DD-JDr.title" = "YASS";
-
-/* Class = "NSButtonCell"; title = "OK"; ObjectID = "yzs-Gu-p7Y"; */
-"yzs-Gu-p7Y.title" = "OK";
-
-/* Class = "NSTextFieldCell"; title = "TCP Keep Alive"; ObjectID = "z0q-m8-6KJ"; */
-"z0q-m8-6KJ.title" = "TCP Keep Alive";
-
-/* Class = "NSTextFieldCell"; title = "Timeout"; ObjectID = "zY6-tD-aUd"; */
-"zY6-tD-aUd.title" = "Timeout";
+/* Class = "UILabel"; text = "Current IP"; ObjectID = "zY6-tD-aUd"; */
+"yg8-lk-vMp.text" = "Current IP";
diff --git a/src/ios/utils.h b/src/ios/utils.h
new file mode 100644
index 000000000..a64aa7582
--- /dev/null
+++ b/src/ios/utils.h
@@ -0,0 +1,11 @@
+// SPDX-License-Identifier: GPL-2.0
+/* Copyright (c) 2023 Chilledheart */
+#ifndef YASS_IOS_UTILS
+#define YASS_IOS_UTILS
+
+#include
+#include
+
+std::vector GetIpAddress();
+
+#endif // YASS_IOS_UTILS
diff --git a/src/ios/utils.mm b/src/ios/utils.mm
new file mode 100644
index 000000000..b4f214aa4
--- /dev/null
+++ b/src/ios/utils.mm
@@ -0,0 +1,49 @@
+// SPDX-License-Identifier: GPL-2.0
+/* Copyright (c) 2023 Chilledheart */
+
+#include "ios/utils.h"
+#include "core/logging.hpp"
+
+#include
+#include
+#include
+#include
+#include
+
+std::vector GetIpAddress() {
+ struct ifaddrs *ifa, *ifaddr;
+ int ret = getifaddrs(&ifaddr);
+ if (ret != 0) {
+ PLOG(INFO) << "getifaddrs failed";
+ return {};
+ }
+ std::vector result, result_v6;
+ for (ifa = ifaddr;ifa; ifa = ifa->ifa_next) {
+ // ignoring p2p ip
+ if (ifa->ifa_flags & IFF_POINTOPOINT) {
+ continue;
+ }
+ if ((ifa->ifa_flags & (IFF_UP|IFF_RUNNING|IFF_LOOPBACK)) ==
+ (IFF_UP|IFF_RUNNING)) {
+ if (ifa->ifa_addr->sa_family == AF_INET || ifa->ifa_addr->sa_family ==
+ AF_INET6) {
+ int s;
+ char host[NI_MAXHOST] = {};
+
+ s = getnameinfo(ifa->ifa_addr, ifa->ifa_addr->sa_len, host,
+ NI_MAXHOST, NULL, 0, NI_NUMERICHOST);
+ if (s == 0) {
+ LOG(INFO) << "GetIpAddress: interface: " << ifa->ifa_name << " ip address: " << host;
+ if (ifa->ifa_addr->sa_family == AF_INET6) {
+ result_v6.push_back(host);
+ } else {
+ result.push_back(host);
+ }
+ }
+ }
+ }
+ }
+ freeifaddrs(ifaddr);
+ result.insert(result.end(), result_v6.begin(), result_v6.end());
+ return result;
+}
diff --git a/src/ios/zh-Hans.lproj/Localizable.strings b/src/ios/zh-Hans.lproj/Localizable.strings
index 925142fd4..f73a29557 100644
Binary files a/src/ios/zh-Hans.lproj/Localizable.strings and b/src/ios/zh-Hans.lproj/Localizable.strings differ
diff --git a/src/ios/zh-Hans.lproj/Main.strings b/src/ios/zh-Hans.lproj/Main.strings
index 07fafabf4..72ecb7885 100644
--- a/src/ios/zh-Hans.lproj/Main.strings
+++ b/src/ios/zh-Hans.lproj/Main.strings
@@ -1,87 +1,26 @@
+/* Class = "UILabel"; text = "Password"; ObjectID = "9N4-Lw-6Ob"; */
+"bEh-We-3bh.text" = "密码";
-/* Class = "NSMenuItem"; title = "YASS"; ObjectID = "1Xt-HY-uBw"; */
-"1Xt-HY-uBw.title" = "YASS";
+/* Class = "UIButton"; text = "Stop"; ObjectID = "JYa-MA-4KH"; */
+"MGs-Nl-c5G.text" = "停止";
-/* Class = "NSTextFieldCell"; title = "Local Port"; ObjectID = "3bJ-wb-xnh"; */
-"3bJ-wb-xnh.title" = "本地端口";
+/* Class = "UIButton"; text = "Start"; ObjectID = "KPU-2Q-dN7"; */
+"mgH-S8-WUJ.text" = "启动";
-/* Class = "NSMenuItem"; title = "Quit YASS"; ObjectID = "4sb-4s-VLi"; */
-"4sb-4s-VLi.title" = "退出";
+/* Class = "UILabel"; text = "Username"; ObjectID = "QRy-PK-jJT"; */
+"dFn-KS-gx8.text" = "用户名";
-/* Class = "NSMenuItem"; title = "About YASS"; ObjectID = "5kV-Vb-QxS"; */
-"5kV-Vb-QxS.title" = "关于 YASS";
+/* Class = "UILabel"; text = "Server Host"; ObjectID = "g3k-Ab-Oin"; */
+"1EK-58-4Tb.text" = "服务器域名";
-/* Class = "NSTextFieldCell"; title = "Auto Start"; ObjectID = "8hL-Qd-hQU"; */
-"8hL-Qd-hQU.title" = "随系统启动";
+/* Class = "UILabel"; text = "Server Port"; ObjectID = "mcp-Vm-U1E"; */
+"h37-oZ-p8D.text" = "服务器端口号";
-/* Class = "NSTextFieldCell"; title = "Password"; ObjectID = "9N4-Lw-6Ob"; */
-"9N4-Lw-6Ob.title" = "密码";
+/* Class = "UILabel"; text = "Cipher/Method"; ObjectID = "tOi-q9-yJY"; */
+"ENX-yq-A0k.text" = "加密方式";
-/* Class = "NSMenu"; title = "Main Menu"; ObjectID = "AYu-sK-qS6"; */
-"AYu-sK-qS6.title" = "主菜单";
+/* Class = "UILabel"; text = "Timeout"; ObjectID = "zY6-tD-aUd"; */
+"3S5-0B-efx.text" = "超时时间";
-/* Class = "NSTextFieldCell"; title = "TCP Keep Alive Count"; ObjectID = "DwU-MU-ncE"; */
-"DwU-MU-ncE.title" = "TCP 保活数目";
-
-/* Class = "NSTextFieldCell"; title = "TCP Keep Alive Idle Timeout"; ObjectID = "EnC-Oa-kda"; */
-"EnC-Oa-kda.title" = "TCP 在闲置以后的保活次数";
-
-/* Class = "NSWindow"; title = "Yet Another Shadow Socket"; ObjectID = "IQv-IB-iLA"; */
-"IQv-IB-iLA.title" = "YASS";
-
-/* Class = "NSButtonCell"; title = "Enable"; ObjectID = "IpF-Ur-Zlh"; */
-"IpF-Ur-Zlh.title" = "启用";
-
-/* Class = "NSButtonCell"; title = "Stop"; ObjectID = "JYa-MA-4KH"; */
-"JYa-MA-4KH.title" = "停止";
-
-/* Class = "NSButtonCell"; title = "Enable"; ObjectID = "Jw2-My-hmB"; */
-"Jw2-My-hmB.title" = "启用";
-
-/* Class = "NSButtonCell"; title = "Start"; ObjectID = "KPU-2Q-dN7"; */
-"KPU-2Q-dN7.title" = "启动";
-
-/* Class = "NSButtonCell"; title = "Cancel"; ObjectID = "Mei-lK-JLB"; */
-"Mei-lK-JLB.title" = "取消";
-
-/* Class = "NSTextFieldCell"; title = "Username"; ObjectID = "QRy-PK-jJT"; */
-"QRy-PK-jJT.title" = "用户名";
-
-/* Class = "NSTextFieldCell"; title = "TCP Keep Alive Interval"; ObjectID = "dCR-E3-G0W"; */
-"dCR-E3-G0W.title" = "TCP 保活间隔";
-
-/* Class = "NSTextFieldCell"; title = "System Proxy"; ObjectID = "g0k-mZ-0JW"; */
-"g0k-mZ-0JW.title" = "系统代理";
-
-/* Class = "NSTextFieldCell"; title = "Server Host"; ObjectID = "g3k-Ab-Oin"; */
-"g3k-Ab-Oin.title" = "服务器域名";
-
-/* Class = "NSButtonCell"; title = "Enable"; ObjectID = "hei-7a-ZHr"; */
-"hei-7a-ZHr.title" = "启用";
-
-/* Class = "NSTextFieldCell"; title = "Server Port"; ObjectID = "mcp-Vm-U1E"; */
-"mcp-Vm-U1E.title" = "服务器端口号";
-
-/* Class = "NSMenuItem"; title = "Option"; ObjectID = "n7v-aO-ITf"; */
-"n7v-aO-ITf.title" = "选项";
-
-/* Class = "NSComboBoxCell"; qHI-jj-mpI.ibShadowedObjectValues[0] = "Item"; ObjectID = "qHI-jj-mpI"; */
-"qHI-jj-mpI.ibShadowedObjectValues[0]" = "Item";
-
-/* Class = "NSTextFieldCell"; title = "Local Host"; ObjectID = "rim-zj-Iub"; */
-"rim-zj-Iub.title" = "本地域名";
-
-/* Class = "NSTextFieldCell"; title = "Cipher/Method"; ObjectID = "tOi-q9-yJY"; */
-"tOi-q9-yJY.title" = "加密方式";
-
-/* Class = "NSMenu"; title = "YASS"; ObjectID = "uQy-DD-JDr"; */
-"uQy-DD-JDr.title" = "YASS";
-
-/* Class = "NSButtonCell"; title = "OK"; ObjectID = "yzs-Gu-p7Y"; */
-"yzs-Gu-p7Y.title" = "确认";
-
-/* Class = "NSTextFieldCell"; title = "TCP Keep Alive"; ObjectID = "z0q-m8-6KJ"; */
-"z0q-m8-6KJ.title" = "TCP 保活";
-
-/* Class = "NSTextFieldCell"; title = "Timeout"; ObjectID = "zY6-tD-aUd"; */
-"zY6-tD-aUd.title" = "超时时间";
+/* Class = "UILabel"; text = "Current IP"; ObjectID = "zY6-tD-aUd"; */
+"yg8-lk-vMp.text" = "本机IP地址";