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
chore(ios): move application shortcut under Ti.UI.Shortcut to have parity #11697
Conversation
|
Relates to #11759 |
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 think we definitely need some basic unit tests around this.
Probably need to take this: https://github.com/appcelerator/titanium-mobile-mocha-suite/blob/master/Resources/ti.ui.shortcutitem.test.js
Add it to tests/Resources
here and drop the .android
filters on the suite/tests.
I saw, Gary has written unit test case in his PR. I tried to run at my end , it is working fine. Once that PR get merge, I'll update that to run for iOS as well. |
|
||
- (TiUIShortcutItemProxy *)getById:(NSString *)identifier; | ||
|
||
- (void)remove:(TiUIShortcutItemProxy *)shortcut; |
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.
cc @garymathews So this is me really super nit-picking. Personally I always do a double-take on any method that returns void. It offers no direct means of determining what happened, or if something happened. You need to usually poke around the object more to tell if what you wanted to happen actually did.
So in this case, we're really talking about a collection and simply adding/removing elements. I think it'd be useful to know if that actually happened. So I think perhaps in this case a boolean return type may make sense.
For example, what if I pass in a shortcut to remove that was never added in the first place? That should return false and do nothing. What if the collection was already empty, removeAll should return false. Add would likely always return true or stay void - any inability to add a shortcut should more likely be an Error thrown.
You guys don't need to change this, just something to consider. Languages/frameworks are very spotty for something like these operations where a lot return void (Obj-C NSMutableArray), some return booleans (Java List), JS returns the new length of the collection for Array. So it's not a clear consensus. (And in Java's case, add
always returns true
)
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.
@vijaysingh-axway Please copy the tests from @garymathews 's PR for Android (and make them also run on iOS).
@sgtcoolguy Added the tests. |
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.
Just needs updated apidocs
# Conflicts: # apidoc/Titanium/UI/Shortcut.yml # apidoc/Titanium/UI/ShortcutItem.yml # tests/Resources/ti.ui.shortcut.addontest.js # tests/Resources/ti.ui.shortcutitem.test.js
@garymathews In android, As per [doc] (https://github.com/appcelerator/titanium_mobile/blob/a378d21e0e5e2343ea3617941226066d8b48321e/apidoc/Titanium/UI/Shortcut.yml#L53), callback of Ti.UI.Shortcut |
Good catch, I've amended this with #11823 |
manually rebased, squashed down commits, combined with latest unit tests for API and merged to master |
https://jira.appcelerator.org/browse/TIMOB-26818
NOTE - Merge with PR #11759