Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

[TIMOB-6355] iOS: handleOpenURL support #3842

Closed
wants to merge 1 commit into from

4 participants

@ttsuru

"handleOpenURL" change to "openurl".

Ti.App.addEventListener("openurl", function(e) {
    var url = Ti.App.getArguments()['url'];
    alert(url);
});
@negupta

I did not find a signed CLA in place. Did you sign one?

@jhaynie
Owner

CLA is located at http://bit.ly/app_cla

@ttsuru

Yes. I sign.

@BlainHamon

CR passed, CLA is signed. Awkward question: How do we want to handle documentation? Also, what about an Android version?

@ttsuru

Android do the same thing by receiving Broadcast Intent via Broadcast Receiver so that there's no equivalent method in iOS. For compatibility, you can add method for Android but this ticket is submitted for iOS.

Also I will send you patch for documents, although it takes time because I'm not English speaker.

@negupta

This feature is already available through: Ti.APP.getArguments

Please read documentation for more information: http://docs.appcelerator.com/titanium/latest/#!/api/Titanium.App-method-getArguments

If there are questions about using that functionality, please let us know and we'll be happy to assist.

@negupta negupta closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Feb 5, 2013
  1. @ttsuru
This page is out of date. Refresh to see the latest.
View
8 iphone/Classes/AppModule.m
@@ -389,6 +389,14 @@ -(void)resumed:(id)sender
}
}
+-(void)openurl:(id)sender
+{
+ if ([self _hasListeners:@"openurl"])
+ {
+ [self fireEvent:@"openurl" withObject:nil];
+ }
+}
+
#pragma mark Delegate stuff
-(void)proximityDetectionChanged:(NSNotification*)note
View
1  iphone/Classes/TiApp.m
@@ -315,6 +315,7 @@ - (BOOL)application:(UIApplication *)application handleOpenURL:(NSURL *)url
{
[launchOptions removeObjectForKey:UIApplicationLaunchOptionsURLKey];
[launchOptions setObject:[url absoluteString] forKey:@"url"];
+ [[NSNotificationCenter defaultCenter] postNotificationName:kTiOpenURLNotification object:self];
return YES;
}
View
1  iphone/Classes/TiBase.h
@@ -563,6 +563,7 @@ extern NSString * const kTiSuspendNotification;
extern NSString * const kTiPausedNotification;
extern NSString * const kTiResumeNotification;
extern NSString * const kTiResumedNotification;
+extern NSString * const kTiOpenURLNotification;
extern NSString * const kTiAnalyticsNotification;
extern NSString * const kTiRemoteDeviceUUIDNotification;
extern NSString * const kTiGestureShakeNotification;
View
1  iphone/Classes/TiBase.m
@@ -139,6 +139,7 @@ void TiLogMessage(NSString* str, ...) {
NSString * const kTiPausedNotification = @"TiPaused";
NSString * const kTiResumeNotification = @"TiResume";
NSString * const kTiResumedNotification = @"TiResumed";
+NSString * const kTiOpenURLNotification = @"TiOpenURL";
NSString * const kTiAnalyticsNotification = @"TiAnalytics";
NSString * const kTiRemoteDeviceUUIDNotification = @"TiDeviceUUID";
NSString * const kTiGestureShakeNotification = @"TiGestureShake";
View
6 iphone/Classes/TiModule.h
@@ -83,4 +83,10 @@
*/
-(void)resumed:(id)sender;
+/**
+ Titanium Platform calls this method open url scheme.
+ @param sender The sender of the event.
+ */
+-(void)openurl:(id)sender;
+
@end
View
5 iphone/Classes/TiModule.m
@@ -89,6 +89,10 @@ -(void)resumed:(id)sender
{
}
+-(void)openurl:(id)sender
+{
+}
+
-(void)registerForNotifications
{
WARN_IF_BACKGROUND_THREAD_OBJ; //NSNotificationCenter is not threadsafe!
@@ -97,6 +101,7 @@ -(void)registerForNotifications
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(paused:) name:kTiPausedNotification object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(resume:) name:kTiResumeNotification object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(resumed:) name:kTiResumedNotification object:nil];
+ [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(openurl:) name:kTiOpenURLNotification object:nil];
}
-(void)startup
Something went wrong with that request. Please try again.