restore osc profile decode for ios12

This commit is contained in:
TrueZhuanjia
2025-06-07 22:30:08 +08:00
parent ab2efcf05a
commit fabd01ca9e
12 changed files with 102 additions and 85 deletions
+8 -9
View File
@@ -1102,31 +1102,31 @@ ICAgICAgICAgICAgICA
<constraint firstItem="YLK-IE-ajS" firstAttribute="centerX" secondItem="fZU-G0-fgM" secondAttribute="centerX" id="xm7-a0-8G7"/>
</constraints>
</view>
<slider opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" value="1" minValue="0.59999999999999998" maxValue="6" id="Efn-Si-TPp" userLabel="Widget Size Slider">
<slider hidden="YES" opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" value="1" minValue="0.59999999999999998" maxValue="6" id="Efn-Si-TPp" userLabel="Widget Size Slider">
<rect key="frame" x="205" y="87" width="420" height="31"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<color key="backgroundColor" systemColor="secondaryLabelColor"/>
<color key="tintColor" red="0.6716768742" green="0.61711704730000005" blue="0.99902987480000005" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</slider>
<slider opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" value="1" minValue="0.59999999999999998" maxValue="6" id="ZOF-sL-e7p" userLabel="Widget Height Slider">
<slider hidden="YES" opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" value="1" minValue="0.59999999999999998" maxValue="6" id="ZOF-sL-e7p" userLabel="Widget Height Slider">
<rect key="frame" x="205" y="122" width="420" height="31"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<color key="backgroundColor" systemColor="secondaryLabelColor"/>
<color key="tintColor" red="0.6716768742" green="0.61711704730000005" blue="0.99902987480000005" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</slider>
<slider opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" value="0.83299999999999996" minValue="0.001" maxValue="0.999" id="ZLL-pE-iZh" userLabel="Widget Alpha Slider">
<slider hidden="YES" opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" value="0.83299999999999996" minValue="0.001" maxValue="0.999" id="ZLL-pE-iZh" userLabel="Widget Alpha Slider">
<rect key="frame" x="205" y="157" width="217" height="31"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<color key="backgroundColor" systemColor="secondaryLabelColor"/>
<color key="tintColor" red="0.6716768742" green="0.61711704730000005" blue="0.99902987480000005" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</slider>
<slider opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" value="1" minValue="0.0" maxValue="8" id="FRZ-xP-x2r">
<slider hidden="YES" opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" value="1" minValue="0.0" maxValue="8" id="FRZ-xP-x2r">
<rect key="frame" x="205" y="192" width="591" height="31"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<color key="backgroundColor" systemColor="secondaryLabelColor"/>
<color key="tintColor" red="0.6716768742" green="0.61711704730000005" blue="0.99902987480000005" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</slider>
<label opaque="NO" userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Profile:" textAlignment="center" lineBreakMode="tailTruncation" adjustsFontSizeToFit="NO" id="cRV-Xw-CVi">
<label hidden="YES" opaque="NO" userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Profile:" textAlignment="center" lineBreakMode="tailTruncation" adjustsFontSizeToFit="NO" id="cRV-Xw-CVi">
<rect key="frame" x="631" y="87" width="163" height="67"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<color key="backgroundColor" red="0.38551661729999998" green="0.28289704380000003" blue="0.61853601300000005" alpha="0.28999999999999998" colorSpace="custom" customColorSpace="sRGB"/>
@@ -1135,13 +1135,13 @@ ICAgICAgICAgICAgICA
<color key="textColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<nil key="highlightedColor"/>
</label>
<slider opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" value="120" minValue="0.0" maxValue="350" id="oc7-kh-RVH">
<slider hidden="YES" opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" value="120" minValue="0.0" maxValue="350" id="oc7-kh-RVH">
<rect key="frame" x="205" y="227" width="591" height="31"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<color key="backgroundColor" systemColor="secondaryLabelColor"/>
<color key="tintColor" red="0.6716768742" green="0.61711704730000005" blue="0.99902987480000005" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</slider>
<slider opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" minValue="0.0" maxValue="8" id="CCy-fw-7og" userLabel="Widget Border Width Slider">
<slider hidden="YES" opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" minValue="0.0" maxValue="8" id="CCy-fw-7og" userLabel="Widget Border Width Slider">
<rect key="frame" x="590" y="157" width="206" height="31"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<color key="backgroundColor" systemColor="secondaryLabelColor"/>
@@ -1201,8 +1201,7 @@ ICAgICAgICAgICAgICA
<constraint firstAttribute="height" constant="44" id="lQr-5u-g05"/>
</constraints>
<items>
<navigationItem title="Controller &amp; Widget Profiles" id="Q2V-XF-4jq">
<navigationItem title="Widget Profiles" id="Q2V-XF-4jq">
<leftBarButtonItems>
<barButtonItem title="Exit" width="45" style="plain" id="czn-mj-8d1">
<connections>
+1 -1
View File
@@ -366,7 +366,7 @@ import UIKit
private var commands: [RemoteCommand] = []
public weak var viewController: CommandManagerViewController?
public weak var viewController: ToolBoxViewController?
private override init() {
super.init()
+4 -16
View File
@@ -161,13 +161,7 @@ static CGRect streamViewBounds;
if (fileData && !error) {
// 3. 成功读取
NSSet *classes = [NSSet setWithObjects: [NSMutableData class], [NSMutableArray class], nil];
if (@available(iOS 13.0, *)) {
// 在 iOS 13 及以上使用 unarchivedObjectOfClasses
profilesEncoded = [NSKeyedUnarchiver unarchivedObjectOfClasses:classes fromData:fileData error:&error];
} else {
// 在 iOS 12 及以下使用 unarchiveObjectWithData(旧方法)
profilesEncoded = [NSKeyedUnarchiver unarchivedObjectOfClass:[NSMutableArray class] fromData:fileData error:&error];
}
profilesEncoded = [NSKeyedUnarchiver unarchivedObjectOfClasses:classes fromData:fileData error:&error];
[self importEncodedProfiles:profilesEncoded];
}
}
@@ -402,15 +396,9 @@ static CGRect streamViewBounds;
- (OnScreenButtonState *)unarchiveButtonStateEncoded:(NSData *)data {
OnScreenButtonState* buttonState;
if (@available(iOS 13.0, *)) {
// 在 iOS 13 及以上使用 unarchivedObjectOfClasses
buttonState = [NSKeyedUnarchiver unarchivedObjectOfClasses:[NSSet setWithObjects:[NSString class], [OnScreenButtonState class], nil]
fromData:data
error:nil];
} else {
// 在 iOS 12 及以下使用 unarchiveObjectWithData(旧方法)
buttonState = [NSKeyedUnarchiver unarchivedObjectOfClass:[OnScreenButtonState class] fromData:data error:nil];
}
buttonState = [NSKeyedUnarchiver unarchivedObjectOfClasses:[NSSet setWithObjects:[NSString class], [OnScreenButtonState class], nil]
fromData:data
error:nil];
return buttonState;
}
@@ -24,11 +24,13 @@ NS_ASSUME_NONNULL_BEGIN
@interface LayoutOnScreenControlsViewController : UIViewController
- (void)profileRefresh;
- (void)reloadOnScreenWidgetViews;
- (void)presentProfilesTableView;
@property LayoutOnScreenControls *layoutOSC; // object that contains a view which contains the on screen controller buttons that allows the user to drag and positions each button on the screen using touch
@property (nonatomic) NSMutableSet* OnScreenWidgetViews;
@property int OSCSegmentSelected;
@property (nonatomic, assign) bool quickSwitchEnabled;
@property (weak, nonatomic) IBOutlet UIButton *trashCanButton;
@property (weak, nonatomic) IBOutlet UIButton *undoButton;
@@ -129,6 +129,7 @@
[OSCProfilesManager setOnScreenWidgetViewsSet:self.OnScreenWidgetViews]; // pass the keyboard button dict to profiles manager
isToolbarHidden = NO; // keeps track if the toolbar is hidden up above the screen so that we know whether to hide or show it when the user taps the toolbar's hide/show button
_quickSwitchEnabled = false;
widgetSizeSliderLabel = [[UILabel alloc] init];
widgetHeightSliderLabel = [[UILabel alloc] init];
@@ -182,7 +183,7 @@
object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(profileRefresh)
selector:@selector(handleProfileTablViewDismiss)
name:@"OscLayoutTableViewCloseNotification"
object:nil];
@@ -225,7 +226,6 @@
}];
}];
});
[self profileRefresh];
}
@@ -233,10 +233,13 @@
- (void) viewDidAppear:(BOOL)animated {
OnScreenWidgetView.editMode = true;
selectedWidgetView = nil;
[super viewWillAppear:animated];
[self profileRefresh];
[super viewDidAppear:animated];
}
- (void) viewWillAppear:(BOOL)animated{
self.navigationController.navigationBar.hidden = _quickSwitchEnabled;
[self profileRefresh];
}
#pragma mark - Class Helper Functions
@@ -730,6 +733,7 @@
}
- (void)setupProfileLableAndSliders{
//if(_quickSwitchEnabled) return;
// self.currentProfileLabel.frame = CGRectMake(0, 0, 180, 35);
// CGFloat profileLabelXPosition = self.view.bounds.size.width - self.currentProfileLabel.frame.size.width - 20;
CGFloat sliderXPosition = (self.view.bounds.size.width - self.widgetSizeSlider.frame.size.width)/2 ;
@@ -737,7 +741,7 @@
// Set the label's frame with the calculated x-position
self.currentProfileLabel.frame = CGRectMake(profileLabelXPosition, self.currentProfileLabel.frame.origin.y, self.currentProfileLabel.frame.size.width, self.currentProfileLabel.frame.size.height);
self.currentProfileLabel.hidden = NO; // Show Current Profile display
self.currentProfileLabel.hidden = _quickSwitchEnabled; // Show Current Profile display
if (@available(iOS 13.0, *)) {
self.currentProfileLabel.textAlignment = NSTextAlignmentNatural;
self.currentProfileLabel.numberOfLines = 2;
@@ -747,7 +751,7 @@
[self.currentProfileLabel setText:[LocalizationHelper localizedStringForKey:@"Profile: %@",[profilesManager getSelectedProfile].name]]; // display current profile name when profile is being refreshed.
// button size sliders
self.widgetSizeSlider.hidden = NO;
self.widgetSizeSlider.hidden = _quickSwitchEnabled;
self.widgetSizeSlider.frame = CGRectMake(sliderXPosition, self.widgetSizeSlider.frame.origin.y, self.widgetSizeSlider.frame.size.width, self.widgetSizeSlider.frame.size.height);
[self.widgetSizeSlider addTarget:self action:@selector(widgetSizeSliderMoved) forControlEvents:(UIControlEventValueChanged)];
widgetSizeSliderLabel.text = [LocalizationHelper localizedStringForKey:@"Widget Size"];
@@ -764,10 +768,10 @@
// Align vertically with the slider
[widgetSizeSliderLabel.centerYAnchor constraintEqualToAnchor:self.widgetSizeSlider.centerYAnchor]
]];
widgetSizeSliderLabel.hidden = NO;
widgetSizeSliderLabel.hidden = _quickSwitchEnabled;
// button height sliders
self.widgetHeightSlider.hidden = NO;
self.widgetHeightSlider.hidden = _quickSwitchEnabled;
self.widgetHeightSlider.frame = CGRectMake(sliderXPosition, self.widgetHeightSlider.frame.origin.y, self.widgetHeightSlider.frame.size.width, self.widgetHeightSlider.frame.size.height);
[self.widgetHeightSlider addTarget:self action:@selector(widgetHeightSliderMoved) forControlEvents:(UIControlEventValueChanged)];
// button height label
@@ -785,10 +789,10 @@
// Align vertically with the slider
[widgetHeightSliderLabel.centerYAnchor constraintEqualToAnchor:self.widgetHeightSlider.centerYAnchor]
]];
widgetHeightSliderLabel.hidden = NO;
widgetHeightSliderLabel.hidden = _quickSwitchEnabled;
// button alpha label
self.widgetAlphaSlider.hidden = NO;
self.widgetAlphaSlider.hidden = _quickSwitchEnabled;
self.widgetAlphaSlider.frame = CGRectMake(sliderXPosition, self.widgetAlphaSlider.frame.origin.y, self.widgetAlphaSlider.frame.size.width, self.widgetAlphaSlider.frame.size.height);
[self.widgetAlphaSlider addTarget:self action:@selector(widgetAlphaSliderMoved) forControlEvents:(UIControlEventValueChanged)];
widgetAlphaSliderLabel.text = [LocalizationHelper localizedStringForKey:@"Widget Alpha"];
@@ -805,11 +809,11 @@
// Align vertically with the slider
[widgetAlphaSliderLabel.centerYAnchor constraintEqualToAnchor:self.widgetAlphaSlider.centerYAnchor]
]];
widgetAlphaSliderLabel.hidden = NO;
widgetAlphaSliderLabel.hidden = _quickSwitchEnabled;
// border Width slider
self.widgetBorderWidthSlider.hidden = NO;
self.widgetBorderWidthSlider.hidden = _quickSwitchEnabled;
self.widgetBorderWidthSlider.frame = CGRectMake(CGRectGetMaxX(self.currentProfileLabel.frame)-self.widgetBorderWidthSlider.frame.size.width, self.widgetBorderWidthSlider.frame.origin.y, self.widgetBorderWidthSlider.frame.size.width, self.widgetBorderWidthSlider.frame.size.height);
[self.widgetBorderWidthSlider addTarget:self action:@selector(widgetBorderWidthSliderMoved) forControlEvents:(UIControlEventValueChanged)];
@@ -825,7 +829,7 @@
// Align vertically with the slider
[widgetBorderWidthSliderLabel.centerYAnchor constraintEqualToAnchor:self.widgetBorderWidthSlider.centerYAnchor]
]];
widgetBorderWidthSliderLabel.hidden = NO;
widgetBorderWidthSliderLabel.hidden = _quickSwitchEnabled;
@@ -882,6 +886,10 @@
stickIndicatorOffsetSliderLabel.hidden = stickIndicatorOffsetExplain.hidden = self.stickIndicatorOffsetSlider.hidden;
}
- (void)handleProfileTablViewDismiss{
[self profileRefresh];
if(_quickSwitchEnabled) [self dismissViewControllerAnimated:NO completion:nil];
}
/* Basically the same method as loadTapped, without parameter*/
// Make sure whenever self view controller load the selected profile and layout its buttons.
@@ -917,9 +925,7 @@
// [self presentViewController:vc animated:YES completion:nil];
}
/* Presents the view controller that lists all OSC profiles the user can choose from */
- (IBAction) loadTapped:(id)sender {
- (void) presentProfilesTableView{
UIStoryboard *storyboard;
BOOL isIPhone = ([UIDevice currentDevice].userInterfaceIdiom == UIUserInterfaceIdiomPhone);
if (isIPhone) {
@@ -959,9 +965,15 @@
[self->selectedWidgetView.stickBallLayer removeFromSuperlayer];
[self->selectedWidgetView.crossMarkLayer removeFromSuperlayer];
_oscProfilesTableViewController.currentOSCButtonLayers = self.layoutOSC.OSCButtonLayers;
[self presentViewController:_oscProfilesTableViewController animated:YES completion:nil];
}
/* Presents the view controller that lists all OSC profiles the user can choose from */
- (IBAction) loadTapped:(id)sender {
[self presentProfilesTableView];
}
#pragma mark - Touch
@@ -42,7 +42,7 @@ const double NAV_BAR_HEIGHT = 50;
return [self getCurrentOrientation]; // 90 Degree rotation not allowed in streaming or app view
}
- (void) viewWillDisappear:(BOOL)animated{
- (void) viewDidDisappear:(BOOL)animated{
[super viewWillDisappear:animated];
[[NSNotificationCenter defaultCenter] postNotificationName:@"OscLayoutTableViewCloseNotification" object:self]; // notify other view that oscLayoutManager is closing
}
@@ -268,14 +268,7 @@ didPickDocumentsAtURLs:(NSArray<NSURL *> *)urls {
NSMutableArray *profilesEncoded;
// 解码原始的NSArray对象,得到包含编码对象的数组
error = nil;
if (@available(iOS 13.0, *)) {
// 在 iOS 13 及以上使用 unarchivedObjectOfClasses
profilesEncoded = [NSKeyedUnarchiver unarchivedObjectOfClasses:classes fromData:fileData error:&error];
} else {
// 在 iOS 12 及以下使用 unarchiveObjectWithData(旧方法)
profilesEncoded = [NSKeyedUnarchiver unarchivedObjectOfClass:[NSMutableArray class] fromData:fileData error:&error];
}
profilesEncoded = [NSKeyedUnarchiver unarchivedObjectOfClasses:classes fromData:fileData error:&error];
restoreFailed = error != nil;
UIAlertController *restoredAlertController = [UIAlertController alertControllerWithTitle: [LocalizationHelper localizedStringForKey:@""] message: [LocalizationHelper localizedStringForKey:@"Pofiles imported"] preferredStyle:UIAlertControllerStyleAlert];
@@ -22,7 +22,7 @@
@interface StreamFrameViewController : GCEventViewController <ConnectionCallbacks, ControllerSupportDelegate, UserInteractionDelegate, UIScrollViewDelegate>
#else
@interface StreamFrameViewController : UIViewController <ConnectionCallbacks, ControllerSupportDelegate, UserInteractionDelegate, UIScrollViewDelegate>
@interface StreamFrameViewController : UIViewController <ConnectionCallbacks, ControllerSupportDelegate, UserInteractionDelegate, UIScrollViewDelegate, ToolBoxSpecialEntryDelegate>
#endif
@property (nonatomic) StreamConfiguration* streamConfig;
@@ -73,7 +73,7 @@
CustomEdgeSlideGestureRecognizer *_slideToCmdToolRecognizer;
CustomTapGestureRecognizer *_oscLayoutTapRecoginizer;
LayoutOnScreenControlsViewController *_layoutOnScreenControlsVC;
CommandManagerViewController* cmdManViewController;
ToolBoxViewController* toolBoxViewController;
#endif
}
@@ -96,7 +96,8 @@
- (void)configOscLayoutTool{
if([self isOscLayoutToolEnabled]){
if(![cmdManViewController.specialEntries containsObject:@"widgetTool"]) [cmdManViewController.specialEntries insertObject:@"widgetTool" atIndex:0];
if(![toolBoxViewController.specialEntries containsObject:@"widgetLayoutTool"]) [toolBoxViewController.specialEntries insertObject:@"widgetLayoutTool" atIndex:0];
if(![toolBoxViewController.specialEntries containsObject:@"widgetSwitchTool"]) [toolBoxViewController.specialEntries insertObject:@"widgetSwitchTool" atIndex:1];
_oscLayoutTapRecoginizer = [[CustomTapGestureRecognizer alloc] initWithTarget:self action:@selector(layoutOSC)];
_oscLayoutTapRecoginizer.numberOfTouchesRequired = _settings.oscLayoutToolFingers.intValue; //tap a predefined number of fingers to open osc layout tool
_oscLayoutTapRecoginizer.tapDownTimeThreshold = 0.2;
@@ -120,11 +121,14 @@
_layoutOnScreenControlsVC.view.backgroundColor = UIColor.clearColor;
_layoutOnScreenControlsVC.modalPresentationStyle = UIModalPresentationOverCurrentContext;
}
else [cmdManViewController.specialEntries removeObject:@"widgetTool"];
else{
[toolBoxViewController.specialEntries removeObject:@"widgetLayoutTool"];
[toolBoxViewController.specialEntries removeObject:@"widgetSwitchTool"];
}
}
- (void)presentCommandManagerViewController{
[self presentViewController:cmdManViewController animated:YES completion:nil];
[self presentViewController:toolBoxViewController animated:YES completion:nil];
}
- (void)configSwipeGestures{
@@ -258,12 +262,7 @@
selector:@selector(expandSettingsView) // //force expand settings view to update resolution table, and all setting includes current fullscreen resolution will be updated.
name:@"SettingsOverlayButtonPressedNotification"
object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(layoutOSC) // //force expand settings view to update resolution table, and all setting includes current fullscreen resolution will be updated.
name:@"OscLayoutToolOpenedFromCmdToolNotification"
object:nil];
#endif
#endif
}
#if TARGET_OS_TV
@@ -361,7 +360,8 @@
_streamView = [[StreamView alloc] initWithFrame:self.view.frame];
cmdManViewController = [[CommandManagerViewController alloc] init];
toolBoxViewController = [[ToolBoxViewController alloc] init];
toolBoxViewController.specialEntryDelegate = self;
/*
_settings.externalDisplayMode.intValue:
@@ -464,12 +464,26 @@
[self.view addSubview:_tipLabel];
}
- (void)layoutOSC{
- (void)openWidgetLayoutTool{
[self->_streamView disableOnScreenControls];
[self->_streamView clearOnScreenKeyboardButtons]; // clear all onScreenKeyboardButtons before entering edit mode
_layoutOnScreenControlsVC.quickSwitchEnabled = false;
_layoutOnScreenControlsVC.toolbarStackView.hidden = false;
_layoutOnScreenControlsVC.toolbarRootView.hidden = false;
[self presentViewController:_layoutOnScreenControlsVC animated:YES completion:nil];
}
- (void)switchWidgetProfile{
[self->_streamView disableOnScreenControls];
[self->_streamView clearOnScreenKeyboardButtons]; // clear all onScreenKeyboardButtons before entering edit mode
_layoutOnScreenControlsVC.quickSwitchEnabled = true;
_layoutOnScreenControlsVC.toolbarStackView.hidden = true;
_layoutOnScreenControlsVC.toolbarRootView.hidden = true;
[self presentViewController:_layoutOnScreenControlsVC animated:NO completion:^{
[self->_layoutOnScreenControlsVC presentProfilesTableView];
}];
}
- (void)oscLayoutClosed{
// Handle the callback
[self->_streamView disableOnScreenControls]; // add this to get realtime back menu working.
@@ -8,8 +8,13 @@
import UIKit
@objc public class CommandManagerViewController: UIViewController, UITableViewDataSource, UITableViewDelegate {
@objc public class ToolBoxViewController: UIViewController, UITableViewDataSource, UITableViewDelegate {
@objc protocol ToolBoxSpecialEntryDelegate: NSObjectProtocol {
@objc optional func openWidgetLayoutTool()
@objc optional func switchWidgetProfile()
}
@objc weak var specialEntryDelegate: ToolBoxSpecialEntryDelegate?
public let tableView = UITableView()
private let addButton = UIButton(type: .system)
private let deleteButton = UIButton(type: .system)
@@ -19,9 +24,10 @@ import UIKit
private let viewBackgroundColor = UIColor(white: 0.2, alpha: 0.8);
private let highlightColor = UIColor(white: 0.39, alpha: 0.8);
private let titleLabel = UILabel()
@objc public var specialEntries : NSMutableArray = ["widgetTool"]
@objc public var specialEntries : NSMutableArray = ["widgetLayoutTool"]
private let specialEntryAliasDic : [String:String] = [
"widgetTool":SwiftLocalizationHelper.localizedString(forKey: "[ Open On-Screen Widget Tool ]")
"widgetSwitchTool":SwiftLocalizationHelper.localizedString(forKey: "[ Switch among on-screen widget profiles ]"),
"widgetLayoutTool":SwiftLocalizationHelper.localizedString(forKey: "[ Open on-screen widget tool ]")
]
private var viewPinned: Bool = false
@@ -333,15 +339,18 @@ import UIKit
}
private func handleSpecialEntries(index:Int){
usleep(1000*100)
dismiss(animated: true, completion: nil)
switch specialEntries[index] as? String {
case "widgetTool":
usleep(1000*150)
dismiss(animated: true, completion: nil)
NotificationCenter.default.post(name: Notification.Name("OscLayoutToolOpenedFromCmdToolNotification"),object: nil) // inform streamFrameViewController to open osc tool
case "widgetLayoutTool":
specialEntryDelegate?.openWidgetLayoutTool!()
case "widgetSwitchTool":
specialEntryDelegate?.switchWidgetProfile?()
default: break
}
}
private func sendKeyboardCommand(_ cmd: RemoteCommand) {
print("Sending key-value")
let keyboardCmdStrings = CommandManager.shared.extractKeyStringsFromComboCommand(from: cmd.cmdString)
+7 -7
View File
@@ -3068,31 +3068,31 @@
}
},
"Q2V-XF-4jq.title" : {
"comment" : "Class = \"UINavigationItem\"; title = \"Controller & Widget Profiles\"; ObjectID = \"Q2V-XF-4jq\";",
"comment" : "Class = \"UINavigationItem\"; title = \"Widget Profiles\"; ObjectID = \"Q2V-XF-4jq\";",
"extractionState" : "extracted_with_value",
"localizations" : {
"en" : {
"stringUnit" : {
"state" : "new",
"value" : "Controller & Widget Profiles"
"value" : "Widget Profiles"
}
},
"zh-Hans" : {
"stringUnit" : {
"state" : "translated",
"value" : "屏显手柄与控件布局"
"value" : "屏显控件布局"
}
},
"zh-Hant" : {
"stringUnit" : {
"state" : "needs_review",
"value" : "屏显手柄与控件布局"
"state" : "translated",
"value" : "屏显控件布局"
}
},
"zh-HK" : {
"stringUnit" : {
"state" : "needs_review",
"value" : "屏显手柄与控件布局"
"state" : "translated",
"value" : "屏显控件布局"
}
}
}
+3 -3
View File
@@ -1406,19 +1406,19 @@
"zh-Hans" : {
"stringUnit" : {
"state" : "translated",
"value" : "屏幕虚拟手柄与控件"
"value" : "屏显控件布局"
}
},
"zh-Hant" : {
"stringUnit" : {
"state" : "translated",
"value" : "屏幕虚拟手柄与控件"
"value" : "屏显控件布局"
}
},
"zh-HK" : {
"stringUnit" : {
"state" : "translated",
"value" : "屏幕虚拟手柄与控件"
"value" : "屏显控件布局"
}
}
}
+4 -4
View File
@@ -32,7 +32,7 @@
847D2FDB2DDA015F00937A62 /* MenuSectionView.m in Sources */ = {isa = PBXBuildFile; fileRef = 847D2FDA2DDA015F00937A62 /* MenuSectionView.m */; };
848F456A2DDCD12500581E36 /* HostCardView.m in Sources */ = {isa = PBXBuildFile; fileRef = 848F45692DDCD12500581E36 /* HostCardView.m */; };
84E1CDEC2C4F67D300547904 /* CommandManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84E1CDEB2C4F67D300547904 /* CommandManager.swift */; };
84E1CDEF2C4F688E00547904 /* CommandManagerViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84E1CDEE2C4F688E00547904 /* CommandManagerViewController.swift */; };
84E1CDEF2C4F688E00547904 /* ToolBoxViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84E1CDEE2C4F688E00547904 /* ToolBoxViewController.swift */; };
84E1CDFA2C4FE83400547904 /* SwiftLocalizationHelper.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84E1CDF92C4FE83400547904 /* SwiftLocalizationHelper.swift */; };
84FD0B512C31338D006B5BE5 /* LocalizationHelper.m in Sources */ = {isa = PBXBuildFile; fileRef = 84FD0B502C31338D006B5BE5 /* LocalizationHelper.m */; };
84FD0B542C3134A6006B5BE5 /* Localizable.xcstrings in Resources */ = {isa = PBXBuildFile; fileRef = 84FD0B532C3134A6006B5BE5 /* Localizable.xcstrings */; };
@@ -177,7 +177,7 @@
848F45692DDCD12500581E36 /* HostCardView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = HostCardView.m; sourceTree = "<group>"; };
84D8EB932C5146AD00FC10A9 /* Moonlight-Bridging-Header.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "Moonlight-Bridging-Header.h"; sourceTree = "<group>"; };
84E1CDEB2C4F67D300547904 /* CommandManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CommandManager.swift; sourceTree = "<group>"; };
84E1CDEE2C4F688E00547904 /* CommandManagerViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CommandManagerViewController.swift; sourceTree = "<group>"; };
84E1CDEE2C4F688E00547904 /* ToolBoxViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ToolBoxViewController.swift; sourceTree = "<group>"; };
84E1CDF92C4FE83400547904 /* SwiftLocalizationHelper.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SwiftLocalizationHelper.swift; sourceTree = "<group>"; };
84FD0B4F2C313343006B5BE5 /* LocalizationHelper.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = LocalizationHelper.h; sourceTree = "<group>"; };
84FD0B502C31338D006B5BE5 /* LocalizationHelper.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = LocalizationHelper.m; sourceTree = "<group>"; };
@@ -638,7 +638,7 @@
FBD3494F19FF2174002D2A60 /* SettingsViewController.m */,
FB4A23B61A9D3637004D2EF2 /* LoadingFrameViewController.h */,
FB4A23B71A9D3637004D2EF2 /* LoadingFrameViewController.m */,
84E1CDEE2C4F688E00547904 /* CommandManagerViewController.swift */,
84E1CDEE2C4F688E00547904 /* ToolBoxViewController.swift */,
);
path = ViewControllers;
sourceTree = "<group>";
@@ -897,7 +897,7 @@
FB89463619F646E200339C8A /* StreamFrameViewController.m in Sources */,
9827E7A32514366900F25707 /* HapticContext.m in Sources */,
9832D1361BBCD5C50036EF48 /* TemporaryApp.m in Sources */,
84E1CDEF2C4F688E00547904 /* CommandManagerViewController.swift in Sources */,
84E1CDEF2C4F688E00547904 /* ToolBoxViewController.swift in Sources */,
844CD0EB2C7F8500004861A7 /* PureNativeTouchHandler.m in Sources */,
84351B102C29ACCB00A77989 /* OSCProfile.m in Sources */,
84351B2C2C29AD6100A77989 /* OSCProfilesTableViewController.m in Sources */,