Skip to content

Add touchbar support#862

Merged
mstarke merged 14 commits intoMacPass:masterfrom
vhschlenker:feature/touchbar
Jul 10, 2019
Merged

Add touchbar support#862
mstarke merged 14 commits intoMacPass:masterfrom
vhschlenker:feature/touchbar

Conversation

@vhschlenker
Copy link
Copy Markdown
Contributor

Hey there,
this is my WIP for Touch Bar support.
It addresses issue #614 .

But since this is pretty much the first time that I am working with objective c, I'd like to get your input early if this looks good or if im off somewhere with my coding style, location of imports, fields and methods or something.

Copy link
Copy Markdown
Member

@mstarke mstarke left a comment

Choose a reason for hiding this comment

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

Thank you very much for your pull request. I've made some comments which should improve the code.
Is it possible to extract all the TouchBar code into a single location? The two places look quite similar, it might be better to use a common tooling class.

@vhschlenker
Copy link
Copy Markdown
Contributor Author

Thank you for taking the time and looking through my code.

After taking a closer look at the issue and examining the Human Interface Guidelines I choose to remove the color for the button. That seems to be the preferred style.

Regarding the topic of a single location, I discovered that you have all delegates in one folder, maybe the makeItemForIdentifier method could go there too with the methods to create the three types of buttons while the Controller itself has something like a map with the entries? I'll be looking into that.

@vhschlenker
Copy link
Copy Markdown
Contributor Author

I played a bit with the idea of a separate delegate, but I hit a road block while comparing it to the existing toolbar delegate.
The problem was how to correctly use and/or implement the actions/selectors, because I had always problems with the target set to "self" which was seen as the delegate and not the controller where the method from the selector was. Maybe you have a better idea?
Anyway, extracting the creation to a helper class was a good idea, it looks far better. I would even go so far an assume that from a lines of code perspective, there is not much more to save with a operate delegate.

@mstarke
Copy link
Copy Markdown
Member

mstarke commented Jan 1, 2019

I'll try to take a look at your changes in the upcoming days and give feedback.

@vhschlenker
Copy link
Copy Markdown
Contributor Author

I hoped you ignored that 😄 .
But yeah, you are right that should be there.
So I looked a bit around, but I did not really found a way outside of manually creating the entries in the respective files (Localizable.strings).
Do you use any form of tool?

@mstarke
Copy link
Copy Markdown
Member

mstarke commented Jan 5, 2019

To update the english strings located in MacPass/en.lproj/Localizable.strings you can run the script extract_localizeables.sh in /scrips. The script should be run inside the scripts folder as I have not made it location un-aware. After you've run the script, /MacPass/en.lproj/Localizable.strings.updated is created. Use a diff tool to add any changes in the keys to /MacPass/en.lproj/Localizable.strings and provide a translation. If you are fluent in another language, you can use the XLIFF export in Xcode to generate those files for other languages and then update the translations.

@vhschlenker
Copy link
Copy Markdown
Contributor Author

So I used the localized strings for the labels and the customization labels and translated them to German, too.
For simplicity, I choose to use the same ones for the actual label and the customization label, because the meaning is pretty much the same.
One thing to consider would be to merge strings like "COPY_PASSWORD" and "TOUCHBAR_COPY_PASSWORD" since they mean the same. I did not merge them because the comment would need to be rewritten.

@mstarke
Copy link
Copy Markdown
Member

mstarke commented Feb 17, 2019

Awesome! About using the same string on different locations with the same meaning: This is a common thought and I did it it at the beginning of MacPass as well but sometimes a different wording is useful so I changed to be verbose with the keys and thus allow for more variability. The downside is that changes often require contributions from all translators.

Copy link
Copy Markdown
Member

@mstarke mstarke left a comment

Choose a reason for hiding this comment

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

Could you bee so kind and update the german localization?

@vhschlenker
Copy link
Copy Markdown
Contributor Author

Sure, thanks for pointing that out. I somehow thought of it as a name.
Also, I made adjustments to the English translation as there is a favor to capitalize the second word.
One thing I noticed while going through the translations "CHOOSE_FILE_BUTTON_TITLE" does not seem to be existing in the translated strings?
Looking at the issue #614 the last thing to do is highlight the "show password" button if the option is active. Currently, I can change its title at runtime, but I can not set it to be highlighted yet. Gist for this problem is here.

@vhschlenker
Copy link
Copy Markdown
Contributor Author

It's not the best solution, but the only one I found to be working.
Another Problem I found is that the touchbar buttons in the DocumentWindow getting to big with the long strings and so a few of the actions drop of.
On one hand one could just add them though editing the touchbar, on the other hand I could replace the edit button with this icon and the two copy buttons with a combination of an copy icon and the field and the autotype button could be replaced with the "MPIconKeyboard" icon. What do you think from a user experience view point?

@Ashok-Varma
Copy link
Copy Markdown

👍

@vhschlenker vhschlenker changed the title [WIP] Add touchbar support Add touchbar support Apr 19, 2019
@vhschlenker
Copy link
Copy Markdown
Contributor Author

Since there is no futher comment on changing the buttons to make them smaller, and one could edit the button placement if wanted, there is no real need to change anything at the moment.
So from my point the pull request is ready to be merged.

@nicholasgcoles
Copy link
Copy Markdown

@mstarke this feature would be incredible.

@mstarke mstarke merged commit 2d98c48 into MacPass:master Jul 10, 2019
@vhschlenker vhschlenker deleted the feature/touchbar branch July 10, 2019 10:01
@mstarke
Copy link
Copy Markdown
Member

mstarke commented Jul 10, 2019

Thank you for this awesome contribution. Finally merged and tested it myself. I might tweak the behaviour but currently this is a big step up from before.

@mstarke mstarke added this to the 0.7.10 milestone Jul 10, 2019
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.

4 participants