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

#362 Changed the expanded keyboard for more languages #397

Merged

Conversation

henrikth93
Copy link
Member

Contributor checklist


Description

Related issue

Added shift keys and changed some sizing. I am not able to test it for all languages for some reason. Will work more on this
Added Italia back to the setting and made it take effect if we are NOT using expanded keyboard
Copy link

github-actions bot commented Jan 28, 2024

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

  • The commit messages for the remote branch should be checked to make sure the contributor's email is set up correctly so that they receive credit for their contribution

    • The contributor's name and icon in remote commits should be the same as what appears in the PR
    • If there's a mismatch, the contributor needs to make sure that the email they use for GitHub matches what they have for git config user.email in their local Scribe-iOS repo
  • The CHANGELOG has been updated with a description of the changes for the upcoming release and the corresponding issue (if necessary)

@andrewtavis andrewtavis self-requested a review January 28, 2024 20:19
Comment on lines 260 to 284
scalarCapsLockKeyWidth = (disableAccentCharacters && keyboardState != .symbols) ? 2.0 : 1.2
scalarSpecialKeysWidth = (disableAccentCharacters && keyboardState != .symbols) ? 2.2 : 1.0
scalarReturnKeyWidth = (disableAccentCharacters && keyboardState != .symbols) ? 1.7 : 1.3
//scalarReturnKeyWidth = 1.3
scalarShiftKeyWidth = 1.8
case "German", "Swedish":
scalarCapsLockKeyWidth = 1.8
scalarReturnKeyWidth = 1.3
scalarSpecialKeysWidth = (disableAccentCharacters && keyboardState != .symbols) ? 2.2 : 1.0
scalarReturnKeyWidth = (disableAccentCharacters && keyboardState != .symbols) ? 2.2 : 1.0
case "French":
scalarCapsLockKeyWidth = 1.2
scalarReturnKeyWidth = (disableAccentCharacters && keyboardState != .symbols) ? 1.4 : 1.0
scalarShiftKeyWidth = 1.8
case "Italian":
scalarSpecialKeysWidth = (disableAccentCharacters && keyboardState != .symbols) ? 2.2 : 1.0
scalarReturnKeyWidth = (disableAccentCharacters && keyboardState != .symbols) ? 1.5 : 1.0
scalarCapsLockKeyWidth = 1.3
scalarShiftKeyWidth = 1.8
default:
scalarSpecialKeysWidth = (disableAccentCharacters && keyboardState != .symbols) ? 2.2 : 1.0
scalarReturnKeyWidth = (disableAccentCharacters && keyboardState != .symbols) ? 2.2 : 1.0
}
//scalarSpecialKeysWidth = (disableAccentCharacters && keyboardState != .symbols) ? 2.2 : 1.0
//scalarReturnKeyWidth = (disableAccentCharacters && keyboardState != .symbols) ? 2.2 : 1.0
Copy link
Member

Choose a reason for hiding this comment

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

nit - Would it make sense to already check (disableAccentCharacters && keyboardState != .symbols) just once before and then simply use the boolean result in the switch statement? The boolean statements for the ternary operators here are simply repeated really.

OR..
(can most definitely be a TODO for later but..) would it be possible to abstract the logic for the values to the specific language somewhere else? So that only something like the below is possible with no switch statement needed?

        scalarCapsLockKeyWidth = currentLanguage.scalarCapsLockKeyWidth 
        scalarReturnKeyWidth = currentLanguage.scalarReturnKeyWidth
        scalarSpecialKeysWidth = currentLanguage.scalarSpecialKeysWidth
        scalarReturnKeyWidth = currentLanguage.scalarReturnKeyWidth

Scribe-iOS isn't my domain, so let me know if I'm talking crazy 😆

Copy link
Member

Choose a reason for hiding this comment

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

Either sounds good to me! What are your thoughts on this, @henrikth93?

And all of Scribe is your domain, @wkyoshida 😊🤗

Copy link
Member Author

Choose a reason for hiding this comment

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

I think Will's idea of abstracting it is good, and that is something I can try and solve. @wkyoshida I am not sure I understand what you mean regarding the ternary operators, but do you mean that just checking the statement once would be less consuming? To tell the truth, my understanding of ternary operators and what they do under the hood is lacking.

Copy link
Member Author

Choose a reason for hiding this comment

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

@wkyoshida @andrewtavis I think the logic for setting the values could be moved to interfacevariables maybe

Copy link
Member

Choose a reason for hiding this comment

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

Hey! 👋

I am not sure I understand what you mean regarding the ternary operators, but do you mean that just checking the statement once would be less consuming?

Oh no, not really 😄 I just meant that since the boolean statements for them is the same, could just write it once, store the result in a variable, then consult the variable in each ternary. It's really just more of a visual suggestion to declutter the code a bit to make it more visually clean - that's all.


Also, regarding the abstraction - I'm good with leaving it for another PR, so no stress (unless you'd really like to tackle it here already, then by all means 😄)

Copy link
Member

Choose a reason for hiding this comment

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

Happy to move that to a new PR/issue or have it be committed here. @henrikth93, let me know which one you'd prefer and I'll get to the review soon if we're leaving as is 😊

Copy link
Member Author

Choose a reason for hiding this comment

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

Let us move that to a new issue! :)

Keyboards/KeyboardsBase/KeyboardViewController.swift Outdated Show resolved Hide resolved
henrikth93 and others added 2 commits February 5, 2024 22:13
Using a boolean instead of the expression directly
@andrewtavis
Copy link
Member

af9e726 removes the code that was commented out and also adds a char to Spanish and Swedish in one row as they had less than the others. Big thing that I'm realizing is that the Russian keyboard is automatically crashing at this point, but then this is the case on main as well 🤦‍♂️ I'll take a look at it. @henrikth93, as a final commit for this, do you want to change it so that the right shift key takes up the whole of the extra space as is done on the system German keyboard? See below:

Simulator Screenshot - iPad Pro (12 9-inch) (6th generation) - 2024-02-06 at 23 52 54

I think that this would be the easiest way of figuring this all out 😊

@andrewtavis
Copy link
Member

andrewtavis commented Mar 31, 2024

Looking into this now and making a checklist for myself to confirm that the UI is ready for things:

  • French letters
  • French alt chars
  • German letters
  • German letters (disable accent chars)
  • German alt chars
  • Italian letters
  • Italian alt chars
  • Portuguese letters
  • Portuguese alt chars
  • Note: something broke the Russian keyboard...
    • Fix it and document what happened
      • RussianKeyboardConstants.symbolKeysPadExpanded was assigned to letterKeys
  • Russian letters
  • Russian alt chars
  • Spanish letters
  • Spanish letters (disable accent chars)
  • Spanish alt chars
  • Swedish letters
  • Swedish letters (disable accent chars)
  • Swedish alt chars
  • Add necessary characters to English, Danish, Norwegian and Hebrew

Copy link
Member

@andrewtavis andrewtavis left a comment

Choose a reason for hiding this comment

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

Approved and on to the next issue! 🥳🚀

63d5ce1 has all kinds of changes coming through:

  • I simplified how expanded keyboards are laid out such that we always have the same number of keys per row for all languages
    • Just felt it was easier than going in and adding all the padding
    • We can do this later if there's a demand
    • This included some general resizing of the special keys
  • There was a bug that brome the Russian keyboard where ussianKeyboardConstants.symbolKeysPadExpanded was assigned to letterKeys rather than symbolKeys
  • I made the height of expanded keyboards a bit larger
  • The vertical space between the keys on expanded keyboards was decreased
  • I removed the menu option for putting a period and a comma on the letter keys if the user is on an iPad
  • Lots of keys were added across all keyboards 😊

Thanks so much for your dedication in working on this, @henrikth93! Really so great to have this finalized 🙌

@andrewtavis andrewtavis merged commit f3862d8 into scribe-org:main Mar 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants