Skip to content

Commit

Permalink
Merge pull request #9910 from hansemannn/TIMOB-25842
Browse files Browse the repository at this point in the history
[TIMOB-25842] iOS: Only fire "handleurl" event if listener is added
  • Loading branch information
ssjsamir committed May 22, 2018
2 parents ce9db15 + ec13e1f commit bb7f11f
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions iphone/Classes/TiAppiOSProxy.m
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,9 @@ - (void)_listenerRemoved:(NSString *)type count:(int)count
if (count == 0 && [type isEqual:@"remotenotificationaction"]) {
[[NSNotificationCenter defaultCenter] removeObserver:self name:kTiRemoteNotificationAction object:nil];
}
if ((count == 0) && [type isEqual:@"handleurl"]) {
[[NSNotificationCenter defaultCenter] removeObserver:self name:kTiApplicationLaunchedFromURL object:nil];
}

if ((count == 1) && [type isEqual:@"backgroundfetch"]) {
[[NSNotificationCenter defaultCenter] removeObserver:self name:kTiBackgroundFetchNotification object:nil];
Expand All @@ -160,7 +163,6 @@ - (void)_listenerRemoved:(NSString *)type count:(int)count
if ((count == 1) && [type isEqual:@"uploadprogress"]) {
[[NSNotificationCenter defaultCenter] removeObserver:self name:kTiURLUploadProgress object:nil];
}

if ((count == 1) && [type isEqual:@"usernotificationsetting"]) {
[[NSNotificationCenter defaultCenter] removeObserver:self name:kTiUserNotificationSettingsNotification object:nil];
}
Expand All @@ -170,7 +172,6 @@ - (void)_listenerRemoved:(NSString *)type count:(int)count
if ((count == 1) && [type isEqual:@"continueactivity"]) {
[[NSNotificationCenter defaultCenter] removeObserver:self name:kTiContinueActivity object:nil];
}

if ([TiUtils isIOS9OrGreater]) {
if ((count == 1) && [type isEqual:@"shortcutitemclick"]) {
[[NSNotificationCenter defaultCenter] removeObserver:self name:kTiApplicationShortcut object:nil];
Expand Down Expand Up @@ -201,6 +202,10 @@ - (void)didReceiveApplicationShortcutNotification:(NSNotification *)info

- (void)didHandleURL:(NSNotification *)info
{
if (![self _hasListeners:@"handleurl"]) {
return;
}

[self fireEvent:@"handleurl"
withObject:@{
@"launchOptions" : [info userInfo]
Expand Down

0 comments on commit bb7f11f

Please sign in to comment.