cordova-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From shazron <...@git.apache.org>
Subject [GitHub] cordova-ios pull request #321: CB-12937 - (iOS) added new method handleOpenU...
Date Tue, 20 Jun 2017 19:37:39 GMT
Github user shazron commented on a diff in the pull request:

    https://github.com/apache/cordova-ios/pull/321#discussion_r123074527
  
    --- 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 --
    
    I know it's trivial, but I would add the line where you extract the annotation here as
well, to be complete, for users that rely on looking at source code on how to get at the data
(who usually are not proficient at Obj-C)


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@cordova.apache.org
For additional commands, e-mail: dev-help@cordova.apache.org


Mime
View raw message