Skip to content

Commit

Permalink
Merge pull request #572 from Chilledheart/ios_update_translations
Browse files Browse the repository at this point in the history
Ios update translations
  • Loading branch information
Chilledheart committed Dec 24, 2023
2 parents 681c53a + e0ac8e5 commit 2e88752
Show file tree
Hide file tree
Showing 9 changed files with 126 additions and 178 deletions.
2 changes: 2 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
40 changes: 20 additions & 20 deletions src/ios/Base.lproj/Main.storyboard
Original file line number Diff line number Diff line change
Expand Up @@ -36,49 +36,42 @@
</connections>
</button>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" text="Server Host" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="1EK-58-4Tb">
<rect key="frame" x="36" y="121" width="90" height="21"/>
<rect key="frame" x="36" y="121" width="117" height="21"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" text="Server Port" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="h37-oZ-p8D">
<rect key="frame" x="38" y="174" width="86" height="21"/>
<rect key="frame" x="38" y="174" width="115" height="21"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" text="Username" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="dFn-KS-gx8">
<rect key="frame" x="42" y="226" width="78" height="21"/>
<rect key="frame" x="42" y="226" width="111" height="21"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" text="Password" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="bEh-We-3bh">
<rect key="frame" x="44" y="279" width="74" height="21"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" text="Cipher/Method" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="ENX-yq-A0k">
<rect key="frame" x="24" y="349" width="114" height="21"/>
<rect key="frame" x="44" y="279" width="109" height="21"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" text="Timeout" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="3S5-0B-efx">
<rect key="frame" x="50" y="416" width="62" height="21"/>
<rect key="frame" x="50" y="432" width="103" height="21"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" text="0.0.0.0" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="e9s-1Y-S5l">
<rect key="frame" x="256" y="488" width="51" height="21"/>
<rect key="frame" x="223" y="488" width="171" height="21"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<nil key="textColor"/>
Expand All @@ -92,46 +85,53 @@
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" text="Current IP" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="yg8-lk-vMp">
<rect key="frame" x="43" y="488" width="77" height="21"/>
<rect key="frame" x="43" y="488" width="110" height="21"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
<textField opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="248" fixedFrame="YES" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="roundedRect" textAlignment="natural" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="GsR-Z4-fTf">
<rect key="frame" x="223" y="114" width="97" height="34"/>
<rect key="frame" x="223" y="114" width="171" height="34"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<fontDescription key="fontDescription" type="system" pointSize="14"/>
<textInputTraits key="textInputTraits"/>
</textField>
<textField opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="248" fixedFrame="YES" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="roundedRect" textAlignment="natural" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="1hy-kK-Mai">
<rect key="frame" x="223" y="167" width="97" height="34"/>
<rect key="frame" x="223" y="167" width="171" height="34"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<fontDescription key="fontDescription" type="system" pointSize="14"/>
<textInputTraits key="textInputTraits"/>
</textField>
<textField opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="248" fixedFrame="YES" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="roundedRect" textAlignment="natural" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="mfn-dW-cAI">
<rect key="frame" x="223" y="219" width="97" height="34"/>
<rect key="frame" x="223" y="219" width="171" height="34"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<fontDescription key="fontDescription" type="system" pointSize="14"/>
<textInputTraits key="textInputTraits"/>
</textField>
<textField opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="248" fixedFrame="YES" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="roundedRect" textAlignment="natural" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="pfU-fE-5kl">
<rect key="frame" x="223" y="272" width="97" height="34"/>
<rect key="frame" x="223" y="272" width="171" height="34"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<fontDescription key="fontDescription" type="system" pointSize="14"/>
<textInputTraits key="textInputTraits" textContentType="password"/>
</textField>
<textField opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="248" fixedFrame="YES" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="roundedRect" textAlignment="natural" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="mMz-Er-D0n">
<rect key="frame" x="223" y="409" width="97" height="34"/>
<rect key="frame" x="223" y="425" width="171" height="34"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<fontDescription key="fontDescription" type="system" pointSize="14"/>
<textInputTraits key="textInputTraits"/>
</textField>
<pickerView contentMode="scaleToFill" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="lHf-f6-QZT">
<rect key="frame" x="169" y="318" width="225" height="83"/>
<rect key="frame" x="223" y="314" width="171" height="103"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
</pickerView>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" text="Cipher/Method" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="ENX-yq-A0k">
<rect key="frame" x="33" y="355" width="111" height="21"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<viewLayoutGuide key="safeArea" id="vDu-zF-Fre"/>
<color key="backgroundColor" systemColor="systemBackgroundColor"/>
Expand Down
2 changes: 2 additions & 0 deletions src/ios/YassAppDelegate.mm
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ @implementation YassAppDelegate {
}

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary<UIApplicationLaunchOptionsKey,id> *)launchOptions {
state_ = STOPPED;
pthread_set_qos_class_self_np(QOS_CLASS_USER_INTERACTIVE, 0);
return YES;
}

Expand Down
6 changes: 6 additions & 0 deletions src/ios/YassViewController.mm
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -61,6 +62,7 @@ - (void)viewDidLoad {
[self.cipherMethod reloadAllComponents];

[self LoadChanges];
[self UpdateStatusBar];
[self.startButton setEnabled:TRUE];
[self.stopButton setEnabled:FALSE];
}
Expand Down Expand Up @@ -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
97 changes: 18 additions & 79 deletions src/ios/en.lproj/Main.strings
Original file line number Diff line number Diff line change
@@ -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";
11 changes: 11 additions & 0 deletions src/ios/utils.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// SPDX-License-Identifier: GPL-2.0
/* Copyright (c) 2023 Chilledheart */
#ifndef YASS_IOS_UTILS
#define YASS_IOS_UTILS

#include <string>
#include <vector>

std::vector<std::string> GetIpAddress();

#endif // YASS_IOS_UTILS
Loading

0 comments on commit 2e88752

Please sign in to comment.