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

[TIMOB-25842] iOS: Only fire "handleurl" event if listener is added #9910

Merged
merged 9 commits into from May 22, 2018

Conversation

hansemannn
Copy link
Collaborator

@hansemannn hansemannn commented Mar 6, 2018

JIRA: https://jira.appcelerator.org/browse/TIMOB-25842

no tests because it's triggered by an async action (handling an external URL).

@hansemannn hansemannn added the bug label Mar 6, 2018
@build build added the ios label Mar 6, 2018
@build
Copy link
Contributor

build commented Mar 6, 2018

Messages
📖

💾 Here's the generated SDK zipfile.

Generated by 🚫 dangerJS

Copy link
Contributor

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

@hansemannn
Copy link
Collaborator Author

@vijaysingh-axway I was missing the second part, pushed now.

@build build added the ios label Mar 7, 2018
Copy link
Contributor

@vijaysingh-axway vijaysingh-axway left a comment

Choose a reason for hiding this comment

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

CR passed.

@sgtcoolguy sgtcoolguy modified the milestones: 7.2.0, 7.3.0 May 16, 2018
@ssjsamir ssjsamir self-requested a review May 22, 2018 15:26
Copy link
Contributor

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

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

@ssjsamir ssjsamir merged commit bb7f11f into tidev:master May 22, 2018
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

5 participants