Merge branch 'iOS26UI' into Integration

This commit is contained in:
True Zhuanjia committed 2026-03-15 11:43:36 +08:00
commit deba65857d
3 files changed
+61 -22

No files matched your search

-1
View File
@@ -325,7 +325,6 @@ static const float REFRESH_CYCLE = 2.0f;
if (@available(iOS 13.0, *)) { if (@available(iOS 13.0, *)) {
UIImageSymbolConfiguration *config = [UIImageSymbolConfiguration configurationWithPointSize:buttonHeight*0.263]; UIImageSymbolConfiguration *config = [UIImageSymbolConfiguration configurationWithPointSize:buttonHeight*0.263];
[self.launchButton setImage:[UIImage systemImageNamed:@"play.fill" withConfiguration:config] forState:UIControlStateNormal]; [self.launchButton setImage:[UIImage systemImageNamed:@"play.fill" withConfiguration:config] forState:UIControlStateNormal];
} else { } else {
// Fallback on earlier versions // Fallback on earlier versions
} }
+57 -21
View File
@@ -249,12 +249,30 @@ static const double X1_MOUSE_SPEED_DIVISOR = 2.5;
- (void)keyboardWillShow:(NSNotification *)notification{ - (void)keyboardWillShow:(NSNotification *)notification{
// NSLog(@"keyboard will show markmark %f", CACurrentMediaTime()); // NSLog(@"keyboard will show markmark %f", CACurrentMediaTime());
if(settings.liftStreamViewForKeyboard && !isInputingText){ if(settings.liftStreamViewForKeyboard && !isInputingText){
isInputingText = true;
NSDictionary *userInfo = notification.userInfo; NSDictionary *userInfo = notification.userInfo;
// Get the keyboard size from the notification // Get the keyboard size from the notification
CGRect keyboardFrame = [userInfo[UIKeyboardFrameEndUserInfoKey] CGRectValue]; CGRect keyboardFrame = [userInfo[UIKeyboardFrameEndUserInfoKey] CGRectValue];
// NSLog(@"keyboard will show markmark, lowest height %f", keyboardToggleRecognizer.lowestTouchPointHeight); CGFloat screenHeight = CGRectGetHeight([[UIScreen mainScreen] bounds]);
if(keyboardFrame.size.height < CGRectGetHeight([[UIScreen mainScreen] bounds]) * 0.25) return; // return in case of abnormal keyboard height CGFloat keyboardHeight = keyboardFrame.size.height;
HeightViewLiftedTo = keyboardFrame.size.height - keyboardToggleRecognizer.lowestTouchPointHeight + CGRectGetHeight([[UIScreen mainScreen] bounds]) * 0.1; // lift the StreamView to the height of lowest touch point of multi-finger tap gesture, while reserving the view of 1/10 screen height for remote typing. CGFloat toolbarHeight = settings.showKeyboardToolbar ? GenericUtils.legacyToolbarHeight : 0;
if(keyboardHeight < screenHeight * 0.33333333333 + toolbarHeight
|| keyboardHeight > screenHeight*0.8 + toolbarHeight){
keyboardHeight = screenHeight*0.5 + toolbarHeight;
// [self toggleKeyboard];
/*
if(keyboardToggleRecognizer.lowestTouchPointHeight < screenHeight/2){
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.25 * NSEC_PER_SEC)),
dispatch_get_main_queue(), ^{
[self toggleKeyboard];
});
return; // return in case of abnormal keyboard height
}*/
}
HeightViewLiftedTo = keyboardHeight - keyboardToggleRecognizer.lowestTouchPointHeight + CGRectGetHeight([[UIScreen mainScreen] bounds]) * 0.15; // lift the StreamView to the height of lowest touch point of multi-finger tap gesture, while reserving the view of 1/10 screen height for remote typing.
if(HeightViewLiftedTo < 0) HeightViewLiftedTo = 0; // set HeightViewLiftedTo to 0 if it is high enough and not going to be covered by keyboard. if(HeightViewLiftedTo < 0) HeightViewLiftedTo = 0; // set HeightViewLiftedTo to 0 if it is high enough and not going to be covered by keyboard.
CGRect liftedStreamFrame = self.frame; CGRect liftedStreamFrame = self.frame;
liftedStreamFrame.origin.y -= HeightViewLiftedTo; liftedStreamFrame.origin.y -= HeightViewLiftedTo;
@@ -263,7 +281,6 @@ static const double X1_MOUSE_SPEED_DIVISOR = 2.5;
// Also lift Metal video view if using Metal rendering backend // Also lift Metal video view if using Metal rendering backend
[self liftMetalVideoViewIfNeeded:HeightViewLiftedTo]; [self liftMetalVideoViewIfNeeded:HeightViewLiftedTo];
isInputingText = true;
[self refreshKeyboardToggleRecognizer:settings.keyboardToggleFingers.intValue]; [self refreshKeyboardToggleRecognizer:settings.keyboardToggleFingers.intValue];
[keyboardToggleTip removeFromSuperview]; [keyboardToggleTip removeFromSuperview];
} }
@@ -353,6 +370,7 @@ static const double X1_MOUSE_SPEED_DIVISOR = 2.5;
if (isInputingText) { if (isInputingText) {
Log(LOG_D, @"Closing the keyboard"); Log(LOG_D, @"Closing the keyboard");
[keyInputField resignFirstResponder]; [keyInputField resignFirstResponder];
[keyboardToggleTip removeFromSuperview];
} else { } else {
Log(LOG_D, @"Opening the keyboard"); Log(LOG_D, @"Opening the keyboard");
// Prepare the textbox used to capture keyboard events. // Prepare the textbox used to capture keyboard events.
@@ -361,21 +379,33 @@ static const double X1_MOUSE_SPEED_DIVISOR = 2.5;
#if !TARGET_OS_TV #if !TARGET_OS_TV
// Prepare the toolbar above the keyboard for more options // Prepare the toolbar above the keyboard for more options
if(settings.showKeyboardToolbar){ if(settings.showKeyboardToolbar){
UIToolbar *customToolbarView = [[UIToolbar alloc] initWithFrame:CGRectMake(0, 0, self.bounds.size.width, 44)]; UIToolbar *customToolbarView = [[UIToolbar alloc] initWithFrame:CGRectMake(0, 0, self.bounds.size.width, GenericUtils.legacyToolbarHeight)];
UIBarButtonItem *doneBarButton = [self createButtonWithImageNamed:@"DoneIcon.png" backgroundColor:[UIColor clearColor] target:self action:@selector(toolbarButtonClicked:) keyCode:0x00 isToggleable:NO]; UIBarButtonItem *doneBarButton = [self createButtonWithImageNamed:@"DoneIcon.png" backgroundColor:[UIColor clearColor] target:self action:@selector(toolbarButtonClicked:) keyCode:0x00 isToggleable:NO isDoneButton:true];
UIBarButtonItem *windowsBarButton = [self createButtonWithImageNamed:@"WindowsIcon.png" backgroundColor:[UIColor blackColor] target:self action:@selector(toolbarButtonClicked:) keyCode:0x5B isToggleable:YES]; UIBarButtonItem *windowsBarButton = [self createButtonWithImageNamed:@"WindowsIcon.png" backgroundColor:[UIColor blackColor] target:self action:@selector(toolbarButtonClicked:) keyCode:0x5B isToggleable:YES isDoneButton:false];
UIBarButtonItem *tabBarButton = [self createButtonWithImageNamed:@"TabIcon.png" backgroundColor:[UIColor blackColor] target:self action:@selector(toolbarButtonClicked:) keyCode:0x09 isToggleable:NO]; UIBarButtonItem *tabBarButton = [self createButtonWithImageNamed:@"TabIcon.png" backgroundColor:[UIColor blackColor] target:self action:@selector(toolbarButtonClicked:) keyCode:0x09 isToggleable:NO isDoneButton:false];
UIBarButtonItem *shiftBarButton = [self createButtonWithImageNamed:@"ShiftIcon.png" backgroundColor:[UIColor blackColor] target:self action:@selector(toolbarButtonClicked:) keyCode:0xA0 isToggleable:YES]; UIBarButtonItem *shiftBarButton = [self createButtonWithImageNamed:@"ShiftIcon.png" backgroundColor:[UIColor blackColor] target:self action:@selector(toolbarButtonClicked:) keyCode:0xA0 isToggleable:YES isDoneButton:false];
UIBarButtonItem *escapeBarButton = [self createButtonWithImageNamed:@"EscapeIcon.png" backgroundColor:[UIColor blackColor] target:self action:@selector(toolbarButtonClicked:) keyCode:0x1B isToggleable:NO]; UIBarButtonItem *escapeBarButton = [self createButtonWithImageNamed:@"EscapeIcon.png" backgroundColor:[UIColor blackColor] target:self action:@selector(toolbarButtonClicked:) keyCode:0x1B isToggleable:NO isDoneButton:false];
UIBarButtonItem *controlBarButton = [self createButtonWithImageNamed:@"ControlIcon.png" backgroundColor:[UIColor blackColor] target:self action:@selector(toolbarButtonClicked:) keyCode:0x11 isToggleable:YES]; UIBarButtonItem *controlBarButton = [self createButtonWithImageNamed:@"ControlIcon.png" backgroundColor:[UIColor blackColor] target:self action:@selector(toolbarButtonClicked:) keyCode:0x11 isToggleable:YES isDoneButton:false];
UIBarButtonItem *altBarButton = [self createButtonWithImageNamed:@"AltIcon.png" backgroundColor:[UIColor blackColor] target:self action:@selector(toolbarButtonClicked:) keyCode:0x12 isToggleable:YES]; UIBarButtonItem *altBarButton = [self createButtonWithImageNamed:@"AltIcon.png" backgroundColor:[UIColor blackColor] target:self action:@selector(toolbarButtonClicked:) keyCode:0x12 isToggleable:YES isDoneButton:false];
UIBarButtonItem *deleteBarButton = [self createButtonWithImageNamed:@"DeleteIcon.png" backgroundColor:[UIColor blackColor] target:self action:@selector(toolbarButtonClicked:) keyCode:0x2E isToggleable:NO]; UIBarButtonItem *deleteBarButton = [self createButtonWithImageNamed:@"DeleteIcon.png" backgroundColor:[UIColor blackColor] target:self action:@selector(toolbarButtonClicked:) keyCode:0x2E isToggleable:NO isDoneButton:false];
UIBarButtonItem *flexibleSpace = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:nil action:nil]; UIBarButtonItem *flexibleSpace = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:nil action:nil];
[customToolbarView setItems:[NSArray arrayWithObjects:doneBarButton, windowsBarButton, escapeBarButton, tabBarButton, shiftBarButton, controlBarButton, altBarButton, deleteBarButton, flexibleSpace, nil]]; [customToolbarView setItems:[NSArray arrayWithObjects:doneBarButton, windowsBarButton, escapeBarButton, tabBarButton, shiftBarButton, controlBarButton, altBarButton, deleteBarButton, flexibleSpace, nil]];
if (@available(iOS 26.0, *)) { if (GenericUtils.liquidGlassEnabled) {
for(UIBarButtonItem *button in customToolbarView.items){ if (@available(iOS 26.0, *)) {
button.hidesSharedBackground = true; for(UIBarButtonItem *button in customToolbarView.items){
button.hidesSharedBackground = true;
}
// customToolbarView.barTintColor = UIColor.systemGrayColor;
customToolbarView.backgroundColor = [UIColor.blackColor colorWithAlphaComponent:0.3];
customToolbarView.layer.cornerRadius = customToolbarView.bounds.size.height/2;
customToolbarView.layer.masksToBounds = true;
UIVisualEffectView *glassView =
[[UIVisualEffectView alloc] initWithEffect:[UIGlassEffect effectWithStyle:UIGlassEffectStyleClear]];
glassView.frame = customToolbarView.bounds;
glassView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
[customToolbarView addSubview:glassView];
[customToolbarView sendSubviewToBack:glassView];
} }
} }
keyInputField.inputAccessoryView = customToolbarView; keyInputField.inputAccessoryView = customToolbarView;
@@ -913,15 +943,21 @@ static const double X1_MOUSE_SPEED_DIVISOR = 2.5;
else if(![_onScreenControls handleTouchDownEvent:targetTouches]) [touchHandler touchesBegan:targetTouches withEvent:event]; else if(![_onScreenControls handleTouchDownEvent:targetTouches]) [touchHandler touchesBegan:targetTouches withEvent:event];
} }
- (UIBarButtonItem *)createButtonWithImageNamed:(NSString *)imageName backgroundColor:(UIColor *)backgroundColor target:(id)target action:(SEL)action keyCode:(NSInteger)keyCode isToggleable:(BOOL)isToggleable { - (UIBarButtonItem *)createButtonWithImageNamed:(NSString *)imageName backgroundColor:(UIColor *)backgroundColor target:(id)target action:(SEL)action keyCode:(NSInteger)keyCode isToggleable:(BOOL)isToggleable isDoneButton:(bool)isDoneButton {
UIImage *image = [UIImage imageNamed:imageName]; UIImage *image = [UIImage imageNamed:imageName];
UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom]; UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
// [button setTitle:@"666" forState:UIControlStateNormal];
[button setImage:image forState:UIControlStateNormal]; [button setImage:image forState:UIControlStateNormal];
button.frame = CGRectMake(0, 0, 30, 30);
button.frame = GenericUtils.liquidGlassEnabled ? CGRectMake(0, 0, 30, 30) : CGRectMake(0, 0, 30, 30);
button.imageView.contentMode = UIViewContentModeScaleAspectFit; button.imageView.contentMode = UIViewContentModeScaleAspectFit;
button.imageView.backgroundColor = backgroundColor; button.imageView.backgroundColor = backgroundColor;
button.imageView.layer.cornerRadius = 10.0; button.imageView.layer.cornerRadius = 10.0;
button.imageEdgeInsets = UIEdgeInsetsMake(6, 6, 6, 6); button.imageEdgeInsets = (GenericUtils.liquidGlassEnabled
? (isDoneButton ? UIEdgeInsetsMake(16, 16, 16, 16) : UIEdgeInsetsMake(27.5, 27.5, 27.5, 27.5))
: UIEdgeInsetsMake(6, 6, 6, 6));
[button addTarget:target action:action forControlEvents:UIControlEventTouchUpInside]; [button addTarget:target action:action forControlEvents:UIControlEventTouchUpInside];
objc_setAssociatedObject(button, "keyCode", @(keyCode), OBJC_ASSOCIATION_RETAIN_NONATOMIC); objc_setAssociatedObject(button, "keyCode", @(keyCode), OBJC_ASSOCIATION_RETAIN_NONATOMIC);
objc_setAssociatedObject(button, "isToggleable", @(isToggleable), OBJC_ASSOCIATION_RETAIN_NONATOMIC); objc_setAssociatedObject(button, "isToggleable", @(isToggleable), OBJC_ASSOCIATION_RETAIN_NONATOMIC);
@@ -937,7 +973,7 @@ static const double X1_MOUSE_SPEED_DIVISOR = 2.5;
isOn = !isOn; isOn = !isOn;
// Update the button's appearance based on its new state // Update the button's appearance based on its new state
if (isOn) { if (isOn) {
sender.imageView.backgroundColor = [UIColor lightGrayColor]; sender.imageView.backgroundColor = GenericUtils.liquidGlassEnabled ? [UIColor.systemGrayColor colorWithAlphaComponent:0.5] : [UIColor lightGrayColor];
} else { } else {
sender.imageView.backgroundColor = [UIColor blackColor]; sender.imageView.backgroundColor = [UIColor blackColor];
} }
+4
View File
@@ -62,6 +62,10 @@ import Foundation
@objc static let menuSeparatorWidth: CGFloat = 0.7 @objc static let menuSeparatorWidth: CGFloat = 0.7
@objc static let menuSectionSeparatorWidth: CGFloat = 0.7 @objc static let menuSectionSeparatorWidth: CGFloat = 0.7
@objc static var legacyToolbarHeight: CGFloat {
return 44
}
@objc static var hostViewNavigationBarHeight: CGFloat { @objc static var hostViewNavigationBarHeight: CGFloat {
switch UIDevice.current.userInterfaceIdiom { switch UIDevice.current.userInterfaceIdiom {
case .phone: case .phone: