-
Notifications
You must be signed in to change notification settings - Fork 83
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
[#371] Add functionality for new keyboard expanded layout #373
[#371] Add functionality for new keyboard expanded layout #373
Conversation
Thank you for the pull request!The Scribe team will do our best to address your contribution as soon as we can. The following is a checklist for maintainers to make sure this process goes as well as possible. Feel free to address the points below yourself in further commits if you realize that actions are needed :) If you're not already a member of our public Matrix community, please consider joining! We'd suggest using Element as your Matrix client, and definitely join the General and iOS rooms once you're in. It'd be great to have you! Maintainer checklist
|
5a4fac8
to
03fa49c
Compare
Tested it and it looks good to me. |
Really appreciate the overall care/detail here and especially some a classic sentence for the example, @damien-rivet! 🦊😊 Going through it all now. Sorry that this took a bit. I needed to switch contexts for another project to do UI/UX design, and that always tends to slow down other work (although fun 🙃). |
@@ -319,7 +319,7 @@ func setPhoneKeyPopCharSize(char: String) { | |||
keyPopChar.font = .systemFont(ofSize: letterKeyWidth / 1.15) | |||
keyHoldPopChar.font = .systemFont(ofSize: letterKeyWidth / 1.15) | |||
} | |||
} else if shiftButtonState == .shift || shiftButtonState == .caps { | |||
} else if shiftButtonState == .shift || capsLockButtonState == .locked { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very intuitive :)
|| key == "return" | ||
|| key == "hideKeyboard" | ||
{ | ||
} else if ["123", ".?123", "return", "hideKeyboard"].contains(key) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Appreciate you fixing these formatting/logic errors! 🙏
|
||
/// Adjusts the style of the button based on different states |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor nit that I'm noting here is that we'd like this to be a complete sentence with a period :) I can get it though!
@@ -40,7 +40,9 @@ var keysThatAreSlightlyLarger = [ | |||
"chevron.right", | |||
"shift", | |||
"shift.fill", | |||
"capslock", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Again the dedication here is amazing. Looking into and finding keysThatAreSlightlyLarger
is great, but also has me worried about the state of some of the code that we're using so many random variables everywhere.
A basic ask would be if you had ideas for how we can improve the code base, it'd be great if you could open some issues. Anything that you've seen that might be some solid refactoring would be very welcome!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point 🤔 I'll do a quick sweep over the codebase and open a few issues for code quality ^^
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks so much, @damien-rivet! Always looking for some good first issues
for new folks to work on 😊
@@ -406,7 +406,9 @@ class KeyboardViewController: UIInputViewController { | |||
var i = 0 | |||
if completionOptions.count <= 3 { | |||
while i < completionOptions.count { | |||
if shiftButtonState == .caps { | |||
if shiftButtonState == .shift { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Interesting, we were missing shift?? Great catch :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yup, suggestions were not handled properly for capitalised first-letter but it will be history after the merge.
@@ -1925,6 +1937,10 @@ class KeyboardViewController: UIInputViewController { | |||
|
|||
// Set the width of the key given device and the given key. | |||
btn.adjustKeyWidth() | |||
|
|||
// Update the button style |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Noting the comment for myself.
@@ -2482,7 +2498,14 @@ class KeyboardViewController: UIInputViewController { | |||
} | |||
|
|||
case "shift": | |||
shiftButtonState = shiftButtonState == .normal ? .shift : .normal | |||
if capsLockButtonState == .locked { | |||
// Return capitalization to default |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice as well as we now have both states to account for :)
@@ -2657,6 +2684,15 @@ class KeyboardViewController: UIInputViewController { | |||
} | |||
} | |||
|
|||
private func switchToFullCaps() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Another thing that we've been dealing with is that not enough of the code base is split into functions. I do some rounds from time to time and break some things out, but if you came across some parts where we can extract some code then by all means let me know or open an issue!
if [.translate, .conjugate, .plural].contains(commandState) { | ||
// Color the return key depending on if it's being used as enter for commands. | ||
backgroundColor = commandKeyColor | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need the else back here for one bug I'm about to mention such that we get backgroundColor = specialKeyColor
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's a default case which should handle the else
but I'll do a review of my code to see if it's not missing some cases.
if shiftButtonState == .shift { | ||
backgroundColor = keyPressedColor | ||
styleIconBtn(btn: self, color: UIColor.label, iconName: "shift.fill") | ||
} else if shiftButtonState == .caps { | ||
backgroundColor = keyPressedColor | ||
styleIconBtn(btn: self, color: UIColor.label, iconName: "capslock.fill") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Losing this line is disabling an indication that we're in caps lock on iPhones :)
Two things I'm seeing based on testing:
Aside from this, really amazing work and one of our best first time contributions, @damien-rivet! I'm happy to get to the final fixes myself. Thank you! |
Don't worry about the bugs, I'll be working on them asap, they should be pretty forward to iron out. |
Fixed issue with CapsLock state not showing on iPhone. Added a missing period in a description. Fixed an issue with the Return key having the wrong color in some cases. Fixed a crash in Command mode when no input is supplied by the user.
@andrewtavis I've fixed both issues in my last commit. While testing I discovered a crash (nil unwrapping) in Command mode, I've added some checks to prevent those from happening again. |
Fantastic, @damien-rivet! I'm off to dinner, but will get to the final review this evening :) :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for getting to the changes so quickly, @damien-rivet, as well as finding and fixing the nil unwrapping! Really great to have this contribution :) Will bring it in and check to make sure that we have everything updated as far as the changelog and such, and then will close out the issue 😊
Contributor checklist
Description
This PR implements #371 by adding functionality for the new expanded layout that was introduced by #352.
The
indent
key is now fully functional as well as thecapslock
key.Recordings
Old design
Simulator.Screen.Recording.-.iPad.Pro.12.9-inch.6th.generation.-.2023-10-22.at.14.39.31.-.01.mp4
New design
Simulator.Screen.Recording.-.iPad.Pro.12.9-inch.6th.generation.-.2023-10-22.at.14.44.49.-.01.-.01.mp4
Screenshots
Related issue