Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(ios): configurable keyboard height #12571

Open
wants to merge 30 commits into
base: master
Choose a base branch
from

Conversation

sgschantz
Copy link
Contributor

@sgschantz sgschantz commented Oct 23, 2024

Allows the height of the Keyman keyboard to be adjusted by the user from within the Keyman Settings.

Fixes #5897

User Testing

  • TEST_PORTRAIT_KEYBOARD_HEIGHT_ADJUSTMENT:
  1. Install and run the Keyman build associated with this PR
  2. Go to Keyman Settings with the Keyman app
  3. Holding the device in portrait orientation, tap Adjust Keyboard Height
  4. Drag the resizer arrow to adjust the height of the keyboard
  5. Tap the Back button
  6. Tap the Done button
  7. Confirm that the keyboard has been resized within the Keyman app
  • TEST_LANDSCAPE_KEYBOARD_HEIGHT_ADJUSTMENT:
  1. Install and run the Keyman build associated with this PR
  2. Go to Keyman Settings with the Keyman app
  3. Holding the device in landscape orientation, tap Adjust Keyboard Height
  4. Drag the resizer arrow to adjust the height of the keyboard
  5. Tap the Back button
  6. Tap the Done button
  7. Confirm that the keyboard has been resized within the Keyman app
  • TEST_SYSTEM_KEYBOARD_HEIGHT_ADJUSTMENT:
  1. Set the keyboard height to a size noticeably different than the default size
  2. Go to an iOS application with text input
  3. Switch to the Keyman system keyboard and confirm that the keyboard height is the same as it was in Keyman
  • TEST_ADJUST_KEYBOARD_ROTATION:
  1. Go to Keyman Settings within the Keyman app
  2. Tap Adjust Keyboard Height
  3. Rotate the device between portrait and landscape
  4. Confirm that the animation is smooth and the keyboard size changes correctly after rotating
  • TEST_ADJUST_KEYBOARD_DARK_MODE:
  1. Go to Keyman Settings within the Keyman app
  2. Tap Adjust Keyboard Height
  3. Go to iOS Settings > Display & Brightness
  4. Change Appearance from Light to Dark or vice-versa
  5. Confirm that the blank keyboard displayed on the Adjust Keyboard screen reflect the appearance change
  • TEST_RESET_TO_DEFAULT:
  1. Go to Keyman Settings within the Keyman app
  2. Tap Adjust Keyboard Height
  3. Resize the keyboard to a height noticeably different from the default
  4. Tap the 'Rest to Default Keyboard Height' button
  5. Confirm that they keyboard size springs back to its original default size

@sgschantz sgschantz added this to the A18S14 milestone Oct 23, 2024
@sgschantz sgschantz self-assigned this Oct 23, 2024
@keymanapp-test-bot
Copy link

keymanapp-test-bot bot commented Oct 23, 2024

User Test Results

Test specification and instructions

  • TEST_PORTRAIT_KEYBOARD_HEIGHT_ADJUSTMENT (PASSED) (notes)
  • TEST_LANDSCAPE_KEYBOARD_HEIGHT_ADJUSTMENT (PASSED) (notes)
  • TEST_SYSTEM_KEYBOARD_HEIGHT_ADJUSTMENT (PASSED) (notes)
  • TEST_ADJUST_KEYBOARD_ROTATION (PASSED) (notes)
  • TEST_ADJUST_KEYBOARD_DARK_MODE (PASSED) (notes)
  • TEST_RESET_TO_DEFAULT (PASSED) (notes)

Test Artifacts

Base automatically changed from fix/ios/xcode-16-build to master October 24, 2024 09:08
@darcywong00 darcywong00 modified the milestones: A18S14, A18S15 Nov 9, 2024
@darcywong00 darcywong00 modified the milestones: A18S15, A18S16 Nov 24, 2024
@sgschantz sgschantz force-pushed the fix/ios/5897-adjustable-keyboard-height branch from 506da20 to 221ba7b Compare December 2, 2024 05:30
viewWillTransition size argument does not reflect device bounds
updates constraints on CustomInputView only so that
changes are isolated to the in-app keyboard and have
no effect on the system keyboard
also avoid call to userdefaults unless key exists
@darcywong00 darcywong00 modified the milestones: A18S16, A18S17 Dec 7, 2024
@keymanapp-test-bot keymanapp-test-bot bot added has-user-test user-test-required User tests have not been completed labels Dec 9, 2024
@sgschantz sgschantz marked this pull request as ready for review December 9, 2024 06:31
@sgschantz sgschantz requested a review from jahorton as a code owner December 9, 2024 06:31
@sgschantz sgschantz requested a review from mcdurdin December 9, 2024 06:32
Copy link
Member

@mcdurdin mcdurdin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, just nits. Good work

private func determineDefaultKeyboardHeights() {
// if no KeyboardScaleMap found for device, then default to 216.0
let portraitKeyboardScale = KeyboardScaleMap.getDeviceDefaultKeyboardScale(forPortrait: true)
self.defaultPortraitHeight = Double(portraitKeyboardScale?.keyboardHeight ?? 216.0)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

216.0 appears in a few places. Is it worth making it a constant somewhere?

Comment on lines +84 to +104
if (self.isPortrait) {
if (Storage.active.userDefaults.object(forKey: Key.portraitKeyboardHeight) != nil) {
self.keyboardHeight = Storage.active.userDefaults.portraitKeyboardHeight
let message = "applyKeyboardHeight, from UserDefaults loaded portrait value \(self.keyboardHeight)"
os_log("%{public}s", log:KeymanEngineLogger.ui, type: .debug, message)
} else {
self.keyboardHeight = self.defaultPortraitHeight
let message = "applyKeyboardHeight, portraitHeight not found in UserDefaults, using default value \(self.keyboardHeight)"
os_log("%{public}s", log:KeymanEngineLogger.ui, type: .error, message)
}
} else {
if (Storage.active.userDefaults.object(forKey: Key.portraitKeyboardHeight) != nil) {
self.keyboardHeight = Storage.active.userDefaults.landscapeKeyboardHeight
let message = "applyKeyboardHeight, from UserDefaults loaded landscape value \(self.keyboardHeight)"
os_log("%{public}s", log:KeymanEngineLogger.ui, type: .debug, message)
} else {
self.keyboardHeight = self.defaultLandscapeHeight
let message = "applyKeyboardHeight, landscapeHeight not found in UserDefaults, using default value \(self.keyboardHeight)"
os_log("%{public}s", log:KeymanEngineLogger.ui, type: .error, message)
}
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's a fair bit of repetition between landscape and portrait orientation code. Could we merge the values into an array (0=portait, 1=landscape) or something like that? What do you think? Or an {x,y}?

@dinakaranr
Copy link

Test Results

I tested this issue with the attached "Keyman 18.0.130-alpha-test-12571" build(test flight) on the iOS 17.4, iPhone 13 physical device.

  • TEST_PORTRAIT_KEYBOARD_HEIGHT_ADJUSTMENT (Passed):
  1. I installed the Keyman 18.0.130-alpha-test-12571 version.
  2. Open the Keyman app. Go to the keyman settings.
  3. iPhone device holds in portrait view. Tap on the "Adjust Keyboard Height" option.
  4. Drag the resizer arrow to adjust the height of the keyboard(Small to Big Height).
  5. Tap the Back button.
  6. Tap the Done button.
    In Keyman editor: Verified that the keyboard resized within the Keyman app.
  • TEST_LANDSCAPE_KEYBOARD_HEIGHT_ADJUSTMENT (Passed):
  1. I installed the Keyman 18.0.130-alpha-test-12571 version.
  2. Open the Keyman app. Go to the keyman settings.
  3. iPhone device holds in landscape view. Tap on the "Adjust Keyboard Height" option.
  4. Drag the resizer arrow to adjust the height of the keyboard(Big Height to Small).
  5. Tap the Back button
  6. Tap the Done button
    In Keyman editor: Verified that the keyboard resized within the Keyman app.
  • TEST_SYSTEM_KEYBOARD_HEIGHT_ADJUSTMENT (Passed):
  1. I installed the Keyman 18.0.130-alpha-test-12571 version.
  2. Open the Keyman app. Go to the keyman settings.
  3. iPhone device holds in portrait view. Tap on the "Adjust Keyboard Height" option.
  4. Drag the resizer arrow to increase the small to Big height of the keyboard.
  5. Tap the Back button
  6. Tap the Done button
  7. Set the keyman keyboard as a system keyboard by clicking keyman/Settings/System Keyboard Settings/Keyboards/Allow full access & Keyman
  8. Open the Pages app. Open a blank page.
  9. Click on the blank page.
  10. In Keyman editor: Verified that the keyboard resized with bigger.
  • TEST_ADJUST_KEYBOARD_ROTATION (Passed):
  1. I installed the Keyman 18.0.130-alpha-test-12571 version.
  2. Open the Keyman app. Go to the keyman settings.
  3. iPhone device holds in portrait view. Tap on the "Adjust Keyboard Height" option.
  4. Rotate the device from portrait to landscape
  5. Verified that the keyboard animation appeared as small size in the landscape view.
  6. Rotate the device from landscape to portrait.
  7. Verified that the keyboard height appeared as a bigger size in the portrait view.
  8. Verified that the keyboard UI appeared correctly when rotating the view in the phone.
  • TEST_ADJUST_KEYBOARD_DARK_MODE (Passed):
  1. I installed the Keyman 18.0.130-alpha-test-12571 version.
  2. Open the Keyman app. Go to the keyman settings.
  3. iPhone device holds in portrait view. Tap on the "Adjust Keyboard Height" option.
  4. Change the iPhone theme from light to dark mode.
  5. Verified that the keyboard animation appeared in the dark view.
  6. Verified that the white background appeared with blue & black text.
  7. Verified that the blue text is clickable.
  • TEST_RESET_TO_DEFAULT (Passed):
  1. I installed the Keyman 18.0.130-alpha-test-12571 version.
  2. Open the Keyman app. Go to the keyman settings.
  3. iPhone device holds in portrait view. Tap on the "Adjust Keyboard Height" option.
  4. Drag the resizer arrow to adjust the height of the keyboard(Small to Big Height).
  5. Tap the Back button
  6. Tap the Done button
  7. In Keyman editor: Verified that the keyboard resized within the Keyman app.
  8. Go to the keyman settings. Tap on the "Adjust Keyboard Height" option.
  9. Click on the 'Rest to Default Keyboard Height' button.
  10. Verified that the keyboard is reset to the default size on the keyboard animation.
  11. Tap the Back button
  12. Tap the Done button
  13. In Keyman editor: Verified that the keyboard appeared as the default size in the Keyman app.

@keymanapp-test-bot keymanapp-test-bot bot removed the user-test-required User tests have not been completed label Dec 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: No status
Development

Successfully merging this pull request may close these issues.

feat(ios): Touch keyboard height adjustability
4 participants