-
Notifications
You must be signed in to change notification settings - Fork 1.3k
revamp iOS settings UI #6389
The head ref may contain hidden characters: "\u{1F4F1}-\u2699-\u{1F6E0}"
revamp iOS settings UI #6389
Conversation
@incanus, thanks for your PR! By analyzing this pull request, we identified @1ec5, @friedbunny and @boundsj to be potential reviewers. |
Grr, of course emoji branch names give Travis trouble. This should be only for core, which this doesn't touch, so I've learned my lesson this time but will let it go for this PR. |
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.
One of the pain points of the current code is that the order is fragile: inserting a new task is prone to off-by-one errors, and Git has a tendency to mangle the order when merging. This PR is an improvement in that the fallout for adding an action is limited to one section rather than the whole list of actions. However, it still relies on literal indices in case statements, which means it’s still fragile around merges. Because -settingsTitlesForSection:
and -performActionForSettingAtIndexPath:
are separate, these switch statements can still get out of sync if we aren’t vigilant.
If I had followed through on the original rewrite of iosapp in #4221 that introduced the storyboard, I probably would’ve put the action table in the storyboard, hooking each static cell up to a separate IBAction. That way, the workflow for adding an action would be:
- Add a cell
- Connect the cell to a new IBAction in the view controller using Connect-to-Source
The IBAction could go anywhere in the source code, and forgetting (2) would just prevent the new action from being functional. There would be a potential for conflicts in the storyboard XML, but conflicts are preferable to botched automerges.
Putting this table in a storyboard can be a future refactor. In the meantime, could you add a mechanism to ensure that the switch statements are in sync, either by replacing the index literals with enum values or adding some assertions?
Makes sense @1ec5, I thought about that but you have have good reasons to make it happen. 👍 |
#6401 tracks the storyboard approach proposed in #6389 (review). |
|
}; | ||
break; | ||
default: | ||
break; |
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.
Should be this an assertion, in case a contributor forgets to add a case here or adds it to the wrong switch statement?
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.
Or a thrown exception?
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.
This is in iosapp, so there’s no need to throw exceptions. If this were SDK code, an exception would be a fine idea.
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.
Handled in the rebased 80079729e8d8fbab67ec08f557f8d4392a77a348.
I think I'm going to pass on:
It should be pretty apparent and this document is more geared towards SDK contributions, not the test app. |
To reiterate, Travis fails here because of the Emoji branch name. Lesson learned. It's all non-Cocoa tests, though, which this PR doesn't impact, so going to proceed with merge anyway. |
@@ -1 +1 @@ | |||
Subproject commit 7cc64b1f32930d0de99381e21dd2cab9f474fa4f | |||
Subproject commit 508d7add9bde4afc9c085ebe1c8395a6c867bf5c |
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.
Revert this.
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.
Whoops.
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.
479919b3cb36ebbd7b7502c6c7ba457e1d5628cb
@@ -11,14 +11,6 @@ | |||
continueAfterRunningActions = "No" | |||
scope = "1" | |||
stopOnStyle = "0"> | |||
<Actions> |
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.
Eh? Probably worth breaking out into a different PR if you don’t like the default (but disabled) breakpoint. 😉
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.
I feel like early on this was something I reversed in master
during this process. I'll take it out of this PR; didn't mean to change anything currently.
Ok, one more time with this 🎪 in 8c5ccff! |
👉 #6421 to avoid Emoji pain. |
This was a bit of a yak shave as a result of getting frustrated starting work on #6379 (adding a new runtime styling action), but I think it's long overdue anyway and helps us scale.
The goal here is a reorganization of our iOS settings UI, which is currently an action sheet and here a modal table view. Here's why:
master
we now have 18-20 (depending ondebugLoggingEnabled
) actions. Even if we cull a few, no matter how we slice it, we're going to have to scroll. Might as well use a UI that's designed for it: a table view. We're probably going to keep adding actions.Manipulate Style
does like eight things, including styling buildings and removing parks, which might not be relevant to the current viewport, making it look like nothing happened.UITableViewController
setup along with making our main app view controller the tabledelegate
anddataSource
. I started down a different route of settings label & action abstraction in a bigass dictionary, but this is cleaner and is what the delegate pattern is designed for./cc @1ec5 @friedbunny @frederoni