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

chore(ios): move application shortcut under Ti.UI.Shortcut to have parity #11697

Closed
wants to merge 21 commits into from

Conversation

vijaysingh-axway
Copy link
Contributor

@vijaysingh-axway vijaysingh-axway commented May 9, 2020

@vijaysingh-axway vijaysingh-axway added hold for parity ✋ This PR should not be merged until an equivalent PR is ready for the other platform(s) improvement ios labels May 9, 2020
@build build added this to the 9.1.0 milestone May 9, 2020
@build build requested a review from a team May 9, 2020 00:25
@build
Copy link
Contributor

build commented May 9, 2020

Messages
📖

💾 Here's the generated SDK zipfile.

📖 ✊ The commits in this PR match our conventions! Feel free to Rebase and Merge this PR when ready.
📖

✅ All tests are passing
Nice one! All 6810 tests are passing.
(There are 700 skipped tests not included in that total)

Generated by 🚫 dangerJS against 53cac84

@sgtcoolguy
Copy link
Contributor

Relates to #11759

Copy link
Contributor

@sgtcoolguy sgtcoolguy left a 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.

iphone/Classes/TiUIShortcutProxy.h Outdated Show resolved Hide resolved
iphone/Classes/TiUIShortcutProxy.h Outdated Show resolved Hide resolved
iphone/Classes/TiUIShortcutProxy.h Outdated Show resolved Hide resolved
iphone/Classes/TiUIShortcutProxy.h Outdated Show resolved Hide resolved
iphone/Classes/TiUIShortcutProxy.h Outdated Show resolved Hide resolved
iphone/Classes/TiUIShortcutItemProxy.h Outdated Show resolved Hide resolved
iphone/Classes/TiUIShortcutItemProxy.m Outdated Show resolved Hide resolved
iphone/Classes/TiUIShortcutItemProxy.m Outdated Show resolved Hide resolved
iphone/Classes/TiUIShortcutItemProxy.m Show resolved Hide resolved
iphone/Classes/TiUIiOSProxy.m Show resolved Hide resolved
@vijaysingh-axway
Copy link
Contributor Author

vijaysingh-axway commented Jun 11, 2020

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.

@build build added the docs label Jun 11, 2020

- (TiUIShortcutItemProxy *)getById:(NSString *)identifier;

- (void)remove:(TiUIShortcutItemProxy *)shortcut;
Copy link
Contributor

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)

@sgtcoolguy sgtcoolguy self-requested a review June 16, 2020 17:35
Copy link
Contributor

@sgtcoolguy sgtcoolguy left a 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).

@vijaysingh-axway
Copy link
Contributor Author

@vijaysingh-axway Please copy the tests from @garymathews 's PR for Android (and make them also run on iOS).

@sgtcoolguy Added the tests.
'remove' test case has been updated a bit. Reason is that 'remove' test case get finished before 'add'. In that case shortcut count get mismatched. While resolving merge conflict 'remove' test case from this PR need to be taken.

@vijaysingh-axway vijaysingh-axway removed the hold for parity ✋ This PR should not be merged until an equivalent PR is ready for the other platform(s) label Jul 2, 2020
@sgtcoolguy sgtcoolguy self-requested a review July 10, 2020 18:44
Copy link
Contributor

@sgtcoolguy sgtcoolguy left a 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

iphone/Classes/TiUIShortcutItemProxy.h Show resolved Hide resolved
iphone/Classes/TiUIShortcutItemProxy.m Outdated Show resolved Hide resolved
iphone/Classes/TiUIShortcutItemProxy.h Show resolved Hide resolved
iphone/Classes/TiUIShortcutItemProxy.m Outdated Show resolved Hide resolved
# 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
@vijaysingh-axway
Copy link
Contributor Author

@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 click event should give 'item' property which should be Ti.UI.ShortcutItem, which is expected behavior as well.
But in example code here, you are using 'e.id' instead of 'e.item.id' to log shortcut id. Is this documentation issue or android has implemented in this way?
cc @sgtcoolguy @jquick-axway .

@garymathews
Copy link
Contributor

@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 click event should give 'item' property which should be Ti.UI.ShortcutItem, which is expected behavior as well.
But in example code here, you are using 'e.id' instead of 'e.item.id' to log shortcut id. Is this documentation issue or android has implemented in this way?
cc @sgtcoolguy @jquick-axway .

Good catch, I've amended this with #11823

@sgtcoolguy
Copy link
Contributor

manually rebased, squashed down commits, combined with latest unit tests for API and merged to master

@sgtcoolguy sgtcoolguy closed this Jul 17, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants