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
[TIMOB-25842] iOS: Only fire "handleurl" event if listener is added #9910
Conversation
Generated by 🚫 dangerJS |
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.
Still event get fired 3 times.
@vijaysingh-axway I was missing the second part, pushed now. |
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.
CR passed.
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.
FR Passed: handleurl
event is only fired once.
Test steps
- Created a build with the generated zip
- Created a titanium app
- Added the following in to the
app.js
(obtained from: https://jira.appcelerator.org/browse/TIMOB-25842)
var win = Ti.UI.createWindow({
backgroundColor: '#fff'
});
function handleURL(e) {
Ti.API.info('Event 1 triggered!');
}
function handleURL2(e) {
Ti.API.info('Event 2 triggered!');
}
Ti.App.iOS.addEventListener('handleurl', handleURL); // Added - will trigger
Ti.App.iOS.removeEventListener('handleurl', handleURL); // Removed - will NOT trigger anymore
Ti.App.iOS.addEventListener('handleurl', handleURL); // Added - will trigger
Ti.App.iOS.removeEventListener('handleurl', handleURL); // Removed - will NOT trigger anymore
Ti.App.iOS.addEventListener('handleurl', handleURL); // Added - will trigger
Ti.App.iOS.addEventListener('handleurl', handleURL2); // Added - will trigger
win.open();
- Added the following in to the
tiapp.xml
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleURLName</key>
<string>com.ideagen.handleurltest</string>
<key>CFBundleURLSchemes</key>
<array>
<string>handleurltest</string>
</array>
</dict>
</array>
- Ran the program
- Opened a web browser (Safari)
- Entered the following URL
handleurltest://
- Allowed the created application to be opened
- Was able to see the console log output that
handleurl
event only fire once (previously event 1 and 2 would be fired 3 times (7.2.0.v20180501104106))
Please manually launch the application
[INFO] : T2/1.0 (7.2.0.3e9d23aab7)
[INFO] : Event 1 triggered!
[INFO] : Event 2 triggered!
-- End application log -------------------------------------------------------
Test Environment
APPC Studio: 5.0.0.201712081732
APPC CLI: 7.0.3
iphone 6 plus (10.2)
Operating System Name: Mac OS High Sierra
Operating System Version: 10.13
Node.js Version: 8.9.1
Xcode 9.2
JIRA: https://jira.appcelerator.org/browse/TIMOB-25842
no tests
because it's triggered by an async action (handling an external URL).