-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(ios): callback not invoked if missing options dictionary in Ti.Pl…
…atform.openURL (#11655) Fixes TIMOB-27861
- Loading branch information
1 parent
707259b
commit 19fc45d
Showing
7 changed files
with
84 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
iphone/TitaniumKit/TitaniumKit/Sources/API/JSValue+Addons.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
/** | ||
* Appcelerator Titanium Mobile | ||
* Copyright (c) 2018-Present by Appcelerator, Inc. All Rights Reserved. | ||
* Licensed under the terms of the Apache Public License | ||
* Please see the LICENSE included with this distribution for details. | ||
*/ | ||
|
||
#import <JavaScriptCore/JavaScriptCore.h> | ||
|
||
NS_ASSUME_NONNULL_BEGIN | ||
|
||
@interface JSValue (Addons) | ||
|
||
@property (readonly) BOOL isFunction; | ||
|
||
@end | ||
|
||
NS_ASSUME_NONNULL_END |
26 changes: 26 additions & 0 deletions
26
iphone/TitaniumKit/TitaniumKit/Sources/API/JSValue+Addons.m
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
/** | ||
* Appcelerator Titanium Mobile | ||
* Copyright (c) 2018-Present by Appcelerator, Inc. All Rights Reserved. | ||
* Licensed under the terms of the Apache Public License | ||
* Please see the LICENSE included with this distribution for details. | ||
*/ | ||
|
||
#import "JSValue+Addons.h" | ||
|
||
@implementation JSValue (Addons) | ||
|
||
- (BOOL)isFunction | ||
{ | ||
if (!self.isObject) { | ||
return NO; | ||
} | ||
|
||
JSContextRef context = self.context.JSGlobalContextRef; | ||
JSObjectRef object = JSValueToObject(context, self.JSValueRef, NULL); | ||
if (object == NULL) { | ||
return NO; | ||
} | ||
return JSObjectIsFunction(context, object); | ||
} | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
/* | ||
* Appcelerator Titanium Mobile | ||
* Copyright (c) 2011-Present by Appcelerator, Inc. All Rights Reserved. | ||
* Licensed under the terms of the Apache Public License | ||
* Please see the LICENSE included with this distribution for details. | ||
*/ | ||
/* eslint-env mocha */ | ||
/* eslint no-unused-expressions: "off" */ | ||
'use strict'; | ||
var should = require('./utilities/assertions'), | ||
utilities = require('./utilities/utilities'); | ||
|
||
describe('Titanium.Platform', function () { | ||
|
||
it.ios('#openURL(url, callback)', function (finish) { | ||
Ti.Platform.openURL('randomapp://', e => finish()); | ||
}); | ||
|
||
it.ios('#openURL(url, options, callback)', function (finish) { | ||
Ti.Platform.openURL('randomapp://', {}, e => finish()); | ||
}); | ||
|
||
}); |