[ 
https://issues.apache.org/jira/browse/CB-12937?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16056365#comment-16056365
 ] 

ASF GitHub Bot commented on CB-12937:
-------------------------------------

Github user Giorgioshooter commented on a diff in the pull request:

    https://github.com/apache/cordova-ios/pull/321#discussion_r123078485
  
    --- Diff: CordovaLib/Classes/Public/CDVPlugin.m ---
    @@ -140,6 +142,36 @@ - (void)handleOpenURL:(NSNotification*)notification
         }
     }
     
    +/*
    +    NOTE: calls into JavaScript must not call or trigger any blocking UI, 
like alerts
    + */
    +- (void)handleOpenURLWithApplicationSourceAndAnnotation: 
(NSNotification*)notification
    +{
    +    
    +    // override to handle urls sent to your app
    +    // register your url schemes in your App-Info.plist
    +    
    +    // The notification object is an NSDictionary which contains
    +    // - url which is a type of NSURL
    +    // - sourceApplication which is a type of NSString and represents the 
package
    +    // id of the app that calls our app
    +    // - annotation which a type of Property list which can be several 
different types
    +    // please see 
https://developer.apple.com/library/content/documentation/General/Conceptual/DevPedia-CocoaCore/PropertyList.html
    +    
    +    NSDictionary*  notificationData = [notification object];
    +    
    +    if ([notificationData isKindOfClass: NSDictionary.class]){
    +        
    +        NSURL* url = notificationData[@"url"];
    +        NSString* sourceApplication = 
notificationData[@"sourceApplication"];
    --- End diff --
    
    No problem at all.


> [iOS] Add new CDVPlugin method to handle incoming urls including 
> sourceApplication and annotation
> -------------------------------------------------------------------------------------------------
>
>                 Key: CB-12937
>                 URL: https://issues.apache.org/jira/browse/CB-12937
>             Project: Apache Cordova
>          Issue Type: Improvement
>          Components: cordova-ios
>    Affects Versions: [email protected]
>            Reporter: Georgios Galatoulas
>            Assignee: Shazron Abdullah
>              Labels: easy-fix
>
> The App is currently using the 
> {code}- (BOOL)application:(UIApplication*)application openURL:(NSURL*)url 
> sourceApplication:(NSString*)sourceApplication 
> annotation:(id)annotation{code} 
> to handle incoming URLs.
> However the notification posted with id CDVPluginHandleOpenURLNotification 
> contains only the url. 
> I would like to add alongside the current notification a new notification 
> which posts a NSDictionary instead that contains the url, sourceApplication 
> and annotation and if makes sense I would also like create a new method like 
> the current handleOpenURL which will provide the NSDictionary to however 
> wants to use. 
> I propose this solution because it does not introduce any breaking changes. I 
> hope the impact is small and easy to add to the next release. *The work is 
> already done in my local fork I will just need to create a branch and ask for 
> a pull request if everyone is happy to proceed*.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to