Skip to content

Settings view#76

Closed
mkchoi212 wants to merge 4 commits intovideolan:masterfrom
mkchoi212:settings-view
Closed

Settings view#76
mkchoi212 wants to merge 4 commits intovideolan:masterfrom
mkchoi212:settings-view

Conversation

@mkchoi212
Copy link
Contributor

Checklist

  • I've run bundle exec fastlane test from the root directory to see all new and existing tests pass
  • I've followed the vlc-ios code style and run bundle exec fastlane lint to ensure the code style is valid
  • I've read the Contribution Guidelines
  • I've updated the documentation if necessary.

Description

Settings view has been updated to match the mockups on Figma (almost)

There are still couple of things that need to be fixed but thought I would open this PR to share with you guys what I have so far 😄

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm aware that this is a WIP so I'm just going to leave a single comment! 😄
What would you think about using [NSLayoutConstraint activateConstraints:@[];?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I didn't know that was a thing! Definitely makes it look cleaner :D

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If you don't mind, please put more comments on stuff! I'm kinda stuck on most things anyways 🤦‍♂️

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, and if we trust the documentation, it's even sometimes faster! 😄

Copy link
Contributor Author

Choose a reason for hiding this comment

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

How do I go about adding a new string that needs to be localized??

Copy link
Contributor

Choose a reason for hiding this comment

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

You need to add constants and their plain text counter-part to the en.lproj's "Root.strings" within the Settings.bundle.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Same thing here. Needs localization

Copy link
Contributor

Choose a reason for hiding this comment

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

See above :)

Copy link
Contributor

@Mikanbu Mikanbu left a comment

Choose a reason for hiding this comment

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

Thanks for your work, you will find some small comments/thoughts in line~

Copy link
Contributor

Choose a reason for hiding this comment

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

I think we can remove this bit of code since we don't support pre-iOS 6 anymore?

Copy link
Contributor

Choose a reason for hiding this comment

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

oh yes!

Copy link
Contributor

Choose a reason for hiding this comment

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

I think we should consider using a macro at the top for the default values.
For example something like:
#define SETTINGS_HEADER_HEIGHT 64

We could also use a const for this if you prefer.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, that's a good idea and matches what we have in other classes.

Copy link
Contributor

Choose a reason for hiding this comment

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

Are you sure about the About ☜(゚ヮ゚☜) string the right localization identifier?

Copy link
Member

Choose a reason for hiding this comment

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

showAbout: as selector would be better :) The controller is not pushed

Copy link
Contributor

Choose a reason for hiding this comment

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

What would you think about having a dynamic height?(mostly for accessibility reasons)
Like for example what @carolanitz did in bf01cc4

@fkuehne fkuehne self-requested a review June 8, 2018 22:24
Copy link
Contributor

Choose a reason for hiding this comment

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

You need to add constants and their plain text counter-part to the en.lproj's "Root.strings" within the Settings.bundle.

Copy link
Contributor

Choose a reason for hiding this comment

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

See above :)

Copy link
Contributor

Choose a reason for hiding this comment

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

👍

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, that's a good idea and matches what we have in other classes.

Copy link
Contributor

Choose a reason for hiding this comment

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

Can we generalize that font configuration similar to the way we handle colors in a global sense?

Copy link
Contributor

Choose a reason for hiding this comment

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

oh yes!

@mkchoi212
Copy link
Contributor Author

With 672bda1, the privacy cell is in the same section as the theme cell as shown in the mockup!

simulator screen shot - iphone x - 2018-06-11 at 10 31 32

@mkchoi212 mkchoi212 changed the title [WIP] Settings view Settings view Jun 11, 2018
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Little hack to ensure minimum height in UITableViewCellStyleSubtitle

simulator screen shot - iphone x - 2018-06-13 at 11 20 56

Copy link
Member

Choose a reason for hiding this comment

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

no hacks, please. If you want to ensure the correct height that leaves enough room you overwrite a cells systemLayoutSizeFittingSize or something like that. There are a bunch of articles on how to achieve this. Your implementation will not leave enough room when you have large text which is what you wanted if I understand the automatic dimension correctly. This will also make the MinimumSettingsrowheight obsolete

@mkchoi212
Copy link
Contributor Author

mkchoi212 commented Jun 13, 2018

Final view has...

  • Section header with separator (Kind of iffy about how it looks)
  • Subtitle style for applicable tableview cells
  • Cell separator turned off
  • Minimum cell height of 64px
  • New labeling on headers
  • About button on top left corner

simulator screen shot - iphone x - 2018-06-13 at 13 06 08

@Mikanbu
Copy link
Contributor

Mikanbu commented Jun 13, 2018

Sorry, small nitpicking again 😄
When in dark mode, the thumbTintColor of the switches should be changed as well like:
https://gyazo.com/ea524b9883585fb97d504c5de34705be

Copy link
Member

@carolanitz carolanitz left a comment

Choose a reason for hiding this comment

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

Looks already really good. There is a bunch of code that should probably be pulled out of the settingscontroller class and possibly even the file though :)

Copy link
Member

Choose a reason for hiding this comment

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

do we really need all of these imports ?

Copy link
Member

Choose a reason for hiding this comment

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

showAbout: as selector would be better :) The controller is not pushed

Copy link
Member

Choose a reason for hiding this comment

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

do we need the IBAction here and the sender? I mean I don't care really but It's always a sign that something is connected over Interface Builder which is not the case here

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Don't know what I was thinking :p Rookie mistake!

Copy link
Member

Choose a reason for hiding this comment

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

this should be presented now since it's not part of the Tableview

Copy link
Member

Choose a reason for hiding this comment

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

I think we also need that actually in the local network screen

Copy link
Member

Choose a reason for hiding this comment

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

^ This really needs to be consistent throughout the app. Can we adjust this in the local network screen as well as part of this PR but in a separate commit?

Copy link
Member

Choose a reason for hiding this comment

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

can go away if you set the rowheight property up top

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I tried what you suggested but I think this is necessary to override the heightForRowAtIndexPath already declared in its parent class IASKSettingsViewController

Copy link
Member

Choose a reason for hiding this comment

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

This will "break" and by that I mean the separator will be too short when you rotate the view since you set a static frame

Copy link
Member

Choose a reason for hiding this comment

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

Can we write cell subclasses for this and not cram everything in this method and viewcontroller? Also magic numbers. By having subclass in an extra file we should also be able to remove some of the above imports I reckon, which will make the entire thing more readable

Copy link
Contributor Author

Choose a reason for hiding this comment

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

VLCSettingsTableViewCell.h/m has been created!

Copy link
Member

Choose a reason for hiding this comment

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

space before the *

Copy link
Contributor Author

Choose a reason for hiding this comment

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

duh 😄

Copy link
Member

Choose a reason for hiding this comment

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

no hacks, please. If you want to ensure the correct height that leaves enough room you overwrite a cells systemLayoutSizeFittingSize or something like that. There are a bunch of articles on how to achieve this. Your implementation will not leave enough room when you have large text which is what you wanted if I understand the automatic dimension correctly. This will also make the MinimumSettingsrowheight obsolete

@mkchoi212 mkchoi212 changed the title Settings view [WIP] Settings view Jun 18, 2018
@mkchoi212 mkchoi212 force-pushed the settings-view branch 2 times, most recently from 0145c93 to 9d3b8a0 Compare June 19, 2018 06:02
@mkchoi212 mkchoi212 changed the title [WIP] Settings view Settings view Jun 27, 2018
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This was required to silence auto layout warnings. See https://stackoverflow.com/a/35053234/4064189

Copy link
Member

Choose a reason for hiding this comment

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

could you try giving the constraints a priority of 999. This allows them to break temporarily while the height or width is 0

Copy link
Member

Choose a reason for hiding this comment

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

why is this needed?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

whoops!

Copy link
Member

Choose a reason for hiding this comment

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

can we write new files in swift?

Copy link
Member

Choose a reason for hiding this comment

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

also prepare for reuse is missing

Copy link
Member

Choose a reason for hiding this comment

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

^ This really needs to be consistent throughout the app. Can we adjust this in the local network screen as well as part of this PR but in a separate commit?

Copy link
Member

Choose a reason for hiding this comment

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

^

Copy link
Member

Choose a reason for hiding this comment

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

could you try giving the constraints a priority of 999. This allows them to break temporarily while the height or width is 0

Copy link
Member

Choose a reason for hiding this comment

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

separators usually have a height of 1 or 0.5 even why the 2?

Copy link
Contributor Author

@mkchoi212 mkchoi212 Jul 4, 2018

Choose a reason for hiding this comment

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

Figma mockups say 2 but changing it to 1 ended up looking a lot better

Copy link
Member

Choose a reason for hiding this comment

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

this font shouldn't be defined here

Copy link
Member

Choose a reason for hiding this comment

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

switch over the specifier.type

Copy link
Member

Choose a reason for hiding this comment

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

value is too vague can we have a variable instead and a couple of checks that the object that you try to get out of there is really the type that you expect?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

All type checks are done by configureForSpecifier for different types of cells with functions from InAppSettingsKit :D

Copy link
Member

Choose a reason for hiding this comment

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

could we have the entire cell be a touch target and not the switch itself?

@mkchoi212 mkchoi212 force-pushed the settings-view branch 3 times, most recently from 0b5ace7 to c069cf8 Compare July 10, 2018 03:07
@mkchoi212 mkchoi212 force-pushed the settings-view branch 2 times, most recently from c218603 to e3ada4e Compare July 11, 2018 03:27
Copy link
Member

@carolanitz carolanitz left a comment

Choose a reason for hiding this comment

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

This looks already a lot better!!
I checked the PR out and constraints seem to break. I don't think you really need to have a designated xib for that since you just have the two labels in there. You can use the UITableviewCells ones for this. The subclass itself definitely makes sense. I'm not sure if Louis really wants to deviate from the standard cellheight here but if so we will find a simpler solution than creating a xib with a bunch of constraints to accomodate that and that can go into a separate PR as well

Copy link
Member

Choose a reason for hiding this comment

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

can we move the self.tableview.heightForRow = UIDimensionAutomatic here as well?

Copy link
Member

Choose a reason for hiding this comment

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

IASKSpecifier *specifier = [self.settingsReader specifierForIndexPath:indexPath];
Bool cellHasSlider = [specifier.type isEqual: kIASKPSSliderSpecifier];
return cellHasSlider ? nil : indexPath;

would that be more obvious ? We can leave it as is, just as a suggestion :)
Btw seeing the kIASKPSToggleSwitchSpecifier a few lines down as well I wonder if that shouldn't be included here

Copy link
Contributor Author

@mkchoi212 mkchoi212 Jul 13, 2018

Choose a reason for hiding this comment

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

The kIASKPSToggleSwitchSpecifier is to allow users to toggle the switch by pressing the cell. Is this not what you meant by have the entire cell be a touch target and not the switch itself? 🤔

Copy link
Member

Choose a reason for hiding this comment

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

oh yeah you're right if we include it here the event wouldn't go through. can we just make sure that it doesn't get the grey selectionstate when you select the cell?

Copy link
Member

Choose a reason for hiding this comment

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

can we not use the Textlabel and detaillabel from the UItableViewCell ?

Copy link
Member

Choose a reason for hiding this comment

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

that would happen automatically if you use the standard elements

Copy link
Member

Choose a reason for hiding this comment

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

can be removed if the separatorStyle is none

@mkchoi212 mkchoi212 force-pushed the settings-view branch 3 times, most recently from 9302d4a to dbdd06e Compare July 18, 2018 07:39
@carolanitz
Copy link
Member

merged with ff9342f and following

@carolanitz carolanitz closed this Jul 24, 2018
@mkchoi212 mkchoi212 deleted the settings-view branch July 25, 2018 00:58
@mkchoi212
Copy link
Contributor Author

@ALL thanks for all the comments guys! this was a big one :D

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

4 participants